mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-11 14:33:41 +00:00
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>
This commit is contained in:
@@ -4,9 +4,39 @@ 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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user