1 /* 2 * Copyright 2022 NXP 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 /** 8 * @brief Driver for External interrupt/event controller in NXP S32 MCUs 9 * 10 */ 11 12 #ifndef ZEPHYR_DRIVERS_INTERRUPT_CONTROLLER_INTC_EIRQ_NXP_S32_H_ 13 #define ZEPHYR_DRIVERS_INTERRUPT_CONTROLLER_INTC_EIRQ_NXP_S32_H_ 14 15 #include <Siul2_Icu_Ip.h> 16 17 /* Wrapper callback for EIRQ line */ 18 typedef void (*eirq_nxp_s32_callback_t)(uint8_t pin, void *arg); 19 20 /** 21 * @brief Unset EIRQ callback for line 22 * 23 * @param dev EIRQ device 24 * @param line EIRQ line 25 */ 26 void eirq_nxp_s32_unset_callback(const struct device *dev, uint8_t line); 27 28 /** 29 * @brief Set EIRQ callback for line 30 * 31 * @param dev EIRQ device 32 * @param line EIRQ line 33 * @param cb Callback 34 * @param pin GPIO pin 35 * @param arg Callback data 36 * 37 * @retval 0 on SUCCESS 38 * @retval -EBUSY if callback for the line is already set 39 */ 40 int eirq_nxp_s32_set_callback(const struct device *dev, uint8_t line, 41 eirq_nxp_s32_callback_t cb, uint8_t pin, void *arg); 42 43 /** 44 * @brief Set edge event and enable interrupt for EIRQ line 45 * 46 * @param dev EIRQ device 47 * @param line EIRQ line 48 * @param edge_type Type of edge event 49 */ 50 void eirq_nxp_s32_enable_interrupt(const struct device *dev, uint8_t line, 51 Siul2_Icu_Ip_EdgeType edge_type); 52 53 /** 54 * @brief Disable interrupt for EIRQ line 55 * 56 * @param dev EIRQ device 57 * @param line EIRQ line 58 */ 59 void eirq_nxp_s32_disable_interrupt(const struct device *dev, uint8_t line); 60 61 /** 62 * @brief Get pending interrupt for EIRQ device 63 * 64 * @param dev EIRQ device 65 * @return A mask contains pending flags 66 */ 67 uint32_t eirq_nxp_s32_get_pending(const struct device *dev); 68 69 #endif /* ZEPHYR_DRIVERS_INTERRUPT_CONTROLLER_INTC_EIRQ_NXP_S32_H_ */ 70