Files
tinygo/src/runtime/runtime_rp2040.go
T
rdon(あーるどん) bf80e9b446 runtime/rp2: handle RP2350 shared FIFO IRQ for GC (#5482)
* runtime/rp2: handle RP2350 shared FIFO IRQ for GC

---------

Co-authored-by: rdon <you@example.com>
2026-07-03 10:21:29 +02:00

43 lines
896 B
Go

//go:build rp2040
package runtime
import (
"device/rp"
"runtime/interrupt"
)
const (
sioIrqFifoProc0 = rp.IRQ_SIO_IRQ_PROC0
sioIrqFifoProc1 = rp.IRQ_SIO_IRQ_PROC1
)
// On RP2040, each core has its own SIO FIFO IRQ. Core0 enables
// IRQ_SIO_IRQ_PROC0 and Core1 enables IRQ_SIO_IRQ_PROC1, so each handler can
// use a fixed core ID.
func enableSIOFifoInterruptCore0() {
intr := interrupt.New(sioIrqFifoProc0, handleSIOFifoInterruptCore0)
intr.Enable()
intr.SetPriority(0xff)
}
func enableSIOFifoInterruptCore1() {
intr := interrupt.New(sioIrqFifoProc1, handleSIOFifoInterruptCore1)
intr.Enable()
intr.SetPriority(0xff)
}
func handleSIOFifoInterruptCore0(intr interrupt.Interrupt) {
switch rp.SIO.FIFO_RD.Get() {
case 1:
gcInterruptHandler(0)
}
}
func handleSIOFifoInterruptCore1(intr interrupt.Interrupt) {
switch rp.SIO.FIFO_RD.Get() {
case 1:
gcInterruptHandler(1)
}
}