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 ICU 9 * @{ 10 **********************************************************************************************************************/ 11 12 #ifndef R_ICU_H 13 #define R_ICU_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 /** ICU private control block. DO NOT MODIFY. Initialization occurs when R_ICU_ExternalIrqOpen is called. */ 33 typedef struct st_icu_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 } icu_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_icu; 55 56 /** @endcond */ 57 58 /*********************************************************************************************************************** 59 * Public APIs 60 **********************************************************************************************************************/ 61 fsp_err_t R_ICU_ExternalIrqOpen(external_irq_ctrl_t * const p_api_ctrl, external_irq_cfg_t const * const p_cfg); 62 63 fsp_err_t R_ICU_ExternalIrqEnable(external_irq_ctrl_t * const p_api_ctrl); 64 65 fsp_err_t R_ICU_ExternalIrqDisable(external_irq_ctrl_t * const p_api_ctrl); 66 67 fsp_err_t R_ICU_ExternalIrqCallbackSet(external_irq_ctrl_t * const p_api_ctrl, 68 void ( * p_callback)(external_irq_callback_args_t *), 69 void const * const p_context, 70 external_irq_callback_args_t * const p_callback_memory); 71 72 fsp_err_t R_ICU_ExternalIrqClose(external_irq_ctrl_t * const p_api_ctrl); 73 74 /*******************************************************************************************************************//** 75 * @} (end defgroup ICU) 76 **********************************************************************************************************************/ 77 78 /* Common macro for FSP header files. There is also a corresponding FSP_HEADER macro at the top of this file. */ 79 FSP_FOOTER 80 81 #endif // R_ICU_H 82