ISSDK  1.7
IoT Sensing Software Development Kit
Driver_GPIO.h
Go to the documentation of this file.
1 /*
2  * The Clear BSD License
3  * Copyright (c) 2016, Freescale Semiconductor, Inc.
4  * Copyright 2016-2017 NXP
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without modification,
8  * are permitted (subject to the limitations in the disclaimer below) provided
9  * that the following conditions are met:
10  *
11  * o Redistributions of source code must retain the above copyright notice, this list
12  * of conditions and the following disclaimer.
13  *
14  * o Redistributions in binary form must reproduce the above copyright notice, this
15  * list of conditions and the following disclaimer in the documentation and/or
16  * other materials provided with the distribution.
17  *
18  * o Neither the name of the copyright holder nor the names of its
19  * contributors may be used to endorse or promote products derived from this
20  * software without specific prior written permission.
21  *
22  * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE.
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
24  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
27  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
30  * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33  */
34 
35 #ifndef __DRIVER_GPIO_H
36 #define __DRIVER_GPIO_H
37 
38 #include "Driver_Common.h"
39 
40 #define GPIO_API_VERSION ARM_DRIVER_VERSION_MAJOR_MINOR(2, 0) /* API version */
41 
42 /**
43  * @file Driver_GPIO.h
44 * @brief The Driver_GPIO.h file contains the definitions for GPIO Driver direction.
45 */
46 
47 typedef enum gpio_direction_en
48 {
49  GPIO_DIRECTION_IN = 0U, /*!< IN. */
50  GPIO_DIRECTION_OUT = 1U, /*!< OUT. */
52 
53 /**
54 \brief GPIO Driver direction.
55 */
56 typedef void *pinID_t;
57 
58 typedef ARM_DRIVER_VERSION GENERIC_DRIVER_VERSION;
59 
60 typedef void (*gpio_isr_handler_t)(void *apUserData);
61 /**
62 \brief Access structure of the GPIO Driver.
63 */
64 typedef struct GENERIC_DRIVER_GPIO
65 {
66  GENERIC_DRIVER_VERSION (*GetVersion)(void); /*!< Pointer to get driver version.*/
67  void (*pin_init)(pinID_t aPinId,
68  gpio_direction_t dir,
69  void *apPinConfig,
70  gpio_isr_handler_t aIsrHandler,
71  void *apUserData); /*!< Pointer to Initialize gpio Interface.*/
72  void (*set_pin)(pinID_t aPinId); /*!< Pointer to set the pin.*/
73  void (*clr_pin)(pinID_t aPinId); /*!< Pointer to clear the pin.*/
74  void (*toggle_pin)(pinID_t aPinId); /*!< Pointer to toggle the pin.*/
75  void (*write_pin)(pinID_t aPinId, uint8_t aValue); /*!<< read the pin value.*/
76  uint32_t (*read_pin)(pinID_t aPinId); /*!<< read the pin value.*/
77 } const GENERIC_DRIVER_GPIO;
78 
79 #endif /* __DRIVER_GPIO_H */
void(* pin_init)(pinID_t aPinId, gpio_direction_t dir, void *apPinConfig, gpio_isr_handler_t aIsrHandler, void *apUserData)
Definition: Driver_GPIO.h:67
void(* toggle_pin)(pinID_t aPinId)
Definition: Driver_GPIO.h:74
void(* gpio_isr_handler_t)(void *apUserData)
Definition: Driver_GPIO.h:60
uint32_t(* read_pin)(pinID_t aPinId)
Definition: Driver_GPIO.h:76
ARM_DRIVER_VERSION GENERIC_DRIVER_VERSION
Definition: Driver_GPIO.h:58
struct GENERIC_DRIVER_GPIO GENERIC_DRIVER_GPIO
Access structure of the GPIO Driver.
void(* write_pin)(pinID_t aPinId, uint8_t aValue)
Definition: Driver_GPIO.h:75
enum gpio_direction_en gpio_direction_t
void(* set_pin)(pinID_t aPinId)
Definition: Driver_GPIO.h:72
void * pinID_t
GPIO Driver direction.
Definition: Driver_GPIO.h:56
void(* clr_pin)(pinID_t aPinId)
Definition: Driver_GPIO.h:73
Access structure of the GPIO Driver.
Definition: Driver_GPIO.h:64
gpio_direction_en
Definition: Driver_GPIO.h:47
GENERIC_DRIVER_VERSION(* GetVersion)(void)
Definition: Driver_GPIO.h:66