PDK API Guide for J721E
gpio.h
Go to the documentation of this file.
1 
15 /*
16  * Copyright (C) 2015-2016 Texas Instruments Incorporated - http://www.ti.com/
17  *
18  * Redistribution and use in source and binary forms, with or without
19  * modification, are permitted provided that the following conditions
20  * are met:
21  *
22  * Redistributions of source code must retain the above copyright
23  * notice, this list of conditions and the following disclaimer.
24  *
25  * Redistributions in binary form must reproduce the above copyright
26  * notice, this list of conditions and the following disclaimer in the
27  * documentation and/or other materials provided with the
28  * distribution.
29  *
30  * Neither the name of Texas Instruments Incorporated nor the names of
31  * its contributors may be used to endorse or promote products derived
32  * from this software without specific prior written permission.
33  *
34  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
35  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
36  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
37  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
38  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
39  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
40  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
41  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
42  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
43  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
44  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
45  *
46  */
47 
48 #ifndef GPIO_V0_H_
49 #define GPIO_V0_H_
50 
51 /* ========================================================================== */
52 /* Include Files */
53 /* ========================================================================== */
54 
55 #include <ti/csl/src/ip/gpio/V0/cslr_gpio.h>
56 
57 #ifdef __cplusplus
58 extern "C" {
59 #endif
60 /* ========================================================================== */
61 /* Macros & Typedefs */
62 /* ========================================================================== */
63 
65 #define GPIO_PIN_LOW (0x0U)
66 
67 #define GPIO_PIN_HIGH (0x1U)
68 
70 #define GPIO_OE_OUTPUTEN_N_ENABLED (0U)
71 
73 #define GPIO_OE_OUTPUTEN_N_DISABLED (1U)
74 
76 #define GPIO_PIN_MASK_ALL 0xFF
77 
84 typedef uint32_t gpioIntrMask_t;
85 #define GPIO_INTR_MASK_NO_EDGE (0x01U)
86 
88 #define GPIO_INTR_MASK_RISE_EDGE (0x02U)
89 
91 #define GPIO_INTR_MASK_FALL_EDGE (0x04U)
92 
94 #define GPIO_INTR_MASK_BOTH_EDGE (0x08U)
95 
97 /* @} */
98 
105 typedef uint32_t gpioDirection_t;
106 #define GPIO_DIRECTION_INPUT (GPIO_OE_OUTPUTEN_N_DISABLED)
107 
108 #define GPIO_DIRECTION_OUTPUT (GPIO_OE_OUTPUTEN_N_ENABLED)
109 
110 /* @} */
111 
112 /* ========================================================================== */
113 /* Structures and Enums */
114 /* ========================================================================== */
115 
117 typedef struct gpioContext
118 {
119  uint32_t ctrl;
121  uint32_t dir;
123  uint32_t data;
126 
127 /* ========================================================================== */
128 /* Global Variables Declarations */
129 /* ========================================================================== */
130 
131 /* None */
132 
133 /* ========================================================================== */
134 /* Function Declarations */
135 /* ========================================================================== */
136 
149 void GPIOSetDirMode_v0(uint32_t baseAddr,
150  uint32_t pinNumber,
151  uint32_t pinDirection);
152 
153 
168 void GPIOPinWrite_v0(uint32_t baseAddr,
169  uint32_t pinNumber,
170  uint32_t pinValue);
171 
184 uint32_t GPIOPinRead_v0(uint32_t baseAddr, uint32_t pinNumber);
185 
186 
199 uint32_t GPIOPinOutValueRead_v0(uint32_t baseAddr, uint32_t pinNumber);
200 
201 
228 void GPIOSetIntrType_v0(uint32_t baseAddr, uint32_t pinNumber, uint32_t eventType);
229 
230 
245 void GPIOIntrEnable_v0(uint32_t baseAddr, uint32_t pinNumber, uint32_t eventType);
246 
256 void GPIOIntrDisable_v0(uint32_t baseAddr, uint32_t pinNumber);
257 
270 uint32_t GPIOIntrStatus_v0(uint32_t baseAddr, uint32_t pinNumber);
271 
280 void GPIOIntrStatusMask_v0(uint32_t baseAddr, uint32_t bankIdx, uint32_t *intrStatusMask);
281 
291 void GPIOIntrClear_v0(uint32_t baseAddr, uint32_t pinNumber);
292 
302 void GPIOIntrClearMask_v0(uint32_t baseAddr, uint32_t bankIdx, uint32_t pinMask);
303 
304 #ifdef __cplusplus
305 }
306 #endif
307 
308 #endif /* #ifndef GPIO_V0_H_ */
309 
void GPIOIntrStatusMask_v0(uint32_t baseAddr, uint32_t bankIdx, uint32_t *intrStatusMask)
This API determines the enabled interrupt status of a specified pin.
void GPIOIntrClear_v0(uint32_t baseAddr, uint32_t pinNumber)
This API clears the enabled interrupt status of a specified GPIO pin.
void GPIOPinWrite_v0(uint32_t baseAddr, uint32_t pinNumber, uint32_t pinValue)
This API drives an output GPIO pin to a logic HIGH or a logic LOW state.
void GPIOIntrClearMask_v0(uint32_t baseAddr, uint32_t bankIdx, uint32_t pinMask)
This API clears the enabled interrupt status of specified GPIO pins.
void GPIOSetDirMode_v0(uint32_t baseAddr, uint32_t pinNumber, uint32_t pinDirection)
This API configures the direction of a specified GPIO pin as being either input or output.
uint32_t gpioIntrMask_t
Enumerates the possible GPIO interrupt generation events.
Definition: gpio.h:84
uint32_t ctrl
Definition: gpio.h:119
uint32_t GPIOPinOutValueRead_v0(uint32_t baseAddr, uint32_t pinNumber)
This API determines the output logic level(value) on a specified GPIO pin.
uint32_t dir
Definition: gpio.h:121
uint32_t GPIOPinRead_v0(uint32_t baseAddr, uint32_t pinNumber)
This API determines the logic level(value) on a specified GPIO pin.
Structure holding the GPIO context.
Definition: gpio.h:117
uint32_t gpioDirection_t
Enumerates the direction of GPIO pin.
Definition: gpio.h:105
void GPIOSetIntrType_v0(uint32_t baseAddr, uint32_t pinNumber, uint32_t eventType)
This API configures the event type for a specified input GPIO pin. Whenever the selected event occurs...
uint32_t data
Definition: gpio.h:123
void GPIOIntrEnable_v0(uint32_t baseAddr, uint32_t pinNumber, uint32_t eventType)
This API enables the configured interrupt event on a specified input GPIO pin to trigger an interrupt...
void GPIOIntrDisable_v0(uint32_t baseAddr, uint32_t pinNumber)
This API disables interrupt generation due to the detection of any event on a specified input GPIO pi...
uint32_t GPIOIntrStatus_v0(uint32_t baseAddr, uint32_t pinNumber)
This API determines the enabled interrupt status of a specified pin.