mirror of https://github.com/ARMmbed/mbed-os.git
[M2351] Merge secure idle/powerdown sequences into one
Merge SYS_UnlockReg_S()/CLK_Idle_S() or CLK_PowerDown_S()/SYS_LockReg_S() into nu_idle_s() or nu_powerdown_s() when they are available.pull/10959/head
parent
a0a1c4d52c
commit
c9b4474d50
|
@ -22,8 +22,18 @@
|
||||||
#include "device.h"
|
#include "device.h"
|
||||||
#include "objects.h"
|
#include "objects.h"
|
||||||
#include "PeripheralPins.h"
|
#include "PeripheralPins.h"
|
||||||
|
#include "platform/mbed_toolchain.h"
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
/* Merge SYS_UnlockReg_S()/CLK_Idle_S() or CLK_PowerDown_S()/SYS_LockReg_S()
|
||||||
|
* into nu_idle_s() or nu_powerdown_s()
|
||||||
|
*
|
||||||
|
* These APIs are secure calls. For performance, merge them into one when
|
||||||
|
* nu_idle_s() and nu_powerdown_s() are available.
|
||||||
|
*/
|
||||||
|
MBED_WEAK void nu_idle_s(void);
|
||||||
|
MBED_WEAK void nu_powerdown_s(void);
|
||||||
|
|
||||||
#if DEVICE_SERIAL
|
#if DEVICE_SERIAL
|
||||||
bool serial_can_deep_sleep(void);
|
bool serial_can_deep_sleep(void);
|
||||||
#endif
|
#endif
|
||||||
|
@ -38,9 +48,13 @@ void hal_sleep(void)
|
||||||
CLK_Idle();
|
CLK_Idle();
|
||||||
SYS_LockReg();
|
SYS_LockReg();
|
||||||
#else
|
#else
|
||||||
SYS_UnlockReg_S();
|
if (nu_idle_s) {
|
||||||
CLK_Idle_S();
|
nu_idle_s();
|
||||||
SYS_LockReg_S();
|
} else {
|
||||||
|
SYS_UnlockReg_S();
|
||||||
|
CLK_Idle_S();
|
||||||
|
SYS_LockReg_S();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,9 +74,13 @@ void hal_deepsleep(void)
|
||||||
CLK_PowerDown();
|
CLK_PowerDown();
|
||||||
SYS_LockReg();
|
SYS_LockReg();
|
||||||
#else
|
#else
|
||||||
SYS_UnlockReg_S();
|
if (nu_powerdown_s) {
|
||||||
CLK_PowerDown_S();
|
nu_powerdown_s();
|
||||||
SYS_LockReg_S();
|
} else {
|
||||||
|
SYS_UnlockReg_S();
|
||||||
|
CLK_PowerDown_S();
|
||||||
|
SYS_LockReg_S();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue