Bluetooth: controller: split: Reduce time to setup tIFS switch

Refactor to reduce the setup next tIFS switch within tIFS
period of the Radio ISR.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit is contained in:
Vinayak Kariappa Chettimada 2019-09-18 13:00:01 +05:30 committed by Carles Cufí
commit b0826a7f65
3 changed files with 35 additions and 24 deletions

View file

@ -319,7 +319,6 @@ static void isr_tx(void *param)
u32_t hcto;
/* TODO: MOVE to a common interface, isr_lll_radio_status? */
if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) {
lll_prof_latency_capture();
}
@ -334,11 +333,11 @@ static void isr_tx(void *param)
}
/* TODO: MOVE ^^ */
radio_isr_set(isr_rx, param);
/* setup tIFS switching */
radio_tmr_tifs_set(EVENT_IFS_US);
radio_switch_complete_and_tx(0, 0, 0, 0);
radio_pkt_rx_set(radio_pkt_scratch_get());
radio_pkt_rx_set(radio_pkt_scratch_get());
/* assert if radio packet ptr is not set and radio started rx */
LL_ASSERT(!radio_is_ready());
@ -346,6 +345,8 @@ static void isr_tx(void *param)
lll_prof_cputime_capture();
}
radio_isr_set(isr_rx, param);
#if defined(CONFIG_BT_CTLR_PRIVACY)
if (ull_filter_lll_rl_enabled()) {
u8_t count, *irks = ull_filter_lll_irks_get(&count);
@ -596,6 +597,7 @@ static void chan_prepare(struct lll_adv *lll)
pdu = lll_adv_data_latest_get(lll, &upd);
scan_pdu = lll_adv_scan_rsp_latest_get(lll, &upd);
#if defined(CONFIG_BT_CTLR_PRIVACY)
if (upd) {
/* Copy the address from the adv packet we will send into the

View file

@ -242,7 +242,6 @@ void lll_conn_isr_rx(void *param)
#endif /* CONFIG_BT_PERIPHERAL */
}
} else {
radio_isr_set(lll_conn_isr_tx, param);
radio_tmr_tifs_set(EVENT_IFS_US);
#if defined(CONFIG_BT_CTLR_PHY)
@ -251,6 +250,8 @@ void lll_conn_isr_rx(void *param)
radio_switch_complete_and_rx(0);
#endif /* !CONFIG_BT_CTLR_PHY */
radio_isr_set(lll_conn_isr_tx, param);
/* capture end of Tx-ed PDU, used to calculate HCTO. */
radio_tmr_end_capture();
}
@ -360,7 +361,7 @@ void lll_conn_isr_tx(void *param)
#endif /* CONFIG_BT_CTLR_GPIO_PA_PIN || CONFIG_BT_CTLR_GPIO_LNA_PIN */
/* TODO: MOVE ^^ */
radio_isr_set(lll_conn_isr_rx, param);
/* setup tIFS switching */
radio_tmr_tifs_set(EVENT_IFS_US);
#if defined(CONFIG_BT_CTLR_PHY)
radio_switch_complete_and_tx(lll->phy_rx, 0,
@ -414,6 +415,8 @@ void lll_conn_isr_tx(void *param)
CONFIG_BT_CTLR_GPIO_LNA_OFFSET);
#endif /* !CONFIG_BT_CTLR_PHY */
#endif /* CONFIG_BT_CTLR_GPIO_LNA_PIN */
radio_isr_set(lll_conn_isr_rx, param);
}
void lll_conn_isr_abort(void *param)

View file

@ -143,9 +143,6 @@ static int prepare_cb(struct lll_prepare_param *prepare_param)
return 0;
}
node_rx = ull_pdu_rx_alloc_peek(1);
LL_ASSERT(node_rx);
radio_reset();
#if defined(CONFIG_BT_CTLR_TX_PWR_DYNAMIC_CONTROL)
radio_tx_power_set(lll->tx_pwr_lvl);
@ -162,6 +159,8 @@ static int prepare_cb(struct lll_prepare_param *prepare_param)
radio_pkt_configure(8, PDU_AC_PAYLOAD_SIZE_MAX, 0);
#endif /* !CONFIG_BT_CTLR_ADV_EXT */
node_rx = ull_pdu_rx_alloc_peek(1);
LL_ASSERT(node_rx);
radio_pkt_rx_set(node_rx->pdu);
radio_aa_set((u8_t *)&aa);
@ -172,6 +171,7 @@ static int prepare_cb(struct lll_prepare_param *prepare_param)
radio_isr_set(isr_rx, lll);
/* setup tIFS switching */
radio_tmr_tifs_set(EVENT_IFS_US);
radio_switch_complete_and_tx(0, 0, 0, 0);
@ -442,12 +442,12 @@ static void isr_tx(void *param)
}
/* TODO: MOVE ^^ */
node_rx = ull_pdu_rx_alloc_peek(1);
LL_ASSERT(node_rx);
radio_isr_set(isr_rx, param);
/* setup tIFS switching */
radio_tmr_tifs_set(EVENT_IFS_US);
radio_switch_complete_and_tx(0, 0, 0, 0);
node_rx = ull_pdu_rx_alloc_peek(1);
LL_ASSERT(node_rx);
radio_pkt_rx_set(node_rx->pdu);
/* assert if radio packet ptr is not set and radio started rx */
@ -477,6 +477,8 @@ static void isr_tx(void *param)
radio_tx_chain_delay_get(0, 0) -
CONFIG_BT_CTLR_GPIO_LNA_OFFSET);
#endif /* CONFIG_BT_CTLR_GPIO_LNA_PIN */
radio_isr_set(isr_rx, param);
}
static void isr_common_done(void *param)
@ -497,13 +499,13 @@ static void isr_common_done(void *param)
}
/* TODO: MOVE ^^ */
node_rx = ull_pdu_rx_alloc_peek(1);
LL_ASSERT(node_rx);
/* setup tIFS switching */
radio_tmr_tifs_set(EVENT_IFS_US);
radio_switch_complete_and_tx(0, 0, 0, 0);
node_rx = ull_pdu_rx_alloc_peek(1);
LL_ASSERT(node_rx);
radio_pkt_rx_set(node_rx->pdu);
radio_rssi_measure();
#if defined(CONFIG_BT_CTLR_PRIVACY)
if (ull_filter_lll_rl_enabled()) {
@ -513,6 +515,8 @@ static void isr_common_done(void *param)
}
#endif /* CONFIG_BT_CTLR_PRIVACY */
radio_rssi_measure();
radio_isr_set(isr_rx, param);
}
@ -713,12 +717,11 @@ static inline u32_t isr_rx_pdu(struct lll_scan *lll, u8_t devmatch_ok,
}
evt = HDR_LLL2EVT(lll);
if (pdu_end_us > (HAL_TICKER_TICKS_TO_US(evt->ticks_slot) -
502 - EVENT_OVERHEAD_START_US -
EVENT_IFS_US - 352 - EVENT_OVERHEAD_START_US -
EVENT_TICKER_RES_MARGIN_US)) {
return -ETIME;
}
radio_isr_set(isr_cleanup, lll);
radio_switch_complete_and_disable();
/* Acquire the connection context */
@ -798,6 +801,7 @@ static inline u32_t isr_rx_pdu(struct lll_scan *lll, u8_t devmatch_ok,
lll_prof_cputime_capture();
}
radio_isr_set(isr_cleanup, lll);
#if defined(CONFIG_BT_CTLR_GPIO_PA_PIN)
if (IS_ENABLED(CONFIG_BT_CTLR_PROFILE_ISR)) {
@ -883,6 +887,10 @@ static inline u32_t isr_rx_pdu(struct lll_scan *lll, u8_t devmatch_ok,
#endif /* CONFIG_BT_CTLR_PRIVACY */
u32_t err;
/* setup tIFS switching */
radio_tmr_tifs_set(EVENT_IFS_US);
radio_switch_complete_and_rx(0);
/* save the adv packet */
err = isr_rx_scan_report(lll, rssi_ready,
irkmatch_ok ? rl_idx : FILTER_IDX_NONE,
@ -913,12 +921,6 @@ static inline u32_t isr_rx_pdu(struct lll_scan *lll, u8_t devmatch_ok,
memcpy(&pdu_tx->scan_req.adv_addr[0],
&pdu_adv_rx->adv_ind.addr[0], BDADDR_SIZE);
/* switch scanner state to active */
lll->state = 1U;
radio_isr_set(isr_tx, lll);
radio_tmr_tifs_set(EVENT_IFS_US);
radio_switch_complete_and_rx(0);
radio_pkt_tx_set(pdu_tx);
/* assert if radio packet ptr is not set and radio started tx */
@ -948,6 +950,10 @@ static inline u32_t isr_rx_pdu(struct lll_scan *lll, u8_t devmatch_ok,
CONFIG_BT_CTLR_GPIO_PA_OFFSET);
#endif /* CONFIG_BT_CTLR_GPIO_PA_PIN */
/* switch scanner state to active */
lll->state = 1U;
radio_isr_set(isr_tx, lll);
return 0;
}
/* Passive scanner or scan responses */