Commit f67a94f4 authored by Vinayak Kariappa Chettimada's avatar Vinayak Kariappa Chettimada Committed by Benjamin Cabé
Browse files

Bluetooth: Controller: Fix single timer end time capture



Fix single timer use end time capture from being disabled
as end time and timer clear use the same PPI.

Signed-off-by: default avatarVinayak Kariappa Chettimada <vich@nordicsemi.no>
parent 65d69ec1
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -528,8 +528,10 @@ static inline void hal_radio_sw_switch_cleanup(void)
{
	hal_radio_sw_switch_disable();
	nrf_dppi_channels_disable(NRF_DPPIC,
				  (BIT(HAL_SW_SWITCH_TIMER_CLEAR_PPI) |
				   BIT(HAL_SW_SWITCH_GROUP_TASK_ENABLE_PPI)));
#if !defined(CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER)
				  BIT(HAL_SW_SWITCH_TIMER_CLEAR_PPI) |
#endif /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */
				  BIT(HAL_SW_SWITCH_GROUP_TASK_ENABLE_PPI));
	nrf_dppi_group_disable(NRF_DPPIC, SW_SWITCH_TIMER_TASK_GROUP(0));
	nrf_dppi_group_disable(NRF_DPPIC, SW_SWITCH_TIMER_TASK_GROUP(1));
}
+8 −4
Original line number Diff line number Diff line
@@ -170,7 +170,7 @@ static inline void hal_radio_end_time_capture_ppi_config(void)
	/* No need to configure anything for the pre-programmed channel. */
}

#else
#else /* !(EVENT_TIMER_ID == 0) */

static inline void hal_radio_end_time_capture_ppi_config(void)
{
@@ -181,7 +181,7 @@ static inline void hal_radio_end_time_capture_ppi_config(void)
		(uint32_t)&(EVENT_TIMER->TASKS_CAPTURE[HAL_EVENT_TIMER_TRX_END_CC_OFFSET]));
}

#endif /* (EVENT_TIMER_ID == 0) */
#endif /* !(EVENT_TIMER_ID == 0) */

/*******************************************************************************
 * Start event timer on RTC tick:
@@ -307,7 +307,7 @@ static inline void hal_sw_switch_timer_clear_ppi_config(void)
		(uint32_t)&(SW_SWITCH_TIMER->TASKS_CLEAR));
}

#else /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */
#else /* CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */

/* Clear event timer (sw-switch timer) on Radio end:
 * wire the RADIO EVENTS_END event to the
@@ -325,7 +325,7 @@ static inline void hal_sw_switch_timer_clear_ppi_config(void)
		(uint32_t)&(SW_SWITCH_TIMER->TASKS_CLEAR));
}

#endif /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */
#endif /* CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */

/* The 2 adjacent PPI groups used for implementing SW_SWITCH_TIMER-based
 * auto-switch for TIFS. 'index' must be 0 or 1.
@@ -453,11 +453,15 @@ static inline void hal_radio_sw_switch_disable(void)
{
	/* Disable the following PPI channels that implement SW Switch:
	 * - Clearing SW SWITCH TIMER on RADIO END event
	 *   - Do not clear for single timer use as it uses the same PPI as
	 *     end time capture
	 * - Enabling SW SWITCH PPI Group on RADIO END event
	 */
	nrf_ppi_channels_disable(
		NRF_PPI,
#if !defined(CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER)
		BIT(HAL_SW_SWITCH_TIMER_CLEAR_PPI) |
#endif /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */
		BIT(HAL_SW_SWITCH_GROUP_TASK_ENABLE_PPI));

	/* Invalidation of subscription of S2 timer Compare used when