gpio.h 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768
  1. //*****************************************************************************
  2. //
  3. // gpio.h - Defines and Macros for GPIO API.
  4. //
  5. // Copyright (c) 2005-2009 Luminary Micro, Inc. All rights reserved.
  6. // Software License Agreement
  7. //
  8. // Luminary Micro, Inc. (LMI) is supplying this software for use solely and
  9. // exclusively on LMI's microcontroller products.
  10. //
  11. // The software is owned by LMI and/or its suppliers, and is protected under
  12. // applicable copyright laws. All rights are reserved. You may not combine
  13. // this software with "viral" open-source software in order to form a larger
  14. // program. Any use in violation of the foregoing restrictions may subject
  15. // the user to criminal sanctions under applicable laws, as well as to civil
  16. // liability for the breach of the terms and conditions of this license.
  17. //
  18. // THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
  19. // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
  20. // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
  21. // LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
  22. // CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
  23. //
  24. // This is part of revision 4694 of the Stellaris Peripheral Driver Library.
  25. //
  26. //*****************************************************************************
  27. #ifndef __GPIO_H__
  28. #define __GPIO_H__
  29. //*****************************************************************************
  30. //
  31. // If building with a C++ compiler, make all of the definitions in this header
  32. // have a C binding.
  33. //
  34. //*****************************************************************************
  35. #ifdef __cplusplus
  36. extern "C"
  37. {
  38. #endif
  39. //*****************************************************************************
  40. //
  41. // The following values define the bit field for the ucPins argument to several
  42. // of the APIs.
  43. //
  44. //*****************************************************************************
  45. #define GPIO_PIN_0 0x00000001 // GPIO pin 0
  46. #define GPIO_PIN_1 0x00000002 // GPIO pin 1
  47. #define GPIO_PIN_2 0x00000004 // GPIO pin 2
  48. #define GPIO_PIN_3 0x00000008 // GPIO pin 3
  49. #define GPIO_PIN_4 0x00000010 // GPIO pin 4
  50. #define GPIO_PIN_5 0x00000020 // GPIO pin 5
  51. #define GPIO_PIN_6 0x00000040 // GPIO pin 6
  52. #define GPIO_PIN_7 0x00000080 // GPIO pin 7
  53. //*****************************************************************************
  54. //
  55. // Values that can be passed to GPIODirModeSet as the ulPinIO parameter, and
  56. // returned from GPIODirModeGet.
  57. //
  58. //*****************************************************************************
  59. #define GPIO_DIR_MODE_IN 0x00000000 // Pin is a GPIO input
  60. #define GPIO_DIR_MODE_OUT 0x00000001 // Pin is a GPIO output
  61. #define GPIO_DIR_MODE_HW 0x00000002 // Pin is a peripheral function
  62. //*****************************************************************************
  63. //
  64. // Values that can be passed to GPIOIntTypeSet as the ulIntType parameter, and
  65. // returned from GPIOIntTypeGet.
  66. //
  67. //*****************************************************************************
  68. #define GPIO_FALLING_EDGE 0x00000000 // Interrupt on falling edge
  69. #define GPIO_RISING_EDGE 0x00000004 // Interrupt on rising edge
  70. #define GPIO_BOTH_EDGES 0x00000001 // Interrupt on both edges
  71. #define GPIO_LOW_LEVEL 0x00000002 // Interrupt on low level
  72. #define GPIO_HIGH_LEVEL 0x00000007 // Interrupt on high level
  73. //*****************************************************************************
  74. //
  75. // Values that can be passed to GPIOPadConfigSet as the ulStrength parameter,
  76. // and returned by GPIOPadConfigGet in the *pulStrength parameter.
  77. //
  78. //*****************************************************************************
  79. #define GPIO_STRENGTH_2MA 0x00000001 // 2mA drive strength
  80. #define GPIO_STRENGTH_4MA 0x00000002 // 4mA drive strength
  81. #define GPIO_STRENGTH_8MA 0x00000004 // 8mA drive strength
  82. #define GPIO_STRENGTH_8MA_SC 0x0000000C // 8mA drive with slew rate control
  83. //*****************************************************************************
  84. //
  85. // Values that can be passed to GPIOPadConfigSet as the ulPadType parameter,
  86. // and returned by GPIOPadConfigGet in the *pulPadType parameter.
  87. //
  88. //*****************************************************************************
  89. #define GPIO_PIN_TYPE_STD 0x00000008 // Push-pull
  90. #define GPIO_PIN_TYPE_STD_WPU 0x0000000A // Push-pull with weak pull-up
  91. #define GPIO_PIN_TYPE_STD_WPD 0x0000000C // Push-pull with weak pull-down
  92. #define GPIO_PIN_TYPE_OD 0x00000009 // Open-drain
  93. #define GPIO_PIN_TYPE_OD_WPU 0x0000000B // Open-drain with weak pull-up
  94. #define GPIO_PIN_TYPE_OD_WPD 0x0000000D // Open-drain with weak pull-down
  95. #define GPIO_PIN_TYPE_ANALOG 0x00000000 // Analog comparator
  96. //*****************************************************************************
  97. //
  98. // Values that can be passed to GPIOPinConfigure as the ulPinConfig parameter.
  99. //
  100. //*****************************************************************************
  101. //
  102. // GPIO pin A0
  103. //
  104. #define GPIO_PA0_U0RX 0x00000001
  105. #define GPIO_PA0_I2C1SCL 0x00000008
  106. #define GPIO_PA0_U1RX 0x00000009
  107. //
  108. // GPIO pin A1
  109. //
  110. #define GPIO_PA1_U0TX 0x00000401
  111. #define GPIO_PA1_I2C1SDA 0x00000408
  112. #define GPIO_PA1_U1TX 0x00000409
  113. //
  114. // GPIO pin A2
  115. //
  116. #define GPIO_PA2_SSI0CLK 0x00000801
  117. #define GPIO_PA2_PWM4 0x00000804
  118. #define GPIO_PA2_I2S0RXSD 0x00000809
  119. //
  120. // GPIO pin A3
  121. //
  122. #define GPIO_PA3_SSI0FSS 0x00000c01
  123. #define GPIO_PA3_PWM5 0x00000c04
  124. #define GPIO_PA3_I2S0RXMCLK 0x00000c09
  125. //
  126. // GPIO pin A4
  127. //
  128. #define GPIO_PA4_SSI0RX 0x00001001
  129. #define GPIO_PA4_PWM6 0x00001004
  130. #define GPIO_PA4_CAN0RX 0x00001005
  131. #define GPIO_PA4_I2S0TXSCK 0x00001009
  132. //
  133. // GPIO pin A5
  134. //
  135. #define GPIO_PA5_SSI0TX 0x00001401
  136. #define GPIO_PA5_PWM7 0x00001404
  137. #define GPIO_PA5_CAN0TX 0x00001405
  138. #define GPIO_PA5_I2S0TXWS 0x00001409
  139. //
  140. // GPIO pin A6
  141. //
  142. #define GPIO_PA6_I2C1SCL 0x00001801
  143. #define GPIO_PA6_CCP1 0x00001802
  144. #define GPIO_PA6_PWM0 0x00001804
  145. #define GPIO_PA6_PWM4 0x00001805
  146. #define GPIO_PA6_CAN0RX 0x00001806
  147. #define GPIO_PA6_USB0EPEN 0x00001808
  148. #define GPIO_PA6_U1CTS 0x00001809
  149. //
  150. // GPIO pin A7
  151. //
  152. #define GPIO_PA7_I2C1SDA 0x00001c01
  153. #define GPIO_PA7_CCP4 0x00001c02
  154. #define GPIO_PA7_PWM1 0x00001c04
  155. #define GPIO_PA7_PWM5 0x00001c05
  156. #define GPIO_PA7_CAN0TX 0x00001c06
  157. #define GPIO_PA7_CCP3 0x00001c07
  158. #define GPIO_PA7_USB0PFLT 0x00001c08
  159. #define GPIO_PA7_U1DCD 0x00001c09
  160. //
  161. // GPIO pin B0
  162. //
  163. #define GPIO_PB0_CCP0 0x00010001
  164. #define GPIO_PB0_PWM2 0x00010002
  165. #define GPIO_PB0_U1RX 0x00010005
  166. //
  167. // GPIO pin B1
  168. //
  169. #define GPIO_PB1_CCP2 0x00010401
  170. #define GPIO_PB1_PWM3 0x00010402
  171. #define GPIO_PB1_CCP1 0x00010404
  172. #define GPIO_PB1_U1TX 0x00010405
  173. //
  174. // GPIO pin B2
  175. //
  176. #define GPIO_PB2_I2C0SCL 0x00010801
  177. #define GPIO_PB2_IDX0 0x00010802
  178. #define GPIO_PB2_CCP3 0x00010804
  179. #define GPIO_PB2_CCP0 0x00010805
  180. #define GPIO_PB2_USB0EPEN 0x00010808
  181. //
  182. // GPIO pin B3
  183. //
  184. #define GPIO_PB3_I2C0SDA 0x00010c01
  185. #define GPIO_PB3_FAULT0 0x00010c02
  186. #define GPIO_PB3_FAULT3 0x00010c04
  187. #define GPIO_PB3_USB0PFLT 0x00010c08
  188. //
  189. // GPIO pin B4
  190. //
  191. #define GPIO_PB4_U2RX 0x00011004
  192. #define GPIO_PB4_CAN0RX 0x00011005
  193. #define GPIO_PB4_IDX0 0x00011006
  194. #define GPIO_PB4_U1RX 0x00011007
  195. #define GPIO_PB4_EPI0S23 0x00011008
  196. //
  197. // GPIO pin B5
  198. //
  199. #define GPIO_PB5_C0O 0x00011401
  200. #define GPIO_PB5_CCP5 0x00011402
  201. #define GPIO_PB5_CCP6 0x00011403
  202. #define GPIO_PB5_CCP0 0x00011404
  203. #define GPIO_PB5_CAN0TX 0x00011405
  204. #define GPIO_PB5_CCP2 0x00011406
  205. #define GPIO_PB5_U1TX 0x00011407
  206. #define GPIO_PB5_EPI0S22 0x00011408
  207. //
  208. // GPIO pin B6
  209. //
  210. #define GPIO_PB6_CCP1 0x00011801
  211. #define GPIO_PB6_CCP7 0x00011802
  212. #define GPIO_PB6_C0O 0x00011803
  213. #define GPIO_PB6_FAULT1 0x00011804
  214. #define GPIO_PB6_IDX0 0x00011805
  215. #define GPIO_PB6_CCP5 0x00011806
  216. #define GPIO_PB6_I2S0TXSCK 0x00011809
  217. //
  218. // GPIO pin B7
  219. //
  220. #define GPIO_PB7_NMI 0x00011c04
  221. //
  222. // GPIO pin C0
  223. //
  224. #define GPIO_PC0_TCK 0x00020003
  225. //
  226. // GPIO pin C1
  227. //
  228. #define GPIO_PC1_TMS 0x00020403
  229. //
  230. // GPIO pin C2
  231. //
  232. #define GPIO_PC2_TDI 0x00020803
  233. //
  234. // GPIO pin C3
  235. //
  236. #define GPIO_PC3_TDO 0x00020c03
  237. //
  238. // GPIO pin C4
  239. //
  240. #define GPIO_PC4_CCP5 0x00021001
  241. #define GPIO_PC4_PHA0 0x00021002
  242. #define GPIO_PC4_PWM6 0x00021004
  243. #define GPIO_PC4_CCP2 0x00021005
  244. #define GPIO_PC4_CCP4 0x00021006
  245. #define GPIO_PC4_EPI0S2 0x00021008
  246. #define GPIO_PC4_CCP1 0x00021009
  247. //
  248. // GPIO pin C5
  249. //
  250. #define GPIO_PC5_CCP1 0x00021401
  251. #define GPIO_PC5_C1O 0x00021402
  252. #define GPIO_PC5_C0O 0x00021403
  253. #define GPIO_PC5_FAULT2 0x00021404
  254. #define GPIO_PC5_CCP3 0x00021405
  255. #define GPIO_PC5_USB0EPEN 0x00021406
  256. #define GPIO_PC5_EPI0S3 0x00021408
  257. //
  258. // GPIO pin C6
  259. //
  260. #define GPIO_PC6_CCP3 0x00021801
  261. #define GPIO_PC6_PHB0 0x00021802
  262. #define GPIO_PC6_C2O 0x00021803
  263. #define GPIO_PC6_PWM7 0x00021804
  264. #define GPIO_PC6_U1RX 0x00021805
  265. #define GPIO_PC6_CCP0 0x00021806
  266. #define GPIO_PC6_USB0PFLT 0x00021807
  267. #define GPIO_PC6_EPI0S4 0x00021808
  268. //
  269. // GPIO pin C7
  270. //
  271. #define GPIO_PC7_CCP4 0x00021c01
  272. #define GPIO_PC7_PHB0 0x00021c02
  273. #define GPIO_PC7_CCP0 0x00021c04
  274. #define GPIO_PC7_U1TX 0x00021c05
  275. #define GPIO_PC7_USB0PFLT 0x00021c06
  276. #define GPIO_PC7_C1O 0x00021c07
  277. #define GPIO_PC7_EPI0S5 0x00021c08
  278. //
  279. // GPIO pin D0
  280. //
  281. #define GPIO_PD0_PWM0 0x00030001
  282. #define GPIO_PD0_CAN0RX 0x00030002
  283. #define GPIO_PD0_IDX0 0x00030003
  284. #define GPIO_PD0_U2RX 0x00030004
  285. #define GPIO_PD0_U1RX 0x00030005
  286. #define GPIO_PD0_CCP6 0x00030006
  287. #define GPIO_PD0_I2S0RXSCK 0x00030008
  288. #define GPIO_PD0_U1CTS 0x00030009
  289. //
  290. // GPIO pin D1
  291. //
  292. #define GPIO_PD1_PWM1 0x00030401
  293. #define GPIO_PD1_CAN0TX 0x00030402
  294. #define GPIO_PD1_PHA0 0x00030403
  295. #define GPIO_PD1_U2TX 0x00030404
  296. #define GPIO_PD1_U1TX 0x00030405
  297. #define GPIO_PD1_CCP7 0x00030406
  298. #define GPIO_PD1_I2S0RXWS 0x00030408
  299. #define GPIO_PD1_U1DCD 0x00030409
  300. #define GPIO_PD1_CCP2 0x0003040a
  301. #define GPIO_PD1_PHB1 0x0003040b
  302. //
  303. // GPIO pin D2
  304. //
  305. #define GPIO_PD2_U1RX 0x00030801
  306. #define GPIO_PD2_CCP6 0x00030802
  307. #define GPIO_PD2_PWM2 0x00030803
  308. #define GPIO_PD2_CCP5 0x00030804
  309. #define GPIO_PD2_EPI0S20 0x00030808
  310. //
  311. // GPIO pin D3
  312. //
  313. #define GPIO_PD3_U1TX 0x00030c01
  314. #define GPIO_PD3_CCP7 0x00030c02
  315. #define GPIO_PD3_PWM3 0x00030c03
  316. #define GPIO_PD3_CCP0 0x00030c04
  317. #define GPIO_PD3_EPI0S21 0x00030c08
  318. //
  319. // GPIO pin D4
  320. //
  321. #define GPIO_PD4_CCP0 0x00031001
  322. #define GPIO_PD4_CCP3 0x00031002
  323. #define GPIO_PD4_I2S0RXSD 0x00031008
  324. #define GPIO_PD4_U1RI 0x00031009
  325. #define GPIO_PD4_EPI0S19 0x0003100a
  326. //
  327. // GPIO pin D5
  328. //
  329. #define GPIO_PD5_CCP2 0x00031401
  330. #define GPIO_PD5_CCP4 0x00031402
  331. #define GPIO_PD5_I2S0RXMCLK 0x00031408
  332. #define GPIO_PD5_U2RX 0x00031409
  333. #define GPIO_PD5_EPI0S28 0x0003140a
  334. //
  335. // GPIO pin D6
  336. //
  337. #define GPIO_PD6_FAULT0 0x00031801
  338. #define GPIO_PD6_I2S0TXSCK 0x00031808
  339. #define GPIO_PD6_U2TX 0x00031809
  340. #define GPIO_PD6_EPI0S29 0x0003180a
  341. //
  342. // GPIO pin D7
  343. //
  344. #define GPIO_PD7_IDX0 0x00031c01
  345. #define GPIO_PD7_C0O 0x00031c02
  346. #define GPIO_PD7_CCP1 0x00031c03
  347. #define GPIO_PD7_I2S0TXWS 0x00031c08
  348. #define GPIO_PD7_U1DTR 0x00031c09
  349. #define GPIO_PD7_EPI0S30 0x00031c0a
  350. //
  351. // GPIO pin E0
  352. //
  353. #define GPIO_PE0_PWM4 0x00040001
  354. #define GPIO_PE0_SSI1CLK 0x00040002
  355. #define GPIO_PE0_CCP3 0x00040003
  356. #define GPIO_PE0_EPI0S8 0x00040008
  357. #define GPIO_PE0_USB0PFLT 0x00040009
  358. //
  359. // GPIO pin E1
  360. //
  361. #define GPIO_PE1_PWM5 0x00040401
  362. #define GPIO_PE1_SSI1FSS 0x00040402
  363. #define GPIO_PE1_FAULT0 0x00040403
  364. #define GPIO_PE1_CCP2 0x00040404
  365. #define GPIO_PE1_CCP6 0x00040405
  366. #define GPIO_PE1_EPI0S9 0x00040408
  367. //
  368. // GPIO pin E2
  369. //
  370. #define GPIO_PE2_CCP4 0x00040801
  371. #define GPIO_PE2_SSI1RX 0x00040802
  372. #define GPIO_PE2_PHB1 0x00040803
  373. #define GPIO_PE2_PHA0 0x00040804
  374. #define GPIO_PE2_CCP2 0x00040805
  375. #define GPIO_PE2_EPI0S24 0x00040808
  376. //
  377. // GPIO pin E3
  378. //
  379. #define GPIO_PE3_CCP1 0x00040c01
  380. #define GPIO_PE3_SSI1TX 0x00040c02
  381. #define GPIO_PE3_PHA1 0x00040c03
  382. #define GPIO_PE3_PHB0 0x00040c04
  383. #define GPIO_PE3_CCP7 0x00040c05
  384. #define GPIO_PE3_EPI0S25 0x00040c08
  385. //
  386. // GPIO pin E4
  387. //
  388. #define GPIO_PE4_CCP3 0x00041001
  389. #define GPIO_PE4_FAULT0 0x00041004
  390. #define GPIO_PE4_U2TX 0x00041005
  391. #define GPIO_PE4_CCP2 0x00041006
  392. #define GPIO_PE4_I2S0TXWS 0x00041009
  393. //
  394. // GPIO pin E5
  395. //
  396. #define GPIO_PE5_CCP5 0x00041401
  397. #define GPIO_PE5_I2S0TXSD 0x00041409
  398. //
  399. // GPIO pin E6
  400. //
  401. #define GPIO_PE6_PWM4 0x00041801
  402. #define GPIO_PE6_C1O 0x00041802
  403. #define GPIO_PE6_U1CTS 0x00041809
  404. //
  405. // GPIO pin E7
  406. //
  407. #define GPIO_PE7_PWM5 0x00041c01
  408. #define GPIO_PE7_C2O 0x00041c02
  409. #define GPIO_PE7_U1DCD 0x00041c09
  410. //
  411. // GPIO pin F0
  412. //
  413. #define GPIO_PF0_CAN1RX 0x00050001
  414. #define GPIO_PF0_PHB0 0x00050002
  415. #define GPIO_PF0_PWM0 0x00050003
  416. #define GPIO_PF0_I2S0TXSD 0x00050008
  417. #define GPIO_PF0_U1DSR 0x00050009
  418. //
  419. // GPIO pin F1
  420. //
  421. #define GPIO_PF1_CAN1TX 0x00050401
  422. #define GPIO_PF1_IDX1 0x00050402
  423. #define GPIO_PF1_PWM1 0x00050403
  424. #define GPIO_PF1_I2S0TXMCLK 0x00050408
  425. #define GPIO_PF1_U1RTS 0x00050409
  426. #define GPIO_PF1_CCP3 0x0005040a
  427. //
  428. // GPIO pin F2
  429. //
  430. #define GPIO_PF2_LED1 0x00050801
  431. #define GPIO_PF2_PWM4 0x00050802
  432. #define GPIO_PF2_PWM2 0x00050804
  433. #define GPIO_PF2_SSI1CLK 0x00050809
  434. //
  435. // GPIO pin F3
  436. //
  437. #define GPIO_PF3_LED0 0x00050c01
  438. #define GPIO_PF3_PWM5 0x00050c02
  439. #define GPIO_PF3_PWM3 0x00050c04
  440. #define GPIO_PF3_SSI1FSS 0x00050c09
  441. //
  442. // GPIO pin F4
  443. //
  444. #define GPIO_PF4_CCP0 0x00051001
  445. #define GPIO_PF4_C0O 0x00051002
  446. #define GPIO_PF4_FAULT0 0x00051004
  447. #define GPIO_PF4_EPI0S12 0x00051008
  448. #define GPIO_PF4_SSI1RX 0x00051009
  449. //
  450. // GPIO pin F5
  451. //
  452. #define GPIO_PF5_CCP2 0x00051401
  453. #define GPIO_PF5_C1O 0x00051402
  454. #define GPIO_PF5_EPI0S15 0x00051408
  455. #define GPIO_PF5_SSI1TX 0x00051409
  456. //
  457. // GPIO pin F6
  458. //
  459. #define GPIO_PF6_CCP1 0x00051801
  460. #define GPIO_PF6_C2O 0x00051802
  461. #define GPIO_PF6_PHA0 0x00051804
  462. #define GPIO_PF6_I2S0TXMCLK 0x00051809
  463. #define GPIO_PF6_U1RTS 0x0005180a
  464. //
  465. // GPIO pin F7
  466. //
  467. #define GPIO_PF7_CCP4 0x00051c01
  468. #define GPIO_PF7_PHB0 0x00051c04
  469. #define GPIO_PF7_EPI0S12 0x00051c08
  470. #define GPIO_PF7_FAULT1 0x00051c09
  471. //
  472. // GPIO pin G0
  473. //
  474. #define GPIO_PG0_U2RX 0x00060001
  475. #define GPIO_PG0_PWM0 0x00060002
  476. #define GPIO_PG0_I2C1SCL 0x00060003
  477. #define GPIO_PG0_PWM4 0x00060004
  478. #define GPIO_PG0_USB0EPEN 0x00060007
  479. #define GPIO_PG0_EPI0S13 0x00060008
  480. //
  481. // GPIO pin G1
  482. //
  483. #define GPIO_PG1_U2TX 0x00060401
  484. #define GPIO_PG1_PWM1 0x00060402
  485. #define GPIO_PG1_I2C1SDA 0x00060403
  486. #define GPIO_PG1_PWM5 0x00060404
  487. #define GPIO_PG1_EPI0S14 0x00060408
  488. //
  489. // GPIO pin G2
  490. //
  491. #define GPIO_PG2_PWM0 0x00060801
  492. #define GPIO_PG2_FAULT0 0x00060804
  493. #define GPIO_PG2_IDX1 0x00060808
  494. #define GPIO_PG2_I2S0RXSD 0x00060809
  495. //
  496. // GPIO pin G3
  497. //
  498. #define GPIO_PG3_PWM1 0x00060c01
  499. #define GPIO_PG3_FAULT2 0x00060c04
  500. #define GPIO_PG3_FAULT0 0x00060c08
  501. #define GPIO_PG3_I2S0RXMCLK 0x00060c09
  502. //
  503. // GPIO pin G4
  504. //
  505. #define GPIO_PG4_CCP3 0x00061001
  506. #define GPIO_PG4_FAULT1 0x00061004
  507. #define GPIO_PG4_EPI0S15 0x00061008
  508. #define GPIO_PG4_PWM6 0x00061009
  509. #define GPIO_PG4_U1RI 0x0006100a
  510. //
  511. // GPIO pin G5
  512. //
  513. #define GPIO_PG5_CCP5 0x00061401
  514. #define GPIO_PG5_IDX0 0x00061404
  515. #define GPIO_PG5_FAULT1 0x00061405
  516. #define GPIO_PG5_PWM7 0x00061408
  517. #define GPIO_PG5_I2S0RXSCK 0x00061409
  518. #define GPIO_PG5_U1DTR 0x0006140a
  519. //
  520. // GPIO pin G6
  521. //
  522. #define GPIO_PG6_PHA1 0x00061801
  523. #define GPIO_PG6_PWM6 0x00061804
  524. #define GPIO_PG6_FAULT1 0x00061808
  525. #define GPIO_PG6_I2S0RXWS 0x00061809
  526. #define GPIO_PG6_U1RI 0x0006180a
  527. //
  528. // GPIO pin G7
  529. //
  530. #define GPIO_PG7_PHB1 0x00061c01
  531. #define GPIO_PG7_PWM7 0x00061c04
  532. #define GPIO_PG7_CCP5 0x00061c08
  533. #define GPIO_PG7_EPI0S31 0x00061c09
  534. //
  535. // GPIO pin H0
  536. //
  537. #define GPIO_PH0_CCP6 0x00070001
  538. #define GPIO_PH0_PWM2 0x00070002
  539. #define GPIO_PH0_EPI0S6 0x00070008
  540. #define GPIO_PH0_PWM4 0x00070009
  541. //
  542. // GPIO pin H1
  543. //
  544. #define GPIO_PH1_CCP7 0x00070401
  545. #define GPIO_PH1_PWM3 0x00070402
  546. #define GPIO_PH1_EPI0S7 0x00070408
  547. #define GPIO_PH1_PWM5 0x00070409
  548. //
  549. // GPIO pin H2
  550. //
  551. #define GPIO_PH2_IDX1 0x00070801
  552. #define GPIO_PH2_C1O 0x00070802
  553. #define GPIO_PH2_FAULT3 0x00070804
  554. #define GPIO_PH2_EPI0S1 0x00070808
  555. //
  556. // GPIO pin H3
  557. //
  558. #define GPIO_PH3_PHB0 0x00070c01
  559. #define GPIO_PH3_FAULT0 0x00070c02
  560. #define GPIO_PH3_USB0EPEN 0x00070c04
  561. #define GPIO_PH3_EPI0S0 0x00070c08
  562. //
  563. // GPIO pin H4
  564. //
  565. #define GPIO_PH4_USB0PFLT 0x00071004
  566. #define GPIO_PH4_EPI0S10 0x00071008
  567. #define GPIO_PH4_SSI1CLK 0x0007100b
  568. //
  569. // GPIO pin H5
  570. //
  571. #define GPIO_PH5_EPI0S11 0x00071408
  572. #define GPIO_PH5_FAULT2 0x0007140a
  573. #define GPIO_PH5_SSI1FSS 0x0007140b
  574. //
  575. // GPIO pin H6
  576. //
  577. #define GPIO_PH6_EPI0S26 0x00071808
  578. #define GPIO_PH6_PWM4 0x0007180a
  579. #define GPIO_PH6_SSI1RX 0x0007180b
  580. //
  581. // GPIO pin H7
  582. //
  583. #define GPIO_PH7_EPI0S27 0x00071c08
  584. #define GPIO_PH7_PWM5 0x00071c0a
  585. #define GPIO_PH7_SSI1TX 0x00071c0b
  586. //
  587. // GPIO pin J0
  588. //
  589. #define GPIO_PJ0_EPI0S16 0x00080008
  590. #define GPIO_PJ0_PWM0 0x0008000a
  591. #define GPIO_PJ0_I2C1SCL 0x0008000b
  592. //
  593. // GPIO pin J1
  594. //
  595. #define GPIO_PJ1_EPI0S17 0x00080408
  596. #define GPIO_PJ1_USB0PFLT 0x00080409
  597. #define GPIO_PJ1_PWM1 0x0008040a
  598. #define GPIO_PJ1_I2C1SDA 0x0008040b
  599. //
  600. // GPIO pin J2
  601. //
  602. #define GPIO_PJ2_EPI0S18 0x00080808
  603. #define GPIO_PJ2_CCP0 0x00080809
  604. #define GPIO_PJ2_FAULT0 0x0008080a
  605. //
  606. // GPIO pin J3
  607. //
  608. #define GPIO_PJ3_EPI0S19 0x00080c08
  609. #define GPIO_PJ3_U1CTS 0x00080c09
  610. #define GPIO_PJ3_CCP6 0x00080c0a
  611. //
  612. // GPIO pin J4
  613. //
  614. #define GPIO_PJ4_EPI0S28 0x00081008
  615. #define GPIO_PJ4_U1DCD 0x00081009
  616. #define GPIO_PJ4_CCP4 0x0008100a
  617. //
  618. // GPIO pin J5
  619. //
  620. #define GPIO_PJ5_EPI0S29 0x00081408
  621. #define GPIO_PJ5_U1DSR 0x00081409
  622. #define GPIO_PJ5_CCP2 0x0008140a
  623. //
  624. // GPIO pin J6
  625. //
  626. #define GPIO_PJ6_EPI0S30 0x00081808
  627. #define GPIO_PJ6_U1RTS 0x00081809
  628. #define GPIO_PJ6_CCP1 0x0008180a
  629. //
  630. // GPIO pin J7
  631. //
  632. #define GPIO_PJ7_U1DTR 0x00081c09
  633. #define GPIO_PJ7_CCP0 0x00081c0a
  634. //*****************************************************************************
  635. //
  636. // Prototypes for the APIs.
  637. //
  638. //*****************************************************************************
  639. extern void GPIODirModeSet(unsigned long ulPort, unsigned char ucPins,
  640. unsigned long ulPinIO);
  641. extern unsigned long GPIODirModeGet(unsigned long ulPort, unsigned char ucPin);
  642. extern void GPIOIntTypeSet(unsigned long ulPort, unsigned char ucPins,
  643. unsigned long ulIntType);
  644. extern unsigned long GPIOIntTypeGet(unsigned long ulPort, unsigned char ucPin);
  645. extern void GPIOPadConfigSet(unsigned long ulPort, unsigned char ucPins,
  646. unsigned long ulStrength,
  647. unsigned long ulPadType);
  648. extern void GPIOPadConfigGet(unsigned long ulPort, unsigned char ucPin,
  649. unsigned long *pulStrength,
  650. unsigned long *pulPadType);
  651. extern void GPIOPinIntEnable(unsigned long ulPort, unsigned char ucPins);
  652. extern void GPIOPinIntDisable(unsigned long ulPort, unsigned char ucPins);
  653. extern long GPIOPinIntStatus(unsigned long ulPort, tBoolean bMasked);
  654. extern void GPIOPinIntClear(unsigned long ulPort, unsigned char ucPins);
  655. extern void GPIOPortIntRegister(unsigned long ulPort,
  656. void (*pfnIntHandler)(void));
  657. extern void GPIOPortIntUnregister(unsigned long ulPort);
  658. extern long GPIOPinRead(unsigned long ulPort, unsigned char ucPins);
  659. extern void GPIOPinWrite(unsigned long ulPort, unsigned char ucPins,
  660. unsigned char ucVal);
  661. extern void GPIOPinConfigure(unsigned long ulPinConfig);
  662. extern void GPIOPinTypeADC(unsigned long ulPort, unsigned char ucPins);
  663. extern void GPIOPinTypeCAN(unsigned long ulPort, unsigned char ucPins);
  664. extern void GPIOPinTypeComparator(unsigned long ulPort, unsigned char ucPins);
  665. extern void GPIOPinTypeGPIOInput(unsigned long ulPort, unsigned char ucPins);
  666. extern void GPIOPinTypeGPIOOutput(unsigned long ulPort, unsigned char ucPins);
  667. extern void GPIOPinTypeGPIOOutputOD(unsigned long ulPort,
  668. unsigned char ucPins);
  669. extern void GPIOPinTypeI2C(unsigned long ulPort, unsigned char ucPins);
  670. extern void GPIOPinTypeI2S(unsigned long ulPort, unsigned char ucPins);
  671. extern void GPIOPinTypePWM(unsigned long ulPort, unsigned char ucPins);
  672. extern void GPIOPinTypeQEI(unsigned long ulPort, unsigned char ucPins);
  673. extern void GPIOPinTypeSSI(unsigned long ulPort, unsigned char ucPins);
  674. extern void GPIOPinTypeTimer(unsigned long ulPort, unsigned char ucPins);
  675. extern void GPIOPinTypeUART(unsigned long ulPort, unsigned char ucPins);
  676. extern void GPIOPinTypeUSBAnalog(unsigned long ulPort, unsigned char ucPins);
  677. extern void GPIOPinTypeUSBDigital(unsigned long ulPort, unsigned char ucPins);
  678. //*****************************************************************************
  679. //
  680. // Mark the end of the C bindings section for C++ compilers.
  681. //
  682. //*****************************************************************************
  683. #ifdef __cplusplus
  684. }
  685. #endif
  686. #endif // __GPIO_H__