Skip to content

Commit 15b573d

Browse files
committed
Reuse nvic powerdown code block for M0+
1 parent 7201cab commit 15b573d

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

platform/mbed_application.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,21 +90,18 @@ void mbed_start_application(uintptr_t address)
9090
static void powerdown_nvic()
9191
{
9292
int i;
93-
#if defined(__CORTEX_M0PLUS)
94-
NVIC->ICER[0] = 0xFFFFFFFF;
95-
NVIC->ICPR[0] = 0xFFFFFFFF;
96-
for (i = 0; i < 8; i++) {
97-
NVIC->IP[i] = 0x00000000;
98-
}
99-
#else
10093
int j;
10194
int isr_groups_32;
95+
10296
#if defined(__CORTEX_M23)
10397
// M23 doesn't support ICTR and supports up to 240 external interrupts.
10498
isr_groups_32 = 8;
99+
#elif defined(__CORTEX_M0PLUS)
100+
isr_groups_32 = 1;
105101
#else
106102
isr_groups_32 = ((SCnSCB->ICTR & SCnSCB_ICTR_INTLINESNUM_Msk) >> SCnSCB_ICTR_INTLINESNUM_Pos) + 1;
107103
#endif
104+
108105
for (i = 0; i < isr_groups_32; i++) {
109106
NVIC->ICER[i] = 0xFFFFFFFF;
110107
NVIC->ICPR[i] = 0xFFFFFFFF;
@@ -116,7 +113,6 @@ static void powerdown_nvic()
116113
#endif
117114
}
118115
}
119-
#endif
120116
}
121117

122118
static void powerdown_scb(uint32_t vtor)

0 commit comments

Comments
 (0)