mcuconf.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  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. * SPC560Bxx 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 SPC560Bxx_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_IDF_VALUE 1
  35. #define SPC5_FMPLL0_NDIV_VALUE 32
  36. #define SPC5_FMPLL0_ODF SPC5_FMPLL_ODF_DIV4
  37. #define SPC5_XOSCDIV_VALUE 1
  38. #define SPC5_IRCDIV_VALUE 1
  39. #define SPC5_PERIPHERAL1_CLK_DIV_VALUE 2
  40. #define SPC5_PERIPHERAL2_CLK_DIV_VALUE 2
  41. #define SPC5_PERIPHERAL3_CLK_DIV_VALUE 2
  42. #define SPC5_CLOCK_FAILURE_HOOK() osalSysHalt("clock failure")
  43. #define SPC5_EMIOS0_GPRE_VALUE 20
  44. #define SPC5_EMIOS1_GPRE_VALUE 20
  45. /*
  46. * EDMA driver settings.
  47. */
  48. #define SPC5_EDMA_CR_SETTING (EDMA_CR_GRP1PRI(1) | \
  49. EDMA_CR_GRP0PRI(0) | \
  50. EDMA_CR_EMLM | \
  51. EDMA_CR_ERGA)
  52. #define SPC5_EDMA_GROUP0_PRIORITIES 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
  53. #define SPC5_EDMA_ERROR_IRQ_PRIO 12
  54. #define SPC5_EDMA_ERROR_HANDLER() osalSysHalt("DMA failure")
  55. /*
  56. * SERIAL driver system settings.
  57. */
  58. #define SPC5_SERIAL_USE_LINFLEX0 TRUE
  59. #define SPC5_SERIAL_USE_LINFLEX1 FALSE
  60. #define SPC5_SERIAL_USE_LINFLEX2 FALSE
  61. #define SPC5_SERIAL_USE_LINFLEX3 FALSE
  62. #define SPC5_SERIAL_USE_LINFLEX4 FALSE
  63. #define SPC5_SERIAL_USE_LINFLEX5 FALSE
  64. #define SPC5_SERIAL_USE_LINFLEX6 FALSE
  65. #define SPC5_SERIAL_USE_LINFLEX7 FALSE
  66. #define SPC5_SERIAL_USE_LINFLEX8 FALSE
  67. #define SPC5_SERIAL_USE_LINFLEX9 FALSE
  68. #define SPC5_SERIAL_LINFLEX0_PRIORITY 8
  69. #define SPC5_SERIAL_LINFLEX1_PRIORITY 8
  70. #define SPC5_SERIAL_LINFLEX2_PRIORITY 8
  71. #define SPC5_SERIAL_LINFLEX3_PRIORITY 8
  72. #define SPC5_SERIAL_LINFLEX4_PRIORITY 8
  73. #define SPC5_SERIAL_LINFLEX5_PRIORITY 8
  74. #define SPC5_SERIAL_LINFLEX6_PRIORITY 8
  75. #define SPC5_SERIAL_LINFLEX7_PRIORITY 8
  76. #define SPC5_SERIAL_LINFLEX8_PRIORITY 8
  77. #define SPC5_SERIAL_LINFLEX9_PRIORITY 8
  78. /*
  79. * SPI driver system settings.
  80. */
  81. #define SPC5_SPI_USE_DSPI0 FALSE
  82. #define SPC5_SPI_USE_DSPI1 FALSE
  83. #define SPC5_SPI_USE_DSPI2 FALSE
  84. #define SPC5_SPI_USE_DSPI3 FALSE
  85. #define SPC5_SPI_USE_DSPI4 FALSE
  86. #define SPC5_SPI_USE_DSPI5 FALSE
  87. #define SPC5_SPI_DMA_MODE SPC5_SPI_DMA_RX_ONLY
  88. #define SPC5_SPI_DSPI0_MCR (0 | SPC5_MCR_PCSIS0 | SPC5_MCR_PCSIS1 | SPC5_MCR_PCSIS2 | SPC5_MCR_PCSIS3 | SPC5_MCR_PCSIS4 | SPC5_MCR_PCSIS5)
  89. #define SPC5_SPI_DSPI1_MCR (0 | SPC5_MCR_PCSIS0 | SPC5_MCR_PCSIS1 | SPC5_MCR_PCSIS2 | SPC5_MCR_PCSIS3 | SPC5_MCR_PCSIS4)
  90. #define SPC5_SPI_DSPI2_MCR (0 | SPC5_MCR_PCSIS0 | SPC5_MCR_PCSIS1 | SPC5_MCR_PCSIS2 | SPC5_MCR_PCSIS3)
  91. #define SPC5_SPI_DSPI3_MCR (0 | SPC5_MCR_PCSIS0 | SPC5_MCR_PCSIS1)
  92. #define SPC5_SPI_DSPI4_MCR (0 | SPC5_MCR_PCSIS0 | SPC5_MCR_PCSIS1)
  93. #define SPC5_SPI_DSPI5_MCR (0 | SPC5_MCR_PCSIS0 | SPC5_MCR_PCSIS1)
  94. #define SPC5_SPI_DSPI0_TX1_DMA_CH_ID 4
  95. #define SPC5_SPI_DSPI0_TX2_DMA_CH_ID 5
  96. #define SPC5_SPI_DSPI0_RX_DMA_CH_ID 6
  97. #define SPC5_SPI_DSPI1_TX1_DMA_CH_ID 7
  98. #define SPC5_SPI_DSPI1_TX2_DMA_CH_ID 8
  99. #define SPC5_SPI_DSPI1_RX_DMA_CH_ID 9
  100. #define SPC5_SPI_DSPI2_TX1_DMA_CH_ID 10
  101. #define SPC5_SPI_DSPI2_TX2_DMA_CH_ID 11
  102. #define SPC5_SPI_DSPI2_RX_DMA_CH_ID 12
  103. #define SPC5_SPI_DSPI3_TX1_DMA_CH_ID 13
  104. #define SPC5_SPI_DSPI3_TX2_DMA_CH_ID 14
  105. #define SPC5_SPI_DSPI3_RX_DMA_CH_ID 15
  106. #define SPC5_SPI_DSPI4_TX1_DMA_CH_ID 1
  107. #define SPC5_SPI_DSPI4_TX2_DMA_CH_ID 2
  108. #define SPC5_SPI_DSPI4_RX_DMA_CH_ID 3
  109. #define SPC5_SPI_DSPI5_TX1_DMA_CH_ID 4
  110. #define SPC5_SPI_DSPI5_TX2_DMA_CH_ID 5
  111. #define SPC5_SPI_DSPI5_RX_DMA_CH_ID 6
  112. #define SPC5_SPI_DSPI0_DMA_IRQ_PRIO 10
  113. #define SPC5_SPI_DSPI1_DMA_IRQ_PRIO 10
  114. #define SPC5_SPI_DSPI2_DMA_IRQ_PRIO 10
  115. #define SPC5_SPI_DSPI3_DMA_IRQ_PRIO 10
  116. #define SPC5_SPI_DSPI4_DMA_IRQ_PRIO 10
  117. #define SPC5_SPI_DSPI5_DMA_IRQ_PRIO 10
  118. #define SPC5_SPI_DSPI0_IRQ_PRIO 10
  119. #define SPC5_SPI_DSPI1_IRQ_PRIO 10
  120. #define SPC5_SPI_DSPI2_IRQ_PRIO 10
  121. #define SPC5_SPI_DSPI3_IRQ_PRIO 10
  122. #define SPC5_SPI_DSPI4_IRQ_PRIO 10
  123. #define SPC5_SPI_DSPI5_IRQ_PRIO 10
  124. #define SPC5_SPI_DMA_ERROR_HOOK(spip) osalSysHalt("DSPI DMA failure")
  125. /*
  126. * ICU-PWM driver system settings.
  127. */
  128. #define SPC5_ICU_USE_EMIOS0_CH0 FALSE
  129. #define SPC5_ICU_USE_EMIOS0_CH1 FALSE
  130. #define SPC5_ICU_USE_EMIOS0_CH2 FALSE
  131. #define SPC5_ICU_USE_EMIOS0_CH3 FALSE
  132. #define SPC5_ICU_USE_EMIOS0_CH4 FALSE
  133. #define SPC5_ICU_USE_EMIOS0_CH5 FALSE
  134. #define SPC5_ICU_USE_EMIOS0_CH6 FALSE
  135. #define SPC5_ICU_USE_EMIOS0_CH7 FALSE
  136. #define SPC5_ICU_USE_EMIOS0_CH24 FALSE
  137. #define SPC5_PWM_USE_EMIOS0_GROUP0 FALSE
  138. #define SPC5_PWM_USE_EMIOS0_GROUP1 FALSE
  139. #define SPC5_EMIOS0_GFR_F0F1_PRIORITY 8
  140. #define SPC5_EMIOS0_GFR_F2F3_PRIORITY 8
  141. #define SPC5_EMIOS0_GFR_F4F5_PRIORITY 8
  142. #define SPC5_EMIOS0_GFR_F6F7_PRIORITY 8
  143. #define SPC5_EMIOS0_GFR_F8F9_PRIORITY 8
  144. #define SPC5_EMIOS0_GFR_F10F11_PRIORITY 8
  145. #define SPC5_EMIOS0_GFR_F12F13_PRIORITY 8
  146. #define SPC5_EMIOS0_GFR_F14F15_PRIORITY 8
  147. #define SPC5_EMIOS0_GFR_F16F17_PRIORITY 8
  148. #define SPC5_EMIOS0_GFR_F18F19_PRIORITY 8
  149. #define SPC5_EMIOS0_GFR_F20F21_PRIORITY 8
  150. #define SPC5_EMIOS0_GFR_F22F23_PRIORITY 8
  151. #define SPC5_EMIOS0_GFR_F24F25_PRIORITY 8
  152. #define SPC5_EMIOS0_START_PCTL (SPC5_ME_PCTL_RUN(1) | \
  153. SPC5_ME_PCTL_LP(2))
  154. #define SPC5_EMIOS0_STOP_PCTL (SPC5_ME_PCTL_RUN(0) | \
  155. SPC5_ME_PCTL_LP(0))
  156. #define SPC5_ICU_USE_EMIOS1_CH24 FALSE
  157. #define SPC5_PWM_USE_EMIOS1_GROUP0 FALSE
  158. #define SPC5_PWM_USE_EMIOS1_GROUP1 FALSE
  159. #define SPC5_PWM_USE_EMIOS1_GROUP2 FALSE
  160. #define SPC5_EMIOS1_GFR_F0F1_PRIORITY 8
  161. #define SPC5_EMIOS1_GFR_F2F3_PRIORITY 8
  162. #define SPC5_EMIOS1_GFR_F4F5_PRIORITY 8
  163. #define SPC5_EMIOS1_GFR_F6F7_PRIORITY 8
  164. #define SPC5_EMIOS1_GFR_F8F9_PRIORITY 8
  165. #define SPC5_EMIOS1_GFR_F10F11_PRIORITY 8
  166. #define SPC5_EMIOS1_GFR_F12F13_PRIORITY 8
  167. #define SPC5_EMIOS1_GFR_F14F15_PRIORITY 8
  168. #define SPC5_EMIOS1_GFR_F16F17_PRIORITY 8
  169. #define SPC5_EMIOS1_GFR_F18F19_PRIORITY 8
  170. #define SPC5_EMIOS1_GFR_F20F21_PRIORITY 8
  171. #define SPC5_EMIOS1_GFR_F22F23_PRIORITY 8
  172. #define SPC5_EMIOS1_GFR_F24F25_PRIORITY 8
  173. #define SPC5_EMIOS1_START_PCTL (SPC5_ME_PCTL_RUN(1) | \
  174. SPC5_ME_PCTL_LP(2))
  175. #define SPC5_EMIOS1_STOP_PCTL (SPC5_ME_PCTL_RUN(0) | \
  176. SPC5_ME_PCTL_LP(0))
  177. /*
  178. * CAN driver system settings.
  179. */
  180. #define SPC5_CAN_USE_FILTERS FALSE
  181. #define SPC5_CAN_USE_FLEXCAN0 FALSE
  182. #define SPC5_CAN_FLEXCAN0_USE_EXT_CLK FALSE
  183. #define SPC5_CAN_FLEXCAN0_PRIORITY 11
  184. #define SPC5_CAN_FLEXCAN0_START_PCTL (SPC5_ME_PCTL_RUN(1) | \
  185. SPC5_ME_PCTL_LP(2))
  186. #define SPC5_CAN_FLEXCAN0_STOP_PCTL (SPC5_ME_PCTL_RUN(0) | \
  187. SPC5_ME_PCTL_LP(0))
  188. #define SPC5_CAN_USE_FLEXCAN1 FALSE
  189. #define SPC5_CAN_FLEXCAN1_USE_EXT_CLK FALSE
  190. #define SPC5_CAN_FLEXCAN1_PRIORITY 11
  191. #define SPC5_CAN_FLEXCAN1_START_PCTL (SPC5_ME_PCTL_RUN(1) | \
  192. SPC5_ME_PCTL_LP(2))
  193. #define SPC5_CAN_FLEXCAN1_STOP_PCTL (SPC5_ME_PCTL_RUN(0) | \
  194. SPC5_ME_PCTL_LP(0))
  195. #define SPC5_CAN_USE_FLEXCAN2 FALSE
  196. #define SPC5_CAN_FLEXCAN2_USE_EXT_CLK FALSE
  197. #define SPC5_CAN_FLEXCAN2_PRIORITY 11
  198. #define SPC5_CAN_FLEXCAN2_START_PCTL (SPC5_ME_PCTL_RUN(1) | \
  199. SPC5_ME_PCTL_LP(2))
  200. #define SPC5_CAN_FLEXCAN2_STOP_PCTL (SPC5_ME_PCTL_RUN(0) | \
  201. SPC5_ME_PCTL_LP(0))
  202. #define SPC5_CAN_USE_FLEXCAN3 FALSE
  203. #define SPC5_CAN_FLEXCAN3_USE_EXT_CLK FALSE
  204. #define SPC5_CAN_FLEXCAN3_PRIORITY 11
  205. #define SPC5_CAN_FLEXCAN3_START_PCTL (SPC5_ME_PCTL_RUN(1) | \
  206. SPC5_ME_PCTL_LP(2))
  207. #define SPC5_CAN_FLEXCAN3_STOP_PCTL (SPC5_ME_PCTL_RUN(0) | \
  208. SPC5_ME_PCTL_LP(0))
  209. #define SPC5_CAN_USE_FLEXCAN4 FALSE
  210. #define SPC5_CAN_FLEXCAN4_USE_EXT_CLK FALSE
  211. #define SPC5_CAN_FLEXCAN4_PRIORITY 11
  212. #define SPC5_CAN_FLEXCAN4_START_PCTL (SPC5_ME_PCTL_RUN(1) | \
  213. SPC5_ME_PCTL_LP(2))
  214. #define SPC5_CAN_FLEXCAN4_STOP_PCTL (SPC5_ME_PCTL_RUN(0) | \
  215. SPC5_ME_PCTL_LP(0))
  216. #define SPC5_CAN_USE_FLEXCAN5 FALSE
  217. #define SPC5_CAN_FLEXCAN5_PRIORITY 11
  218. #define SPC5_CAN_FLEXCAN5_START_PCTL (SPC5_ME_PCTL_RUN(1) | \
  219. SPC5_ME_PCTL_LP(2))
  220. #define SPC5_CAN_FLEXCAN5_STOP_PCTL (SPC5_ME_PCTL_RUN(0) | \
  221. SPC5_ME_PCTL_LP(0))
  222. /*
  223. * ADC driver system settings.
  224. */
  225. #define SPC5_ADC_USE_ADC0 FALSE
  226. #define SPC5_ADC_ADC0_CLK_FREQUENCY HALF_PERIPHERAL_SET_CLOCK_FREQUENCY
  227. #define SPC5_ADC_ADC0_AUTO_CLOCK_OFF FALSE
  228. #define SPC5_ADC_ADC0_WD_PRIORITY 12
  229. #define SPC5_ADC_ADC0_DMA_CH_ID 1
  230. #define SPC5_ADC_ADC0_DMA_IRQ_PRIO 12
  231. #define SPC5_ADC_ADC0_START_PCTL (SPC5_ME_PCTL_RUN(1) | \
  232. SPC5_ME_PCTL_LP(2))
  233. #define SPC5_ADC_ADC0_STOP_PCTL (SPC5_ME_PCTL_RUN(0) | \
  234. SPC5_ME_PCTL_LP(0))
  235. #define SPC5_ADC_USE_ADC1 FALSE
  236. #define SPC5_ADC_ADC1_CLK_FREQUENCY HALF_PERIPHERAL_SET_CLOCK_FREQUENCY
  237. #define SPC5_ADC_ADC1_AUTO_CLOCK_OFF FALSE
  238. #define SPC5_ADC_ADC1_WD_PRIORITY 12
  239. #define SPC5_ADC_ADC1_DMA_CH_ID 2
  240. #define SPC5_ADC_ADC1_DMA_IRQ_PRIO 12
  241. #define SPC5_ADC_ADC1_START_PCTL (SPC5_ME_PCTL_RUN(1) | \
  242. SPC5_ME_PCTL_LP(2))
  243. #define SPC5_ADC_ADC1_STOP_PCTL (SPC5_ME_PCTL_RUN(0) | \
  244. SPC5_ME_PCTL_LP(0))
  245. #endif /* MCUCONF_H */