1 /*
2 * Copyright (c) 2020 - 2024 Renesas Electronics Corporation and/or its affiliates
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6 
7 /*******************************************************************************************************************//**
8  * @addtogroup INTC_NMI
9  * @{
10  **********************************************************************************************************************/
11 
12 #ifndef R_INTC_NMI_H
13 #define R_INTC_NMI_H
14 
15 /***********************************************************************************************************************
16  * Includes
17  **********************************************************************************************************************/
18 #include "bsp_api.h"
19 #include "r_external_irq_api.h"
20 
21 /* Common macro for FSP header files. There is also a corresponding FSP_FOOTER macro at the end of this file. */
22 FSP_HEADER
23 
24 /***********************************************************************************************************************
25  * Macro definitions
26  **********************************************************************************************************************/
27 
28 /*********************************************************************************************************************
29  * Typedef definitions
30  *********************************************************************************************************************/
31 
32 /** INTC_NMI private control block. DO NOT MODIFY. Initialization occurs when R_INTC_NMI_ExternalIrqOpen is called. */
33 typedef struct st_intc_nmi_instance_ctrl
34 {
35     uint32_t  open;                                             ///< Used to determine if channel control block is in use
36     IRQn_Type irq;                                              ///< NVIC Interrupt number
37     uint8_t   channel;                                          ///< Channel
38 
39 #if BSP_TZ_SECURE_BUILD
40     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.
41 #endif
42     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.
43 
44     /** Placeholder for user data.  Passed to the user callback in ::external_irq_callback_args_t. */
45     void const * p_context;
46 } intc_nmi_instance_ctrl_t;
47 
48 /**********************************************************************************************************************
49  * Exported global variables
50  **********************************************************************************************************************/
51 
52 /** @cond INC_HEADER_DEFS_SEC */
53 /** Filled in Interface API structure for this Instance. */
54 extern const external_irq_api_t g_external_irq_on_intc_nmi;
55 
56 /** @endcond */
57 
58 /***********************************************************************************************************************
59  * Public APIs
60  **********************************************************************************************************************/
61 fsp_err_t R_INTC_NMI_ExternalIrqOpen(external_irq_ctrl_t * const p_api_ctrl, external_irq_cfg_t const * const p_cfg);
62 
63 fsp_err_t R_INTC_NMI_ExternalIrqEnable(external_irq_ctrl_t * const p_api_ctrl);
64 
65 fsp_err_t R_INTC_NMI_ExternalIrqDisable(external_irq_ctrl_t * const p_api_ctrl);
66 
67 fsp_err_t R_INTC_NMI_ExternalIrqCallbackSet(external_irq_ctrl_t * const p_api_ctrl,
68                                             void (                    * p_callback)(
69                                                 external_irq_callback_args_t *),
70                                             void const * const                   p_context,
71                                             external_irq_callback_args_t * const p_callback_memory);
72 
73 fsp_err_t R_INTC_NMI_ExternalIrqClose(external_irq_ctrl_t * const p_api_ctrl);
74 
75 /*******************************************************************************************************************//**
76  * @} (end defgroup INTC_NMI)
77  **********************************************************************************************************************/
78 
79 /* Common macro for FSP header files. There is also a corresponding FSP_HEADER macro at the top of this file. */
80 FSP_FOOTER
81 
82 #endif                                 // R_INTC_NMI_H
83