[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bluetooth-dev] Can anybody help to explain the following code?




Hi,

In HCI.c file, Axis stack has the following code (inside function
"hci_receive_data(u8* data, u32 count)"):

void hci_receive_data(u8* data, u32 count)
{
	case WAIT_FOR_ACL_HDR:
		.....
		if (pb_flag == L2CAP_FRAME_START) {
			D_REC(__FUNCTION__ ": New frame\n");
			in_buf = get_free_inbuffer();
			if (in_buf) {
				in_buf->nbr_of_hci_pkt = 1;
				in_buf->hci_hdl = hci_hdl;
			}

		case WAIT_FOR_ACL_DATA:
			D_STATE(__FUNCTION__ ": WAIT_FOR_ACL_DATA\n");
		....
			c = MIN(count, data_len - tmp_pos);
			if (in_buf) {
				memcpy(in_buf->buf_ptr, buf, c);
				in_buf->buf_ptr += c;
				in_buf->count += c;
				D_REC(__FUNCTION__ ": in_buf->count =
%d\n",in_buf->count);
			}		
}

If my understanding is correct, "in_buf->buf_ptr" is not initialized before
it is used for the FISRT ACL packet!!!!! I have looked at the code, and it
is initialized only inside "hci_clear_buffer" function, which is called
within function "l2cap_receive_data". Actually function "l2cap_receive_data"
is called after the "in_buf->buf_ptr" is used!!!!

regards,

XiaoGuo
-
To unsubscribe from this list: send the line "unsubscribe bluetooth-dev" in
the body of a message to majordomo@xxxxxxx.com