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; ///< Interrupt number 37 uint8_t channel; ///< Channel 38 external_irq_callback_args_t * p_callback_memory; // Pointer to optional callback argument memory 39 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. 40 41 /** Placeholder for user data. Passed to the user callback in ::external_irq_callback_args_t. */ 42 void const * p_context; 43 } icu_instance_ctrl_t; 44 45 /********************************************************************************************************************** 46 * Exported global variables 47 **********************************************************************************************************************/ 48 49 /** @cond INC_HEADER_DEFS_SEC */ 50 /** Filled in Interface API structure for this Instance. */ 51 extern const external_irq_api_t g_external_irq_on_icu; 52 53 /** @endcond */ 54 55 /*********************************************************************************************************************** 56 * Public APIs 57 **********************************************************************************************************************/ 58 fsp_err_t R_ICU_ExternalIrqOpen(external_irq_ctrl_t * const p_ctrl, external_irq_cfg_t const * const p_cfg); 59 60 fsp_err_t R_ICU_ExternalIrqEnable(external_irq_ctrl_t * const p_ctrl); 61 62 fsp_err_t R_ICU_ExternalIrqDisable(external_irq_ctrl_t * const p_ctrl); 63 64 fsp_err_t R_ICU_ExternalIrqCallbackSet(external_irq_ctrl_t * const p_ctrl, 65 void ( * p_callback)(external_irq_callback_args_t *), 66 void const * const p_context, 67 external_irq_callback_args_t * const p_callback_memory); 68 69 fsp_err_t R_ICU_ExternalIrqClose(external_irq_ctrl_t * const p_ctrl); 70 71 /*******************************************************************************************************************//** 72 * @} (end defgroup ICU) 73 **********************************************************************************************************************/ 74 75 /* Common macro for FSP header files. There is also a corresponding FSP_HEADER macro at the top of this file. */ 76 FSP_FOOTER 77 78 #endif // R_ICU_H 79