esp_wifi/wifi/
os_adapter_esp32c6.rs

1use crate::hal::{interrupt, peripherals};
2
3pub(crate) fn chip_ints_on(mask: u32) {
4    unsafe {
5        peripherals::INTPRI::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::INTPRI::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    // this gets called with
26    // INFO - set_intr 0 2 1 1 (WIFI_PWR)
27    // INFO - set_intr 0 0 1 1 (WIFI_MAC)
28
29    // we do nothing here since all the interrupts are already
30    // configured in `setup_timer_isr` and messing with the interrupts will
31    // get us into trouble
32}
33
34pub(crate) unsafe extern "C" fn regdma_link_set_write_wait_content_dummy(
35    _arg1: *mut esp_wifi_sys::c_types::c_void,
36    _arg2: u32,
37    _arg3: u32,
38) {
39    todo!()
40}
41
42pub(crate) unsafe extern "C" fn sleep_retention_find_link_by_id_dummy(
43    _arg1: esp_wifi_sys::c_types::c_int,
44) -> *mut esp_wifi_sys::c_types::c_void {
45    todo!()
46}
47
48/// **************************************************************************
49/// Name: esp_set_isr
50///
51/// Description:
52///   Register interrupt function
53///
54/// Input Parameters:
55///   n   - Interrupt ID
56///   f   - Interrupt function
57///   arg - Function private data
58///
59/// Returned Value:
60///   None
61///
62/// *************************************************************************
63pub unsafe extern "C" fn set_isr(
64    n: i32,
65    f: *mut crate::binary::c_types::c_void,
66    arg: *mut crate::binary::c_types::c_void,
67) {
68    trace!("set_isr - interrupt {} function {:?} arg {:?}", n, f, arg);
69
70    match n {
71        0 => {
72            crate::wifi::ISR_INTERRUPT_1 = (f, arg);
73        }
74        1 => {
75            crate::wifi::ISR_INTERRUPT_1 = (f, arg);
76        }
77        _ => panic!("set_isr - unsupported interrupt number {}", n),
78    }
79    #[cfg(feature = "wifi")]
80    {
81        unwrap!(interrupt::enable(
82            peripherals::Interrupt::WIFI_MAC,
83            interrupt::Priority::Priority1
84        ));
85        unwrap!(interrupt::enable(
86            peripherals::Interrupt::WIFI_PWR,
87            interrupt::Priority::Priority1
88        ));
89    }
90}