From 318ed20061ae9dfcec39f26e352a6fcdc60b6184 Mon Sep 17 00:00:00 2001 From: Alexander Heldt Date: Wed, 31 Jul 2024 11:27:49 +0200 Subject: [PATCH] Add `flash.h` --- src/flash.h | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/flash.h diff --git a/src/flash.h b/src/flash.h new file mode 100644 index 0000000..780cee5 --- /dev/null +++ b/src/flash.h @@ -0,0 +1,35 @@ +#ifndef FLASH_H_ +#define FLASH_H_ + +#include + +struct flash { + volatile uint32_t ACR; // Flash access control register + volatile uint32_t KEYR; // Flash key register + volatile uint32_t OPTKEYR; // Flash option key register + volatile uint32_t SR; // Flash status register + volatile uint32_t CR; // Flash control register + volatile uint32_t OPTCR; // Flash option control register +}; + +#define FLASH_BASE_ADDR (0x40023C00U) +#define FLASH ((struct flash *) FLASH_BASE_ADDR) + +// ACR Register +// Data cache enable + +#define FLASH_ACR_DCEN_BIT 10 +#define FLASH_ACR_DCEN_ENABLE (1 <