From 96ec89f1f57d449e4b8514bec21a2f725252e199 Mon Sep 17 00:00:00 2001 From: Alex Moon Date: Fri, 15 Nov 2024 17:36:38 -0500 Subject: [PATCH 1/2] Fix SWI2 IRQ handler with `nrf_pac` --- nrf-softdevice/src/events.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/nrf-softdevice/src/events.rs b/nrf-softdevice/src/events.rs index 9fff616..2ca970b 100644 --- a/nrf-softdevice/src/events.rs +++ b/nrf-softdevice/src/events.rs @@ -105,9 +105,24 @@ pub(crate) async fn run_ble() -> ! { )] #[cfg_attr( not(any(feature = "nrf52805", feature = "nrf52810", feature = "nrf52811")), - export_name = "SWI2_EGU2" + export_name = "EGU2_SWI2" +)] +#[cfg_attr( + not(any(feature = "nrf52805", feature = "nrf52810", feature = "nrf52811")), + allow(dead_code) )] unsafe extern "C" fn swi2_irq_handler() { SWI2_SOC_EVT_WAKER.wake(); SWI2_BLE_EVT_WAKER.wake(); } + +/// Support older PACs which use a different name for the SWI2 interrupt +#[cfg_attr( + not(any(feature = "nrf52805", feature = "nrf52810", feature = "nrf52811")), + export_name = "SWI2_EGU2" +)] +#[allow(dead_code)] +unsafe extern "C" fn old_swi2_irq_handler() { + SWI2_SOC_EVT_WAKER.wake(); + SWI2_BLE_EVT_WAKER.wake(); +} From d554940a57646328e1a0f913fe83e59e350019a1 Mon Sep 17 00:00:00 2001 From: Alex Moon Date: Sun, 17 Nov 2024 13:47:54 -0500 Subject: [PATCH 2/2] Fix SWI2 IRQ attributes --- nrf-softdevice/src/events.rs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/nrf-softdevice/src/events.rs b/nrf-softdevice/src/events.rs index 2ca970b..0a5b982 100644 --- a/nrf-softdevice/src/events.rs +++ b/nrf-softdevice/src/events.rs @@ -107,21 +107,15 @@ pub(crate) async fn run_ble() -> ! { not(any(feature = "nrf52805", feature = "nrf52810", feature = "nrf52811")), export_name = "EGU2_SWI2" )] -#[cfg_attr( - not(any(feature = "nrf52805", feature = "nrf52810", feature = "nrf52811")), - allow(dead_code) -)] unsafe extern "C" fn swi2_irq_handler() { SWI2_SOC_EVT_WAKER.wake(); SWI2_BLE_EVT_WAKER.wake(); } -/// Support older PACs which use a different name for the SWI2 interrupt -#[cfg_attr( - not(any(feature = "nrf52805", feature = "nrf52810", feature = "nrf52811")), - export_name = "SWI2_EGU2" -)] +/// `nrf528xx_pac` and early versions of `nrf_pac` name the SWI2 interrupt `SWI2_EGU2` instead of `EGU2_SWI2` +#[cfg(not(any(feature = "nrf52805", feature = "nrf52810", feature = "nrf52811")))] #[allow(dead_code)] +#[export_name = "SWI2_EGU2"] unsafe extern "C" fn old_swi2_irq_handler() { SWI2_SOC_EVT_WAKER.wake(); SWI2_BLE_EVT_WAKER.wake();