diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv.c index ff94a69d3ce..f250baab399 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv.c @@ -477,8 +477,8 @@ static void isr_done(void *param) #if defined(CONFIG_BT_CTLR_ADV_EXT) if (lll->aux) { - lll_adv_aux_offset_fill(lll->aux->ticks_offset, - start_us, pdu); + ull_adv_aux_lll_offset_fill(lll->aux->ticks_offset, + start_us, pdu); } #else /* !CONFIG_BT_CTLR_ADV_EXT */ ARG_UNUSED(pdu); diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_aux.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_aux.c index 16915ceee85..6d5901e3264 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_aux.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_aux.c @@ -75,33 +75,6 @@ void lll_adv_aux_prepare(void *param) LL_ASSERT(!err || err == -EINPROGRESS); } -void lll_adv_aux_offset_fill(uint32_t ticks_offset, uint32_t start_us, - struct pdu_adv *pdu) -{ - struct pdu_adv_com_ext_adv *p; - struct ext_adv_aux_ptr *aux; - struct ext_adv_hdr *h; - uint8_t *ptr; - - p = (void *)&pdu->adv_ext_ind; - h = (void *)p->ext_hdr_adi_adv_data; - ptr = (uint8_t *)h + sizeof(*h); - - if (h->adv_addr) { - ptr += BDADDR_SIZE; - } - - if (h->adi) { - ptr += sizeof(struct ext_adv_adi); - } - - aux = (void *)ptr; - aux->offs = (HAL_TICKER_TICKS_TO_US(ticks_offset) - start_us) / 30; - if (aux->offs_units) { - aux->offs /= 10; - } -} - void lll_adv_aux_pback_prepare(void *param) { } diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_aux.h b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_aux.h index 1625ac47bd3..ced86a87ca0 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_aux.h +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_aux.h @@ -7,8 +7,8 @@ int lll_adv_aux_init(void); int lll_adv_aux_reset(void); void lll_adv_aux_prepare(void *param); -void lll_adv_aux_offset_fill(uint32_t ticks_offset, uint32_t start_us, - struct pdu_adv *pdu); - extern uint8_t ull_adv_aux_lll_handle_get(struct lll_adv_aux *lll); +extern struct ext_adv_aux_ptr * +ull_adv_aux_lll_offset_fill(uint32_t ticks_offset, uint32_t start_us, + struct pdu_adv *pdu); diff --git a/subsys/bluetooth/controller/ll_sw/ull_adv.c b/subsys/bluetooth/controller/ll_sw/ull_adv.c index da20cc03f20..be06841681e 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_adv.c +++ b/subsys/bluetooth/controller/ll_sw/ull_adv.c @@ -434,7 +434,7 @@ uint8_t ll_adv_data_set(uint8_t len, uint8_t const *const data) return BT_HCI_ERR_CMD_DISALLOWED; } - return adv_data_set(adv, len, data); + return ull_adv_data_set(adv, len, data); } #if defined(CONFIG_BT_CTLR_ADV_EXT) @@ -453,7 +453,7 @@ uint8_t ll_adv_scan_rsp_set(uint8_t len, uint8_t const *const data) return BT_HCI_ERR_CMD_DISALLOWED; } - return scan_rsp_set(adv, len, data); + return ull_scan_rsp_set(adv, len, data); } #if defined(CONFIG_BT_CTLR_ADV_EXT) || defined(CONFIG_BT_HCI_MESH_EXT) @@ -1252,8 +1252,8 @@ struct ll_adv_set *ull_adv_is_created_get(uint8_t handle) } #endif /* CONFIG_BT_CTLR_ADV_EXT */ -uint8_t adv_data_set(struct ll_adv_set *adv, uint8_t len, - uint8_t const *const data) +uint8_t ull_adv_data_set(struct ll_adv_set *adv, uint8_t len, + uint8_t const *const data) { struct pdu_adv *prev; struct pdu_adv *pdu; @@ -1292,8 +1292,8 @@ uint8_t adv_data_set(struct ll_adv_set *adv, uint8_t len, return 0; } -uint8_t scan_rsp_set(struct ll_adv_set *adv, uint8_t len, - uint8_t const *const data) +uint8_t ull_scan_rsp_set(struct ll_adv_set *adv, uint8_t len, + uint8_t const *const data) { struct pdu_adv *prev; struct pdu_adv *pdu; diff --git a/subsys/bluetooth/controller/ll_sw/ull_adv_aux.c b/subsys/bluetooth/controller/ll_sw/ull_adv_aux.c index abc712f9f7f..003670a5a78 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_adv_aux.c +++ b/subsys/bluetooth/controller/ll_sw/ull_adv_aux.c @@ -123,7 +123,7 @@ uint8_t ll_adv_aux_ad_data_set(uint8_t handle, uint8_t op, uint8_t frag_pref, ui */ _pri = lll_adv_data_peek(lll); if (_pri->type != PDU_ADV_TYPE_EXT_IND) { - return adv_data_set(adv, len, data); + return ull_adv_data_set(adv, len, data); } /* Allocate or existing Auxiliary channel instance */ @@ -479,7 +479,7 @@ uint8_t ll_adv_aux_sr_data_set(uint8_t handle, uint8_t op, uint8_t frag_pref, ui */ _pri = lll_adv_data_peek(lll); if (_pri->type != PDU_ADV_TYPE_EXT_IND) { - return scan_rsp_set(adv, len, data); + return ull_scan_rsp_set(adv, len, data); } /* FIXME: Workaround to not fail when no data is supplied */ @@ -640,6 +640,36 @@ void ull_adv_aux_offset_get(struct ll_adv_set *adv) LL_ASSERT(!ret); } +struct ext_adv_aux_ptr *ull_adv_aux_lll_offset_fill(uint32_t ticks_offset, + uint32_t start_us, + struct pdu_adv *pdu) +{ + struct pdu_adv_com_ext_adv *p; + struct ext_adv_aux_ptr *aux; + struct ext_adv_hdr *h; + uint8_t *ptr; + + p = (void *)&pdu->adv_ext_ind; + h = (void *)p->ext_hdr_adi_adv_data; + ptr = (uint8_t *)h + sizeof(*h); + + if (h->adv_addr) { + ptr += BDADDR_SIZE; + } + + if (h->adi) { + ptr += sizeof(struct ext_adv_adi); + } + + aux = (void *)ptr; + aux->offs = (HAL_TICKER_TICKS_TO_US(ticks_offset) - start_us) / 30; + if (aux->offs_units) { + aux->offs /= 10; + } + + return aux; +} + static int init_reset(void) { /* Initialize adv aux pool. */ @@ -725,7 +755,7 @@ static void mfy_aux_offset_get(void *param) /* FIXME: we are in ULL_LOW context, fill offset in LLL context */ pdu = lll_adv_data_curr_get(&adv->lll); - lll_adv_aux_offset_fill(ticks_to_expire, 0, pdu); + ull_adv_aux_lll_offset_fill(ticks_to_expire, 0, pdu); } static void ticker_cb(uint32_t ticks_at_expire, uint32_t remainder, diff --git a/subsys/bluetooth/controller/ll_sw/ull_adv_internal.h b/subsys/bluetooth/controller/ll_sw/ull_adv_internal.h index c720a3d8e83..2140d7aee93 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_adv_internal.h +++ b/subsys/bluetooth/controller/ll_sw/ull_adv_internal.h @@ -38,12 +38,12 @@ uint32_t ull_adv_filter_pol_get(uint8_t handle); struct ll_adv_set *ull_adv_is_created_get(uint8_t handle); /* Helper function to construct AD data */ -uint8_t adv_data_set(struct ll_adv_set *adv, uint8_t len, - uint8_t const *const data); +uint8_t ull_adv_data_set(struct ll_adv_set *adv, uint8_t len, + uint8_t const *const data); /* Helper function to construct SR data */ -uint8_t scan_rsp_set(struct ll_adv_set *adv, uint8_t len, - uint8_t const *const data); +uint8_t ull_scan_rsp_set(struct ll_adv_set *adv, uint8_t len, + uint8_t const *const data); #if defined(CONFIG_BT_CTLR_ADV_EXT) /* Helper functions to initialise and reset ull_adv_aux module */