32#ifdef LIBOPENCM3_FLASH_H
34#ifndef LIBOPENCM3_FLASH_COMMON_F01_H
35#define LIBOPENCM3_FLASH_COMMON_F01_H
40#define FLASH_ACR MMIO32(FLASH_MEM_INTERFACE_BASE + 0x00)
41#define FLASH_KEYR MMIO32(FLASH_MEM_INTERFACE_BASE + 0x04)
42#define FLASH_OPTKEYR MMIO32(FLASH_MEM_INTERFACE_BASE + 0x08)
43#define FLASH_SR MMIO32(FLASH_MEM_INTERFACE_BASE + 0x0C)
44#define FLASH_CR MMIO32(FLASH_MEM_INTERFACE_BASE + 0x10)
45#define FLASH_AR MMIO32(FLASH_MEM_INTERFACE_BASE + 0x14)
46#define FLASH_OBR MMIO32(FLASH_MEM_INTERFACE_BASE + 0x1C)
47#define FLASH_WRPR MMIO32(FLASH_MEM_INTERFACE_BASE + 0x20)
49#define FLASH_KEYR2 MMIO32(FLASH_MEM_INTERFACE_BASE + 0x44)
50#define FLASH_SR2 MMIO32(FLASH_MEM_INTERFACE_BASE + 0x4C)
51#define FLASH_CR2 MMIO32(FLASH_MEM_INTERFACE_BASE + 0x50)
52#define FLASH_AR2 MMIO32(FLASH_MEM_INTERFACE_BASE + 0x54)
56#define FLASH_OPTION_BYTE(i) MMIO16(INFO_BASE+0x0800 + (i)*2)
60#define FLASH_ACR_LATENCY_SHIFT 0
61#define FLASH_ACR_LATENCY_MASK 7
63#define FLASH_ACR_PRFTBS (1 << 5)
64#define FLASH_ACR_PRFTBE (1 << 4)
66#define FLASH_ACR_PRFTEN FLASH_ACR_PRFTBE
70#define FLASH_SR_EOP (1 << 5)
71#define FLASH_SR_WRPRTERR (1 << 4)
72#define FLASH_SR_PGERR (1 << 2)
73#define FLASH_SR_BSY (1 << 0)
77#define FLASH_CR_EOPIE (1 << 12)
78#define FLASH_CR_ERRIE (1 << 10)
79#define FLASH_CR_OPTWRE (1 << 9)
80#define FLASH_CR_LOCK (1 << 7)
81#define FLASH_CR_STRT (1 << 6)
82#define FLASH_CR_OPTER (1 << 5)
83#define FLASH_CR_OPTPG (1 << 4)
84#define FLASH_CR_MER (1 << 2)
85#define FLASH_CR_PER (1 << 1)
86#define FLASH_CR_PG (1 << 0)
90#define FLASH_OBR_RDPRT_SHIFT 1
91#define FLASH_OBR_OPTERR (1 << 0)
95#define FLASH_KEYR_KEY1 ((uint32_t)0x45670123)
96#define FLASH_KEYR_KEY2 ((uint32_t)0xcdef89ab)
98#define FLASH_OPTKEYR_KEY1 FLASH_KEYR_KEY1
99#define FLASH_OPTKEYR_KEY2 FLASH_KEYR_KEY2
121#warning "flash_common_f01.h should not be included directly,"
122#warning "only via flash.h"
void flash_erase_page(uint32_t page_address)
Erase a Page of FLASH.
uint32_t flash_get_status_flags(void)
Read All Status Flags.
void flash_erase_option_bytes(void)
Erase All Option Bytes.
void flash_program_word(uint32_t address, uint32_t data)
Program a 32 bit Word to FLASH.
void flash_clear_pgerr_flag(void)
Unlock the Flash Program and Erase Controller.
void flash_clear_wrprterr_flag(void)
Clear the Write Protect Error Status Flag.
void flash_program_option_bytes(uint32_t address, uint16_t data)
Program the Option Bytes.
void flash_erase_all_pages(void)
Erase All FLASH.
void flash_program_half_word(uint32_t address, uint16_t data)
Program a Half Word to FLASH.