libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
FLASH Defines

Defined Constants and Types for the STM32L4xx Flash Control More...

Collaboration diagram for FLASH Defines:

Modules

 Flash_acr_values
 

Macros

#define FLASH_ACR   MMIO32(FLASH_MEM_INTERFACE_BASE + 0x00)
 
#define FLASH_PDKEYR   MMIO32(FLASH_MEM_INTERFACE_BASE + 0x04)
 
#define FLASH_KEYR   MMIO32(FLASH_MEM_INTERFACE_BASE + 0x08)
 
#define FLASH_OPTKEYR   MMIO32(FLASH_MEM_INTERFACE_BASE + 0x0C)
 
#define FLASH_SR   MMIO32(FLASH_MEM_INTERFACE_BASE + 0x10)
 
#define FLASH_CR   MMIO32(FLASH_MEM_INTERFACE_BASE + 0x14)
 
#define FLASH_ECCR   MMIO32(FLASH_MEM_INTERFACE_BASE + 0x18)
 
#define FLASH_OPTR   MMIO32(FLASH_MEM_INTERFACE_BASE + 0x20)
 
#define FLASH_PCROP1SR   MMIO32(FLASH_MEM_INTERFACE_BASE + 0x24)
 
#define FLASH_PCROP1ER   MMIO32(FLASH_MEM_INTERFACE_BASE + 0x28)
 
#define FLASH_WRP1AR   MMIO32(FLASH_MEM_INTERFACE_BASE + 0x2C)
 
#define FLASH_WRP1BR   MMIO32(FLASH_MEM_INTERFACE_BASE + 0x30)
 
#define FLASH_PCROP2SR   MMIO32(FLASH_MEM_INTERFACE_BASE + 0x44)
 
#define FLASH_PCROP2ER   MMIO32(FLASH_MEM_INTERFACE_BASE + 0x48)
 
#define FLASH_WRP2AR   MMIO32(FLASH_MEM_INTERFACE_BASE + 0x4C)
 
#define FLASH_WRP2BR   MMIO32(FLASH_MEM_INTERFACE_BASE + 0x50)
 
#define FLASH_ACR_SLEEP_PD   (1 << 14)
 
#define FLASH_ACR_RUN_PD   (1 << 13)
 
#define FLASH_ACR_PRFTEN   (1 << 8)
 
#define FLASH_ACR_LATENCY_SHIFT   0
 
#define FLASH_ACR_LATENCY_MASK   0x07
 
#define FLASH_ACR_LATENCY_0WS   0x00
 
#define FLASH_ACR_LATENCY_1WS   0x01
 
#define FLASH_ACR_LATENCY_2WS   0x02
 
#define FLASH_ACR_LATENCY_3WS   0x03
 
#define FLASH_ACR_LATENCY_4WS   0x04
 
#define FLASH_SR_BSY   (1 << 16)
 
#define FLASH_SR_OPTVERR   (1 << 15)
 
#define FLASH_SR_RDERR   (1 << 14)
 
#define FLASH_SR_FASTERR   (1 << 9)
 
#define FLASH_SR_MISERR   (1 << 8)
 
#define FLASH_SR_PGSERR   (1 << 7)
 
#define FLASH_SR_SIZERR   (1 << 6)
 
#define FLASH_SR_PGAERR   (1 << 5)
 
#define FLASH_SR_WRPERR   (1 << 4)
 
#define FLASH_SR_PROGERR   (1 << 3)
 
#define FLASH_SR_OPERR   (1 << 1)
 
#define FLASH_SR_EOP   (1 << 0)
 
#define FLASH_CR_LOCK   (1 << 31)
 
#define FLASH_CR_OPTLOCK   (1 << 30)
 
#define FLASH_CR_OBL_LAUNCH   (1 << 27)
 
#define FLASH_CR_RDERRIE   (1 << 26)
 
#define FLASH_CR_ERRIE   (1 << 25)
 
#define FLASH_CR_EOPIE   (1 << 24)
 
#define FLASH_CR_FSTPG   (1 << 18)
 
#define FLASH_CR_OPTSTRT   (1 << 17)
 
#define FLASH_CR_START   (1 << 16)
 
#define FLASH_CR_MER2   (1 << 15)
 
#define FLASH_CR_BKER   (1 << 11)
 
#define FLASH_CR_MER1   (1 << 2)
 
#define FLASH_CR_PER   (1 << 1)
 
#define FLASH_CR_PG   (1 << 0)
 
#define FLASH_CR_PNB_SHIFT   3
 
#define FLASH_CR_PNB_MASK   0xff
 
#define FLASH_ECCR_ECCD   (1 << 31)
 
#define FLASH_ECCR_ECCC   (1 << 30)
 
#define FLASH_ECCR_ECCIE   (1 << 24)
 
#define FLASH_ECCR_SYSF_ECC   (1 << 20)
 
#define FLASH_ECCR_BK_ECC   (1 << 19)
 
#define FLASH_ECCR_ADDR_ECC_SHIFT   0
 
#define FLASH_ECCR_ADDR_ECC_MASK   0x7ffff
 
#define FLASH_OPTR_SRAM2_RST   (1 << 25)
 
#define FLASH_OPTR_SRAM2_PE   (1 << 24)
 
#define FLASH_OPTR_nBOOT1   (1 << 23)
 
#define FLASH_OPTR_DUALBANK   (1 << 21)
 
#define FLASH_OPTR_BFB2   (1 << 20)
 
#define FLASH_OPTR_WWDG_SW   (1 << 19)
 
#define FLASH_OPTR_IWDG_STDBY   (1 << 18)
 
#define FLASH_OPTR_IWDG_STOP   (1 << 17)
 
#define FLASH_OPTR_IDWG_SW   (1 << 16)
 
#define FLASH_OPTR_nRST_SHDW   (1 << 14)
 
#define FLASH_OPTR_nRST_STDBY   (1 << 13)
 
#define FLASH_OPTR_nRST_STOP   (1 << 12)
 
#define FLASH_OPTR_BOR_SHIFT   8
 
#define FLASH_OPTR_BOR_MASK   0x700
 
#define FLASH_OPTR_BOR_LEVEL_0   0
 
#define FLASH_OPTR_BOR_LEVEL_1   1
 
#define FLASH_OPTR_BOR_LEVEL_2   2
 
#define FLASH_OPTR_BOR_LEVEL_3   3
 
#define FLASH_OPTR_BOR_LEVEL_4   4
 
#define FLASH_OPTR_RDP_SHIFT   0
 
#define FLASH_OPTR_RDP_MASK   0xff
 
#define FLASH_OPTR_RDP_LEVEL_0   0xAA
 
#define FLASH_OPTR_RDP_LEVEL_1   0xBB
 
#define FLASH_OPTR_RDP_LEVEL_2   0xCC
 
#define FLASH_PCROP1SR_PCROP1_STRT_SHIFT   0
 
#define FLASH_PCROP1SR_PCROP1_STRT_MASK   0xffff
 
#define FLASH_PCROP1ER_PCROP_RDP   (1 << 31)
 
#define FLASH_PCROP1ER_PCROP1_END_SHIFT   0
 
#define FLASH_PCROP1ER_PCROP1_END_MASK   0xffff
 
#define FLASH_WRP1AR_WRP1A_END_SHIFT   16
 
#define FLASH_WRP1AR_WRP1A_END_MASK   0xff
 
#define FLASH_WRP1AR_WRP1A_STRT_SHIFT   0
 
#define FLASH_WRP1AR_WRP1A_STRT_MASK   0xff
 
#define FLASH_WRP1BR_WRP1B_END_SHIFT   16
 
#define FLASH_WRP1BR_WRP1B_END_MASK   0xff
 
#define FLASH_WRP1BR_WRP1B_STRT_SHIFT   0
 
#define FLASH_WRP1BR_WRP1B_STRT_MASK   0xff
 
#define FLASH_PCROP2SR_PCROP2_STRT_SHIFT   0
 
#define FLASH_PCROP2SR_PCROP2_STRT_MASK   0xffff
 
#define FLASH_PCROP2ER_PCROP2_END_SHIFT   0
 
#define FLASH_PCROP2ER_PCROP2_END_MASK   0xffff
 
#define FLASH_WRP2AR_WRP2A_END_SHIFT   16
 
#define FLASH_WRP2AR_WRP2A_END_MASK   0xff
 
#define FLASH_WRP2AR_WRP2A_STRT_SHIFT   0
 
#define FLASH_WRP2AR_WRP2A_STRT_MASK   0xff
 
#define FLASH_WRP2BR_WRP2B_END_SHIFT   16
 
#define FLASH_WRP2BR_WRP2B_END_MASK   0xff
 
#define FLASH_WRP2BR_WRP2B_STRT_SHIFT   0
 
#define FLASH_WRP2BR_WRP2B_STRT_MASK   0xff
 
#define FLASH_PDKEYR_PDKEY1   ((uint32_t)0x04152637)
 
#define FLASH_PDKEYR_PDKEY2   ((uint32_t)0xfafbfcfd)
 
#define FLASH_KEYR_KEY1   ((uint32_t)0x45670123)
 
#define FLASH_KEYR_KEY2   ((uint32_t)0xcdef89ab)
 
#define FLASH_OPTKEYR_KEY1   ((uint32_t)0x08192a3b)
 
#define FLASH_OPTKEYR_KEY2   ((uint32_t)0x4c5d6e7f)
 

Functions

void flash_clear_progerr_flag (void)
 Clear the Programming Error Status Flag. More...
 
void flash_clear_pgserr_flag (void)
 Clear the Programming Sequence Error Flag This flag is set when incorrect programming configuration has been made. More...
 
void flash_clear_size_flag (void)
 Clear programming size error flag. More...
 
void flash_clear_pgaerr_flag (void)
 Clear the Programming Alignment Error Flag. More...
 
void flash_clear_wrperr_flag (void)
 Clear the Write Protect Error Flag. More...
 
void flash_lock_option_bytes (void)
 Lock the Option Byte Access This disables write access to the option bytes. More...
 
void flash_program_double_word (uint32_t address, uint64_t data)
 Program a 64 bit word to FLASH. More...
 
void flash_program (uint32_t address, uint8_t *data, uint32_t len)
 Program a Data Block to FLASH This programs an arbitrary length data block to FLASH memory. More...
 
void flash_erase_page (uint32_t page)
 Erase a page of FLASH. More...
 
void flash_erase_all_pages (void)
 Erase All FLASH This performs all operations necessary to erase all sectors in the FLASH memory. More...
 
void flash_program_option_bytes (uint32_t data)
 Program the Option Bytes This performs all operations necessary to program the option bytes. More...
 
void flash_dcache_enable (void)
 Enable the data cache. More...
 
void flash_dcache_disable (void)
 Disable the data cache. More...
 
void flash_icache_enable (void)
 Enable the Instruction Cache. More...
 
void flash_icache_disable (void)
 Disable the Instruction Cache. More...
 
void flash_dcache_reset (void)
 Reset the Data Cache. More...
 
void flash_icache_reset (void)
 Reset the Instruction Cache. More...
 

Detailed Description

Defined Constants and Types for the STM32L4xx Flash Control

Version
1.0.0
Author
© 2016 Benjamin Levine benja.nosp@m.min@.nosp@m.jesco.nosp@m..kar.nosp@m.oo.co.nosp@m..uk
Date
12 February 2016

LGPL License Terms libopencm3 License

Macro Definition Documentation

◆ FLASH_ACR

#define FLASH_ACR   MMIO32(FLASH_MEM_INTERFACE_BASE + 0x00)

Definition at line 50 of file l4/flash.h.

◆ FLASH_ACR_LATENCY_0WS

#define FLASH_ACR_LATENCY_0WS   0x00

Definition at line 76 of file l4/flash.h.

◆ FLASH_ACR_LATENCY_1WS

#define FLASH_ACR_LATENCY_1WS   0x01

Definition at line 77 of file l4/flash.h.

◆ FLASH_ACR_LATENCY_2WS

#define FLASH_ACR_LATENCY_2WS   0x02

Definition at line 78 of file l4/flash.h.

◆ FLASH_ACR_LATENCY_3WS

#define FLASH_ACR_LATENCY_3WS   0x03

Definition at line 79 of file l4/flash.h.

◆ FLASH_ACR_LATENCY_4WS

#define FLASH_ACR_LATENCY_4WS   0x04

Definition at line 80 of file l4/flash.h.

◆ FLASH_ACR_LATENCY_MASK

#define FLASH_ACR_LATENCY_MASK   0x07

Definition at line 74 of file l4/flash.h.

◆ FLASH_ACR_LATENCY_SHIFT

#define FLASH_ACR_LATENCY_SHIFT   0

Definition at line 73 of file l4/flash.h.

◆ FLASH_ACR_PRFTEN

#define FLASH_ACR_PRFTEN   (1 << 8)

Definition at line 71 of file l4/flash.h.

◆ FLASH_ACR_RUN_PD

#define FLASH_ACR_RUN_PD   (1 << 13)

Definition at line 70 of file l4/flash.h.

◆ FLASH_ACR_SLEEP_PD

#define FLASH_ACR_SLEEP_PD   (1 << 14)

Definition at line 69 of file l4/flash.h.

◆ FLASH_CR

#define FLASH_CR   MMIO32(FLASH_MEM_INTERFACE_BASE + 0x14)

Definition at line 55 of file l4/flash.h.

◆ FLASH_CR_BKER

#define FLASH_CR_BKER   (1 << 11)

Definition at line 109 of file l4/flash.h.

◆ FLASH_CR_EOPIE

#define FLASH_CR_EOPIE   (1 << 24)

Definition at line 104 of file l4/flash.h.

◆ FLASH_CR_ERRIE

#define FLASH_CR_ERRIE   (1 << 25)

Definition at line 103 of file l4/flash.h.

◆ FLASH_CR_FSTPG

#define FLASH_CR_FSTPG   (1 << 18)

Definition at line 105 of file l4/flash.h.

◆ FLASH_CR_LOCK

#define FLASH_CR_LOCK   (1 << 31)

Definition at line 99 of file l4/flash.h.

◆ FLASH_CR_MER1

#define FLASH_CR_MER1   (1 << 2)

Definition at line 110 of file l4/flash.h.

◆ FLASH_CR_MER2

#define FLASH_CR_MER2   (1 << 15)

Definition at line 108 of file l4/flash.h.

◆ FLASH_CR_OBL_LAUNCH

#define FLASH_CR_OBL_LAUNCH   (1 << 27)

Definition at line 101 of file l4/flash.h.

◆ FLASH_CR_OPTLOCK

#define FLASH_CR_OPTLOCK   (1 << 30)

Definition at line 100 of file l4/flash.h.

◆ FLASH_CR_OPTSTRT

#define FLASH_CR_OPTSTRT   (1 << 17)

Definition at line 106 of file l4/flash.h.

◆ FLASH_CR_PER

#define FLASH_CR_PER   (1 << 1)

Definition at line 111 of file l4/flash.h.

◆ FLASH_CR_PG

#define FLASH_CR_PG   (1 << 0)

Definition at line 112 of file l4/flash.h.

◆ FLASH_CR_PNB_MASK

#define FLASH_CR_PNB_MASK   0xff

Definition at line 115 of file l4/flash.h.

◆ FLASH_CR_PNB_SHIFT

#define FLASH_CR_PNB_SHIFT   3

Definition at line 114 of file l4/flash.h.

◆ FLASH_CR_RDERRIE

#define FLASH_CR_RDERRIE   (1 << 26)

Definition at line 102 of file l4/flash.h.

◆ FLASH_CR_START

#define FLASH_CR_START   (1 << 16)

Definition at line 107 of file l4/flash.h.

◆ FLASH_ECCR

#define FLASH_ECCR   MMIO32(FLASH_MEM_INTERFACE_BASE + 0x18)

Definition at line 56 of file l4/flash.h.

◆ FLASH_ECCR_ADDR_ECC_MASK

#define FLASH_ECCR_ADDR_ECC_MASK   0x7ffff

Definition at line 126 of file l4/flash.h.

◆ FLASH_ECCR_ADDR_ECC_SHIFT

#define FLASH_ECCR_ADDR_ECC_SHIFT   0

Definition at line 125 of file l4/flash.h.

◆ FLASH_ECCR_BK_ECC

#define FLASH_ECCR_BK_ECC   (1 << 19)

Definition at line 123 of file l4/flash.h.

◆ FLASH_ECCR_ECCC

#define FLASH_ECCR_ECCC   (1 << 30)

Definition at line 120 of file l4/flash.h.

◆ FLASH_ECCR_ECCD

#define FLASH_ECCR_ECCD   (1 << 31)

Definition at line 119 of file l4/flash.h.

◆ FLASH_ECCR_ECCIE

#define FLASH_ECCR_ECCIE   (1 << 24)

Definition at line 121 of file l4/flash.h.

◆ FLASH_ECCR_SYSF_ECC

#define FLASH_ECCR_SYSF_ECC   (1 << 20)

Definition at line 122 of file l4/flash.h.

◆ FLASH_KEYR

#define FLASH_KEYR   MMIO32(FLASH_MEM_INTERFACE_BASE + 0x08)

Definition at line 52 of file l4/flash.h.

◆ FLASH_KEYR_KEY1

#define FLASH_KEYR_KEY1   ((uint32_t)0x45670123)

Definition at line 215 of file l4/flash.h.

◆ FLASH_KEYR_KEY2

#define FLASH_KEYR_KEY2   ((uint32_t)0xcdef89ab)

Definition at line 216 of file l4/flash.h.

◆ FLASH_OPTKEYR

#define FLASH_OPTKEYR   MMIO32(FLASH_MEM_INTERFACE_BASE + 0x0C)

Definition at line 53 of file l4/flash.h.

◆ FLASH_OPTKEYR_KEY1

#define FLASH_OPTKEYR_KEY1   ((uint32_t)0x08192a3b)

Definition at line 218 of file l4/flash.h.

◆ FLASH_OPTKEYR_KEY2

#define FLASH_OPTKEYR_KEY2   ((uint32_t)0x4c5d6e7f)

Definition at line 219 of file l4/flash.h.

◆ FLASH_OPTR

#define FLASH_OPTR   MMIO32(FLASH_MEM_INTERFACE_BASE + 0x20)

Definition at line 57 of file l4/flash.h.

◆ FLASH_OPTR_BFB2

#define FLASH_OPTR_BFB2   (1 << 20)

Definition at line 134 of file l4/flash.h.

◆ FLASH_OPTR_BOR_LEVEL_0

#define FLASH_OPTR_BOR_LEVEL_0   0

Definition at line 145 of file l4/flash.h.

◆ FLASH_OPTR_BOR_LEVEL_1

#define FLASH_OPTR_BOR_LEVEL_1   1

Definition at line 146 of file l4/flash.h.

◆ FLASH_OPTR_BOR_LEVEL_2

#define FLASH_OPTR_BOR_LEVEL_2   2

Definition at line 147 of file l4/flash.h.

◆ FLASH_OPTR_BOR_LEVEL_3

#define FLASH_OPTR_BOR_LEVEL_3   3

Definition at line 148 of file l4/flash.h.

◆ FLASH_OPTR_BOR_LEVEL_4

#define FLASH_OPTR_BOR_LEVEL_4   4

Definition at line 149 of file l4/flash.h.

◆ FLASH_OPTR_BOR_MASK

#define FLASH_OPTR_BOR_MASK   0x700

Definition at line 144 of file l4/flash.h.

◆ FLASH_OPTR_BOR_SHIFT

#define FLASH_OPTR_BOR_SHIFT   8

Definition at line 143 of file l4/flash.h.

◆ FLASH_OPTR_DUALBANK

#define FLASH_OPTR_DUALBANK   (1 << 21)

Definition at line 133 of file l4/flash.h.

◆ FLASH_OPTR_IDWG_SW

#define FLASH_OPTR_IDWG_SW   (1 << 16)

Definition at line 138 of file l4/flash.h.

◆ FLASH_OPTR_IWDG_STDBY

#define FLASH_OPTR_IWDG_STDBY   (1 << 18)

Definition at line 136 of file l4/flash.h.

◆ FLASH_OPTR_IWDG_STOP

#define FLASH_OPTR_IWDG_STOP   (1 << 17)

Definition at line 137 of file l4/flash.h.

◆ FLASH_OPTR_nBOOT1

#define FLASH_OPTR_nBOOT1   (1 << 23)

Definition at line 132 of file l4/flash.h.

◆ FLASH_OPTR_nRST_SHDW

#define FLASH_OPTR_nRST_SHDW   (1 << 14)

Definition at line 139 of file l4/flash.h.

◆ FLASH_OPTR_nRST_STDBY

#define FLASH_OPTR_nRST_STDBY   (1 << 13)

Definition at line 140 of file l4/flash.h.

◆ FLASH_OPTR_nRST_STOP

#define FLASH_OPTR_nRST_STOP   (1 << 12)

Definition at line 141 of file l4/flash.h.

◆ FLASH_OPTR_RDP_LEVEL_0

#define FLASH_OPTR_RDP_LEVEL_0   0xAA

Definition at line 153 of file l4/flash.h.

◆ FLASH_OPTR_RDP_LEVEL_1

#define FLASH_OPTR_RDP_LEVEL_1   0xBB

Definition at line 154 of file l4/flash.h.

◆ FLASH_OPTR_RDP_LEVEL_2

#define FLASH_OPTR_RDP_LEVEL_2   0xCC

Definition at line 155 of file l4/flash.h.

◆ FLASH_OPTR_RDP_MASK

#define FLASH_OPTR_RDP_MASK   0xff

Definition at line 152 of file l4/flash.h.

◆ FLASH_OPTR_RDP_SHIFT

#define FLASH_OPTR_RDP_SHIFT   0

Definition at line 151 of file l4/flash.h.

◆ FLASH_OPTR_SRAM2_PE

#define FLASH_OPTR_SRAM2_PE   (1 << 24)

Definition at line 131 of file l4/flash.h.

◆ FLASH_OPTR_SRAM2_RST

#define FLASH_OPTR_SRAM2_RST   (1 << 25)

Definition at line 130 of file l4/flash.h.

◆ FLASH_OPTR_WWDG_SW

#define FLASH_OPTR_WWDG_SW   (1 << 19)

Definition at line 135 of file l4/flash.h.

◆ FLASH_PCROP1ER

#define FLASH_PCROP1ER   MMIO32(FLASH_MEM_INTERFACE_BASE + 0x28)

Definition at line 59 of file l4/flash.h.

◆ FLASH_PCROP1ER_PCROP1_END_MASK

#define FLASH_PCROP1ER_PCROP1_END_MASK   0xffff

Definition at line 166 of file l4/flash.h.

◆ FLASH_PCROP1ER_PCROP1_END_SHIFT

#define FLASH_PCROP1ER_PCROP1_END_SHIFT   0

Definition at line 165 of file l4/flash.h.

◆ FLASH_PCROP1ER_PCROP_RDP

#define FLASH_PCROP1ER_PCROP_RDP   (1 << 31)

Definition at line 164 of file l4/flash.h.

◆ FLASH_PCROP1SR

#define FLASH_PCROP1SR   MMIO32(FLASH_MEM_INTERFACE_BASE + 0x24)

Definition at line 58 of file l4/flash.h.

◆ FLASH_PCROP1SR_PCROP1_STRT_MASK

#define FLASH_PCROP1SR_PCROP1_STRT_MASK   0xffff

Definition at line 160 of file l4/flash.h.

◆ FLASH_PCROP1SR_PCROP1_STRT_SHIFT

#define FLASH_PCROP1SR_PCROP1_STRT_SHIFT   0

Definition at line 159 of file l4/flash.h.

◆ FLASH_PCROP2ER

#define FLASH_PCROP2ER   MMIO32(FLASH_MEM_INTERFACE_BASE + 0x48)

Definition at line 63 of file l4/flash.h.

◆ FLASH_PCROP2ER_PCROP2_END_MASK

#define FLASH_PCROP2ER_PCROP2_END_MASK   0xffff

Definition at line 192 of file l4/flash.h.

◆ FLASH_PCROP2ER_PCROP2_END_SHIFT

#define FLASH_PCROP2ER_PCROP2_END_SHIFT   0

Definition at line 191 of file l4/flash.h.

◆ FLASH_PCROP2SR

#define FLASH_PCROP2SR   MMIO32(FLASH_MEM_INTERFACE_BASE + 0x44)

Definition at line 62 of file l4/flash.h.

◆ FLASH_PCROP2SR_PCROP2_STRT_MASK

#define FLASH_PCROP2SR_PCROP2_STRT_MASK   0xffff

Definition at line 187 of file l4/flash.h.

◆ FLASH_PCROP2SR_PCROP2_STRT_SHIFT

#define FLASH_PCROP2SR_PCROP2_STRT_SHIFT   0

Definition at line 186 of file l4/flash.h.

◆ FLASH_PDKEYR

#define FLASH_PDKEYR   MMIO32(FLASH_MEM_INTERFACE_BASE + 0x04)

Definition at line 51 of file l4/flash.h.

◆ FLASH_PDKEYR_PDKEY1

#define FLASH_PDKEYR_PDKEY1   ((uint32_t)0x04152637)

Definition at line 212 of file l4/flash.h.

◆ FLASH_PDKEYR_PDKEY2

#define FLASH_PDKEYR_PDKEY2   ((uint32_t)0xfafbfcfd)

Definition at line 213 of file l4/flash.h.

◆ FLASH_SR

#define FLASH_SR   MMIO32(FLASH_MEM_INTERFACE_BASE + 0x10)

Definition at line 54 of file l4/flash.h.

◆ FLASH_SR_BSY

#define FLASH_SR_BSY   (1 << 16)

Definition at line 84 of file l4/flash.h.

◆ FLASH_SR_EOP

#define FLASH_SR_EOP   (1 << 0)

Definition at line 95 of file l4/flash.h.

◆ FLASH_SR_FASTERR

#define FLASH_SR_FASTERR   (1 << 9)

Definition at line 87 of file l4/flash.h.

◆ FLASH_SR_MISERR

#define FLASH_SR_MISERR   (1 << 8)

Definition at line 88 of file l4/flash.h.

◆ FLASH_SR_OPERR

#define FLASH_SR_OPERR   (1 << 1)

Definition at line 94 of file l4/flash.h.

◆ FLASH_SR_OPTVERR

#define FLASH_SR_OPTVERR   (1 << 15)

Definition at line 85 of file l4/flash.h.

◆ FLASH_SR_PGAERR

#define FLASH_SR_PGAERR   (1 << 5)

Definition at line 91 of file l4/flash.h.

◆ FLASH_SR_PGSERR

#define FLASH_SR_PGSERR   (1 << 7)

Definition at line 89 of file l4/flash.h.

◆ FLASH_SR_PROGERR

#define FLASH_SR_PROGERR   (1 << 3)

Definition at line 93 of file l4/flash.h.

◆ FLASH_SR_RDERR

#define FLASH_SR_RDERR   (1 << 14)

Definition at line 86 of file l4/flash.h.

◆ FLASH_SR_SIZERR

#define FLASH_SR_SIZERR   (1 << 6)

Definition at line 90 of file l4/flash.h.

◆ FLASH_SR_WRPERR

#define FLASH_SR_WRPERR   (1 << 4)

Definition at line 92 of file l4/flash.h.

◆ FLASH_WRP1AR

#define FLASH_WRP1AR   MMIO32(FLASH_MEM_INTERFACE_BASE + 0x2C)

Definition at line 60 of file l4/flash.h.

◆ FLASH_WRP1AR_WRP1A_END_MASK

#define FLASH_WRP1AR_WRP1A_END_MASK   0xff

Definition at line 171 of file l4/flash.h.

◆ FLASH_WRP1AR_WRP1A_END_SHIFT

#define FLASH_WRP1AR_WRP1A_END_SHIFT   16

Definition at line 170 of file l4/flash.h.

◆ FLASH_WRP1AR_WRP1A_STRT_MASK

#define FLASH_WRP1AR_WRP1A_STRT_MASK   0xff

Definition at line 174 of file l4/flash.h.

◆ FLASH_WRP1AR_WRP1A_STRT_SHIFT

#define FLASH_WRP1AR_WRP1A_STRT_SHIFT   0

Definition at line 173 of file l4/flash.h.

◆ FLASH_WRP1BR

#define FLASH_WRP1BR   MMIO32(FLASH_MEM_INTERFACE_BASE + 0x30)

Definition at line 61 of file l4/flash.h.

◆ FLASH_WRP1BR_WRP1B_END_MASK

#define FLASH_WRP1BR_WRP1B_END_MASK   0xff

Definition at line 179 of file l4/flash.h.

◆ FLASH_WRP1BR_WRP1B_END_SHIFT

#define FLASH_WRP1BR_WRP1B_END_SHIFT   16

Definition at line 178 of file l4/flash.h.

◆ FLASH_WRP1BR_WRP1B_STRT_MASK

#define FLASH_WRP1BR_WRP1B_STRT_MASK   0xff

Definition at line 182 of file l4/flash.h.

◆ FLASH_WRP1BR_WRP1B_STRT_SHIFT

#define FLASH_WRP1BR_WRP1B_STRT_SHIFT   0

Definition at line 181 of file l4/flash.h.

◆ FLASH_WRP2AR

#define FLASH_WRP2AR   MMIO32(FLASH_MEM_INTERFACE_BASE + 0x4C)

Definition at line 64 of file l4/flash.h.

◆ FLASH_WRP2AR_WRP2A_END_MASK

#define FLASH_WRP2AR_WRP2A_END_MASK   0xff

Definition at line 197 of file l4/flash.h.

◆ FLASH_WRP2AR_WRP2A_END_SHIFT

#define FLASH_WRP2AR_WRP2A_END_SHIFT   16

Definition at line 196 of file l4/flash.h.

◆ FLASH_WRP2AR_WRP2A_STRT_MASK

#define FLASH_WRP2AR_WRP2A_STRT_MASK   0xff

Definition at line 200 of file l4/flash.h.

◆ FLASH_WRP2AR_WRP2A_STRT_SHIFT

#define FLASH_WRP2AR_WRP2A_STRT_SHIFT   0

Definition at line 199 of file l4/flash.h.

◆ FLASH_WRP2BR

#define FLASH_WRP2BR   MMIO32(FLASH_MEM_INTERFACE_BASE + 0x50)

Definition at line 65 of file l4/flash.h.

◆ FLASH_WRP2BR_WRP2B_END_MASK

#define FLASH_WRP2BR_WRP2B_END_MASK   0xff

Definition at line 205 of file l4/flash.h.

◆ FLASH_WRP2BR_WRP2B_END_SHIFT

#define FLASH_WRP2BR_WRP2B_END_SHIFT   16

Definition at line 204 of file l4/flash.h.

◆ FLASH_WRP2BR_WRP2B_STRT_MASK

#define FLASH_WRP2BR_WRP2B_STRT_MASK   0xff

Definition at line 208 of file l4/flash.h.

◆ FLASH_WRP2BR_WRP2B_STRT_SHIFT

#define FLASH_WRP2BR_WRP2B_STRT_SHIFT   0

Definition at line 207 of file l4/flash.h.

Function Documentation

◆ flash_clear_pgaerr_flag()

void flash_clear_pgaerr_flag ( void  )

Clear the Programming Alignment Error Flag.

Definition at line 70 of file flash.c.

References FLASH_SR, and FLASH_SR_PGAERR.

Referenced by flash_clear_status_flags().

Here is the caller graph for this function:

◆ flash_clear_pgserr_flag()

void flash_clear_pgserr_flag ( void  )

Clear the Programming Sequence Error Flag This flag is set when incorrect programming configuration has been made.

Definition at line 57 of file flash.c.

References FLASH_SR, and FLASH_SR_PGSERR.

Referenced by flash_clear_status_flags().

Here is the caller graph for this function:

◆ flash_clear_progerr_flag()

void flash_clear_progerr_flag ( void  )

Clear the Programming Error Status Flag.

Definition at line 84 of file flash.c.

References FLASH_SR, and FLASH_SR_PROGERR.

Referenced by flash_clear_status_flags().

Here is the caller graph for this function:

◆ flash_clear_size_flag()

void flash_clear_size_flag ( void  )

Clear programming size error flag.

Definition at line 63 of file flash.c.

References FLASH_SR, and FLASH_SR_SIZERR.

Referenced by flash_clear_status_flags().

Here is the caller graph for this function:

◆ flash_clear_wrperr_flag()

void flash_clear_wrperr_flag ( void  )

Clear the Write Protect Error Flag.

Definition at line 77 of file flash.c.

References FLASH_SR, and FLASH_SR_WRPERR.

Referenced by flash_clear_status_flags().

Here is the caller graph for this function:

◆ flash_dcache_disable()

void flash_dcache_disable ( void  )

Disable the data cache.

Definition at line 32 of file flash_common_idcache.c.

References FLASH_ACR.

Referenced by rcc_clock_setup_pll().

Here is the caller graph for this function:

◆ flash_dcache_enable()

void flash_dcache_enable ( void  )

Enable the data cache.

Definition at line 27 of file flash_common_idcache.c.

References FLASH_ACR, and FLASH_ACR_DCEN.

Referenced by rcc_clock_setup_pll().

Here is the caller graph for this function:

◆ flash_dcache_reset()

void flash_dcache_reset ( void  )

Reset the Data Cache.

The data cache must be disabled for this to have effect.

Definition at line 48 of file flash_common_idcache.c.

References FLASH_ACR, and FLASH_ACR_DCRST.

◆ flash_erase_all_pages()

void flash_erase_all_pages ( void  )

Erase All FLASH This performs all operations necessary to erase all sectors in the FLASH memory.

Definition at line 178 of file flash.c.

References FLASH_CR, FLASH_CR_MER1, FLASH_CR_MER2, FLASH_CR_START, and flash_wait_for_last_operation().

Here is the call graph for this function:

◆ flash_erase_page()

void flash_erase_page ( uint32_t  page)

Erase a page of FLASH.

Parameters
[in]page(0 - 255 for bank 1, 256-511 for bank 2)

Definition at line 157 of file flash.c.

References FLASH_CR, FLASH_CR_BKER, FLASH_CR_PER, FLASH_CR_PNB_MASK, FLASH_CR_PNB_SHIFT, FLASH_CR_START, and flash_wait_for_last_operation().

Here is the call graph for this function:

◆ flash_icache_disable()

void flash_icache_disable ( void  )

Disable the Instruction Cache.

Definition at line 42 of file flash_common_idcache.c.

References FLASH_ACR.

Referenced by rcc_clock_setup_pll().

Here is the caller graph for this function:

◆ flash_icache_enable()

void flash_icache_enable ( void  )

Enable the Instruction Cache.

Definition at line 37 of file flash_common_idcache.c.

References FLASH_ACR, and FLASH_ACR_ICEN.

Referenced by rcc_clock_setup_pll().

Here is the caller graph for this function:

◆ flash_icache_reset()

void flash_icache_reset ( void  )

Reset the Instruction Cache.

The instruction cache must be disabled for this to have effect.

Definition at line 53 of file flash_common_idcache.c.

References FLASH_ACR, and FLASH_ACR_ICRST.

◆ flash_lock_option_bytes()

void flash_lock_option_bytes ( void  )

Lock the Option Byte Access This disables write access to the option bytes.

It is locked by default on reset.

Definition at line 106 of file flash.c.

References FLASH_CR, and FLASH_CR_OPTLOCK.

◆ flash_program()

void flash_program ( uint32_t  address,
uint8_t *  data,
uint32_t  len 
)

Program a Data Block to FLASH This programs an arbitrary length data block to FLASH memory.

The program error flag should be checked separately for the event that memory was not properly erased.

Parameters
[in]addressStarting address in Flash.
[in]dataPointer to start of data block.
[in]lenLength of data block in bytes (multiple of 8).

Definition at line 147 of file flash.c.

References flash_program_double_word().

Here is the call graph for this function:

◆ flash_program_double_word()

void flash_program_double_word ( uint32_t  address,
uint64_t  data 
)

Program a 64 bit word to FLASH.

This performs all operations necessary to program a 64 bit word to FLASH memory. The program error flag should be checked separately for the event that memory was not properly erased.

Parameters
[in]addressStarting address in Flash.
[in]dataDouble word to write

Definition at line 120 of file flash.c.

References FLASH_CR, FLASH_CR_PG, flash_wait_for_last_operation(), and MMIO32.

Referenced by flash_program().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ flash_program_option_bytes()

void flash_program_option_bytes ( uint32_t  data)

Program the Option Bytes This performs all operations necessary to program the option bytes.

The option bytes do not need to be erased first.

Parameters
[in]datavalue to be programmed.

Definition at line 194 of file flash.c.

References FLASH_CR, FLASH_CR_OPTLOCK, FLASH_CR_OPTSTRT, FLASH_OPTR, flash_unlock_option_bytes(), and flash_wait_for_last_operation().

Here is the call graph for this function: