Bluetooth: controller: Fix missing node rx allocation for ISO establish
Added missing allocation of node rx buffer required for generation of Broadcast ISO Sync Established. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit is contained in:
parent
065dc42516
commit
eaa0215c74
3 changed files with 82 additions and 37 deletions
|
@ -108,9 +108,9 @@ uint8_t ll_sync_create(uint8_t options, uint8_t sid, uint8_t adv_addr_type,
|
|||
return BT_HCI_ERR_MEM_CAPACITY_EXCEEDED;
|
||||
}
|
||||
|
||||
scan->per_scan.state = LL_SYNC_STATE_IDLE;
|
||||
node_rx->link = link_sync_estab;
|
||||
scan->per_scan.node_rx_estab = node_rx;
|
||||
scan->per_scan.state = LL_SYNC_STATE_IDLE;
|
||||
scan->per_scan.filter_policy = options & BIT(0);
|
||||
if (IS_ENABLED(CONFIG_BT_CTLR_PHY_CODED)) {
|
||||
scan_coded->per_scan.state = LL_SYNC_STATE_IDLE;
|
||||
|
@ -145,7 +145,7 @@ uint8_t ll_sync_create(uint8_t options, uint8_t sid, uint8_t adv_addr_type,
|
|||
|
||||
#if defined(CONFIG_BT_CTLR_SYNC_ISO)
|
||||
/* Reset Broadcast Isochronous Group Sync Establishment */
|
||||
sync->sync_iso = NULL;
|
||||
sync->iso.sync_iso = NULL;
|
||||
#endif /* CONFIG_BT_CTLR_SYNC_ISO */
|
||||
|
||||
/* Initialize sync LLL context */
|
||||
|
|
|
@ -56,42 +56,60 @@ uint8_t ll_big_sync_create(uint8_t big_handle, uint16_t sync_handle,
|
|||
uint16_t sync_timeout, uint8_t num_bis,
|
||||
uint8_t *bis)
|
||||
{
|
||||
memq_link_t *big_sync_estab;
|
||||
memq_link_t *big_sync_lost;
|
||||
struct lll_sync_iso *lll_sync;
|
||||
struct ll_sync_set *sync;
|
||||
struct ll_sync_iso *sync_iso;
|
||||
memq_link_t *link_sync_estab;
|
||||
memq_link_t *link_sync_lost;
|
||||
struct node_rx_hdr *node_rx;
|
||||
struct ll_sync_set *sync;
|
||||
|
||||
sync = ull_sync_is_enabled_get(sync_handle);
|
||||
if (!sync || sync->sync_iso) {
|
||||
if (!sync || sync->iso.sync_iso) {
|
||||
return BT_HCI_ERR_CMD_DISALLOWED;
|
||||
}
|
||||
|
||||
link_sync_estab = ll_rx_link_alloc();
|
||||
if (!link_sync_estab) {
|
||||
return BT_HCI_ERR_MEM_CAPACITY_EXCEEDED;
|
||||
}
|
||||
|
||||
link_sync_lost = ll_rx_link_alloc();
|
||||
if (!link_sync_lost) {
|
||||
ll_rx_link_release(link_sync_estab);
|
||||
|
||||
return BT_HCI_ERR_MEM_CAPACITY_EXCEEDED;
|
||||
}
|
||||
|
||||
node_rx = ll_rx_alloc();
|
||||
if (!node_rx) {
|
||||
ll_rx_link_release(link_sync_lost);
|
||||
ll_rx_link_release(link_sync_estab);
|
||||
|
||||
return BT_HCI_ERR_MEM_CAPACITY_EXCEEDED;
|
||||
}
|
||||
|
||||
sync_iso = sync_iso_acquire();
|
||||
if (!sync_iso) {
|
||||
return BT_HCI_ERR_MEM_CAPACITY_EXCEEDED;
|
||||
}
|
||||
|
||||
big_sync_estab = ll_rx_link_alloc();
|
||||
if (!big_sync_estab) {
|
||||
return BT_HCI_ERR_MEM_CAPACITY_EXCEEDED;
|
||||
}
|
||||
|
||||
big_sync_lost = ll_rx_link_alloc();
|
||||
if (!big_sync_lost) {
|
||||
ll_rx_link_release(big_sync_estab);
|
||||
ll_rx_release(node_rx);
|
||||
ll_rx_link_release(link_sync_lost);
|
||||
ll_rx_link_release(link_sync_estab);
|
||||
|
||||
return BT_HCI_ERR_MEM_CAPACITY_EXCEEDED;
|
||||
}
|
||||
|
||||
sync_iso->node_rx_lost.link = big_sync_lost;
|
||||
sync_iso->node_rx_estab.link = big_sync_estab;
|
||||
/* Initialize the ISO sync ULL context */
|
||||
sync_iso->sync = sync;
|
||||
sync_iso->node_rx_lost.hdr.link = link_sync_lost;
|
||||
|
||||
lll_sync = &sync_iso->lll;
|
||||
/* Setup the periodic sync to establish ISO sync */
|
||||
node_rx->link = link_sync_estab;
|
||||
sync->iso.node_rx_estab = node_rx;
|
||||
|
||||
/* Initialise ULL and LLL headers */
|
||||
/* Initialize ULL and LLL headers */
|
||||
ull_hdr_init(&sync_iso->ull);
|
||||
lll_hdr_init(lll_sync, sync);
|
||||
lll_hdr_init(&sync_iso->lll, sync);
|
||||
|
||||
/* Enable periodic advertising to establish ISO sync */
|
||||
sync->iso.sync_iso = sync_iso;
|
||||
|
||||
return BT_HCI_ERR_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -9,19 +9,7 @@
|
|||
#define LL_SYNC_STATE_CREATED 0x02
|
||||
|
||||
#if defined(CONFIG_BT_CTLR_SYNC_ISO)
|
||||
struct ll_sync_iso {
|
||||
struct evt_hdr evt;
|
||||
struct ull_hdr ull;
|
||||
struct lll_sync_iso lll;
|
||||
|
||||
struct node_rx_hdr node_rx_lost;
|
||||
struct node_rx_hdr node_rx_estab;
|
||||
};
|
||||
|
||||
struct node_rx_sync_iso {
|
||||
uint8_t status;
|
||||
uint16_t interval;
|
||||
};
|
||||
struct ll_sync_iso;
|
||||
#endif /* CONFIG_BT_CTLR_SYNC_ISO */
|
||||
|
||||
struct ll_sync_set {
|
||||
|
@ -47,7 +35,15 @@ struct ll_sync_set {
|
|||
} node_rx_lost;
|
||||
|
||||
#if defined(CONFIG_BT_CTLR_SYNC_ISO)
|
||||
struct ll_sync_iso *sync_iso;
|
||||
struct {
|
||||
struct node_rx_hdr *node_rx_estab;
|
||||
|
||||
/* Non-Null when creating sync, reset in ISR context on
|
||||
* synchronisation state and checked in Thread context when
|
||||
* cancelling sync create, hence the volatile keyword.
|
||||
*/
|
||||
struct ll_sync_iso *volatile sync_iso;
|
||||
} iso;
|
||||
#endif /* CONFIG_BT_CTLR_SYNC_ISO */
|
||||
};
|
||||
|
||||
|
@ -57,3 +53,34 @@ struct node_rx_sync {
|
|||
uint16_t interval;
|
||||
uint8_t sca;
|
||||
};
|
||||
|
||||
#if defined(CONFIG_BT_CTLR_SYNC_ISO)
|
||||
struct ll_sync_iso {
|
||||
struct evt_hdr evt;
|
||||
struct ull_hdr ull;
|
||||
struct lll_sync_iso lll;
|
||||
|
||||
/* Periodic Advertising Sync that contained the BIGInfo */
|
||||
struct ll_sync_set *sync;
|
||||
|
||||
/* node rx type with memory aligned storage for sync lost reason.
|
||||
* HCI will reference the value using the pdu member of
|
||||
* struct node_rx_pdu.
|
||||
*/
|
||||
struct {
|
||||
struct node_rx_hdr hdr;
|
||||
union {
|
||||
uint8_t pdu[0] __aligned(4);
|
||||
struct {
|
||||
uint8_t handle;
|
||||
uint8_t reason;
|
||||
};
|
||||
};
|
||||
} node_rx_lost;
|
||||
};
|
||||
|
||||
struct node_rx_sync_iso {
|
||||
uint8_t status;
|
||||
uint16_t interval;
|
||||
};
|
||||
#endif /* CONFIG_BT_CTLR_SYNC_ISO */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue