Skip to content

Commit 23281c4

Browse files
cvinayakandrzej-kaczmarek
authored andcommitted
Bluetooth: controller: nRF5: Back-to-Back Radio Tx interface
Add Radio interface to perform back-to-back transmit of PDU with a configurable inter frame spacing. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
1 parent b82a662 commit 23281c4

File tree

2 files changed

+37
-11
lines changed

2 files changed

+37
-11
lines changed

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

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -446,24 +446,34 @@ void *radio_pkt_decrypt_get(void)
446446
#if !defined(CONFIG_BT_CTLR_TIFS_HW)
447447
static uint8_t sw_tifs_toggle;
448448

449-
static void sw_switch(uint8_t dir, uint8_t phy_curr, uint8_t flags_curr, uint8_t phy_next,
450-
uint8_t flags_next)
449+
static void sw_switch(uint8_t dir_curr, uint8_t dir_next,
450+
uint8_t phy_curr, uint8_t flags_curr,
451+
uint8_t phy_next, uint8_t flags_next)
451452
{
452453
uint8_t ppi = HAL_SW_SWITCH_RADIO_ENABLE_PPI(sw_tifs_toggle);
453454
uint8_t cc = SW_SWITCH_TIMER_EVTS_COMP(sw_tifs_toggle);
454455
uint32_t delay;
455456

456457
hal_radio_sw_switch_setup(cc, ppi, sw_tifs_toggle);
457458

458-
if (dir) {
459+
if (dir_next) {
459460
/* TX */
460461

461-
/* Calculate delay with respect to current (RX) and next
462-
* (TX) PHY. If RX PHY is LE Coded, assume S8 coding scheme.
462+
/* Calculate delay with respect to current and next PHY.
463+
* If RX PHY is LE Coded, assume S8 coding scheme.
463464
*/
464-
delay = HAL_RADIO_NS2US_ROUND(
465-
hal_radio_tx_ready_delay_ns_get(phy_next, flags_next) +
466-
hal_radio_rx_chain_delay_ns_get(phy_curr, 1));
465+
if (dir_curr) {
466+
delay = HAL_RADIO_NS2US_ROUND(
467+
hal_radio_tx_ready_delay_ns_get(phy_next,
468+
flags_next) +
469+
hal_radio_tx_chain_delay_ns_get(phy_curr,
470+
flags_curr));
471+
} else {
472+
delay = HAL_RADIO_NS2US_ROUND(
473+
hal_radio_tx_ready_delay_ns_get(phy_next,
474+
flags_next) +
475+
hal_radio_rx_chain_delay_ns_get(phy_curr, 1));
476+
}
467477

468478
hal_radio_txen_on_sw_switch(ppi);
469479

@@ -475,7 +485,7 @@ static void sw_switch(uint8_t dir, uint8_t phy_curr, uint8_t flags_curr, uint8_t
475485
HAL_SW_SWITCH_GROUP_TASK_DISABLE_PPI(
476486
sw_tifs_toggle);
477487

478-
if (phy_curr & PHY_CODED) {
488+
if (!dir_curr && (phy_curr & PHY_CODED)) {
479489
/* Switching to TX after RX on LE Coded PHY. */
480490

481491
uint8_t cc_s2 =
@@ -565,7 +575,7 @@ void radio_switch_complete_and_rx(uint8_t phy_rx)
565575
#else /* !CONFIG_BT_CTLR_TIFS_HW */
566576
NRF_RADIO->SHORTS = RADIO_SHORTS_READY_START_Msk |
567577
RADIO_SHORTS_END_DISABLE_Msk;
568-
sw_switch(0, 0, 0, phy_rx, 0);
578+
sw_switch(1, 0, 0, 0, phy_rx, 0);
569579
#endif /* !CONFIG_BT_CTLR_TIFS_HW */
570580
}
571581

@@ -579,7 +589,21 @@ void radio_switch_complete_and_tx(uint8_t phy_rx, uint8_t flags_rx, uint8_t phy_
579589
#else /* !CONFIG_BT_CTLR_TIFS_HW */
580590
NRF_RADIO->SHORTS = RADIO_SHORTS_READY_START_Msk |
581591
RADIO_SHORTS_END_DISABLE_Msk;
582-
sw_switch(1, phy_rx, flags_rx, phy_tx, flags_tx);
592+
sw_switch(0, 1, phy_rx, flags_rx, phy_tx, flags_tx);
593+
#endif /* !CONFIG_BT_CTLR_TIFS_HW */
594+
}
595+
596+
void radio_switch_complete_and_b2b_tx(uint8_t phy_curr, uint8_t flags_curr,
597+
uint8_t phy_next, uint8_t flags_next)
598+
{
599+
#if defined(CONFIG_BT_CTLR_TIFS_HW)
600+
NRF_RADIO->SHORTS = RADIO_SHORTS_READY_START_Msk |
601+
RADIO_SHORTS_END_DISABLE_Msk |
602+
RADIO_SHORTS_DISABLED_TXEN_Msk;
603+
#else /* !CONFIG_BT_CTLR_TIFS_HW */
604+
NRF_RADIO->SHORTS = RADIO_SHORTS_READY_START_Msk |
605+
RADIO_SHORTS_END_DISABLE_Msk;
606+
sw_switch(1, 1, phy_curr, flags_curr, phy_next, flags_next);
583607
#endif /* !CONFIG_BT_CTLR_TIFS_HW */
584608
}
585609

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ void *radio_pkt_decrypt_get(void);
4848
void radio_switch_complete_and_rx(uint8_t phy_rx);
4949
void radio_switch_complete_and_tx(uint8_t phy_rx, uint8_t flags_rx, uint8_t phy_tx,
5050
uint8_t flags_tx);
51+
void radio_switch_complete_and_b2b_tx(uint8_t phy_curr, uint8_t flags_curr,
52+
uint8_t phy_next, uint8_t flags_next);
5153
void radio_switch_complete_and_disable(void);
5254

5355
void radio_rssi_measure(void);

0 commit comments

Comments
 (0)