source
ti
drivers
gpio
GPIOWFF3.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2021-2025, Texas Instruments Incorporated
3
* All rights reserved.
4
*
5
* Redistribution and use in source and binary forms, with or without
6
* modification, are permitted provided that the following conditions
7
* are met:
8
*
9
* * Redistributions of source code must retain the above copyright
10
* notice, this list of conditions and the following disclaimer.
11
*
12
* * Redistributions in binary form must reproduce the above copyright
13
* notice, this list of conditions and the following disclaimer in the
14
* documentation and/or other materials provided with the distribution.
15
*
16
* * Neither the name of Texas Instruments Incorporated nor the names of
17
* its contributors may be used to endorse or promote products derived
18
* from this software without specific prior written permission.
19
*
20
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
*/
32
/*!****************************************************************************
33
* @file GPIOWFF3.h
34
*
35
* @brief GPIO driver implementation for WiFi F3 devices
36
*
37
* # Overview #
38
*
39
* The GPIO header file should be included in an application as follows:
40
* @code
41
* #include <ti/drivers/GPIO.h>
42
* #include <ti/drivers/gpio/GPIOWFF3.h>
43
* @endcode
44
*
45
* Refer to @ref GPIO.h for a complete description of the GPIO
46
* driver APIs provided and examples of their use.
47
*
48
* There are some WiFi F3 device-specific configuration values that can be used
49
* when calling @ref GPIO_setConfig or @ref GPIO_setConfigAndMux, listed below.
50
* All other macros should be used directly from GPIO.h.
51
*
52
* There are some WiFi F3 device-specific mux values that can be used
53
* when calling @ref GPIO_setConfigAndMux listed below.
54
*
55
* # IO Multiplexing #
56
* If an IO is multiplexed to an output signal or an analog signal, the IO must
57
* be configured with @ref GPIO_CFG_NO_DIR. The output will automatically be
58
* enabled when needed.
59
* If an IO is multiplexed to a digital input or bi-directional signal, the IO
60
* must be configured as an input using @ref GPIO_CFG_INPUT,
61
* @ref GPIO_CFG_IN_PU etc. to ensure that the input buffer of the IO is
62
* enabled.
63
*
64
* For IOs supporting analog signals, an additional mux setting
65
* @ref GPIOWFF3_MUX_ANALOG can be used with @ref GPIO_setConfigAndMux().
66
*
67
* # Software Controlled IO #
68
* Independently of the muxing, the IO can also be controlled/overriden by
69
* software. This means that if the IO is configured as an output (for example
70
* using @ref GPIO_CFG_OUTPUT), then the output state of the IO is controlled by
71
* the software. The signal the IO is muxed to is ignored. This is useful for
72
* some scenarios, for example setting the sleep state of the IO before
73
* entering sleep.
74
* When the IO is only intended to be used as a software controlled IO, it is
75
* recommended to use the @ref GPIO_MUX_GPIO mux setting.
76
*/
77
78
#ifndef ti_drivers_GPIOWFF3__include
79
#define ti_drivers_GPIOWFF3__include
80
81
#include <
ti/drivers/GPIO.h
>
82
83
#include <ti/devices/DeviceFamily.h>
84
#include DeviceFamily_constructPath(inc/hw_iomux.h)
85
86
#ifdef __cplusplus
87
extern
"C"
{
88
#endif
89
113
#define GPIOWFF3_MUX_ANALOG (GPIOWFF3_MUX_ANALOG_INTERNAL | GPIO_MUX_GPIO_INTERNAL)
114
127
#define GPIOWFF3_DO_NOT_CONFIG 0x80000000
128
138
/* Do not configure this pin. */
139
#define GPIO_CFG_DO_NOT_CONFIG_INTERNAL GPIOWFF3_DO_NOT_CONFIG
140
141
#define GPIO_MUX_GPIO_INTERNAL (0x0D)
142
#define GPIOWFF3_MUX_ANALOG_INTERNAL (0x100)
143
144
/* We don't define this value on purpose - any unsupported values will cause a
145
* compile-time error. If your compiler tells you that this macro is missing,
146
* you are trying to use an unsupported option.
147
*
148
* See below for which options are unsupported.
149
*/
150
#undef GPIOWFF3_CFG_OPTION_NOT_SUPPORTED
151
152
/* The IO configuration for WiFi F3 devices are split between multiple
153
* registers. The below mask and shift defines are used to split the
154
* configuration data between registers.
155
* Note: Most bitmasks are from GPIO2, but some GPIOs has additional fields,
156
* and the bitmask from these fields are from a different GPIO. For example
157
* GPIO20 is used for the drive strength bitmask.
158
*/
159
#define GPIOWFF3_CFG_CFG_S (0)
160
#define GPIOWFF3_CFG_CFG_M \
161
((IOMUX_GPIO2CFG_IE_M | IOMUX_GPIO2CFG_OUTDIS_M | IOMUX_GPIO2CFG_OUTDISOVREN_M | IOMUX_GPIO20CFG_IOSTR_M) \
162
<< GPIOWFF3_CFG_CFG_S)
163
164
#define GPIOWFF3_CFG_PULLCTL_S (0)
165
#define GPIOWFF3_CFG_PULLCTL_M ((IOMUX_GPIO2PCTL_CTL_M) << GPIOWFF3_CFG_PULLCTL_S)
166
167
#define GPIOWFF3_CFG_CTL_S (0)
168
#define GPIOWFF3_CFG_CTL_M ((IOMUX_GPIO2CTL_OUTOVREN_M | IOMUX_GPIO2CTL_OUT_M) << GPIOWFF3_CFG_CTL_S)
169
170
#define GPIOWFF3_CFG_EVTCTL_S (16)
171
#define GPIOWFF3_CFG_EVTCTL_M ((IOMUX_GPIO37ECTL_EVTDETCFG_M | IOMUX_GPIO2ECTL_TRGLVL_M) << GPIOWFF3_CFG_EVTCTL_S)
172
173
#define GPIOWFF3_CFG_IOMUX_COMB_M \
174
(GPIOWFF3_CFG_CFG_M | GPIOWFF3_CFG_PULLCTL_M | GPIOWFF3_CFG_CTL_M | GPIOWFF3_CFG_EVTCTL_M)
175
176
/* Throw an error if above masks are overlapping */
177
#if ((GPIOWFF3_CFG_CFG_M + GPIOWFF3_CFG_PULLCTL_M + GPIOWFF3_CFG_CTL_M + GPIOWFF3_CFG_EVTCTL_M) != \
178
GPIOWFF3_CFG_IOMUX_COMB_M)
179
#error \
180
"GPIOWFF3_CFG_CFG_M, GPIOWFF3_CFG_PULLCTL_M, GPIOWFF3_CFG_CTL_M and GPIOWFF3_CFG_EVTCTL_M have overlapping bits"
181
#endif
182
183
/* The remaining unused bits will be used for configuration options not directly
184
* handled by IOMUX.
185
*/
186
#define GPIOWFF3_CFG_INTERNAL_M ~GPIOWFF3_CFG_IOMUX_COMB_M
187
188
/* - Disable output disable override (IP can control OUTDIS)
189
* - Disable input
190
*/
191
#define GPIO_CFG_NO_DIR_INTERNAL \
192
((IOMUX_GPIO2CFG_OUTDISOVREN_DISABLE << GPIOWFF3_CFG_CFG_S) | (IOMUX_GPIO2CFG_IE_DISABLE << GPIOWFF3_CFG_CFG_S))
193
194
/* - Disable output disable override (IP can control OUTDIS)
195
* - Enable input
196
*/
197
#define GPIO_CFG_INPUT_INTERNAL \
198
((IOMUX_GPIO2CFG_OUTDISOVREN_DISABLE << GPIOWFF3_CFG_CFG_S) | (IOMUX_GPIO2CFG_IE_ENABLE << GPIOWFF3_CFG_CFG_S))
199
200
/* - Enable output disable override (IP cannot control OUTDIS)
201
* - Enable output (clear OUTDIS, which ENABLEs the pad)
202
* - Enable input (to be able to read the current pin output value)
203
* - Enable output override
204
*/
205
#define GPIO_CFG_OUTPUT_INTERNAL \
206
((IOMUX_GPIO2CFG_OUTDISOVREN_ENABLE << GPIOWFF3_CFG_CFG_S) | \
207
(IOMUX_GPIO2CFG_OUTDIS_ENABLE << GPIOWFF3_CFG_CFG_S) | (IOMUX_GPIO2CFG_IE_ENABLE << GPIOWFF3_CFG_CFG_S) | \
208
(IOMUX_GPIO2CTL_OUTOVREN_ENABLE << GPIOWFF3_CFG_CTL_S))
209
210
/* Default output value (only has an affect if output override is enabled) */
211
#define GPIO_CFG_OUTPUT_DEFAULT_HIGH_INTERNAL (IOMUX_GPIO2CTL_OUT_HIGH << GPIOWFF3_CFG_CTL_S)
212
#define GPIO_CFG_OUTPUT_DEFAULT_LOW_INTERNAL (IOMUX_GPIO2CTL_OUT_LOW << GPIOWFF3_CFG_CTL_S)
213
214
/* Use IP Pull Control (TODO: Determine if this is a good solution and if it will work at all) */
215
#define GPIO_CFG_PULL_NONE_INTERNAL (IOMUX_GPIO2PCTL_CTL_IPCTRL << GPIOWFF3_CFG_PULLCTL_S)
216
217
/* Override IP pull control to pull up/down */
218
#define GPIO_CFG_PULL_UP_INTERNAL (IOMUX_GPIO2PCTL_CTL_UP << GPIOWFF3_CFG_PULLCTL_S)
219
#define GPIO_CFG_PULL_DOWN_INTERNAL (IOMUX_GPIO2PCTL_CTL_DOWN << GPIOWFF3_CFG_PULLCTL_S)
220
221
/* Interrupt configurations*/
222
#define GPIO_CFG_INT_NONE_INTERNAL 0
223
224
/* - Enable edge detection
225
* - Set edge direction to falling
226
*/
227
#define GPIO_CFG_INT_FALLING_INTERNAL (IOMUX_GPIO2ECTL_EVTDETCFG_NEG_EDGE << GPIOWFF3_CFG_EVTCTL_S)
228
229
/* - Enable edge detection
230
* - Set edge direction to rising
231
*/
232
#define GPIO_CFG_INT_RISING_INTERNAL (IOMUX_GPIO2ECTL_EVTDETCFG_POS_EDGE << GPIOWFF3_CFG_EVTCTL_S)
233
234
/* - Enable level detection
235
* - Trigger event when IO level is low
236
*/
237
#define GPIO_CFG_INT_LOW_INTERNAL \
238
((IOMUX_GPIO2ECTL_EVTDETCFG_LEVEL << GPIOWFF3_CFG_EVTCTL_S) | (IOMUX_GPIO2ECTL_TRGLVL_LOW << GPIOWFF3_CFG_EVTCTL_S))
239
240
/* - Enable level detection
241
* - Trigger event when IO level is high
242
*/
243
#define GPIO_CFG_INT_HIGH_INTERNAL \
244
((IOMUX_GPIO2ECTL_EVTDETCFG_LEVEL << GPIOWFF3_CFG_EVTCTL_S) | \
245
(IOMUX_GPIO2ECTL_TRGLVL_HIGH << GPIOWFF3_CFG_EVTCTL_S))
246
247
/* Drive strengths configurations
248
* Note: GPIO20 is used instead of GPIO2, because GPIO2 do not have a drive
249
* strength field.
250
*/
251
#define GPIO_CFG_DRVSTR_LOW_INTERNAL (IOMUX_GPIO20CFG_IOSTR_LOW << GPIOWFF3_CFG_CFG_S)
252
#define GPIO_CFG_DRVSTR_HIGH_INTERNAL (IOMUX_GPIO20CFG_IOSTR_HIGH << GPIOWFF3_CFG_CFG_S)
253
254
/* TODO: Implement shutdown wake up (if supported) */
255
#define GPIO_CFG_SHUTDOWN_WAKE_OFF_INTERNAL 0
256
#define GPIO_CFG_SHUTDOWN_WAKE_HIGH_INTERNAL 0
257
#define GPIO_CFG_SHUTDOWN_WAKE_LOW_INTERNAL 0
258
259
/* Configuration values stored in internally used bits. Any configuration
260
* options not directly handled by IOMUX need to be stored inside the internal
261
* bits (\ref GPIOWFF3_CFG_INTERNAL_MASK)
262
*/
263
264
/* Interrupt enable is in the GPIO module */
265
#define GPIO_CFG_INT_ENABLE_INTERNAL 0x10
266
#define GPIO_CFG_INT_DISABLE_INTERNAL 0
267
268
/* Make sure configuration options not directly handled by IOMUX is only stored
269
* in the internally used bits.
270
*/
271
#if (((GPIO_CFG_INT_ENABLE_INTERNAL | GPIOWFF3_DO_NOT_CONFIG) | GPIOWFF3_CFG_INTERNAL_M) != GPIOWFF3_CFG_INTERNAL_M)
272
#error "Internal configurations values are not stored in GPIOWFF3_CFG_INTERNAL_M"
273
#endif
274
275
/* Not supported features */
276
#define GPIO_CFG_OUTPUT_OPEN_DRAIN_INTERNAL GPIOWFF3_CFG_OPTION_NOT_SUPPORTED
277
#define GPIO_CFG_OUT_OPEN_SOURCE_INTERNAL GPIOWFF3_CFG_OPTION_NOT_SUPPORTED
278
279
#define GPIO_CFG_INT_BOTH_EDGES_INTERNAL GPIOWFF3_CFG_OPTION_NOT_SUPPORTED
280
281
#define GPIO_CFG_DRVSTR_MED_INTERNAL GPIOWFF3_CFG_OPTION_NOT_SUPPORTED
282
283
#define GPIO_CFG_INVERT_OFF_INTERNAL GPIOWFF3_CFG_OPTION_NOT_SUPPORTED
284
#define GPIO_CFG_INVERT_ON_INTERNAL GPIOWFF3_CFG_OPTION_NOT_SUPPORTED
285
#define GPIO_CFG_HYSTERESIS_OFF_INTERNAL GPIOWFF3_CFG_OPTION_NOT_SUPPORTED
286
#define GPIO_CFG_HYSTERESIS_ON_INTERNAL GPIOWFF3_CFG_OPTION_NOT_SUPPORTED
287
#define GPIO_CFG_SLEW_NORMAL_INTERNAL GPIOWFF3_CFG_OPTION_NOT_SUPPORTED
288
#define GPIO_CFG_SLEW_REDUCED_INTERNAL GPIOWFF3_CFG_OPTION_NOT_SUPPORTED
289
292
#ifdef __cplusplus
293
}
294
#endif
295
296
#endif
/* ti_drivers_GPIOWFF3__include */
GPIO.h
General Purpose I/O driver interface.
© Copyright 1995-2026
, Texas Instruments Incorporated. All rights reserved.
Trademarks
|
Privacy policy
|
Terms of use
|
Terms of sale