1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-25 06:23:53 +01:00

cpu/lpc2387: clear POR bit if we woke from Deep Sleep

RSIR is 0x1 (POR) if we woke from Deep Sleep.
This makes it hard to distinguish between real power-on and waking from
Deep Sleep, which is why the Backup RAM signature was introduced.

However, calling cpu_woke_from_backup() a second time will always return
true, as the signature will have been set up by early boot then.

Thus, clear the POR bit if the signature was already in place.
The result is:

	RSIR == 0 -> woke from sleep
	RSIR == 1 -> cold boot
This commit is contained in:
Benjamin Valentin 2019-12-05 22:09:39 +01:00 committed by Benjamin Valentin
parent 6dbbc8f33a
commit 80dde82c86

View File

@ -166,6 +166,11 @@ bool cpu_woke_from_backup(void)
return false;
}
/* When we wake from Deep Sleep only POR is set, just like in the real
* POR case. Clear the bit to create a new, distinct state.
*/
RSIR |= RSIR_POR;
return true;
}