diff --git a/arch/arm/core/aarch32/Kconfig b/arch/arm/core/aarch32/Kconfig index 63f6d7121e..35c0ec0129 100644 --- a/arch/arm/core/aarch32/Kconfig +++ b/arch/arm/core/aarch32/Kconfig @@ -150,7 +150,7 @@ config RUNTIME_NMI The kernel provides a simple NMI handler that simply hangs in a tight loop if triggered. This fills the requirement that there must be an NMI handler installed when the CPU boots. If a custom handler is - needed, enable this option and attach it via _NmiHandlerSet(). + needed, enable this option and attach it via z_arm_nmi_set_handler(). config PLATFORM_SPECIFIC_INIT bool "Platform (SOC) specific startup hook" diff --git a/arch/arm/core/aarch32/nmi.c b/arch/arm/core/aarch32/nmi.c index aefa4450b0..a84827d1e3 100644 --- a/arch/arm/core/aarch32/nmi.c +++ b/arch/arm/core/aarch32/nmi.c @@ -70,7 +70,7 @@ void z_arm_nmi_init(void) * */ -void z_NmiHandlerSet(void (*pHandler)(void)) +void z_arm_nmi_set_handler(void (*pHandler)(void)) { handler = pHandler; } diff --git a/drivers/watchdog/wdt_cmsdk_apb.c b/drivers/watchdog/wdt_cmsdk_apb.c index 9156c9db05..9d4fa1b979 100644 --- a/drivers/watchdog/wdt_cmsdk_apb.c +++ b/drivers/watchdog/wdt_cmsdk_apb.c @@ -12,6 +12,7 @@ #include #include +#include #include #include #include @@ -148,7 +149,6 @@ static const struct wdt_driver_api wdog_cmsdk_apb_api = { }; #ifdef CONFIG_RUNTIME_NMI -extern void z_NmiHandlerSet(void (*pHandler)(void)); static int wdog_cmsdk_apb_has_fired(void) { @@ -189,7 +189,7 @@ static int wdog_cmsdk_apb_init(const struct device *dev) #ifdef CONFIG_RUNTIME_NMI /* Configure the interrupts */ - z_NmiHandlerSet(wdog_cmsdk_apb_isr); + z_arm_nmi_set_handler(wdog_cmsdk_apb_isr); #endif #ifdef CONFIG_WDOG_CMSDK_APB_START_AT_BOOT diff --git a/drivers/watchdog/wdt_smartbond.c b/drivers/watchdog/wdt_smartbond.c index bf827667d5..4e48aa5c5c 100644 --- a/drivers/watchdog/wdt_smartbond.c +++ b/drivers/watchdog/wdt_smartbond.c @@ -5,6 +5,7 @@ */ #include +#include #include #include #include @@ -50,8 +51,6 @@ static int wdg_smartbond_disable(const struct device *dev) } #ifdef CONFIG_WDT_SMARTBOND_NMI -extern void z_NmiHandlerSet(void (*pHandler)(void)); - static void wdog_smartbond_nmi_isr(void) { if (wdog_smartbond_dev_data.callback) { @@ -86,7 +85,7 @@ static int wdg_smartbond_install_timeout(const struct device *dev, #if CONFIG_WDT_SMARTBOND_NMI data->callback = config->callback; data->wdog_device = dev; - z_NmiHandlerSet(wdog_smartbond_nmi_isr); + z_arm_nmi_set_handler(wdog_smartbond_nmi_isr); SYS_WDOG->WATCHDOG_CTRL_REG = 2; #else SYS_WDOG->WATCHDOG_CTRL_REG = 2 | SYS_WDOG_WATCHDOG_CTRL_REG_NMI_RST_Msk; diff --git a/include/zephyr/arch/arm/aarch32/nmi.h b/include/zephyr/arch/arm/aarch32/nmi.h index 4e7417e7a0..6d44499aaf 100644 --- a/include/zephyr/arch/arm/aarch32/nmi.h +++ b/include/zephyr/arch/arm/aarch32/nmi.h @@ -16,6 +16,7 @@ #ifndef _ASMLANGUAGE #ifdef CONFIG_RUNTIME_NMI extern void z_arm_nmi_init(void); +extern void z_arm_nmi_set_handler(void (*pHandler)(void)); #define NMI_INIT() z_arm_nmi_init() #else #define NMI_INIT() diff --git a/tests/arch/arm/arm_runtime_nmi/src/arm_runtime_nmi.c b/tests/arch/arm/arm_runtime_nmi/src/arm_runtime_nmi.c index b6789804d9..d5ce44e300 100644 --- a/tests/arch/arm/arm_runtime_nmi/src/arm_runtime_nmi.c +++ b/tests/arch/arm/arm_runtime_nmi/src/arm_runtime_nmi.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -16,8 +17,6 @@ #define SCB_ICSR_NMIPENDSET_Msk SCB_ICSR_PENDNMISET_Msk #endif -extern void z_NmiHandlerSet(void (*pHandler)(void)); - static bool nmi_triggered; static void nmi_test_isr(void) @@ -38,20 +37,20 @@ static void nmi_test_isr(void) /** * @brief test the behavior of CONFIG_RUNTIME_NMI at run time * - * @details this test is to validate z_NmiHandlerSet() api. - * First we configure the NMI isr using z_NmiHandlerSet() api. + * @details this test is to validate z_arm_nmi_set_handler() api. + * First we configure the NMI isr using z_arm_nmi_set_handler() api. * After wait for some time, and set the Interrupt Control and * State Register(ICSR) of System control block (SCB). * The registered NMI isr should fire immediately. * - * @see z_NmiHandlerSet() + * @see z_arm_nmi_set_handler() */ ZTEST(arm_runtime_nmi_fn, test_arm_runtime_nmi) { uint32_t i = 0U; /* Configure the NMI isr */ - z_NmiHandlerSet(nmi_test_isr); + z_arm_nmi_set_handler(nmi_test_isr); for (i = 0U; i < 10; i++) { printk("Trigger NMI in 10s: %d s\n", i);