1 /*
2  * Copyright (c) 2016, Freescale Semiconductor, Inc.
3  * Copyright 2016-2017 NXP
4  * All rights reserved.
5  *
6  * SPDX-License-Identifier: BSD-3-Clause
7  */
8 
9 #ifndef __DRIVER_GPIO_H
10 #define __DRIVER_GPIO_H
11 
12 #include "Driver_Common.h"
13 
14 #define GPIO_API_VERSION ARM_DRIVER_VERSION_MAJOR_MINOR(2, 0) /* API version */
15 
16 /**
17  * @file Driver_GPIO.h
18 * @brief  The Driver_GPIO.h file contains the definitions for GPIO Driver direction.
19 */
20 
21 typedef enum gpio_direction_en
22 {
23     GPIO_DIRECTION_IN = 0U,  /*!< IN. */
24     GPIO_DIRECTION_OUT = 1U, /*!< OUT. */
25 } gpio_direction_t;
26 
27 /**
28 \brief GPIO Driver direction.
29 */
30 typedef void *pinID_t;
31 
32 typedef ARM_DRIVER_VERSION GENERIC_DRIVER_VERSION;
33 
34 typedef void (*gpio_isr_handler_t)(void *apUserData);
35 /**
36 \brief Access structure of the GPIO Driver.
37 */
38 typedef struct GENERIC_DRIVER_GPIO
39 {
40     GENERIC_DRIVER_VERSION (*GetVersion)(void); /*!< Pointer to get driver version.*/
41     void (*pin_init)(pinID_t aPinId,
42                      gpio_direction_t dir,
43                      void *apPinConfig,
44                      gpio_isr_handler_t aIsrHandler,
45                      void *apUserData);                /*!< Pointer to Initialize gpio Interface.*/
46     void (*set_pin)(pinID_t aPinId);                   /*!< Pointer to set the pin.*/
47     void (*clr_pin)(pinID_t aPinId);                   /*!< Pointer to clear the pin.*/
48     void (*toggle_pin)(pinID_t aPinId);                /*!< Pointer to toggle the pin.*/
49     void (*write_pin)(pinID_t aPinId, uint8_t aValue); /*!<< read the pin value.*/
50     uint32_t (*read_pin)(pinID_t aPinId);              /*!<< read the pin value.*/
51 } const GENERIC_DRIVER_GPIO;
52 
53 #endif /* __DRIVER_GPIO_H */
54