Skip to content

Commit 2a99857

Browse files
cvinayakcarlescufi
authored andcommitted
Bluetooth: controller: Refactor PA/LNA PPI configuration
Refactor the implementation of PA/LNA PPI configuration which was done on every Tx or Rx as common code to be executed once per radio reset. And only setup the timeout and enabling of PPI at every Tx or Rx. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
1 parent 5470444 commit 2a99857

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@ void radio_reset(void)
118118
#if !defined(CONFIG_BT_CTLR_TIFS_HW)
119119
hal_radio_sw_switch_ppi_group_setup();
120120
#endif
121+
122+
#if defined(CONFIG_BT_CTLR_GPIO_PA_PIN) || defined(CONFIG_BT_CTLR_GPIO_LNA_PIN)
123+
hal_palna_ppi_setup();
124+
#endif
121125
}
122126

123127
void radio_phy_set(uint8_t phy, uint8_t flags)
@@ -1023,9 +1027,6 @@ void radio_gpio_lna_off(void)
10231027
void radio_gpio_pa_lna_enable(uint32_t trx_us)
10241028
{
10251029
nrf_timer_cc_set(EVENT_TIMER, 2, trx_us);
1026-
1027-
hal_enable_palna_ppi_config();
1028-
hal_disable_palna_ppi_config();
10291030
hal_radio_nrf_ppi_channels_enable(BIT(HAL_ENABLE_PALNA_PPI) |
10301031
BIT(HAL_DISABLE_PALNA_PPI));
10311032
}

subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_ppi.h

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -264,22 +264,17 @@ static inline void hal_trigger_rateoverride_ppi_config(void)
264264
/******************************************************************************/
265265
#if defined(CONFIG_BT_CTLR_GPIO_PA_PIN) || defined(CONFIG_BT_CTLR_GPIO_LNA_PIN)
266266

267-
#define HAL_ENABLE_PALNA_PPI 15
267+
#define HAL_ENABLE_PALNA_PPI 15
268+
#define HAL_DISABLE_PALNA_PPI 16
268269

269-
static inline void hal_enable_palna_ppi_config(void)
270+
static inline void hal_palna_ppi_setup(void)
270271
{
271272
nrf_ppi_channel_endpoint_setup(
272273
NRF_PPI,
273274
HAL_ENABLE_PALNA_PPI,
274275
(uint32_t)&(EVENT_TIMER->EVENTS_COMPARE[2]),
275276
(uint32_t)&(NRF_GPIOTE->TASKS_OUT[
276277
CONFIG_BT_CTLR_PA_LNA_GPIOTE_CHAN]));
277-
}
278-
279-
#define HAL_DISABLE_PALNA_PPI 16
280-
281-
static inline void hal_disable_palna_ppi_config(void)
282-
{
283278
nrf_ppi_channel_endpoint_setup(
284279
NRF_PPI,
285280
HAL_DISABLE_PALNA_PPI,

0 commit comments

Comments
 (0)