1 /*
2  * Copyright (c) 2019 Nordic Semiconductor ASA
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 /* nRF51 and nRF52 Series IRQ mapping*/
8 #if defined(CONFIG_SOC_SERIES_NRF51X) || defined(CONFIG_SOC_COMPATIBLE_NRF52X)
9 
10 #define HAL_SWI_RADIO_IRQ  SWI4_IRQn
11 #define HAL_SWI_WORKER_IRQ RTC0_IRQn
12 
13 #if !defined(CONFIG_BT_CTLR_LOW_LAT) && \
14 	(CONFIG_BT_CTLR_ULL_HIGH_PRIO == CONFIG_BT_CTLR_ULL_LOW_PRIO)
15 #define HAL_SWI_JOB_IRQ    HAL_SWI_WORKER_IRQ
16 #else
17 #define HAL_SWI_JOB_IRQ    SWI5_IRQn
18 #endif
19 
20 #define HAL_RTC_IRQn       RTC0_IRQn
21 
22 /* nRF53 Series IRQ mapping */
23 #elif defined(CONFIG_SOC_COMPATIBLE_NRF53X)
24 
25 /* nRF53 Series Engineering D and Revision 1 IRQ mapping */
26 #if defined(CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET)
27 
28 #define HAL_SWI_RADIO_IRQ  SWI2_IRQn
29 #define HAL_SWI_WORKER_IRQ RTC0_IRQn
30 
31 #if !defined(CONFIG_BT_CTLR_LOW_LAT) && \
32 	(CONFIG_BT_CTLR_ULL_HIGH_PRIO == CONFIG_BT_CTLR_ULL_LOW_PRIO)
33 #define HAL_SWI_JOB_IRQ    HAL_SWI_WORKER_IRQ
34 #else
35 #define HAL_SWI_JOB_IRQ    SWI3_IRQn
36 #endif
37 
38 #define HAL_RTC_IRQn       RTC0_IRQn
39 
40 #elif /* !CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET */
41 #error Unknown NRF5340 CPU.
42 #endif /* !CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET */
43 
44 /* nRF54 Series IRQ mapping */
45 #elif defined(CONFIG_SOC_COMPATIBLE_NRF54LX)
46 
47 #define HAL_SWI_RADIO_IRQ  SWI02_IRQn
48 
49 #if defined(CONFIG_BT_CTLR_NRF_GRTC)
50 #define HAL_SWI_WORKER_IRQ GRTC_1_IRQn
51 #define HAL_RTC_IRQn       GRTC_1_IRQn
52 #else /* !CONFIG_BT_CTLR_NRF_GRTC */
53 #define HAL_SWI_WORKER_IRQ RTC10_IRQn
54 #define HAL_RTC_IRQn       RTC10_IRQn
55 #endif /* !CONFIG_BT_CTLR_NRF_GRTC */
56 
57 #if !defined(CONFIG_BT_CTLR_LOW_LAT) && \
58 	(CONFIG_BT_CTLR_ULL_HIGH_PRIO == CONFIG_BT_CTLR_ULL_LOW_PRIO)
59 #define HAL_SWI_JOB_IRQ    HAL_SWI_WORKER_IRQ
60 #else
61 #define HAL_SWI_JOB_IRQ    SWI03_IRQn
62 #endif
63 
64 #endif
65 
hal_swi_init(void)66 static inline void hal_swi_init(void)
67 {
68 	/* No platform-specific initialization required. */
69 }
70 
hal_swi_lll_pend(void)71 static inline void hal_swi_lll_pend(void)
72 {
73 	NVIC_SetPendingIRQ(HAL_SWI_RADIO_IRQ);
74 }
75 
hal_swi_worker_pend(void)76 static inline void hal_swi_worker_pend(void)
77 {
78 	NVIC_SetPendingIRQ(HAL_SWI_WORKER_IRQ);
79 }
80 
hal_swi_job_pend(void)81 static inline void hal_swi_job_pend(void)
82 {
83 	NVIC_SetPendingIRQ(HAL_SWI_JOB_IRQ);
84 }
85