GPIOCC32XX.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  */
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 /* See GPIO.h for details about these configuration values */
99 
100 /* Interrupt config takes bits 0-2.
101  * 0x0 is used for FALLING, which makes this setting difficult to detect. The
102  * highest value here is 6 and 7 is still only 3 bits, so we add 1 to shift the
103  * value range and we can then use 0 for 'no configured interrupts' as usual.
104  */
105 #define GPIO_CFG_INT_NONE_INTERNAL 0
106 #define GPIO_CFG_INT_LOW_INTERNAL (GPIO_LOW_LEVEL + 1)
107 #define GPIO_CFG_INT_HIGH_INTERNAL (GPIO_HIGH_LEVEL + 1)
108 #define GPIO_CFG_INT_FALLING_INTERNAL (GPIO_FALLING_EDGE + 1)
109 #define GPIO_CFG_INT_RISING_INTERNAL (GPIO_RISING_EDGE + 1)
110 #define GPIO_CFG_INT_BOTH_EDGES_INTERNAL (GPIO_BOTH_EDGES + 1)
111 
112 /* Int enabled stored in bit 3 */
113 #define GPIO_CFG_INT_ENABLE_INTERNAL 0x8
114 #define GPIO_CFG_INT_DISABLE_INTERNAL 0
115 
116 /* General options, stored in bits 4-11 */
117 #define GPIO_CFG_INPUT_INTERNAL (PIN_TYPE_STD | PIN_DIR_MODE_IN)
118 #define GPIO_CFG_OUTPUT_INTERNAL (PIN_TYPE_STD | PIN_DIR_MODE_OUT)
119 #define GPIO_CFG_OUTPUT_OPEN_DRAIN_INTERNAL (PIN_TYPE_OD | PIN_DIR_MODE_OUT)
120 
121 #define GPIO_CFG_PULL_NONE_INTERNAL PIN_TYPE_STD
122 #define GPIO_CFG_PULL_UP_INTERNAL PIN_TYPE_STD_PU
123 #define GPIO_CFG_PULL_DOWN_INTERNAL PIN_TYPE_STD_PD
124 
125 #define GPIO_CFG_DRVSTR_LOW_INTERNAL PIN_STRENGTH_2MA
126 #define GPIO_CFG_DRVSTR_MED_INTERNAL PIN_STRENGTH_4MA
127 #define GPIO_CFG_DRVSTR_HIGH_INTERNAL PIN_STRENGTH_6MA
128 
129 #define GPIO_CFG_NO_DIR_INTERNAL PIN_TYPE_ANALOG
130 
131 /* Hysteresis enable in bit 12 */
132 #define GPIO_CFG_HYSTERESIS_OFF_INTERNAL 0x0
133 #define GPIO_CFG_HYSTERESIS_ON_INTERNAL 0x1000
134 
135 /* Default enable in bit 13 */
136 #define GPIO_CFG_OUTPUT_DEFAULT_LOW_INTERNAL 0x0
137 #define GPIO_CFG_OUTPUT_DEFAULT_HIGH_INTERNAL 0x2000
138 
139 #ifdef __cplusplus
140 }
141 #endif
142 
143 #endif /* ti_drivers_GPIOCC32XX__include */
General Purpose I/O driver interface.
© Copyright 1995-2021, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale