mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-10 22:13:39 +00:00
device/arm: clear pending interrupts before enabling them
Without this change, a pending interrupt would spuriously trigger
immediately after enabling. This happens if an interrupt is triggered
during flashing (e.g. by DMA), which survives the subsequent reset.
This behaviour matches e.g. `machine.irqSet` in machine_rp2_rp2350.go.
See 7f970a45, whose symptoms were likely caused by spurious interrupts.
This commit is contained in:
@@ -9,6 +9,9 @@ import (
|
||||
// Enable enables this interrupt. Right after calling this function, the
|
||||
// interrupt may be invoked if it was already pending.
|
||||
func (irq Interrupt) Enable() {
|
||||
// Clear the ARM pending bit, an asserting device may still
|
||||
// trigger the interrupt once enabled.
|
||||
arm.ClearPendingIRQ(uint32(irq.num))
|
||||
arm.EnableIRQ(uint32(irq.num))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user