1 /*
2  * Copyright (c) 2019 Nordic Semiconductor ASA
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #include "ll_irqs.h"
8 
9 #define SetPendingIRQ(x) (EVENT_UNIT->INTPTPENDSET |= (uint32_t)(1 << (x)))
10 
hal_swi_init(void)11 static inline void hal_swi_init(void)
12 {
13 	/* No platform-specific initialization required. */
14 }
15 
16 /* SW IRQs required for the SW defined BLE Controller on RV32M1. */
17 #if defined(CONFIG_BT_LL_SW_SPLIT)
18 /* Split architecture uses max. two SWI */
19 #define HAL_SWI_RADIO_IRQ  LL_SWI4_IRQn
20 #define HAL_SWI_WORKER_IRQ LL_RTC0_IRQn
21 
22 #if !defined(CONFIG_BT_CTLR_LOW_LAT) && \
23 	(CONFIG_BT_CTLR_ULL_HIGH_PRIO == CONFIG_BT_CTLR_ULL_LOW_PRIO)
24 #define HAL_SWI_JOB_IRQ    HAL_SWI_WORKER_IRQ
25 #else
26 #define HAL_SWI_JOB_IRQ    LL_SWI5_IRQn
27 #endif
28 
hal_swi_lll_pend(void)29 static inline void hal_swi_lll_pend(void)
30 {
31 	SetPendingIRQ(HAL_SWI_RADIO_IRQ);
32 }
33 
34 #else
35 #error "CTRL architecture not defined"
36 #endif
37 
hal_swi_worker_pend(void)38 static inline void hal_swi_worker_pend(void)
39 {
40 	SetPendingIRQ(HAL_SWI_WORKER_IRQ);
41 }
42 
hal_swi_job_pend(void)43 static inline void hal_swi_job_pend(void)
44 {
45 	SetPendingIRQ(HAL_SWI_JOB_IRQ);
46 }
47