aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/machine/machine_rp2_resets.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/machine/machine_rp2_resets.go')
-rw-r--r--src/machine/machine_rp2_resets.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/machine/machine_rp2_resets.go b/src/machine/machine_rp2_resets.go
new file mode 100644
index 000000000..245436c47
--- /dev/null
+++ b/src/machine/machine_rp2_resets.go
@@ -0,0 +1,31 @@
+//go:build rp2040 || rp2350
+
+package machine
+
+import (
+ "device/rp"
+ "unsafe"
+)
+
+var resets = (*rp.RESETS_Type)(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.RESET_DONE.HasBits(bits) {
+ }
+}