GPIOCC26XX.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2021, 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_GPIOCC26XX__include
54 #define ti_drivers_GPIOCC26XX__include
55 
56 #include <ti/drivers/GPIO.h>
57 
58 #include <ti/devices/DeviceFamily.h>
59 #include DeviceFamily_constructPath(inc/hw_ioc.h)
60 #include DeviceFamily_constructPath(driverlib/ioc.h)
61 
62 #ifdef __cplusplus
63 extern "C" {
64 #endif
65 
66 /* Alternative mux values are defined in hw_ioc.h */
67 #define GPIO_MUX_GPIO_INTERNAL IOC_IOCFG0_PORT_ID_GPIO
68 
69 /* We don't define this value on purpose - any unsupported values will cause a
70  * compile-time error. If your compiler tells you that this macro is missing,
71  * you are trying to use an unsupported option.
72  *
73  * See below for which options are unsupported.
74  */
75 #undef GPIOCC26XX_CFG_OPTION_NOT_SUPPORTED
76 
77 /* Low and high value interrupts are not available on CC26XX hardware */
78 #define GPIO_CFG_INT_LOW_INTERNAL GPIOCC26XX_CFG_OPTION_NOT_SUPPORTED
79 #define GPIO_CFG_INT_HIGH_INTERNAL GPIOCC26XX_CFG_OPTION_NOT_SUPPORTED
80 
81 /* Support for DO_NOT_CONFIG would break a major initialisation optimisation */
82 #define GPIO_CFG_DO_NOT_CONFIG_INTERNAL GPIOCC26XX_CFG_OPTION_NOT_SUPPORTED
83 
84 /* CC13XX/CC26XX pins are always enabled for wakeup from standby with standard interrupts */
85 #define GPIO_CFG_STANDBY_WAKE_OFF_INTERNAL GPIOCC26XX_CFG_OPTION_NOT_SUPPORTED
86 #define GPIO_CFG_STANDBY_WAKE_ON_INTERNAL 0x0
87 
88 /* See GPIO.h for details about these configuration values */
89 
90 /* General options remapped directly to IOC defines */
91 #define GPIO_CFG_NO_DIR_INTERNAL (IOC_IOCFG0_IOMODE_NORMAL | GPIOCC26XX_CFG_PIN_IS_INPUT_INTERNAL)
92 #define GPIO_CFG_INPUT_INTERNAL (IOC_IOCFG0_IOMODE_NORMAL | IOC_IOCFG0_IE | GPIOCC26XX_CFG_PIN_IS_INPUT_INTERNAL)
93 #define GPIO_CFG_OUTPUT_INTERNAL (IOC_IOCFG0_IOMODE_NORMAL | IOC_IOCFG0_IE | GPIOCC26XX_CFG_PIN_IS_OUTPUT_INTERNAL)
94 #define GPIO_CFG_OUTPUT_OPEN_DRAIN_INTERNAL \
95  (IOC_IOCFG0_IOMODE_OPENDR | IOC_IOCFG0_IE | GPIOCC26XX_CFG_PIN_IS_OUTPUT_INTERNAL)
96 #define GPIO_CFG_OUT_OPEN_SOURCE_INTERNAL \
97  (IOC_IOCFG0_IOMODE_OPENSRC | IOC_IOCFG0_IE | GPIOCC26XX_CFG_PIN_IS_OUTPUT_INTERNAL)
98 
99 #define GPIO_CFG_PULL_NONE_INTERNAL IOC_IOCFG0_PULL_CTL_DIS
100 #define GPIO_CFG_PULL_UP_INTERNAL IOC_IOCFG0_PULL_CTL_UP
101 #define GPIO_CFG_PULL_DOWN_INTERNAL IOC_IOCFG0_PULL_CTL_DWN
102 
103 #define GPIO_CFG_INT_NONE_INTERNAL IOC_IOCFG0_EDGE_DET_NONE
104 #define GPIO_CFG_INT_FALLING_INTERNAL IOC_IOCFG0_EDGE_DET_NEG
105 #define GPIO_CFG_INT_RISING_INTERNAL IOC_IOCFG0_EDGE_DET_POS
106 #define GPIO_CFG_INT_BOTH_EDGES_INTERNAL IOC_IOCFG0_EDGE_DET_BOTH
107 
108 #define GPIO_CFG_INT_ENABLE_INTERNAL IOC_IOCFG0_EDGE_IRQ_EN
109 #define GPIO_CFG_INT_DISABLE_INTERNAL 0
110 
111 /* Value inversion is stored in the low bit of IOMODE */
112 #define GPIO_CFG_INVERT_OFF_INTERNAL 0
113 #define GPIO_CFG_INVERT_ON_INTERNAL IOC_IOCFG0_IOMODE_INV
114 
115 #define GPIO_CFG_HYSTERESIS_OFF_INTERNAL 0
116 #define GPIO_CFG_HYSTERESIS_ON_INTERNAL IOC_IOCFG0_HYST_EN
117 
118 #define GPIO_CFG_SLEW_NORMAL_INTERNAL 0
119 #define GPIO_CFG_SLEW_REDUCED_INTERNAL IOC_IOCFG0_SLEW_RED
120 
121 #define GPIO_CFG_DRVSTR_LOW_INTERNAL IOC_IOCFG0_IOSTR_AUTO
122 #define GPIO_CFG_DRVSTR_MED_INTERNAL IOC_IOCFG0_IOSTR_MED
123 #define GPIO_CFG_DRVSTR_HIGH_INTERNAL IOC_IOCFG0_IOSTR_MAX
124 
125 #define GPIO_CFG_SHUTDOWN_WAKE_OFF_INTERNAL 0
126 #define GPIO_CFG_SHUTDOWN_WAKE_HIGH_INTERNAL IOC_WAKE_ON_HIGH
127 #define GPIO_CFG_SHUTDOWN_WAKE_LOW_INTERNAL IOC_WAKE_ON_LOW
128 
129 /* We can hide some settings inside the MUX byte if they are not part of the
130  * IOC config, since the mux is applied separately. On CC26XX this is the
131  * lowest 8 bits.
132  *
133  * Do not use these values when calling GPIO_setConfig. They are for
134  * internal use only, to provide support for driver functionality that does
135  * not map directly into the IO config registers.
136  */
137 #define GPIO_CFG_OUTPUT_DEFAULT_HIGH_INTERNAL 0x1
138 #define GPIO_CFG_OUTPUT_DEFAULT_LOW_INTERNAL 0
139 
140 /* Whether GPIO hardware should have the output enable bit set for this pin */
141 #define GPIOCC26XX_CFG_PIN_IS_INPUT_INTERNAL 0x2
142 #define GPIOCC26XX_CFG_PIN_IS_OUTPUT_INTERNAL 0
143 
144 #ifdef __cplusplus
145 }
146 #endif
147 
148 #endif /* ti_drivers_GPIOCC26XX__include */
General Purpose I/O driver interface.
© Copyright 1995-2022, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale