add some debug info for spurious irqs

This commit is contained in:
bunnie 2025-09-13 16:18:15 +08:00
parent a077e9c617
commit b0d2a18122

View file

@ -458,6 +458,7 @@ fn main() {
} }
} }
HalOpcode::IrqLocalHandler => { HalOpcode::IrqLocalHandler => {
if let Some(scalar) = msg.body.scalar_message() {
// Figure out which port(s) caused the IRQ // Figure out which port(s) caused the IRQ
let irq_flag = iox.csr.r(utralib::utra::iox::SFR_INTFR); let irq_flag = iox.csr.r(utralib::utra::iox::SFR_INTFR);
// clear the set bit by writing it back // clear the set bit by writing it back
@ -468,8 +469,8 @@ fn main() {
if ((irq_flag << (bitpos as u32)) & 0x80) != 0 { if ((irq_flag << (bitpos as u32)) & 0x80) != 0 {
if let Some(local_reg) = irq_table[bitpos] { if let Some(local_reg) = irq_table[bitpos] {
found = true; found = true;
// interrupts are "Best effort" and can gracefully fail if the receiver has been // interrupts are "Best effort" and can gracefully fail if the receiver has
// overwhelmed by too many interrupts // been overwhelmed by too many interrupts
xous::try_send_message( xous::try_send_message(
local_reg.cid, local_reg.cid,
xous::Message::new_scalar(local_reg.opcode, 0, 0, 0, 0), xous::Message::new_scalar(local_reg.opcode, 0, 0, 0, 0),
@ -484,10 +485,23 @@ fn main() {
} }
} }
if !found { if !found {
if irq_flag != 0 {
log::warn!( log::warn!(
"No handler was found for raw flag: {:x} (note bit order is reversed)", "No handler was found for raw flag: {:x} (note bit order is reversed)",
irq_flag irq_flag
); );
} else {
log::info!("Interrupt received but maybe not for us? pending {:x}", scalar.arg1);
log::info!("CR0 {:x}", iox.csr.r(utralib::utra::iox::SFR_INTCR_CRINT0));
log::info!("CR1 {:x}", iox.csr.r(utralib::utra::iox::SFR_INTCR_CRINT1));
log::info!("CR2 {:x}", iox.csr.r(utralib::utra::iox::SFR_INTCR_CRINT2));
log::info!("CR3 {:x}", iox.csr.r(utralib::utra::iox::SFR_INTCR_CRINT3));
log::info!("CR4 {:x}", iox.csr.r(utralib::utra::iox::SFR_INTCR_CRINT4));
log::info!("CR5 {:x}", iox.csr.r(utralib::utra::iox::SFR_INTCR_CRINT5));
log::info!("CR6 {:x}", iox.csr.r(utralib::utra::iox::SFR_INTCR_CRINT6));
log::info!("CR7 {:x}", iox.csr.r(utralib::utra::iox::SFR_INTCR_CRINT7));
}
}
} }
} }
HalOpcode::SetGpioBank => { HalOpcode::SetGpioBank => {