Skip to content

Commit 0811368

Browse files
committed
Bluetooth: controller: nrf5: use portable IRQ pending API
Replace direct NVIC_SetPendingIRQ()/NVIC_ClearPendingIRQ() calls with k_irq_set_pending()/k_irq_clear_pending(). The portable API is backed by the NVIC on the Nordic hardware targets and by the POSIX-arch board interface on the simulated bsim targets, so the CMSIS emulation layer is no longer involved. Assisted-by: Claude:claude-opus-5 Signed-off-by: Anas Nashif <anas.nashif@intel.com>
1 parent 031cf63 commit 0811368

3 files changed

Lines changed: 13 additions & 9 deletions

File tree

subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/ecb.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <stdint.h>
99
#include <string.h>
1010

11+
#include <zephyr/irq.h>
1112
#include <zephyr/sys/byteorder.h>
1213

1314
#include <hal/nrf_ecb.h>
@@ -191,7 +192,7 @@ void ecb_encrypt_nonblocking(struct ecb *e)
191192
| ECB_INTENSET_ENDECB_Msk);
192193

193194
/* enable interrupt */
194-
NVIC_ClearPendingIRQ(ECB_IRQn);
195+
k_irq_clear_pending(ECB_IRQn);
195196
irq_enable(ECB_IRQn);
196197

197198
/* start the encryption h/w */

subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* SPDX-License-Identifier: Apache-2.0
66
*/
77

8+
#include <zephyr/irq.h>
89
#include <zephyr/toolchain.h>
910
#include <zephyr/dt-bindings/gpio/gpio.h>
1011
#include <zephyr/sys/byteorder.h>
@@ -1191,7 +1192,7 @@ uint32_t radio_tmr_isr_set(uint32_t start_us, radio_isr_cb_t cb, void *param)
11911192

11921193
nrf_timer_int_enable(EVENT_TIMER, TIMER_INTENSET_COMPARE2_Msk);
11931194

1194-
NVIC_ClearPendingIRQ(TIMER0_IRQn);
1195+
k_irq_clear_pending(TIMER0_IRQn);
11951196

11961197
irq_enable(TIMER0_IRQn);
11971198

@@ -2525,7 +2526,7 @@ uint32_t radio_ccm_is_done(void)
25252526
cpu_sleep();
25262527
}
25272528
nrf_ccm_int_disable(NRF_CCM, CCM_INTENCLR_ENDCRYPT_Msk);
2528-
NVIC_ClearPendingIRQ(nrfx_get_irq_number(NRF_CCM));
2529+
k_irq_clear_pending(nrfx_get_irq_number(NRF_CCM));
25292530

25302531
return (NRF_CCM->EVENTS_ERROR == 0);
25312532
}
@@ -2737,7 +2738,7 @@ uint32_t radio_ar_has_match(void)
27372738

27382739
nrf_aar_int_disable(NRF_AAR, AAR_INTENCLR_END_Msk);
27392740

2740-
NVIC_ClearPendingIRQ(nrfx_get_irq_number(NRF_AAR));
2741+
k_irq_clear_pending(nrfx_get_irq_number(NRF_AAR));
27412742

27422743
if (NRF_AAR->EVENTS_RESOLVED && !NRF_AAR->EVENTS_NOTRESOLVED) {
27432744
return 1U;
@@ -2777,7 +2778,7 @@ uint8_t radio_ar_resolve(const uint8_t *addr)
27772778
nrf_aar_event_clear(NRF_AAR, NRF_AAR_EVENT_RESOLVED);
27782779
nrf_aar_event_clear(NRF_AAR, NRF_AAR_EVENT_NOTRESOLVED);
27792780

2780-
NVIC_ClearPendingIRQ(nrfx_get_irq_number(NRF_AAR));
2781+
k_irq_clear_pending(nrfx_get_irq_number(NRF_AAR));
27812782

27822783
nrf_aar_int_enable(NRF_AAR, AAR_INTENSET_END_Msk);
27832784

@@ -2787,7 +2788,7 @@ uint8_t radio_ar_resolve(const uint8_t *addr)
27872788

27882789
nrf_aar_int_disable(NRF_AAR, AAR_INTENCLR_END_Msk);
27892790

2790-
NVIC_ClearPendingIRQ(nrfx_get_irq_number(NRF_AAR));
2791+
k_irq_clear_pending(nrfx_get_irq_number(NRF_AAR));
27912792

27922793
retval = (NRF_AAR->EVENTS_RESOLVED && !NRF_AAR->EVENTS_NOTRESOLVED) ?
27932794
1U : 0U;

subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/swi.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,22 +63,24 @@
6363

6464
#endif
6565

66+
#include <zephyr/irq.h>
67+
6668
static inline void hal_swi_init(void)
6769
{
6870
/* No platform-specific initialization required. */
6971
}
7072

7173
static inline void hal_swi_lll_pend(void)
7274
{
73-
NVIC_SetPendingIRQ(HAL_SWI_RADIO_IRQ);
75+
k_irq_set_pending(HAL_SWI_RADIO_IRQ);
7476
}
7577

7678
static inline void hal_swi_worker_pend(void)
7779
{
78-
NVIC_SetPendingIRQ(HAL_SWI_WORKER_IRQ);
80+
k_irq_set_pending(HAL_SWI_WORKER_IRQ);
7981
}
8082

8183
static inline void hal_swi_job_pend(void)
8284
{
83-
NVIC_SetPendingIRQ(HAL_SWI_JOB_IRQ);
85+
k_irq_set_pending(HAL_SWI_JOB_IRQ);
8486
}

0 commit comments

Comments
 (0)