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 /* Low and high value interrupts are not available on Low Power F3 devices */
84 #define GPIO_CFG_INT_LOW_INTERNAL GPIOLPF3_CFG_OPTION_NOT_SUPPORTED
85 #define GPIO_CFG_INT_HIGH_INTERNAL GPIOLPF3_CFG_OPTION_NOT_SUPPORTED
86 
87 /* General options */
88 #define GPIO_CFG_NO_DIR_INTERNAL (IOC_IOC3_IOMODE_NORMAL | GPIOLPF3_CFG_PIN_IS_INPUT_INTERNAL)
89 /* Hysteresis is enabled by default for all input pins due to hardware changes on these devices.
90  * This may impact pin response by 1-2ns, but creates significantly more stable environments for
91  * high-speed use cases like SPI.
92  */
93 #define GPIO_CFG_INPUT_INTERNAL \
94  (IOC_IOC3_IOMODE_NORMAL | IOC_IOC3_INPEN | IOC_IOC3_WUENSB | IOC_IOC3_HYSTEN | GPIOLPF3_CFG_PIN_IS_INPUT_INTERNAL)
95 #define GPIO_CFG_OUTPUT_INTERNAL (IOC_IOC3_IOMODE_NORMAL | IOC_IOC3_INPEN | GPIOLPF3_CFG_PIN_IS_OUTPUT_INTERNAL)
96 #define GPIO_CFG_OUTPUT_OPEN_DRAIN_INTERNAL \
97  (IOC_IOC3_IOMODE_OPEND | IOC_IOC3_INPEN | GPIOLPF3_CFG_PIN_IS_OUTPUT_INTERNAL)
98 #define GPIO_CFG_OUT_OPEN_SOURCE_INTERNAL (IOC_IOC3_IOMODE_OPENS | IOC_IOC3_INPEN | GPIOLPF3_CFG_PIN_IS_OUTPUT_INTERNAL)
99 
100 #define GPIO_CFG_PULL_NONE_INTERNAL IOC_IOC3_PULLCTL_PULL_DIS
101 #define GPIO_CFG_PULL_UP_INTERNAL IOC_IOC3_PULLCTL_PULL_UP
102 #define GPIO_CFG_PULL_DOWN_INTERNAL IOC_IOC3_PULLCTL_PULL_DOWN
103 
104 #define GPIO_CFG_INT_NONE_INTERNAL IOC_IOC3_EDGEDET_EDGE_DIS
105 #define GPIO_CFG_INT_FALLING_INTERNAL IOC_IOC3_EDGEDET_EDGE_NEG
106 #define GPIO_CFG_INT_RISING_INTERNAL IOC_IOC3_EDGEDET_EDGE_POS
107 #define GPIO_CFG_INT_BOTH_EDGES_INTERNAL IOC_IOC3_EDGEDET_EDGE_BOTH
108 
109 /* We can feed this into the low bit of IOMODE, and it can then be ORed with output/input/OD/OS */
110 #define GPIO_CFG_INVERT_OFF_INTERNAL 0
111 #define GPIO_CFG_INVERT_ON_INTERNAL IOC_IOC3_IOMODE_INVERTED
112 
113 #define GPIO_CFG_HYSTERESIS_OFF_INTERNAL 0
114 #define GPIO_CFG_HYSTERESIS_ON_INTERNAL IOC_IOC3_HYSTEN
115 
116 #define GPIO_CFG_SHUTDOWN_WAKE_OFF_INTERNAL 0
117 #define GPIO_CFG_SHUTDOWN_WAKE_HIGH_INTERNAL IOC_IOC3_WUCFGSD_WAKE_HIGH
118 #define GPIO_CFG_SHUTDOWN_WAKE_LOW_INTERNAL IOC_IOC3_WUCFGSD_WAKE_LOW
119 
120 /* Slew limits and drive strength are only supported on specific pins: pin 12, pins 16-19, and pin 24 */
121 #define GPIO_CFG_SLEW_NORMAL_INTERNAL IOC_IOC17_SLEWRED_NORMAL
122 #define GPIO_CFG_SLEW_REDUCED_INTERNAL IOC_IOC17_SLEWRED_REDUCED
123 
124 #define GPIO_CFG_DRVSTR_LOW_INTERNAL IOC_IOC17_IOCURR_CUR_2MA
125 #define GPIO_CFG_DRVSTR_MED_INTERNAL IOC_IOC17_IOCURR_CUR_4MA
126 #define GPIO_CFG_DRVSTR_HIGH_INTERNAL IOC_IOC17_IOCURR_CUR_8MA
127 
128 /* Configuration values stored in mux bits Any configuration options not
129  * directly handled by IOC need to be stored inside the mux bits (lowest 3 bits
130  * on Low Power F3 devices). These are masked out by init() and setConfig()
131  */
132 
133 /* Default output value */
134 #define GPIO_CFG_OUTPUT_DEFAULT_HIGH_INTERNAL 0x1
135 #define GPIO_CFG_OUTPUT_DEFAULT_LOW_INTERNAL 0
136 
137 /* Whether GPIO hardware should have the output enable bit set for this pin */
138 #define GPIOLPF3_CFG_PIN_IS_INPUT_INTERNAL 0x2
139 #define GPIOLPF3_CFG_PIN_IS_OUTPUT_INTERNAL 0
140 
141 /* Interrupt enable is in the GPIO module */
142 #define GPIO_CFG_INT_ENABLE_INTERNAL 0x4
143 #define GPIO_CFG_INT_DISABLE_INTERNAL 0
144 
145 #ifdef __cplusplus
146 }
147 #endif
148 
149 #endif /* ti_drivers_GPIOCC26XX__include */
General Purpose I/O driver interface.
© Copyright 1995-2023, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale