Skip to content

Commit ec69ccb

Browse files
cvinayakkartben
authored andcommitted
Bluetooth: Controller: Fix single timer direction finding support
Fix use of single timer software tIFS switching to support direction finding. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
1 parent 7520742 commit ec69ccb

File tree

2 files changed

+33
-34
lines changed

2 files changed

+33
-34
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ static inline void hal_trigger_crypt_by_bcmatch_ppi_config(void)
233233
#if !defined(CONFIG_BT_CTLR_TIFS_HW)
234234
/* DPPI setup used for SW-based auto-switching during TIFS. */
235235

236-
#if defined(CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER)
236+
#if defined(CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER) && !defined(CONFIG_BT_CTLR_DF)
237237
#define HAL_NRF_RADIO_TIMER_CLEAR_EVENT_END HAL_NRF_RADIO_EVENT_END
238238
#define HAL_RADIO_GROUP_TASK_ENABLE_PUBLISH_END HAL_RADIO_PUBLISH_END
239239
#else /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER || CONFIG_BT_CTLR_DF */

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

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -63,50 +63,50 @@
6363
*/
6464
#define HAL_RADIO_ISR_LATENCY_MAX_US 80U
6565

66-
#if defined(CONFIG_BT_CTLR_DF_CONN_CTE_RX)
67-
/* Delay of CCM TASKS_CRYPT start in number of bits for Radio Bit counter */
68-
#define CCM_TASKS_CRYPT_DELAY_BITS 3
69-
#endif /* CONFIG_BT_CTLR_DF_CONN_CTE_RX */
66+
#define SW_SWITCH_TIMER_EVTS_COMP_BASE 4
7067

7168
#if defined(CONFIG_BT_CTLR_PHY_CODED)
72-
#define SW_SWITCH_TIMER_EVTS_COMP_BASE 4
7369
#define SW_SWITCH_TIMER_EVTS_COMP_S2_BASE 6
70+
#endif /* !CONFIG_BT_CTLR_PHY_CODED */
71+
72+
#if defined(CONFIG_BT_CTLR_DF)
73+
#if defined(CONFIG_BT_CTLR_DF_PHYEND_OFFSET_COMPENSATION_ENABLE)
74+
/* Allocate 2 adjacent channels for PHYEND delay compensation. Use the same channels as for
75+
* PHY CODED S2. The CTEINLINE may not be enabled for PHY CODED so PHYEND event is generated
76+
* at the same instant as END event. Hence the channels are used interchangeably.
77+
* That saves from use of another timer.
78+
*/
79+
#define SW_SWITCH_TIMER_EVTS_COMP_PHYEND_DELAY_COMPENSATION_BASE 6
80+
#endif /* CONFIG_BT_CTLR_DF_PHYEND_OFFSET_COMPENSATION_ENABLE */
7481

7582
/* Wrapper for EVENTS_END event generated by Radio peripheral at the very end of the transmission
7683
* or reception of a PDU on air. In case of regular PDU it is generated when last bit of CRC is
7784
* received or transmitted.
85+
*
86+
* When direction finding is enabled a PDU may include Constant Tone Extension at its end. For PDU
87+
* including CTE EVENTS_PHYEND event is generated at very end of a PDU. In case there is no CTE in
88+
* a PDU the EVENTS_PHYEND event is generated in the same instant as EVENTS_END event.
7889
*/
79-
#define HAL_RADIO_TRX_EVENTS_END HAL_RADIO_EVENTS_END
80-
#define HAL_NRF_RADIO_TRX_EVENT_END HAL_NRF_RADIO_EVENT_END
90+
#define HAL_RADIO_TRX_EVENTS_END HAL_RADIO_EVENTS_PHYEND
91+
#define HAL_NRF_RADIO_TRX_EVENT_END HAL_NRF_RADIO_EVENT_PHYEND
8192

82-
/* Wrapper for RADIO_SHORTS mask connecting EVENTS_END to EVENTS_DISABLE.
83-
* This is a default shortcut used to automatically disable Radio after end of PDU.
93+
/* Wrapper for RADIO_SHORTS mask connecting EVENTS_PHYEND to EVENTS_DISABLE.
94+
* This is a mask for SOC that has Direction Finding Extension in a Radio peripheral.
95+
* It enables shortcut for EVENTS_PHYEND event generated at very end to Radio EVENTS_DISABLE event.
96+
* In case there is a CTE in a PDU then EVENTS_PHYEND event is generated after the CTE.
97+
* If there is no CTE, it is generated in the same instant as EVENTS_END.
8498
*/
85-
#define NRF_RADIO_SHORTS_TRX_END_DISABLE_Msk HAL_RADIO_SHORTS_TRX_END_DISABLE_Msk
86-
87-
#define HAL_EVENT_TIMER_TRX_CC_OFFSET 0
88-
#define HAL_EVENT_TIMER_TRX_EVENT NRF_TIMER_EVENT_COMPARE0
89-
#define HAL_EVENT_TIMER_READY_TASK NRF_TIMER_TASK_CAPTURE0
90-
91-
#define HAL_EVENT_TIMER_HCTO_CC_OFFSET 1
92-
#define HAL_EVENT_TIMER_HCTO_EVENT NRF_TIMER_EVENT_COMPARE1
93-
#define HAL_EVENT_TIMER_ADDRESS_TASK NRF_TIMER_TASK_CAPTURE1
94-
95-
#define HAL_EVENT_TIMER_TRX_END_CC_OFFSET 2
96-
#define HAL_EVENT_TIMER_TRX_END_TASK NRF_TIMER_TASK_CAPTURE2
97-
98-
#define HAL_EVENT_TIMER_DEFERRED_TRX_CC_OFFSET 2
99-
#define HAL_EVENT_TIMER_DEFERRED_TX_EVENT NRF_TIMER_EVENT_COMPARE2
100-
101-
#define HAL_EVENT_TIMER_SAMPLE_CC_OFFSET 3
102-
#define HAL_EVENT_TIMER_SAMPLE_TASK NRF_TIMER_TASK_CAPTURE3
99+
#define NRF_RADIO_SHORTS_TRX_END_DISABLE_Msk HAL_RADIO_SHORTS_TRX_PHYEND_DISABLE_Msk
103100

104-
#define HAL_EVENT_TIMER_PA_LNA_CC_OFFSET 2
105-
#define HAL_EVENT_TIMER_PA_LNA_PDN_CC_OFFSET 3
101+
/* Delay of EVENTS_PHYEND event on receive PDU without CTE included when CTEINLINE is enabled */
102+
#define RADIO_EVENTS_PHYEND_DELAY_US 16
106103

107-
#else /* !CONFIG_BT_CTLR_PHY_CODED */
108-
#define SW_SWITCH_TIMER_EVTS_COMP_BASE 4
104+
#if defined(CONFIG_BT_CTLR_DF_CONN_CTE_RX)
105+
/* Delay of CCM TASKS_CRYPT start in number of bits for Radio Bit counter */
106+
#define CCM_TASKS_CRYPT_DELAY_BITS 3
107+
#endif /* CONFIG_BT_CTLR_DF_CONN_CTE_RX */
109108

109+
#else /* !CONFIG_BT_CTLR_DF */
110110
/* Wrapper for EVENTS_END event generated by Radio peripheral at the very end of the transmission
111111
* or reception of a PDU on air. In case of regular PDU it is generated when last bit of CRC is
112112
* received or transmitted.
@@ -118,6 +118,7 @@
118118
* This is a default shortcut used to automatically disable Radio after end of PDU.
119119
*/
120120
#define NRF_RADIO_SHORTS_TRX_END_DISABLE_Msk HAL_RADIO_SHORTS_TRX_END_DISABLE_Msk
121+
#endif /* !CONFIG_BT_CTLR_DF */
121122

122123
#define HAL_EVENT_TIMER_TRX_CC_OFFSET 0
123124
#define HAL_EVENT_TIMER_TRX_EVENT NRF_TIMER_EVENT_COMPARE0
@@ -138,7 +139,6 @@
138139

139140
#define HAL_EVENT_TIMER_PA_LNA_CC_OFFSET 2
140141
#define HAL_EVENT_TIMER_PA_LNA_PDN_CC_OFFSET 3
141-
#endif /* !CONFIG_BT_CTLR_PHY_CODED */
142142

143143
#else /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */
144144
#define EVENT_TIMER_ID 0
@@ -158,7 +158,6 @@
158158
#endif /* !CONFIG_BT_CTLR_PHY_CODED */
159159

160160
#if defined(CONFIG_BT_CTLR_DF)
161-
162161
#if defined(CONFIG_BT_CTLR_DF_PHYEND_OFFSET_COMPENSATION_ENABLE)
163162
/* Allocate 2 adjacent channels for PHYEND delay compensation. Use the same channels as for
164163
* PHY CODED S2. The CTEINLINE may not be enabled for PHY CODED so PHYEND event is generated

0 commit comments

Comments
 (0)