SWM320_port.h 10.6 KB
Newer Older
Z
zohar123 已提交
1 2 3
#ifndef __SWM320_PORT_H__
#define __SWM320_PORT_H__

Y
yanmowudi 已提交
4
void PORT_Init(uint32_t PORTx, uint32_t n, uint32_t func, uint32_t digit_in_en); //端口引脚功能选择,其可取值如下:
Z
zohar123 已提交
5

Y
yanmowudi 已提交
6 7 8 9 10 11
#define PORTA 0
#define PORTB 1
#define PORTC 2
#define PORTM 3
#define PORTN 4
#define PORTP 5
Z
zohar123 已提交
12

Y
yanmowudi 已提交
13 14 15
#define PORTA_PIN0_GPIO 0
#define PORTA_PIN0_FUNMUX 1
#define PORTA_PIN0_SWCLK 2
Z
zohar123 已提交
16

Y
yanmowudi 已提交
17 18 19
#define PORTA_PIN1_GPIO 0
#define PORTA_PIN1_FUNMUX 1
#define PORTA_PIN1_SWDIO 2
Z
zohar123 已提交
20

Y
yanmowudi 已提交
21 22
#define PORTA_PIN2_GPIO 0
#define PORTA_PIN2_FUNMUX 1
Z
zohar123 已提交
23

Y
yanmowudi 已提交
24 25
#define PORTA_PIN3_GPIO 0
#define PORTA_PIN3_FUNMUX 1
Z
zohar123 已提交
26

Y
yanmowudi 已提交
27 28
#define PORTA_PIN4_GPIO 0
#define PORTA_PIN4_FUNMUX 1
Z
zohar123 已提交
29

Y
yanmowudi 已提交
30 31
#define PORTA_PIN5_GPIO 0
#define PORTA_PIN5_FUNMUX 1
Z
zohar123 已提交
32

Y
yanmowudi 已提交
33 34
#define PORTA_PIN6_GPIO 0
#define PORTA_PIN6_FUNMUX 1
Z
zohar123 已提交
35

Y
yanmowudi 已提交
36 37
#define PORTA_PIN7_GPIO 0
#define PORTA_PIN7_FUNMUX 1
Z
zohar123 已提交
38

Y
yanmowudi 已提交
39 40
#define PORTA_PIN8_GPIO 0
#define PORTA_PIN8_FUNMUX 1
Z
zohar123 已提交
41

Y
yanmowudi 已提交
42 43 44
#define PORTA_PIN9_GPIO 0
#define PORTA_PIN9_FUNMUX 1
#define PORTA_PIN9_ADC0_IN7 3
Z
zohar123 已提交
45

Y
yanmowudi 已提交
46 47 48
#define PORTA_PIN10_GPIO 0
#define PORTA_PIN10_FUNMUX 1
#define PORTA_PIN10_ADC0_IN6 3
Z
zohar123 已提交
49

Y
yanmowudi 已提交
50 51 52
#define PORTA_PIN11_GPIO 0
#define PORTA_PIN11_FUNMUX 1
#define PORTA_PIN11_ADC0_IN5 3
Z
zohar123 已提交
53

Y
yanmowudi 已提交
54 55
#define PORTA_PIN12_GPIO 0
#define PORTA_PIN12_ADC0_IN4 3
Z
zohar123 已提交
56

Y
yanmowudi 已提交
57 58 59
#define PORTB_PIN0_GPIO 0
#define PORTB_PIN0_FUNMUX 1
#define PORTB_PIN0_SD_DETECT 2
Z
zohar123 已提交
60

Y
yanmowudi 已提交
61 62 63
#define PORTB_PIN1_GPIO 0
#define PORTB_PIN1_FUNMUX 1
#define PORTB_PIN1_SD_CLK 2
Z
zohar123 已提交
64

Y
yanmowudi 已提交
65 66 67
#define PORTB_PIN2_GPIO 0
#define PORTB_PIN2_FUNMUX 1
#define PORTB_PIN2_SD_CMD 2
Z
zohar123 已提交
68

Y
yanmowudi 已提交
69 70 71
#define PORTB_PIN3_GPIO 0
#define PORTB_PIN3_FUNMUX 1
#define PORTB_PIN3_SD_D0 2
Z
zohar123 已提交
72

Y
yanmowudi 已提交
73 74 75
#define PORTB_PIN4_GPIO 0
#define PORTB_PIN4_FUNMUX 1
#define PORTB_PIN4_SD_D1 2
Z
zohar123 已提交
76

Y
yanmowudi 已提交
77 78 79
#define PORTB_PIN5_GPIO 0
#define PORTB_PIN5_FUNMUX 1
#define PORTB_PIN5_SD_D2 2
Z
zohar123 已提交
80

Y
yanmowudi 已提交
81 82 83
#define PORTB_PIN6_GPIO 0
#define PORTB_PIN6_FUNMUX 1
#define PORTB_PIN6_SD_D3 2
Z
zohar123 已提交
84

Y
yanmowudi 已提交
85 86 87
#define PORTB_PIN7_GPIO 0
#define PORTB_PIN7_FUNMUX 1
#define PORTB_PIN7_SD_D4 2
Z
zohar123 已提交
88

Y
yanmowudi 已提交
89 90 91
#define PORTB_PIN8_GPIO 0
#define PORTB_PIN8_FUNMUX 1
#define PORTB_PIN8_SD_D5 2
Z
zohar123 已提交
92

Y
yanmowudi 已提交
93 94 95
#define PORTB_PIN9_GPIO 0
#define PORTB_PIN9_FUNMUX 1
#define PORTB_PIN9_SD_D6 2
Z
zohar123 已提交
96

Y
yanmowudi 已提交
97 98 99
#define PORTB_PIN10_GPIO 0
#define PORTB_PIN10_FUNMUX 1
#define PORTB_PIN10_SD_D7 2
Z
zohar123 已提交
100

Y
yanmowudi 已提交
101 102
#define PORTB_PIN11_GPIO 0
#define PORTB_PIN11_FUNMUX 1
Z
zohar123 已提交
103

Y
yanmowudi 已提交
104
#define PORTB_PIN12_GPIO 0
Z
zohar123 已提交
105

Y
yanmowudi 已提交
106 107
#define PORTC_PIN0_GPIO 0
#define PORTC_PIN0_FUNMUX 1
Z
zohar123 已提交
108

Y
yanmowudi 已提交
109 110
#define PORTC_PIN1_GPIO 0
#define PORTC_PIN1_FUNMUX 1
Z
zohar123 已提交
111

Y
yanmowudi 已提交
112 113
#define PORTC_PIN2_GPIO 0
#define PORTC_PIN2_FUNMUX 1
Z
zohar123 已提交
114

Y
yanmowudi 已提交
115 116
#define PORTC_PIN3_GPIO 0
#define PORTC_PIN3_FUNMUX 1
Z
zohar123 已提交
117

Y
yanmowudi 已提交
118 119 120
#define PORTC_PIN4_GPIO 0
#define PORTC_PIN4_FUNMUX 1
#define PORTC_PIN4_ADC1_IN3 3
Z
zohar123 已提交
121

Y
yanmowudi 已提交
122 123 124
#define PORTC_PIN5_GPIO 0
#define PORTC_PIN5_FUNMUX 1
#define PORTC_PIN5_ADC1_IN2 3
Z
zohar123 已提交
125

Y
yanmowudi 已提交
126 127 128
#define PORTC_PIN6_GPIO 0
#define PORTC_PIN6_FUNMUX 1
#define PORTC_PIN6_ADC1_IN1 3
Z
zohar123 已提交
129

Y
yanmowudi 已提交
130 131 132
#define PORTC_PIN7_GPIO 0
#define PORTC_PIN7_FUNMUX 1
#define PORTC_PIN7_ADC1_IN0 3
Z
zohar123 已提交
133

Y
yanmowudi 已提交
134 135 136
#define PORTM_PIN0_GPIO 0
#define PORTM_PIN0_FUNMUX 1
#define PORTM_PIN0_NORFL_D15 2
Z
zohar123 已提交
137

Y
yanmowudi 已提交
138 139 140
#define PORTM_PIN1_GPIO 0
#define PORTM_PIN1_FUNMUX 1
#define PORTM_PIN1_NORFL_D14 2
Z
zohar123 已提交
141

Y
yanmowudi 已提交
142 143 144
#define PORTM_PIN2_GPIO 0
#define PORTM_PIN2_FUNMUX 1
#define PORTM_PIN2_NORFL_D13 2
Z
zohar123 已提交
145

Y
yanmowudi 已提交
146 147 148
#define PORTM_PIN3_GPIO 0
#define PORTM_PIN3_FUNMUX 1
#define PORTM_PIN3_NORFL_D12 2
Z
zohar123 已提交
149

Y
yanmowudi 已提交
150 151 152
#define PORTM_PIN4_GPIO 0
#define PORTM_PIN4_FUNMUX 1
#define PORTM_PIN4_NORFL_D11 2
Z
zohar123 已提交
153

Y
yanmowudi 已提交
154 155 156
#define PORTM_PIN5_GPIO 0
#define PORTM_PIN5_FUNMUX 1
#define PORTM_PIN5_NORFL_D10 2
Z
zohar123 已提交
157

Y
yanmowudi 已提交
158 159 160
#define PORTM_PIN6_GPIO 0
#define PORTM_PIN6_FUNMUX 1
#define PORTM_PIN6_NORFL_D9 2
Z
zohar123 已提交
161

Y
yanmowudi 已提交
162 163 164
#define PORTM_PIN7_GPIO 0
#define PORTM_PIN7_FUNMUX 1
#define PORTM_PIN7_NORFL_D8 2
Z
zohar123 已提交
165

Y
yanmowudi 已提交
166 167 168
#define PORTM_PIN8_GPIO 0
#define PORTM_PIN8_FUNMUX 1
#define PORTM_PIN8_NORFL_D7 2
Z
zohar123 已提交
169

Y
yanmowudi 已提交
170 171 172
#define PORTM_PIN9_GPIO 0
#define PORTM_PIN9_FUNMUX 1
#define PORTM_PIN9_NORFL_D6 2
Z
zohar123 已提交
173

Y
yanmowudi 已提交
174 175 176
#define PORTM_PIN10_GPIO 0
#define PORTM_PIN10_FUNMUX 1
#define PORTM_PIN10_NORFL_D5 2
Z
zohar123 已提交
177

Y
yanmowudi 已提交
178 179 180
#define PORTM_PIN11_GPIO 0
#define PORTM_PIN11_FUNMUX 1
#define PORTM_PIN11_NORFL_D4 2
Z
zohar123 已提交
181

Y
yanmowudi 已提交
182 183 184
#define PORTM_PIN12_GPIO 0
#define PORTM_PIN12_FUNMUX 1
#define PORTM_PIN12_NORFL_D3 2
Z
zohar123 已提交
185

Y
yanmowudi 已提交
186 187 188
#define PORTM_PIN13_GPIO 0
#define PORTM_PIN13_FUNMUX 1
#define PORTM_PIN13_NORFL_D2 2
Z
zohar123 已提交
189

Y
yanmowudi 已提交
190 191 192
#define PORTM_PIN14_GPIO 0
#define PORTM_PIN14_FUNMUX 1
#define PORTM_PIN14_NORFL_D1 2
Z
zohar123 已提交
193

Y
yanmowudi 已提交
194 195 196
#define PORTM_PIN15_GPIO 0
#define PORTM_PIN15_FUNMUX 1
#define PORTM_PIN15_NORFL_D0 2
Z
zohar123 已提交
197

Y
yanmowudi 已提交
198 199 200
#define PORTM_PIN16_GPIO 0
#define PORTM_PIN16_FUNMUX 1
#define PORTM_PIN16_NORFL_OEN 2
Z
zohar123 已提交
201

Y
yanmowudi 已提交
202 203 204
#define PORTM_PIN17_GPIO 0
#define PORTM_PIN17_FUNMUX 1
#define PORTM_PIN17_NORFL_WEN 2
Z
zohar123 已提交
205

Y
yanmowudi 已提交
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472
#define PORTM_PIN18_GPIO 0
#define PORTM_PIN18_FUNMUX 1
#define PORTM_PIN18_NORFL_CSN 2

#define PORTM_PIN19_GPIO 0
#define PORTM_PIN19_FUNMUX 1
#define PORTM_PIN19_SDRAM_CSN 2

#define PORTM_PIN20_GPIO 0
#define PORTM_PIN20_FUNMUX 1
#define PORTM_PIN20_SRAM_CSN 2

#define PORTM_PIN21_GPIO 0
#define PORTM_PIN21_FUNMUX 1
#define PORTM_PIN21_SDRAM_CKE 2

#define PORTN_PIN0_GPIO 0
#define PORTN_PIN0_FUNMUX 1
#define PORTN_PIN0_LCD_D0 2
#define PORTN_PIN0_ADC1_IN4 3

#define PORTN_PIN1_GPIO 0
#define PORTN_PIN1_FUNMUX 1
#define PORTN_PIN1_LCD_D1 2
#define PORTN_PIN1_ADC1_IN5 3

#define PORTN_PIN2_GPIO 0
#define PORTN_PIN2_FUNMUX 1
#define PORTN_PIN2_LCD_D2 2
#define PORTN_PIN2_ADC1_IN6 3

#define PORTN_PIN3_GPIO 0
#define PORTN_PIN3_FUNMUX 1
#define PORTN_PIN3_LCD_D3 2

#define PORTN_PIN4_GPIO 0
#define PORTN_PIN4_FUNMUX 1
#define PORTN_PIN4_LCD_D4 2

#define PORTN_PIN5_GPIO 0
#define PORTN_PIN5_FUNMUX 1
#define PORTN_PIN5_LCD_D5 2

#define PORTN_PIN6_GPIO 0
#define PORTN_PIN6_FUNMUX 1
#define PORTN_PIN6_LCD_D6 2

#define PORTN_PIN7_GPIO 0
#define PORTN_PIN7_FUNMUX 1
#define PORTN_PIN7_LCD_D7 2

#define PORTN_PIN8_GPIO 0
#define PORTN_PIN8_FUNMUX 1
#define PORTN_PIN8_LCD_D8 2

#define PORTN_PIN9_GPIO 0
#define PORTN_PIN9_FUNMUX 1
#define PORTN_PIN9_LCD_D9 2

#define PORTN_PIN10_GPIO 0
#define PORTN_PIN10_FUNMUX 1
#define PORTN_PIN10_LCD_D10 2

#define PORTN_PIN11_GPIO 0
#define PORTN_PIN11_FUNMUX 1
#define PORTN_PIN11_LCD_D11 2

#define PORTN_PIN12_GPIO 0
#define PORTN_PIN12_FUNMUX 1
#define PORTN_PIN12_LCD_D12 2

#define PORTN_PIN13_GPIO 0
#define PORTN_PIN13_FUNMUX 1
#define PORTN_PIN13_LCD_D13 2

#define PORTN_PIN14_GPIO 0
#define PORTN_PIN14_FUNMUX 1
#define PORTN_PIN14_LCD_D14 2

#define PORTN_PIN15_GPIO 0
#define PORTN_PIN15_FUNMUX 1
#define PORTN_PIN15_LCD_D15 2

#define PORTN_PIN16_GPIO 0
#define PORTN_PIN16_FUNMUX 1
#define PORTN_PIN16_LCD_RD 2
#define PORTN_PIN16_LCD_DOTCK 2

#define PORTN_PIN17_GPIO 0
#define PORTN_PIN17_FUNMUX 1
#define PORTN_PIN17_LCD_CS 2
#define PORTN_PIN17_LCD_VSYNC 2

#define PORTN_PIN18_GPIO 0
#define PORTN_PIN18_LCD_RS 2
#define PORTN_PIN18_LCD_DATEN 2 //Data Enable

#define PORTN_PIN19_GPIO 0
#define PORTN_PIN19_LCD_WR 2
#define PORTN_PIN19_LCD_HSYNC 2

#define PORTP_PIN0_GPIO 0
#define PORTP_PIN0_FUNMUX 1
#define PORTP_PIN0_NORFL_A0 2

#define PORTP_PIN1_GPIO 0
#define PORTP_PIN1_FUNMUX 1
#define PORTP_PIN1_NORFL_A1 2

#define PORTP_PIN2_GPIO 0
#define PORTP_PIN2_FUNMUX 1
#define PORTP_PIN2_NORFL_A2 2
#define PORTP_PIN2_SD_D7 3

#define PORTP_PIN3_GPIO 0
#define PORTP_PIN3_FUNMUX 1
#define PORTP_PIN3_NORFL_A3 2
#define PORTP_PIN3_SD_D6 3

#define PORTP_PIN4_GPIO 0
#define PORTP_PIN4_FUNMUX 1
#define PORTP_PIN4_NORFL_A4 2
#define PORTP_PIN4_SD_D5 3

#define PORTP_PIN5_GPIO 0
#define PORTP_PIN5_FUNMUX 1
#define PORTP_PIN5_NORFL_A5 2
#define PORTP_PIN5_SD_D4 3

#define PORTP_PIN6_GPIO 0
#define PORTP_PIN6_FUNMUX 1
#define PORTP_PIN6_NORFL_A6 2
#define PORTP_PIN6_SD_D3 3

#define PORTP_PIN7_GPIO 0
#define PORTP_PIN7_FUNMUX 1
#define PORTP_PIN7_NORFL_A7 2
#define PORTP_PIN7_SD_D2 3

#define PORTP_PIN8_GPIO 0
#define PORTP_PIN8_FUNMUX 1
#define PORTP_PIN8_NORFL_A8 2
#define PORTP_PIN8_SD_D1 3

#define PORTP_PIN9_GPIO 0
#define PORTP_PIN9_FUNMUX 1
#define PORTP_PIN9_NORFL_A9 2
#define PORTP_PIN9_SD_D0 3

#define PORTP_PIN10_GPIO 0
#define PORTP_PIN10_FUNMUX 1
#define PORTP_PIN10_NORFL_A10 2
#define PORTP_PIN10_SD_CMD 3

#define PORTP_PIN11_GPIO 0
#define PORTP_PIN11_FUNMUX 1
#define PORTP_PIN11_NORFL_A11 2
#define PORTP_PIN11_SD_CLK 3

#define PORTP_PIN12_GPIO 0
#define PORTP_PIN12_FUNMUX 1
#define PORTP_PIN12_NORFL_A12 2
#define PORTP_PIN12_SD_DETECT 3

#define PORTP_PIN13_GPIO 0
#define PORTP_PIN13_FUNMUX 1
#define PORTP_PIN13_NORFL_A13 2
#define PORTP_PIN13_SDRAM_CLK 2

#define PORTP_PIN14_GPIO 0
#define PORTP_PIN14_FUNMUX 1
#define PORTP_PIN14_NORFL_A14 2
#define PORTP_PIN14_SDRAM_CAS 2

#define PORTP_PIN15_GPIO 0
#define PORTP_PIN15_FUNMUX 1
#define PORTP_PIN15_NORFL_A15 2
#define PORTP_PIN15_SDRAM_RAS 2

#define PORTP_PIN16_GPIO 0
#define PORTP_PIN16_FUNMUX 1
#define PORTP_PIN16_NORFL_A16 2
#define PORTP_PIN16_SDRAM_LDQ 2

#define PORTP_PIN17_GPIO 0
#define PORTP_PIN17_FUNMUX 1
#define PORTP_PIN17_NORFL_A17 2
#define PORTP_PIN17_SDRAM_UDQ 2

#define PORTP_PIN18_GPIO 0
#define PORTP_PIN18_FUNMUX 1
#define PORTP_PIN18_NORFL_A18 2

#define PORTP_PIN19_GPIO 0
#define PORTP_PIN19_FUNMUX 1
#define PORTP_PIN19_NORFL_A19 2

#define PORTP_PIN20_GPIO 0
#define PORTP_PIN20_FUNMUX 1
#define PORTP_PIN20_NORFL_A20 2
#define PORTP_PIN20_SDRAM_BA0 2

#define PORTP_PIN21_GPIO 0
#define PORTP_PIN21_FUNMUX 1
#define PORTP_PIN21_NORFL_A21 2
#define PORTP_PIN21_SDRAM_BA1 2

#define PORTP_PIN22_GPIO 0
#define PORTP_PIN22_FUNMUX 1
#define PORTP_PIN22_NORFL_A22 2

#define PORTP_PIN23_GPIO 0
#define PORTP_PIN23_FUNMUX 1
#define PORTP_PIN23_NORFL_A23 2

/* 下面宏定义的取值全部在正确值的基础上“加100”,以区分上面宏定义的值,从而方便库函数的编写*/
/* 下面这些值是偶数编号引脚的功能取值,如PIN0、PIN2、... */
#define FUNMUX0_UART0_RXD 100
#define FUNMUX0_UART1_RXD 101
#define FUNMUX0_UART2_RXD 102
#define FUNMUX0_UART3_RXD 103
#define FUNMUX0_I2C0_SCL 105
#define FUNMUX0_I2C1_SCL 106
#define FUNMUX0_PWM0A_OUT 107
#define FUNMUX0_PWM2A_OUT 108
#define FUNMUX0_PWM4A_OUT 109
#define FUNMUX0_PWM0B_OUT 110
#define FUNMUX0_PWM2B_OUT 111
#define FUNMUX0_PWM4B_OUT 112
#define FUNMUX0_PWM_BREAK 113
#define FUNMUX0_TIMR0_IN 114
#define FUNMUX0_TIMR2_IN 115
#define FUNMUX0_CAN_RX 116
#define FUNMUX0_SPI0_SSEL 117
#define FUNMUX0_SPI0_MOSI 118
#define FUNMUX0_SPI1_SSEL 119
#define FUNMUX0_SPI1_MOSI 120
#define FUNMUX0_UART0_CTS 121
#define FUNMUX0_UART1_CTS 122
#define FUNMUX0_UART2_CTS 123
#define FUNMUX0_UART3_CTS 124

/* 下面这些值是奇数编号引脚的功能取值,如PIN1、PIN3、... */
#define FUNMUX1_UART0_TXD 100
#define FUNMUX1_UART1_TXD 101
#define FUNMUX1_UART2_TXD 102
#define FUNMUX1_UART3_TXD 103
#define FUNMUX1_I2C0_SDA 105
#define FUNMUX1_I2C1_SDA 106
#define FUNMUX1_PWM1A_OUT 107
#define FUNMUX1_PWM3A_OUT 108
#define FUNMUX1_PWM5A_OUT 109
#define FUNMUX1_PWM1B_OUT 110
#define FUNMUX1_PWM3B_OUT 111
#define FUNMUX1_PWM5B_OUT 112
#define FUNMUX1_PULSE_IN 113
#define FUNMUX1_TIMR1_IN 114
#define FUNMUX1_TIMR3_IN 115
#define FUNMUX1_CAN_TX 116
#define FUNMUX1_SPI0_SCLK 117
#define FUNMUX1_SPI0_MISO 118
#define FUNMUX1_SPI1_SCLK 119
#define FUNMUX1_SPI1_MISO 120
#define FUNMUX1_UART0_RTS 121
#define FUNMUX1_UART1_RTS 122
#define FUNMUX1_UART2_RTS 123
#define FUNMUX1_UART3_RTS 124
Z
zohar123 已提交
473 474

#endif //__SWM320_PORT_H__