GPIOCC32XX.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  */
56 #ifndef ti_drivers_GPIOCC32XX__include
57 #define ti_drivers_GPIOCC32XX__include
58 
59 #include <stdint.h>
60 #include <ti/drivers/GPIO.h>
61 
62 #include <ti/devices/cc32xx/inc/hw_types.h>
63 #include <ti/devices/cc32xx/driverlib/gpio.h>
64 #include <ti/devices/cc32xx/driverlib/pin.h>
65 
66 #ifdef __cplusplus
67 extern "C" {
68 #endif
69 
75 #define GPIOCC32XX_DO_NOT_CONFIG 0x80000000
76 
78 #define GPIOCC32XX_CFG_USE_STATIC 0x4000
79 
81 /* We don't define this value on purpose - any unsupported values will cause a
82  * compile-time error. If your compiler tells you that this macro is missing,
83  * you are trying to use an unsupported option.
84  *
85  * See below for which options are unsupported.
86  */
87 #undef GPIOCC32XX_CFG_OPTION_NOT_SUPPORTED
88 
89 /* To mux on CC32XX, use the PinTypeXXX functions from driverlib. */
90 #define GPIO_MUX_GPIO_INTERNAL GPIOCC32XX_CFG_OPTION_NOT_SUPPORTED
91 
92 /* The following options are not supported by CC32XX IO hardware */
93 #define GPIO_CFG_SLEW_NORMAL_INTERNAL GPIOCC32XX_CFG_OPTION_NOT_SUPPORTED
94 #define GPIO_CFG_SLEW_REDUCED_INTERNAL GPIOCC32XX_CFG_OPTION_NOT_SUPPORTED
95 #define GPIO_CFG_INVERT_OFF_INTERNAL GPIOCC32XX_CFG_OPTION_NOT_SUPPORTED
96 #define GPIO_CFG_INVERT_ON_INTERNAL GPIOCC32XX_CFG_OPTION_NOT_SUPPORTED
97 
98 /* Wakeup from shutdown is configured by the Power driver */
99 #define GPIO_CFG_SHUTDOWN_WAKE_OFF_INTERNAL GPIOCC26XX_CFG_OPTION_NOT_SUPPORTED
100 #define GPIO_CFG_SHUTDOWN_WAKE_HIGH_INTERNAL GPIOCC26XX_CFG_OPTION_NOT_SUPPORTED
101 #define GPIO_CFG_SHUTDOWN_WAKE_LOW_INTERNAL GPIOCC26XX_CFG_OPTION_NOT_SUPPORTED
102 
103 /* See GPIO.h for details about these configuration values */
104 
105 /* Interrupt config takes bits 0-2.
106  * 0x0 is used for FALLING, which makes this setting difficult to detect. The
107  * highest value here is 6 and 7 is still only 3 bits, so we add 1 to shift the
108  * value range and we can then use 0 for 'no configured interrupts' as usual.
109  */
110 #define GPIO_CFG_INT_NONE_INTERNAL 0
111 #define GPIO_CFG_INT_LOW_INTERNAL (GPIO_LOW_LEVEL + 1)
112 #define GPIO_CFG_INT_HIGH_INTERNAL (GPIO_HIGH_LEVEL + 1)
113 #define GPIO_CFG_INT_FALLING_INTERNAL (GPIO_FALLING_EDGE + 1)
114 #define GPIO_CFG_INT_RISING_INTERNAL (GPIO_RISING_EDGE + 1)
115 #define GPIO_CFG_INT_BOTH_EDGES_INTERNAL (GPIO_BOTH_EDGES + 1)
116 
117 /* Int enabled stored in bit 3 */
118 #define GPIO_CFG_INT_ENABLE_INTERNAL 0x8
119 #define GPIO_CFG_INT_DISABLE_INTERNAL 0
120 
121 /* General options, stored in bits 4-11 */
122 #define GPIO_CFG_INPUT_INTERNAL (PIN_TYPE_STD | PIN_DIR_MODE_IN)
123 #define GPIO_CFG_OUTPUT_INTERNAL (PIN_TYPE_STD | PIN_DIR_MODE_OUT)
124 #define GPIO_CFG_OUTPUT_OPEN_DRAIN_INTERNAL (PIN_TYPE_OD | PIN_DIR_MODE_OUT)
125 
126 #define GPIO_CFG_PULL_NONE_INTERNAL PIN_TYPE_STD
127 #define GPIO_CFG_PULL_UP_INTERNAL PIN_TYPE_STD_PU
128 #define GPIO_CFG_PULL_DOWN_INTERNAL PIN_TYPE_STD_PD
129 
130 #define GPIO_CFG_DRVSTR_LOW_INTERNAL PIN_STRENGTH_2MA
131 #define GPIO_CFG_DRVSTR_MED_INTERNAL PIN_STRENGTH_4MA
132 #define GPIO_CFG_DRVSTR_HIGH_INTERNAL PIN_STRENGTH_6MA
133 
134 #define GPIO_CFG_NO_DIR_INTERNAL PIN_TYPE_ANALOG
135 
136 /* Hysteresis enable in bit 12 */
137 #define GPIO_CFG_HYSTERESIS_OFF_INTERNAL 0x0
138 #define GPIO_CFG_HYSTERESIS_ON_INTERNAL 0x1000
139 
140 /* Default enable in bit 13 */
141 #define GPIO_CFG_OUTPUT_DEFAULT_LOW_INTERNAL 0x0
142 #define GPIO_CFG_OUTPUT_DEFAULT_HIGH_INTERNAL 0x2000
143 
144 #ifdef __cplusplus
145 }
146 #endif
147 
148 #endif /* ti_drivers_GPIOCC32XX__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