1 /*
2  * Copyright (c) 2024 Nordic Semiconductor ASA
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 /* Extracted from radio_nrf_ppi.h functions that reference gpiote variables. */
8 
9 #if defined(HAL_RADIO_GPIO_HAVE_PA_PIN) || defined(HAL_RADIO_GPIO_HAVE_LNA_PIN)
hal_palna_ppi_setup(void)10 static inline void hal_palna_ppi_setup(void)
11 {
12 	nrf_ppi_channel_endpoint_setup(
13 		NRF_PPI,
14 		HAL_ENABLE_PALNA_PPI,
15 		(uint32_t)&(EVENT_TIMER->EVENTS_COMPARE[2]),
16 		(uint32_t)&(gpiote_palna.p_reg->TASKS_OUT[gpiote_ch_palna]));
17 	nrf_ppi_channel_endpoint_setup(
18 		NRF_PPI,
19 		HAL_DISABLE_PALNA_PPI,
20 		(uint32_t)&(NRF_RADIO->EVENTS_DISABLED),
21 		(uint32_t)&(gpiote_palna.p_reg->TASKS_OUT[gpiote_ch_palna]));
22 }
23 #endif /* defined(HAL_RADIO_GPIO_HAVE_PA_PIN) || defined(HAL_RADIO_GPIO_HAVE_LNA_PIN) */
24 
25 /******************************************************************************/
26 #if defined(HAL_RADIO_FEM_IS_NRF21540)
hal_pa_ppi_setup(void)27 static inline void hal_pa_ppi_setup(void)
28 {
29 	/* Nothing specific to PA with FEM to handle inside TRX chains */
30 }
31 
hal_lna_ppi_setup(void)32 static inline void hal_lna_ppi_setup(void)
33 {
34 	/* Nothing specific to LNA with FEM to handle inside TRX chains */
35 }
36 
hal_fem_ppi_setup(void)37 static inline void hal_fem_ppi_setup(void)
38 {
39 	nrf_ppi_channel_and_fork_endpoint_setup(
40 		NRF_PPI,
41 		HAL_ENABLE_FEM_PPI,
42 		(uint32_t)&(EVENT_TIMER->EVENTS_COMPARE[3]),
43 		(uint32_t)&(gpiote_pdn.p_reg->TASKS_OUT[gpiote_ch_pdn]),
44 		(uint32_t)&(gpiote_csn.p_reg->TASKS_OUT[gpiote_ch_csn]));
45 	nrf_ppi_channel_and_fork_endpoint_setup(
46 		NRF_PPI,
47 		HAL_DISABLE_FEM_PPI,
48 		(uint32_t)&(NRF_RADIO->EVENTS_DISABLED),
49 		(uint32_t)&(gpiote_pdn.p_reg->TASKS_OUT[gpiote_ch_pdn]),
50 		(uint32_t)&(gpiote_csn.p_reg->TASKS_OUT[gpiote_ch_csn]));
51 }
52 
53 #endif /* HAL_RADIO_FEM_IS_NRF21540 */
54