Bluetooth: userchan: Add support for ISO packets

This adds supports for ISO packets so then can be transmitted and
received with userchan driver.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
Luiz Augusto von Dentz 2020-05-12 13:34:31 -07:00 committed by Carles Cufí
commit f93c4dece0

View file

@ -46,6 +46,7 @@ struct sockaddr_hci {
#define H4_ACL 0x02
#define H4_SCO 0x03
#define H4_EVT 0x04
#define H4_ISO 0x05
static K_KERNEL_STACK_DEFINE(rx_thread_stack,
CONFIG_ARCH_POSIX_RECOMMENDED_STACK_SIZE);
@ -57,11 +58,21 @@ static int bt_dev_index = -1;
static struct net_buf *get_rx(const uint8_t *buf)
{
if (buf[0] == H4_EVT) {
switch (buf[0]) {
case H4_EVT:
return bt_buf_get_evt(buf[1], false, K_FOREVER);
case H4_ACL:
return bt_buf_get_rx(BT_BUF_ACL_IN, K_FOREVER);
case H4_ISO:
if (IS_ENABLED(CONFIG_BT_ISO)) {
return bt_buf_get_rx(BT_BUF_ISO_IN, K_FOREVER);
}
__fallthrough;
default:
BT_ERR("Unknown packet type: %u", buf[0]);
}
return bt_buf_get_rx(BT_BUF_ACL_IN, K_FOREVER);
return NULL;
}
static bool uc_ready(void)
@ -131,6 +142,12 @@ static int uc_send(struct net_buf *buf)
case BT_BUF_CMD:
net_buf_push_u8(buf, H4_CMD);
break;
case BT_BUF_ISO_OUT:
if (IS_ENABLED(CONFIG_BT_ISO)) {
net_buf_push_u8(buf, H4_ISO);
break;
}
__fallthrough;
default:
BT_ERR("Unknown buffer type");
return -EINVAL;