mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-18 11:33:59 +00:00
add rp2040, pico
adds preliminary support (just enough to run blinky1) for the Raspberry Pi Pico board along with the rp2040 mcu.
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
// +build rp2040
|
||||
|
||||
package machine
|
||||
|
||||
import (
|
||||
"device/rp"
|
||||
"runtime/volatile"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// RESETS_RESET_Msk is bitmask to reset all peripherals
|
||||
//
|
||||
// TODO: This field is not available in the device file.
|
||||
const RESETS_RESET_Msk = 0x01ffffff
|
||||
|
||||
type resetsType struct {
|
||||
reset volatile.Register32
|
||||
wdSel volatile.Register32
|
||||
resetDone volatile.Register32
|
||||
}
|
||||
|
||||
var resets = (*resetsType)(unsafe.Pointer(rp.RESETS))
|
||||
|
||||
// resetBlock resets hardware blocks specified
|
||||
// by the bit pattern in bits.
|
||||
func resetBlock(bits uint32) {
|
||||
resets.reset.SetBits(bits)
|
||||
}
|
||||
|
||||
// unresetBlock brings hardware blocks specified by the
|
||||
// bit pattern in bits out of reset.
|
||||
func unresetBlock(bits uint32) {
|
||||
resets.reset.ClearBits(bits)
|
||||
}
|
||||
|
||||
// unresetBlockWait brings specified hardware blocks
|
||||
// specified by the bit pattern in bits
|
||||
// out of reset and wait for completion.
|
||||
func unresetBlockWait(bits uint32) {
|
||||
unresetBlock(bits)
|
||||
for !resets.resetDone.HasBits(bits) {
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user