Bluetooth: controller: sw-switch with the event timer (prepare commit)

This commit implements minor refactoring of radio.c and ctrl.c,
to prepare for adding the implementation of sw-switch based on
the event timer.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
This commit is contained in:
Ioannis Glaropoulos 2018-01-31 13:07:12 +01:00 committed by Carles Cufí
commit 0ec1095dd6
3 changed files with 24 additions and 10 deletions

View file

@ -900,6 +900,11 @@ u32_t radio_tmr_end_get(void)
return EVENT_TIMER->CC[2];
}
u32_t radio_tmr_tifs_base_get(void)
{
return radio_tmr_end_get();
}
#if defined(CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER)
static u32_t tmr_sample_val;
#endif /* CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */

View file

@ -78,6 +78,7 @@ u32_t radio_tmr_aa_restore(void);
u32_t radio_tmr_ready_get(void);
void radio_tmr_end_capture(void);
u32_t radio_tmr_end_get(void);
u32_t radio_tmr_tifs_base_get(void);
void radio_tmr_sample(void);
u32_t radio_tmr_sample_get(void);

View file

@ -614,7 +614,8 @@ static inline void isr_radio_state_tx(void)
_radio.state = STATE_RX;
hcto = radio_tmr_end_get() + RADIO_TIFS + 4 + 1; /* 1us, end jitter */
hcto = radio_tmr_tifs_base_get()
+ RADIO_TIFS + 4 + 1; /* 1us, end jitter */
radio_tmr_tifs_set(RADIO_TIFS);
@ -654,7 +655,8 @@ static inline void isr_radio_state_tx(void)
#endif /* CONFIG_BT_CTLR_SCAN_REQ_RSSI */
#if defined(CONFIG_BT_CTLR_GPIO_LNA_PIN)
radio_gpio_pa_lna_enable(radio_tmr_end_get() + RADIO_TIFS - 4 -
radio_gpio_pa_lna_enable(radio_tmr_tifs_base_get() +
RADIO_TIFS - 4 -
radio_tx_chain_delay_get(0, 0) -
CONFIG_BT_CTLR_GPIO_LNA_OFFSET);
#endif /* CONFIG_BT_CTLR_GPIO_LNA_PIN */
@ -684,7 +686,8 @@ static inline void isr_radio_state_tx(void)
radio_rssi_measure();
#if defined(CONFIG_BT_CTLR_GPIO_LNA_PIN)
radio_gpio_pa_lna_enable(radio_tmr_end_get() + RADIO_TIFS - 4 -
radio_gpio_pa_lna_enable(radio_tmr_tifs_base_get() +
RADIO_TIFS - 4 -
radio_tx_chain_delay_get(0, 0) -
CONFIG_BT_CTLR_GPIO_LNA_OFFSET);
#endif /* CONFIG_BT_CTLR_GPIO_LNA_PIN */
@ -731,13 +734,15 @@ static inline void isr_radio_state_tx(void)
#if defined(CONFIG_BT_CTLR_GPIO_LNA_PIN)
#if defined(CONFIG_BT_CTLR_PHY)
radio_gpio_pa_lna_enable(radio_tmr_end_get() + RADIO_TIFS - 4 -
radio_gpio_pa_lna_enable(radio_tmr_tifs_base_get() +
RADIO_TIFS - 4 -
radio_tx_chain_delay_get(
_radio.conn_curr->phy_tx,
_radio.conn_curr->phy_flags) -
CONFIG_BT_CTLR_GPIO_LNA_OFFSET);
#else /* !CONFIG_BT_CTLR_PHY */
radio_gpio_pa_lna_enable(radio_tmr_end_get() + RADIO_TIFS - 4 -
radio_gpio_pa_lna_enable(radio_tmr_tifs_base_get() +
RADIO_TIFS - 4 -
radio_tx_chain_delay_get(0, 0) -
CONFIG_BT_CTLR_GPIO_LNA_OFFSET);
#endif /* !CONFIG_BT_CTLR_PHY */
@ -922,7 +927,8 @@ static inline u32_t isr_rx_adv(u8_t devmatch_ok, u8_t devmatch_id,
#if defined(CONFIG_BT_CTLR_GPIO_PA_PIN)
radio_gpio_pa_setup();
radio_gpio_pa_lna_enable(radio_tmr_end_get() + RADIO_TIFS -
radio_gpio_pa_lna_enable(radio_tmr_tifs_base_get() +
RADIO_TIFS -
radio_rx_chain_delay_get(0, 0) -
CONFIG_BT_CTLR_GPIO_PA_OFFSET);
#endif /* CONFIG_BT_CTLR_GPIO_PA_PIN */
@ -1472,7 +1478,8 @@ static inline u32_t isr_rx_scan(u8_t devmatch_ok, u8_t devmatch_id,
#if defined(CONFIG_BT_CTLR_GPIO_PA_PIN)
radio_gpio_pa_setup();
radio_gpio_pa_lna_enable(radio_tmr_end_get() + RADIO_TIFS -
radio_gpio_pa_lna_enable(radio_tmr_tifs_base_get() +
RADIO_TIFS -
radio_rx_chain_delay_get(0, 0) -
CONFIG_BT_CTLR_GPIO_PA_OFFSET);
#endif /* CONFIG_BT_CTLR_GPIO_PA_PIN */
@ -1670,7 +1677,8 @@ static inline u32_t isr_rx_scan(u8_t devmatch_ok, u8_t devmatch_id,
#if defined(CONFIG_BT_CTLR_GPIO_PA_PIN)
radio_gpio_pa_setup();
radio_gpio_pa_lna_enable(radio_tmr_end_get() + RADIO_TIFS -
radio_gpio_pa_lna_enable(radio_tmr_tifs_base_get() +
RADIO_TIFS -
radio_rx_chain_delay_get(0, 0) -
CONFIG_BT_CTLR_GPIO_PA_OFFSET);
#endif /* CONFIG_BT_CTLR_GPIO_PA_PIN */
@ -3498,12 +3506,12 @@ static inline void isr_rx_conn(u8_t crc_ok, u8_t trx_done,
radio_gpio_pa_setup();
#if defined(CONFIG_BT_CTLR_PHY)
radio_gpio_pa_lna_enable(radio_tmr_end_get() + RADIO_TIFS -
radio_gpio_pa_lna_enable(radio_tmr_tifs_base_get() + RADIO_TIFS -
radio_rx_chain_delay_get(
_radio.conn_curr->phy_rx, 1) -
CONFIG_BT_CTLR_GPIO_PA_OFFSET);
#else /* !CONFIG_BT_CTLR_PHY */
radio_gpio_pa_lna_enable(radio_tmr_end_get() + RADIO_TIFS -
radio_gpio_pa_lna_enable(radio_tmr_tifs_base_get() + RADIO_TIFS -
radio_rx_chain_delay_get(0, 0) -
CONFIG_BT_CTLR_GPIO_PA_OFFSET);
#endif /* !CONFIG_BT_CTLR_PHY */