From 06b7503e33338bad4e22361b9caf008dbf3859f5 Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Wed, 1 Jan 2025 15:21:58 +0100 Subject: [PATCH] Bluetooth: Controller: Fix nRF5 radio and event timer abstractions Fix nRF5 radio and event timer abstractions for some that where hard coded compared to use of the ones defined in the resources header file. Signed-off-by: Vinayak Kariappa Chettimada --- .../ll_sw/nordic/hal/nrf5/radio/radio.c | 4 +- .../ll_sw/nordic/hal/nrf5/radio/radio_nrf51.h | 7 ++- .../nordic/hal/nrf5/radio/radio_nrf52805.h | 7 ++- .../nordic/hal/nrf5/radio/radio_nrf52810.h | 7 ++- .../nordic/hal/nrf5/radio/radio_nrf52811.h | 4 ++ .../nordic/hal/nrf5/radio/radio_nrf52820.h | 4 ++ .../nordic/hal/nrf5/radio/radio_nrf52832.h | 7 ++- .../nordic/hal/nrf5/radio/radio_nrf52833.h | 4 ++ .../nordic/hal/nrf5/radio/radio_nrf52840.h | 7 ++- .../nordic/hal/nrf5/radio/radio_nrf5340.h | 6 ++ .../nordic/hal/nrf5/radio/radio_nrf54lx.h | 6 ++ .../nordic/hal/nrf5/radio/radio_nrf5_dppi.h | 56 +++++++++---------- .../nrf5/radio/radio_nrf5_dppi_resources.h | 16 +++--- .../nordic/hal/nrf5/radio/radio_nrf5_ppi.h | 18 +++--- .../hal/nrf5/radio/radio_nrf5_resources.h | 30 ++++++++-- .../nordic/hal/nrf5/radio/radio_sim_nrf52.h | 20 ++++++- .../nordic/hal/nrf5/radio/radio_sim_nrf5340.h | 13 ++++- .../nordic/hal/nrf5/radio/radio_sim_nrf54l.h | 6 ++ 18 files changed, 149 insertions(+), 73 deletions(-) diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c index ecba6079886649..1e10c8e71a89dc 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c @@ -622,7 +622,7 @@ static void last_pdu_end_us_init(uint32_t latency_us) uint32_t radio_is_done(void) { - if (NRF_RADIO->NRF_RADIO_TRX_END_EVENT != 0) { + if (NRF_RADIO->HAL_RADIO_TRX_EVENTS_END != 0) { /* On packet END event increment last packet end time value. * Note: this depends on the function being called exactly once * in the ISR function. @@ -637,7 +637,7 @@ uint32_t radio_is_done(void) #else /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */ uint32_t radio_is_done(void) { - return (NRF_RADIO->NRF_RADIO_TRX_END_EVENT != 0); + return (NRF_RADIO->HAL_RADIO_TRX_EVENTS_END != 0); } #endif /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */ diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf51.h b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf51.h index 4ccb6f2e309905..faad07f4cbc80e 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf51.h +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf51.h @@ -24,9 +24,10 @@ #define HAL_RADIO_NRF51_RX_CHAIN_DELAY_NS 3000 /* 3.0 */ /* HAL abstraction of Radio bitfields */ -#define HAL_RADIO_INTENSET_DISABLED_Msk RADIO_INTENSET_DISABLED_Msk -#define HAL_RADIO_SHORTS_TRX_END_DISABLE_Msk RADIO_SHORTS_END_DISABLE_Msk -#define HAL_RADIO_SHORTS_TRX_PHYEND_DISABLE_Msk RADIO_SHORTS_PHYEND_DISABLE_Msk +#define HAL_NRF_RADIO_EVENT_END NRF_RADIO_EVENT_END +#define HAL_RADIO_EVENTS_END EVENTS_END +#define HAL_RADIO_INTENSET_DISABLED_Msk RADIO_INTENSET_DISABLED_Msk +#define HAL_RADIO_SHORTS_TRX_END_DISABLE_Msk RADIO_SHORTS_END_DISABLE_Msk /* HAL abstraction of Radio IRQ number */ #define HAL_RADIO_IRQn RADIO_IRQn diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf52805.h b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf52805.h index ad4e1377d39c63..ee96c07a5fc3c1 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf52805.h +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf52805.h @@ -186,9 +186,10 @@ #endif /* !CONFIG_BT_CTLR_RADIO_ENABLE_FAST */ /* HAL abstraction of Radio bitfields */ -#define HAL_RADIO_INTENSET_DISABLED_Msk RADIO_INTENSET_DISABLED_Msk -#define HAL_RADIO_SHORTS_TRX_END_DISABLE_Msk RADIO_SHORTS_END_DISABLE_Msk -#define HAL_RADIO_SHORTS_TRX_PHYEND_DISABLE_Msk RADIO_SHORTS_PHYEND_DISABLE_Msk +#define HAL_NRF_RADIO_EVENT_END NRF_RADIO_EVENT_END +#define HAL_RADIO_EVENTS_END EVENTS_END +#define HAL_RADIO_INTENSET_DISABLED_Msk RADIO_INTENSET_DISABLED_Msk +#define HAL_RADIO_SHORTS_TRX_END_DISABLE_Msk RADIO_SHORTS_END_DISABLE_Msk /* HAL abstraction of Radio IRQ number */ #define HAL_RADIO_IRQn RADIO_IRQn diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf52810.h b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf52810.h index b672f74cf9ae04..7b22249ec928c5 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf52810.h +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf52810.h @@ -188,9 +188,10 @@ #endif /* !CONFIG_BT_CTLR_RADIO_ENABLE_FAST */ /* HAL abstraction of Radio bitfields */ -#define HAL_RADIO_INTENSET_DISABLED_Msk RADIO_INTENSET_DISABLED_Msk -#define HAL_RADIO_SHORTS_TRX_END_DISABLE_Msk RADIO_SHORTS_END_DISABLE_Msk -#define HAL_RADIO_SHORTS_TRX_PHYEND_DISABLE_Msk RADIO_SHORTS_PHYEND_DISABLE_Msk +#define HAL_NRF_RADIO_EVENT_END NRF_RADIO_EVENT_END +#define HAL_RADIO_EVENTS_END EVENTS_END +#define HAL_RADIO_INTENSET_DISABLED_Msk RADIO_INTENSET_DISABLED_Msk +#define HAL_RADIO_SHORTS_TRX_END_DISABLE_Msk RADIO_SHORTS_END_DISABLE_Msk /* HAL abstraction of Radio IRQ number */ #define HAL_RADIO_IRQn RADIO_IRQn diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf52811.h b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf52811.h index 9204ed3ac3ee5d..5caa59470b6331 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf52811.h +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf52811.h @@ -343,6 +343,10 @@ #endif /* !CONFIG_BT_CTLR_RADIO_ENABLE_FAST */ /* HAL abstraction of Radio bitfields */ +#define HAL_NRF_RADIO_EVENT_END NRF_RADIO_EVENT_END +#define HAL_RADIO_EVENTS_END EVENTS_END +#define HAL_NRF_RADIO_EVENT_PHYEND NRF_RADIO_EVENT_PHYEND +#define HAL_RADIO_EVENTS_PHYEND EVENTS_PHYEND #define HAL_RADIO_INTENSET_DISABLED_Msk RADIO_INTENSET_DISABLED_Msk #define HAL_RADIO_SHORTS_TRX_END_DISABLE_Msk RADIO_SHORTS_END_DISABLE_Msk #define HAL_RADIO_SHORTS_TRX_PHYEND_DISABLE_Msk RADIO_SHORTS_PHYEND_DISABLE_Msk diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf52820.h b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf52820.h index c0be42698ad0b5..ab15f62f68578c 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf52820.h +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf52820.h @@ -343,6 +343,10 @@ #endif /* !CONFIG_BT_CTLR_RADIO_ENABLE_FAST */ /* HAL abstraction of Radio bitfields */ +#define HAL_NRF_RADIO_EVENT_END NRF_RADIO_EVENT_END +#define HAL_RADIO_EVENTS_END EVENTS_END +#define HAL_NRF_RADIO_EVENT_PHYEND NRF_RADIO_EVENT_PHYEND +#define HAL_RADIO_EVENTS_PHYEND EVENTS_PHYEND #define HAL_RADIO_INTENSET_DISABLED_Msk RADIO_INTENSET_DISABLED_Msk #define HAL_RADIO_SHORTS_TRX_END_DISABLE_Msk RADIO_SHORTS_END_DISABLE_Msk #define HAL_RADIO_SHORTS_TRX_PHYEND_DISABLE_Msk RADIO_SHORTS_PHYEND_DISABLE_Msk diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf52832.h b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf52832.h index 398c92b5064de8..10e942cca1e98d 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf52832.h +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf52832.h @@ -189,9 +189,10 @@ #endif /* !CONFIG_BT_CTLR_RADIO_ENABLE_FAST */ /* HAL abstraction of Radio bitfields */ -#define HAL_RADIO_INTENSET_DISABLED_Msk RADIO_INTENSET_DISABLED_Msk -#define HAL_RADIO_SHORTS_TRX_END_DISABLE_Msk RADIO_SHORTS_END_DISABLE_Msk -#define HAL_RADIO_SHORTS_TRX_PHYEND_DISABLE_Msk RADIO_SHORTS_PHYEND_DISABLE_Msk +#define HAL_NRF_RADIO_EVENT_END NRF_RADIO_EVENT_END +#define HAL_RADIO_EVENTS_END EVENTS_END +#define HAL_RADIO_INTENSET_DISABLED_Msk RADIO_INTENSET_DISABLED_Msk +#define HAL_RADIO_SHORTS_TRX_END_DISABLE_Msk RADIO_SHORTS_END_DISABLE_Msk /* HAL abstraction of Radio IRQ number */ #define HAL_RADIO_IRQn RADIO_IRQn diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf52833.h b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf52833.h index 169f5c93714ddc..e8c55fc89524cd 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf52833.h +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf52833.h @@ -343,6 +343,10 @@ #endif /* !CONFIG_BT_CTLR_RADIO_ENABLE_FAST */ /* HAL abstraction of Radio bitfields */ +#define HAL_NRF_RADIO_EVENT_END NRF_RADIO_EVENT_END +#define HAL_RADIO_EVENTS_END EVENTS_END +#define HAL_NRF_RADIO_EVENT_PHYEND NRF_RADIO_EVENT_PHYEND +#define HAL_RADIO_EVENTS_PHYEND EVENTS_PHYEND #define HAL_RADIO_INTENSET_DISABLED_Msk RADIO_INTENSET_DISABLED_Msk #define HAL_RADIO_SHORTS_TRX_END_DISABLE_Msk RADIO_SHORTS_END_DISABLE_Msk #define HAL_RADIO_SHORTS_TRX_PHYEND_DISABLE_Msk RADIO_SHORTS_PHYEND_DISABLE_Msk diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf52840.h b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf52840.h index 07c9a7d6130b7c..80ab0f9e2410b8 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf52840.h +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf52840.h @@ -346,9 +346,10 @@ #endif /* !CONFIG_BT_CTLR_RADIO_ENABLE_FAST */ /* HAL abstraction of Radio bitfields */ -#define HAL_RADIO_INTENSET_DISABLED_Msk RADIO_INTENSET_DISABLED_Msk -#define HAL_RADIO_SHORTS_TRX_END_DISABLE_Msk RADIO_SHORTS_END_DISABLE_Msk -#define HAL_RADIO_SHORTS_TRX_PHYEND_DISABLE_Msk RADIO_SHORTS_PHYEND_DISABLE_Msk +#define HAL_NRF_RADIO_EVENT_END NRF_RADIO_EVENT_END +#define HAL_RADIO_EVENTS_END EVENTS_END +#define HAL_RADIO_INTENSET_DISABLED_Msk RADIO_INTENSET_DISABLED_Msk +#define HAL_RADIO_SHORTS_TRX_END_DISABLE_Msk RADIO_SHORTS_END_DISABLE_Msk /* HAL abstraction of Radio IRQ number */ #define HAL_RADIO_IRQn RADIO_IRQn diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5340.h b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5340.h index f8b7635e7d1482..a9638b62634ce4 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5340.h +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5340.h @@ -365,6 +365,12 @@ #endif /* HAL abstraction of Radio bitfields */ +#define HAL_NRF_RADIO_EVENT_END NRF_RADIO_EVENT_END +#define HAL_RADIO_EVENTS_END EVENTS_END +#define HAL_RADIO_PUBLISH_END PUBLISH_END +#define HAL_NRF_RADIO_EVENT_PHYEND NRF_RADIO_EVENT_PHYEND +#define HAL_RADIO_EVENTS_PHYEND EVENTS_PHYEND +#define HAL_RADIO_PUBLISH_PHYEND PUBLISH_PHYEND #define HAL_RADIO_INTENSET_DISABLED_Msk RADIO_INTENSET_DISABLED_Msk #define HAL_RADIO_SHORTS_TRX_END_DISABLE_Msk RADIO_SHORTS_END_DISABLE_Msk #define HAL_RADIO_SHORTS_TRX_PHYEND_DISABLE_Msk RADIO_SHORTS_PHYEND_DISABLE_Msk diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf54lx.h b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf54lx.h index bc0cc2993c563b..7c73a603ea9351 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf54lx.h +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf54lx.h @@ -361,6 +361,12 @@ #endif /* !CONFIG_BT_CTLR_RADIO_ENABLE_FAST */ /* HAL abstraction of Radio bitfields */ +#define HAL_NRF_RADIO_EVENT_END NRF_RADIO_EVENT_END +#define HAL_RADIO_EVENTS_END EVENTS_END +#define HAL_RADIO_PUBLISH_END PUBLISH_END +#define HAL_NRF_RADIO_EVENT_PHYEND NRF_RADIO_EVENT_PHYEND +#define HAL_RADIO_EVENTS_PHYEND EVENTS_PHYEND +#define HAL_RADIO_PUBLISH_PHYEND PUBLISH_PHYEND #define HAL_RADIO_INTENSET_DISABLED_Msk RADIO_INTENSET00_DISABLED_Msk #define HAL_RADIO_SHORTS_TRX_END_DISABLE_Msk RADIO_SHORTS_PHYEND_DISABLE_Msk #define HAL_RADIO_SHORTS_TRX_PHYEND_DISABLE_Msk RADIO_SHORTS_PHYEND_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 e0447e600b7c9c..916fcafd878058 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 @@ -26,7 +26,7 @@ static inline void hal_radio_nrf_ppi_channels_disable(uint32_t mask) static inline void hal_radio_enable_on_tick_ppi_config_and_enable(uint8_t trx) { if (trx) { - nrf_timer_publish_set(EVENT_TIMER, NRF_TIMER_EVENT_COMPARE0, + nrf_timer_publish_set(EVENT_TIMER, HAL_EVENT_TIMER_TRX_EVENT, HAL_RADIO_ENABLE_TX_ON_TICK_PPI); nrf_radio_subscribe_set(NRF_RADIO, NRF_RADIO_TASK_TXEN, HAL_RADIO_ENABLE_TX_ON_TICK_PPI); @@ -40,7 +40,7 @@ static inline void hal_radio_enable_on_tick_ppi_config_and_enable(uint8_t trx) nrf_dppi_channels_enable(NRF_DPPIC, BIT(HAL_RADIO_ENABLE_TX_ON_TICK_PPI)); } else { - nrf_timer_publish_set(EVENT_TIMER, NRF_TIMER_EVENT_COMPARE0, + nrf_timer_publish_set(EVENT_TIMER, HAL_EVENT_TIMER_TRX_EVENT, HAL_RADIO_ENABLE_RX_ON_TICK_PPI); nrf_radio_subscribe_set(NRF_RADIO, NRF_RADIO_TASK_RXEN, HAL_RADIO_ENABLE_RX_ON_TICK_PPI); @@ -63,10 +63,10 @@ static inline void hal_radio_enable_on_tick_ppi_config_and_enable(uint8_t trx) */ static inline void hal_radio_recv_timeout_cancel_ppi_config(void) { - nrf_radio_publish_set(NRF_RADIO, - NRF_RADIO_EVENT_ADDRESS, HAL_RADIO_RECV_TIMEOUT_CANCEL_PPI); - nrf_timer_subscribe_set(EVENT_TIMER, - NRF_TIMER_TASK_CAPTURE1, HAL_RADIO_RECV_TIMEOUT_CANCEL_PPI); + nrf_radio_publish_set(NRF_RADIO, NRF_RADIO_EVENT_ADDRESS, + HAL_RADIO_RECV_TIMEOUT_CANCEL_PPI); + nrf_timer_subscribe_set(EVENT_TIMER, HAL_EVENT_TIMER_ADDRESS_TASK, + HAL_RADIO_RECV_TIMEOUT_CANCEL_PPI); } /******************************************************************************* @@ -76,10 +76,10 @@ static inline void hal_radio_recv_timeout_cancel_ppi_config(void) */ static inline void hal_radio_disable_on_hcto_ppi_config(void) { - nrf_timer_publish_set(EVENT_TIMER, - NRF_TIMER_EVENT_COMPARE1, HAL_RADIO_DISABLE_ON_HCTO_PPI); - nrf_radio_subscribe_set(NRF_RADIO, - NRF_RADIO_TASK_DISABLE, HAL_RADIO_DISABLE_ON_HCTO_PPI); + nrf_timer_publish_set(EVENT_TIMER, HAL_EVENT_TIMER_HCTO_EVENT, + HAL_RADIO_DISABLE_ON_HCTO_PPI); + nrf_radio_subscribe_set(NRF_RADIO, NRF_RADIO_TASK_DISABLE, + HAL_RADIO_DISABLE_ON_HCTO_PPI); } /******************************************************************************* @@ -89,9 +89,9 @@ 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, NRF_RADIO_EVENT_END, HAL_RADIO_END_TIME_CAPTURE_PPI); - nrf_timer_subscribe_set(EVENT_TIMER, - NRF_TIMER_TASK_CAPTURE2, 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); } /******************************************************************************* @@ -131,10 +131,10 @@ static inline void hal_event_timer_start_ppi_config(void) */ static inline void hal_radio_ready_time_capture_ppi_config(void) { - nrf_radio_publish_set(NRF_RADIO, - NRF_RADIO_EVENT_READY, HAL_RADIO_READY_TIME_CAPTURE_PPI); - nrf_timer_subscribe_set(EVENT_TIMER, - NRF_TIMER_TASK_CAPTURE0, HAL_RADIO_READY_TIME_CAPTURE_PPI); + nrf_radio_publish_set(NRF_RADIO, NRF_RADIO_EVENT_READY, + HAL_RADIO_READY_TIME_CAPTURE_PPI); + nrf_timer_subscribe_set(EVENT_TIMER, HAL_EVENT_TIMER_READY_TASK, + HAL_RADIO_READY_TIME_CAPTURE_PPI); } #if defined(CONFIG_BT_CTLR_LE_ENC) || defined(CONFIG_BT_CTLR_BROADCAST_ISO_ENC) @@ -215,16 +215,14 @@ static inline void hal_trigger_crypt_by_bcmatch_ppi_config(void) /******************************************************************************/ #if !defined(CONFIG_BT_CTLR_TIFS_HW) -#if !defined(CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER) -#define NRF_RADIO_PUBLISH_PDU_END_EVT PUBLISH_PHYEND -/* Wrappenr for EVENTS_END event name used by nRFX API */ -#define NRFX_RADIO_TXRX_END_EVENT NRF_RADIO_EVENT_PHYEND -#else /* CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */ -#define NRF_RADIO_PUBLISH_PDU_END_EVT PUBLISH_END -#define NRFX_RADIO_TXRX_END_EVENT NRF_RADIO_EVENT_END -#endif /* CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */ - /* 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 */ /* Clear SW-switch timer on packet end: * wire the RADIO EVENTS_END event to SW_SWITCH_TIMER TASKS_CLEAR task. @@ -236,7 +234,8 @@ 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, NRFX_RADIO_TXRX_END_EVENT, HAL_SW_SWITCH_TIMER_CLEAR_PPI); + nrf_radio_publish_set(NRF_RADIO, HAL_NRF_RADIO_TIFS_DPPI_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); @@ -305,7 +304,8 @@ static inline void hal_sw_switch_timer_clear_ppi_config(void) * Note: we do not need an additional PPI, since we have already set up * a PPI to publish RADIO END event. */ -#define HAL_SW_SWITCH_GROUP_TASK_ENABLE_PPI_REGISTER_EVT (NRF_RADIO->NRF_RADIO_PUBLISH_PDU_END_EVT) +#define HAL_SW_SWITCH_GROUP_TASK_ENABLE_PPI_REGISTER_EVT \ + (NRF_RADIO->HAL_RADIO_TIFS_DPPI_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_dppi_resources.h b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_dppi_resources.h index 8bb3fc1c9f0bdc..ed57597a134bc1 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_dppi_resources.h +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_dppi_resources.h @@ -94,16 +94,16 @@ /* Clear SW-switch timer on packet end: * wire the RADIO EVENTS_END event to SW_SWITCH_TIMER TASKS_CLEAR task. * - * Note: In case of HW TIFS support or single timer configuration we do not need - * an additional PPI, since we have already set up a PPI to publish RADIO END - * event. In other case separate PPI is used because packet end is marked by - * PHYEND event while last bit or CRC is marked by END event. + * Note: In case of single timer configuration we do not need an additional PPI, + * since we have already set up a PPI to publish RADIO END event. In other case + * separate PPI is used because packet end is marked by PHYEND event while last + * bit or CRC is marked by END event. */ -#if !defined(CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER) -#define HAL_SW_SWITCH_TIMER_CLEAR_PPI 24 -#else /* CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */ +#if defined(CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER) #define HAL_SW_SWITCH_TIMER_CLEAR_PPI HAL_RADIO_END_TIME_CAPTURE_PPI -#endif /* CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */ +#else /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */ +#define HAL_SW_SWITCH_TIMER_CLEAR_PPI 24 +#endif /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */ /* Wire a SW SWITCH TIMER EVENTS_COMPARE[] event * to a PPI GROUP TASK DISABLE task (PPI group with index ). 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 8185036fbc3b63..5d18d76ff61278 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 @@ -63,7 +63,7 @@ static inline void hal_radio_enable_on_tick_ppi_config_and_enable(uint8_t trx) if (trx) { nrf_ppi_channel_endpoint_setup(NRF_PPI, HAL_RADIO_ENABLE_TX_ON_TICK_PPI, - (uint32_t)&(EVENT_TIMER->EVENTS_COMPARE[0]), + (uint32_t)&(EVENT_TIMER->EVENTS_COMPARE[HAL_EVENT_TIMER_TRX_CC_OFFSET]), (uint32_t)&(NRF_RADIO->TASKS_TXEN)); #if defined(CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER) @@ -80,7 +80,7 @@ static inline void hal_radio_enable_on_tick_ppi_config_and_enable(uint8_t trx) } else { nrf_ppi_channel_endpoint_setup(NRF_PPI, HAL_RADIO_ENABLE_RX_ON_TICK_PPI, - (uint32_t)&(EVENT_TIMER->EVENTS_COMPARE[0]), + (uint32_t)&(EVENT_TIMER->EVENTS_COMPARE[HAL_EVENT_TIMER_TRX_CC_OFFSET]), (uint32_t)&(NRF_RADIO->TASKS_RXEN)); #if defined(CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER) @@ -122,7 +122,7 @@ static inline void hal_radio_recv_timeout_cancel_ppi_config(void) NRF_PPI, HAL_RADIO_RECV_TIMEOUT_CANCEL_PPI, (uint32_t)&(NRF_RADIO->EVENTS_ADDRESS), - (uint32_t)&(EVENT_TIMER->TASKS_CAPTURE[1])); + (uint32_t)&(EVENT_TIMER->TASKS_CAPTURE[HAL_EVENT_TIMER_HCTO_CC_OFFSET])); } #endif /* (EVENT_TIMER_ID == 0) */ @@ -149,7 +149,7 @@ static inline void hal_radio_disable_on_hcto_ppi_config(void) nrf_ppi_channel_endpoint_setup( NRF_PPI, HAL_RADIO_DISABLE_ON_HCTO_PPI, - (uint32_t)&(EVENT_TIMER->EVENTS_COMPARE[1]), + (uint32_t)&(EVENT_TIMER->EVENTS_COMPARE[HAL_EVENT_TIMER_HCTO_CC_OFFSET]), (uint32_t)&(NRF_RADIO->TASKS_DISABLE)); } @@ -177,8 +177,8 @@ 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->NRF_RADIO_TRX_END_EVENT), - (uint32_t)&(EVENT_TIMER->TASKS_CAPTURE[2])); + (uint32_t)&(NRF_RADIO->HAL_RADIO_TRX_EVENTS_END), + (uint32_t)&(EVENT_TIMER->TASKS_CAPTURE[HAL_EVENT_TIMER_TRX_END_CC_OFFSET])); } #endif /* (EVENT_TIMER_ID == 0) */ @@ -207,7 +207,7 @@ static inline void hal_radio_ready_time_capture_ppi_config(void) NRF_PPI, HAL_RADIO_READY_TIME_CAPTURE_PPI, (uint32_t)&(NRF_RADIO->EVENTS_READY), - (uint32_t)&(EVENT_TIMER->TASKS_CAPTURE[0])); + (uint32_t)&(EVENT_TIMER->TASKS_CAPTURE[HAL_EVENT_TIMER_TRX_CC_OFFSET])); } /******************************************************************************* @@ -303,7 +303,7 @@ static inline void hal_sw_switch_timer_clear_ppi_config(void) nrf_ppi_channel_endpoint_setup( NRF_PPI, HAL_SW_SWITCH_TIMER_CLEAR_PPI, - (uint32_t)&(NRF_RADIO->NRF_RADIO_TRX_END_EVENT), + (uint32_t)&(NRF_RADIO->HAL_RADIO_TRX_EVENTS_END), (uint32_t)&(SW_SWITCH_TIMER->TASKS_CLEAR)); } @@ -364,7 +364,7 @@ static inline void hal_sw_switch_timer_clear_ppi_config(void) * 'index' must be 0 or 1. */ #define HAL_SW_SWITCH_GROUP_TASK_ENABLE_PPI_EVT \ - ((uint32_t)&(NRF_RADIO->NRF_RADIO_TRX_END_EVENT)) + ((uint32_t)&(NRF_RADIO->HAL_RADIO_TRX_EVENTS_END)) #define HAL_SW_SWITCH_GROUP_TASK_ENABLE_PPI_TASK(index) \ ((uint32_t)&(NRF_PPI->TASKS_CHG[SW_SWITCH_TIMER_TASK_GROUP(index)].EN)) 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 bfeaacb6f84bb8..41163909c677ce 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,7 @@ * 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 NRF_RADIO_TRX_END_EVENT EVENTS_END +#define HAL_RADIO_TRX_EVENTS_END HAL_RADIO_EVENTS_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. @@ -27,9 +27,14 @@ #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 @@ -65,7 +70,7 @@ * 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 NRF_RADIO_TRX_END_EVENT EVENTS_END +#define HAL_RADIO_TRX_EVENTS_END HAL_RADIO_EVENTS_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. @@ -74,9 +79,14 @@ #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 @@ -94,7 +104,7 @@ * 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 NRF_RADIO_TRX_END_EVENT EVENTS_END +#define HAL_RADIO_TRX_EVENTS_END HAL_RADIO_EVENTS_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. @@ -103,9 +113,14 @@ #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 @@ -153,7 +168,7 @@ * 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 NRF_RADIO_TRX_END_EVENT EVENTS_PHYEND +#define HAL_RADIO_TRX_EVENTS_END HAL_RADIO_EVENTS_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. @@ -174,7 +189,7 @@ * 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 NRF_RADIO_TRX_END_EVENT EVENTS_END +#define HAL_RADIO_TRX_EVENTS_END HAL_RADIO_EVENTS_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. @@ -184,9 +199,14 @@ #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 diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_sim_nrf52.h b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_sim_nrf52.h index 62f0fc7a8d3dcd..099f073f30c3ba 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_sim_nrf52.h +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_sim_nrf52.h @@ -345,13 +345,27 @@ #endif /* !CONFIG_BT_CTLR_RADIO_ENABLE_FAST */ /* HAL abstraction of Radio bitfields */ -#define HAL_RADIO_INTENSET_DISABLED_Msk RADIO_INTENSET_DISABLED_Msk -#define HAL_RADIO_SHORTS_TRX_END_DISABLE_Msk RADIO_SHORTS_END_DISABLE_Msk -#define HAL_RADIO_SHORTS_TRX_PHYEND_DISABLE_Msk RADIO_SHORTS_PHYEND_DISABLE_Msk +#define HAL_NRF_RADIO_EVENT_END NRF_RADIO_EVENT_END +#define HAL_RADIO_EVENTS_END EVENTS_END +#define HAL_NRF_RADIO_EVENT_PHYEND NRF_RADIO_EVENT_PHYEND +#define HAL_RADIO_EVENTS_PHYEND EVENTS_PHYEND +#define HAL_RADIO_INTENSET_DISABLED_Msk RADIO_INTENSET_DISABLED_Msk +#define HAL_RADIO_SHORTS_TRX_END_DISABLE_Msk RADIO_SHORTS_END_DISABLE_Msk +#define HAL_RADIO_SHORTS_TRX_PHYEND_DISABLE_Msk RADIO_SHORTS_PHYEND_DISABLE_Msk +#define HAL_RADIO_CLEARPATTERN_CLEARPATTERN_Clear RADIO_CLEARPATTERN_CLEARPATTERN_Clear /* HAL abstraction of Radio IRQ number */ #define HAL_RADIO_IRQn RADIO_IRQn +/* SoC specific NRF_RADIO power-on reset value. Refer to Product Specification, + * RADIO Registers section for the documented reset values. + * + * NOTE: Only implementation used values defined here. + * In the future if MDK or nRFx header include these, use them instead. + */ +#define HAL_RADIO_RESET_VALUE_DFEMODE 0x00000000UL +#define HAL_RADIO_RESET_VALUE_CTEINLINECONF 0x00002800UL + static inline void hal_radio_reset(void) { } diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_sim_nrf5340.h b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_sim_nrf5340.h index 967db391b59990..ff31a6693cfe34 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_sim_nrf5340.h +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_sim_nrf5340.h @@ -363,9 +363,16 @@ #endif /* HAL abstraction of Radio bitfields */ -#define HAL_RADIO_INTENSET_DISABLED_Msk RADIO_INTENSET_DISABLED_Msk -#define HAL_RADIO_SHORTS_TRX_END_DISABLE_Msk RADIO_SHORTS_END_DISABLE_Msk -#define HAL_RADIO_SHORTS_TRX_PHYEND_DISABLE_Msk RADIO_SHORTS_PHYEND_DISABLE_Msk +#define HAL_NRF_RADIO_EVENT_END NRF_RADIO_EVENT_END +#define HAL_RADIO_EVENTS_END EVENTS_END +#define HAL_RADIO_PUBLISH_END PUBLISH_END +#define HAL_NRF_RADIO_EVENT_PHYEND NRF_RADIO_EVENT_PHYEND +#define HAL_RADIO_EVENTS_PHYEND EVENTS_PHYEND +#define HAL_RADIO_PUBLISH_PHYEND PUBLISH_PHYEND +#define HAL_RADIO_INTENSET_DISABLED_Msk RADIO_INTENSET_DISABLED_Msk +#define HAL_RADIO_SHORTS_TRX_END_DISABLE_Msk RADIO_SHORTS_END_DISABLE_Msk +#define HAL_RADIO_SHORTS_TRX_PHYEND_DISABLE_Msk RADIO_SHORTS_PHYEND_DISABLE_Msk +#define HAL_RADIO_CLEARPATTERN_CLEARPATTERN_Clear RADIO_CLEARPATTERN_CLEARPATTERN_Clear /* HAL abstraction of Radio IRQ number */ #define HAL_RADIO_IRQn RADIO_IRQn diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_sim_nrf54l.h b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_sim_nrf54l.h index bc0cc2993c563b..7c73a603ea9351 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_sim_nrf54l.h +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_sim_nrf54l.h @@ -361,6 +361,12 @@ #endif /* !CONFIG_BT_CTLR_RADIO_ENABLE_FAST */ /* HAL abstraction of Radio bitfields */ +#define HAL_NRF_RADIO_EVENT_END NRF_RADIO_EVENT_END +#define HAL_RADIO_EVENTS_END EVENTS_END +#define HAL_RADIO_PUBLISH_END PUBLISH_END +#define HAL_NRF_RADIO_EVENT_PHYEND NRF_RADIO_EVENT_PHYEND +#define HAL_RADIO_EVENTS_PHYEND EVENTS_PHYEND +#define HAL_RADIO_PUBLISH_PHYEND PUBLISH_PHYEND #define HAL_RADIO_INTENSET_DISABLED_Msk RADIO_INTENSET00_DISABLED_Msk #define HAL_RADIO_SHORTS_TRX_END_DISABLE_Msk RADIO_SHORTS_PHYEND_DISABLE_Msk #define HAL_RADIO_SHORTS_TRX_PHYEND_DISABLE_Msk RADIO_SHORTS_PHYEND_DISABLE_Msk