board.h 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. /*
  2. ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. #ifndef _BOARD_H_
  14. #define _BOARD_H_
  15. /*
  16. * Setup for Atmel SAM A5 D27 Xplained Ultra board.
  17. */
  18. /*
  19. * Board identifier.
  20. */
  21. #define BOARD_ATSAM5D2_XULT
  22. #define BOARD_NAME "Atmel SAM A5 D27 Xplained Ultra"
  23. /*
  24. * Ethernet PHY type.
  25. */
  26. #define BOARD_PHY_ID MII_KSZ8081_ID
  27. #define BOARD_PHY_RMII
  28. /*
  29. * Board oscillators-related settings.
  30. */
  31. #if !defined(SAMA_OSCXTCLK)
  32. #define SAMA_OSCXTCLK 32768U
  33. #endif
  34. #if !defined(SAMA_MOSCXTCLK)
  35. #define SAMA_MOSCXTCLK 12000000U
  36. #endif
  37. /*
  38. * MCU type as defined in the Atmel header.
  39. */
  40. #define SAMA5D27
  41. /**
  42. * Port identifiers.
  43. */
  44. #define SAMA_PIOA 0U
  45. #define SAMA_PIOB 1U
  46. #define SAMA_PIOC 2U
  47. #define SAMA_PIOD 3U
  48. /*
  49. * Forms a line identifier. In this driver the pad number is encoded in the
  50. * lower 5 bits of line and the port in sixth and seventh bits.
  51. */
  52. #define SAMA_LINE(port, pad) \
  53. ((uint32_t)((uint32_t)(port << 5U)) | ((uint32_t)(pad)))
  54. /*
  55. * Decodes a port identifier from a line identifier.
  56. */
  57. #define SAMA_PORT(line) \
  58. ((uint32_t)((line & 0xFFFFFFE0U) >> 5U)
  59. /**
  60. * Decodes a pad identifier from a line identifier.
  61. */
  62. #define SAMA_PAD(line) \
  63. ((uint32_t)(line & 0x0000001FU))
  64. /*
  65. * IO pins assignments.
  66. */
  67. #define PIOA_SDMMC0_CK 0U
  68. #define PIOA_SDMMC0_CMD 1U
  69. #define PIOA_SDMMC0_DAT0 2U
  70. #define PIOA_SDMMC0_DAT1 3U
  71. #define PIOA_SDMMC0_DAT2 4U
  72. #define PIOA_SDMMC0_DAT3 5U
  73. #define PIOA_SDMMC0_DAT4 6U
  74. #define PIOA_SDMMC0_DAT5 7U
  75. #define PIOA_SDMMC0_DAT6 8U
  76. #define PIOA_SDMMC0_DAT7 9U
  77. #define PIOA_SDMMC0_RSTN 10U
  78. #define PIOA_PIN11 11U
  79. #define PIOA_PIN12 12U
  80. #define PIOA_SDMMC0_CD 13U
  81. #define PIOA_PIN14 14U
  82. #define PIOA_PIN15 15U
  83. #define PIOA_PIN16 16U
  84. #define PIOA_PIN17 17U
  85. #define PIOA_PIN18 18U
  86. #define PIOA_PIN19 19U
  87. #define PIOA_PIN20 20U
  88. #define PIOA_PIN21 21U
  89. #define PIOA_PIN22 22U
  90. #define PIOA_PIN23 23U
  91. #define PIOA_PIN24 24U
  92. #define PIOA_PIN25 25U
  93. #define PIOA_PIN26 26U
  94. #define PIOA_PIN27 27U
  95. #define PIOA_PIN28 28U
  96. #define PIOA_PIN29 29U
  97. #define PIOA_PIN30 30U
  98. #define PIOA_PIN31 31U
  99. #define PIOB_PIN0 0U
  100. #define PIOB_CLASSD_R0 1U
  101. #define PIOB_CLASSD_R1 2U
  102. #define PIOB_CLASSD_R2 3U
  103. #define PIOB_CLASSD_R3 4U
  104. #define PIOB_PIN5 5U
  105. #define PIOB_LED_RED 6U
  106. #define PIOB_PIN7 7U
  107. #define PIOB_PIN8 8U
  108. #define PIOB_USER_PB 9U
  109. #define PIOB_PIN10 10U
  110. #define PIOB_PIN11 11U
  111. #define PIOB_PIN12 12U
  112. #define PIOB_PIN13 13U
  113. #define PIOB_ETH_GTXCK 14U
  114. #define PIOB_ETH_GTXEN 15U
  115. #define PIOB_ETH_GRXDV 16U
  116. #define PIOB_ETH_GRXER 17U
  117. #define PIOB_ETH_GRX0 18U
  118. #define PIOB_ETH_GRX1 19U
  119. #define PIOB_ETH_GTX0 20U
  120. #define PIOB_ETH_GTX1 21U
  121. #define PIOB_ETH_GMDC 22U
  122. #define PIOB_ETH_GMDIO 23U
  123. #define PIOB_PIN24 24U
  124. #define PIOB_PIN25 25U
  125. #define PIOB_URXD0 26U
  126. #define PIOB_UTXD0 27U
  127. #define PIOB_UART_FLEXCOM0_IO0 28U
  128. #define PIOB_UART_FLEXCOM0_IO1 29U
  129. #define PIOB_PIN30 30U
  130. #define PIOB_PIN31 31U
  131. #define PIOC_PIO0 0U
  132. #define PIOC_PIN1 1U
  133. #define PIOC_PIN2 2U
  134. #define PIOC_PIN3 3U
  135. #define PIOC_PIN4 4U
  136. #define PIOC_PIN5 5U
  137. #define PIOC_PIN6 6U
  138. #define PIOC_PIN7 7U
  139. #define PIOC_PIN8 8U
  140. #define PIOC_PIN9 9U
  141. #define PIOC_PIN10 10U
  142. #define PIOC_PIN11 11U
  143. #define PIOC_PIN12 12U
  144. #define PIOC_PIN13 13U
  145. #define PIOC_PIN14 14U
  146. #define PIOC_PIN15 15U
  147. #define PIOC_PIN16 16U
  148. #define PIOC_PIN17 17U
  149. #define PIOC_PIN18 18U
  150. #define PIOC_PIN19 19U
  151. #define PIOC_PIN20 20U
  152. #define PIOC_PIN21 21U
  153. #define PIOC_PIN22 22U
  154. #define PIOC_PIN23 23U
  155. #define PIOC_PIN24 24U
  156. #define PIOC_PIN25 25U
  157. #define PIOC_PIN26 26U
  158. #define PIOC_PIN27 27U
  159. #define PIOC_PIN28 28U
  160. #define PIOC_PIN29 29U
  161. #define PIOC_PIN30 30U
  162. #define PIOC_PIN31 31U
  163. #define PIOD_PIO0 0U
  164. #define PIOD_PIN1 1U
  165. #define PIOD_PIN2 2U
  166. #define PIOD_PIN3 3U
  167. #define PIOD_URXD2 4U
  168. #define PIOD_UTXD2 5U
  169. #define PIOD_PIN6 6U
  170. #define PIOD_PIN7 7U
  171. #define PIOD_PIN8 8U
  172. #define PIOD_PIN9 9U
  173. #define PIOD_PIN10 10U
  174. #define PIOD_PIN11 11U
  175. #define PIOD_PIN12 12U
  176. #define PIOD_PIN13 13U
  177. #define PIOD_PIN14 14U
  178. #define PIOD_PIN15 15U
  179. #define PIOD_PIN16 16U
  180. #define PIOD_PIN17 17U
  181. #define PIOD_PIN18 18U
  182. #define PIOD_PIN19 19U
  183. #define PIOD_PIN20 20U
  184. #define PIOD_UART_FLEXCOM4_IO0 21U
  185. #define PIOD_UART_FLEXCOM4_IO1 22U
  186. #define PIOD_PIN23 23U
  187. #define PIOD_UART_FLEXCOM4_IO3 24U
  188. #define PIOD_UART_FLEXCOM4_IO4 25U
  189. #define PIOD_PIN26 26U
  190. #define PIOD_PIN27 27U
  191. #define PIOD_PIN28 28U
  192. #define PIOD_PIN29 29U
  193. #define PIOD_PIN30 30U
  194. #define PIOD_PIN31 31U
  195. /*
  196. * IO lines assignments.
  197. */
  198. #define BOARD_LINE(port, pad) \
  199. ((uint32_t)((uint32_t)(port)) | ((uint32_t)(pad)))
  200. #define LINE_LED_RED BOARD_LINE(PIOB, 6U)
  201. #define LINE_USER_PB BOARD_LINE(PIOB, 9U)
  202. #if !defined(_FROM_ASM_)
  203. #ifdef __cplusplus
  204. extern "C" {
  205. #endif
  206. void boardInit(void);
  207. #ifdef __cplusplus
  208. }
  209. #endif
  210. #endif /* _FROM_ASM_ */
  211. #endif /* _BOARD_H_ */