STM32 RTOS 0.2.3
Bare-metal preemptive RTOS for STM32F446RE
Loading...
Searching...
No Matches
flash.c
Go to the documentation of this file.
1
5#include "flash.h"
6
11
13{
15
17 {
19 }
20 else
21 {
22 flash->ACR = (flash->ACR & ~FLASH_ACR_LATENCY_Msk) | (latency << FLASH_ACR_LATENCY_Pos);
23
24 /* RM0390 section 3.4.1 asks for this read-back before the clock rises.
25 * It is the project's only coverage exclusion: an in-memory struct
26 * always reads back what was written, so the failure branch needs
27 * silicon that rejects the write (see docs/DESIGN.md, "Host testing
28 * and its limits"). */
29 /* GCOVR_EXCL_START */
30 if ((flash->ACR & FLASH_ACR_LATENCY_Msk) != (latency << FLASH_ACR_LATENCY_Pos))
31 {
33 }
34 /* GCOVR_EXCL_STOP */
35 }
36
37 return status;
38}
39
44
Flash driver: access latency (wait states), prefetch and caches.
DriverStatus_e
Outcome of a driver call: a category for control flow, not a diagnosis.
@ DRIVER_STATUS_OK
Succeeded.
@ DRIVER_STATUS_ERR_HW_FAULT
The hardware answered with a fault, such as a UART framing error or a rejected write.
@ DRIVER_STATUS_ERR_INVALID_PARAM
A parameter is outside its valid domain.
DRIVER_MUST_CHECK DriverStatus_e flashSetLatency(FlashRegisters_t *flash, uint32_t latency)
Set the flash access latency and confirm it by reading it back.
Definition flash.c:12
void flashEnableCaches(FlashRegisters_t *flash)
Turn on prefetch and the instruction and data caches.
Definition flash.c:40
#define FLASH_ACR_PRFTEN
<span class="regaccess">rw</span> Enable prefetch.
Definition flash_reg.h:45
#define FLASH_ACR_ICEN
<span class="regaccess">rw</span> Enable the instruction cache.
Definition flash_reg.h:48
#define FLASH_ACR_DCEN
<span class="regaccess">rw</span> Enable the data cache.
Definition flash_reg.h:51
#define FLASH_ACR_LATENCY_Msk
<span class="regaccess">rw</span> Wait states (0-15).
Definition flash_reg.h:42
#define FLASH_ACR_LATENCY_Pos
Bits 3:0.
Definition flash_reg.h:40
Flash interface register block.
Definition flash_reg.h:26
volatile uint32_t ACR
0x00: access control
Definition flash_reg.h:27