mcuboot/boot/zephyr/arm_cleanup.c

23 lines
472 B
C

/*
* Copyright (c) 2020 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr.h>
void cleanup_arm_nvic(void) {
/* Allow any pending interrupts to be recognized */
__ISB();
__disable_irq();
/* Disable NVIC interrupts */
for (u8_t i = 0; i < ARRAY_SIZE(NVIC->ICER); i++) {
NVIC->ICER[i] = 0xFFFFFFFF;
}
/* Clear pending NVIC interrupts */
for (u8_t i = 0; i < ARRAY_SIZE(NVIC->ICPR); i++) {
NVIC->ICPR[i] = 0xFFFFFFFF;
}
}