ISSDK  1.8
IoT Sensing Software Development Kit
gpio_driver.h
Go to the documentation of this file.
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 /**
10  * @file gpio_driver.h
11  * @brief The gpio_driver.h file containes the Generic Irq implmentation for the gpio.
12 */
13 
14 #ifndef __DRIVER_GPIO_H__
15 #define __DRIVER_GPIO_H__
16 
17 #include "Driver_Common.h"
18 #include "Driver_GPIO.h"
19 #include "fsl_common.h"
20 #include "fsl_gpio.h"
21 #include "fsl_port.h"
22 
23 /**
24 \brief GPIO PORT NAMES.
25 */
26 typedef enum port_number
27 {
28  PORTA_NUM = 0,
29  PORTB_NUM = 1,
30  PORTC_NUM = 2,
31  PORTD_NUM = 3,
32  PORTE_NUM = 4,
35 
36 /*!
37  * @brief The GPIO Configuration KSDK.
38  */
39 typedef struct gpioConfigKSDK
40 {
41  gpio_pin_config_t pinConfig; /*!< General pin charactertics.*/
42  port_pin_config_t portPinConfig; /*!< port pin configuration.*/
43  port_interrupt_t interruptMode; /*!< Interrupt mode for a pin.*/
45 
46 /*!
47  * @brief The GPIO pin handle for KSDK.
48  */
49 typedef struct gpioHandleKSDK
50 {
51  GPIO_Type *base; /*!< Base address of the GPIO Port.*/
52  PORT_Type *portBase; /*!< Base address of the GPIO Port.*/
53  uint32_t pinNumber; /*!< pin number start from 0 -31.*/
54  uint32_t mask; /*!< mask value for a pin.*/
55  IRQn_Type irq; /*!< IRQ Number for the port.*/
56  clock_ip_name_t clockName; /*!< Clock Name for the port.*/
57  port_number_t portNumber; /*!< Port Number for the port.*/
59 
60 /*!
61  * @brief The gpio isr object.
62  */
63 typedef struct gpioIsrObj
64 {
65  void *pUserData; /*!< Pointer to a UserData.*/
66  gpio_isr_handler_t isrHandle; /*!< pointer to isrHandle.*/
67 } gpioIsrObj_t;
68 
69 /*!
70  * @brief Macro to create a Gpio handle
71  */
72 #define MAKE_GPIO_HANDLE(PortName, Base, PortBase, PinNumber, Irq, ClockName, PortNumber) \
73  static gpioHandleKSDK_t PortName##PinNumber = {.base = Base, \
74  .portBase = PortBase, \
75  .pinNumber = PinNumber, \
76  .mask = 1 << (PinNumber), \
77  .irq = Irq, \
78  .clockName = ClockName, \
79  .portNumber = PortNumber};
80 
81 #define GPIO_PIN_ID(PortName, PinNumber) &(PortName##PinNumber)
83 
84 #endif // __DRIVER_GPIO_H__
struct gpioIsrObj gpioIsrObj_t
The gpio isr object.
The GPIO Configuration KSDK.
Definition: gpio_driver.h:39
PORT_Type * portBase
Definition: gpio_driver.h:52
port_number
GPIO PORT NAMES.
Definition: gpio_driver.h:27
struct gpioHandleKSDK gpioHandleKSDK_t
The GPIO pin handle for KSDK.
The gpio isr object.
Definition: gpio_driver.h:62
void(* gpio_isr_handler_t)(void *apUserData)
Definition: Driver_GPIO.h:34
Access structure of the GPIO Driver.
Definition: Driver_GPIO.h:38
The Driver_GPIO.h file contains the definitions for GPIO Driver direction.
The GPIO pin handle for KSDK.
Definition: gpio_driver.h:49
gpio_pin_config_t pinConfig
Definition: gpio_driver.h:41
uint32_t mask
Definition: gpio_driver.h:54
port_interrupt_t interruptMode
Definition: gpio_driver.h:43
IRQn_Type irq
Definition: gpio_driver.h:55
GPIO_Type * base
Definition: gpio_driver.h:51
clock_ip_name_t clockName
Definition: gpio_driver.h:56
struct gpioConfigKSDK gpioConfigKSDK_t
The GPIO Configuration KSDK.
enum port_number port_number_t
GPIO PORT NAMES.
port_number_t portNumber
Definition: gpio_driver.h:57
uint32_t pinNumber
Definition: gpio_driver.h:53
port_pin_config_t portPinConfig
Definition: gpio_driver.h:42
GENERIC_DRIVER_GPIO Driver_GPIO_KSDK
Definition: gpio_driver.c:177