Bluetooth: controller: HCI stubs for BIG commands
Adds initial HCI stubs for the BIG commands to be used for broadcast isochronous channels. Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
parent
07009701c4
commit
68153f048d
|
@ -1450,6 +1450,24 @@ struct bt_hci_cp_le_create_big {
|
|||
} __packed;
|
||||
|
||||
#define BT_HCI_OP_LE_CREATE_BIG_TEST BT_OP(BT_OGF_LE, 0x0069)
|
||||
struct bt_hci_cp_le_create_big_test {
|
||||
uint8_t big_handle;
|
||||
uint8_t adv_handle;
|
||||
uint8_t num_bis;
|
||||
uint8_t sdu_interval[3];
|
||||
uint16_t iso_interval;
|
||||
uint8_t nse;
|
||||
uint16_t max_sdu;
|
||||
uint16_t max_pdu;
|
||||
uint8_t phy;
|
||||
uint8_t packing;
|
||||
uint8_t framing;
|
||||
uint8_t bn;
|
||||
uint8_t irc;
|
||||
uint8_t pto;
|
||||
uint8_t encryption;
|
||||
uint8_t bcode[16];
|
||||
} __packed;
|
||||
|
||||
#define BT_HCI_OP_LE_TERMINATE_BIG BT_OP(BT_OGF_LE, 0x006a)
|
||||
struct bt_hci_cp_le_terminate_big {
|
||||
|
@ -2059,6 +2077,23 @@ struct bt_hci_evt_le_req_peer_sca_complete {
|
|||
uint8_t sca;
|
||||
} __packed;
|
||||
|
||||
#define BT_HCI_EVT_LE_BIGINFO_ADV_REPORT 0x22
|
||||
struct bt_hci_evt_le_biginfo_adv_report {
|
||||
uint16_t sync_handle;
|
||||
uint8_t num_bis;
|
||||
uint8_t nse;
|
||||
uint16_t iso_interval;
|
||||
uint8_t bn;
|
||||
uint8_t pto;
|
||||
uint8_t irc;
|
||||
uint16_t max_pdu;
|
||||
uint8_t sdu_interval[3];
|
||||
uint16_t max_sdu;
|
||||
uint8_t phy;
|
||||
uint8_t framing;
|
||||
uint8_t encryption;
|
||||
} __packed;
|
||||
|
||||
/* Event mask bits */
|
||||
|
||||
#define BT_EVT_BIT(n) (1ULL << (n))
|
||||
|
@ -2141,8 +2176,13 @@ struct bt_hci_evt_le_req_peer_sca_complete {
|
|||
#define BT_EVT_MASK_LE_CIS_ESTABLISHED BT_EVT_BIT(24)
|
||||
#define BT_EVT_MASK_LE_CIS_REQ BT_EVT_BIT(25)
|
||||
#define BT_EVT_MASK_LE_BIG_COMPLETE BT_EVT_BIT(26)
|
||||
#define BT_EVT_MASK_LE_BIG_SYNC_LOST BT_EVT_BIT(27)
|
||||
#define BT_EVT_MASK_LE_REQ_PEER_SCA_COMPLETE BT_EVT_BIT(28)
|
||||
#define BT_EVT_MASK_LE_BIG_TERMINATED BT_EVT_BIT(27)
|
||||
#define BT_EVT_MASK_LE_BIG_SYNC_ESTABLISHED BT_EVT_BIT(28)
|
||||
#define BT_EVT_MASK_LE_BIG_SYNC_LOST BT_EVT_BIT(29)
|
||||
#define BT_EVT_MASK_LE_REQ_PEER_SCA_COMPLETE BT_EVT_BIT(30)
|
||||
#define BT_EVT_MASK_LE_PATH_LOSS_THRESHOLD BT_EVT_BIT(31)
|
||||
#define BT_EVT_MASK_LE_TRANSMIT_POWER_REPORTING BT_EVT_BIT(32)
|
||||
#define BT_EVT_MASK_LE_BIGINFO_ADV_REPORT BT_EVT_BIT(33)
|
||||
|
||||
/** Allocate a HCI command buffer.
|
||||
*
|
||||
|
|
|
@ -34,6 +34,9 @@ if(CONFIG_BT_LL_SW_SPLIT)
|
|||
CONFIG_BT_CTLR_ADV_PERIODIC
|
||||
ll_sw/ull_adv_sync.c
|
||||
)
|
||||
zephyr_library_sources(
|
||||
ll_sw/ull_adv_iso.c
|
||||
)
|
||||
endif()
|
||||
if(CONFIG_BT_OBSERVER)
|
||||
zephyr_library_sources(
|
||||
|
@ -47,6 +50,9 @@ if(CONFIG_BT_LL_SW_SPLIT)
|
|||
CONFIG_BT_CTLR_SYNC_PERIODIC
|
||||
ll_sw/ull_sync.c
|
||||
)
|
||||
zephyr_library_sources(
|
||||
ll_sw/ull_sync_iso.c
|
||||
)
|
||||
endif()
|
||||
if(CONFIG_BT_CONN)
|
||||
zephyr_library_sources(
|
||||
|
|
|
@ -1066,6 +1066,60 @@ static void le_set_adv_enable(struct net_buf *buf, struct net_buf **evt)
|
|||
|
||||
*evt = cmd_complete_status(status);
|
||||
}
|
||||
|
||||
static void le_create_big(struct net_buf *buf, struct net_buf **evt)
|
||||
{
|
||||
struct bt_hci_cp_le_create_big *cmd = (void *)buf->data;
|
||||
uint8_t status;
|
||||
uint32_t sdu_interval;
|
||||
uint16_t max_sdu;
|
||||
uint16_t max_latency;
|
||||
|
||||
sdu_interval = sys_get_le24(cmd->sdu_interval);
|
||||
max_sdu = sys_le16_to_cpu(cmd->max_sdu);
|
||||
max_latency = sys_le16_to_cpu(cmd->max_latency);
|
||||
|
||||
status = ll_big_create(cmd->big_handle, cmd->adv_handle, cmd->num_bis,
|
||||
sdu_interval, max_sdu, max_latency, cmd->rtn,
|
||||
cmd->phy, cmd->packing, cmd->framing,
|
||||
cmd->encryption, cmd->bcode);
|
||||
|
||||
*evt = cmd_status(status);
|
||||
}
|
||||
|
||||
static void le_create_big_test(struct net_buf *buf, struct net_buf **evt)
|
||||
{
|
||||
struct bt_hci_cp_le_create_big_test *cmd = (void *)buf->data;
|
||||
uint8_t status;
|
||||
uint32_t sdu_interval;
|
||||
uint16_t iso_interval;
|
||||
uint16_t max_sdu;
|
||||
uint16_t max_pdu;
|
||||
|
||||
sdu_interval = sys_get_le24(cmd->sdu_interval);
|
||||
iso_interval = sys_le16_to_cpu(cmd->iso_interval);
|
||||
max_sdu = sys_le16_to_cpu(cmd->max_sdu);
|
||||
max_pdu = sys_le16_to_cpu(cmd->max_pdu);
|
||||
|
||||
status = ll_big_test_create(cmd->big_handle, cmd->adv_handle,
|
||||
cmd->num_bis, sdu_interval, iso_interval,
|
||||
cmd->nse, max_sdu, max_pdu, cmd->phy,
|
||||
cmd->packing, cmd->framing, cmd->bn,
|
||||
cmd->irc, cmd->pto, cmd->encryption,
|
||||
cmd->bcode);
|
||||
|
||||
*evt = cmd_status(status);
|
||||
}
|
||||
|
||||
static void le_terminate_big(struct net_buf *buf, struct net_buf **evt)
|
||||
{
|
||||
struct bt_hci_cp_le_terminate_big *cmd = (void *)buf->data;
|
||||
uint8_t status;
|
||||
|
||||
status = ll_big_terminate(cmd->big_handle, cmd->reason);
|
||||
|
||||
*evt = cmd_status(status);
|
||||
}
|
||||
#endif /* CONFIG_BT_BROADCASTER */
|
||||
|
||||
#if defined(CONFIG_BT_OBSERVER)
|
||||
|
@ -1112,6 +1166,34 @@ static void le_set_scan_enable(struct net_buf *buf, struct net_buf **evt)
|
|||
|
||||
*evt = cmd_complete_status(status);
|
||||
}
|
||||
|
||||
static void le_big_create_sync(struct net_buf *buf, struct net_buf **evt)
|
||||
{
|
||||
struct bt_hci_cp_le_big_create_sync *cmd = (void *)buf->data;
|
||||
uint8_t status;
|
||||
uint16_t sync_handle;
|
||||
uint16_t sync_timeout;
|
||||
|
||||
sync_handle = sys_le16_to_cpu(cmd->sync_handle);
|
||||
sync_timeout = sys_le16_to_cpu(cmd->sync_timeout);
|
||||
|
||||
status = ll_big_sync_create(cmd->big_handle, sync_handle,
|
||||
cmd->encryption, cmd->bcode, cmd->mse,
|
||||
sync_timeout, cmd->num_bis, cmd->bis);
|
||||
|
||||
*evt = cmd_status(status);
|
||||
}
|
||||
|
||||
|
||||
static void le_big_terminate_sync(struct net_buf *buf, struct net_buf **evt)
|
||||
{
|
||||
struct bt_hci_cp_le_big_terminate_sync *cmd = (void *)buf->data;
|
||||
uint8_t status;
|
||||
|
||||
status = ll_big_sync_terminate(cmd->big_handle);
|
||||
|
||||
*evt = cmd_complete_status(status);
|
||||
}
|
||||
#endif /* CONFIG_BT_OBSERVER */
|
||||
|
||||
#if defined(CONFIG_BT_CONN)
|
||||
|
@ -2272,6 +2354,18 @@ static int controller_cmd_handle(uint16_t ocf, struct net_buf *cmd,
|
|||
case BT_OCF(BT_HCI_OP_LE_SET_ADV_ENABLE):
|
||||
le_set_adv_enable(cmd, evt);
|
||||
break;
|
||||
|
||||
case BT_OCF(BT_HCI_OP_LE_CREATE_BIG):
|
||||
le_create_big(cmd, evt);
|
||||
break;
|
||||
|
||||
case BT_OCF(BT_HCI_OP_LE_CREATE_BIG_TEST):
|
||||
le_create_big_test(cmd, evt);
|
||||
break;
|
||||
|
||||
case BT_OCF(BT_HCI_OP_LE_TERMINATE_BIG):
|
||||
le_terminate_big(cmd, evt);
|
||||
break;
|
||||
#endif /* CONFIG_BT_BROADCASTER */
|
||||
|
||||
#if defined(CONFIG_BT_OBSERVER)
|
||||
|
@ -2282,6 +2376,14 @@ static int controller_cmd_handle(uint16_t ocf, struct net_buf *cmd,
|
|||
case BT_OCF(BT_HCI_OP_LE_SET_SCAN_ENABLE):
|
||||
le_set_scan_enable(cmd, evt);
|
||||
break;
|
||||
|
||||
case BT_OCF(BT_HCI_OP_LE_BIG_CREATE_SYNC):
|
||||
le_big_create_sync(cmd, evt);
|
||||
break;
|
||||
|
||||
case BT_OCF(BT_HCI_OP_LE_BIG_TERMINATE_SYNC):
|
||||
le_big_terminate_sync(cmd, evt);
|
||||
break;
|
||||
#endif /* CONFIG_BT_OBSERVER */
|
||||
|
||||
#if defined(CONFIG_BT_CONN)
|
||||
|
|
|
@ -94,8 +94,21 @@ uint8_t ll_adv_enable(uint8_t handle, uint8_t enable,
|
|||
uint8_t ll_adv_enable(uint8_t enable);
|
||||
#endif /* !CONFIG_BT_CTLR_ADV_EXT || !CONFIG_BT_HCI_MESH_EXT */
|
||||
|
||||
uint8_t ll_big_create(uint8_t big_handle, uint8_t adv_handle, uint8_t num_bis,
|
||||
uint32_t sdu_interval, uint16_t max_sdu,
|
||||
uint16_t max_latency, uint8_t rtn, uint8_t phy,
|
||||
uint8_t packing, uint8_t framing, uint8_t encryption,
|
||||
uint8_t *bcode);
|
||||
uint8_t ll_big_test_create(uint8_t big_handle, uint8_t adv_handle,
|
||||
uint8_t num_bis, uint32_t sdu_interval,
|
||||
uint16_t iso_interval, uint8_t nse, uint16_t max_sdu,
|
||||
uint16_t max_pdu, uint8_t phy, uint8_t packing,
|
||||
uint8_t framing, uint8_t bn, uint8_t irc,
|
||||
uint8_t pto, uint8_t encryption, uint8_t *bcode);
|
||||
uint8_t ll_big_terminate(uint8_t big_handle, uint8_t reason);
|
||||
|
||||
uint8_t ll_scan_params_set(uint8_t type, uint16_t interval, uint16_t window,
|
||||
uint8_t own_addr_type, uint8_t filter_policy);
|
||||
uint8_t own_addr_type, uint8_t filter_policy);
|
||||
#if defined(CONFIG_BT_CTLR_ADV_EXT)
|
||||
uint8_t ll_scan_enable(uint8_t enable); /* TODO: add duration and period */
|
||||
uint8_t ll_sync_create(uint8_t options, uint8_t sid, uint8_t adv_addr_type,
|
||||
|
@ -104,6 +117,11 @@ uint8_t ll_sync_create(uint8_t options, uint8_t sid, uint8_t adv_addr_type,
|
|||
uint8_t ll_sync_create_cancel(void **rx);
|
||||
uint8_t ll_sync_terminate(uint16_t handle);
|
||||
uint8_t ll_sync_recv_enable(uint16_t handle, uint8_t enable);
|
||||
uint8_t ll_big_sync_create(uint8_t big_handle, uint16_t sync_handle,
|
||||
uint8_t encryption, uint8_t *bcode, uint8_t mse,
|
||||
uint16_t sync_timeout, uint8_t num_bis,
|
||||
uint8_t *bis);
|
||||
uint8_t ll_big_sync_terminate(uint8_t big_handle);
|
||||
#else /* !CONFIG_BT_CTLR_ADV_EXT */
|
||||
uint8_t ll_scan_enable(uint8_t enable);
|
||||
#endif /* !CONFIG_BT_CTLR_ADV_EXT */
|
||||
|
|
72
subsys/bluetooth/controller/ll_sw/ull_adv_iso.c
Normal file
72
subsys/bluetooth/controller/ll_sw/ull_adv_iso.c
Normal file
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
* Copyright (c) 2020 Nordic Semiconductor ASA
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <zephyr.h>
|
||||
|
||||
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BT_DEBUG_HCI_DRIVER)
|
||||
#define LOG_MODULE_NAME bt_ctlr_ull_adv_iso
|
||||
#include "common/log.h"
|
||||
#include "hal/debug.h"
|
||||
|
||||
uint8_t ll_big_create(uint8_t big_handle, uint8_t adv_handle, uint8_t num_bis,
|
||||
uint32_t sdu_interval, uint16_t max_sdu,
|
||||
uint16_t max_latency, uint8_t rtn, uint8_t phy,
|
||||
uint8_t packing, uint8_t framing, uint8_t encryption,
|
||||
uint8_t *bcode)
|
||||
{
|
||||
/* TODO: Implement */
|
||||
ARG_UNUSED(big_handle);
|
||||
ARG_UNUSED(adv_handle);
|
||||
ARG_UNUSED(num_bis);
|
||||
ARG_UNUSED(sdu_interval);
|
||||
ARG_UNUSED(max_sdu);
|
||||
ARG_UNUSED(max_latency);
|
||||
ARG_UNUSED(rtn);
|
||||
ARG_UNUSED(phy);
|
||||
ARG_UNUSED(packing);
|
||||
ARG_UNUSED(framing);
|
||||
ARG_UNUSED(encryption);
|
||||
ARG_UNUSED(bcode[16]);
|
||||
|
||||
return BT_HCI_ERR_CMD_DISALLOWED;
|
||||
}
|
||||
|
||||
uint8_t ll_big_test_create(uint8_t big_handle, uint8_t adv_handle,
|
||||
uint8_t num_bis, uint32_t sdu_interval,
|
||||
uint16_t iso_interval, uint8_t nse, uint16_t max_sdu,
|
||||
uint16_t max_pdu, uint8_t phy, uint8_t packing,
|
||||
uint8_t framing, uint8_t bn, uint8_t irc,
|
||||
uint8_t pto, uint8_t encryption, uint8_t *bcode)
|
||||
{
|
||||
/* TODO: Implement */
|
||||
ARG_UNUSED(big_handle);
|
||||
ARG_UNUSED(adv_handle);
|
||||
ARG_UNUSED(num_bis);
|
||||
ARG_UNUSED(sdu_interval);
|
||||
ARG_UNUSED(iso_interval);
|
||||
ARG_UNUSED(nse);
|
||||
ARG_UNUSED(max_sdu);
|
||||
ARG_UNUSED(max_pdu);
|
||||
ARG_UNUSED(phy);
|
||||
ARG_UNUSED(packing);
|
||||
ARG_UNUSED(framing);
|
||||
ARG_UNUSED(bn);
|
||||
ARG_UNUSED(irc);
|
||||
ARG_UNUSED(pto);
|
||||
ARG_UNUSED(encryption);
|
||||
ARG_UNUSED(bcode);
|
||||
|
||||
return BT_HCI_ERR_CMD_DISALLOWED;
|
||||
}
|
||||
|
||||
uint8_t ll_big_terminate(uint8_t big_handle, uint8_t reason)
|
||||
{
|
||||
/* TODO: Implement */
|
||||
ARG_UNUSED(big_handle);
|
||||
ARG_UNUSED(reason);
|
||||
|
||||
return BT_HCI_ERR_CMD_DISALLOWED;
|
||||
}
|
39
subsys/bluetooth/controller/ll_sw/ull_sync_iso.c
Normal file
39
subsys/bluetooth/controller/ll_sw/ull_sync_iso.c
Normal file
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* Copyright (c) 2020 Nordic Semiconductor ASA
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <zephyr.h>
|
||||
|
||||
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BT_DEBUG_HCI_DRIVER)
|
||||
#define LOG_MODULE_NAME bt_ctlr_ull_sync_iso
|
||||
#include "common/log.h"
|
||||
#include "hal/debug.h"
|
||||
|
||||
uint8_t ll_big_sync_create(uint8_t big_handle, uint16_t sync_handle,
|
||||
uint8_t encryption, uint8_t *bcode, uint8_t mse,
|
||||
uint16_t sync_timeout, uint8_t num_bis,
|
||||
uint8_t *bis)
|
||||
{
|
||||
/* TODO: Implement */
|
||||
ARG_UNUSED(big_handle);
|
||||
ARG_UNUSED(sync_handle);
|
||||
ARG_UNUSED(encryption);
|
||||
ARG_UNUSED(bcode);
|
||||
ARG_UNUSED(mse);
|
||||
ARG_UNUSED(sync_timeout);
|
||||
ARG_UNUSED(num_bis);
|
||||
ARG_UNUSED(bis);
|
||||
|
||||
return BT_HCI_ERR_CMD_DISALLOWED;
|
||||
}
|
||||
|
||||
|
||||
uint8_t ll_big_sync_terminate(uint8_t big_handle)
|
||||
{
|
||||
/* TODO: Implement */
|
||||
ARG_UNUSED(big_handle);
|
||||
|
||||
return BT_HCI_ERR_CMD_DISALLOWED;
|
||||
}
|
Loading…
Reference in a new issue