From 229fd5405eef950e60cae3b6f446c146f38a2e13 Mon Sep 17 00:00:00 2001 From: Vegard Storheil Eriksen Date: Sat, 3 Dec 2011 19:47:07 +0100 Subject: Moved FLASH and RCC register definitions into own headers. --- hal/flash.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 hal/flash.h (limited to 'hal/flash.h') diff --git a/hal/flash.h b/hal/flash.h new file mode 100644 index 0000000..30d30a5 --- /dev/null +++ b/hal/flash.h @@ -0,0 +1,30 @@ +#ifndef FLASH_H +#define FLASH_H + +#include + +struct FLASH_t { + volatile uint32_t ACR; + volatile uint32_t KEYR; + volatile uint32_t OPTKEYR; + volatile uint32_t SR; + volatile uint32_t CR; + #if defined(STM32F1) + volatile uint32_t AR; + volatile uint32_t RESERVED; + volatile uint32_t OBR; + volatile uint32_t WRPR; + #elif defined(STM32F4) + volatile uint32_t OPTCR; + #endif +}; + +#if defined(STM32F1) +static FLASH_t& FLASH = *(FLASH_t*)0x40022000; +#elif defined(STM32F4) +static FLASH_t& FLASH = *(FLASH_t*)0x40023c00; +#endif + +void flash_init(); + +#endif -- cgit v1.2.3