mirror of
https://github.com/apache/nuttx.git
synced 2026-06-05 07:12:54 +08:00
wireless/bluetooth: A few trivial fixes from initial testing with the simulator. The simulated Bluetooth device is probably going to be in adequate for any level of testing.
This commit is contained in:
@@ -322,6 +322,7 @@ FAR struct bt_buf_s *bt_buf_alloc(enum bt_buf_type_e type,
|
||||
* allocated buffer structure.
|
||||
*/
|
||||
|
||||
memset(buf, 0, sizeof(struct bt_buf_s));
|
||||
buf->pool = pool;
|
||||
buf->ref = 1;
|
||||
buf->type = type;
|
||||
@@ -347,7 +348,6 @@ FAR struct bt_buf_s *bt_buf_alloc(enum bt_buf_type_e type,
|
||||
* available buffers.
|
||||
*/
|
||||
|
||||
memset(buf, 0, sizeof(struct bt_buf_s));
|
||||
buf->frame = iob_alloc(false);
|
||||
if (!buf->frame)
|
||||
{
|
||||
@@ -368,6 +368,7 @@ FAR struct bt_buf_s *bt_buf_alloc(enum bt_buf_type_e type,
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: bt_buf_release
|
||||
*
|
||||
|
||||
@@ -221,7 +221,7 @@ static void hci_cmd_done(uint16_t opcode, uint8_t status,
|
||||
|
||||
/* If the command was synchronous wake up bt_hci_cmd_send_sync() */
|
||||
|
||||
if (sent->u.hci.sync)
|
||||
if (sent->u.hci.sync != NULL)
|
||||
{
|
||||
FAR sem_t *sem = sent->u.hci.sync;
|
||||
|
||||
@@ -871,7 +871,7 @@ static int hci_tx_kthread(int argc, FAR char *argv[])
|
||||
|
||||
g_btdev.ncmd = 0;
|
||||
|
||||
wlinfo("Sending command %x (buf %p) to driver\n",
|
||||
wlinfo("Sending command %04x buf %p to driver\n",
|
||||
buf->u.hci.opcode, buf);
|
||||
|
||||
dev->send(dev, buf);
|
||||
@@ -994,7 +994,7 @@ static void le_read_buffer_size_complete(FAR struct bt_buf_s *buf)
|
||||
g_btdev.le_pkts = rp->le_max_num;
|
||||
}
|
||||
|
||||
static int hci_init(void)
|
||||
static int hci_initialize(void)
|
||||
{
|
||||
FAR struct bt_hci_cp_host_buffer_size_s *hbs;
|
||||
FAR struct bt_hci_cp_set_event_mask_s *ev;
|
||||
@@ -1257,7 +1257,7 @@ int bt_initialize(void)
|
||||
return err;
|
||||
}
|
||||
|
||||
err = hci_init();
|
||||
err = hci_initialize();
|
||||
if (err)
|
||||
{
|
||||
return err;
|
||||
@@ -1452,7 +1452,7 @@ int bt_hci_cmd_send_sync(uint16_t opcode, FAR struct bt_buf_s *buf,
|
||||
* back the blocking semaphore.
|
||||
*/
|
||||
|
||||
if (!buf)
|
||||
if (buf == NULL)
|
||||
{
|
||||
buf = bt_hci_cmd_create(opcode, 0);
|
||||
if (!buf)
|
||||
@@ -1486,7 +1486,7 @@ int bt_hci_cmd_send_sync(uint16_t opcode, FAR struct bt_buf_s *buf,
|
||||
|
||||
if (ret >= 0)
|
||||
{
|
||||
if (!buf->u.hci.sync)
|
||||
if (buf->u.hci.sync == NULL)
|
||||
{
|
||||
ret = -EIO;
|
||||
}
|
||||
|
||||
@@ -980,7 +980,7 @@ static int btnet_properties(FAR struct radio_driver_s *netdev,
|
||||
* IPv6 or AF_BLUETOOTH socket.
|
||||
*
|
||||
* This function should be called only once from board bring-up logic
|
||||
* before any Bluetooth devices are registered.
|
||||
* *AFTER* any Bluetooth devices have been registered.
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
|
||||
@@ -151,6 +151,7 @@ int bt_queue_receive(mqd_t mqd, FAR struct bt_buf_s **buf)
|
||||
|
||||
/* Wait for the next message */
|
||||
|
||||
u.msg.buf = NULL;
|
||||
msgsize = nxmq_receive(mqd, u.msgbuf, BT_MSGSIZE, &priority);
|
||||
if (msgsize < 0)
|
||||
{
|
||||
@@ -163,7 +164,7 @@ int bt_queue_receive(mqd_t mqd, FAR struct bt_buf_s **buf)
|
||||
*/
|
||||
|
||||
DEBUGASSERT(msgsize == sizeof(struct bt_bufmsg_s));
|
||||
DEBUGASSERT(u.msg.buf->frame != NULL);
|
||||
DEBUGASSERT(u.msg.buf != NULL && u.msg.buf->frame != NULL);
|
||||
|
||||
/* Return the buffer */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user