From 4dbfb22a7ea5266d2ebeaa3d774d421d0fb55a65 Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Fri, 28 Jun 2024 14:19:47 +0200 Subject: [PATCH] Bluetooth: Controller: Relax radio packet pointer assignment deadline Relax the radio packet pointer assignment deadline assertion until access address being transmitted. The PDU buffer is probably only needed just after access address is being transmitted or received by the radio. This will give some more breathing room for slow CPUs like in nRF51x SoCs. Signed-off-by: Vinayak Kariappa Chettimada --- .../controller/ll_sw/nordic/hal/nrf5/radio/radio.c | 6 ++++++ .../controller/ll_sw/nordic/hal/nrf5/radio/radio.h | 1 + subsys/bluetooth/controller/ll_sw/nordic/lll/lll_conn.c | 8 ++++---- 3 files changed, 11 insertions(+), 4 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 17e2bd282be..c63883bf4b2 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 @@ -596,6 +596,7 @@ void radio_status_reset(void) * EVENT_* registers are not reset to save code and CPU time. */ nrf_radio_event_clear(NRF_RADIO, NRF_RADIO_EVENT_READY); + nrf_radio_event_clear(NRF_RADIO, NRF_RADIO_EVENT_ADDRESS); nrf_radio_event_clear(NRF_RADIO, NRF_RADIO_EVENT_END); #if defined(CONFIG_BT_CTLR_DF_SUPPORT) && !defined(CONFIG_ZTEST) /* Clear it only for SoCs supporting DF extension */ @@ -616,6 +617,11 @@ uint32_t radio_is_ready(void) return (NRF_RADIO->EVENTS_READY != 0); } +uint32_t radio_is_address(void) +{ + return (NRF_RADIO->EVENTS_ADDRESS != 0); +} + #if defined(CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER) static uint32_t last_pdu_end_us; diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.h b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.h index fbc79906a2c..f2a99cfc552 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.h +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.h @@ -84,6 +84,7 @@ void radio_disable(void); void radio_status_reset(void); uint32_t radio_is_ready(void); +uint32_t radio_is_address(void); uint32_t radio_is_done(void); uint32_t radio_has_disabled(void); uint32_t radio_is_idle(void); diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_conn.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_conn.c index d17c66d6778..131fcde4d48 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_conn.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_conn.c @@ -397,10 +397,10 @@ void lll_conn_isr_rx(void *param) /* assert if radio packet ptr is not set and radio started tx */ if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { - LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, + LL_ASSERT_MSG(!radio_is_address(), "%s: Radio ISR latency: %u", __func__, lll_prof_latency_get()); } else { - LL_ASSERT(!radio_is_ready()); + LL_ASSERT(!radio_is_address()); } lll_conn_isr_rx_exit: @@ -576,10 +576,10 @@ void lll_conn_isr_tx(void *param) /* assert if radio packet ptr is not set and radio started rx */ if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) { - LL_ASSERT_MSG(!radio_is_ready(), "%s: Radio ISR latency: %u", __func__, + LL_ASSERT_MSG(!radio_is_address(), "%s: Radio ISR latency: %u", __func__, lll_prof_latency_get()); } else { - LL_ASSERT(!radio_is_ready()); + LL_ASSERT(!radio_is_address()); } #if defined(CONFIG_BT_CTLR_DF_CONN_CTE_TX)