rusefi/firmware/hw_layer/ports/at32/at32f4/mpu_util.cpp

34 lines
800 B
C++

/**
* @file mpu_util.cpp
*
* @date Nov 3, 2023
* @author Andrey Gusakov, (c) 2023
*/
#include "pch.h"
#include "flash_int.h"
bool allowFlashWhileRunning() {
/* TODO: check for actual flash configuration? */
/* currently we support only AT32F43X with dual-bank flash, so allow flashing to second bank */
return true;
}
/* TODO: fix name! */
void stm32_standby() {
// Don't get bothered by interrupts
__disable_irq();
/* TODO: validate! */
#if 0
SysTick->CTRL = 0;
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
PWR->CR |= PWR_CR_PDDS; // PDDS = use standby mode (not stop mode)
PWR->CR |= PWR_CR_CSBF; // Clear standby flag
#endif
// Do anything the board wants to prepare for standby mode - enabling wakeup sources!
boardPrepareForStandby();
__WFI();
}