source
ti
drivers
gpio
GPIOCC26XX.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2015-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_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
/* Most configuration values are directly mapped to fields in the IOCFGn
78
* registers, but the lower 8 bits are reserved for configuration options that
79
* cannot be directly mapped to the IOCFGn registers. The define below is the
80
* mask used by the GPIO driver to mask off the non-IOC configuration values.
81
*/
82
#define GPIOCC26XX_CFG_IOC_M 0xFFFFFF00
83
84
/* Low and high value interrupts are not available on CC26XX hardware */
85
#define GPIO_CFG_INT_LOW_INTERNAL GPIOCC26XX_CFG_OPTION_NOT_SUPPORTED
86
#define GPIO_CFG_INT_HIGH_INTERNAL GPIOCC26XX_CFG_OPTION_NOT_SUPPORTED
87
88
/* Support for DO_NOT_CONFIG would break a major initialisation optimisation */
89
#define GPIO_CFG_DO_NOT_CONFIG_INTERNAL GPIOCC26XX_CFG_OPTION_NOT_SUPPORTED
90
91
/* See GPIO.h for details about these configuration values */
92
93
/* General options remapped directly to IOC defines */
94
#define GPIO_CFG_NO_DIR_INTERNAL (IOC_IOCFG0_IOMODE_NORMAL | GPIOCC26XX_CFG_PIN_IS_INPUT_INTERNAL)
95
#define GPIO_CFG_INPUT_INTERNAL (IOC_IOCFG0_IOMODE_NORMAL | IOC_IOCFG0_IE | GPIOCC26XX_CFG_PIN_IS_INPUT_INTERNAL)
96
#define GPIO_CFG_OUTPUT_INTERNAL (IOC_IOCFG0_IOMODE_NORMAL | IOC_IOCFG0_IE | GPIOCC26XX_CFG_PIN_IS_OUTPUT_INTERNAL)
97
#define GPIO_CFG_OUTPUT_OPEN_DRAIN_INTERNAL \
98
(IOC_IOCFG0_IOMODE_OPENDR | IOC_IOCFG0_IE | GPIOCC26XX_CFG_PIN_IS_OUTPUT_INTERNAL)
99
#define GPIO_CFG_OUT_OPEN_SOURCE_INTERNAL \
100
(IOC_IOCFG0_IOMODE_OPENSRC | IOC_IOCFG0_IE | GPIOCC26XX_CFG_PIN_IS_OUTPUT_INTERNAL)
101
102
#define GPIO_CFG_PULL_NONE_INTERNAL IOC_IOCFG0_PULL_CTL_DIS
103
#define GPIO_CFG_PULL_UP_INTERNAL IOC_IOCFG0_PULL_CTL_UP
104
#define GPIO_CFG_PULL_DOWN_INTERNAL IOC_IOCFG0_PULL_CTL_DWN
105
106
#define GPIO_CFG_INT_NONE_INTERNAL IOC_IOCFG0_EDGE_DET_NONE
107
#define GPIO_CFG_INT_FALLING_INTERNAL IOC_IOCFG0_EDGE_DET_NEG
108
#define GPIO_CFG_INT_RISING_INTERNAL IOC_IOCFG0_EDGE_DET_POS
109
#define GPIO_CFG_INT_BOTH_EDGES_INTERNAL IOC_IOCFG0_EDGE_DET_BOTH
110
111
#define GPIO_CFG_INT_ENABLE_INTERNAL IOC_IOCFG0_EDGE_IRQ_EN
112
#define GPIO_CFG_INT_DISABLE_INTERNAL 0
113
114
/* Value inversion is stored in the low bit of IOMODE */
115
#define GPIO_CFG_INVERT_OFF_INTERNAL 0
116
#define GPIO_CFG_INVERT_ON_INTERNAL IOC_IOCFG0_IOMODE_INV
117
118
#define GPIO_CFG_HYSTERESIS_OFF_INTERNAL 0
119
#define GPIO_CFG_HYSTERESIS_ON_INTERNAL IOC_IOCFG0_HYST_EN
120
121
#define GPIO_CFG_SLEW_NORMAL_INTERNAL 0
122
#define GPIO_CFG_SLEW_REDUCED_INTERNAL IOC_IOCFG0_SLEW_RED
123
124
#define GPIO_CFG_DRVSTR_LOW_INTERNAL IOC_IOCFG0_IOCURR_2MA
125
#define GPIO_CFG_DRVSTR_MED_INTERNAL IOC_IOCFG0_IOCURR_4MA
126
#define GPIO_CFG_DRVSTR_HIGH_INTERNAL IOC_IOCFG0_IOCURR_4_8MA
127
128
#define GPIO_CFG_SHUTDOWN_WAKE_OFF_INTERNAL 0
129
#define GPIO_CFG_SHUTDOWN_WAKE_HIGH_INTERNAL IOC_WAKE_ON_HIGH
130
#define GPIO_CFG_SHUTDOWN_WAKE_LOW_INTERNAL IOC_WAKE_ON_LOW
131
132
/* We can hide some settings inside the MUX byte if they are not part of the
133
* IOC config, since the mux is applied separately. On CC26XX this is the
134
* lowest 8 bits.
135
*
136
* Do not use these values when calling GPIO_setConfig(). They are for
137
* internal use only, to provide support for driver functionality that does
138
* not map directly into the IO config registers.
139
*/
140
#define GPIO_CFG_OUTPUT_DEFAULT_HIGH_INTERNAL 0x1
141
#define GPIO_CFG_OUTPUT_DEFAULT_LOW_INTERNAL 0
142
143
/* Whether GPIO hardware should have the output enable bit set for this pin */
144
#define GPIOCC26XX_CFG_PIN_IS_INPUT_INTERNAL 0x2
145
#define GPIOCC26XX_CFG_PIN_IS_OUTPUT_INTERNAL 0
146
147
#ifdef __cplusplus
148
}
149
#endif
150
151
#endif
/* ti_drivers_GPIOCC26XX__include */
GPIO.h
General Purpose I/O driver interface.
© Copyright 1995-2023
, Texas Instruments Incorporated. All rights reserved.
Trademarks
|
Privacy policy
|
Terms of use
|
Terms of sale