2020-03-16 20:34:30 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2020 Nordic Semiconductor ASA
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
2020-04-02 07:41:54 +08:00
|
|
|
#include <arch/arm/aarch32/cortex_m/cmsis.h>
|
2020-03-16 20:34:30 +08:00
|
|
|
|
|
|
|
void cleanup_arm_nvic(void) {
|
|
|
|
/* Allow any pending interrupts to be recognized */
|
|
|
|
__ISB();
|
|
|
|
__disable_irq();
|
|
|
|
|
|
|
|
/* Disable NVIC interrupts */
|
2020-05-28 01:25:41 +08:00
|
|
|
for (uint8_t i = 0; i < ARRAY_SIZE(NVIC->ICER); i++) {
|
2020-03-16 20:34:30 +08:00
|
|
|
NVIC->ICER[i] = 0xFFFFFFFF;
|
|
|
|
}
|
|
|
|
/* Clear pending NVIC interrupts */
|
2020-05-28 01:25:41 +08:00
|
|
|
for (uint8_t i = 0; i < ARRAY_SIZE(NVIC->ICPR); i++) {
|
2020-03-16 20:34:30 +08:00
|
|
|
NVIC->ICPR[i] = 0xFFFFFFFF;
|
|
|
|
}
|
|
|
|
}
|