mikroSDK Reference Manual
hw_gpio.h
1//*****************************************************************************
2//
3// hw_gpio.h - Defines and Macros for GPIO hardware.
4//
5// Copyright (c) 2005-2020 Texas Instruments Incorporated. All rights reserved.
6// Software License Agreement
7//
8// Redistribution and use in source and binary forms, with or without
9// modification, are permitted provided that the following conditions
10// are met:
11//
12// Redistributions of source code must retain the above copyright
13// notice, this list of conditions and the following disclaimer.
14//
15// Redistributions in binary form must reproduce the above copyright
16// notice, this list of conditions and the following disclaimer in the
17// documentation and/or other materials provided with the
18// distribution.
19//
20// Neither the name of Texas Instruments Incorporated nor the names of
21// its contributors may be used to endorse or promote products derived
22// from this software without specific prior written permission.
23//
24// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
27// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
28// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
30// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35//
36// This is part of revision 2.2.0.295 of the Tiva Firmware Development Package.
37//
38//*****************************************************************************
39
40#ifndef __HW_GPIO_H__
41#define __HW_GPIO_H__
42
43//*****************************************************************************
44//
45// The following are defines for the GPIO register offsets.
46//
47//*****************************************************************************
48#define GPIO_O_DATA 0x00000000 // GPIO Data
49#define GPIO_O_DIR 0x00000400 // GPIO Direction
50#define GPIO_O_IS 0x00000404 // GPIO Interrupt Sense
51#define GPIO_O_IBE 0x00000408 // GPIO Interrupt Both Edges
52#define GPIO_O_IEV 0x0000040C // GPIO Interrupt Event
53#define GPIO_O_IM 0x00000410 // GPIO Interrupt Mask
54#define GPIO_O_RIS 0x00000414 // GPIO Raw Interrupt Status
55#define GPIO_O_MIS 0x00000418 // GPIO Masked Interrupt Status
56#define GPIO_O_ICR 0x0000041C // GPIO Interrupt Clear
57#define GPIO_O_AFSEL 0x00000420 // GPIO Alternate Function Select
58#define GPIO_O_DR2R 0x00000500 // GPIO 2-mA Drive Select
59#define GPIO_O_DR4R 0x00000504 // GPIO 4-mA Drive Select
60#define GPIO_O_DR8R 0x00000508 // GPIO 8-mA Drive Select
61#define GPIO_O_ODR 0x0000050C // GPIO Open Drain Select
62#define GPIO_O_PUR 0x00000510 // GPIO Pull-Up Select
63#define GPIO_O_PDR 0x00000514 // GPIO Pull-Down Select
64#define GPIO_O_SLR 0x00000518 // GPIO Slew Rate Control Select
65#define GPIO_O_DEN 0x0000051C // GPIO Digital Enable
66#define GPIO_O_LOCK 0x00000520 // GPIO Lock
67#define GPIO_O_CR 0x00000524 // GPIO Commit
68#define GPIO_O_AMSEL 0x00000528 // GPIO Analog Mode Select
69#define GPIO_O_PCTL 0x0000052C // GPIO Port Control
70#define GPIO_O_ADCCTL 0x00000530 // GPIO ADC Control
71#define GPIO_O_DMACTL 0x00000534 // GPIO DMA Control
72#define GPIO_O_SI 0x00000538 // GPIO Select Interrupt
73#define GPIO_O_DR12R 0x0000053C // GPIO 12-mA Drive Select
74#define GPIO_O_WAKEPEN 0x00000540 // GPIO Wake Pin Enable
75#define GPIO_O_WAKELVL 0x00000544 // GPIO Wake Level
76#define GPIO_O_WAKESTAT 0x00000548 // GPIO Wake Status
77#define GPIO_O_PP 0x00000FC0 // GPIO Peripheral Property
78#define GPIO_O_PC 0x00000FC4 // GPIO Peripheral Configuration
79
80//*****************************************************************************
81//
82// The following are defines for the bit fields in the GPIO_O_IM register.
83//
84//*****************************************************************************
85#define GPIO_IM_DMAIME 0x00000100 // GPIO uDMA Done Interrupt Mask
86 // Enable
87#define GPIO_IM_GPIO_M 0x000000FF // GPIO Interrupt Mask Enable
88#define GPIO_IM_GPIO_S 0
89
90//*****************************************************************************
91//
92// The following are defines for the bit fields in the GPIO_O_RIS register.
93//
94//*****************************************************************************
95#define GPIO_RIS_DMARIS 0x00000100 // GPIO uDMA Done Interrupt Raw
96 // Status
97#define GPIO_RIS_GPIO_M 0x000000FF // GPIO Interrupt Raw Status
98#define GPIO_RIS_GPIO_S 0
99
100//*****************************************************************************
101//
102// The following are defines for the bit fields in the GPIO_O_MIS register.
103//
104//*****************************************************************************
105#define GPIO_MIS_DMAMIS 0x00000100 // GPIO uDMA Done Masked Interrupt
106 // Status
107#define GPIO_MIS_GPIO_M 0x000000FF // GPIO Masked Interrupt Status
108#define GPIO_MIS_GPIO_S 0
109
110//*****************************************************************************
111//
112// The following are defines for the bit fields in the GPIO_O_ICR register.
113//
114//*****************************************************************************
115#define GPIO_ICR_DMAIC 0x00000100 // GPIO uDMA Interrupt Clear
116#define GPIO_ICR_GPIO_M 0x000000FF // GPIO Interrupt Clear
117#define GPIO_ICR_GPIO_S 0
118
119//*****************************************************************************
120//
121// The following are defines for the bit fields in the GPIO_O_LOCK register.
122//
123//*****************************************************************************
124#define GPIO_LOCK_M 0xFFFFFFFF // GPIO Lock
125#define GPIO_LOCK_UNLOCKED 0x00000000 // The GPIOCR register is unlocked
126 // and may be modified
127#define GPIO_LOCK_LOCKED 0x00000001 // The GPIOCR register is locked
128 // and may not be modified
129#define GPIO_LOCK_KEY 0x4C4F434B // Unlocks the GPIO_CR register
130
131//*****************************************************************************
132//
133// The following are defines for the bit fields in the GPIO_O_SI register.
134//
135//*****************************************************************************
136#define GPIO_SI_SUM 0x00000001 // Summary Interrupt
137
138//*****************************************************************************
139//
140// The following are defines for the bit fields in the GPIO_O_DR12R register.
141//
142//*****************************************************************************
143#define GPIO_DR12R_DRV12_M 0x000000FF // Output Pad 12-mA Drive Enable
144#define GPIO_DR12R_DRV12_12MA 0x00000001 // The corresponding GPIO pin has
145 // 12-mA drive. This encoding is
146 // only valid if the GPIOPP EDE bit
147 // is set and the appropriate
148 // GPIOPC EDM bit field is
149 // programmed to 0x3
150
151//*****************************************************************************
152//
153// The following are defines for the bit fields in the GPIO_O_WAKEPEN register.
154//
155//*****************************************************************************
156#define GPIO_WAKEPEN_WAKEP4 0x00000010 // P[4] Wake Enable
157
158//*****************************************************************************
159//
160// The following are defines for the bit fields in the GPIO_O_WAKELVL register.
161//
162//*****************************************************************************
163#define GPIO_WAKELVL_WAKELVL4 0x00000010 // P[4] Wake Level
164
165//*****************************************************************************
166//
167// The following are defines for the bit fields in the GPIO_O_WAKESTAT
168// register.
169//
170//*****************************************************************************
171#define GPIO_WAKESTAT_STAT4 0x00000010 // P[4] Wake Status
172
173//*****************************************************************************
174//
175// The following are defines for the bit fields in the GPIO_O_PP register.
176//
177//*****************************************************************************
178#define GPIO_PP_EDE 0x00000001 // Extended Drive Enable
179
180//*****************************************************************************
181//
182// The following are defines for the bit fields in the GPIO_O_PC register.
183//
184//*****************************************************************************
185#define GPIO_PC_EDM7_M 0x0000C000 // Extended Drive Mode Bit 7
186#define GPIO_PC_EDM6_M 0x00003000 // Extended Drive Mode Bit 6
187#define GPIO_PC_EDM5_M 0x00000C00 // Extended Drive Mode Bit 5
188#define GPIO_PC_EDM4_M 0x00000300 // Extended Drive Mode Bit 4
189#define GPIO_PC_EDM3_M 0x000000C0 // Extended Drive Mode Bit 3
190#define GPIO_PC_EDM2_M 0x00000030 // Extended Drive Mode Bit 2
191#define GPIO_PC_EDM1_M 0x0000000C // Extended Drive Mode Bit 1
192#define GPIO_PC_EDM0_M 0x00000003 // Extended Drive Mode Bit 0
193#define GPIO_PC_EDM0_DISABLE 0x00000000 // Drive values of 2, 4 and 8 mA
194 // are maintained. GPIO n Drive
195 // Select (GPIODRnR) registers
196 // function as normal
197#define GPIO_PC_EDM0_6MA 0x00000001 // An additional 6 mA option is
198 // provided
199#define GPIO_PC_EDM0_PLUS2MA 0x00000003 // A 2 mA driver is always enabled;
200 // setting the corresponding
201 // GPIODR4R register bit adds 2 mA
202 // and setting the corresponding
203 // GPIODR8R of GPIODR12R register
204 // bit adds an additional 4 mA
205#define GPIO_PC_EDM7_S 14
206#define GPIO_PC_EDM6_S 12
207#define GPIO_PC_EDM5_S 10
208#define GPIO_PC_EDM4_S 8
209#define GPIO_PC_EDM3_S 6
210#define GPIO_PC_EDM2_S 4
211#define GPIO_PC_EDM1_S 2
212
213#endif // __HW_GPIO_H__