From 386e50d1138143fe9844c5ab62f14f7ae8e18f52 Mon Sep 17 00:00:00 2001 From: Freey0 Date: Thu, 26 May 2022 02:02:49 +0800 Subject: [PATCH] Fix bug when restarting and getting interrupts that are not processed. Reason: Interrupts were not cleaned up during initialization --- bsp/nuvoton/libraries/nuc980/rtt_port/drv_sys.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bsp/nuvoton/libraries/nuc980/rtt_port/drv_sys.c b/bsp/nuvoton/libraries/nuc980/rtt_port/drv_sys.c index 8e13f40ff7f..7260bd01605 100644 --- a/bsp/nuvoton/libraries/nuc980/rtt_port/drv_sys.c +++ b/bsp/nuvoton/libraries/nuc980/rtt_port/drv_sys.c @@ -106,8 +106,11 @@ void rt_hw_interrupt_init(void) { int i; - *((volatile unsigned int *)REG_AIC_INTDIS0) = 0xFFFFFFFF; // disable all interrupt channel - *((volatile unsigned int *)REG_AIC_INTDIS1) = 0xFFFFFFFF; // disable all interrupt channel + outpw(REG_AIC_INTDIS0, 0xFFFFFFFF); // disable all interrupt channel + outpw(REG_AIC_INTDIS1, 0xFFFFFFFF); // disable all interrupt channel + + outpw(REG_AIC_EOIS, 1); // resetand restart AIC's IRQ processing + outpw(REG_AIC_EOFS, 1); // resetand restart AIC's IRQ processing /* init interrupt nest, and context in thread sp */ rt_interrupt_nest = 0;