+/rtos

git clone https://git.julia.blue/+/rtos

Joseph RyanRedo adc initialization0f0b895

master
10.4 KiB222 linesraw
1//*****************************************************************************
2//
3// hw_gpio.h - Defines and Macros for GPIO hardware.
4//
5// Copyright (c) 2005-2017 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.1.4.178 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                                                         \
86    0x00000100                    // GPIO uDMA Done Interrupt Mask
87                                  // Enable
88#define GPIO_IM_GPIO_M 0x000000FF // GPIO Interrupt Mask Enable
89#define GPIO_IM_GPIO_S 0
90
91//*****************************************************************************
92//
93// The following are defines for the bit fields in the GPIO_O_RIS register.
94//
95//*****************************************************************************
96#define GPIO_RIS_DMARIS                                                        \
97    0x00000100                     // GPIO uDMA Done Interrupt Raw
98                                   // Status
99#define GPIO_RIS_GPIO_M 0x000000FF // GPIO Interrupt Raw Status
100#define GPIO_RIS_GPIO_S 0
101
102//*****************************************************************************
103//
104// The following are defines for the bit fields in the GPIO_O_MIS register.
105//
106//*****************************************************************************
107#define GPIO_MIS_DMAMIS                                                        \
108    0x00000100                     // GPIO uDMA Done Masked Interrupt
109                                   // Status
110#define GPIO_MIS_GPIO_M 0x000000FF // GPIO Masked Interrupt Status
111#define GPIO_MIS_GPIO_S 0
112
113//*****************************************************************************
114//
115// The following are defines for the bit fields in the GPIO_O_ICR register.
116//
117//*****************************************************************************
118#define GPIO_ICR_DMAIC 0x00000100  // GPIO uDMA Interrupt Clear
119#define GPIO_ICR_GPIO_M 0x000000FF // GPIO Interrupt Clear
120#define GPIO_ICR_GPIO_S 0
121
122//*****************************************************************************
123//
124// The following are defines for the bit fields in the GPIO_O_LOCK register.
125//
126//*****************************************************************************
127#define GPIO_LOCK_M 0xFFFFFFFF // GPIO Lock
128#define GPIO_LOCK_UNLOCKED                                                     \
129    0x00000000 // The GPIOCR register is unlocked
130               // and may be modified
131#define GPIO_LOCK_LOCKED                                                       \
132    0x00000001                   // The GPIOCR register is locked
133                                 // and may not be modified
134#define GPIO_LOCK_KEY 0x4C4F434B // Unlocks the GPIO_CR register
135
136//*****************************************************************************
137//
138// The following are defines for the bit fields in the GPIO_O_SI register.
139//
140//*****************************************************************************
141#define GPIO_SI_SUM 0x00000001 // Summary Interrupt
142
143//*****************************************************************************
144//
145// The following are defines for the bit fields in the GPIO_O_DR12R register.
146//
147//*****************************************************************************
148#define GPIO_DR12R_DRV12_M 0x000000FF // Output Pad 12-mA Drive Enable
149#define GPIO_DR12R_DRV12_12MA                                                  \
150    0x00000001 // The corresponding GPIO pin has
151               // 12-mA drive. This encoding is
152               // only valid if the GPIOPP EDE bit
153               // is set and the appropriate
154               // GPIOPC EDM bit field is
155               // programmed to 0x3
156
157//*****************************************************************************
158//
159// The following are defines for the bit fields in the GPIO_O_WAKEPEN register.
160//
161//*****************************************************************************
162#define GPIO_WAKEPEN_WAKEP4 0x00000010 // P[4] Wake Enable
163
164//*****************************************************************************
165//
166// The following are defines for the bit fields in the GPIO_O_WAKELVL register.
167//
168//*****************************************************************************
169#define GPIO_WAKELVL_WAKELVL4 0x00000010 // P[4] Wake Level
170
171//*****************************************************************************
172//
173// The following are defines for the bit fields in the GPIO_O_WAKESTAT
174// register.
175//
176//*****************************************************************************
177#define GPIO_WAKESTAT_STAT4 0x00000010 // P[4] Wake Status
178
179//*****************************************************************************
180//
181// The following are defines for the bit fields in the GPIO_O_PP register.
182//
183//*****************************************************************************
184#define GPIO_PP_EDE 0x00000001 // Extended Drive Enable
185
186//*****************************************************************************
187//
188// The following are defines for the bit fields in the GPIO_O_PC register.
189//
190//*****************************************************************************
191#define GPIO_PC_EDM7_M 0x0000C000 // Extended Drive Mode Bit 7
192#define GPIO_PC_EDM6_M 0x00003000 // Extended Drive Mode Bit 6
193#define GPIO_PC_EDM5_M 0x00000C00 // Extended Drive Mode Bit 5
194#define GPIO_PC_EDM4_M 0x00000300 // Extended Drive Mode Bit 4
195#define GPIO_PC_EDM3_M 0x000000C0 // Extended Drive Mode Bit 3
196#define GPIO_PC_EDM2_M 0x00000030 // Extended Drive Mode Bit 2
197#define GPIO_PC_EDM1_M 0x0000000C // Extended Drive Mode Bit 1
198#define GPIO_PC_EDM0_M 0x00000003 // Extended Drive Mode Bit 0
199#define GPIO_PC_EDM0_DISABLE                                                   \
200    0x00000000 // Drive values of 2, 4 and 8 mA
201               // are maintained. GPIO n Drive
202               // Select (GPIODRnR) registers
203               // function as normal
204#define GPIO_PC_EDM0_6MA                                                       \
205    0x00000001 // An additional 6 mA option is
206               // provided
207#define GPIO_PC_EDM0_PLUS2MA                                                   \
208    0x00000003 // A 2 mA driver is always enabled;
209               // setting the corresponding
210               // GPIODR4R register bit adds 2 mA
211               // and setting the corresponding
212               // GPIODR8R of GPIODR12R register
213               // bit adds an additional 4 mA
214#define GPIO_PC_EDM7_S 14
215#define GPIO_PC_EDM6_S 12
216#define GPIO_PC_EDM5_S 10
217#define GPIO_PC_EDM4_S 8
218#define GPIO_PC_EDM3_S 6
219#define GPIO_PC_EDM2_S 4
220#define GPIO_PC_EDM1_S 2
221
222#endif // __HW_GPIO_H__