From d2e75eee1d017a7632faf017f40780a5255897f5 Mon Sep 17 00:00:00 2001 From: Vegard Storheil Eriksen Date: Sat, 28 May 2011 16:15:15 +0200 Subject: Started rewrite from scratch. --- stm32.h | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 stm32.h (limited to 'stm32.h') diff --git a/stm32.h b/stm32.h new file mode 100644 index 0000000..9b8ec59 --- /dev/null +++ b/stm32.h @@ -0,0 +1,47 @@ +#ifndef STM32_H +#define STM32_H + +#include + +struct RCC_t { + volatile uint32_t CR; + volatile uint32_t CFGR; + volatile uint32_t CIR; + volatile uint32_t APB2RSTR; + volatile uint32_t APB1RSTR; + volatile uint32_t AHBENR; + volatile uint32_t APB2ENR; + volatile uint32_t APB1ENR; + volatile uint32_t BDCR; + volatile uint32_t CSR; +}; + +static RCC_t& RCC = *(RCC_t*)0x40021000; + +struct FLASH_t { + volatile uint32_t ACR; + volatile uint32_t KEYR; + volatile uint32_t OPTKEYR; + volatile uint32_t SR; + volatile uint32_t CR; + volatile uint32_t AR; + volatile uint32_t RESERVED; + volatile uint32_t OBR; + volatile uint32_t WRPR; +}; + +static FLASH_t& FLASH = *(FLASH_t*)0x40022000; + +struct GPIO_t { + volatile uint32_t CRL; + volatile uint32_t CRH; + volatile uint32_t IDR; + volatile uint32_t ODR; + volatile uint32_t BSRR; + volatile uint32_t BRR; + volatile uint32_t LCKR; +}; + +static GPIO_t& GPIOA = *(GPIO_t*)0x40010800; + +#endif -- cgit v1.2.3