Bluetooth: Enable controller to host flow control in HCI init
To start supporting controller to host flow control we need to tell the controller our supported packet count & MTU and send the enabling HCI command. This patch does the necessary addition to the HCI init procedure. Change-Id: I51a66f8cc3a85782a5085f9aae0f4aeb59decad3 Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
parent
25af03265c
commit
39a6c7df9b
2 changed files with 32 additions and 0 deletions
|
@ -81,6 +81,16 @@ struct bt_hci_cp_set_event_mask {
|
|||
|
||||
#define BT_HCI_OP_RESET BT_OP(BT_OGF_BASEBAND, 0x0003)
|
||||
|
||||
#define BT_HCI_OP_SET_CTL_TO_HOST_FLOW BT_OP(BT_OGF_BASEBAND, 0x0031)
|
||||
|
||||
#define BT_HCI_OP_HOST_BUFFER_SIZE BT_OP(BT_OGF_BASEBAND, 0x0033)
|
||||
struct bt_hci_cp_host_buffer_size {
|
||||
uint16_t acl_mtu;
|
||||
uint8_t sco_mtu;
|
||||
uint16_t acl_pkts;
|
||||
uint16_t sco_pkts;
|
||||
} PACK_STRUCT;
|
||||
|
||||
#define BT_HCI_OP_LE_WRITE_LE_HOST_SUPP BT_OP(BT_OGF_BASEBAND, 0x006d)
|
||||
struct bt_hci_cp_write_le_host_supp {
|
||||
uint8_t le;
|
||||
|
|
|
@ -505,8 +505,10 @@ static void hci_rx_fiber(void)
|
|||
|
||||
static int hci_init(void)
|
||||
{
|
||||
struct bt_hci_cp_host_buffer_size *hbs;
|
||||
struct bt_hci_cp_set_event_mask *ev;
|
||||
struct bt_buf *buf;
|
||||
uint8_t *enable;
|
||||
|
||||
/* Send HCI_RESET */
|
||||
bt_hci_cmd_send(BT_HCI_OP_RESET, NULL);
|
||||
|
@ -554,6 +556,26 @@ static int hci_init(void)
|
|||
|
||||
bt_hci_cmd_send_sync(BT_HCI_OP_SET_EVENT_MASK, buf);
|
||||
|
||||
buf = bt_hci_cmd_create(BT_HCI_OP_HOST_BUFFER_SIZE, sizeof(*hbs));
|
||||
if (!buf)
|
||||
return -ENOBUFS;
|
||||
|
||||
hbs = (void *)bt_buf_add(buf, sizeof(*hbs));
|
||||
memset(hbs, 0, sizeof(*hbs));
|
||||
hbs->acl_mtu = sys_cpu_to_le16(BT_BUF_MAX_DATA -
|
||||
sizeof(struct bt_hci_acl_hdr));
|
||||
hbs->acl_pkts = sys_cpu_to_le16(ACL_IN_MAX);
|
||||
|
||||
bt_hci_cmd_send(BT_HCI_OP_HOST_BUFFER_SIZE, buf);
|
||||
|
||||
buf = bt_hci_cmd_create(BT_HCI_OP_SET_CTL_TO_HOST_FLOW, 1);
|
||||
if (!buf)
|
||||
return -ENOBUFS;
|
||||
|
||||
enable = (void *)bt_buf_add(buf, sizeof(*enable));
|
||||
*enable = 0x01;
|
||||
bt_hci_cmd_send(BT_HCI_OP_SET_CTL_TO_HOST_FLOW, buf);
|
||||
|
||||
if (lmp_bredr_capable(dev)) {
|
||||
struct bt_hci_cp_write_le_host_supp *cp;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue