File tree Expand file tree Collapse file tree 1 file changed +24
-6
lines changed
targets/TARGET_NUVOTON/TARGET_M2351 Expand file tree Collapse file tree 1 file changed +24
-6
lines changed Original file line number Diff line number Diff line change 22
22
#include "device.h"
23
23
#include "objects.h"
24
24
#include "PeripheralPins.h"
25
+ #include "platform/mbed_toolchain.h"
25
26
#include <stdbool.h>
26
27
28
+ /* Merge SYS_UnlockReg_S()/CLK_Idle_S() or CLK_PowerDown_S()/SYS_LockReg_S()
29
+ * into nu_idle_s() or nu_powerdown_s()
30
+ *
31
+ * These APIs are secure calls. For performance, merge them into one when
32
+ * nu_idle_s() and nu_powerdown_s() are available.
33
+ */
34
+ MBED_WEAK void nu_idle_s (void );
35
+ MBED_WEAK void nu_powerdown_s (void );
36
+
27
37
#if DEVICE_SERIAL
28
38
bool serial_can_deep_sleep (void );
29
39
#endif
@@ -38,9 +48,13 @@ void hal_sleep(void)
38
48
CLK_Idle ();
39
49
SYS_LockReg ();
40
50
#else
41
- SYS_UnlockReg_S ();
42
- CLK_Idle_S ();
43
- SYS_LockReg_S ();
51
+ if (nu_idle_s ) {
52
+ nu_idle_s ();
53
+ } else {
54
+ SYS_UnlockReg_S ();
55
+ CLK_Idle_S ();
56
+ SYS_LockReg_S ();
57
+ }
44
58
#endif
45
59
}
46
60
@@ -60,9 +74,13 @@ void hal_deepsleep(void)
60
74
CLK_PowerDown ();
61
75
SYS_LockReg ();
62
76
#else
63
- SYS_UnlockReg_S ();
64
- CLK_PowerDown_S ();
65
- SYS_LockReg_S ();
77
+ if (nu_powerdown_s ) {
78
+ nu_powerdown_s ();
79
+ } else {
80
+ SYS_UnlockReg_S ();
81
+ CLK_PowerDown_S ();
82
+ SYS_LockReg_S ();
83
+ }
66
84
#endif
67
85
}
68
86
You can’t perform that action at this time.
0 commit comments