1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-17 05:12:57 +01:00

cpu/lpc2387: rename cpu_woke_from_backup()

The function would always return `true` after early boot, so it
is not very useful for applications.

Now it will only (but always) return true when we woke from Deep Sleep
*after* early boot. This makes it behave the same ways as the function
of the same name on SAME54.

Rename the existing function to cpu_backup_ram_is_initialized() to better
match it's semantics.
This commit is contained in:
Benjamin Valentin 2019-12-09 15:01:57 +01:00 committed by Benjamin Valentin
parent 64107dd3a9
commit 76e19602a2
3 changed files with 10 additions and 3 deletions

View File

@ -88,7 +88,7 @@ static inline void _init_data(void)
#ifdef CPU_HAS_BACKUP_RAM
/* only initialize battery backup on cold boot */
if (cpu_woke_from_backup()) {
if (cpu_backup_ram_is_initialized()) {
return;
}

View File

@ -139,7 +139,7 @@ void cpu_init(void)
/* RSIR will only have POR bit set even when waking up from Deep Power Down
* Use signature in battery RAM to discriminate between Deep Power Down and POR
*/
bool cpu_woke_from_backup(void)
bool cpu_backup_ram_is_initialized(void)
{
static char signature[] __attribute__((section(".backup.data"))) = {
'R', 'I', 'O', 'T'

View File

@ -60,7 +60,14 @@ static inline void cpu_print_last_instruction(void)
/**
* @brief Returns true if the CPU woke from Deep Sleep
*/
bool cpu_woke_from_backup(void);
static inline bool cpu_woke_from_backup(void) {
return RSIR == 0;
}
/**
* @brief Returns true if the backup RAM has been initialized
*/
bool cpu_backup_ram_is_initialized(void);
/**
* @brief The CPU has RAM that is retained in the deepest sleep mode.