Bluetooth: Controller: Update support for Periodic Sync Receive enable
Update support for Periodic Advertising Synchronization Receive Enable command, so that PDUs are received so that contents of Extended Common Payload Format is parsed and process for information like Channel Map Update and BIGInfo. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit is contained in:
parent
64eaa52e41
commit
a1810425ca
6 changed files with 40 additions and 30 deletions
|
@ -6164,10 +6164,10 @@ static void le_per_adv_sync_report(struct pdu_data *pdu_data,
|
||||||
uint8_t data_len_max;
|
uint8_t data_len_max;
|
||||||
uint8_t *acad = NULL;
|
uint8_t *acad = NULL;
|
||||||
uint8_t hdr_buf_len;
|
uint8_t hdr_buf_len;
|
||||||
bool dup = false;
|
|
||||||
uint8_t hdr_len;
|
uint8_t hdr_len;
|
||||||
uint8_t *ptr;
|
uint8_t *ptr;
|
||||||
int8_t rssi;
|
int8_t rssi;
|
||||||
|
bool drop;
|
||||||
|
|
||||||
if (!(event_mask & BT_EVT_MASK_LE_META_EVENT) ||
|
if (!(event_mask & BT_EVT_MASK_LE_META_EVENT) ||
|
||||||
(!(le_event_mask & BT_EVT_MASK_LE_PER_ADVERTISING_REPORT) &&
|
(!(le_event_mask & BT_EVT_MASK_LE_PER_ADVERTISING_REPORT) &&
|
||||||
|
@ -6292,23 +6292,29 @@ no_ext_hdr:
|
||||||
BT_DBG(" AD Data (%u): <todo>", data_len);
|
BT_DBG(" AD Data (%u): <todo>", data_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (0) {
|
||||||
|
|
||||||
#if (CONFIG_BT_CTLR_DUP_FILTER_LEN > 0) && \
|
#if (CONFIG_BT_CTLR_DUP_FILTER_LEN > 0) && \
|
||||||
defined(CONFIG_BT_CTLR_SYNC_PERIODIC_ADI_SUPPORT)
|
defined(CONFIG_BT_CTLR_SYNC_PERIODIC_ADI_SUPPORT)
|
||||||
if (IS_ENABLED(CONFIG_BT_CTLR_SYNC_PERIODIC_ADI_SUPPORT) && adi) {
|
} else if (IS_ENABLED(CONFIG_BT_CTLR_SYNC_PERIODIC_ADI_SUPPORT) &&
|
||||||
|
adi) {
|
||||||
const struct ll_sync_set *sync = HDR_LLL2ULL(ftr->param);
|
const struct ll_sync_set *sync = HDR_LLL2ULL(ftr->param);
|
||||||
|
|
||||||
/* FIXME: Use correct data status else chain PDU report will
|
/* FIXME: Use correct data status else chain PDU report will
|
||||||
* be filtered out.
|
* be filtered out.
|
||||||
*/
|
*/
|
||||||
dup = sync->nodups && dup_found(PDU_ADV_TYPE_EXT_IND,
|
drop = !ftr->sync_rx_enabled ||
|
||||||
sync->peer_id_addr_type,
|
(sync->nodups && dup_found(PDU_ADV_TYPE_EXT_IND,
|
||||||
sync->peer_id_addr,
|
sync->peer_id_addr_type,
|
||||||
DUP_EXT_ADV_MODE_PERIODIC,
|
sync->peer_id_addr,
|
||||||
adi, 0U);
|
DUP_EXT_ADV_MODE_PERIODIC,
|
||||||
}
|
adi, 0U));
|
||||||
#endif /* CONFIG_BT_CTLR_DUP_FILTER_LEN > 0 &&
|
#endif /* CONFIG_BT_CTLR_DUP_FILTER_LEN > 0 &&
|
||||||
* CONFIG_BT_CTLR_SYNC_PERIODIC_ADI_SUPPORT
|
* CONFIG_BT_CTLR_SYNC_PERIODIC_ADI_SUPPORT
|
||||||
*/
|
*/
|
||||||
|
} else {
|
||||||
|
drop = !ftr->sync_rx_enabled;
|
||||||
|
}
|
||||||
|
|
||||||
data_len_max = ADV_REPORT_EVT_MAX_LEN -
|
data_len_max = ADV_REPORT_EVT_MAX_LEN -
|
||||||
sizeof(struct bt_hci_evt_le_meta_event) -
|
sizeof(struct bt_hci_evt_le_meta_event) -
|
||||||
|
@ -6316,7 +6322,7 @@ no_ext_hdr:
|
||||||
|
|
||||||
evt_buf = buf;
|
evt_buf = buf;
|
||||||
|
|
||||||
if (!dup && (le_event_mask & BT_EVT_MASK_LE_PER_ADVERTISING_REPORT)) {
|
if ((le_event_mask & BT_EVT_MASK_LE_PER_ADVERTISING_REPORT) && !drop) {
|
||||||
do {
|
do {
|
||||||
struct bt_hci_evt_le_per_advertising_report *sep;
|
struct bt_hci_evt_le_per_advertising_report *sep;
|
||||||
uint8_t data_len_frag;
|
uint8_t data_len_frag;
|
||||||
|
|
|
@ -334,7 +334,8 @@ struct node_rx_ftr {
|
||||||
uint8_t aux_w4next:1;
|
uint8_t aux_w4next:1;
|
||||||
uint8_t aux_failed:1;
|
uint8_t aux_failed:1;
|
||||||
#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC)
|
#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC)
|
||||||
uint8_t sync_status:2;
|
uint8_t sync_status:2;
|
||||||
|
uint8_t sync_rx_enabled:1;
|
||||||
#endif /* CONFIG_BT_CTLR_SYNC_PERIODIC */
|
#endif /* CONFIG_BT_CTLR_SYNC_PERIODIC */
|
||||||
|
|
||||||
uint8_t phy_flags:1;
|
uint8_t phy_flags:1;
|
||||||
|
|
|
@ -18,13 +18,13 @@ struct lll_sync {
|
||||||
uint8_t crc_init[3];
|
uint8_t crc_init[3];
|
||||||
|
|
||||||
uint8_t phy:3;
|
uint8_t phy:3;
|
||||||
uint8_t is_rx_enabled:1;
|
|
||||||
/* Bitmask providing not allowed types of CTE. */
|
/* Bitmask providing not allowed types of CTE. */
|
||||||
uint8_t cte_type:5;
|
uint8_t cte_type:5;
|
||||||
/* The member is required for filtering by CTE type. If filtering policy is disabled then
|
/* The member is required for filtering by CTE type. If filtering policy is disabled then
|
||||||
* synchronization is terminated for periodic advertisements with wrong CTE type.
|
* synchronization is terminated for periodic advertisements with wrong CTE type.
|
||||||
*/
|
*/
|
||||||
uint8_t filter_policy:1;
|
uint8_t filter_policy:1;
|
||||||
|
uint8_t is_rx_enabled:1;
|
||||||
uint8_t is_aux_sched:1;
|
uint8_t is_aux_sched:1;
|
||||||
|
|
||||||
#if defined(CONFIG_BT_CTLR_SYNC_ISO)
|
#if defined(CONFIG_BT_CTLR_SYNC_ISO)
|
||||||
|
|
|
@ -627,8 +627,7 @@ static int isr_rx(struct lll_sync *lll, uint8_t node_type, uint8_t crc_ok, uint8
|
||||||
struct node_rx_pdu *node_rx;
|
struct node_rx_pdu *node_rx;
|
||||||
|
|
||||||
node_rx = ull_pdu_rx_alloc_peek(3);
|
node_rx = ull_pdu_rx_alloc_peek(3);
|
||||||
if (node_rx &&
|
if (node_rx) {
|
||||||
(lll->is_rx_enabled || (node_type == NODE_RX_TYPE_SYNC))) {
|
|
||||||
struct node_rx_ftr *ftr;
|
struct node_rx_ftr *ftr;
|
||||||
struct pdu_adv *pdu;
|
struct pdu_adv *pdu;
|
||||||
|
|
||||||
|
@ -646,6 +645,7 @@ static int isr_rx(struct lll_sync *lll, uint8_t node_type, uint8_t crc_ok, uint8
|
||||||
radio_rx_chain_delay_get(lll->phy,
|
radio_rx_chain_delay_get(lll->phy,
|
||||||
1);
|
1);
|
||||||
ftr->sync_status = status;
|
ftr->sync_status = status;
|
||||||
|
ftr->sync_rx_enabled = lll->is_rx_enabled;
|
||||||
|
|
||||||
pdu = (void *)node_rx->pdu;
|
pdu = (void *)node_rx->pdu;
|
||||||
|
|
||||||
|
|
|
@ -179,6 +179,10 @@ uint8_t ll_sync_create(uint8_t options, uint8_t sid, uint8_t adv_addr_type,
|
||||||
sync->node_rx_sync_estab = node_rx;
|
sync->node_rx_sync_estab = node_rx;
|
||||||
sync->node_rx_lost.hdr.link = link_sync_lost;
|
sync->node_rx_lost.hdr.link = link_sync_lost;
|
||||||
|
|
||||||
|
/* Reporting initially enabled/disabled */
|
||||||
|
sync->rx_enable =
|
||||||
|
!(options & BT_HCI_LE_PER_ADV_CREATE_SYNC_FP_REPORTS_DISABLED);
|
||||||
|
|
||||||
#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC_ADI_SUPPORT)
|
#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC_ADI_SUPPORT)
|
||||||
sync->nodups = (options &
|
sync->nodups = (options &
|
||||||
BT_HCI_LE_PER_ADV_CREATE_SYNC_FP_FILTER_DUPLICATE) ?
|
BT_HCI_LE_PER_ADV_CREATE_SYNC_FP_FILTER_DUPLICATE) ?
|
||||||
|
@ -218,6 +222,7 @@ uint8_t ll_sync_create(uint8_t options, uint8_t sid, uint8_t adv_addr_type,
|
||||||
|
|
||||||
/* Initialize sync LLL context */
|
/* Initialize sync LLL context */
|
||||||
lll_sync = &sync->lll;
|
lll_sync = &sync->lll;
|
||||||
|
lll_sync->is_rx_enabled = sync->rx_enable;
|
||||||
lll_sync->skip_prepare = 0U;
|
lll_sync->skip_prepare = 0U;
|
||||||
lll_sync->skip_event = 0U;
|
lll_sync->skip_event = 0U;
|
||||||
lll_sync->window_widening_prepare_us = 0U;
|
lll_sync->window_widening_prepare_us = 0U;
|
||||||
|
@ -227,10 +232,6 @@ uint8_t ll_sync_create(uint8_t options, uint8_t sid, uint8_t adv_addr_type,
|
||||||
lll_sync->filter_policy = scan->per_scan.filter_policy;
|
lll_sync->filter_policy = scan->per_scan.filter_policy;
|
||||||
#endif /* CONFIG_BT_CTLR_SYNC_PERIODIC_CTE_TYPE_FILTERING */
|
#endif /* CONFIG_BT_CTLR_SYNC_PERIODIC_CTE_TYPE_FILTERING */
|
||||||
|
|
||||||
/* Reporting initially enabled/disabled */
|
|
||||||
lll_sync->is_rx_enabled =
|
|
||||||
!(options & BT_HCI_LE_PER_ADV_CREATE_SYNC_FP_REPORTS_DISABLED);
|
|
||||||
|
|
||||||
#if defined(CONFIG_BT_CTLR_DF_SCAN_CTE_RX)
|
#if defined(CONFIG_BT_CTLR_DF_SCAN_CTE_RX)
|
||||||
ull_df_sync_cfg_init(&lll_sync->df_cfg);
|
ull_df_sync_cfg_init(&lll_sync->df_cfg);
|
||||||
#endif /* CONFIG_BT_CTLR_DF_SCAN_CTE_RX */
|
#endif /* CONFIG_BT_CTLR_DF_SCAN_CTE_RX */
|
||||||
|
@ -362,7 +363,6 @@ uint8_t ll_sync_terminate(uint16_t handle)
|
||||||
uint8_t ll_sync_recv_enable(uint16_t handle, uint8_t enable)
|
uint8_t ll_sync_recv_enable(uint16_t handle, uint8_t enable)
|
||||||
{
|
{
|
||||||
struct ll_sync_set *sync;
|
struct ll_sync_set *sync;
|
||||||
struct lll_sync *lll;
|
|
||||||
|
|
||||||
sync = ull_sync_is_enabled_get(handle);
|
sync = ull_sync_is_enabled_get(handle);
|
||||||
if (!sync) {
|
if (!sync) {
|
||||||
|
@ -370,10 +370,8 @@ uint8_t ll_sync_recv_enable(uint16_t handle, uint8_t enable)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reporting enabled/disabled */
|
/* Reporting enabled/disabled */
|
||||||
lll = &sync->lll;
|
sync->rx_enable = (enable & BT_HCI_LE_SET_PER_ADV_RECV_ENABLE_ENABLE) ?
|
||||||
lll->is_rx_enabled = (enable &
|
1U : 0U;
|
||||||
BT_HCI_LE_SET_PER_ADV_RECV_ENABLE_ENABLE) ?
|
|
||||||
1U : 0U;
|
|
||||||
|
|
||||||
#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC_ADI_SUPPORT)
|
#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC_ADI_SUPPORT)
|
||||||
sync->nodups = (enable &
|
sync->nodups = (enable &
|
||||||
|
@ -735,7 +733,6 @@ void ull_sync_established_report(memq_link_t *link, struct node_rx_hdr *rx)
|
||||||
struct lll_sync *lll;
|
struct lll_sync *lll;
|
||||||
|
|
||||||
ftr = &rx->rx_ftr;
|
ftr = &rx->rx_ftr;
|
||||||
lll = ftr->param;
|
|
||||||
|
|
||||||
#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC_CTE_TYPE_FILTERING)
|
#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC_CTE_TYPE_FILTERING)
|
||||||
enum sync_status sync_status;
|
enum sync_status sync_status;
|
||||||
|
@ -745,6 +742,8 @@ void ull_sync_established_report(memq_link_t *link, struct node_rx_hdr *rx)
|
||||||
#else
|
#else
|
||||||
struct pdu_cte_info *rx_cte_info;
|
struct pdu_cte_info *rx_cte_info;
|
||||||
|
|
||||||
|
lll = ftr->param;
|
||||||
|
|
||||||
rx_cte_info = pdu_cte_info_get((struct pdu_adv *)((struct node_rx_pdu *)rx)->pdu);
|
rx_cte_info = pdu_cte_info_get((struct pdu_adv *)((struct node_rx_pdu *)rx)->pdu);
|
||||||
if (rx_cte_info != NULL) {
|
if (rx_cte_info != NULL) {
|
||||||
sync_status = lll_sync_cte_is_allowed(lll->cte_type, lll->filter_policy,
|
sync_status = lll_sync_cte_is_allowed(lll->cte_type, lll->filter_policy,
|
||||||
|
@ -767,6 +766,7 @@ void ull_sync_established_report(memq_link_t *link, struct node_rx_hdr *rx)
|
||||||
/* Set the sync handle corresponding to the LLL context passed in the node rx
|
/* Set the sync handle corresponding to the LLL context passed in the node rx
|
||||||
* footer field.
|
* footer field.
|
||||||
*/
|
*/
|
||||||
|
lll = ftr->param;
|
||||||
ull_sync = HDR_LLL2ULL(lll);
|
ull_sync = HDR_LLL2ULL(lll);
|
||||||
|
|
||||||
/* Prepare and dispatch sync notification */
|
/* Prepare and dispatch sync notification */
|
||||||
|
@ -808,13 +808,11 @@ void ull_sync_established_report(memq_link_t *link, struct node_rx_hdr *rx)
|
||||||
/* Switch sync event prepare function to one reposnsible for regular PDUs receive */
|
/* Switch sync event prepare function to one reposnsible for regular PDUs receive */
|
||||||
mfy_lll_prepare.fp = lll_sync_prepare;
|
mfy_lll_prepare.fp = lll_sync_prepare;
|
||||||
|
|
||||||
if (lll->is_rx_enabled) {
|
/* Change node type to appropriately handle periodic
|
||||||
/* Change node type to appropriately handle periodic
|
* advertising PDU report.
|
||||||
* advertising PDU report.
|
*/
|
||||||
*/
|
rx->type = NODE_RX_TYPE_SYNC_REPORT;
|
||||||
rx->type = NODE_RX_TYPE_SYNC_REPORT;
|
ull_scan_aux_setup(link, rx);
|
||||||
ull_scan_aux_setup(link, rx);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1102,6 +1100,9 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift,
|
||||||
|
|
||||||
lll = &sync->lll;
|
lll = &sync->lll;
|
||||||
|
|
||||||
|
/* Commit receive enable changed value */
|
||||||
|
lll->is_rx_enabled = sync->rx_enable;
|
||||||
|
|
||||||
/* Increment prepare reference count */
|
/* Increment prepare reference count */
|
||||||
ref = ull_ref_inc(&sync->ull);
|
ref = ull_ref_inc(&sync->ull);
|
||||||
LL_ASSERT(ref);
|
LL_ASSERT(ref);
|
||||||
|
|
|
@ -29,6 +29,8 @@ struct ll_sync_set {
|
||||||
* CONFIG_BT_CTLR_SYNC_PERIODIC_ADI_SUPPORT
|
* CONFIG_BT_CTLR_SYNC_PERIODIC_ADI_SUPPORT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
uint8_t rx_enable:1;
|
||||||
|
|
||||||
#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC_ADI_SUPPORT)
|
#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC_ADI_SUPPORT)
|
||||||
uint8_t nodups:1;
|
uint8_t nodups:1;
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue