arch: arm: core: aarch32: rename z_NmiHandlerSet

rename the function that sets the handler for the nmi.
It should be namespaced and not camel-case:
z_NmiHandlerSet to z_arm_nmi_set_handler

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
This commit is contained in:
Thomas Stranger 2023-04-07 19:06:52 +02:00 committed by Carles Cufí
parent 053697cd5f
commit 77d2490164
6 changed files with 12 additions and 13 deletions

View file

@ -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"

View file

@ -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;
}

View file

@ -12,6 +12,7 @@
#include <errno.h>
#include <soc.h>
#include <zephyr/arch/arm/aarch32/nmi.h>
#include <zephyr/drivers/watchdog.h>
#include <zephyr/sys/printk.h>
#include <zephyr/sys/reboot.h>
@ -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

View file

@ -5,6 +5,7 @@
*/
#include <soc.h>
#include <zephyr/arch/arm/aarch32/nmi.h>
#include <zephyr/kernel.h>
#include <zephyr/drivers/watchdog.h>
#include <zephyr/logging/log.h>
@ -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;

View file

@ -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()

View file

@ -8,6 +8,7 @@
#include <zephyr/sys/printk.h>
#include <zephyr/sys/reboot.h>
#include <zephyr/arch/arm/aarch32/cortex_m/cmsis.h>
#include <zephyr/arch/arm/aarch32/nmi.h>
#include <zephyr/ztest.h>
#include <zephyr/tc_util.h>
@ -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);