Bluetooth: controller: split: Move aux_offset_fill into ULL files

Move the aux pointer fill function to ULL files, so as it is
re-usable by all vendors.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit is contained in:
Vinayak Kariappa Chettimada 2020-05-12 15:40:01 +05:30 committed by Carles Cufí
commit 06cba0d4e3
6 changed files with 48 additions and 45 deletions

View file

@ -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);

View file

@ -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)
{
}

View file

@ -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);

View file

@ -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;

View file

@ -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,

View file

@ -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 */