File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,6 +13,11 @@ import (
1313 "unsafe"
1414)
1515
16+ const (
17+ rp2SIOFIFOCommandGC uint32 = iota + 1
18+ rp2SIOFIFOCommandFlashSafe
19+ )
20+
1621const numCPU = 2
1722const numSpinlocks = 32
1823
@@ -142,9 +147,9 @@ func startSecondaryCores() {
142147 // second core.
143148 intr := interrupt .New (sioIrqFifoProc0 , func (intr interrupt.Interrupt ) {
144149 switch rp .SIO .FIFO_RD .Get () {
145- case 1 :
150+ case rp2SIOFIFOCommandGC :
146151 gcInterruptHandler (0 )
147- case 2 :
152+ case rp2SIOFIFOCommandFlashSafe :
148153 rp2FlashSafeInterruptHandler (0 )
149154 }
150155 })
@@ -178,9 +183,9 @@ func runCore1() {
178183 // interrupts can still happen while the GC is running.
179184 intr := interrupt .New (sioIrqFifoProc1 , func (intr interrupt.Interrupt ) {
180185 switch rp .SIO .FIFO_RD .Get () {
181- case 1 :
186+ case rp2SIOFIFOCommandGC :
182187 gcInterruptHandler (1 )
183- case 2 :
188+ case rp2SIOFIFOCommandFlashSafe :
184189 rp2FlashSafeInterruptHandler (1 )
185190 }
186191 })
@@ -269,7 +274,7 @@ func gcInterruptHandler(hartID uint32) {
269274
270275// Pause the given core by sending it an interrupt.
271276func gcPauseCore (core uint32 ) {
272- rp .SIO .FIFO_WR .Set (1 )
277+ rp .SIO .FIFO_WR .Set (rp2SIOFIFOCommandGC )
273278}
274279
275280// Signal the given core that it can resume one step.
Original file line number Diff line number Diff line change @@ -11,11 +11,9 @@ import (
1111)
1212
1313const (
14- rp2040FlashSafeFIFOCommand = 2
15-
16- rp2040FlashSafeIdle = 0
17- rp2040FlashSafeLocked = 1
18- rp2040FlashSafeRelease = 2
14+ rp2040FlashSafeIdle uint8 = iota
15+ rp2040FlashSafeLocked
16+ rp2040FlashSafeRelease
1917)
2018
2119// rp2040FlashSafeState is used to synchronize the core that performs a flash
@@ -79,7 +77,7 @@ func rp2040ExitFlashSafeSection(state interrupt.State) {
7977
8078func rp2040FlashSafePauseCore (core uint32 ) {
8179 _ = core // RP2040 SIO FIFO writes to the other core.
82- rp .SIO .FIFO_WR .Set (rp2040FlashSafeFIFOCommand )
80+ rp .SIO .FIFO_WR .Set (rp2SIOFIFOCommandFlashSafe )
8381 arm .Asm ("sev" )
8482}
8583
You can’t perform that action at this time.
0 commit comments