Commit 39fcf021 authored by Lucas Mathias Balling's avatar Lucas Mathias Balling Committed by Carles Cufi
Browse files

Bluetooth: Controller: Implement Periodic Sync Procedure

Adding PDU flow for Periodic Sync Indication

Signed-off-by: default avatarLucas Mathias Balling <lutb@demant.com>
parent 2dc1113a
Loading
Loading
Loading
Loading
+6 −0
Changes for subsys/bluetooth/controller/CMakeLists.txt: 6 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -98,6 +98,12 @@ if(CONFIG_BT_CONN)
    ll_sw/ull_llcp_chmu.c
    ll_sw/ull_llcp_remote.c
    )
    if (CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER OR
        CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER)
      zephyr_library_sources(
        ll_sw/ull_llcp_past.c
      )
    endif()
    zephyr_library_sources_ifdef(
    CONFIG_BT_PERIPHERAL
    ll_sw/ull_peripheral.c
+3 −1
Changes for subsys/bluetooth/controller/Kconfig.ll_sw_split: 3 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -48,6 +48,8 @@ config BT_LLL_VENDOR_NORDIC
	select BT_CTLR_CHAN_SEL_2_SUPPORT
	select BT_CTLR_MIN_USED_CHAN_SUPPORT
	select BT_CTLR_SCA_UPDATE_SUPPORT
	select BT_CTLR_SYNC_TRANSFER_RECEIVER_SUPPORT
	select BT_CTLR_SYNC_TRANSFER_SENDER_SUPPORT
	select BT_CTLR_DTM_HCI_SUPPORT
	select BT_CTLR_CONN_RSSI_SUPPORT

@@ -61,7 +63,7 @@ config BT_LLL_VENDOR_NORDIC
				   (BT_OBSERVER && BT_CTLR_ADV_EXT)
	select BT_TICKER_START_REMAINDER if BT_CTLR_CENTRAL_ISO
	select BT_TICKER_REMAINDER_GET if BT_BROADCASTER && BT_CTLR_ADV_EXT
	select BT_TICKER_LAZY_GET if BT_CTLR_ADV_PERIODIC || BT_CTLR_CENTRAL_ISO
	select BT_TICKER_LAZY_GET if BT_CTLR_ADV_PERIODIC || BT_CTLR_CENTRAL_ISO || BT_CTLR_SYNC_TRANSFER_SENDER

	select BT_TICKER_PREFER_START_BEFORE_STOP if BT_TICKER_SLOT_AGNOSTIC

+15 −1
Changes for subsys/bluetooth/controller/include/ll_feat.h: 15 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -177,6 +177,18 @@
#define LL_FEAT_BIT_SCA_UPDATE 0
#endif /* !CONFIG_BT_CTLR_SCA_UPDATE */

#if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER)
#define LL_FEAT_BIT_SYNC_TRANSFER_SENDER BIT64(BT_LE_FEAT_BIT_PAST_SEND)
#else /* !CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER */
#define LL_FEAT_BIT_SYNC_TRANSFER_SENDER 0
#endif /* !CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER */

#if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER)
#define LL_FEAT_BIT_SYNC_TRANSFER_RECEIVER BIT64(BT_LE_FEAT_BIT_PAST_RECV)
#else /* !CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER */
#define LL_FEAT_BIT_SYNC_TRANSFER_RECEIVER 0
#endif /* !CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER */

#if defined(CONFIG_BT_CTLR_CENTRAL_ISO)
#define LL_FEAT_BIT_CIS_CENTRAL BIT64(BT_LE_FEAT_BIT_CIS_CENTRAL)
#else /* !CONFIG_BT_CTLR_CENTRAL_ISO */
@@ -282,7 +294,9 @@
				  LL_FEAT_BIT_CIS_PERIPHERAL | \
				  LL_FEAT_BIT_ISO_BROADCASTER | \
				  LL_FEAT_BIT_SYNC_RECEIVER | \
				  LL_FEAT_BIT_PERIODIC_ADI_SUPPORT)
				  LL_FEAT_BIT_PERIODIC_ADI_SUPPORT | \
				  LL_FEAT_BIT_SYNC_TRANSFER_RECEIVER | \
				  LL_FEAT_BIT_SYNC_TRANSFER_SENDER)

/* Connected Isochronous Stream (Host Support) bit is controlled by host */
#if defined(CONFIG_BT_CTLR_CONN_ISO)
+4 −2
Changes for subsys/bluetooth/controller/ll_sw/lll_sync.h: 4 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -29,9 +29,11 @@ struct lll_sync {
	uint8_t is_aux_sched:1;
	uint8_t forced:1;

#if defined(CONFIG_BT_CTLR_SYNC_ISO)
#if defined(CONFIG_BT_CTLR_SYNC_ISO) || \
	defined(CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER) || \
	defined(CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER)
	uint8_t sca:3;
#endif /* CONFIG_BT_CTLR_SYNC_ISO */
#endif /* CONFIG_BT_CTLR_SYNC_ISO || CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER/SENDER */

#if defined(CONFIG_BT_CTLR_SCAN_AUX_SYNC_RESERVE_MIN)
	/* Counter used by LLL abort of event when in unreserved time space to
+21 −0
Changes for subsys/bluetooth/controller/ll_sw/pdu.h: 21 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -614,6 +614,7 @@ enum pdu_data_llctrl_type {
	PDU_DATA_LLCTRL_TYPE_MIN_USED_CHAN_IND = 0x19,
	PDU_DATA_LLCTRL_TYPE_CTE_REQ = 0x1A,
	PDU_DATA_LLCTRL_TYPE_CTE_RSP = 0x1B,
	PDU_DATA_LLCTRL_TYPE_PERIODIC_SYNC_IND = 0x1C,
	PDU_DATA_LLCTRL_TYPE_CLOCK_ACCURACY_REQ = 0x1D,
	PDU_DATA_LLCTRL_TYPE_CLOCK_ACCURACY_RSP = 0x1E,
	PDU_DATA_LLCTRL_TYPE_CIS_REQ = 0x1F,
@@ -888,6 +889,25 @@ struct pdu_data_llctrl_cis_terminate_ind {
	uint8_t  error_code;
} __packed;

struct pdu_data_llctrl_periodic_sync_ind {
	uint16_t id;
	struct pdu_adv_sync_info sync_info;
	uint16_t conn_event_count;
	uint16_t last_pa_event_counter;
#ifdef CONFIG_LITTLE_ENDIAN
	uint8_t  sid:4;
	uint8_t  addr_type:1;
	uint8_t  sca:3;
#else
	uint8_t  sca:3;
	uint8_t  addr_type:1;
	uint8_t  sid:4;
#endif /* CONFIG_LITTLE_ENDIAN */
	uint8_t  phy;
	uint8_t  adv_addr[6];
	uint16_t sync_conn_event_count;
} __packed;

struct pdu_data_llctrl {
	uint8_t opcode;
	union {
@@ -925,6 +945,7 @@ struct pdu_data_llctrl {
		struct pdu_data_llctrl_cis_rsp cis_rsp;
		struct pdu_data_llctrl_cis_ind cis_ind;
		struct pdu_data_llctrl_cis_terminate_ind cis_terminate_ind;
		struct pdu_data_llctrl_periodic_sync_ind periodic_sync_ind;
	} __packed;
} __packed;

Loading