CC3200 Peripheral Driver Library User's Guide  1.2.0
gpio.h
1 //*****************************************************************************
2 //
3 // gpio.h
4 //
5 // Defines and Macros for GPIO API.
6 //
7 // Copyright (C) 2014 Texas Instruments Incorporated - https://www.ti.com/
8 //
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions
12 // are met:
13 //
14 // Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the
20 // distribution.
21 //
22 // Neither the name of Texas Instruments Incorporated nor the names of
23 // its contributors may be used to endorse or promote products derived
24 // from this software without specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
27 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
28 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
29 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
30 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
31 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
32 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
33 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
34 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
36 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 //
38 //*****************************************************************************
39 
40 #ifndef __GPIO_H__
41 #define __GPIO_H__
42 
43 //*****************************************************************************
44 //
45 // If building with a C++ compiler, make all of the definitions in this header
46 // have a C binding.
47 //
48 //*****************************************************************************
49 #ifdef __cplusplus
50 extern "C"
51 {
52 #endif
53 
54 //*****************************************************************************
55 //
56 // The following values define the bit field for the ucPins argument to several
57 // of the APIs.
58 //
59 //*****************************************************************************
60 #define GPIO_PIN_0 0x00000001 // GPIO pin 0
61 #define GPIO_PIN_1 0x00000002 // GPIO pin 1
62 #define GPIO_PIN_2 0x00000004 // GPIO pin 2
63 #define GPIO_PIN_3 0x00000008 // GPIO pin 3
64 #define GPIO_PIN_4 0x00000010 // GPIO pin 4
65 #define GPIO_PIN_5 0x00000020 // GPIO pin 5
66 #define GPIO_PIN_6 0x00000040 // GPIO pin 6
67 #define GPIO_PIN_7 0x00000080 // GPIO pin 7
68 
69 //*****************************************************************************
70 //
71 // Values that can be passed to GPIODirModeSet as the ulPinIO parameter, and
72 // returned from GPIODirModeGet.
73 //
74 //*****************************************************************************
75 #define GPIO_DIR_MODE_IN 0x00000000 // Pin is a GPIO input
76 #define GPIO_DIR_MODE_OUT 0x00000001 // Pin is a GPIO output
77 
78 //*****************************************************************************
79 //
80 // Values that can be passed to GPIOIntTypeSet as the ulIntType parameter, and
81 // returned from GPIOIntTypeGet.
82 //
83 //*****************************************************************************
84 #define GPIO_FALLING_EDGE 0x00000000 // Interrupt on falling edge
85 #define GPIO_RISING_EDGE 0x00000004 // Interrupt on rising edge
86 #define GPIO_BOTH_EDGES 0x00000001 // Interrupt on both edges
87 #define GPIO_LOW_LEVEL 0x00000002 // Interrupt on low level
88 #define GPIO_HIGH_LEVEL 0x00000006 // Interrupt on high level
89 
90 //*****************************************************************************
91 //
92 // Values that can be passed to GPIOIntEnable() and GPIOIntDisable() functions
93 // in the ulIntFlags parameter.
94 //
95 //*****************************************************************************
96 #define GPIO_INT_DMA 0x00000100
97 #define GPIO_INT_PIN_0 0x00000001
98 #define GPIO_INT_PIN_1 0x00000002
99 #define GPIO_INT_PIN_2 0x00000004
100 #define GPIO_INT_PIN_3 0x00000008
101 #define GPIO_INT_PIN_4 0x00000010
102 #define GPIO_INT_PIN_5 0x00000020
103 #define GPIO_INT_PIN_6 0x00000040
104 #define GPIO_INT_PIN_7 0x00000080
105 
106 //*****************************************************************************
107 //
108 // Prototypes for the APIs.
109 //
110 //*****************************************************************************
111 extern void GPIODirModeSet(unsigned long ulPort, unsigned char ucPins,
112  unsigned long ulPinIO);
113 extern unsigned long GPIODirModeGet(unsigned long ulPort, unsigned char ucPin);
114 extern void GPIOIntTypeSet(unsigned long ulPort, unsigned char ucPins,
115  unsigned long ulIntType);
116 extern void GPIODMATriggerEnable(unsigned long ulPort);
117 extern void GPIODMATriggerDisable(unsigned long ulPort);
118 extern unsigned long GPIOIntTypeGet(unsigned long ulPort, unsigned char ucPin);
119 extern void GPIOIntEnable(unsigned long ulPort, unsigned long ulIntFlags);
120 extern void GPIOIntDisable(unsigned long ulPort, unsigned long ulIntFlags);
121 extern long GPIOIntStatus(unsigned long ulPort, tBoolean bMasked);
122 extern void GPIOIntClear(unsigned long ulPort, unsigned long ulIntFlags);
123 extern void GPIOIntRegister(unsigned long ulPort,
124  void (*pfnIntHandler)(void));
125 extern void GPIOIntUnregister(unsigned long ulPort);
126 extern long GPIOPinRead(unsigned long ulPort, unsigned char ucPins);
127 extern void GPIOPinWrite(unsigned long ulPort, unsigned char ucPins,
128  unsigned char ucVal);
129 
130 //*****************************************************************************
131 //
132 // Mark the end of the C bindings section for C++ compilers.
133 //
134 //*****************************************************************************
135 #ifdef __cplusplus
136 }
137 #endif
138 
139 #endif // __GPIO_H__
void GPIOIntRegister(unsigned long ulPort, void(*pfnIntHandler)(void))
Definition: gpio.c:496
void GPIODirModeSet(unsigned long ulPort, unsigned char ucPins, unsigned long ulPinIO)
Definition: gpio.c:173
unsigned long GPIOIntTypeGet(unsigned long ulPort, unsigned char ucPin)
Definition: gpio.c:304
void GPIOIntClear(unsigned long ulPort, unsigned long ulIntFlags)
Definition: gpio.c:462
void GPIOPinWrite(unsigned long ulPort, unsigned char ucPins, unsigned char ucVal)
Definition: gpio.c:614
long GPIOIntStatus(unsigned long ulPort, tBoolean bMasked)
Definition: gpio.c:425
void GPIOIntEnable(unsigned long ulPort, unsigned long ulIntFlags)
Definition: gpio.c:356
void GPIODMATriggerDisable(unsigned long ulPort)
Definition: gpio.c:683
void GPIOIntTypeSet(unsigned long ulPort, unsigned char ucPins, unsigned long ulIntType)
Definition: gpio.c:261
void GPIOIntUnregister(unsigned long ulPort)
Definition: gpio.c:537
void GPIOIntDisable(unsigned long ulPort, unsigned long ulIntFlags)
Definition: gpio.c:396
unsigned long GPIODirModeGet(unsigned long ulPort, unsigned char ucPin)
Definition: gpio.c:207
long GPIOPinRead(unsigned long ulPort, unsigned char ucPins)
Definition: gpio.c:582
void GPIODMATriggerEnable(unsigned long ulPort)
Definition: gpio.c:641