STM32 RTOS 0.2.3
Bare-metal preemptive RTOS for STM32F446RE
Loading...
Searching...
No Matches
flash_reg.h File Reference

Flash interface registers: access latency, prefetch and caches (RM0390 section 3.8). More...

#include <stdint.h>
Include dependency graph for flash_reg.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  FlashRegisters_t
 Flash interface register block. More...

Macros

#define FLASH_BASE   (0x40023C00UL)
 Flash interface base address (AHB1).
#define FLASH   ((FlashRegisters_t *)FLASH_BASE)
 The Flash interface instance.
ACR - access control (0x00)
#define FLASH_ACR_LATENCY_Pos   (0U)
 Bits 3:0.
#define FLASH_ACR_LATENCY_Msk   ((uint32_t)0xFU << FLASH_ACR_LATENCY_Pos)
  rw Wait states (0-15).
#define FLASH_ACR_PRFTEN_Pos   (8U)
 Bit 8.
#define FLASH_ACR_PRFTEN   ((uint32_t)1U << FLASH_ACR_PRFTEN_Pos)
  rw Enable prefetch.
#define FLASH_ACR_ICEN_Pos   (9U)
 Bit 9.
#define FLASH_ACR_ICEN   ((uint32_t)1U << FLASH_ACR_ICEN_Pos)
  rw Enable the instruction cache.
#define FLASH_ACR_DCEN_Pos   (10U)
 Bit 10.
#define FLASH_ACR_DCEN   ((uint32_t)1U << FLASH_ACR_DCEN_Pos)
  rw Enable the data cache.
#define FLASH_ACR_ICRST_Pos   (11U)
 Bit 11.
#define FLASH_ACR_ICRST   ((uint32_t)1U << FLASH_ACR_ICRST_Pos)
  rw Reset the instruction cache; only while it is disabled.
#define FLASH_ACR_DCRST_Pos   (12U)
 Bit 12.
#define FLASH_ACR_DCRST   ((uint32_t)1U << FLASH_ACR_DCRST_Pos)
  rw Reset the data cache; only while it is disabled.
SR - status (0x0C)
#define FLASH_SR_EOP_Pos   (0U)
 Bit 0.
#define FLASH_SR_EOP   ((uint32_t)1U << FLASH_SR_EOP_Pos)
  rc_w1 End of operation.
#define FLASH_SR_WRPERR_Pos   (4U)
 Bit 4.
#define FLASH_SR_WRPERR   ((uint32_t)1U << FLASH_SR_WRPERR_Pos)
  rc_w1 Write-protection error.
#define FLASH_SR_BSY_Pos   (16U)
 Bit 16.
#define FLASH_SR_BSY   ((uint32_t)1U << FLASH_SR_BSY_Pos)
  ro A flash operation is in progress.

Typedefs

typedef struct FlashRegisters_t FlashRegisters_t
 Flash interface register block.

Detailed Description

Flash interface registers: access latency, prefetch and caches (RM0390 section 3.8).

LATENCY must match SYSCLK and the supply voltage (RM0390 Table 5). A wrong value raises no fault; flash reads are simply unreliable. Only the bits the clock bring-up uses are modelled: there are no CR programming bits and only EOP, WRPERR and BSY in SR, because the project does not write flash at run time.

Definition in file flash_reg.h.