STM32 RTOS 0.2.3
Bare-metal preemptive RTOS for STM32F446RE
Loading...
Searching...
No Matches
Flash

Flash wait states, prefetch and caches. More...

Collaboration diagram for Flash:

Functions

DRIVER_MUST_CHECK DriverStatus_e flashSetLatency (FlashRegisters_t *flash, uint32_t latency)
 Set the flash access latency and confirm it by reading it back.
void flashEnableCaches (FlashRegisters_t *flash)
 Turn on prefetch and the instruction and data caches.

Detailed Description

Flash wait states, prefetch and caches.

Function Documentation

◆ flashSetLatency()

DriverStatus_e flashSetLatency ( FlashRegisters_t * flash,
uint32_t latency )

Set the flash access latency and confirm it by reading it back.

The latency must be at least RM0390 Table 5's value for the SYSCLK in use. More wait states than needed are always safe; too few corrupt instruction fetches with no fault. RM0390 has no ready flag for this field, but asks for the read-back.

Parameters
flashFlash interface block (e.g. FLASH).
latencyWait states, 0-15.
Return values
DRIVER_STATUS_OKWritten and read back.
DRIVER_STATUS_ERR_INVALID_PARAMlatency is above 15.
DRIVER_STATUS_ERR_HW_FAULTThe read-back differs: the interface did not accept it.
See also
rccSysclkSwitch(), which raises latency before a switch and lowers it after.

Definition at line 12 of file flash.c.

References FlashRegisters_t::ACR, DRIVER_STATUS_ERR_HW_FAULT, DRIVER_STATUS_ERR_INVALID_PARAM, DRIVER_STATUS_OK, FLASH_ACR_LATENCY_Msk, FLASH_ACR_LATENCY_Pos, and flashSetLatency().

Referenced by flashSetLatency(), and rccSysclkSwitch().

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

◆ flashEnableCaches()

void flashEnableCaches ( FlashRegisters_t * flash)

Turn on prefetch and the instruction and data caches.

Other ACR fields, including LATENCY, are preserved. The caches are empty out of reset, so no cache reset is done. Callable at any point in bring-up.

Parameters
flashFlash interface block (e.g. FLASH).

Definition at line 40 of file flash.c.

References FlashRegisters_t::ACR, FLASH_ACR_DCEN, FLASH_ACR_ICEN, FLASH_ACR_PRFTEN, and flashEnableCaches().

Referenced by bspClockInit(), and flashEnableCaches().

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