source
ti
drivers
gpio
GPIOLPF3.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2021-2023, 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
*/
53
#ifndef ti_drivers_GPIOLPF3__include
54
#define ti_drivers_GPIOLPF3__include
55
56
#include <
ti/drivers/GPIO.h
>
57
58
#include <ti/devices/DeviceFamily.h>
59
#include DeviceFamily_constructPath(inc/hw_ioc.h)
60
61
#ifdef __cplusplus
62
extern
"C"
{
63
#endif
64
65
/* Re-map IOC PORTCFG defines from hw_ioc.h to GPIO defines*/
66
#define GPIO_MUX_PORTCFG_PFUNC7 IOC_IOC3_PORTCFG_DTB
67
#define GPIO_MUX_PORTCFG_PFUNC6 IOC_IOC3_PORTCFG_ANA
68
#define GPIO_MUX_PORTCFG_PFUNC5 IOC_IOC3_PORTCFG_PFUNC5
69
#define GPIO_MUX_PORTCFG_PFUNC4 IOC_IOC3_PORTCFG_PFUNC4
70
#define GPIO_MUX_PORTCFG_PFUNC3 IOC_IOC3_PORTCFG_PFUNC3
71
#define GPIO_MUX_PORTCFG_PFUNC2 IOC_IOC3_PORTCFG_PFUNC2
72
#define GPIO_MUX_PORTCFG_PFUNC1 IOC_IOC3_PORTCFG_PFUNC1
73
#define GPIO_MUX_GPIO_INTERNAL IOC_IOC3_PORTCFG_BASE
74
75
/* We don't define this value on purpose - any unsupported values will cause a
76
* compile-time error. If your compiler tells you that this macro is missing,
77
* you are trying to use an unsupported option.
78
*
79
* See below for which options are unsupported.
80
*/
81
#undef GPIOLPF3_CFG_OPTION_NOT_SUPPORTED
82
83
/* Most configuration values are directly mapped to fields in the IOCn
84
* registers, but the mux bits are reserved for configuration options that
85
* cannot be directly mapped to the IOCn registers. The define below is the
86
* mask used by the GPIO driver to mask off the non-IOC configuration values.
87
*/
88
#define GPIOLPF3_CFG_IOC_M 0xFFFFFFF8
89
90
/* Low and high value interrupts are not available on Low Power F3 devices */
91
#define GPIO_CFG_INT_LOW_INTERNAL GPIOLPF3_CFG_OPTION_NOT_SUPPORTED
92
#define GPIO_CFG_INT_HIGH_INTERNAL GPIOLPF3_CFG_OPTION_NOT_SUPPORTED
93
94
/* General options */
95
#define GPIO_CFG_NO_DIR_INTERNAL (IOC_IOC3_IOMODE_NORMAL | GPIOLPF3_CFG_PIN_IS_INPUT_INTERNAL)
96
/* Hysteresis is enabled by default for all input pins due to hardware changes on these devices.
97
* This may impact pin response by 1-2ns, but creates significantly more stable environments for
98
* high-speed use cases like SPI.
99
*/
100
#define GPIO_CFG_INPUT_INTERNAL \
101
(IOC_IOC3_IOMODE_NORMAL | IOC_IOC3_INPEN | IOC_IOC3_WUENSB | IOC_IOC3_HYSTEN | GPIOLPF3_CFG_PIN_IS_INPUT_INTERNAL)
102
#define GPIO_CFG_OUTPUT_INTERNAL (IOC_IOC3_IOMODE_NORMAL | IOC_IOC3_INPEN | GPIOLPF3_CFG_PIN_IS_OUTPUT_INTERNAL)
103
#define GPIO_CFG_OUTPUT_OPEN_DRAIN_INTERNAL \
104
(IOC_IOC3_IOMODE_OPEND | IOC_IOC3_INPEN | GPIOLPF3_CFG_PIN_IS_OUTPUT_INTERNAL)
105
#define GPIO_CFG_OUT_OPEN_SOURCE_INTERNAL (IOC_IOC3_IOMODE_OPENS | IOC_IOC3_INPEN | GPIOLPF3_CFG_PIN_IS_OUTPUT_INTERNAL)
106
107
#define GPIO_CFG_PULL_NONE_INTERNAL IOC_IOC3_PULLCTL_PULL_DIS
108
#define GPIO_CFG_PULL_UP_INTERNAL IOC_IOC3_PULLCTL_PULL_UP
109
#define GPIO_CFG_PULL_DOWN_INTERNAL IOC_IOC3_PULLCTL_PULL_DOWN
110
111
#define GPIO_CFG_INT_NONE_INTERNAL IOC_IOC3_EDGEDET_EDGE_DIS
112
#define GPIO_CFG_INT_FALLING_INTERNAL IOC_IOC3_EDGEDET_EDGE_NEG
113
#define GPIO_CFG_INT_RISING_INTERNAL IOC_IOC3_EDGEDET_EDGE_POS
114
#define GPIO_CFG_INT_BOTH_EDGES_INTERNAL IOC_IOC3_EDGEDET_EDGE_BOTH
115
116
/* We can feed this into the low bit of IOMODE, and it can then be ORed with output/input/OD/OS */
117
#define GPIO_CFG_INVERT_OFF_INTERNAL 0
118
#define GPIO_CFG_INVERT_ON_INTERNAL IOC_IOC3_IOMODE_INVERTED
119
120
#define GPIO_CFG_HYSTERESIS_OFF_INTERNAL 0
121
#define GPIO_CFG_HYSTERESIS_ON_INTERNAL IOC_IOC3_HYSTEN
122
123
#define GPIO_CFG_SHUTDOWN_WAKE_OFF_INTERNAL 0
124
#define GPIO_CFG_SHUTDOWN_WAKE_HIGH_INTERNAL IOC_IOC3_WUCFGSD_WAKE_HIGH
125
#define GPIO_CFG_SHUTDOWN_WAKE_LOW_INTERNAL IOC_IOC3_WUCFGSD_WAKE_LOW
126
127
/* Slew limits and drive strength are only supported on specific pins: pin 12, pins 16-19, and pin 24 */
128
#define GPIO_CFG_SLEW_NORMAL_INTERNAL IOC_IOC17_SLEWRED_NORMAL
129
#define GPIO_CFG_SLEW_REDUCED_INTERNAL IOC_IOC17_SLEWRED_REDUCED
130
131
#define GPIO_CFG_DRVSTR_LOW_INTERNAL IOC_IOC17_IOCURR_CUR_2MA
132
#define GPIO_CFG_DRVSTR_MED_INTERNAL IOC_IOC17_IOCURR_CUR_4MA
133
#define GPIO_CFG_DRVSTR_HIGH_INTERNAL IOC_IOC17_IOCURR_CUR_8MA
134
135
/* Configuration values stored in mux bits Any configuration options not
136
* directly handled by IOC need to be stored inside the mux bits (lowest 3 bits
137
* on Low Power F3 devices). These are masked out by GPIO_init(),
138
* GPIO_setConfig(), GPIO_setConfigAndMux() and GPIO_getConfig() using
139
* GPIOLPF3_CFG_IOC_M.
140
*/
141
142
/* Default output value */
143
#define GPIO_CFG_OUTPUT_DEFAULT_HIGH_INTERNAL 0x1
144
#define GPIO_CFG_OUTPUT_DEFAULT_LOW_INTERNAL 0
145
146
/* Whether GPIO hardware should have the output enable bit set for this pin */
147
#define GPIOLPF3_CFG_PIN_IS_INPUT_INTERNAL 0x2
148
#define GPIOLPF3_CFG_PIN_IS_OUTPUT_INTERNAL 0
149
150
/* Interrupt enable is in the GPIO module */
151
#define GPIO_CFG_INT_ENABLE_INTERNAL 0x4
152
#define GPIO_CFG_INT_DISABLE_INTERNAL 0
153
154
#ifdef __cplusplus
155
}
156
#endif
157
158
#endif
/* ti_drivers_GPIOCC26XX__include */
GPIO.h
General Purpose I/O driver interface.
© Copyright 1995-2023
, Texas Instruments Incorporated. All rights reserved.
Trademarks
|
Privacy policy
|
Terms of use
|
Terms of sale