From 431b848c79e1b14246b3a8eacd4e2b476a6ab62a Mon Sep 17 00:00:00 2001 From: buxiasen Date: Tue, 8 Oct 2024 12:22:09 +0800 Subject: [PATCH] board/arm/nrf52: fix use up_interrupt_context to is_nesting_interrupt The case want to determine if a interrupt with higher priority and the interrupt preemption occurred, but up_interrupt_context indicates that we self inside interrupt/handler mode. As we previously did not handle the ramvector interrupt correctly, after update breaked the case. We should use a more clear private function is_nesting_interrupt. Signed-off-by: buxiasen --- boards/arm/nrf52/nrf52840-dk/src/nrf52_highpri.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/boards/arm/nrf52/nrf52840-dk/src/nrf52_highpri.c b/boards/arm/nrf52/nrf52840-dk/src/nrf52_highpri.c index f926bccf7e..9036c79caf 100644 --- a/boards/arm/nrf52/nrf52840-dk/src/nrf52_highpri.c +++ b/boards/arm/nrf52/nrf52840-dk/src/nrf52_highpri.c @@ -96,6 +96,11 @@ static struct highpri_s g_highpri; * Private Functions ****************************************************************************/ +static inline_function bool is_nesting_interrupt(void) +{ + return up_current_regs() != NULL; +} + /**************************************************************************** * Name: timer_handler * @@ -126,7 +131,7 @@ void timer_handler(void) /* Check if we are in an interrupt handle */ - if (up_interrupt_context()) + if (is_nesting_interrupt()) { g_highpri.handler++; }