rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Functions
mpu_util.cpp File Reference

Detailed Description

Date
Jul 27, 2014
Author
Andrey Belomutskiy, (c) 2012-2020

Definition in file mpu_util.cpp.

Functions

bool mcuCanFlashWhileRunning ()
 
size_t flashSectorSize (flashsector_t sector)
 Get the size of sector.
 
uintptr_t getFlashAddrFirstCopy ()
 
uintptr_t getFlashAddrSecondCopy ()
 
void stm32_standby ()
 

Function Documentation

◆ flashSectorSize()

size_t flashSectorSize ( flashsector_t  sector)

Get the size of sector.

Returns
sector size in bytes.

Definition at line 15 of file mpu_util.cpp.

15 {
16 // sectors 0..11 are the 1st memory bank (1Mb), and 12..23 are the 2nd (the same structure).
17 if (sector <= 3 || (sector >= 12 && sector <= 15))
18 return 16 * 1024;
19 else if (sector == 4 || sector == 16)
20 return 64 * 1024;
21 else if ((sector >= 5 && sector <= 11) || (sector >= 17 && sector <= 23))
22 return 128 * 1024;
23 return 0;
24}

◆ getFlashAddrFirstCopy()

uintptr_t getFlashAddrFirstCopy ( void  )

Flex Non Volatile Memory is faster than flash It also has smaller pages so it takes less time to erase

There is no remote access to FlexNVM meaning that we cannot erase settings externally

Definition at line 28 of file mpu_util.cpp.

28 {
29 /* last 128K sector on 512K devices */
30 if (TM_ID_GetFlashSize() <= 512)
31 return 0x08060000;
32 return 0x080E0000;
33}

◆ getFlashAddrSecondCopy()

uintptr_t getFlashAddrSecondCopy ( void  )

Definition at line 35 of file mpu_util.cpp.

35 {
36 /* no second copy on 512K devices */
37 if (TM_ID_GetFlashSize() <= 512)
38 return 0x000000000;
39 return 0x080C0000;
40}

◆ mcuCanFlashWhileRunning()

bool mcuCanFlashWhileRunning ( )

Definition at line 10 of file mpu_util.cpp.

10 {
11 // Never allow flash while running on F4, dual bank not implemented.
12 return false;
13}

◆ stm32_standby()

void stm32_standby ( )

Definition at line 46 of file mpu_util.cpp.

46 {
47 // Don't get bothered by interrupts
48 __disable_irq();
49
50 SysTick->CTRL = 0;
51 SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
52 PWR->CR |= PWR_CR_PDDS; // PDDS = use standby mode (not stop mode)
53 PWR->CR |= PWR_CR_CSBF; // Clear standby flag
54
55 // Do anything the board wants to prepare for standby mode - enabling wakeup sources!
57
58 __WFI();
59}
void boardPrepareForStandby()
Here is the call graph for this function:

Go to the source code of this file.