mcuconf.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  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 MCUCONF_H
  14. #define MCUCONF_H
  15. /*
  16. * SPC56ELxx drivers configuration.
  17. * The following settings override the default settings present in
  18. * the various device driver implementation headers.
  19. * Note that the settings for each driver only have effect if the whole
  20. * driver is enabled in halconf.h.
  21. *
  22. * IRQ priorities:
  23. * 1...15 Lowest...Highest.
  24. * DMA priorities:
  25. * 0...15 Highest...Lowest.
  26. */
  27. #define SPC56ELxx_MCUCONF
  28. /*
  29. * HAL driver system settings.
  30. */
  31. #define SPC5_NO_INIT FALSE
  32. #define SPC5_ALLOW_OVERCLOCK FALSE
  33. #define SPC5_DISABLE_WATCHDOG TRUE
  34. #define SPC5_FMPLL0_CLK_SRC SPC5_FMPLL_SRC_XOSC
  35. #define SPC5_FMPLL0_IDF_VALUE 5
  36. #define SPC5_FMPLL0_NDIV_VALUE 60
  37. #define SPC5_FMPLL0_ODF SPC5_FMPLL_ODF_DIV4
  38. #define SPC5_FMPLL1_CLK_SRC SPC5_FMPLL_SRC_XOSC
  39. #define SPC5_FMPLL1_IDF_VALUE 5
  40. #define SPC5_FMPLL1_NDIV_VALUE 60
  41. #define SPC5_FMPLL1_ODF SPC5_FMPLL_ODF_DIV4
  42. #define SPC5_SYSCLK_DIVIDER_VALUE 2
  43. #define SPC5_AUX0CLK_SRC SPC5_CGM_SS_FMPLL1
  44. #define SPC5_MCONTROL_DIVIDER_VALUE 15
  45. #define SPC5_SWG_DIVIDER_VALUE 2
  46. #define SPC5_AUX1CLK_SRC SPC5_CGM_SS_FMPLL1
  47. #define SPC5_FLEXRAY_DIVIDER_VALUE 2
  48. #define SPC5_AUX2CLK_SRC SPC5_CGM_SS_FMPLL1
  49. #define SPC5_FLEXCAN_DIVIDER_VALUE 2
  50. #define SPC5_ME_ME_BITS (SPC5_ME_ME_RUN1 | \
  51. SPC5_ME_ME_RUN2 | \
  52. SPC5_ME_ME_RUN3 | \
  53. SPC5_ME_ME_HALT0 | \
  54. SPC5_ME_ME_STOP0)
  55. #define SPC5_ME_SAFE_MC_BITS (SPC5_ME_MC_PDO)
  56. #define SPC5_ME_DRUN_MC_BITS (SPC5_ME_MC_SYSCLK_FMPLL0 | \
  57. SPC5_ME_MC_IRCON | \
  58. SPC5_ME_MC_XOSC0ON | \
  59. SPC5_ME_MC_PLL0ON | \
  60. SPC5_ME_MC_PLL1ON | \
  61. SPC5_ME_MC_FLAON_NORMAL | \
  62. SPC5_ME_MC_MVRON)
  63. #define SPC5_ME_RUN0_MC_BITS (SPC5_ME_MC_SYSCLK_FMPLL0 | \
  64. SPC5_ME_MC_IRCON | \
  65. SPC5_ME_MC_XOSC0ON | \
  66. SPC5_ME_MC_PLL0ON | \
  67. SPC5_ME_MC_PLL1ON | \
  68. SPC5_ME_MC_FLAON_NORMAL | \
  69. SPC5_ME_MC_MVRON)
  70. #define SPC5_ME_RUN1_MC_BITS (SPC5_ME_MC_SYSCLK_FMPLL0 | \
  71. SPC5_ME_MC_IRCON | \
  72. SPC5_ME_MC_XOSC0ON | \
  73. SPC5_ME_MC_PLL0ON | \
  74. SPC5_ME_MC_PLL1ON | \
  75. SPC5_ME_MC_FLAON_NORMAL | \
  76. SPC5_ME_MC_MVRON)
  77. #define SPC5_ME_RUN2_MC_BITS (SPC5_ME_MC_SYSCLK_FMPLL0 | \
  78. SPC5_ME_MC_IRCON | \
  79. SPC5_ME_MC_XOSC0ON | \
  80. SPC5_ME_MC_PLL0ON | \
  81. SPC5_ME_MC_PLL1ON | \
  82. SPC5_ME_MC_FLAON_NORMAL | \
  83. SPC5_ME_MC_MVRON)
  84. #define SPC5_ME_RUN3_MC_BITS (SPC5_ME_MC_SYSCLK_FMPLL0 | \
  85. SPC5_ME_MC_IRCON | \
  86. SPC5_ME_MC_XOSC0ON | \
  87. SPC5_ME_MC_PLL0ON | \
  88. SPC5_ME_MC_PLL1ON | \
  89. SPC5_ME_MC_FLAON_NORMAL | \
  90. SPC5_ME_MC_MVRON)
  91. #define SPC5_ME_HALT0_MC_BITS (SPC5_ME_MC_SYSCLK_FMPLL0 | \
  92. SPC5_ME_MC_IRCON | \
  93. SPC5_ME_MC_XOSC0ON | \
  94. SPC5_ME_MC_PLL0ON | \
  95. SPC5_ME_MC_PLL1ON | \
  96. SPC5_ME_MC_FLAON_NORMAL | \
  97. SPC5_ME_MC_MVRON)
  98. #define SPC5_ME_STOP0_MC_BITS (SPC5_ME_MC_SYSCLK_FMPLL0 | \
  99. SPC5_ME_MC_IRCON | \
  100. SPC5_ME_MC_XOSC0ON | \
  101. SPC5_ME_MC_PLL0ON | \
  102. SPC5_ME_MC_PLL1ON | \
  103. SPC5_ME_MC_FLAON_NORMAL | \
  104. SPC5_ME_MC_MVRON)
  105. #define SPC5_ME_RUN_PC3_BITS (SPC5_ME_RUN_PC_RUN0 | \
  106. SPC5_ME_RUN_PC_RUN1 | \
  107. SPC5_ME_RUN_PC_RUN2 | \
  108. SPC5_ME_RUN_PC_RUN3)
  109. #define SPC5_ME_RUN_PC4_BITS (SPC5_ME_RUN_PC_RUN0 | \
  110. SPC5_ME_RUN_PC_RUN1 | \
  111. SPC5_ME_RUN_PC_RUN2 | \
  112. SPC5_ME_RUN_PC_RUN3)
  113. #define SPC5_ME_RUN_PC5_BITS (SPC5_ME_RUN_PC_RUN0 | \
  114. SPC5_ME_RUN_PC_RUN1 | \
  115. SPC5_ME_RUN_PC_RUN2 | \
  116. SPC5_ME_RUN_PC_RUN3)
  117. #define SPC5_ME_RUN_PC6_BITS (SPC5_ME_RUN_PC_RUN0 | \
  118. SPC5_ME_RUN_PC_RUN1 | \
  119. SPC5_ME_RUN_PC_RUN2 | \
  120. SPC5_ME_RUN_PC_RUN3)
  121. #define SPC5_ME_RUN_PC7_BITS (SPC5_ME_RUN_PC_RUN0 | \
  122. SPC5_ME_RUN_PC_RUN1 | \
  123. SPC5_ME_RUN_PC_RUN2 | \
  124. SPC5_ME_RUN_PC_RUN3)
  125. #define SPC5_ME_LP_PC4_BITS (SPC5_ME_LP_PC_HALT0 | \
  126. SPC5_ME_LP_PC_STOP0)
  127. #define SPC5_ME_LP_PC5_BITS (SPC5_ME_LP_PC_HALT0 | \
  128. SPC5_ME_LP_PC_STOP0)
  129. #define SPC5_ME_LP_PC6_BITS (SPC5_ME_LP_PC_HALT0 | \
  130. SPC5_ME_LP_PC_STOP0)
  131. #define SPC5_ME_LP_PC7_BITS (SPC5_ME_LP_PC_HALT0 | \
  132. SPC5_ME_LP_PC_STOP0)
  133. #define SPC5_CLOCK_FAILURE_HOOK() chSysHalt("Clock failure")
  134. /*
  135. * EDMA driver settings.
  136. */
  137. #define SPC5_EDMA_CR_SETTING 0
  138. #define SPC5_EDMA_GROUP0_PRIORITIES \
  139. 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
  140. #define SPC5_EDMA_ERROR_IRQ_PRIO 12
  141. #define SPC5_EDMA_ERROR_HANDLER() chSysHalt("DMA failure")
  142. /*
  143. * SERIAL driver system settings.
  144. */
  145. #define SPC5_SERIAL_USE_LINFLEX0 TRUE
  146. #define SPC5_SERIAL_USE_LINFLEX1 TRUE
  147. #define SPC5_SERIAL_LINFLEX0_PRIORITY 8
  148. #define SPC5_SERIAL_LINFLEX1_PRIORITY 8
  149. #define SPC5_SERIAL_LINFLEX0_START_PCTL (SPC5_ME_PCTL_RUN(1) | \
  150. SPC5_ME_PCTL_LP(2))
  151. #define SPC5_SERIAL_LINFLEX0_STOP_PCTL (SPC5_ME_PCTL_RUN(0) | \
  152. SPC5_ME_PCTL_LP(0))
  153. #define SPC5_SERIAL_LINFLEX1_START_PCTL (SPC5_ME_PCTL_RUN(1) | \
  154. SPC5_ME_PCTL_LP(2))
  155. #define SPC5_SERIAL_LINFLEX1_STOP_PCTL (SPC5_ME_PCTL_RUN(0) | \
  156. SPC5_ME_PCTL_LP(0))
  157. /*
  158. * PWM driver system settings.
  159. */
  160. #define SPC5_PWM_USE_SMOD0 FALSE
  161. #define SPC5_PWM_USE_SMOD1 FALSE
  162. #define SPC5_PWM_USE_SMOD2 FALSE
  163. #define SPC5_PWM_USE_SMOD3 FALSE
  164. #define SPC5_PWM_SMOD0_PRIORITY 7
  165. #define SPC5_PWM_SMOD1_PRIORITY 7
  166. #define SPC5_PWM_SMOD2_PRIORITY 7
  167. #define SPC5_PWM_SMOD3_PRIORITY 7
  168. #define SPC5_PWM_FLEXPWM0_START_PCTL (SPC5_ME_PCTL_RUN(1) | \
  169. SPC5_ME_PCTL_LP(2))
  170. #define SPC5_PWM_FLEXPWM0_STOP_PCTL (SPC5_ME_PCTL_RUN(0) | \
  171. SPC5_ME_PCTL_LP(0))
  172. #define SPC5_PWM_USE_SMOD4 FALSE
  173. #define SPC5_PWM_USE_SMOD5 FALSE
  174. #define SPC5_PWM_USE_SMOD6 FALSE
  175. #define SPC5_PWM_USE_SMOD7 FALSE
  176. #define SPC5_PWM_SMOD4_PRIORITY 7
  177. #define SPC5_PWM_SMOD5_PRIORITY 7
  178. #define SPC5_PWM_SMOD6_PRIORITY 7
  179. #define SPC5_PWM_SMOD7_PRIORITY 7
  180. #define SPC5_PWM_FLEXPWM1_START_PCTL (SPC5_ME_PCTL_RUN(1) | \
  181. SPC5_ME_PCTL_LP(2))
  182. #define SPC5_PWM_FLEXPWM1_STOP_PCTL (SPC5_ME_PCTL_RUN(0) | \
  183. SPC5_ME_PCTL_LP(0))
  184. /*
  185. * ICU driver system settings.
  186. */
  187. #define SPC5_ICU_USE_SMOD0 FALSE
  188. #define SPC5_ICU_USE_SMOD1 FALSE
  189. #define SPC5_ICU_USE_SMOD2 FALSE
  190. #define SPC5_ICU_USE_SMOD3 FALSE
  191. #define SPC5_ICU_USE_SMOD4 FALSE
  192. #define SPC5_ICU_USE_SMOD5 FALSE
  193. #define SPC5_ICU_ETIMER0_PRIORITY 7
  194. #define SPC5_ICU_ETIMER0_START_PCTL (SPC5_ME_PCTL_RUN(1) | \
  195. SPC5_ME_PCTL_LP(2))
  196. #define SPC5_ICU_ETIMER0_STOP_PCTL (SPC5_ME_PCTL_RUN(0) | \
  197. SPC5_ME_PCTL_LP(0))
  198. #define SPC5_ICU_USE_SMOD6 FALSE
  199. #define SPC5_ICU_USE_SMOD7 FALSE
  200. #define SPC5_ICU_USE_SMOD8 FALSE
  201. #define SPC5_ICU_USE_SMOD9 FALSE
  202. #define SPC5_ICU_USE_SMOD10 FALSE
  203. #define SPC5_ICU_USE_SMOD11 FALSE
  204. #define SPC5_ICU_ETIMER1_PRIORITY 7
  205. #define SPC5_ICU_ETIMER1_START_PCTL (SPC5_ME_PCTL_RUN(1) | \
  206. SPC5_ME_PCTL_LP(2))
  207. #define SPC5_ICU_ETIMER1_STOP_PCTL (SPC5_ME_PCTL_RUN(0) | \
  208. SPC5_ME_PCTL_LP(0))
  209. #define SPC5_ICU_USE_SMOD12 FALSE
  210. #define SPC5_ICU_USE_SMOD13 FALSE
  211. #define SPC5_ICU_USE_SMOD14 FALSE
  212. #define SPC5_ICU_USE_SMOD15 FALSE
  213. #define SPC5_ICU_USE_SMOD16 FALSE
  214. #define SPC5_ICU_USE_SMOD17 FALSE
  215. #define SPC5_ICU_ETIMER2_PRIORITY 7
  216. #define SPC5_ICU_ETIMER2_START_PCTL (SPC5_ME_PCTL_RUN(1) | \
  217. SPC5_ME_PCTL_LP(2))
  218. #define SPC5_ICU_ETIMER2_STOP_PCTL (SPC5_ME_PCTL_RUN(0) | \
  219. SPC5_ME_PCTL_LP(0))
  220. /*
  221. * SPI driver system settings.
  222. */
  223. #define SPC5_SPI_USE_DSPI0 FALSE
  224. #define SPC5_SPI_USE_DSPI1 FALSE
  225. #define SPC5_SPI_USE_DSPI2 FALSE
  226. #define SPC5_SPI_DSPI0_MCR (SPC5_MCR_PCSIS0 | \
  227. SPC5_MCR_PCSIS1 | \
  228. SPC5_MCR_PCSIS2 | \
  229. SPC5_MCR_PCSIS3 | \
  230. SPC5_MCR_PCSIS4 | \
  231. SPC5_MCR_PCSIS5 | \
  232. SPC5_MCR_PCSIS6 | \
  233. SPC5_MCR_PCSIS7)
  234. #define SPC5_SPI_DSPI1_MCR (SPC5_MCR_PCSIS0 | \
  235. SPC5_MCR_PCSIS1 | \
  236. SPC5_MCR_PCSIS2 | \
  237. SPC5_MCR_PCSIS3 | \
  238. SPC5_MCR_PCSIS4 | \
  239. SPC5_MCR_PCSIS5 | \
  240. SPC5_MCR_PCSIS6 | \
  241. SPC5_MCR_PCSIS7)
  242. #define SPC5_SPI_DSPI2_MCR (SPC5_MCR_PCSIS0 | \
  243. SPC5_MCR_PCSIS1 | \
  244. SPC5_MCR_PCSIS2 | \
  245. SPC5_MCR_PCSIS3 | \
  246. SPC5_MCR_PCSIS4 | \
  247. SPC5_MCR_PCSIS5 | \
  248. SPC5_MCR_PCSIS6 | \
  249. SPC5_MCR_PCSIS7)
  250. #define SPC5_SPI_DSPI0_TX1_DMA_CH_ID 4
  251. #define SPC5_SPI_DSPI0_TX2_DMA_CH_ID 5
  252. #define SPC5_SPI_DSPI0_RX_DMA_CH_ID 6
  253. #define SPC5_SPI_DSPI1_TX1_DMA_CH_ID 7
  254. #define SPC5_SPI_DSPI1_TX2_DMA_CH_ID 8
  255. #define SPC5_SPI_DSPI1_RX_DMA_CH_ID 9
  256. #define SPC5_SPI_DSPI2_TX1_DMA_CH_ID 10
  257. #define SPC5_SPI_DSPI2_TX2_DMA_CH_ID 11
  258. #define SPC5_SPI_DSPI2_RX_DMA_CH_ID 12
  259. #define SPC5_SPI_DSPI0_DMA_IRQ_PRIO 10
  260. #define SPC5_SPI_DSPI1_DMA_IRQ_PRIO 10
  261. #define SPC5_SPI_DSPI2_DMA_IRQ_PRIO 10
  262. #define SPC5_SPI_DSPI0_IRQ_PRIO 10
  263. #define SPC5_SPI_DSPI1_IRQ_PRIO 10
  264. #define SPC5_SPI_DSPI2_IRQ_PRIO 10
  265. #define SPC5_SPI_DMA_ERROR_HOOK(spip) chSysHalt("DMA failure")
  266. #define SPC5_SPI_DSPI0_START_PCTL (SPC5_ME_PCTL_RUN(1) | \
  267. SPC5_ME_PCTL_LP(2))
  268. #define SPC5_SPI_DSPI0_STOP_PCTL (SPC5_ME_PCTL_RUN(0) | \
  269. SPC5_ME_PCTL_LP(0))
  270. #define SPC5_SPI_DSPI1_START_PCTL (SPC5_ME_PCTL_RUN(1) | \
  271. SPC5_ME_PCTL_LP(2))
  272. #define SPC5_SPI_DSPI1_STOP_PCTL (SPC5_ME_PCTL_RUN(0) | \
  273. SPC5_ME_PCTL_LP(0))
  274. #define SPC5_SPI_DSPI2_START_PCTL (SPC5_ME_PCTL_RUN(1) | \
  275. SPC5_ME_PCTL_LP(2))
  276. #define SPC5_SPI_DSPI2_STOP_PCTL (SPC5_ME_PCTL_RUN(0) | \
  277. SPC5_ME_PCTL_LP(0))
  278. #endif /* MCUCONF_H */