Bluetooth: Start implementing BTPROTO_HCI socket support

Signed-off-by: Brennan Ashton <bashton@brennanashton.com>
This commit is contained in:
Brennan Ashton
2020-08-28 14:51:26 -07:00
parent 3098b61776
commit 1080d3f411
5 changed files with 302 additions and 82 deletions
+29 -1
View File
@@ -120,6 +120,30 @@ static struct work_s g_hp_work;
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: bt_send
*
* Description:
* Add the provided buffer 'buf' to the head selected buffer list 'list'
*
* Input Parameters:
* btdev - An instance of the low-level drivers interface structure.
* buf - The buffer to be sent by the driver
*
* Returned Value:
* Zero is returned on success; a negated errno value is returned on any
* failure.
*
****************************************************************************/
static int bt_send(FAR const struct bt_driver_s *btdev,
FAR struct bt_buf_s *buf)
{
/* TODDO: Hook here to notify hci monitor */
return btdev->send(btdev, buf);
}
/****************************************************************************
* Name: bt_enqueue_bufwork
*
@@ -1049,6 +1073,8 @@ static void hci_rx_work(FAR void *arg)
{
wlinfo("buf %p type %u len %u\n", buf, buf->type, buf->len);
/* TODO: Hook monitor callback */
switch (buf->type)
{
case BT_ACL_IN:
@@ -1096,6 +1122,8 @@ static void priority_rx_work(FAR void *arg)
wlinfo("buf %p type %u len %u\n", buf, buf->type, buf->len);
/* TODO: Hook monitor callback */
if (buf->type != BT_EVT)
{
wlerr("Unknown buf type %u\n", buf->type);
@@ -1684,7 +1712,7 @@ int bt_hci_cmd_send(uint16_t opcode, FAR struct bt_buf_s *buf)
if (opcode == BT_HCI_OP_HOST_NUM_COMPLETED_PACKETS)
{
g_btdev.btdev->send(g_btdev.btdev, buf);
bt_send(g_btdev.btdev, buf);
bt_buf_release(buf);
return 0;
}