mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
add some debug info for spurious irqs
This commit is contained in:
parent
a077e9c617
commit
b0d2a18122
1 changed files with 42 additions and 28 deletions
|
|
@ -458,36 +458,50 @@ fn main() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
HalOpcode::IrqLocalHandler => {
|
HalOpcode::IrqLocalHandler => {
|
||||||
// Figure out which port(s) caused the IRQ
|
if let Some(scalar) = msg.body.scalar_message() {
|
||||||
let irq_flag = iox.csr.r(utralib::utra::iox::SFR_INTFR);
|
// Figure out which port(s) caused the IRQ
|
||||||
// clear the set bit by writing it back
|
let irq_flag = iox.csr.r(utralib::utra::iox::SFR_INTFR);
|
||||||
iox.csr.wo(utralib::utra::iox::SFR_INTFR, irq_flag);
|
// clear the set bit by writing it back
|
||||||
let mut found = false;
|
iox.csr.wo(utralib::utra::iox::SFR_INTFR, irq_flag);
|
||||||
for bitpos in 0..8 {
|
let mut found = false;
|
||||||
// the bit position is flipped versus register order in memory
|
for bitpos in 0..8 {
|
||||||
if ((irq_flag << (bitpos as u32)) & 0x80) != 0 {
|
// the bit position is flipped versus register order in memory
|
||||||
if let Some(local_reg) = irq_table[bitpos] {
|
if ((irq_flag << (bitpos as u32)) & 0x80) != 0 {
|
||||||
found = true;
|
if let Some(local_reg) = irq_table[bitpos] {
|
||||||
// interrupts are "Best effort" and can gracefully fail if the receiver has been
|
found = true;
|
||||||
// overwhelmed by too many interrupts
|
// interrupts are "Best effort" and can gracefully fail if the receiver has
|
||||||
xous::try_send_message(
|
// been overwhelmed by too many interrupts
|
||||||
local_reg.cid,
|
xous::try_send_message(
|
||||||
xous::Message::new_scalar(local_reg.opcode, 0, 0, 0, 0),
|
local_reg.cid,
|
||||||
)
|
xous::Message::new_scalar(local_reg.opcode, 0, 0, 0, 0),
|
||||||
.ok();
|
)
|
||||||
} else {
|
.ok();
|
||||||
log::warn!(
|
} else {
|
||||||
"Got IRQ on position {} but no registration was found, ignoring!",
|
log::warn!(
|
||||||
bitpos
|
"Got IRQ on position {} but no registration was found, ignoring!",
|
||||||
);
|
bitpos
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !found {
|
||||||
|
if irq_flag != 0 {
|
||||||
|
log::warn!(
|
||||||
|
"No handler was found for raw flag: {:x} (note bit order is reversed)",
|
||||||
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !found {
|
|
||||||
log::warn!(
|
|
||||||
"No handler was found for raw flag: {:x} (note bit order is reversed)",
|
|
||||||
irq_flag
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
HalOpcode::SetGpioBank => {
|
HalOpcode::SetGpioBank => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue