Skip to content

Commit d52fced

Browse files
committed
M263: Fix compile error on analogin/out & crypto-misc
1 parent b9a2e06 commit d52fced

File tree

3 files changed

+17
-38
lines changed

3 files changed

+17
-38
lines changed

targets/TARGET_NUVOTON/TARGET_M261/analogin_api.c

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -57,23 +57,14 @@ void analogin_init(analogin_t *obj, PinName pin)
5757

5858
// NOTE: All channels (identified by ADCName) share a ADC module. This reset will also affect other channels of the same ADC module.
5959
if (! eadc_modinit_mask) {
60-
/* Reset module
61-
*
62-
* NOTE: We must call secure version (from non-secure domain) because SYS/CLK regions are secure.
63-
*/
64-
SYS_ResetModule_S(modinit->rsetidx);
65-
66-
/* Select IP clock source
67-
*
68-
* NOTE: We must call secure version (from non-secure domain) because SYS/CLK regions are secure.
69-
*/
70-
CLK_SetModuleClock_S(modinit->clkidx, modinit->clksrc, modinit->clkdiv);
60+
// Reset module
61+
SYS_ResetModule(modinit->rsetidx);
62+
63+
// Select IP clock source
64+
CLK_SetModuleClock(modinit->clkidx, modinit->clksrc, modinit->clkdiv);
7165

72-
/* Enable IP clock
73-
*
74-
* NOTE: We must call secure version (from non-secure domain) because SYS/CLK regions are secure.
75-
*/
76-
CLK_EnableModuleClock_S(modinit->clkidx);
66+
// Enable IP clock
67+
CLK_EnableModuleClock(modinit->clkidx);
7768

7869
// Set the ADC internal sampling time, input mode as single-end and enable the A/D converter
7970
EADC_Open(eadc_base, EADC_CTL_DIFFEN_SINGLE_END);

targets/TARGET_NUVOTON/TARGET_M261/analogout_api.c

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -66,23 +66,14 @@ void analogout_init(dac_t *obj, PinName pin)
6666
* channels are deactivated.
6767
*/
6868
if ((! dac_modinit_mask[0]) && (! dac_modinit_mask[1])) {
69-
/* Reset IP
70-
*
71-
* NOTE: We must call secure version (from non-secure domain) because SYS/CLK regions are secure.
72-
*/
73-
SYS_ResetModule_S(modinit->rsetidx);
69+
// Reset IP
70+
SYS_ResetModule(modinit->rsetidx);
7471

75-
/* Select IP clock source and clock divider
76-
*
77-
* NOTE: We must call secure version (from non-secure domain) because SYS/CLK regions are secure.
78-
*/
79-
CLK_SetModuleClock_S(modinit->clkidx, modinit->clksrc, modinit->clkdiv);
80-
81-
/* Enable IP clock
82-
*
83-
* NOTE: We must call secure version (from non-secure domain) because SYS/CLK regions are secure.
84-
*/
85-
CLK_EnableModuleClock_S(modinit->clkidx);
72+
// Select IP clock source and clock divider
73+
CLK_SetModuleClock(modinit->clkidx, modinit->clksrc, modinit->clkdiv);
74+
75+
// Enable IP clock
76+
CLK_EnableModuleClock(modinit->clkidx);
8677

8778
/* The conversion settling time is 8us when 12-bit input code transition from
8879
* lowest code (0x000) to highest code (0xFFF). */
@@ -134,11 +125,8 @@ void analogout_free(dac_t *obj)
134125
/* See analogout_init() for reason */
135126
if ((! dac_modinit_mask[0]) && (! dac_modinit_mask[1])) {
136127

137-
/* Disable IP clock
138-
*
139-
* NOTE: We must call secure version (from non-secure domain) because SYS/CLK regions are secure.
140-
*/
141-
CLK_DisableModuleClock_S(modinit->clkidx);
128+
// Disable IP clock
129+
CLK_DisableModuleClock(modinit->clkidx);
142130
}
143131
}
144132

targets/TARGET_NUVOTON/TARGET_M261/crypto/crypto-misc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ void crypto_init(void)
9090
}
9191
core_util_atomic_incr_u16(&crypto_init_counter, 1);
9292
if (crypto_init_counter == 1) {
93-
/* Enable IP clock
93+
// Enable IP clock
9494
SYS_UnlockReg(); // Unlock protected register
9595
CLK_EnableModuleClock(CRPT_MODULE);
9696
SYS_LockReg(); // Lock protected register

0 commit comments

Comments
 (0)