pub(crate) fn bound_cpu_interrupt_for(cpu: Cpu, interrupt: Interrupt) -> Option<CpuInterrupt> {
    let interrupt_number = interrupt as isize;

    let intr_map_base = match cpu {
        Cpu::ProCpu => unsafe { (*core0_interrupt_peripheral()).pro_mac_intr_map().as_ptr() },
        #[cfg(multi_core)]
        Cpu::AppCpu => unsafe { (*core1_interrupt_peripheral()).app_mac_intr_map().as_ptr() },
    };
    let cpu_intr = unsafe { intr_map_base.offset(interrupt_number).read_volatile() };
    let cpu_intr = CpuInterrupt::from_u32(cpu_intr)?;

    if cpu_intr.is_peripheral() {
        Some(cpu_intr)
    } else {
        None
    }
}
Get cpu interrupt assigned to peripheral interrupt
esp-hal/src/interrupt/xtensa.rs