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:
Rajiv Kanchan
2021-04-09 11:32:49 +05:30
committed by Ron Evans
parent ed2db8a26d
commit 722a3a5c94
16 changed files with 882 additions and 2 deletions
+43
View File
@@ -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) {
}
}