summaryrefslogtreecommitdiff
path: root/src/stm/stm32l.h
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2012-10-25 13:38:13 -0700
committerKeith Packard <keithp@keithp.com>2012-10-25 13:38:13 -0700
commit9b978cd467f9128f3069765dd8fbf8abad3459a4 (patch)
tree2dc870427e95b7fdf4c5155d83276165a524ce5a /src/stm/stm32l.h
parent7ee031bdab33cc6a1e2a7995a7c3a43f3a64b687 (diff)
altos: Clean up stm arch macros a bit.
Turn a bunch of the macros into inline functions. Clean up the reboot method to use the stm_scb structure. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/stm/stm32l.h')
-rw-r--r--src/stm/stm32l.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/stm/stm32l.h b/src/stm/stm32l.h
index d953aee4..0dbfae39 100644
--- a/src/stm/stm32l.h
+++ b/src/stm/stm32l.h
@@ -901,6 +901,36 @@ stm_nvic_get_priority(int irq) {
return (stm_nvic.ipr[IRQ_PRIO_REG(irq)] >> IRQ_PRIO_BIT(irq)) & IRQ_PRIO_MASK(0);
}
+struct stm_scb {
+ vuint32_t cpuid;
+ vuint32_t icsr;
+ vuint32_t vtor;
+ vuint32_t aircr;
+
+ vuint32_t scr;
+ vuint32_t ccr;
+ vuint32_t shpr1;
+ vuint32_t shpr2;
+
+ vuint32_t shpr3;
+ vuint32_t shcrs;
+ vuint32_t cfsr;
+ vuint32_t hfsr;
+
+ uint32_t unused_30;
+ vuint32_t mmfar;
+ vuint32_t bfar;
+};
+
+extern struct stm_scb stm_scb;
+
+#define STM_SCB_AIRCR_VECTKEY 16
+#define STM_SCB_AIRCR_VECTKEY_KEY 0x05fa
+#define STM_SCB_AIRCR_PRIGROUP 8
+#define STM_SCB_AIRCR_SYSRESETREQ 2
+#define STM_SCB_AIRCR_VECTCLRACTIVE 1
+#define STM_SCB_AIRCR_VECTRESET 0
+
struct stm_mpu {
vuint32_t typer;
vuint32_t cr;