From 0c992e982e72f4b7d367289455a07be502a8bbc6 Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Sat, 22 Feb 2025 06:18:10 +0100 Subject: [PATCH 1/5] Bluetooth: Controller: Fix active mode extended scanning assert Fix active mode extended scanning assert raised when calling radio_tmr_start_us() due to stale radio_tmr_end_get() value. Active mode extended scanning did not drop reception of ADV_EXT_IND PDU when setup to receive ADV_SCAN_RSP PDUs. Signed-off-by: Vinayak Kariappa Chettimada --- subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan.c index 5f51c55f4255d..8aedcd44a4f88 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan.c @@ -1381,9 +1381,10 @@ static inline int isr_rx_pdu(struct lll_scan *lll, struct pdu_adv *pdu_adv_rx, rl_idx, &dir_report))) || #if defined(CONFIG_BT_CTLR_ADV_EXT) ((pdu_adv_rx->type == PDU_ADV_TYPE_EXT_IND) && - lll->phy && lll_scan_ext_tgta_check(lll, true, false, - pdu_adv_rx, rl_idx, - &dir_report)) || + lll->phy && + !lll->state && + lll_scan_ext_tgta_check(lll, true, false, pdu_adv_rx, rl_idx, + &dir_report)) || #endif /* CONFIG_BT_CTLR_ADV_EXT */ ((pdu_adv_rx->type == PDU_ADV_TYPE_SCAN_RSP) && (pdu_adv_rx->len >= offsetof(struct pdu_adv_scan_rsp, data)) && From 48bf1ea562607ad5b463fb7823e956a109b1a696 Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Sat, 22 Feb 2025 06:18:10 +0100 Subject: [PATCH 2/5] Bluetooth: Controller: Fix single timer end time capture Fix single timer use end time capture from being disabled as end time and timer clear use the same PPI. Signed-off-by: Vinayak Kariappa Chettimada --- .../ll_sw/nordic/hal/nrf5/radio/radio_nrf5_dppi.h | 6 ++++-- .../ll_sw/nordic/hal/nrf5/radio/radio_nrf5_ppi.h | 12 ++++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_dppi.h b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_dppi.h index 06aea328eaf46..cdb00dd38ddb7 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_dppi.h +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_dppi.h @@ -528,8 +528,10 @@ static inline void hal_radio_sw_switch_cleanup(void) { hal_radio_sw_switch_disable(); nrf_dppi_channels_disable(NRF_DPPIC, - (BIT(HAL_SW_SWITCH_TIMER_CLEAR_PPI) | - BIT(HAL_SW_SWITCH_GROUP_TASK_ENABLE_PPI))); +#if !defined(CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER) + BIT(HAL_SW_SWITCH_TIMER_CLEAR_PPI) | +#endif /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */ + BIT(HAL_SW_SWITCH_GROUP_TASK_ENABLE_PPI)); nrf_dppi_group_disable(NRF_DPPIC, SW_SWITCH_TIMER_TASK_GROUP(0)); nrf_dppi_group_disable(NRF_DPPIC, SW_SWITCH_TIMER_TASK_GROUP(1)); } diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_ppi.h b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_ppi.h index 05445e1fb48bc..0680231ebeaf6 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_ppi.h +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_ppi.h @@ -170,7 +170,7 @@ static inline void hal_radio_end_time_capture_ppi_config(void) /* No need to configure anything for the pre-programmed channel. */ } -#else +#else /* !(EVENT_TIMER_ID == 0) */ static inline void hal_radio_end_time_capture_ppi_config(void) { @@ -181,7 +181,7 @@ static inline void hal_radio_end_time_capture_ppi_config(void) (uint32_t)&(EVENT_TIMER->TASKS_CAPTURE[HAL_EVENT_TIMER_TRX_END_CC_OFFSET])); } -#endif /* (EVENT_TIMER_ID == 0) */ +#endif /* !(EVENT_TIMER_ID == 0) */ /******************************************************************************* * Start event timer on RTC tick: @@ -307,7 +307,7 @@ static inline void hal_sw_switch_timer_clear_ppi_config(void) (uint32_t)&(SW_SWITCH_TIMER->TASKS_CLEAR)); } -#else /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */ +#else /* CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */ /* Clear event timer (sw-switch timer) on Radio end: * wire the RADIO EVENTS_END event to the @@ -325,7 +325,7 @@ static inline void hal_sw_switch_timer_clear_ppi_config(void) (uint32_t)&(SW_SWITCH_TIMER->TASKS_CLEAR)); } -#endif /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */ +#endif /* CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */ /* The 2 adjacent PPI groups used for implementing SW_SWITCH_TIMER-based * auto-switch for TIFS. 'index' must be 0 or 1. @@ -453,11 +453,15 @@ static inline void hal_radio_sw_switch_disable(void) { /* Disable the following PPI channels that implement SW Switch: * - Clearing SW SWITCH TIMER on RADIO END event + * - Do not clear for single timer use as it uses the same PPI as + * end time capture * - Enabling SW SWITCH PPI Group on RADIO END event */ nrf_ppi_channels_disable( NRF_PPI, +#if !defined(CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER) BIT(HAL_SW_SWITCH_TIMER_CLEAR_PPI) | +#endif /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */ BIT(HAL_SW_SWITCH_GROUP_TASK_ENABLE_PPI)); /* Invalidation of subscription of S2 timer Compare used when From b498a0de6c9e564bd174238dd3b6de76ebb11b11 Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Sat, 22 Feb 2025 06:18:10 +0100 Subject: [PATCH 3/5] Bluetooth: Controller: Fix end time capture be on radio event end Fix end time capture be on radio event end irrespective of direction finding support. Let the timer clear use radio end or radio phy end, for no direction finding or direction finding support, respectively. Signed-off-by: Vinayak Kariappa Chettimada --- .../controller/ll_sw/nordic/hal/nrf5/radio/radio_df.c | 2 +- .../controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_dppi.h | 3 ++- .../controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_ppi.h | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_df.c b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_df.c index 500720ba35709..1f5c810bc2aed 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_df.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_df.c @@ -399,7 +399,7 @@ void radio_switch_complete_and_phy_end_b2b_tx(uint8_t phy_curr, uint8_t flags_cu uint8_t phy_next, uint8_t flags_next) { #if defined(CONFIG_BT_CTLR_TIFS_HW) - NRF_RADIO->SHORTS = RADIO_SHORTS_READY_START_Msk | RADIO_SHORTS_END_DISABLE_Msk | + NRF_RADIO->SHORTS = RADIO_SHORTS_READY_START_Msk | NRF_RADIO_SHORTS_TRX_END_DISABLE_Msk | RADIO_SHORTS_DISABLED_TXEN_Msk; #else /* !CONFIG_BT_CTLR_TIFS_HW */ NRF_RADIO->SHORTS = RADIO_SHORTS_READY_START_Msk | NRF_RADIO_SHORTS_TRX_END_DISABLE_Msk; diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_dppi.h b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_dppi.h index cdb00dd38ddb7..a61f5cdb7f5f2 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_dppi.h +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_dppi.h @@ -89,7 +89,8 @@ static inline void hal_radio_disable_on_hcto_ppi_config(void) */ static inline void hal_radio_end_time_capture_ppi_config(void) { - nrf_radio_publish_set(NRF_RADIO, HAL_NRF_RADIO_EVENT_END, HAL_RADIO_END_TIME_CAPTURE_PPI); + nrf_radio_publish_set(NRF_RADIO, HAL_NRF_RADIO_EVENT_END, + HAL_RADIO_END_TIME_CAPTURE_PPI); nrf_timer_subscribe_set(EVENT_TIMER, HAL_EVENT_TIMER_TRX_END_TASK, HAL_RADIO_END_TIME_CAPTURE_PPI); } diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_ppi.h b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_ppi.h index 0680231ebeaf6..d9ead6803a9d2 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_ppi.h +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_ppi.h @@ -177,7 +177,7 @@ static inline void hal_radio_end_time_capture_ppi_config(void) nrf_ppi_channel_endpoint_setup( NRF_PPI, HAL_RADIO_END_TIME_CAPTURE_PPI, - (uint32_t)&(NRF_RADIO->HAL_RADIO_TRX_EVENTS_END), + (uint32_t)&(NRF_RADIO->HAL_RADIO_EVENTS_END), (uint32_t)&(EVENT_TIMER->TASKS_CAPTURE[HAL_EVENT_TIMER_TRX_END_CC_OFFSET])); } From 88fa42ae1557145908da1176dd8800a2f544efdb Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Mon, 24 Feb 2025 21:04:06 +0100 Subject: [PATCH 4/5] Bluetooth: Controller: Fix single timer clear event define name Rename the single timer clear event define name based on direction finding support. Signed-off-by: Vinayak Kariappa Chettimada --- .../nordic/hal/nrf5/radio/radio_nrf5_dppi.h | 18 +++++++++--------- .../hal/nrf5/radio/radio_nrf5_resources.h | 15 ++++++++++----- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_dppi.h b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_dppi.h index a61f5cdb7f5f2..503f03d037b6e 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_dppi.h +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_dppi.h @@ -231,15 +231,15 @@ static inline void hal_trigger_crypt_by_bcmatch_ppi_config(void) /******************************************************************************/ #if !defined(CONFIG_BT_CTLR_TIFS_HW) - /* DPPI setup used for SW-based auto-switching during TIFS. */ + #if defined(CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER) -#define HAL_NRF_RADIO_TIFS_DPPI_EVENT_END HAL_NRF_RADIO_EVENT_END -#define HAL_RADIO_TIFS_DPPI_PUBLISH_END HAL_RADIO_PUBLISH_END -#else /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */ -#define HAL_NRF_RADIO_TIFS_DPPI_EVENT_END HAL_NRF_RADIO_EVENT_PHYEND -#define HAL_RADIO_TIFS_DPPI_PUBLISH_END HAL_RADIO_PUBLISH_PHYEND -#endif /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */ +#define HAL_NRF_RADIO_TIMER_CLEAR_EVENT_END HAL_NRF_RADIO_EVENT_END +#define HAL_RADIO_GROUP_TASK_ENABLE_PUBLISH_END HAL_RADIO_PUBLISH_END +#else /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER || CONFIG_BT_CTLR_DF */ +#define HAL_NRF_RADIO_TIMER_CLEAR_EVENT_END HAL_NRF_RADIO_EVENT_PHYEND +#define HAL_RADIO_GROUP_TASK_ENABLE_PUBLISH_END HAL_RADIO_PUBLISH_PHYEND +#endif /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER || CONFIG_BT_CTLR_DF */ /* Clear SW-switch timer on packet end: * wire the RADIO EVENTS_END event to SW_SWITCH_TIMER TASKS_CLEAR task. @@ -251,7 +251,7 @@ static inline void hal_trigger_crypt_by_bcmatch_ppi_config(void) */ static inline void hal_sw_switch_timer_clear_ppi_config(void) { - nrf_radio_publish_set(NRF_RADIO, HAL_NRF_RADIO_TIFS_DPPI_EVENT_END, + nrf_radio_publish_set(NRF_RADIO, HAL_NRF_RADIO_TIMER_CLEAR_EVENT_END, HAL_SW_SWITCH_TIMER_CLEAR_PPI); nrf_timer_subscribe_set(SW_SWITCH_TIMER, NRF_TIMER_TASK_CLEAR, HAL_SW_SWITCH_TIMER_CLEAR_PPI); @@ -322,7 +322,7 @@ static inline void hal_sw_switch_timer_clear_ppi_config(void) * a PPI to publish RADIO END event. */ #define HAL_SW_SWITCH_GROUP_TASK_ENABLE_PPI_REGISTER_EVT \ - (NRF_RADIO->HAL_RADIO_TIFS_DPPI_PUBLISH_END) + (NRF_RADIO->HAL_RADIO_GROUP_TASK_ENABLE_PUBLISH_END) #define HAL_SW_SWITCH_GROUP_TASK_ENABLE_PPI_EVT \ (((HAL_SW_SWITCH_GROUP_TASK_ENABLE_PPI << \ RADIO_PUBLISH_END_CHIDX_Pos) \ diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_resources.h b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_resources.h index 8bd540bbfa658..3bdc3cc22b5d8 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_resources.h +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_resources.h @@ -18,7 +18,8 @@ * or reception of a PDU on air. In case of regular PDU it is generated when last bit of CRC is * received or transmitted. */ -#define HAL_RADIO_TRX_EVENTS_END HAL_RADIO_EVENTS_END +#define HAL_RADIO_TRX_EVENTS_END HAL_RADIO_EVENTS_END +#define HAL_NRF_RADIO_TRX_EVENT_END HAL_NRF_RADIO_EVENT_END /* Wrapper for RADIO_SHORTS mask connecting EVENTS_END to EVENTS_DISABLE. * This is a default shortcut used to automatically disable Radio after end of PDU. @@ -75,7 +76,8 @@ * or reception of a PDU on air. In case of regular PDU it is generated when last bit of CRC is * received or transmitted. */ -#define HAL_RADIO_TRX_EVENTS_END HAL_RADIO_EVENTS_END +#define HAL_RADIO_TRX_EVENTS_END HAL_RADIO_EVENTS_END +#define HAL_NRF_RADIO_TRX_EVENT_END HAL_NRF_RADIO_EVENT_END /* Wrapper for RADIO_SHORTS mask connecting EVENTS_END to EVENTS_DISABLE. * This is a default shortcut used to automatically disable Radio after end of PDU. @@ -109,7 +111,8 @@ * or reception of a PDU on air. In case of regular PDU it is generated when last bit of CRC is * received or transmitted. */ -#define HAL_RADIO_TRX_EVENTS_END HAL_RADIO_EVENTS_END +#define HAL_RADIO_TRX_EVENTS_END HAL_RADIO_EVENTS_END +#define HAL_NRF_RADIO_TRX_EVENT_END HAL_NRF_RADIO_EVENT_END /* Wrapper for RADIO_SHORTS mask connecting EVENTS_END to EVENTS_DISABLE. * This is a default shortcut used to automatically disable Radio after end of PDU. @@ -173,7 +176,8 @@ * including CTE EVENTS_PHYEND event is generated at very end of a PDU. In case there is no CTE in * a PDU the EVENTS_PHYEND event is generated in the same instant as EVENTS_END event. */ -#define HAL_RADIO_TRX_EVENTS_END HAL_RADIO_EVENTS_PHYEND +#define HAL_RADIO_TRX_EVENTS_END HAL_RADIO_EVENTS_PHYEND +#define HAL_NRF_RADIO_TRX_EVENT_END HAL_NRF_RADIO_EVENT_PHYEND /* Wrapper for RADIO_SHORTS mask connecting EVENTS_PHYEND to EVENTS_DISABLE. * This is a mask for SOC that has Direction Finding Extension in a Radio peripheral. @@ -196,7 +200,8 @@ * or reception of a PDU on air. In case of regular PDU it is generated when last bit of CRC is * received or transmitted. */ -#define HAL_RADIO_TRX_EVENTS_END HAL_RADIO_EVENTS_END +#define HAL_RADIO_TRX_EVENTS_END HAL_RADIO_EVENTS_END +#define HAL_NRF_RADIO_TRX_EVENT_END HAL_NRF_RADIO_EVENT_END /* Wrapper for RADIO_SHORTS mask connecting EVENTS_END to EVENTS_DISABLE. * This is a default shortcut used to automatically disable Radio after end of PDU. From ee10f4b2c32216581452a1f8192a280d9ca11a00 Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Sat, 22 Feb 2025 06:18:10 +0100 Subject: [PATCH 5/5] Bluetooth: Controller: Fix single timer direction finding support Fix use of single timer software tIFS switching to support direction finding. Signed-off-by: Vinayak Kariappa Chettimada --- .../nordic/hal/nrf5/radio/radio_nrf5_dppi.h | 2 +- .../hal/nrf5/radio/radio_nrf5_resources.h | 65 +++++++++---------- 2 files changed, 33 insertions(+), 34 deletions(-) diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_dppi.h b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_dppi.h index 503f03d037b6e..4dabe97d910bf 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_dppi.h +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_dppi.h @@ -233,7 +233,7 @@ static inline void hal_trigger_crypt_by_bcmatch_ppi_config(void) #if !defined(CONFIG_BT_CTLR_TIFS_HW) /* DPPI setup used for SW-based auto-switching during TIFS. */ -#if defined(CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER) +#if defined(CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER) && !defined(CONFIG_BT_CTLR_DF) #define HAL_NRF_RADIO_TIMER_CLEAR_EVENT_END HAL_NRF_RADIO_EVENT_END #define HAL_RADIO_GROUP_TASK_ENABLE_PUBLISH_END HAL_RADIO_PUBLISH_END #else /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER || CONFIG_BT_CTLR_DF */ diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_resources.h b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_resources.h index 3bdc3cc22b5d8..a60b27e248246 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_resources.h +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_resources.h @@ -63,50 +63,50 @@ */ #define HAL_RADIO_ISR_LATENCY_MAX_US 80U -#if defined(CONFIG_BT_CTLR_DF_CONN_CTE_RX) -/* Delay of CCM TASKS_CRYPT start in number of bits for Radio Bit counter */ -#define CCM_TASKS_CRYPT_DELAY_BITS 3 -#endif /* CONFIG_BT_CTLR_DF_CONN_CTE_RX */ +#define SW_SWITCH_TIMER_EVTS_COMP_BASE 4 #if defined(CONFIG_BT_CTLR_PHY_CODED) -#define SW_SWITCH_TIMER_EVTS_COMP_BASE 4 #define SW_SWITCH_TIMER_EVTS_COMP_S2_BASE 6 +#endif /* !CONFIG_BT_CTLR_PHY_CODED */ + +#if defined(CONFIG_BT_CTLR_DF) +#if defined(CONFIG_BT_CTLR_DF_PHYEND_OFFSET_COMPENSATION_ENABLE) +/* Allocate 2 adjacent channels for PHYEND delay compensation. Use the same channels as for + * PHY CODED S2. The CTEINLINE may not be enabled for PHY CODED so PHYEND event is generated + * at the same instant as END event. Hence the channels are used interchangeably. + * That saves from use of another timer. + */ +#define SW_SWITCH_TIMER_EVTS_COMP_PHYEND_DELAY_COMPENSATION_BASE 6 +#endif /* CONFIG_BT_CTLR_DF_PHYEND_OFFSET_COMPENSATION_ENABLE */ /* Wrapper for EVENTS_END event generated by Radio peripheral at the very end of the transmission * or reception of a PDU on air. In case of regular PDU it is generated when last bit of CRC is * received or transmitted. + * + * When direction finding is enabled a PDU may include Constant Tone Extension at its end. For PDU + * including CTE EVENTS_PHYEND event is generated at very end of a PDU. In case there is no CTE in + * a PDU the EVENTS_PHYEND event is generated in the same instant as EVENTS_END event. */ -#define HAL_RADIO_TRX_EVENTS_END HAL_RADIO_EVENTS_END -#define HAL_NRF_RADIO_TRX_EVENT_END HAL_NRF_RADIO_EVENT_END +#define HAL_RADIO_TRX_EVENTS_END HAL_RADIO_EVENTS_PHYEND +#define HAL_NRF_RADIO_TRX_EVENT_END HAL_NRF_RADIO_EVENT_PHYEND -/* Wrapper for RADIO_SHORTS mask connecting EVENTS_END to EVENTS_DISABLE. - * This is a default shortcut used to automatically disable Radio after end of PDU. +/* Wrapper for RADIO_SHORTS mask connecting EVENTS_PHYEND to EVENTS_DISABLE. + * This is a mask for SOC that has Direction Finding Extension in a Radio peripheral. + * It enables shortcut for EVENTS_PHYEND event generated at very end to Radio EVENTS_DISABLE event. + * In case there is a CTE in a PDU then EVENTS_PHYEND event is generated after the CTE. + * If there is no CTE, it is generated in the same instant as EVENTS_END. */ -#define NRF_RADIO_SHORTS_TRX_END_DISABLE_Msk HAL_RADIO_SHORTS_TRX_END_DISABLE_Msk - -#define HAL_EVENT_TIMER_TRX_CC_OFFSET 0 -#define HAL_EVENT_TIMER_TRX_EVENT NRF_TIMER_EVENT_COMPARE0 -#define HAL_EVENT_TIMER_READY_TASK NRF_TIMER_TASK_CAPTURE0 - -#define HAL_EVENT_TIMER_HCTO_CC_OFFSET 1 -#define HAL_EVENT_TIMER_HCTO_EVENT NRF_TIMER_EVENT_COMPARE1 -#define HAL_EVENT_TIMER_ADDRESS_TASK NRF_TIMER_TASK_CAPTURE1 - -#define HAL_EVENT_TIMER_TRX_END_CC_OFFSET 2 -#define HAL_EVENT_TIMER_TRX_END_TASK NRF_TIMER_TASK_CAPTURE2 - -#define HAL_EVENT_TIMER_DEFERRED_TRX_CC_OFFSET 2 -#define HAL_EVENT_TIMER_DEFERRED_TX_EVENT NRF_TIMER_EVENT_COMPARE2 - -#define HAL_EVENT_TIMER_SAMPLE_CC_OFFSET 3 -#define HAL_EVENT_TIMER_SAMPLE_TASK NRF_TIMER_TASK_CAPTURE3 +#define NRF_RADIO_SHORTS_TRX_END_DISABLE_Msk HAL_RADIO_SHORTS_TRX_PHYEND_DISABLE_Msk -#define HAL_EVENT_TIMER_PA_LNA_CC_OFFSET 2 -#define HAL_EVENT_TIMER_PA_LNA_PDN_CC_OFFSET 3 +/* Delay of EVENTS_PHYEND event on receive PDU without CTE included when CTEINLINE is enabled */ +#define RADIO_EVENTS_PHYEND_DELAY_US 16 -#else /* !CONFIG_BT_CTLR_PHY_CODED */ -#define SW_SWITCH_TIMER_EVTS_COMP_BASE 4 +#if defined(CONFIG_BT_CTLR_DF_CONN_CTE_RX) +/* Delay of CCM TASKS_CRYPT start in number of bits for Radio Bit counter */ +#define CCM_TASKS_CRYPT_DELAY_BITS 3 +#endif /* CONFIG_BT_CTLR_DF_CONN_CTE_RX */ +#else /* !CONFIG_BT_CTLR_DF */ /* Wrapper for EVENTS_END event generated by Radio peripheral at the very end of the transmission * or reception of a PDU on air. In case of regular PDU it is generated when last bit of CRC is * received or transmitted. @@ -118,6 +118,7 @@ * This is a default shortcut used to automatically disable Radio after end of PDU. */ #define NRF_RADIO_SHORTS_TRX_END_DISABLE_Msk HAL_RADIO_SHORTS_TRX_END_DISABLE_Msk +#endif /* !CONFIG_BT_CTLR_DF */ #define HAL_EVENT_TIMER_TRX_CC_OFFSET 0 #define HAL_EVENT_TIMER_TRX_EVENT NRF_TIMER_EVENT_COMPARE0 @@ -138,7 +139,6 @@ #define HAL_EVENT_TIMER_PA_LNA_CC_OFFSET 2 #define HAL_EVENT_TIMER_PA_LNA_PDN_CC_OFFSET 3 -#endif /* !CONFIG_BT_CTLR_PHY_CODED */ #else /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */ #define EVENT_TIMER_ID 0 @@ -158,7 +158,6 @@ #endif /* !CONFIG_BT_CTLR_PHY_CODED */ #if defined(CONFIG_BT_CTLR_DF) - #if defined(CONFIG_BT_CTLR_DF_PHYEND_OFFSET_COMPENSATION_ENABLE) /* Allocate 2 adjacent channels for PHYEND delay compensation. Use the same channels as for * PHY CODED S2. The CTEINLINE may not be enabled for PHY CODED so PHYEND event is generated