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
+27
View File
@@ -0,0 +1,27 @@
// +build rp2040
package machine
import (
"device/rp"
"runtime/volatile"
"unsafe"
)
type watchdogType struct {
ctrl volatile.Register32
load volatile.Register32
reason volatile.Register32
scratch [8]volatile.Register32
tick volatile.Register32
}
var watchdog = (*watchdogType)(unsafe.Pointer(rp.WATCHDOG))
// startTick starts the watchdog tick.
// cycles needs to be a divider that when applied to the xosc input,
// produces a 1MHz clock. So if the xosc frequency is 12MHz,
// this will need to be 12.
func (wd *watchdogType) startTick(cycles uint32) {
wd.tick.Set(cycles | rp.WATCHDOG_TICK_ENABLE)
}