GPIOCC26XX.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2022, 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 /* See GPIO.h for details about these configuration values */
85 
86 /* General options remapped directly to IOC defines */
87 #define GPIO_CFG_NO_DIR_INTERNAL (IOC_IOCFG0_IOMODE_NORMAL | GPIOCC26XX_CFG_PIN_IS_INPUT_INTERNAL)
88 #define GPIO_CFG_INPUT_INTERNAL (IOC_IOCFG0_IOMODE_NORMAL | IOC_IOCFG0_IE | GPIOCC26XX_CFG_PIN_IS_INPUT_INTERNAL)
89 #define GPIO_CFG_OUTPUT_INTERNAL (IOC_IOCFG0_IOMODE_NORMAL | IOC_IOCFG0_IE | GPIOCC26XX_CFG_PIN_IS_OUTPUT_INTERNAL)
90 #define GPIO_CFG_OUTPUT_OPEN_DRAIN_INTERNAL \
91  (IOC_IOCFG0_IOMODE_OPENDR | IOC_IOCFG0_IE | GPIOCC26XX_CFG_PIN_IS_OUTPUT_INTERNAL)
92 #define GPIO_CFG_OUT_OPEN_SOURCE_INTERNAL \
93  (IOC_IOCFG0_IOMODE_OPENSRC | IOC_IOCFG0_IE | GPIOCC26XX_CFG_PIN_IS_OUTPUT_INTERNAL)
94 
95 #define GPIO_CFG_PULL_NONE_INTERNAL IOC_IOCFG0_PULL_CTL_DIS
96 #define GPIO_CFG_PULL_UP_INTERNAL IOC_IOCFG0_PULL_CTL_UP
97 #define GPIO_CFG_PULL_DOWN_INTERNAL IOC_IOCFG0_PULL_CTL_DWN
98 
99 #define GPIO_CFG_INT_NONE_INTERNAL IOC_IOCFG0_EDGE_DET_NONE
100 #define GPIO_CFG_INT_FALLING_INTERNAL IOC_IOCFG0_EDGE_DET_NEG
101 #define GPIO_CFG_INT_RISING_INTERNAL IOC_IOCFG0_EDGE_DET_POS
102 #define GPIO_CFG_INT_BOTH_EDGES_INTERNAL IOC_IOCFG0_EDGE_DET_BOTH
103 
104 #define GPIO_CFG_INT_ENABLE_INTERNAL IOC_IOCFG0_EDGE_IRQ_EN
105 #define GPIO_CFG_INT_DISABLE_INTERNAL 0
106 
107 /* Value inversion is stored in the low bit of IOMODE */
108 #define GPIO_CFG_INVERT_OFF_INTERNAL 0
109 #define GPIO_CFG_INVERT_ON_INTERNAL IOC_IOCFG0_IOMODE_INV
110 
111 #define GPIO_CFG_HYSTERESIS_OFF_INTERNAL 0
112 #define GPIO_CFG_HYSTERESIS_ON_INTERNAL IOC_IOCFG0_HYST_EN
113 
114 #define GPIO_CFG_SLEW_NORMAL_INTERNAL 0
115 #define GPIO_CFG_SLEW_REDUCED_INTERNAL IOC_IOCFG0_SLEW_RED
116 
117 #define GPIO_CFG_DRVSTR_LOW_INTERNAL IOC_IOCFG0_IOCURR_2MA
118 #define GPIO_CFG_DRVSTR_MED_INTERNAL IOC_IOCFG0_IOCURR_4MA
119 #define GPIO_CFG_DRVSTR_HIGH_INTERNAL IOC_IOCFG0_IOCURR_4_8MA
120 
121 #define GPIO_CFG_SHUTDOWN_WAKE_OFF_INTERNAL 0
122 #define GPIO_CFG_SHUTDOWN_WAKE_HIGH_INTERNAL IOC_WAKE_ON_HIGH
123 #define GPIO_CFG_SHUTDOWN_WAKE_LOW_INTERNAL IOC_WAKE_ON_LOW
124 
125 /* We can hide some settings inside the MUX byte if they are not part of the
126  * IOC config, since the mux is applied separately. On CC26XX this is the
127  * lowest 8 bits.
128  *
129  * Do not use these values when calling GPIO_setConfig. They are for
130  * internal use only, to provide support for driver functionality that does
131  * not map directly into the IO config registers.
132  */
133 #define GPIO_CFG_OUTPUT_DEFAULT_HIGH_INTERNAL 0x1
134 #define GPIO_CFG_OUTPUT_DEFAULT_LOW_INTERNAL 0
135 
136 /* Whether GPIO hardware should have the output enable bit set for this pin */
137 #define GPIOCC26XX_CFG_PIN_IS_INPUT_INTERNAL 0x2
138 #define GPIOCC26XX_CFG_PIN_IS_OUTPUT_INTERNAL 0
139 
140 #ifdef __cplusplus
141 }
142 #endif
143 
144 #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