esp_wifi/radio/
radio_esp32c6.rs
1#[cfg(any(feature = "wifi", feature = "ble"))]
2#[allow(unused_imports)]
3use crate::{
4 binary,
5 hal::{
6 interrupt,
7 peripherals::{Interrupt, INTERRUPT_CORE0},
8 },
9};
10
11pub(crate) fn setup_radio_isr() {
12 INTERRUPT_CORE0::regs()
16 .wifi_bb_intr_map()
17 .write(|w| unsafe { w.wifi_bb_intr_map().bits(31) });
18 INTERRUPT_CORE0::regs()
19 .modem_peri_timeout_intr_map()
20 .write(|w| unsafe { w.modem_peri_timeout_intr_map().bits(31) });
21}
22
23pub(crate) fn shutdown_radio_isr() {
24 #[cfg(feature = "ble")]
25 {
26 interrupt::disable(crate::hal::system::Cpu::ProCpu, Interrupt::LP_TIMER);
27 interrupt::disable(crate::hal::system::Cpu::ProCpu, Interrupt::BT_MAC);
28 }
29}
30
31#[cfg(feature = "wifi")]
32#[no_mangle]
33extern "C" fn WIFI_MAC() {
34 unsafe {
35 let (fnc, arg) = crate::wifi::os_adapter::ISR_INTERRUPT_1;
36
37 trace!("interrupt WIFI_MAC {:?} {:?}", fnc, arg);
38
39 if !fnc.is_null() {
40 let fnc: fn(*mut binary::c_types::c_void) = core::mem::transmute(fnc);
41 fnc(arg);
42 }
43
44 trace!("interrupt 1 done");
45 };
46}
47
48#[cfg(feature = "wifi")]
49#[no_mangle]
50extern "C" fn WIFI_PWR() {
51 unsafe {
52 let (fnc, arg) = crate::wifi::os_adapter::ISR_INTERRUPT_1;
53
54 trace!("interrupt WIFI_PWR {:?} {:?}", fnc, arg);
55
56 if !fnc.is_null() {
57 let fnc: fn(*mut binary::c_types::c_void) = core::mem::transmute(fnc);
58 fnc(arg);
59 }
60
61 trace!("interrupt 1 done");
62 };
63}
64
65#[cfg(feature = "ble")]
66#[no_mangle]
67extern "C" fn LP_TIMER() {
68 unsafe {
69 trace!("LP_TIMER interrupt");
70
71 let (fnc, arg) = crate::ble::npl::ble_os_adapter_chip_specific::ISR_INTERRUPT_7;
72
73 trace!("interrupt LP_TIMER {:?} {:?}", fnc, arg);
74
75 if !fnc.is_null() {
76 trace!("interrupt LP_TIMER call");
77
78 let fnc: fn(*mut binary::c_types::c_void) = core::mem::transmute(fnc);
79 fnc(arg);
80 trace!("LP_TIMER done");
81 }
82
83 trace!("interrupt LP_TIMER done");
84 };
85}
86
87#[cfg(feature = "ble")]
88#[no_mangle]
89extern "C" fn BT_MAC() {
90 unsafe {
91 trace!("BT_MAC interrupt");
92
93 let (fnc, arg) = crate::ble::npl::ble_os_adapter_chip_specific::ISR_INTERRUPT_4;
94
95 trace!("interrupt BT_MAC {:?} {:?}", fnc, arg);
96
97 if !fnc.is_null() {
98 trace!("interrupt BT_MAC call");
99
100 let fnc: fn(*mut binary::c_types::c_void) = core::mem::transmute(fnc);
101 fnc(arg);
102 trace!("BT_MAC done");
103 }
104
105 trace!("interrupt BT_MAC done");
106 };
107}