board.h 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. /*
  2. ChibiOS - Copyright (C) 2006..2018 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 SOM1-EK1 board.
  17. */
  18. /*
  19. * Board identifier.
  20. */
  21. #define BOARD_ATSAM5D27_SOM1
  22. #define BOARD_NAME "Atmel SAM A5 D27 SOM1 evaluation kit 1"
  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 24000000U
  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_LED_RED 10U
  78. #define PIOA_SDMMC0_VDDSEL 11U
  79. #define PIOA_SDMMC0_WP 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_ONEWIRE 17U
  85. #define PIOA_SDMMC1_DAT0 18U
  86. #define PIOA_SDMMC1_DAT1 19U
  87. #define PIOA_SDMMC1_DAT2 20U
  88. #define PIOA_SDMMC1_DAT3 21U
  89. #define PIOA_SDMMC1_CK 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_SDMMC1_CMD 28U
  96. #define PIOA_USER_PB 29U
  97. #define PIOA_SDMMC1_CD 30U
  98. #define PIOA_LED_BLUE 31U
  99. #define PIOB_PIN0 0U
  100. #define PIOB_LED_GREEN 1U
  101. #define PIOB_PIN2 2U
  102. #define PIOB_URXD4 3U
  103. #define PIOB_UTXD4 4U
  104. #define PIOB_QSPI1_SCK 5U
  105. #define PIOB_QSPI1_CS 6U
  106. #define PIOB_QSPI1_IO0 7U
  107. #define PIOB_QSPI1_IO1 8U
  108. #define PIOB_QSPI1_IO2 9U
  109. #define PIOB_QSPI1_IO3 10U
  110. #define PIOB_LCDDAT0 11U
  111. #define PIOB_LCDDAT1 12U
  112. #define PIOB_LCDDAT2 13U
  113. #define PIOB_LCDDAT3 14U
  114. #define PIOB_LCDDAT4 15U
  115. #define PIOB_LCDDAT5 16U
  116. #define PIOB_LCDDAT6 17U
  117. #define PIOB_LCDDAT7 18U
  118. #define PIOB_LCDDAT8 19U
  119. #define PIOB_LCDDAT9 20U
  120. #define PIOB_LCDDAT10 21U
  121. #define PIOB_LCDDAT11 22U
  122. #define PIOB_LCDDAT12 23U
  123. #define PIOB_LCDDAT13 24U
  124. #define PIOB_LCDDAT14 25U
  125. #define PIOB_LCDDAT15 26U
  126. #define PIOB_LCDDAT16 27U
  127. #define PIOB_LCDDAT17 28U
  128. #define PIOB_LCDDAT18 29U
  129. #define PIOB_LCDDAT19 30U
  130. #define PIOB_LCDDAT20 31U
  131. #define PIOC_LCDDAT21 0U
  132. #define PIOC_LCDDAT22 1U
  133. #define PIOC_LCDDAT23 2U
  134. #define PIOC_LCDPWM 3U
  135. #define PIOC_LCDDISP 4U
  136. #define PIOC_LCDVSYNC 5U
  137. #define PIOC_LCDHSYNC 6U
  138. #define PIOC_LCDPCK 7U
  139. #define PIOC_LCDDEN 8U
  140. #define PIOC_IRQ9 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_SPI_FLEXCOM4_IO0 28U
  160. #define PIOC_SPI_FLEXCOM4_IO1 29U
  161. #define PIOC_SPI_FLEXCOM4_IO2 30U
  162. #define PIOC_SPI_FLEXCOM4_IO3 31U
  163. #define PIOD_SPI_FLEXCOM4_IO4 0U
  164. #define PIOD_IRQ1 1U
  165. #define PIOD_URXD1 2U
  166. #define PIOD_UTXD1 3U
  167. #define PIOD_TWD1 4U
  168. #define PIOD_TWCK1 5U
  169. #define PIOD_PIO6 6U
  170. #define PIOD_PIO7 7U
  171. #define PIOD_PIN8 8U
  172. #define PIOD_ETH_GTXCK 9U
  173. #define PIOD_ETH_GTXEN 10U
  174. #define PIOD_ETH_GRXDV 11U
  175. #define PIOD_ETH_GRXER 12U
  176. #define PIOD_ETH_GRX0 13U
  177. #define PIOD_ETH_GRX1 14U
  178. #define PIOD_ETH_GTX0 15U
  179. #define PIOD_ETH_GTX1 16U
  180. #define PIOD_ETH_GMDC 17U
  181. #define PIOD_ETH_GMDIO 18U
  182. #define PIOD_PIO19 19U
  183. #define PIOD_PIO20 20U
  184. #define PIOD_PIO21 21U
  185. #define PIOD_PIO22 22U
  186. #define PIOD_URXD2 23U
  187. #define PIOD_UTXD2 24U
  188. #define PIOD_PIO25 25U
  189. #define PIOD_PIO26 26U
  190. #define PIOD_PIO27 27U
  191. #define PIOD_PIO28 28U
  192. #define PIOD_PIO29 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_BLUE BOARD_LINE(PIOA, 31U)
  201. #define LINE_LED_GREEN BOARD_LINE(PIOB, 1U)
  202. #define LINE_LED_RED BOARD_LINE(PIOA, 10U)
  203. #define LINE_USER_PB BOARD_LINE(PIOA, 29U)
  204. #define LINE_IRQ9 BOARD_LINE(PIOC, 9U)
  205. #define LINE_ONEWIRE BOARD_LINE(PIOA, 17U)
  206. #if !defined(_FROM_ASM_)
  207. #ifdef __cplusplus
  208. extern "C" {
  209. #endif
  210. void boardInit(void);
  211. #ifdef __cplusplus
  212. }
  213. #endif
  214. #endif /* _FROM_ASM_ */
  215. #endif /* _BOARD_H_ */