Hi,
--- Quote Start ---
Thank you so much for your information. It's really very helpful for me. Currently I'm just successfully created a normal zImage after suffering for quite a long time. Later I will try to include the bluetooth driver in the kernel. Looking forward for your new post on the test case. :-)
--- Quote End ---
Before to compile the kernel, please revise the codes
static void l2cap_add_conf_opt(void **ptr, u8 type, u8 len, unsigned long val)
{
struct l2cap_conf_opt *opt = *ptr;
BT_DBG("type 0x%2.2x len %d val 0x%lx", type, len, val);
opt->type = type;
opt->len = len;
// switch (len) {
// case 1:
// *((u8 *) opt->val) = val;
// break;
//
// case 2:
// *((__le16 *) opt->val) = cpu_to_le16(val);
// break;
//
// case 4:
// *((__le32 *) opt->val) = cpu_to_le32(val);
// break;
//
// default:
// memcpy(opt->val, (void *) &val, len);
// break;
// }
memcpy(opt->val, (void *) &val, len);
*ptr += L2CAP_CONF_OPT_SIZE + len;
}
in the file 'l2cap(_core).c' and
/*
* Only data is little endian, addr has cpu endianess
*/
static void hpi_write_words_le16(struct c67x00_device *dev, u16 addr,
__le16 *data, u16 count)
{
unsigned long flags;
int i;
spin_lock_irqsave(&dev->hpi.lock, flags);
hpi_write_reg(dev, HPI_ADDR, addr);
if ((unsigned long)data & 0x1) {
u8 *tmp_p;
u16 tmp_d;
for (i = 0; i < count; i++, data++) {
tmp_p = (u8 *)data;
tmp_d = *tmp_p | (*(tmp_p+1) << 8);
hpi_write_reg(dev, HPI_DATA, tmp_d);
}
} else
for (i = 0; i < count; i++)
hpi_write_reg(dev, HPI_DATA, le16_to_cpu(*data++));
spin_unlock_irqrestore(&dev->hpi.lock, flags);
}
/*
* Only data is little endian, addr has cpu endianess
*/
static void hpi_read_words_le16(struct c67x00_device *dev, u16 addr,
__le16 *data, u16 count)
{
unsigned long flags;
int i;
spin_lock_irqsave(&dev->hpi.lock, flags);
hpi_write_reg(dev, HPI_ADDR, addr);
if ((unsigned long)data & 0x1) {
u8 *tmp_p;
u16 tmp_d;
for (i = 0; i < count; i++, data++) {
tmp_d = cpu_to_le16(hpi_read_reg(dev, HPI_DATA));
tmp_p = (u8 *)data;
*tmp_p = (u8)tmp_d;
*(tmp_p+1) = (u8)(tmp_d >> 8);
}
} else
for (i = 0; i < count; i++)
*data++ = cpu_to_le16(hpi_read_reg(dev, HPI_DATA));
spin_unlock_irqrestore(&dev->hpi.lock, flags);
}
in the file 'c67x00-ll-hpi.c', because Nios2 CPU can't do unaligned memory accesses.
--- Quote Start ---
But at the software side, do you have any reference that I can learn and refer to? at the current stage, I'm just able to build the image, but have no idea on the software side.
--- Quote End ---
From the view point of the software side, I think that the easiest way is to use 'BlueZ'.
http://www.bluez.org/ But this tool uses Python scripts, so you need a Python interpreter and many modules.
Kazu