]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_MPU_M23_Nuvoton_NuMaker_PFM_M2351_IAR_GCC/Nuvoton_Code/StdDriver/inc/gpio.h
Add Cortex M23 GCC and IAR ports. Add demo projects for Nuvoton NuMaker-PFM-2351.
[freertos] / FreeRTOS / Demo / CORTEX_MPU_M23_Nuvoton_NuMaker_PFM_M2351_IAR_GCC / Nuvoton_Code / StdDriver / inc / gpio.h
1 /**************************************************************************//**\r
2  * @file     GPIO.h\r
3  * @version  V3.0\r
4  * @brief    M2351 series General Purpose I/O (GPIO) driver header file\r
5  *\r
6  * @note\r
7  * Copyright (C) 2016 Nuvoton Technology Corp. All rights reserved.\r
8  *\r
9  ******************************************************************************/\r
10 #ifndef __GPIO_H__\r
11 #define __GPIO_H__\r
12 \r
13 #ifdef __cplusplus\r
14 extern "C"\r
15 {\r
16 #endif\r
17 \r
18 \r
19 /** @addtogroup Standard_Driver Standard Driver\r
20   @{\r
21 */\r
22 \r
23 /** @addtogroup GPIO_Driver GPIO Driver\r
24   @{\r
25 */\r
26 \r
27 /** @addtogroup GPIO_EXPORTED_CONSTANTS GPIO Exported Constants\r
28   @{\r
29 */\r
30 \r
31 #define GPIO_PIN_MAX            16UL /*!< Specify Maximum Pins of Each GPIO Port */\r
32 \r
33 \r
34 /*---------------------------------------------------------------------------------------------------------*/\r
35 /*  GPIO_MODE Constant Definitions                                                                               */\r
36 /*---------------------------------------------------------------------------------------------------------*/\r
37 #define GPIO_MODE_INPUT          0x0UL /*!< Input Mode */\r
38 #define GPIO_MODE_OUTPUT         0x1UL /*!< Output Mode */\r
39 #define GPIO_MODE_OPEN_DRAIN     0x2UL /*!< Open-Drain Mode */\r
40 #define GPIO_MODE_QUASI          0x3UL /*!< Quasi-bidirectional Mode */\r
41 \r
42 \r
43 /*---------------------------------------------------------------------------------------------------------*/\r
44 /*  GPIO Interrupt Type Constant Definitions                                                               */\r
45 /*---------------------------------------------------------------------------------------------------------*/\r
46 #define GPIO_INT_RISING         0x00010000UL /*!< Interrupt enable by Input Rising Edge */\r
47 #define GPIO_INT_FALLING        0x00000001UL /*!< Interrupt enable by Input Falling Edge */\r
48 #define GPIO_INT_BOTH_EDGE      0x00010001UL /*!< Interrupt enable by both Rising Edge and Falling Edge */\r
49 #define GPIO_INT_HIGH           0x01010000UL /*!< Interrupt enable by Level-High */\r
50 #define GPIO_INT_LOW            0x01000001UL /*!< Interrupt enable by Level-Level */\r
51 \r
52 \r
53 /*---------------------------------------------------------------------------------------------------------*/\r
54 /*  GPIO_INTTYPE Constant Definitions                                                                               */\r
55 /*---------------------------------------------------------------------------------------------------------*/\r
56 #define GPIO_INTTYPE_EDGE           0UL /*!< GPIO_INTTYPE Setting for Edge Trigger Mode */\r
57 #define GPIO_INTTYPE_LEVEL          1UL /*!< GPIO_INTTYPE Setting for Edge Level Mode */\r
58 \r
59 \r
60 /*---------------------------------------------------------------------------------------------------------*/\r
61 /*  GPIO Slew Rate Type Constant Definitions                                                               */\r
62 /*---------------------------------------------------------------------------------------------------------*/\r
63 #define GPIO_SLEWCTL_NORMAL         0x0UL           /*!< GPIO slew setting for normal Mode */\r
64 #define GPIO_SLEWCTL_HIGH           0x1UL           /*!< GPIO slew setting for high Mode */\r
65 #define GPIO_SLEWCTL_FAST           0x2UL           /*!< GPIO slew setting for fast Mode */\r
66 \r
67 \r
68 /*---------------------------------------------------------------------------------------------------------*/\r
69 /*  GPIO Pull-up And Pull-down Type Constant Definitions                                                   */\r
70 /*---------------------------------------------------------------------------------------------------------*/\r
71 #define GPIO_PUSEL_DISABLE          0x0UL           /*!< GPIO PUSEL setting for Disable Mode */\r
72 #define GPIO_PUSEL_PULL_UP          0x1UL           /*!< GPIO PUSEL setting for Pull-up Mode */\r
73 #define GPIO_PUSEL_PULL_DOWN        0x2UL           /*!< GPIO PUSEL setting for Pull-down Mode */\r
74 \r
75 \r
76 /*---------------------------------------------------------------------------------------------------------*/\r
77 /*  GPIO_DBCTL Constant Definitions                                                                        */\r
78 /*---------------------------------------------------------------------------------------------------------*/\r
79 #define GPIO_DBCTL_ICLK_ON            0x00000020UL /*!< GPIO_DBCTL setting for all IO pins edge detection circuit is always active after reset */\r
80 #define GPIO_DBCTL_ICLK_OFF           0x00000000UL /*!< GPIO_DBCTL setting for edge detection circuit is active only if IO pin corresponding GPIOx_IEN bit is set to 1 */\r
81 \r
82 #define GPIO_DBCTL_DBCLKSRC_LIRC      0x00000010UL /*!< GPIO_DBCTL setting for de-bounce counter clock source is the internal 10 kHz */\r
83 #define GPIO_DBCTL_DBCLKSRC_HCLK      0x00000000UL /*!< GPIO_DBCTL setting for de-bounce counter clock source is the HCLK */\r
84 \r
85 #define GPIO_DBCTL_DBCLKSEL_1         0x00000000UL /*!< GPIO_DBCTL setting for sampling cycle = 1 clocks */\r
86 #define GPIO_DBCTL_DBCLKSEL_2         0x00000001UL /*!< GPIO_DBCTL setting for sampling cycle = 2 clocks */\r
87 #define GPIO_DBCTL_DBCLKSEL_4         0x00000002UL /*!< GPIO_DBCTL setting for sampling cycle = 4 clocks */\r
88 #define GPIO_DBCTL_DBCLKSEL_8         0x00000003UL /*!< GPIO_DBCTL setting for sampling cycle = 8 clocks */\r
89 #define GPIO_DBCTL_DBCLKSEL_16        0x00000004UL /*!< GPIO_DBCTL setting for sampling cycle = 16 clocks */\r
90 #define GPIO_DBCTL_DBCLKSEL_32        0x00000005UL /*!< GPIO_DBCTL setting for sampling cycle = 32 clocks */\r
91 #define GPIO_DBCTL_DBCLKSEL_64        0x00000006UL /*!< GPIO_DBCTL setting for sampling cycle = 64 clocks */\r
92 #define GPIO_DBCTL_DBCLKSEL_128       0x00000007UL /*!< GPIO_DBCTL setting for sampling cycle = 128 clocks */\r
93 #define GPIO_DBCTL_DBCLKSEL_256       0x00000008UL /*!< GPIO_DBCTL setting for sampling cycle = 256 clocks */\r
94 #define GPIO_DBCTL_DBCLKSEL_512       0x00000009UL /*!< GPIO_DBCTL setting for sampling cycle = 512 clocks */\r
95 #define GPIO_DBCTL_DBCLKSEL_1024      0x0000000AUL /*!< GPIO_DBCTL setting for sampling cycle = 1024 clocks */\r
96 #define GPIO_DBCTL_DBCLKSEL_2048      0x0000000BUL /*!< GPIO_DBCTL setting for sampling cycle = 2048 clocks */\r
97 #define GPIO_DBCTL_DBCLKSEL_4096      0x0000000CUL /*!< GPIO_DBCTL setting for sampling cycle = 4096 clocks */\r
98 #define GPIO_DBCTL_DBCLKSEL_8192      0x0000000DUL /*!< GPIO_DBCTL setting for sampling cycle = 8192 clocks */\r
99 #define GPIO_DBCTL_DBCLKSEL_16384     0x0000000EUL /*!< GPIO_DBCTL setting for sampling cycle = 16384 clocks */\r
100 #define GPIO_DBCTL_DBCLKSEL_32768     0x0000000FUL /*!< GPIO_DBCTL setting for sampling cycle = 32768 clocks */\r
101 \r
102 \r
103 /** Define GPIO Pin Data Input/Output. It could be used to control each I/O pin by pin address mapping.\r
104  *  Example 1:\r
105  *\r
106  *      PA0 = 1;\r
107  *\r
108  *  It is used to set PA.0 to high;\r
109  *\r
110  *  Example 2:\r
111  *\r
112  *      if (PA0)\r
113  *          PA0 = 0;\r
114  *\r
115  *  If PA.0 pin status is high, then set PA.0 data output to low.\r
116  */\r
117 #define GPIO_PIN_DATA(port, pin)    (*((volatile uint32_t *)((GPIO_PIN_DATA_BASE+(0x40*(port))) + ((pin)<<2))))\r
118 #define PA0             GPIO_PIN_DATA(0, 0 ) /*!< Specify PA.0 Pin Data Input/Output */\r
119 #define PA1             GPIO_PIN_DATA(0, 1 ) /*!< Specify PA.1 Pin Data Input/Output */\r
120 #define PA2             GPIO_PIN_DATA(0, 2 ) /*!< Specify PA.2 Pin Data Input/Output */\r
121 #define PA3             GPIO_PIN_DATA(0, 3 ) /*!< Specify PA.3 Pin Data Input/Output */\r
122 #define PA4             GPIO_PIN_DATA(0, 4 ) /*!< Specify PA.4 Pin Data Input/Output */\r
123 #define PA5             GPIO_PIN_DATA(0, 5 ) /*!< Specify PA.5 Pin Data Input/Output */\r
124 #define PA6             GPIO_PIN_DATA(0, 6 ) /*!< Specify PA.6 Pin Data Input/Output */\r
125 #define PA7             GPIO_PIN_DATA(0, 7 ) /*!< Specify PA.7 Pin Data Input/Output */\r
126 #define PA8             GPIO_PIN_DATA(0, 8 ) /*!< Specify PA.8 Pin Data Input/Output */\r
127 #define PA9             GPIO_PIN_DATA(0, 9 ) /*!< Specify PA.9 Pin Data Input/Output */\r
128 #define PA10            GPIO_PIN_DATA(0, 10) /*!< Specify PA.10 Pin Data Input/Output */\r
129 #define PA11            GPIO_PIN_DATA(0, 11) /*!< Specify PA.11 Pin Data Input/Output */\r
130 #define PA12            GPIO_PIN_DATA(0, 12) /*!< Specify PA.12 Pin Data Input/Output */\r
131 #define PA13            GPIO_PIN_DATA(0, 13) /*!< Specify PA.13 Pin Data Input/Output */\r
132 #define PA14            GPIO_PIN_DATA(0, 14) /*!< Specify PA.14 Pin Data Input/Output */\r
133 #define PA15            GPIO_PIN_DATA(0, 15) /*!< Specify PA.15 Pin Data Input/Output */\r
134 #define PB0             GPIO_PIN_DATA(1, 0 ) /*!< Specify PB.0 Pin Data Input/Output */\r
135 #define PB1             GPIO_PIN_DATA(1, 1 ) /*!< Specify PB.1 Pin Data Input/Output */\r
136 #define PB2             GPIO_PIN_DATA(1, 2 ) /*!< Specify PB.2 Pin Data Input/Output */\r
137 #define PB3             GPIO_PIN_DATA(1, 3 ) /*!< Specify PB.3 Pin Data Input/Output */\r
138 #define PB4             GPIO_PIN_DATA(1, 4 ) /*!< Specify PB.4 Pin Data Input/Output */\r
139 #define PB5             GPIO_PIN_DATA(1, 5 ) /*!< Specify PB.5 Pin Data Input/Output */\r
140 #define PB6             GPIO_PIN_DATA(1, 6 ) /*!< Specify PB.6 Pin Data Input/Output */\r
141 #define PB7             GPIO_PIN_DATA(1, 7 ) /*!< Specify PB.7 Pin Data Input/Output */\r
142 #define PB8             GPIO_PIN_DATA(1, 8 ) /*!< Specify PB.8 Pin Data Input/Output */\r
143 #define PB9             GPIO_PIN_DATA(1, 9 ) /*!< Specify PB.9 Pin Data Input/Output */\r
144 #define PB10            GPIO_PIN_DATA(1, 10) /*!< Specify PB.10 Pin Data Input/Output */\r
145 #define PB11            GPIO_PIN_DATA(1, 11) /*!< Specify PB.11 Pin Data Input/Output */\r
146 #define PB12            GPIO_PIN_DATA(1, 12) /*!< Specify PB.12 Pin Data Input/Output */\r
147 #define PB13            GPIO_PIN_DATA(1, 13) /*!< Specify PB.13 Pin Data Input/Output */\r
148 #define PB14            GPIO_PIN_DATA(1, 14) /*!< Specify PB.14 Pin Data Input/Output */\r
149 #define PB15            GPIO_PIN_DATA(1, 15) /*!< Specify PB.15 Pin Data Input/Output */\r
150 #define PC0             GPIO_PIN_DATA(2, 0 ) /*!< Specify PC.0 Pin Data Input/Output */\r
151 #define PC1             GPIO_PIN_DATA(2, 1 ) /*!< Specify PC.1 Pin Data Input/Output */\r
152 #define PC2             GPIO_PIN_DATA(2, 2 ) /*!< Specify PC.2 Pin Data Input/Output */\r
153 #define PC3             GPIO_PIN_DATA(2, 3 ) /*!< Specify PC.3 Pin Data Input/Output */\r
154 #define PC4             GPIO_PIN_DATA(2, 4 ) /*!< Specify PC.4 Pin Data Input/Output */\r
155 #define PC5             GPIO_PIN_DATA(2, 5 ) /*!< Specify PC.5 Pin Data Input/Output */\r
156 #define PC6             GPIO_PIN_DATA(2, 6 ) /*!< Specify PC.6 Pin Data Input/Output */\r
157 #define PC7             GPIO_PIN_DATA(2, 7 ) /*!< Specify PC.7 Pin Data Input/Output */\r
158 #define PC8             GPIO_PIN_DATA(2, 8 ) /*!< Specify PC.8 Pin Data Input/Output */\r
159 #define PC9             GPIO_PIN_DATA(2, 9 ) /*!< Specify PC.9 Pin Data Input/Output */\r
160 #define PC10            GPIO_PIN_DATA(2, 10) /*!< Specify PC.10 Pin Data Input/Output */\r
161 #define PC11            GPIO_PIN_DATA(2, 11) /*!< Specify PC.11 Pin Data Input/Output */\r
162 #define PC12            GPIO_PIN_DATA(2, 12) /*!< Specify PC.12 Pin Data Input/Output */\r
163 #define PC13            GPIO_PIN_DATA(2, 13) /*!< Specify PC.13 Pin Data Input/Output */\r
164 #define PD0             GPIO_PIN_DATA(3, 0 ) /*!< Specify PD.0 Pin Data Input/Output */\r
165 #define PD1             GPIO_PIN_DATA(3, 1 ) /*!< Specify PD.1 Pin Data Input/Output */\r
166 #define PD2             GPIO_PIN_DATA(3, 2 ) /*!< Specify PD.2 Pin Data Input/Output */\r
167 #define PD3             GPIO_PIN_DATA(3, 3 ) /*!< Specify PD.3 Pin Data Input/Output */\r
168 #define PD4             GPIO_PIN_DATA(3, 4 ) /*!< Specify PD.4 Pin Data Input/Output */\r
169 #define PD5             GPIO_PIN_DATA(3, 5 ) /*!< Specify PD.5 Pin Data Input/Output */\r
170 #define PD6             GPIO_PIN_DATA(3, 6 ) /*!< Specify PD.6 Pin Data Input/Output */\r
171 #define PD7             GPIO_PIN_DATA(3, 7 ) /*!< Specify PD.7 Pin Data Input/Output */\r
172 #define PD8             GPIO_PIN_DATA(3, 8 ) /*!< Specify PD.8 Pin Data Input/Output */\r
173 #define PD9             GPIO_PIN_DATA(3, 9 ) /*!< Specify PD.9 Pin Data Input/Output */\r
174 #define PD10            GPIO_PIN_DATA(3, 10) /*!< Specify PD.10 Pin Data Input/Output */\r
175 #define PD11            GPIO_PIN_DATA(3, 11) /*!< Specify PD.11 Pin Data Input/Output */\r
176 #define PD12            GPIO_PIN_DATA(3, 12) /*!< Specify PD.12 Pin Data Input/Output */\r
177 #define PD13            GPIO_PIN_DATA(3, 13) /*!< Specify PD.13 Pin Data Input/Output */\r
178 #define PD14            GPIO_PIN_DATA(3, 14) /*!< Specify PD.14 Pin Data Input/Output */\r
179 #define PE0             GPIO_PIN_DATA(4, 0 ) /*!< Specify PE.0 Pin Data Input/Output */\r
180 #define PE1             GPIO_PIN_DATA(4, 1 ) /*!< Specify PE.1 Pin Data Input/Output */\r
181 #define PE2             GPIO_PIN_DATA(4, 2 ) /*!< Specify PE.2 Pin Data Input/Output */\r
182 #define PE3             GPIO_PIN_DATA(4, 3 ) /*!< Specify PE.3 Pin Data Input/Output */\r
183 #define PE4             GPIO_PIN_DATA(4, 4 ) /*!< Specify PE.4 Pin Data Input/Output */\r
184 #define PE5             GPIO_PIN_DATA(4, 5 ) /*!< Specify PE.5 Pin Data Input/Output */\r
185 #define PE6             GPIO_PIN_DATA(4, 6 ) /*!< Specify PE.6 Pin Data Input/Output */\r
186 #define PE7             GPIO_PIN_DATA(4, 7 ) /*!< Specify PE.7 Pin Data Input/Output */\r
187 #define PE8             GPIO_PIN_DATA(4, 8 ) /*!< Specify PE.8 Pin Data Input/Output */\r
188 #define PE9             GPIO_PIN_DATA(4, 9 ) /*!< Specify PE.9 Pin Data Input/Output */\r
189 #define PE10            GPIO_PIN_DATA(4, 10) /*!< Specify PE.10 Pin Data Input/Output */\r
190 #define PE11            GPIO_PIN_DATA(4, 11) /*!< Specify PE.11 Pin Data Input/Output */\r
191 #define PE12            GPIO_PIN_DATA(4, 12) /*!< Specify PE.12 Pin Data Input/Output */\r
192 #define PE13            GPIO_PIN_DATA(4, 13) /*!< Specify PE.13 Pin Data Input/Output */\r
193 #define PE14            GPIO_PIN_DATA(4, 14) /*!< Specify PE.14 Pin Data Input/Output */\r
194 #define PE15            GPIO_PIN_DATA(4, 15) /*!< Specify PE.15 Pin Data Input/Output */\r
195 #define PF0             GPIO_PIN_DATA(5, 0 ) /*!< Specify PF.0 Pin Data Input/Output */\r
196 #define PF1             GPIO_PIN_DATA(5, 1 ) /*!< Specify PF.1 Pin Data Input/Output */\r
197 #define PF2             GPIO_PIN_DATA(5, 2 ) /*!< Specify PF.2 Pin Data Input/Output */\r
198 #define PF3             GPIO_PIN_DATA(5, 3 ) /*!< Specify PF.3 Pin Data Input/Output */\r
199 #define PF4             GPIO_PIN_DATA(5, 4 ) /*!< Specify PF.4 Pin Data Input/Output */\r
200 #define PF5             GPIO_PIN_DATA(5, 5 ) /*!< Specify PF.5 Pin Data Input/Output */\r
201 #define PF6             GPIO_PIN_DATA(5, 6 ) /*!< Specify PF.6 Pin Data Input/Output */\r
202 #define PF7             GPIO_PIN_DATA(5, 7 ) /*!< Specify PF.7 Pin Data Input/Output */\r
203 #define PF8             GPIO_PIN_DATA(5, 8 ) /*!< Specify PF.8 Pin Data Input/Output */\r
204 #define PF9             GPIO_PIN_DATA(5, 9 ) /*!< Specify PF.9 Pin Data Input/Output */\r
205 #define PF10            GPIO_PIN_DATA(5, 10) /*!< Specify PF.10 Pin Data Input/Output */\r
206 #define PF11            GPIO_PIN_DATA(5, 11) /*!< Specify PF.11 Pin Data Input/Output */\r
207 #define PG2             GPIO_PIN_DATA(6, 2 ) /*!< Specify PG.2 Pin Data Input/Output */\r
208 #define PG3             GPIO_PIN_DATA(6, 3 ) /*!< Specify PG.3 Pin Data Input/Output */\r
209 #define PG4             GPIO_PIN_DATA(6, 4 ) /*!< Specify PG.4 Pin Data Input/Output */\r
210 #define PG9             GPIO_PIN_DATA(6, 9 ) /*!< Specify PG.9 Pin Data Input/Output */\r
211 #define PG10            GPIO_PIN_DATA(6, 10) /*!< Specify PG.10 Pin Data Input/Output */\r
212 #define PG11            GPIO_PIN_DATA(6, 11) /*!< Specify PG.11 Pin Data Input/Output */\r
213 #define PG12            GPIO_PIN_DATA(6, 12) /*!< Specify PG.12 Pin Data Input/Output */\r
214 #define PG13            GPIO_PIN_DATA(6, 13) /*!< Specify PG.13 Pin Data Input/Output */\r
215 #define PG14            GPIO_PIN_DATA(6, 14) /*!< Specify PG.14 Pin Data Input/Output */\r
216 #define PG15            GPIO_PIN_DATA(6, 15) /*!< Specify PG.15 Pin Data Input/Output */\r
217 #define PH4             GPIO_PIN_DATA(7, 4 ) /*!< Specify PH.4 Pin Data Input/Output */\r
218 #define PH5             GPIO_PIN_DATA(7, 5 ) /*!< Specify PH.5 Pin Data Input/Output */\r
219 #define PH6             GPIO_PIN_DATA(7, 6 ) /*!< Specify PH.6 Pin Data Input/Output */\r
220 #define PH7             GPIO_PIN_DATA(7, 7 ) /*!< Specify PH.7 Pin Data Input/Output */\r
221 #define PH8             GPIO_PIN_DATA(7, 8 ) /*!< Specify PH.8 Pin Data Input/Output */\r
222 #define PH9             GPIO_PIN_DATA(7, 9 ) /*!< Specify PH.9 Pin Data Input/Output */\r
223 #define PH10            GPIO_PIN_DATA(7, 10) /*!< Specify PH.10 Pin Data Input/Output */\r
224 #define PH11            GPIO_PIN_DATA(7, 11) /*!< Specify PH.11 Pin Data Input/Output */\r
225 \r
226 /* GPIO bit definitions for non-secure */\r
227 #define GPIO_PIN_DATA_NS(port, pin)    (*((volatile uint32_t *)((GPIO_PIN_DATA_BASE+NS_OFFSET+(0x40*(port))) + ((pin)<<2))))\r
228 #define PA0_NS            GPIO_PIN_DATA_NS(0, 0 ) /*!< Specify PA.0 Pin Data Input/Output */\r
229 #define PA1_NS            GPIO_PIN_DATA_NS(0, 1 ) /*!< Specify PA.1 Pin Data Input/Output */\r
230 #define PA2_NS            GPIO_PIN_DATA_NS(0, 2 ) /*!< Specify PA.2 Pin Data Input/Output */\r
231 #define PA3_NS            GPIO_PIN_DATA_NS(0, 3 ) /*!< Specify PA.3 Pin Data Input/Output */\r
232 #define PA4_NS            GPIO_PIN_DATA_NS(0, 4 ) /*!< Specify PA.4 Pin Data Input/Output */\r
233 #define PA5_NS            GPIO_PIN_DATA_NS(0, 5 ) /*!< Specify PA.5 Pin Data Input/Output */\r
234 #define PA6_NS            GPIO_PIN_DATA_NS(0, 6 ) /*!< Specify PA.6 Pin Data Input/Output */\r
235 #define PA7_NS            GPIO_PIN_DATA_NS(0, 7 ) /*!< Specify PA.7 Pin Data Input/Output */\r
236 #define PA8_NS            GPIO_PIN_DATA_NS(0, 8 ) /*!< Specify PA.8 Pin Data Input/Output */\r
237 #define PA9_NS            GPIO_PIN_DATA_NS(0, 9 ) /*!< Specify PA.9 Pin Data Input/Output */\r
238 #define PA10_NS           GPIO_PIN_DATA_NS(0, 10) /*!< Specify PA.10 Pin Data Input/Output */\r
239 #define PA11_NS           GPIO_PIN_DATA_NS(0, 11) /*!< Specify PA.11 Pin Data Input/Output */\r
240 #define PA12_NS           GPIO_PIN_DATA_NS(0, 12) /*!< Specify PA.12 Pin Data Input/Output */\r
241 #define PA13_NS           GPIO_PIN_DATA_NS(0, 13) /*!< Specify PA.13 Pin Data Input/Output */\r
242 #define PA14_NS           GPIO_PIN_DATA_NS(0, 14) /*!< Specify PA.14 Pin Data Input/Output */\r
243 #define PA15_NS           GPIO_PIN_DATA_NS(0, 15) /*!< Specify PA.15 Pin Data Input/Output */\r
244 #define PB0_NS            GPIO_PIN_DATA_NS(1, 0 ) /*!< Specify PB.0 Pin Data Input/Output */\r
245 #define PB1_NS            GPIO_PIN_DATA_NS(1, 1 ) /*!< Specify PB.1 Pin Data Input/Output */\r
246 #define PB2_NS            GPIO_PIN_DATA_NS(1, 2 ) /*!< Specify PB.2 Pin Data Input/Output */\r
247 #define PB3_NS            GPIO_PIN_DATA_NS(1, 3 ) /*!< Specify PB.3 Pin Data Input/Output */\r
248 #define PB4_NS            GPIO_PIN_DATA_NS(1, 4 ) /*!< Specify PB.4 Pin Data Input/Output */\r
249 #define PB5_NS            GPIO_PIN_DATA_NS(1, 5 ) /*!< Specify PB.5 Pin Data Input/Output */\r
250 #define PB6_NS            GPIO_PIN_DATA_NS(1, 6 ) /*!< Specify PB.6 Pin Data Input/Output */\r
251 #define PB7_NS            GPIO_PIN_DATA_NS(1, 7 ) /*!< Specify PB.7 Pin Data Input/Output */\r
252 #define PB8_NS            GPIO_PIN_DATA_NS(1, 8 ) /*!< Specify PB.8 Pin Data Input/Output */\r
253 #define PB9_NS            GPIO_PIN_DATA_NS(1, 9 ) /*!< Specify PB.9 Pin Data Input/Output */\r
254 #define PB10_NS           GPIO_PIN_DATA_NS(1, 10) /*!< Specify PB.10 Pin Data Input/Output */\r
255 #define PB11_NS           GPIO_PIN_DATA_NS(1, 11) /*!< Specify PB.11 Pin Data Input/Output */\r
256 #define PB12_NS           GPIO_PIN_DATA_NS(1, 12) /*!< Specify PB.12 Pin Data Input/Output */\r
257 #define PB13_NS           GPIO_PIN_DATA_NS(1, 13) /*!< Specify PB.13 Pin Data Input/Output */\r
258 #define PB14_NS           GPIO_PIN_DATA_NS(1, 14) /*!< Specify PB.14 Pin Data Input/Output */\r
259 #define PB15_NS           GPIO_PIN_DATA_NS(1, 15) /*!< Specify PB.15 Pin Data Input/Output */\r
260 #define PC0_NS            GPIO_PIN_DATA_NS(2, 0 ) /*!< Specify PC.0 Pin Data Input/Output */\r
261 #define PC1_NS            GPIO_PIN_DATA_NS(2, 1 ) /*!< Specify PC.1 Pin Data Input/Output */\r
262 #define PC2_NS            GPIO_PIN_DATA_NS(2, 2 ) /*!< Specify PC.2 Pin Data Input/Output */\r
263 #define PC3_NS            GPIO_PIN_DATA_NS(2, 3 ) /*!< Specify PC.3 Pin Data Input/Output */\r
264 #define PC4_NS            GPIO_PIN_DATA_NS(2, 4 ) /*!< Specify PC.4 Pin Data Input/Output */\r
265 #define PC5_NS            GPIO_PIN_DATA_NS(2, 5 ) /*!< Specify PC.5 Pin Data Input/Output */\r
266 #define PC6_NS            GPIO_PIN_DATA_NS(2, 6 ) /*!< Specify PC.6 Pin Data Input/Output */\r
267 #define PC7_NS            GPIO_PIN_DATA_NS(2, 7 ) /*!< Specify PC.7 Pin Data Input/Output */\r
268 #define PC8_NS            GPIO_PIN_DATA_NS(2, 8 ) /*!< Specify PC.8 Pin Data Input/Output */\r
269 #define PC9_NS            GPIO_PIN_DATA_NS(2, 9 ) /*!< Specify PC.9 Pin Data Input/Output */\r
270 #define PC10_NS           GPIO_PIN_DATA_NS(2, 10) /*!< Specify PC.10 Pin Data Input/Output */\r
271 #define PC11_NS           GPIO_PIN_DATA_NS(2, 11) /*!< Specify PC.11 Pin Data Input/Output */\r
272 #define PC12_NS           GPIO_PIN_DATA_NS(2, 12) /*!< Specify PC.12 Pin Data Input/Output */\r
273 #define PC13_NS           GPIO_PIN_DATA_NS(2, 13) /*!< Specify PC.13 Pin Data Input/Output */\r
274 #define PD0_NS            GPIO_PIN_DATA_NS(3, 0 ) /*!< Specify PD.0 Pin Data Input/Output */\r
275 #define PD1_NS            GPIO_PIN_DATA_NS(3, 1 ) /*!< Specify PD.1 Pin Data Input/Output */\r
276 #define PD2_NS            GPIO_PIN_DATA_NS(3, 2 ) /*!< Specify PD.2 Pin Data Input/Output */\r
277 #define PD3_NS            GPIO_PIN_DATA_NS(3, 3 ) /*!< Specify PD.3 Pin Data Input/Output */\r
278 #define PD4_NS            GPIO_PIN_DATA_NS(3, 4 ) /*!< Specify PD.4 Pin Data Input/Output */\r
279 #define PD5_NS            GPIO_PIN_DATA_NS(3, 5 ) /*!< Specify PD.5 Pin Data Input/Output */\r
280 #define PD6_NS            GPIO_PIN_DATA_NS(3, 6 ) /*!< Specify PD.6 Pin Data Input/Output */\r
281 #define PD7_NS            GPIO_PIN_DATA_NS(3, 7 ) /*!< Specify PD.7 Pin Data Input/Output */\r
282 #define PD8_NS            GPIO_PIN_DATA_NS(3, 8 ) /*!< Specify PD.8 Pin Data Input/Output */\r
283 #define PD9_NS            GPIO_PIN_DATA_NS(3, 9 ) /*!< Specify PD.9 Pin Data Input/Output */\r
284 #define PD10_NS           GPIO_PIN_DATA_NS(3, 10) /*!< Specify PD.10 Pin Data Input/Output */\r
285 #define PD11_NS           GPIO_PIN_DATA_NS(3, 11) /*!< Specify PD.11 Pin Data Input/Output */\r
286 #define PD12_NS           GPIO_PIN_DATA_NS(3, 12) /*!< Specify PD.12 Pin Data Input/Output */\r
287 #define PD13_NS           GPIO_PIN_DATA_NS(3, 13) /*!< Specify PD.13 Pin Data Input/Output */\r
288 #define PD14_NS           GPIO_PIN_DATA_NS(3, 14) /*!< Specify PD.14 Pin Data Input/Output */\r
289 #define PE0_NS            GPIO_PIN_DATA_NS(4, 0 ) /*!< Specify PE.0 Pin Data Input/Output */\r
290 #define PE1_NS            GPIO_PIN_DATA_NS(4, 1 ) /*!< Specify PE.1 Pin Data Input/Output */\r
291 #define PE2_NS            GPIO_PIN_DATA_NS(4, 2 ) /*!< Specify PE.2 Pin Data Input/Output */\r
292 #define PE3_NS            GPIO_PIN_DATA_NS(4, 3 ) /*!< Specify PE.3 Pin Data Input/Output */\r
293 #define PE4_NS            GPIO_PIN_DATA_NS(4, 4 ) /*!< Specify PE.4 Pin Data Input/Output */\r
294 #define PE5_NS            GPIO_PIN_DATA_NS(4, 5 ) /*!< Specify PE.5 Pin Data Input/Output */\r
295 #define PE6_NS            GPIO_PIN_DATA_NS(4, 6 ) /*!< Specify PE.6 Pin Data Input/Output */\r
296 #define PE7_NS            GPIO_PIN_DATA_NS(4, 7 ) /*!< Specify PE.7 Pin Data Input/Output */\r
297 #define PE8_NS            GPIO_PIN_DATA_NS(4, 8 ) /*!< Specify PE.8 Pin Data Input/Output */\r
298 #define PE9_NS            GPIO_PIN_DATA_NS(4, 9 ) /*!< Specify PE.9 Pin Data Input/Output */\r
299 #define PE10_NS           GPIO_PIN_DATA_NS(4, 10) /*!< Specify PE.10 Pin Data Input/Output */\r
300 #define PE11_NS           GPIO_PIN_DATA_NS(4, 11) /*!< Specify PE.11 Pin Data Input/Output */\r
301 #define PE12_NS           GPIO_PIN_DATA_NS(4, 12) /*!< Specify PE.12 Pin Data Input/Output */\r
302 #define PE13_NS           GPIO_PIN_DATA_NS(4, 13) /*!< Specify PE.13 Pin Data Input/Output */\r
303 #define PE14_NS           GPIO_PIN_DATA_NS(4, 14) /*!< Specify PE.14 Pin Data Input/Output */\r
304 #define PE15_NS           GPIO_PIN_DATA_NS(4, 15) /*!< Specify PE.15 Pin Data Input/Output */\r
305 #define PF0_NS            GPIO_PIN_DATA_NS(5, 0 ) /*!< Specify PF.0 Pin Data Input/Output */\r
306 #define PF1_NS            GPIO_PIN_DATA_NS(5, 1 ) /*!< Specify PF.1 Pin Data Input/Output */\r
307 #define PF2_NS            GPIO_PIN_DATA_NS(5, 2 ) /*!< Specify PF.2 Pin Data Input/Output */\r
308 #define PF3_NS            GPIO_PIN_DATA_NS(5, 3 ) /*!< Specify PF.3 Pin Data Input/Output */\r
309 #define PF4_NS            GPIO_PIN_DATA_NS(5, 4 ) /*!< Specify PF.4 Pin Data Input/Output */\r
310 #define PF5_NS            GPIO_PIN_DATA_NS(5, 5 ) /*!< Specify PF.5 Pin Data Input/Output */\r
311 #define PF6_NS            GPIO_PIN_DATA_NS(5, 6 ) /*!< Specify PF.6 Pin Data Input/Output */\r
312 #define PF7_NS            GPIO_PIN_DATA_NS(5, 7 ) /*!< Specify PF.7 Pin Data Input/Output */\r
313 #define PF8_NS            GPIO_PIN_DATA_NS(5, 8 ) /*!< Specify PF.8 Pin Data Input/Output */\r
314 #define PF9_NS            GPIO_PIN_DATA_NS(5, 9 ) /*!< Specify PF.9 Pin Data Input/Output */\r
315 #define PF10_NS           GPIO_PIN_DATA_NS(5, 10) /*!< Specify PF.10 Pin Data Input/Output */\r
316 #define PF11_NS           GPIO_PIN_DATA_NS(5, 11) /*!< Specify PF.11 Pin Data Input/Output */\r
317 #define PG2_NS            GPIO_PIN_DATA_NS(6, 2 ) /*!< Specify PG.2 Pin Data Input/Output */\r
318 #define PG3_NS            GPIO_PIN_DATA_NS(6, 3 ) /*!< Specify PG.3 Pin Data Input/Output */\r
319 #define PG4_NS            GPIO_PIN_DATA_NS(6, 4 ) /*!< Specify PG.4 Pin Data Input/Output */\r
320 #define PG9_NS            GPIO_PIN_DATA_NS(6, 9 ) /*!< Specify PG.9 Pin Data Input/Output */\r
321 #define PG10_NS           GPIO_PIN_DATA_NS(6, 10) /*!< Specify PG.10 Pin Data Input/Output */\r
322 #define PG11_NS           GPIO_PIN_DATA_NS(6, 11) /*!< Specify PG.11 Pin Data Input/Output */\r
323 #define PG12_NS           GPIO_PIN_DATA_NS(6, 12) /*!< Specify PG.12 Pin Data Input/Output */\r
324 #define PG13_NS           GPIO_PIN_DATA_NS(6, 13) /*!< Specify PG.13 Pin Data Input/Output */\r
325 #define PG14_NS           GPIO_PIN_DATA_NS(6, 14) /*!< Specify PG.14 Pin Data Input/Output */\r
326 #define PG15_NS           GPIO_PIN_DATA_NS(6, 15) /*!< Specify PG.15 Pin Data Input/Output */\r
327 #define PH4_NS            GPIO_PIN_DATA_NS(7, 4 ) /*!< Specify PH.4 Pin Data Input/Output */\r
328 #define PH5_NS            GPIO_PIN_DATA_NS(7, 5 ) /*!< Specify PH.5 Pin Data Input/Output */\r
329 #define PH6_NS            GPIO_PIN_DATA_NS(7, 6 ) /*!< Specify PH.6 Pin Data Input/Output */\r
330 #define PH7_NS            GPIO_PIN_DATA_NS(7, 7 ) /*!< Specify PH.7 Pin Data Input/Output */\r
331 #define PH8_NS            GPIO_PIN_DATA_NS(7, 8 ) /*!< Specify PH.8 Pin Data Input/Output */\r
332 #define PH9_NS            GPIO_PIN_DATA_NS(7, 9 ) /*!< Specify PH.9 Pin Data Input/Output */\r
333 #define PH10_NS           GPIO_PIN_DATA_NS(7, 10) /*!< Specify PH.10 Pin Data Input/Output */\r
334 #define PH11_NS           GPIO_PIN_DATA_NS(7, 11) /*!< Specify PH.11 Pin Data Input/Output */\r
335 \r
336 \r
337 /*@}*/ /* end of group GPIO_EXPORTED_CONSTANTS */\r
338 \r
339 \r
340 /** @addtogroup GPIO_EXPORTED_FUNCTIONS GPIO Exported Functions\r
341   @{\r
342 */\r
343 \r
344 /**\r
345  * @brief       Clear GPIO Pin Interrupt Flag\r
346  *\r
347  * @param[in]   port        GPIO port. It could be PA, PB, PC, PD, PE, PF, PG or PH.\r
348  * @param[in]   u32PinMask  The single or multiple pins of specified GPIO port. \n\r
349  *                          It could be BIT0 ~ BIT15 for PA, PB, PC, PD and PF. \n\r
350  *                          It could be BIT0 ~ BIT13 for PE. \n\r
351  *                          It could be BIT1 ~ BIT5, BIT7 ~ BIT12 for PG.\r
352  *\r
353  * @return      None\r
354  *\r
355  * @details     Clear the interrupt status of specified GPIO pin.\r
356  */\r
357 #define GPIO_CLR_INT_FLAG(port, u32PinMask)         ((port)->INTSRC = (u32PinMask))\r
358 \r
359 /**\r
360  * @brief       Disable Pin De-bounce Function\r
361  *\r
362  * @param[in]   port        GPIO port. It could be PA, PB, PC, PD, PE, PF, PG or PH.\r
363  * @param[in]   u32PinMask  The single or multiple pins of specified GPIO port. \n\r
364  *                          It could be BIT0 ~ BIT15 for PA, PB and PE. \n\r
365  *                          It could be BIT0 ~ BIT13 for PC. \n\r
366  *                          It could be BIT0 ~ BIT14 for PD. \n\r
367  *                          It could be BIT0 ~ BIT11 for PF. \n\r
368  *                          It could be BIT2 ~ BIT3, BIT9 ~ BIT15 for PG. \n\r
369  *                          It could be BIT4 ~ BIT11 for PH.\r
370  *\r
371  * @return      None\r
372  *\r
373  * @details     Disable the interrupt de-bounce function of specified GPIO pin.\r
374  */\r
375 #define GPIO_DISABLE_DEBOUNCE(port, u32PinMask)     ((port)->DBEN &= ~(u32PinMask))\r
376 \r
377 /**\r
378  * @brief       Enable Pin De-bounce Function\r
379  *\r
380  * @param[in]   port        GPIO port. It could be PA, PB, PC, PD, PE, PF, PG or PH.\r
381  * @param[in]   u32PinMask  The single or multiple pins of specified GPIO port. \n\r
382  *                          It could be BIT0 ~ BIT15 for PA, PB and PE. \n\r
383  *                          It could be BIT0 ~ BIT13 for PC. \n\r
384  *                          It could be BIT0 ~ BIT14 for PD. \n\r
385  *                          It could be BIT0 ~ BIT11 for PF. \n\r
386  *                          It could be BIT2 ~ BIT3, BIT9 ~ BIT15 for PG. \n\r
387  *                          It could be BIT4 ~ BIT11 for PH.\r
388  * @return      None\r
389  *\r
390  * @details     Enable the interrupt de-bounce function of specified GPIO pin.\r
391  */\r
392 #define GPIO_ENABLE_DEBOUNCE(port, u32PinMask)      ((port)->DBEN |= (u32PinMask))\r
393 \r
394 /**\r
395  * @brief       Disable I/O Digital Input Path\r
396  *\r
397  * @param[in]   port        GPIO port. It could be PA, PB, PC, PD, PE, PF, PG or PH.\r
398  * @param[in]   u32PinMask  The single or multiple pins of specified GPIO port. \n\r
399  *                          It could be BIT0 ~ BIT15 for PA, PB and PE. \n\r
400  *                          It could be BIT0 ~ BIT13 for PC. \n\r
401  *                          It could be BIT0 ~ BIT14 for PD. \n\r
402  *                          It could be BIT0 ~ BIT11 for PF. \n\r
403  *                          It could be BIT2 ~ BIT3, BIT9 ~ BIT15 for PG. \n\r
404  *                          It could be BIT4 ~ BIT11 for PH.\r
405  *\r
406  * @return      None\r
407  *\r
408  * @details     Disable I/O digital input path of specified GPIO pin.\r
409  */\r
410 #define GPIO_DISABLE_DIGITAL_PATH(port, u32PinMask) ((port)->DINOFF |= ((u32PinMask)<<16))\r
411 \r
412 /**\r
413  * @brief       Enable I/O Digital Input Path\r
414  *\r
415  * @param[in]   port        GPIO port. It could be PA, PB, PC, PD, PE, PF, PG or PH.\r
416  * @param[in]   u32PinMask  The single or multiple pins of specified GPIO port. \n\r
417  *                          It could be BIT0 ~ BIT15 for PA, PB and PE. \n\r
418  *                          It could be BIT0 ~ BIT13 for PC. \n\r
419  *                          It could be BIT0 ~ BIT14 for PD. \n\r
420  *                          It could be BIT0 ~ BIT11 for PF. \n\r
421  *                          It could be BIT2 ~ BIT3, BIT9 ~ BIT15 for PG. \n\r
422  *                          It could be BIT4 ~ BIT11 for PH.\r
423  *\r
424  * @return      None\r
425  *\r
426  * @details     Enable I/O digital input path of specified GPIO pin.\r
427  */\r
428 #define GPIO_ENABLE_DIGITAL_PATH(port, u32PinMask)  ((port)->DINOFF &= ~((u32PinMask)<<16))\r
429 \r
430 /**\r
431  * @brief       Disable I/O DOUT mask\r
432  *\r
433  * @param[in]   port        GPIO port. It could be PA, PB, PC, PD, PE, PF, PG or PH.\r
434  * @param[in]   u32PinMask  The single or multiple pins of specified GPIO port. \n\r
435  *                          It could be BIT0 ~ BIT15 for PA, PB and PE. \n\r
436  *                          It could be BIT0 ~ BIT13 for PC. \n\r
437  *                          It could be BIT0 ~ BIT14 for PD. \n\r
438  *                          It could be BIT0 ~ BIT11 for PF. \n\r
439  *                          It could be BIT2 ~ BIT3, BIT9 ~ BIT15 for PG. \n\r
440  *                          It could be BIT4 ~ BIT11 for PH.\r
441  *\r
442  * @return      None\r
443  *\r
444  * @details     Disable I/O DOUT mask of specified GPIO pin.\r
445  */\r
446 #define GPIO_DISABLE_DOUT_MASK(port, u32PinMask)    ((port)->DATMSK &= ~(u32PinMask))\r
447 \r
448 /**\r
449  * @brief       Enable I/O DOUT mask\r
450  *\r
451  * @param[in]   port        GPIO port. It could be PA, PB, PC, PD, PE, PF, PG or PH.\r
452  * @param[in]   u32PinMask  The single or multiple pins of specified GPIO port. \n\r
453  *                          It could be BIT0 ~ BIT15 for PA, PB and PE. \n\r
454  *                          It could be BIT0 ~ BIT13 for PC. \n\r
455  *                          It could be BIT0 ~ BIT14 for PD. \n\r
456  *                          It could be BIT0 ~ BIT11 for PF. \n\r
457  *                          It could be BIT2 ~ BIT3, BIT9 ~ BIT15 for PG. \n\r
458  *                          It could be BIT4 ~ BIT11 for PH.\r
459  *\r
460  * @return      None\r
461  *\r
462  * @details     Enable I/O DOUT mask of specified GPIO pin.\r
463  */\r
464 #define GPIO_ENABLE_DOUT_MASK(port, u32PinMask) ((port)->DATMSK |= (u32PinMask))\r
465 \r
466 /**\r
467  * @brief       Get GPIO Pin Interrupt Flag\r
468  *\r
469  * @param[in]   port        GPIO port. It could be PA, PB, PC, PD, PE, PF, PG or PH.\r
470  * @param[in]   u32PinMask  The single or multiple pins of specified GPIO port. \n\r
471  *                          It could be BIT0 ~ BIT15 for PA, PB and PE. \n\r
472  *                          It could be BIT0 ~ BIT13 for PC. \n\r
473  *                          It could be BIT0 ~ BIT14 for PD. \n\r
474  *                          It could be BIT0 ~ BIT11 for PF. \n\r
475  *                          It could be BIT2 ~ BIT3, BIT9 ~ BIT15 for PG. \n\r
476  *                          It could be BIT4 ~ BIT11 for PH.\r
477  *\r
478  * @retval      0           No interrupt at specified GPIO pin\r
479  * @retval      1           The specified GPIO pin generate an interrupt\r
480  *\r
481  * @details     Get the interrupt status of specified GPIO pin.\r
482  */\r
483 #define GPIO_GET_INT_FLAG(port, u32PinMask)     ((port)->INTSRC & (u32PinMask))\r
484 \r
485 /**\r
486  * @brief       Set De-bounce Sampling Cycle Time\r
487  *\r
488  * @param[in]   port        GPIO port. It could be PA, PB, PC, PD, PE, PF, PG or PH.\r
489  * @param[in]   u32ClkSrc   The de-bounce counter clock source. It could be GPIO_DBCTL_DBCLKSRC_HCLK or GPIO_DBCTL_DBCLKSRC_LIRC.\r
490  * @param[in]   u32ClkSel   The de-bounce sampling cycle selection. It could be\r
491  *                            - \ref GPIO_DBCTL_DBCLKSEL_1\r
492  *                            - \ref GPIO_DBCTL_DBCLKSEL_2\r
493  *                            - \ref GPIO_DBCTL_DBCLKSEL_4\r
494  *                            - \ref GPIO_DBCTL_DBCLKSEL_8\r
495  *                            - \ref GPIO_DBCTL_DBCLKSEL_16\r
496  *                            - \ref GPIO_DBCTL_DBCLKSEL_32\r
497  *                            - \ref GPIO_DBCTL_DBCLKSEL_64\r
498  *                            - \ref GPIO_DBCTL_DBCLKSEL_128\r
499  *                            - \ref GPIO_DBCTL_DBCLKSEL_256\r
500  *                            - \ref GPIO_DBCTL_DBCLKSEL_512\r
501  *                            - \ref GPIO_DBCTL_DBCLKSEL_1024\r
502  *                            - \ref GPIO_DBCTL_DBCLKSEL_2048\r
503  *                            - \ref GPIO_DBCTL_DBCLKSEL_4096\r
504  *                            - \ref GPIO_DBCTL_DBCLKSEL_8192\r
505  *                            - \ref GPIO_DBCTL_DBCLKSEL_16384\r
506  *                            - \ref GPIO_DBCTL_DBCLKSEL_32768\r
507  *\r
508  * @return      None\r
509  *\r
510  * @details     Set the interrupt de-bounce sampling cycle time based on the debounce counter clock source. \n\r
511  *              Example: _GPIO_SET_DEBOUNCE_TIME(PA, GPIO_DBCTL_DBCLKSRC_LIRC, GPIO_DBCTL_DBCLKSEL_4). \n\r
512  *              It's meaning the De-debounce counter clock source is internal 10 KHz and sampling cycle selection is 4. \n\r
513  *              Then the target de-bounce sampling cycle time is (4)*(1/(10*1000)) s = 4*0.0001 s = 400 us,\r
514  *              and system will sampling interrupt input once per 400 us.\r
515  */\r
516 #define GPIO_SET_DEBOUNCE_TIME(port, u32ClkSrc, u32ClkSel)    ((port)->DBCTL = (GPIO_DBCTL_ICLKON_Msk | (u32ClkSrc) | (u32ClkSel)))\r
517 \r
518 /**\r
519  * @brief       Get GPIO Port IN Data\r
520  *\r
521  * @param[in]   port        GPIO port. It could be PA, PB, PC, PD, PE, PF, PG or PH.\r
522  *\r
523  * @return      The specified port data\r
524  *\r
525  * @details     Get the PIN register of specified GPIO port.\r
526  */\r
527 #define GPIO_GET_IN_DATA(port)  ((port)->PIN)\r
528 \r
529 /**\r
530  * @brief       Set GPIO Port OUT Data\r
531  *\r
532  * @param[in]   port        GPIO port. It could be PA, PB, PC, PD, PE, PF, PG or PH.\r
533  * @param[in]   u32Data     GPIO port data.\r
534  *\r
535  * @return      None\r
536  *\r
537  * @details     Set the Data into specified GPIO port.\r
538  */\r
539 #define GPIO_SET_OUT_DATA(port, u32Data)    ((port)->DOUT = (u32Data))\r
540 \r
541 /**\r
542  * @brief       Toggle Specified GPIO pin\r
543  *\r
544  * @param[in]   u32Pin      Pxy\r
545  *\r
546  * @return      None\r
547  *\r
548  * @details     Toggle the specified GPIO pint.\r
549  */\r
550 #define GPIO_TOGGLE(u32Pin) ((u32Pin) ^= 1)\r
551 \r
552 \r
553 /**\r
554  * @brief       Enable External GPIO interrupt\r
555  *\r
556  * @param[in]   port            GPIO port. It could be PA, PB, PC, PD, PE, PF, PG or PH.\r
557  * @param[in]   u32Pin          The pin of specified GPIO port. \n\r
558  *                              It could be 0 ~ 15 for PA, PB and PE. \n\r
559  *                              It could be 0 ~ 13 for PC GPIO port. \n\r
560  *                              It could be 0 ~ 14 for PD GPIO port. \n\r
561  *                              It could be 0 ~ 11 for PF GPIO port. \n\r
562  *                              It could be 2 ~ 4, 9 ~ 15 for PG GPIO port. \n\r
563  *                              It could be 4 ~ 11 for PH GPIO port.\r
564  * @param[in]   u32IntAttribs   The interrupt attribute of specified GPIO pin. It could be\r
565  *                              - \ref GPIO_INT_RISING\r
566  *                              - \ref GPIO_INT_FALLING\r
567  *                              - \ref GPIO_INT_BOTH_EDGE\r
568  *                              - \ref GPIO_INT_HIGH\r
569  *                              - \ref GPIO_INT_LOW\r
570  *\r
571  * @return      None\r
572  *\r
573  * @details     This function is used to enable specified GPIO pin interrupt.\r
574  */\r
575 #define GPIO_EnableEINT     GPIO_EnableInt\r
576 \r
577 /**\r
578  * @brief       Disable External GPIO interrupt\r
579  *\r
580  * @param[in]   port        GPIO port. It could be PA, PB, PC, PD, PE, PF, PG or PH.\r
581  * @param[in]   u32Pin      The pin of specified GPIO port. \n\r
582  *                          It could be 0 ~ 15 for PA, PB and PE. \n\r
583  *                          It could be 0 ~ 13 for PC GPIO port. \n\r
584  *                          It could be 0 ~ 14 for PD GPIO port. \n\r
585  *                          It could be 0 ~ 11 for PF GPIO port. \n\r
586  *                          It could be 2 ~ 4, 9 ~ 15 for PG GPIO port. \n\r
587  *                          It could be 4 ~ 11 for PH GPIO port.\r
588  *\r
589  * @return      None\r
590  *\r
591  * @details     This function is used to enable specified GPIO pin interrupt.\r
592  */\r
593 #define GPIO_DisableEINT    GPIO_DisableInt\r
594 \r
595 \r
596 void GPIO_SetMode(GPIO_T *port, uint32_t u32PinMask, uint32_t u32Mode);\r
597 void GPIO_EnableInt(GPIO_T *port, uint32_t u32Pin, uint32_t u32IntAttribs);\r
598 void GPIO_DisableInt(GPIO_T *port, uint32_t u32Pin);\r
599 void GPIO_SetSlewCtl(GPIO_T *port, uint32_t u32PinMask, uint32_t u32Mode);\r
600 void GPIO_SetPullCtl(GPIO_T *port, uint32_t u32PinMask, uint32_t u32Mode);\r
601 \r
602 \r
603 /*@}*/ /* end of group GPIO_EXPORTED_FUNCTIONS */\r
604 \r
605 /*@}*/ /* end of group GPIO_Driver */\r
606 \r
607 /*@}*/ /* end of group Standard_Driver */\r
608 \r
609 #ifdef __cplusplus\r
610 }\r
611 #endif\r
612 \r
613 #endif /* __GPIO_H__ */\r
614 \r
615 /*** (C) COPYRIGHT 2016 Nuvoton Technology Corp. ***/\r