esp_wifi/wifi/
os_adapter_esp32c2.rs
1use crate::hal::{interrupt, peripherals};
2
3pub(crate) fn chip_ints_on(mask: u32) {
4 unsafe {
5 peripherals::INTERRUPT_CORE0::regs()
6 .cpu_int_enable()
7 .modify(|r, w| w.bits(r.bits() | mask));
8 }
9}
10
11pub(crate) fn chip_ints_off(mask: u32) {
12 unsafe {
13 peripherals::INTERRUPT_CORE0::regs()
14 .cpu_int_enable()
15 .modify(|r, w| w.bits(r.bits() & !mask));
16 }
17}
18
19pub(crate) unsafe extern "C" fn set_intr(
20 _cpu_no: i32,
21 _intr_source: u32,
22 _intr_num: u32,
23 _intr_prio: i32,
24) {
25 }
33
34pub unsafe extern "C" fn set_isr(
50 n: i32,
51 f: *mut crate::binary::c_types::c_void,
52 arg: *mut crate::binary::c_types::c_void,
53) {
54 trace!("set_isr - interrupt {} function {:?} arg {:?}", n, f, arg);
55 match n {
56 0 => unsafe {
57 crate::wifi::ISR_INTERRUPT_1 = (f, arg);
58 },
59 1 => unsafe {
60 crate::wifi::ISR_INTERRUPT_1 = (f, arg);
61 },
62 _ => panic!("set_isr - unsupported interrupt number {}", n),
63 }
64 #[cfg(feature = "wifi")]
65 {
66 unwrap!(interrupt::enable(
67 peripherals::Interrupt::WIFI_MAC,
68 interrupt::Priority::Priority1
69 ));
70 unwrap!(interrupt::enable(
71 peripherals::Interrupt::WIFI_PWR,
72 interrupt::Priority::Priority1
73 ));
74 }
75}