early_pin.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. /*
  2. * Joshua Henderson <joshua.henderson@microchip.com>
  3. * Copyright (C) 2015 Microchip Technology Inc. All rights reserved.
  4. *
  5. * This program is free software; you can distribute it and/or modify it
  6. * under the terms of the GNU General Public License (Version 2) as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  12. * for more details.
  13. */
  14. #ifndef _PIC32MZDA_EARLY_PIN_H
  15. #define _PIC32MZDA_EARLY_PIN_H
  16. /*
  17. * This is a complete, yet overly simplistic and unoptimized, PIC32MZDA PPS
  18. * configuration only useful before we have full pinctrl initialized.
  19. */
  20. /* Input PPS Functions */
  21. enum {
  22. IN_FUNC_INT3,
  23. IN_FUNC_T2CK,
  24. IN_FUNC_T6CK,
  25. IN_FUNC_IC3,
  26. IN_FUNC_IC7,
  27. IN_FUNC_U1RX,
  28. IN_FUNC_U2CTS,
  29. IN_FUNC_U5RX,
  30. IN_FUNC_U6CTS,
  31. IN_FUNC_SDI1,
  32. IN_FUNC_SDI3,
  33. IN_FUNC_SDI5,
  34. IN_FUNC_SS6,
  35. IN_FUNC_REFCLKI1,
  36. IN_FUNC_INT4,
  37. IN_FUNC_T5CK,
  38. IN_FUNC_T7CK,
  39. IN_FUNC_IC4,
  40. IN_FUNC_IC8,
  41. IN_FUNC_U3RX,
  42. IN_FUNC_U4CTS,
  43. IN_FUNC_SDI2,
  44. IN_FUNC_SDI4,
  45. IN_FUNC_C1RX,
  46. IN_FUNC_REFCLKI4,
  47. IN_FUNC_INT2,
  48. IN_FUNC_T3CK,
  49. IN_FUNC_T8CK,
  50. IN_FUNC_IC2,
  51. IN_FUNC_IC5,
  52. IN_FUNC_IC9,
  53. IN_FUNC_U1CTS,
  54. IN_FUNC_U2RX,
  55. IN_FUNC_U5CTS,
  56. IN_FUNC_SS1,
  57. IN_FUNC_SS3,
  58. IN_FUNC_SS4,
  59. IN_FUNC_SS5,
  60. IN_FUNC_C2RX,
  61. IN_FUNC_INT1,
  62. IN_FUNC_T4CK,
  63. IN_FUNC_T9CK,
  64. IN_FUNC_IC1,
  65. IN_FUNC_IC6,
  66. IN_FUNC_U3CTS,
  67. IN_FUNC_U4RX,
  68. IN_FUNC_U6RX,
  69. IN_FUNC_SS2,
  70. IN_FUNC_SDI6,
  71. IN_FUNC_OCFA,
  72. IN_FUNC_REFCLKI3,
  73. };
  74. /* Input PPS Pins */
  75. #define IN_RPD2 0x00
  76. #define IN_RPG8 0x01
  77. #define IN_RPF4 0x02
  78. #define IN_RPD10 0x03
  79. #define IN_RPF1 0x04
  80. #define IN_RPB9 0x05
  81. #define IN_RPB10 0x06
  82. #define IN_RPC14 0x07
  83. #define IN_RPB5 0x08
  84. #define IN_RPC1 0x0A
  85. #define IN_RPD14 0x0B
  86. #define IN_RPG1 0x0C
  87. #define IN_RPA14 0x0D
  88. #define IN_RPD6 0x0E
  89. #define IN_RPD3 0x00
  90. #define IN_RPG7 0x01
  91. #define IN_RPF5 0x02
  92. #define IN_RPD11 0x03
  93. #define IN_RPF0 0x04
  94. #define IN_RPB1 0x05
  95. #define IN_RPE5 0x06
  96. #define IN_RPC13 0x07
  97. #define IN_RPB3 0x08
  98. #define IN_RPC4 0x0A
  99. #define IN_RPD15 0x0B
  100. #define IN_RPG0 0x0C
  101. #define IN_RPA15 0x0D
  102. #define IN_RPD7 0x0E
  103. #define IN_RPD9 0x00
  104. #define IN_RPG6 0x01
  105. #define IN_RPB8 0x02
  106. #define IN_RPB15 0x03
  107. #define IN_RPD4 0x04
  108. #define IN_RPB0 0x05
  109. #define IN_RPE3 0x06
  110. #define IN_RPB7 0x07
  111. #define IN_RPF12 0x09
  112. #define IN_RPD12 0x0A
  113. #define IN_RPF8 0x0B
  114. #define IN_RPC3 0x0C
  115. #define IN_RPE9 0x0D
  116. #define IN_RPD1 0x00
  117. #define IN_RPG9 0x01
  118. #define IN_RPB14 0x02
  119. #define IN_RPD0 0x03
  120. #define IN_RPB6 0x05
  121. #define IN_RPD5 0x06
  122. #define IN_RPB2 0x07
  123. #define IN_RPF3 0x08
  124. #define IN_RPF13 0x09
  125. #define IN_RPF2 0x0B
  126. #define IN_RPC2 0x0C
  127. #define IN_RPE8 0x0D
  128. /* Output PPS Pins */
  129. enum {
  130. OUT_RPD2,
  131. OUT_RPG8,
  132. OUT_RPF4,
  133. OUT_RPD10,
  134. OUT_RPF1,
  135. OUT_RPB9,
  136. OUT_RPB10,
  137. OUT_RPC14,
  138. OUT_RPB5,
  139. OUT_RPC1,
  140. OUT_RPD14,
  141. OUT_RPG1,
  142. OUT_RPA14,
  143. OUT_RPD6,
  144. OUT_RPD3,
  145. OUT_RPG7,
  146. OUT_RPF5,
  147. OUT_RPD11,
  148. OUT_RPF0,
  149. OUT_RPB1,
  150. OUT_RPE5,
  151. OUT_RPC13,
  152. OUT_RPB3,
  153. OUT_RPC4,
  154. OUT_RPD15,
  155. OUT_RPG0,
  156. OUT_RPA15,
  157. OUT_RPD7,
  158. OUT_RPD9,
  159. OUT_RPG6,
  160. OUT_RPB8,
  161. OUT_RPB15,
  162. OUT_RPD4,
  163. OUT_RPB0,
  164. OUT_RPE3,
  165. OUT_RPB7,
  166. OUT_RPF12,
  167. OUT_RPD12,
  168. OUT_RPF8,
  169. OUT_RPC3,
  170. OUT_RPE9,
  171. OUT_RPD1,
  172. OUT_RPG9,
  173. OUT_RPB14,
  174. OUT_RPD0,
  175. OUT_RPB6,
  176. OUT_RPD5,
  177. OUT_RPB2,
  178. OUT_RPF3,
  179. OUT_RPF13,
  180. OUT_RPC2,
  181. OUT_RPE8,
  182. OUT_RPF2,
  183. };
  184. /* Output PPS Functions */
  185. #define OUT_FUNC_U3TX 0x01
  186. #define OUT_FUNC_U4RTS 0x02
  187. #define OUT_FUNC_SDO1 0x05
  188. #define OUT_FUNC_SDO2 0x06
  189. #define OUT_FUNC_SDO3 0x07
  190. #define OUT_FUNC_SDO5 0x09
  191. #define OUT_FUNC_SS6 0x0A
  192. #define OUT_FUNC_OC3 0x0B
  193. #define OUT_FUNC_OC6 0x0C
  194. #define OUT_FUNC_REFCLKO4 0x0D
  195. #define OUT_FUNC_C2OUT 0x0E
  196. #define OUT_FUNC_C1TX 0x0F
  197. #define OUT_FUNC_U1TX 0x01
  198. #define OUT_FUNC_U2RTS 0x02
  199. #define OUT_FUNC_U5TX 0x03
  200. #define OUT_FUNC_U6RTS 0x04
  201. #define OUT_FUNC_SDO1 0x05
  202. #define OUT_FUNC_SDO2 0x06
  203. #define OUT_FUNC_SDO3 0x07
  204. #define OUT_FUNC_SDO4 0x08
  205. #define OUT_FUNC_SDO5 0x09
  206. #define OUT_FUNC_OC4 0x0B
  207. #define OUT_FUNC_OC7 0x0C
  208. #define OUT_FUNC_REFCLKO1 0x0F
  209. #define OUT_FUNC_U3RTS 0x01
  210. #define OUT_FUNC_U4TX 0x02
  211. #define OUT_FUNC_U6TX 0x04
  212. #define OUT_FUNC_SS1 0x05
  213. #define OUT_FUNC_SS3 0x07
  214. #define OUT_FUNC_SS4 0x08
  215. #define OUT_FUNC_SS5 0x09
  216. #define OUT_FUNC_SDO6 0x0A
  217. #define OUT_FUNC_OC5 0x0B
  218. #define OUT_FUNC_OC8 0x0C
  219. #define OUT_FUNC_C1OUT 0x0E
  220. #define OUT_FUNC_REFCLKO3 0x0F
  221. #define OUT_FUNC_U1RTS 0x01
  222. #define OUT_FUNC_U2TX 0x02
  223. #define OUT_FUNC_U5RTS 0x03
  224. #define OUT_FUNC_U6TX 0x04
  225. #define OUT_FUNC_SS2 0x06
  226. #define OUT_FUNC_SDO4 0x08
  227. #define OUT_FUNC_SDO6 0x0A
  228. #define OUT_FUNC_OC2 0x0B
  229. #define OUT_FUNC_OC1 0x0C
  230. #define OUT_FUNC_OC9 0x0D
  231. #define OUT_FUNC_C2TX 0x0F
  232. void pic32_pps_input(int function, int pin);
  233. void pic32_pps_output(int function, int pin);
  234. #endif