From 325167b3e73156602ba8ea96baecbc7d5f870a1a Mon Sep 17 00:00:00 2001 From: Nhut Nguyen Date: Thu, 12 Dec 2024 17:52:00 +0700 Subject: [PATCH] hal: renesas: rzg: Initial support for Interrupt Control Initial HAL support for Interrupt Control Signed-off-by: Hoang Nguyen Signed-off-by: Nhut Nguyen --- drivers/rz/CMakeLists.txt | 4 + drivers/rz/fsp/inc/api/r_external_irq_api.h | 170 ++++++++ drivers/rz/fsp/inc/instances/rzg/r_intc_irq.h | 82 ++++ drivers/rz/fsp/inc/instances/rzg/r_intc_nmi.h | 82 ++++ .../rz/fsp/src/rzg/r_intc_irq/r_intc_irq.c | 381 ++++++++++++++++++ .../rz/fsp/src/rzg/r_intc_nmi/r_intc_nmi.c | 327 +++++++++++++++ zephyr/rz/rz_cfg/fsp_cfg/rzg/r_intc_irq_cfg.h | 17 + zephyr/rz/rz_cfg/fsp_cfg/rzg/r_intc_nmi_cfg.h | 17 + 8 files changed, 1080 insertions(+) create mode 100644 drivers/rz/fsp/inc/api/r_external_irq_api.h create mode 100644 drivers/rz/fsp/inc/instances/rzg/r_intc_irq.h create mode 100644 drivers/rz/fsp/inc/instances/rzg/r_intc_nmi.h create mode 100644 drivers/rz/fsp/src/rzg/r_intc_irq/r_intc_irq.c create mode 100644 drivers/rz/fsp/src/rzg/r_intc_nmi/r_intc_nmi.c create mode 100644 zephyr/rz/rz_cfg/fsp_cfg/rzg/r_intc_irq_cfg.h create mode 100644 zephyr/rz/rz_cfg/fsp_cfg/rzg/r_intc_nmi_cfg.h diff --git a/drivers/rz/CMakeLists.txt b/drivers/rz/CMakeLists.txt index d68c114..4f1f37e 100644 --- a/drivers/rz/CMakeLists.txt +++ b/drivers/rz/CMakeLists.txt @@ -34,3 +34,7 @@ zephyr_library_sources_ifdef(CONFIG_USE_RZ_FSP_RIIC_MASTER zephyr_library_sources_ifdef(CONFIG_USE_RZ_FSP_GTM fsp/src/${SOC_SERIES_PREFIX}/r_gtm/r_gtm.c) + +zephyr_library_sources_ifdef(CONFIG_USE_RZ_FSP_EXT_IRQ + fsp/src/${SOC_SERIES_PREFIX}/r_intc_irq/r_intc_irq.c + fsp/src/${SOC_SERIES_PREFIX}/r_intc_nmi/r_intc_nmi.c) diff --git a/drivers/rz/fsp/inc/api/r_external_irq_api.h b/drivers/rz/fsp/inc/api/r_external_irq_api.h new file mode 100644 index 0000000..02eb1fc --- /dev/null +++ b/drivers/rz/fsp/inc/api/r_external_irq_api.h @@ -0,0 +1,170 @@ +/* +* Copyright (c) 2020 - 2024 Renesas Electronics Corporation and/or its affiliates +* +* SPDX-License-Identifier: BSD-3-Clause +*/ + +/*******************************************************************************************************************//** + * @ingroup RENESAS_INTERFACES + * @defgroup EXTERNAL_IRQ_API External IRQ Interface + * @brief Interface for detecting external interrupts. + * + * @section EXTERNAL_IRQ_API_Summary Summary + * The External IRQ Interface is for configuring interrupts to fire when a trigger condition is detected on an + * external IRQ pin. + * + * The External IRQ Interface can be implemented by: + * - @ref INTC_NMI + * - @ref INTC_IRQ + * + * @{ + **********************************************************************************************************************/ + +#ifndef R_EXTERNAL_IRQ_API_H +#define R_EXTERNAL_IRQ_API_H + +/*********************************************************************************************************************** + * Includes + **********************************************************************************************************************/ + +/* Includes board and MCU related header files. */ +#include "bsp_api.h" + +/* Common macro for FSP header files. There is also a corresponding FSP_FOOTER macro at the end of this file. */ +FSP_HEADER + +/********************************************************************************************************************** + * Macro definitions + *********************************************************************************************************************/ + +/********************************************************************************************************************* + * Typedef definitions + *********************************************************************************************************************/ + +/** Callback function parameter data */ +typedef struct st_external_irq_callback_args +{ + /** Placeholder for user data. Set in @ref external_irq_api_t::open function in @ref external_irq_cfg_t. */ + void const * p_context; + uint32_t channel; ///< The physical hardware channel that caused the interrupt. +} external_irq_callback_args_t; + +/** Condition that will trigger an interrupt when detected. */ +typedef enum e_external_irq_trigger +{ + EXTERNAL_IRQ_TRIG_FALLING = 0, ///< Falling edge trigger + EXTERNAL_IRQ_TRIG_RISING = 1, ///< Rising edge trigger + EXTERNAL_IRQ_TRIG_BOTH_EDGE = 2, ///< Both edges trigger + EXTERNAL_IRQ_TRIG_LEVEL_LOW = 3, ///< Low level trigger +} external_irq_trigger_t; + +/** External IRQ input pin digital filtering sample clock divisor settings. The digital filter rejects trigger + * conditions that are shorter than 3 periods of the filter clock. + */ +typedef enum e_external_irq_pclk_div +{ + EXTERNAL_IRQ_PCLK_DIV_BY_1 = 0, ///< Filter using PCLK divided by 1 + EXTERNAL_IRQ_PCLK_DIV_BY_8 = 1, ///< Filter using PCLK divided by 8 + EXTERNAL_IRQ_PCLK_DIV_BY_32 = 2, ///< Filter using PCLK divided by 32 + EXTERNAL_IRQ_PCLK_DIV_BY_64 = 3, ///< Filter using PCLK divided by 64 +} external_irq_pclk_div_t; + +/** User configuration structure, used in open function */ +typedef struct st_external_irq_cfg +{ + uint8_t channel; ///< Hardware channel used. + uint8_t ipl; ///< Interrupt priority + IRQn_Type irq; ///< NVIC interrupt number assigned to this instance + external_irq_trigger_t trigger; ///< Trigger setting. + external_irq_pclk_div_t pclk_div; ///< Digital filter clock divisor setting. + bool filter_enable; ///< Digital filter enable/disable setting. + + /** Callback provided external input trigger occurs. */ + void (* p_callback)(external_irq_callback_args_t * p_args); + + /** Placeholder for user data. Passed to the user callback in @ref external_irq_callback_args_t. */ + void const * p_context; + void const * p_extend; ///< External IRQ hardware dependent configuration. +} external_irq_cfg_t; + +/** External IRQ control block. Allocate an instance specific control block to pass into the external IRQ API calls. + * @par Implemented as + * - intc_nmi_instance_ctrl_t + * - intc_irq_instance_ctrl_t + */ +typedef void external_irq_ctrl_t; + +/** External interrupt driver structure. External interrupt functions implemented at the HAL layer will follow this API. */ +typedef struct st_external_irq_api +{ + /** Initial configuration. + * @par Implemented as + * - @ref R_INTC_NMI_ExternalIrqOpen() + * - @ref R_INTC_IRQ_ExternalIrqOpen() + * + * @param[out] p_ctrl Pointer to control block. Must be declared by user. Value set here. + * @param[in] p_cfg Pointer to configuration structure. All elements of the structure must be set by user. + */ + fsp_err_t (* open)(external_irq_ctrl_t * const p_ctrl, external_irq_cfg_t const * const p_cfg); + + /** Enable callback when an external trigger condition occurs. + * @par Implemented as + * - @ref R_INTC_NMI_ExternalIrqEnable() + * - @ref R_INTC_IRQ_ExternalIrqEnable() + * + * @param[in] p_ctrl Control block set in Open call for this external interrupt. + */ + fsp_err_t (* enable)(external_irq_ctrl_t * const p_ctrl); + + /** Disable callback when external trigger condition occurs. + * @par Implemented as + * - @ref R_INTC_NMI_ExternalIrqDisable() + * - @ref R_INTC_IRQ_ExternalIrqDisable() + * + * @param[in] p_ctrl Control block set in Open call for this external interrupt. + */ + fsp_err_t (* disable)(external_irq_ctrl_t * const p_ctrl); + + /** + * Specify callback function and optional context pointer and working memory pointer. + * @par Implemented as + * - R_INTC_NMI_ExternalIrqCallbackSet() + * - R_INTC_IRQ_ExternalIrqCallbackSet() + * + * @param[in] p_ctrl Pointer to the Extneral IRQ control block. + * @param[in] p_callback Callback function + * @param[in] p_context Pointer to send to callback function + * @param[in] p_working_memory Pointer to volatile memory where callback structure can be allocated. + * Callback arguments allocated here are only valid during the callback. + */ + fsp_err_t (* callbackSet)(external_irq_ctrl_t * const p_api_ctrl, + void ( * p_callback)(external_irq_callback_args_t *), + void const * const p_context, + external_irq_callback_args_t * const p_callback_memory); + + /** Allow driver to be reconfigured. May reduce power consumption. + * @par Implemented as + * - @ref R_INTC_NMI_ExternalIrqClose() + * - @ref R_INTC_IRQ_ExternalIrqClose() + * + * @param[in] p_ctrl Control block set in Open call for this external interrupt. + */ + fsp_err_t (* close)(external_irq_ctrl_t * const p_ctrl); +} external_irq_api_t; + +/** This structure encompasses everything that is needed to use an instance of this interface. */ +typedef struct st_external_irq_instance +{ + external_irq_ctrl_t * p_ctrl; ///< Pointer to the control structure for this instance + external_irq_cfg_t const * p_cfg; ///< Pointer to the configuration structure for this instance + external_irq_api_t const * p_api; ///< Pointer to the API structure for this instance +} external_irq_instance_t; + +/* Common macro for FSP header files. There is also a corresponding FSP_HEADER macro at the top of this file. */ +FSP_FOOTER + +/*******************************************************************************************************************//** + * @} (end defgroup EXTERNAL_IRQ_API) + **********************************************************************************************************************/ + +#endif diff --git a/drivers/rz/fsp/inc/instances/rzg/r_intc_irq.h b/drivers/rz/fsp/inc/instances/rzg/r_intc_irq.h new file mode 100644 index 0000000..dd65e6e --- /dev/null +++ b/drivers/rz/fsp/inc/instances/rzg/r_intc_irq.h @@ -0,0 +1,82 @@ +/* +* Copyright (c) 2020 - 2024 Renesas Electronics Corporation and/or its affiliates +* +* SPDX-License-Identifier: BSD-3-Clause +*/ + +/*******************************************************************************************************************//** + * @addtogroup INTC_IRQ + * @{ + **********************************************************************************************************************/ + +#ifndef R_INTC_IRQ_H +#define R_INTC_IRQ_H + +/*********************************************************************************************************************** + * Includes + **********************************************************************************************************************/ +#include "bsp_api.h" +#include "r_external_irq_api.h" + +/* Common macro for FSP header files. There is also a corresponding FSP_FOOTER macro at the end of this file. */ +FSP_HEADER + +/*********************************************************************************************************************** + * Macro definitions + **********************************************************************************************************************/ + +/********************************************************************************************************************* + * Typedef definitions + *********************************************************************************************************************/ + +/** INTC_IRQ private control block. DO NOT MODIFY. Initialization occurs when R_INTC_IRQ_ExternalIrqOpen is called. */ +typedef struct st_intc_irq_instance_ctrl +{ + uint32_t open; ///< Used to determine if channel control block is in use + IRQn_Type irq; ///< NVIC interrupt number + uint8_t channel; ///< Channel + +#if BSP_TZ_SECURE_BUILD + external_irq_callback_args_t * p_callback_memory; // Pointer to non-secure memory that can be used to pass arguments to a callback in non-secure memory. +#endif + void (* p_callback)(external_irq_callback_args_t * p_args); // Pointer to callback that is called when an edge is detected on the external irq pin. + + /** Placeholder for user data. Passed to the user callback in ::external_irq_callback_args_t. */ + void const * p_context; +} intc_irq_instance_ctrl_t; + +/********************************************************************************************************************** + * Exported global variables + **********************************************************************************************************************/ + +/** @cond INC_HEADER_DEFS_SEC */ +/** Filled in Interface API structure for this Instance. */ +extern const external_irq_api_t g_external_irq_on_intc_irq; + +/** @endcond */ + +/*********************************************************************************************************************** + * Public APIs + **********************************************************************************************************************/ +fsp_err_t R_INTC_IRQ_ExternalIrqOpen(external_irq_ctrl_t * const p_api_ctrl, external_irq_cfg_t const * const p_cfg); + +fsp_err_t R_INTC_IRQ_ExternalIrqEnable(external_irq_ctrl_t * const p_api_ctrl); + +fsp_err_t R_INTC_IRQ_ExternalIrqDisable(external_irq_ctrl_t * const p_api_ctrl); + +fsp_err_t R_INTC_IRQ_ExternalIrqCallbackSet(external_irq_ctrl_t * const p_api_ctrl, + void ( * p_callback)( + external_irq_callback_args_t *), + void const * const p_context, + external_irq_callback_args_t * const p_callback_memory); + +fsp_err_t R_INTC_IRQ_ExternalIrqClose(external_irq_ctrl_t * const p_api_ctrl); + +/*******************************************************************************************************************//** + * @} (end defgroup INTC_IRQ) + **********************************************************************************************************************/ + +/* Common macro for FSP header files. There is also a corresponding FSP_HEADER macro at the top of this file. */ +FSP_FOOTER + +#endif // R_INTC_IRQ_H diff --git a/drivers/rz/fsp/inc/instances/rzg/r_intc_nmi.h b/drivers/rz/fsp/inc/instances/rzg/r_intc_nmi.h new file mode 100644 index 0000000..1407e69 --- /dev/null +++ b/drivers/rz/fsp/inc/instances/rzg/r_intc_nmi.h @@ -0,0 +1,82 @@ +/* +* Copyright (c) 2020 - 2024 Renesas Electronics Corporation and/or its affiliates +* +* SPDX-License-Identifier: BSD-3-Clause +*/ + +/*******************************************************************************************************************//** + * @addtogroup INTC_NMI + * @{ + **********************************************************************************************************************/ + +#ifndef R_INTC_NMI_H +#define R_INTC_NMI_H + +/*********************************************************************************************************************** + * Includes + **********************************************************************************************************************/ +#include "bsp_api.h" +#include "r_external_irq_api.h" + +/* Common macro for FSP header files. There is also a corresponding FSP_FOOTER macro at the end of this file. */ +FSP_HEADER + +/*********************************************************************************************************************** + * Macro definitions + **********************************************************************************************************************/ + +/********************************************************************************************************************* + * Typedef definitions + *********************************************************************************************************************/ + +/** INTC_NMI private control block. DO NOT MODIFY. Initialization occurs when R_INTC_NMI_ExternalIrqOpen is called. */ +typedef struct st_intc_nmi_instance_ctrl +{ + uint32_t open; ///< Used to determine if channel control block is in use + IRQn_Type irq; ///< NVIC Interrupt number + uint8_t channel; ///< Channel + +#if BSP_TZ_SECURE_BUILD + external_irq_callback_args_t * p_callback_memory; // Pointer to non-secure memory that can be used to pass arguments to a callback in non-secure memory. +#endif + void (* p_callback)(external_irq_callback_args_t * p_args); // Pointer to callback that is called when an edge is detected on the external irq pin. + + /** Placeholder for user data. Passed to the user callback in ::external_irq_callback_args_t. */ + void const * p_context; +} intc_nmi_instance_ctrl_t; + +/********************************************************************************************************************** + * Exported global variables + **********************************************************************************************************************/ + +/** @cond INC_HEADER_DEFS_SEC */ +/** Filled in Interface API structure for this Instance. */ +extern const external_irq_api_t g_external_irq_on_intc_nmi; + +/** @endcond */ + +/*********************************************************************************************************************** + * Public APIs + **********************************************************************************************************************/ +fsp_err_t R_INTC_NMI_ExternalIrqOpen(external_irq_ctrl_t * const p_api_ctrl, external_irq_cfg_t const * const p_cfg); + +fsp_err_t R_INTC_NMI_ExternalIrqEnable(external_irq_ctrl_t * const p_api_ctrl); + +fsp_err_t R_INTC_NMI_ExternalIrqDisable(external_irq_ctrl_t * const p_api_ctrl); + +fsp_err_t R_INTC_NMI_ExternalIrqCallbackSet(external_irq_ctrl_t * const p_api_ctrl, + void ( * p_callback)( + external_irq_callback_args_t *), + void const * const p_context, + external_irq_callback_args_t * const p_callback_memory); + +fsp_err_t R_INTC_NMI_ExternalIrqClose(external_irq_ctrl_t * const p_api_ctrl); + +/*******************************************************************************************************************//** + * @} (end defgroup INTC_NMI) + **********************************************************************************************************************/ + +/* Common macro for FSP header files. There is also a corresponding FSP_HEADER macro at the top of this file. */ +FSP_FOOTER + +#endif // R_INTC_NMI_H diff --git a/drivers/rz/fsp/src/rzg/r_intc_irq/r_intc_irq.c b/drivers/rz/fsp/src/rzg/r_intc_irq/r_intc_irq.c new file mode 100644 index 0000000..f3d6ae8 --- /dev/null +++ b/drivers/rz/fsp/src/rzg/r_intc_irq/r_intc_irq.c @@ -0,0 +1,381 @@ +/* +* Copyright (c) 2020 - 2024 Renesas Electronics Corporation and/or its affiliates +* +* SPDX-License-Identifier: BSD-3-Clause +*/ + +/*********************************************************************************************************************** + * Includes + **********************************************************************************************************************/ +#include "r_intc_irq.h" +#include "r_intc_irq_cfg.h" + +/*********************************************************************************************************************** + * Macro definitions + **********************************************************************************************************************/ + +/** "IRQ" in ASCII, used to determine if channel is open. */ +#define INTC_IRQ_OPEN (0x0000495251U) + +#define INTC_IRQ_TRIG_LEVEL_LOW (0U) +#define INTC_IRQ_TRIG_FALLING (1U) +#define INTC_IRQ_TRIG_RISING (2U) +#define INTC_IRQ_TRIG_BOTH_EDGE (3U) + +#define INTC_IRQ_IITSR_IITSEL_MASK (3U) +#define INTC_IRQ_IITSR_IITSEL_WIDTH (2U) + +#define INTC_IRQ_ISCR_ISTAT_MASK (1U) + +/*********************************************************************************************************************** + * Typedef definitions + **********************************************************************************************************************/ + +#if defined(__ARMCC_VERSION) || defined(__ICCARM__) +typedef void (BSP_CMSE_NONSECURE_CALL * intc_irq_prv_ns_callback)(external_irq_callback_args_t * p_args); +#elif defined(__GNUC__) +typedef BSP_CMSE_NONSECURE_CALL void (*volatile intc_irq_prv_ns_callback)(external_irq_callback_args_t * p_args); +#endif + +/*********************************************************************************************************************** + * Private function prototypes + **********************************************************************************************************************/ +void r_intc_irq_isr(void); + +/*********************************************************************************************************************** + * Private global variables + **********************************************************************************************************************/ + +/*********************************************************************************************************************** + * Global Variables + **********************************************************************************************************************/ + +/* INTC_IRQ implementation of External IRQ API. */ +const external_irq_api_t g_external_irq_on_intc_irq = +{ + .open = R_INTC_IRQ_ExternalIrqOpen, + .enable = R_INTC_IRQ_ExternalIrqEnable, + .disable = R_INTC_IRQ_ExternalIrqDisable, + .callbackSet = R_INTC_IRQ_ExternalIrqCallbackSet, + .close = R_INTC_IRQ_ExternalIrqClose, +}; + +/*******************************************************************************************************************//** + * @addtogroup INTC_IRQ + * @{ + **********************************************************************************************************************/ + +/*********************************************************************************************************************** + * Functions + **********************************************************************************************************************/ + +/*******************************************************************************************************************//** + * Configure an IRQ input pin for use with the external interrupt interface. Implements @ref external_irq_api_t::open. + * + * The Open function is responsible for preparing an external IRQ pin for operation. + * + * @retval FSP_SUCCESS Open successful. + * @retval FSP_ERR_ASSERTION One of the following is invalid: + * - p_ctrl or p_cfg is NULL + * @retval FSP_ERR_ALREADY_OPEN The channel specified has already been opened. No configurations were changed. + * Call the associated Close function to reconfigure the channel. + * @retval FSP_ERR_IP_CHANNEL_NOT_PRESENT The channel requested in p_cfg is not available on the device selected in + * r_bsp_cfg.h. + * @note This function is reentrant for different channels. It is not reentrant for the same channel. + **********************************************************************************************************************/ +fsp_err_t R_INTC_IRQ_ExternalIrqOpen (external_irq_ctrl_t * const p_api_ctrl, external_irq_cfg_t const * const p_cfg) +{ + intc_irq_instance_ctrl_t * p_ctrl = (intc_irq_instance_ctrl_t *) p_api_ctrl; + +#if INTC_IRQ_CFG_PARAM_CHECKING_ENABLE + FSP_ASSERT(NULL != p_ctrl); + FSP_ERROR_RETURN(INTC_IRQ_OPEN != p_ctrl->open, FSP_ERR_ALREADY_OPEN); + FSP_ASSERT(NULL != p_cfg); + FSP_ERROR_RETURN(0 != ((1U << p_cfg->channel) & BSP_FEATURE_INTC_IRQ_VALID_CHANNEL_MASK), FSP_ERR_IP_CHANNEL_NOT_PRESENT); +#endif + + p_ctrl->irq = p_cfg->irq; + +#if BSP_TZ_SECURE_BUILD + + /* If this is a secure build, the callback provided in p_cfg must be secure. */ + p_ctrl->p_callback_memory = NULL; +#endif + + /* Initialize control block. */ + p_ctrl->p_callback = p_cfg->p_callback; + p_ctrl->p_context = p_cfg->p_context; + p_ctrl->channel = p_cfg->channel; + + uint32_t trigger = 0; + /* Convert the trigger. */ + if (EXTERNAL_IRQ_TRIG_LEVEL_LOW == p_cfg->trigger) + { + trigger = INTC_IRQ_TRIG_LEVEL_LOW; + } + else if (EXTERNAL_IRQ_TRIG_FALLING == p_cfg->trigger) + { + trigger = INTC_IRQ_TRIG_FALLING; + } + else if (EXTERNAL_IRQ_TRIG_RISING == p_cfg->trigger) + { + trigger = INTC_IRQ_TRIG_RISING; + } + else if (EXTERNAL_IRQ_TRIG_BOTH_EDGE == p_cfg->trigger) + { + trigger = INTC_IRQ_TRIG_BOTH_EDGE; + } + else + { + /* Do nothing. */ + } + + /* Set the trigger. */ + uint32_t iitsr = R_INTC_IM33->IITSR; + iitsr &= ~(INTC_IRQ_IITSR_IITSEL_MASK << (p_ctrl->channel * INTC_IRQ_IITSR_IITSEL_WIDTH)); + iitsr |= (trigger << (p_ctrl->channel * INTC_IRQ_IITSR_IITSEL_WIDTH)); + R_INTC_IM33->IITSR = iitsr; + + if (INTC_IRQ_TRIG_LEVEL_LOW == trigger) + { + /* Do nothing. */ + } + else + { + /* Dummy read the ISCR before clearing the ISTAT bit. */ + volatile uint32_t iscr = R_INTC_IM33->ISCR; + FSP_PARAMETER_NOT_USED(iscr); + + /* Clear the ISTAT bit after changing the trigger setting to the edge type. + * Reference section "Precaution when Changing Interrupt Settings" of the user's manual. */ + R_INTC_IM33->ISCR = ~(INTC_IRQ_ISCR_ISTAT_MASK << p_ctrl->channel); + + /* Dummy read the ISCR to prevent the interrupt cause that have been cleared from being accidentally accepted. + * Reference section "Clear Timing of Interrupt Cause" of the user's manual. */ + iscr = R_INTC_IM33->ISCR; + FSP_PARAMETER_NOT_USED(iscr); + } + + if (p_ctrl->irq >= 0) + { + R_BSP_IrqCfg(p_ctrl->irq, p_cfg->ipl, p_ctrl); + } + + /* Mark the control block as open. */ + p_ctrl->open = INTC_IRQ_OPEN; + + return FSP_SUCCESS; +} + +/*******************************************************************************************************************//** + * Enable external interrupt for specified channel at NVIC. Implements @ref external_irq_api_t::enable. + * + * @retval FSP_SUCCESS Interrupt Enabled successfully. + * @retval FSP_ERR_ASSERTION The p_ctrl parameter was null. + * @retval FSP_ERR_NOT_OPEN The channel is not opened. + * @retval FSP_ERR_IRQ_BSP_DISABLED Requested IRQ is not defined in this system. + **********************************************************************************************************************/ +fsp_err_t R_INTC_IRQ_ExternalIrqEnable (external_irq_ctrl_t * const p_api_ctrl) +{ + intc_irq_instance_ctrl_t * p_ctrl = (intc_irq_instance_ctrl_t *) p_api_ctrl; + +#if INTC_IRQ_CFG_PARAM_CHECKING_ENABLE + FSP_ASSERT(NULL != p_ctrl); + FSP_ERROR_RETURN(INTC_IRQ_OPEN == p_ctrl->open, FSP_ERR_NOT_OPEN); + FSP_ERROR_RETURN(p_ctrl->irq >= 0, FSP_ERR_IRQ_BSP_DISABLED); +#endif + + /* Clear the interrupt status and Pending bits, before the interrupt is enabled. */ + R_BSP_IrqEnable(p_ctrl->irq); + + return FSP_SUCCESS; +} + +/*******************************************************************************************************************//** + * Disable external interrupt for specified channel at NVIC. Implements @ref external_irq_api_t::disable. + * + * @retval FSP_SUCCESS Interrupt disabled successfully. + * @retval FSP_ERR_ASSERTION The p_ctrl parameter was null. + * @retval FSP_ERR_NOT_OPEN The channel is not opened. + * @retval FSP_ERR_IRQ_BSP_DISABLED Requested IRQ is not defined in this system. + **********************************************************************************************************************/ +fsp_err_t R_INTC_IRQ_ExternalIrqDisable (external_irq_ctrl_t * const p_api_ctrl) +{ + intc_irq_instance_ctrl_t * p_ctrl = (intc_irq_instance_ctrl_t *) p_api_ctrl; + +#if INTC_IRQ_CFG_PARAM_CHECKING_ENABLE + FSP_ASSERT(NULL != p_ctrl); + FSP_ERROR_RETURN(INTC_IRQ_OPEN == p_ctrl->open, FSP_ERR_NOT_OPEN); + FSP_ERROR_RETURN(p_ctrl->irq >= 0, FSP_ERR_IRQ_BSP_DISABLED); +#endif + + /* Disable the interrupt, and then clear the interrupt pending bits and interrupt status. */ + R_BSP_IrqDisable(p_ctrl->irq); + + return FSP_SUCCESS; +} + +/*******************************************************************************************************************//** + * Updates the user callback and has option of providing memory for callback structure. + * Implements external_irq_api_t::callbackSet. + * + * @retval FSP_SUCCESS Callback updated successfully. + * @retval FSP_ERR_ASSERTION A required pointer is NULL. + * @retval FSP_ERR_NOT_OPEN The control block has not been opened. + * @retval FSP_ERR_NO_CALLBACK_MEMORY p_callback is non-secure and p_callback_memory is either secure or NULL. + **********************************************************************************************************************/ +fsp_err_t R_INTC_IRQ_ExternalIrqCallbackSet (external_irq_ctrl_t * const p_api_ctrl, + void ( * p_callback)( + external_irq_callback_args_t *), + void const * const p_context, + external_irq_callback_args_t * const p_callback_memory) +{ + intc_irq_instance_ctrl_t * p_ctrl = p_api_ctrl; + +#if BSP_TZ_SECURE_BUILD + + /* cmse_check_address_range returns NULL if p_callback is located in secure memory. */ + bool callback_is_secure = + (NULL == cmse_check_address_range((void *) p_callback, sizeof(void *), CMSE_AU_NONSECURE)); +#else + FSP_PARAMETER_NOT_USED(p_callback_memory); +#endif + +#if INTC_IRQ_CFG_PARAM_CHECKING_ENABLE + FSP_ASSERT(NULL != p_ctrl); + FSP_ERROR_RETURN(INTC_IRQ_OPEN == p_ctrl->open, FSP_ERR_NOT_OPEN); + FSP_ASSERT(NULL != p_callback); + + #if BSP_TZ_SECURE_BUILD + + /* In secure projects, p_callback_memory must be provided in non-secure space if p_callback is non-secure. */ + external_irq_callback_args_t * const p_callback_memory_checked = cmse_check_pointed_object(p_callback_memory, + CMSE_AU_NONSECURE); + FSP_ERROR_RETURN(callback_is_secure || (NULL != p_callback_memory_checked), FSP_ERR_NO_CALLBACK_MEMORY); + #endif +#endif + +#if BSP_TZ_SECURE_BUILD + p_ctrl->p_callback_memory = p_callback_memory; + p_ctrl->p_callback = callback_is_secure ? p_callback : + (void (*)(external_irq_callback_args_t *))cmse_nsfptr_create(p_callback); +#else + p_ctrl->p_callback = p_callback; +#endif + p_ctrl->p_context = p_context; + + return FSP_SUCCESS; +} + +/*******************************************************************************************************************//** + * Close the external interrupt channel. Implements @ref external_irq_api_t::close. + * + * @retval FSP_SUCCESS Successfully closed. + * @retval FSP_ERR_ASSERTION The parameter p_ctrl is NULL. + * @retval FSP_ERR_NOT_OPEN The channel is not opened. + **********************************************************************************************************************/ +fsp_err_t R_INTC_IRQ_ExternalIrqClose (external_irq_ctrl_t * const p_api_ctrl) +{ + intc_irq_instance_ctrl_t * p_ctrl = (intc_irq_instance_ctrl_t *) p_api_ctrl; + +#if INTC_IRQ_CFG_PARAM_CHECKING_ENABLE + FSP_ASSERT(NULL != p_ctrl); + FSP_ERROR_RETURN(INTC_IRQ_OPEN == p_ctrl->open, FSP_ERR_NOT_OPEN); +#endif + + /* Cleanup. Disable interrupt. */ + if (p_ctrl->irq >= 0) + { + /* Disable the interrupt, and then clear the interrupt pending bits and interrupt status. */ + R_BSP_IrqDisable(p_ctrl->irq); + R_FSP_IsrContextSet(p_ctrl->irq, NULL); + } + + p_ctrl->open = 0U; + + return FSP_SUCCESS; +} + +/*******************************************************************************************************************//** + * @} (end addtogroup INTC_IRQ) + **********************************************************************************************************************/ + +/*******************************************************************************************************************//** + * INTC_IRQ External Interrupt ISR. + **********************************************************************************************************************/ +void r_intc_irq_isr (void) +{ + /* Save context if RTOS is used. */ + FSP_CONTEXT_SAVE + + IRQn_Type irq = R_FSP_CurrentIrqGet(); + intc_irq_instance_ctrl_t * p_ctrl = (intc_irq_instance_ctrl_t *) R_FSP_IsrContextGet(irq); + + /* Retrieve the trigger setting. */ + uint32_t iitsr = R_INTC_IM33->IITSR; + iitsr &= (INTC_IRQ_IITSR_IITSEL_MASK << (p_ctrl->channel * INTC_IRQ_IITSR_IITSEL_WIDTH)); + iitsr >>= (p_ctrl->channel * INTC_IRQ_IITSR_IITSEL_WIDTH); + + if (INTC_IRQ_TRIG_LEVEL_LOW == iitsr) + { + /* Do nothing. */ + } + else + { + /* Dummy read the ISCR before clearing the ISTAT bit. */ + volatile uint32_t iscr = R_INTC_IM33->ISCR; + FSP_PARAMETER_NOT_USED(iscr); + + /* Clear the ISTAT bit before calling the user callback so that if an edge is detected while the ISR is active + * it will not be missed. */ + R_INTC_IM33->ISCR = ~(INTC_IRQ_ISCR_ISTAT_MASK << p_ctrl->channel); + + /* Dummy read the ISCR to prevent the interrupt cause that should have been cleared from being accidentally + * accepted again. Reference section "Clear Timing of Interrupt Cause" of the user's manual. */ + iscr = R_INTC_IM33->ISCR; + FSP_PARAMETER_NOT_USED(iscr); + } + + if ((NULL != p_ctrl) && (NULL != p_ctrl->p_callback)) + { +#if BSP_TZ_SECURE_BUILD + + /* p_callback can point to a secure function or a non-secure function. */ + external_irq_callback_args_t args; + if (!cmse_is_nsfptr(p_ctrl->p_callback)) + { + /* If p_callback is secure, then the project does not need to change security state. */ + args.channel = p_ctrl->channel; + args.p_context = p_ctrl->p_context; + p_ctrl->p_callback(&args); + } + else + { + /* Save current state of p_callback_args so that it can be shared between interrupts. */ + args = *p_ctrl->p_callback_memory; + + /* Set the callback args passed to the Non-secure callback. */ + p_ctrl->p_callback_memory->channel = p_ctrl->channel; + p_ctrl->p_callback_memory->p_context = p_ctrl->p_context; + + /* If p_callback is Non-secure, then the project must change to Non-secure state in order to call the callback. */ + intc_irq_prv_ns_callback p_callback = (intc_irq_prv_ns_callback) (p_ctrl->p_callback); + p_callback(p_ctrl->p_callback_memory); + + /* Restore the state of p_callback_args. */ + *p_ctrl->p_callback_memory = args; + } + +#else + + /* Set data to identify callback to user, then call user callback. */ + external_irq_callback_args_t args; + args.channel = p_ctrl->channel; + args.p_context = p_ctrl->p_context; + p_ctrl->p_callback(&args); +#endif + } + + /* Restore context if RTOS is used. */ + FSP_CONTEXT_RESTORE +} diff --git a/drivers/rz/fsp/src/rzg/r_intc_nmi/r_intc_nmi.c b/drivers/rz/fsp/src/rzg/r_intc_nmi/r_intc_nmi.c new file mode 100644 index 0000000..7c07588 --- /dev/null +++ b/drivers/rz/fsp/src/rzg/r_intc_nmi/r_intc_nmi.c @@ -0,0 +1,327 @@ +/* +* Copyright (c) 2020 - 2024 Renesas Electronics Corporation and/or its affiliates +* +* SPDX-License-Identifier: BSD-3-Clause +*/ + +/*********************************************************************************************************************** + * Includes + **********************************************************************************************************************/ +#include "r_intc_nmi.h" +#include "r_intc_nmi_cfg.h" + +/*********************************************************************************************************************** + * Macro definitions + **********************************************************************************************************************/ + +/** "NMI" in ASCII, used to determine if channel is open. */ +#define INTC_NMI_OPEN (0x00004e4d49U) + +/*********************************************************************************************************************** + * Typedef definitions + **********************************************************************************************************************/ + +#if defined(__ARMCC_VERSION) || defined(__ICCARM__) +typedef void (BSP_CMSE_NONSECURE_CALL * intc_nmi_prv_ns_callback)(external_irq_callback_args_t * p_args); +#elif defined(__GNUC__) +typedef BSP_CMSE_NONSECURE_CALL void (*volatile intc_nmi_prv_ns_callback)(external_irq_callback_args_t * p_args); +#endif + +/*********************************************************************************************************************** + * Private function prototypes + **********************************************************************************************************************/ +void r_intc_nmi_isr(void); + +/*********************************************************************************************************************** + * Private global variables + **********************************************************************************************************************/ + +/*********************************************************************************************************************** + * Global Variables + **********************************************************************************************************************/ + +/* INTC_NMI implementation of External IRQ API. */ +const external_irq_api_t g_external_irq_on_intc_nmi = +{ + .open = R_INTC_NMI_ExternalIrqOpen, + .enable = R_INTC_NMI_ExternalIrqEnable, + .disable = R_INTC_NMI_ExternalIrqDisable, + .callbackSet = R_INTC_NMI_ExternalIrqCallbackSet, + .close = R_INTC_NMI_ExternalIrqClose, +}; + +/*******************************************************************************************************************//** + * @addtogroup INTC_NMI + * @{ + **********************************************************************************************************************/ + +/*********************************************************************************************************************** + * Functions + **********************************************************************************************************************/ + +/*******************************************************************************************************************//** + * Configure a NMI pin for use with the external interrupt interface. Implements @ref external_irq_api_t::open. + * + * The Open function is responsible for preparing a NMI pin for operation. + * + * @retval FSP_SUCCESS Open successful. + * @retval FSP_ERR_ASSERTION One of the following is invalid: + * - p_ctrl or p_cfg is NULL. + * @retval FSP_ERR_ALREADY_OPEN The channel specified has already been opened. No configurations were changed. + * Call the associated Close function to reconfigure the channel. + * @retval FSP_ERR_INVALID_ARGUMENT p_cfg->trigger is invalid. + * + * @note This function is reentrant for different channels. It is not reentrant for the same channel. + **********************************************************************************************************************/ +fsp_err_t R_INTC_NMI_ExternalIrqOpen (external_irq_ctrl_t * const p_api_ctrl, external_irq_cfg_t const * const p_cfg) +{ + intc_nmi_instance_ctrl_t * p_ctrl = (intc_nmi_instance_ctrl_t *) p_api_ctrl; + +#if INTC_NMI_CFG_PARAM_CHECKING_ENABLE + FSP_ASSERT(NULL != p_ctrl); + FSP_ERROR_RETURN(INTC_NMI_OPEN != p_ctrl->open, FSP_ERR_ALREADY_OPEN); + FSP_ASSERT(NULL != p_cfg); + FSP_ERROR_RETURN(EXTERNAL_IRQ_TRIG_BOTH_EDGE != p_cfg->trigger, FSP_ERR_INVALID_ARGUMENT); + FSP_ERROR_RETURN(EXTERNAL_IRQ_TRIG_LEVEL_LOW != p_cfg->trigger, FSP_ERR_INVALID_ARGUMENT); +#endif + + p_ctrl->irq = p_cfg->irq; + +#if BSP_TZ_SECURE_BUILD + + /* If this is a secure build, the callback provided in p_cfg must be secure. */ + p_ctrl->p_callback_memory = NULL; +#endif + + /* Initialize control block. */ + p_ctrl->p_callback = p_cfg->p_callback; + p_ctrl->p_context = p_cfg->p_context; + p_ctrl->channel = p_cfg->channel; + + /* Set the trigger. */ + R_INTC_IM33->NITSR_b.NTSEL = p_cfg->trigger; + + /* Dummy read the NSCR before clearing the NSTAT bit. */ + volatile uint32_t nscr = R_INTC_IM33->NSCR; + FSP_PARAMETER_NOT_USED(nscr); + + /* Clear the NSTAT bit after changing the trigger setting to the edge type. + * Reference section "Precaution when Changing Interrupt Settings" of the user's manual. */ + R_INTC_IM33->NSCR_b.NSTAT = 0; + + /* Dummy read the NSCR to prevent the interrupt cause that have been cleared from being accidentally accepted. + * Reference section "Clear Timing of Interrupt Cause" of the user's manual. */ + nscr = R_INTC_IM33->NSCR; + FSP_PARAMETER_NOT_USED(nscr); + + if (p_ctrl->irq >= 0) + { + R_BSP_IrqCfg(p_ctrl->irq, p_cfg->ipl, p_ctrl); + } + + /* Mark the control block as open. */ + p_ctrl->open = INTC_NMI_OPEN; + + return FSP_SUCCESS; +} + +/*******************************************************************************************************************//** + * Enable external interrupt for specified channel at NVIC. Implements @ref external_irq_api_t::enable. + * + * @retval FSP_SUCCESS Interrupt Enabled successfully. + * @retval FSP_ERR_ASSERTION The p_ctrl parameter was null. + * @retval FSP_ERR_NOT_OPEN The channel is not opened. + * @retval FSP_ERR_IRQ_BSP_DISABLED Requested IRQ is not defined in this system. + **********************************************************************************************************************/ +fsp_err_t R_INTC_NMI_ExternalIrqEnable (external_irq_ctrl_t * const p_api_ctrl) +{ + intc_nmi_instance_ctrl_t * p_ctrl = (intc_nmi_instance_ctrl_t *) p_api_ctrl; + +#if INTC_NMI_CFG_PARAM_CHECKING_ENABLE + FSP_ASSERT(NULL != p_ctrl); + FSP_ERROR_RETURN(INTC_NMI_OPEN == p_ctrl->open, FSP_ERR_NOT_OPEN); + FSP_ERROR_RETURN(p_ctrl->irq >= 0, FSP_ERR_IRQ_BSP_DISABLED); +#endif + + /* Clear the interrupt status and Pending bits, before the interrupt is enabled. */ + R_BSP_IrqEnable(p_ctrl->irq); + + return FSP_SUCCESS; +} + +/*******************************************************************************************************************//** + * Disable external interrupt for specified channel at NVIC. Implements @ref external_irq_api_t::disable. + * + * @retval FSP_SUCCESS Interrupt disabled successfully. + * @retval FSP_ERR_ASSERTION The p_ctrl parameter was null. + * @retval FSP_ERR_NOT_OPEN The channel is not opened. + * @retval FSP_ERR_IRQ_BSP_DISABLED Requested IRQ is not defined in this system. + **********************************************************************************************************************/ +fsp_err_t R_INTC_NMI_ExternalIrqDisable (external_irq_ctrl_t * const p_api_ctrl) +{ + intc_nmi_instance_ctrl_t * p_ctrl = (intc_nmi_instance_ctrl_t *) p_api_ctrl; + +#if INTC_NMI_CFG_PARAM_CHECKING_ENABLE + FSP_ASSERT(NULL != p_ctrl); + FSP_ERROR_RETURN(INTC_NMI_OPEN == p_ctrl->open, FSP_ERR_NOT_OPEN); + FSP_ERROR_RETURN(p_ctrl->irq >= 0, FSP_ERR_IRQ_BSP_DISABLED); +#endif + + /* Disable the interrupt, and then clear the interrupt pending bits and interrupt status. */ + R_BSP_IrqDisable(p_ctrl->irq); + + return FSP_SUCCESS; +} + +/*******************************************************************************************************************//** + * Updates the user callback and has option of providing memory for callback structure. + * Implements external_irq_api_t::callbackSet. + * + * @retval FSP_SUCCESS Callback updated successfully. + * @retval FSP_ERR_ASSERTION A required pointer is NULL. + * @retval FSP_ERR_NOT_OPEN The control block has not been opened. + * @retval FSP_ERR_NO_CALLBACK_MEMORY p_callback is non-secure and p_callback_memory is either secure or NULL. + **********************************************************************************************************************/ +fsp_err_t R_INTC_NMI_ExternalIrqCallbackSet (external_irq_ctrl_t * const p_api_ctrl, + void ( * p_callback)( + external_irq_callback_args_t *), + void const * const p_context, + external_irq_callback_args_t * const p_callback_memory) +{ + intc_nmi_instance_ctrl_t * p_ctrl = p_api_ctrl; + +#if BSP_TZ_SECURE_BUILD + + /* cmse_check_address_range returns NULL if p_callback is located in secure memory. */ + bool callback_is_secure = + (NULL == cmse_check_address_range((void *) p_callback, sizeof(void *), CMSE_AU_NONSECURE)); +#else + FSP_PARAMETER_NOT_USED(p_callback_memory); +#endif + +#if INTC_NMI_CFG_PARAM_CHECKING_ENABLE + FSP_ASSERT(NULL != p_ctrl); + FSP_ERROR_RETURN(INTC_NMI_OPEN == p_ctrl->open, FSP_ERR_NOT_OPEN); + FSP_ASSERT(NULL != p_callback); + + #if BSP_TZ_SECURE_BUILD + + /* In secure projects, p_callback_memory must be provided in non-secure space if p_callback is non-secure. */ + external_irq_callback_args_t * const p_callback_memory_checked = cmse_check_pointed_object(p_callback_memory, + CMSE_AU_NONSECURE); + FSP_ERROR_RETURN(callback_is_secure || (NULL != p_callback_memory_checked), FSP_ERR_NO_CALLBACK_MEMORY); + #endif +#endif + +#if BSP_TZ_SECURE_BUILD + p_ctrl->p_callback_memory = p_callback_memory; + p_ctrl->p_callback = callback_is_secure ? p_callback : + (void (*)(external_irq_callback_args_t *))cmse_nsfptr_create(p_callback); +#else + p_ctrl->p_callback = p_callback; +#endif + p_ctrl->p_context = p_context; + + return FSP_SUCCESS; +} + +/*******************************************************************************************************************//** + * Close the external interrupt channel. Implements @ref external_irq_api_t::close. + * + * @retval FSP_SUCCESS Successfully closed. + * @retval FSP_ERR_ASSERTION The parameter p_ctrl is NULL. + * @retval FSP_ERR_NOT_OPEN The channel is not opened. + **********************************************************************************************************************/ +fsp_err_t R_INTC_NMI_ExternalIrqClose (external_irq_ctrl_t * const p_api_ctrl) +{ + intc_nmi_instance_ctrl_t * p_ctrl = (intc_nmi_instance_ctrl_t *) p_api_ctrl; + +#if INTC_NMI_CFG_PARAM_CHECKING_ENABLE + FSP_ASSERT(NULL != p_ctrl); + FSP_ERROR_RETURN(INTC_NMI_OPEN == p_ctrl->open, FSP_ERR_NOT_OPEN); +#endif + + /* Cleanup. Disable interrupt. */ + if (p_ctrl->irq >= 0) + { + /* Disable the interrupt, and then clear the interrupt pending bits and interrupt status. */ + R_BSP_IrqDisable(p_ctrl->irq); + R_FSP_IsrContextSet(p_ctrl->irq, NULL); + } + + p_ctrl->open = 0U; + + return FSP_SUCCESS; +} + +/*******************************************************************************************************************//** + * @} (end addtogroup INTC_NMI) + **********************************************************************************************************************/ + +/*******************************************************************************************************************//** + * INTC_NMI External Interrupt ISR. + **********************************************************************************************************************/ +void r_intc_nmi_isr (void) +{ + /* Save context if RTOS is used. */ + FSP_CONTEXT_SAVE + + IRQn_Type irq = R_FSP_CurrentIrqGet(); + intc_nmi_instance_ctrl_t * p_ctrl = (intc_nmi_instance_ctrl_t *) R_FSP_IsrContextGet(irq); + + /* Dummy read the NSCR before clearing the NSTAT bit. */ + volatile uint32_t nscr = R_INTC_IM33->NSCR; + FSP_PARAMETER_NOT_USED(nscr); + + /* Clear the NSTAT bit before calling the user callback so that if an edge is detected while the ISR is active + * it will not be missed. */ + R_INTC_IM33->NSCR_b.NSTAT = 0; + + /* Dummy read the NSCR to prevent the interrupt cause that should have been cleared from being accidentally + * accepted again. Reference section "Clear Timing of Interrupt Cause" of the user's manual. */ + nscr = R_INTC_IM33->NSCR; + FSP_PARAMETER_NOT_USED(nscr); + + if ((NULL != p_ctrl) && (NULL != p_ctrl->p_callback)) + { +#if BSP_TZ_SECURE_BUILD + + /* p_callback can point to a secure function or a non-secure function. */ + external_irq_callback_args_t args; + if (!cmse_is_nsfptr(p_ctrl->p_callback)) + { + /* If p_callback is secure, then the project does not need to change security state. */ + args.channel = p_ctrl->channel; + args.p_context = p_ctrl->p_context; + p_ctrl->p_callback(&args); + } + else + { + /* Save current state of p_callback_args so that it can be shared between interrupts. */ + args = *p_ctrl->p_callback_memory; + + /* Set the callback args passed to the Non-secure callback. */ + p_ctrl->p_callback_memory->channel = p_ctrl->channel; + p_ctrl->p_callback_memory->p_context = p_ctrl->p_context; + + /* If p_callback is Non-secure, then the project must change to Non-secure state in order to call the callback. */ + intc_nmi_prv_ns_callback p_callback = (intc_nmi_prv_ns_callback) (p_ctrl->p_callback); + p_callback(p_ctrl->p_callback_memory); + + /* Restore the state of p_callback_args. */ + *p_ctrl->p_callback_memory = args; + } + +#else + + /* Set data to identify callback to user, then call user callback. */ + external_irq_callback_args_t args; + args.channel = p_ctrl->channel; + args.p_context = p_ctrl->p_context; + p_ctrl->p_callback(&args); +#endif + } + + /* Restore context if RTOS is used */ + FSP_CONTEXT_RESTORE +} diff --git a/zephyr/rz/rz_cfg/fsp_cfg/rzg/r_intc_irq_cfg.h b/zephyr/rz/rz_cfg/fsp_cfg/rzg/r_intc_irq_cfg.h new file mode 100644 index 0000000..06985e9 --- /dev/null +++ b/zephyr/rz/rz_cfg/fsp_cfg/rzg/r_intc_irq_cfg.h @@ -0,0 +1,17 @@ +/* +* Copyright (c) 2020 - 2024 Renesas Electronics Corporation and/or its affiliates +* +* SPDX-License-Identifier: BSD-3-Clause +*/ +#ifndef R_INTC_IRQ_CFG_H_ +#define R_INTC_IRQ_CFG_H_ +#ifdef __cplusplus +extern "C" { +#endif + +#define INTC_IRQ_CFG_PARAM_CHECKING_ENABLE (BSP_CFG_PARAM_CHECKING_ENABLE) + +#ifdef __cplusplus +} +#endif +#endif /* R_INTC_IRQ_CFG_H_ */ diff --git a/zephyr/rz/rz_cfg/fsp_cfg/rzg/r_intc_nmi_cfg.h b/zephyr/rz/rz_cfg/fsp_cfg/rzg/r_intc_nmi_cfg.h new file mode 100644 index 0000000..e5c541e --- /dev/null +++ b/zephyr/rz/rz_cfg/fsp_cfg/rzg/r_intc_nmi_cfg.h @@ -0,0 +1,17 @@ +/* +* Copyright (c) 2020 - 2024 Renesas Electronics Corporation and/or its affiliates +* +* SPDX-License-Identifier: BSD-3-Clause +*/ +#ifndef R_INTC_NMI_CFG_H_ +#define R_INTC_NMI_CFG_H_ +#ifdef __cplusplus +extern "C" { +#endif + +#define INTC_NMI_CFG_PARAM_CHECKING_ENABLE (BSP_CFG_PARAM_CHECKING_ENABLE) + +#ifdef __cplusplus +} +#endif +#endif /* R_INTC_NMI_CFG_H_ */