common: Implement nvic::system_reset().
authorTilman Sauerbeck <tilman@code-monkey.de>
Wed, 18 Dec 2019 07:46:46 +0000 (08:46 +0100)
committerTilman Sauerbeck <tilman@code-monkey.de>
Sun, 5 Jan 2020 19:38:11 +0000 (20:38 +0100)
Performs a system reset.

src/common/nvic.rs

index 38aece3fb449a1b57c2d7a13e40738d773ad81c4..1519f47b431dd6b1f00246cb3d70390bd77f64e8 100644 (file)
@@ -62,3 +62,12 @@ pub fn set_priority(irq_number: u32, priority: u32) {
         m
     });
 }
+
+pub fn system_reset() {
+    let mut scb_aircr = Reg32::new(0xe000ed0c);
+
+    scb_aircr.write(0x5fa0004);
+
+    loop {
+    }
+}