mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-07 04:23:41 +00:00
bf80e9b446
* runtime/rp2: handle RP2350 shared FIFO IRQ for GC --------- Co-authored-by: rdon <you@example.com>
43 lines
896 B
Go
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)
|
|
}
|
|
}
|