Skip to content

Commit c8475b9

Browse files
ppryga-nordicnashif
authored andcommitted
Bluetooth: controller: ULL: enable TX of CTE with per. adv. PDU
Enable transmission of CTE with periodic advertising PDU. Signed-off-by: Piotr Pryga <[email protected]>
1 parent f1ef308 commit c8475b9

File tree

6 files changed

+571
-157
lines changed

6 files changed

+571
-157
lines changed

subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_sync.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@
2929
#include "lll_internal.h"
3030
#include "lll_adv_internal.h"
3131
#include "lll_tim_internal.h"
32+
#if IS_ENABLED(CONFIG_BT_CTLR_DF_ADV_CTE_TX)
3233
#include "lll_df_internal.h"
34+
#endif /* CONFIG_BT_CTLR_DF_ADV_CTE_TX */
3335

3436
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BT_DEBUG_HCI_DRIVER)
3537
#define LOG_MODULE_NAME bt_ctlr_lll_adv_sync

subsys/bluetooth/controller/ll_sw/ull_adv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1204,7 +1204,7 @@ uint8_t ll_adv_enable(uint8_t enable)
12041204
ticks_slot_aux +
12051205
HAL_TICKER_US_TO_TICKS(EVENT_MAFS_US);
12061206

1207-
ret = ull_adv_sync_start(sync,
1207+
ret = ull_adv_sync_start(adv, sync,
12081208
ticks_anchor_sync);
12091209
if (ret) {
12101210
goto failure_cleanup;

subsys/bluetooth/controller/ll_sw/ull_adv_aux.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
#include "lll_adv.h"
2828
#include "lll_adv_aux.h"
2929
#include "lll_adv_internal.h"
30+
#if IS_ENABLED(CONFIG_BT_CTLR_DF_ADV_CTE_TX)
31+
#include "lll_df_internal.h"
32+
#endif /* CONFIG_BT_CTLR_DF_ADV_CTE_TX */
3033

3134
#include "ull_adv_types.h"
3235

@@ -355,6 +358,17 @@ uint8_t ll_adv_aux_set_remove(uint8_t handle)
355358
}
356359
#endif /* CONFIG_BT_CTLR_ADV_PERIODIC */
357360

361+
#if IS_ENABLED(CONFIG_BT_CTLR_DF_ADV_CTE_TX)
362+
if (adv->df_cfg) {
363+
if (adv->df_cfg->is_enabled) {
364+
return BT_HCI_ERR_CMD_DISALLOWED;
365+
}
366+
367+
ull_df_adv_cfg_release(adv->df_cfg);
368+
adv->df_cfg = NULL;
369+
}
370+
#endif /* CONFIG_BT_CTLR_DF_ADV_CTE_TX */
371+
358372
/* Release auxiliary channel set */
359373
if (lll->aux) {
360374
struct ll_adv_aux_set *aux;

subsys/bluetooth/controller/ll_sw/ull_adv_internal.h

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,19 @@ const uint8_t *ull_adv_pdu_update_addrs(struct ll_adv_set *adv,
4747
#if defined(CONFIG_BT_CTLR_ADV_EXT)
4848

4949
#define ULL_ADV_PDU_HDR_FIELD_ADVA BIT(0)
50+
#define ULL_ADV_PDU_HDR_FIELD_CTE_INFO BIT(2)
51+
#define ULL_ADV_PDU_HDR_FIELD_AUX_PTR BIT(4)
5052
#define ULL_ADV_PDU_HDR_FIELD_SYNC_INFO BIT(5)
5153
#define ULL_ADV_PDU_HDR_FIELD_AD_DATA BIT(8)
5254

55+
/* Helper type to store data for extended advertising
56+
* header fields and extra data.
57+
*/
58+
struct adv_pdu_field_data {
59+
uint8_t *field_data;
60+
void *extra_data;
61+
};
62+
5363
/* helper function to handle adv done events */
5464
void ull_adv_done(struct node_rx_event_done *done);
5565

@@ -91,6 +101,15 @@ uint8_t ull_adv_aux_hdr_set_clear(struct ll_adv_set *adv,
91101
struct pdu_adv_adi *adi,
92102
uint8_t *pri_idx);
93103

104+
/* helper function to set/clear common extended header format fields
105+
* for AUX_SYNC_IND PDU.
106+
*/
107+
uint8_t ull_adv_sync_pdu_set_clear(struct ll_adv_set *adv,
108+
uint16_t hdr_add_fields,
109+
uint16_t hdr_rem_fields,
110+
struct adv_pdu_field_data *data,
111+
uint8_t *ter_idx);
112+
94113
/* helper function to calculate common ext adv payload header length and
95114
* adjust the data pointer.
96115
* NOTE: This function reverts the header data pointer if there is no
@@ -129,12 +148,23 @@ int ull_adv_sync_init(void);
129148
int ull_adv_sync_reset(void);
130149

131150
/* helper function to start periodic advertising */
132-
uint32_t ull_adv_sync_start(struct ll_adv_sync_set *sync,
151+
uint32_t ull_adv_sync_start(struct ll_adv_set *adv,
152+
struct ll_adv_sync_set *sync,
133153
uint32_t ticks_anchor);
134154

155+
/* helper function to update periodic advertising event length */
156+
void ull_adv_sync_update(struct ll_adv_sync_set *sync, uint32_t slot_plus_us,
157+
uint32_t slot_minus_us);
158+
135159
/* helper function to schedule a mayfly to get sync offset */
136160
void ull_adv_sync_offset_get(struct ll_adv_set *adv);
137161

138162
int ull_adv_iso_init(void);
139163
int ull_adv_iso_reset(void);
164+
165+
#if IS_ENABLED(CONFIG_BT_CTLR_DF_ADV_CTE_TX)
166+
/* helper function to release unused DF configuration memory */
167+
void ull_df_adv_cfg_release(struct lll_df_adv_cfg *df_adv_cfg);
168+
#endif /* CONFIG_BT_CTLR_DF_ADV_CTE_TX */
169+
140170
#endif /* CONFIG_BT_CTLR_ADV_EXT */

0 commit comments

Comments
 (0)