1 /* 2 * Copyright (c) 2021 Nuvoton Technology Corporation. 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #ifndef ZEPHYR_DRIVERS_GPIO_GPIO_NCT38XX_H_ 8 #define ZEPHYR_DRIVERS_GPIO_GPIO_NCT38XX_H_ 9 10 #include <zephyr/device.h> 11 #include <zephyr/drivers/gpio.h> 12 #include <zephyr/drivers/i2c.h> 13 #include <zephyr/kernel.h> 14 15 /* NCT38XX controller register */ 16 #define NCT38XX_REG_ALERT 0x10 17 #define NCT38XX_REG_ALERT_MASK 0x12 18 19 #define NCT38XX_REG_GPIO_DATA_IN(n) (0xC0 + ((n) * 8)) 20 #define NCT38XX_REG_GPIO_DATA_OUT(n) (0xC1 + ((n) * 8)) 21 #define NCT38XX_REG_GPIO_DIR(n) (0xC2 + ((n) * 8)) 22 #define NCT38XX_REG_GPIO_OD_SEL(n) (0xC3 + ((n) * 8)) 23 #define NCT38XX_REG_GPIO_ALERT_RISE(n) (0xC4 + ((n) * 8)) 24 #define NCT38XX_REG_GPIO_ALERT_FALL(n) (0xC5 + ((n) * 8)) 25 #define NCT38XX_REG_GPIO_ALERT_LEVEL(n) (0xC6 + ((n) * 8)) 26 #define NCT38XX_REG_GPIO_ALERT_MASK(n) (0xC7 + ((n) * 8)) 27 #define NCT38XX_REG_MUX_CONTROL 0xD0 28 #define NCT38XX_REG_GPIO_ALERT_STAT(n) (0xD4 + (n)) 29 30 /* NCT38XX controller register field */ 31 #define NCT38XX_REG_ALERT_VENDOR_DEFINDED_ALERT 15 32 #define NCT38XX_REG_ALERT_MASK_VENDOR_DEFINDED_ALERT 15 33 34 /** 35 * @brief Dispatch GPIO port ISR 36 * 37 * @param dev GPIO port device 38 * @return 0 if successful, otherwise failed. 39 */ 40 int gpio_nct38xx_dispatch_port_isr(const struct device *dev); 41 42 #endif /* ZEPHYR_DRIVERS_GPIO_GPIO_NCT38XX_H_*/ 43