mcuconf.h.ftl 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452
  1. [#ftl]
  2. <#--
  3. -- Decodes a ME_xxx_MC register description node.
  4. -->
  5. [#function decode_mc node]
  6. [#assign s = "" /]
  7. [#if node.pdo.value[0]?lower_case == "true"]
  8. [#assign s = s + " | SPC5_ME_MC_PDO" /]
  9. [/#if]
  10. [#if node.mvron.value[0]?lower_case == "true"]
  11. [#assign s = s + " | SPC5_ME_MC_MVRON" /]
  12. [/#if]
  13. [#assign n = node.dflaon.@index[0]?trim?number /]
  14. [#if n == 0]
  15. [#assign s = s + " | SPC5_ME_MC_DFLAON_NORMAL" /]
  16. [#elseif n == 1]
  17. [#assign s = s + " | SPC5_ME_MC_DFLAON_LP" /]
  18. [#else]
  19. [#assign s = s + " | SPC5_ME_MC_DFLAON_PD" /]
  20. [/#if]
  21. [#assign n = node.cflaon.@index[0]?trim?number /]
  22. [#if n == 0]
  23. [#assign s = s + " | SPC5_ME_MC_CFLAON_NORMAL" /]
  24. [#elseif n == 1]
  25. [#assign s = s + " | SPC5_ME_MC_CFLAON_LP" /]
  26. [#else]
  27. [#assign s = s + " | SPC5_ME_MC_CFLAON_PD" /]
  28. [/#if]
  29. [#if node.pll1on.value[0]?lower_case == "true"]
  30. [#assign s = s + " | SPC5_ME_MC_PLL1ON" /]
  31. [/#if]
  32. [#if node.pll0on.value[0]?lower_case == "true"]
  33. [#assign s = s + " | SPC5_ME_MC_PLL0ON" /]
  34. [/#if]
  35. [#if node.xosc0on.value[0]?lower_case == "true"]
  36. [#assign s = s + " | SPC5_ME_MC_XOSC0ON" /]
  37. [/#if]
  38. [#if node.ircon.value[0]?lower_case == "true"]
  39. [#assign s = s + " | SPC5_ME_MC_IRCON" /]
  40. [/#if]
  41. [#assign n = node.sysclk.@index[0]?trim?number /]
  42. [#if n == 0]
  43. [#assign s = s + " | SPC5_ME_MC_SYSCLK_IRC" /]
  44. [#elseif n == 1]
  45. [#assign s = s + " | SPC5_ME_MC_SYSCLK_XOSC" /]
  46. [#elseif n == 2]
  47. [#assign s = s + " | SPC5_ME_MC_SYSCLK_FMPLL0" /]
  48. [#elseif n == 3]
  49. [#assign s = s + " | SPC5_ME_MC_SYSCLK_FMPLL1" /]
  50. [#else]
  51. [#assign s = s + " | SPC5_ME_MC_SYSCLK_DISABLED" /]
  52. [/#if]
  53. [#return s]
  54. [/#function]
  55. <#--
  56. -- Decodes a ME_RUN_PCx register description node.
  57. -->
  58. [#function decode_runpc node]
  59. [#assign s = "" /]
  60. [#if node.safe.value[0]?lower_case == "true"]
  61. [#assign s = s + " | SPC5_ME_RUN_PC_SAFE" /]
  62. [/#if]
  63. [#if node.drun.value[0]?lower_case == "true"]
  64. [#assign s = s + " | SPC5_ME_RUN_PC_DRUN" /]
  65. [/#if]
  66. [#if node.run0.value[0]?lower_case == "true"]
  67. [#assign s = s + " | SPC5_ME_RUN_PC_RUN0" /]
  68. [/#if]
  69. [#if node.run1.value[0]?lower_case == "true"]
  70. [#assign s = s + " | SPC5_ME_RUN_PC_RUN1" /]
  71. [/#if]
  72. [#if node.run2.value[0]?lower_case == "true"]
  73. [#assign s = s + " | SPC5_ME_RUN_PC_RUN2" /]
  74. [/#if]
  75. [#if node.run3.value[0]?lower_case == "true"]
  76. [#assign s = s + " | SPC5_ME_RUN_PC_RUN3" /]
  77. [/#if]
  78. [#return s]
  79. [/#function]
  80. <#--
  81. -- Decodes a ME_LP_PCx register description node.
  82. -->
  83. [#function decode_lppc node]
  84. [#assign s = "" /]
  85. [#if node.halt0.value[0]?lower_case == "true"]
  86. [#assign s = s + " | SPC5_ME_LP_PC_HALT0" /]
  87. [/#if]
  88. [#if node.stop0.value[0]?lower_case == "true"]
  89. [#assign s = s + " | SPC5_ME_LP_PC_STOP0" /]
  90. [/#if]
  91. [#return s]
  92. [/#function]
  93. [@pp.dropOutputFile /]
  94. [@pp.changeOutputFile name="mcuconf.h" /]
  95. /*
  96. SPC5 HAL - Copyright (C) 2013 STMicroelectronics
  97. Licensed under the Apache License, Version 2.0 (the "License");
  98. you may not use this file except in compliance with the License.
  99. You may obtain a copy of the License at
  100. http://www.apache.org/licenses/LICENSE-2.0
  101. Unless required by applicable law or agreed to in writing, software
  102. distributed under the License is distributed on an "AS IS" BASIS,
  103. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  104. See the License for the specific language governing permissions and
  105. limitations under the License.
  106. */
  107. #ifndef _MCUCONF_H_
  108. #define _MCUCONF_H_
  109. /*
  110. * SPC560Pxx drivers configuration.
  111. * The following settings override the default settings present in
  112. * the various device driver implementation headers.
  113. * Note that the settings for each driver only have effect if the whole
  114. * driver is enabled in halconf.h.
  115. *
  116. * IRQ priorities:
  117. * 1...15 Lowest...Highest.
  118. * DMA priorities:
  119. * 0...15 Highest...Lowest.
  120. */
  121. #define SPC560Pxx_MCUCONF
  122. /*
  123. * HAL driver system settings.
  124. */
  125. #define SPC5_NO_INIT ${conf.instance.initialization_settings.do_not_init.value[0]?upper_case}
  126. #define SPC5_ALLOW_OVERCLOCK ${conf.instance.initialization_settings.allow_overclocking.value[0]?upper_case}
  127. #define SPC5_DISABLE_WATCHDOG ${conf.instance.initialization_settings.disable_watchdog.value[0]?upper_case}
  128. #define SPC5_FMPLL0_IDF_VALUE ${conf.instance.initialization_settings.fmpll0_settings.idf_value.value[0]}
  129. #define SPC5_FMPLL0_NDIV_VALUE ${conf.instance.initialization_settings.fmpll0_settings.ndiv_value.value[0]}
  130. #define SPC5_FMPLL0_ODF ${conf.instance.initialization_settings.fmpll0_settings.odf_value.value[0]}
  131. [#assign options = "" /]
  132. [#if conf.instance.initialization_settings.fmpll0_settings.progressive_clock_switching.value[0]?lower_case == "true"]
  133. [#assign options = options + " | SPC5_FMPLL_EN_PLL_SW" /]
  134. [/#if]
  135. [#if conf.instance.initialization_settings.fmpll0_settings.mask_fail_output.value[0]?lower_case == "true"]
  136. [#assign options = options + " | SPC5_FMPLL_PLL_FAIL_MASK" /]
  137. [/#if]
  138. #define SPC5_FMPLL0_OPTIONS (0${options})
  139. [#assign options = "" /]
  140. [#if conf.instance.initialization_settings.fmpll0_settings.fm_enable.value[0]?lower_case == "true"]
  141. [#assign options = options + " | SPC5_FMPLL_FM_EN" /]
  142. [#if conf.instance.initialization_settings.fmpll0_settings.spread_type.@index[0]?trim?number != 0]
  143. [#assign options = options + " | SPC5_FMPLL_SPRD_SEL" /]
  144. [/#if]
  145. [#assign options = options + " | SPC5_FMPLL_MOD_PERIOD(" + conf.instance.initialization_settings.fmpll0_settings.modulation_period.value[0]?trim + ")" /]
  146. [#assign options = options + " | SPC5_FMPLL_INC_STEP(" + conf.instance.initialization_settings.fmpll0_settings.increment_step.value[0]?trim + ")" /]
  147. [/#if]
  148. #define SPC5_FMPLL0_MR_INIT (0${options})
  149. #define SPC5_FMPLL1_IDF_VALUE ${conf.instance.initialization_settings.fmpll1_settings.idf_value.value[0]}
  150. #define SPC5_FMPLL1_NDIV_VALUE ${conf.instance.initialization_settings.fmpll1_settings.ndiv_value.value[0]}
  151. #define SPC5_FMPLL1_ODF ${conf.instance.initialization_settings.fmpll1_settings.odf_value.value[0]}
  152. [#assign options = "" /]
  153. [#if conf.instance.initialization_settings.fmpll1_settings.progressive_clock_switching.value[0]?lower_case == "true"]
  154. [#assign options = options + " | SPC5_FMPLL_EN_PLL_SW" /]
  155. [/#if]
  156. [#if conf.instance.initialization_settings.fmpll1_settings.mask_fail_output[0].value?lower_case == "true"]
  157. [#assign options = options + " | SPC5_FMPLL_PLL_FAIL_MASK" /]
  158. [/#if]
  159. #define SPC5_FMPLL1_OPTIONS (0${options})
  160. [#assign options = "" /]
  161. [#if conf.instance.initialization_settings.fmpll1_settings.fm_enable.value[0]?lower_case == "true"]
  162. [#assign options = options + " | SPC5_FMPLL_FM_EN" /]
  163. [#if conf.instance.initialization_settings.fmpll1_settings.spread_type.@index[0]?trim?number != 0]
  164. [#assign options = options + " | SPC5_FMPLL_SPRD_SEL" /]
  165. [/#if]
  166. [#assign options = options + " | SPC5_FMPLL_MOD_PERIOD(" + conf.instance.initialization_settings.fmpll1_settings.modulation_period.value[0]?trim + ")" /]
  167. [#assign options = options + " | SPC5_FMPLL_INC_STEP(" + conf.instance.initialization_settings.fmpll1_settings.increment_step.value[0]?trim + ")" /]
  168. [/#if]
  169. #define SPC5_FMPLL1_MR_INIT (0${options})
  170. #define SPC5_CLKOUT_SRC SPC5_CGM_OCDS_SELCTL_${conf.instance.initialization_settings.clocks.clkout_clock_source.value[0]}
  171. #define SPC5_CLKOUT_DIV_VALUE ${conf.instance.initialization_settings.clocks.clkout_clock_divider.value[0]}
  172. #define SPC5_AUX0CLK_SRC SPC5_CGM_SS_${conf.instance.initialization_settings.clocks.aux0_clock_source.value[0]}
  173. #define SPC5_MCONTROL_DIVIDER_VALUE ${conf.instance.initialization_settings.clocks.motor_control_clock_divider.value[0]}
  174. #define SPC5_FMPLL1_CLK_DIVIDER_VALUE ${conf.instance.initialization_settings.clocks.fmpll1_div_clock_divider.value[0]}
  175. #define SPC5_AUX2CLK_SRC SPC5_CGM_SS_${conf.instance.initialization_settings.clocks.aux2_clock_source.value[0]}
  176. #define SPC5_SP_CLK_DIVIDER_VALUE ${conf.instance.initialization_settings.clocks.sp_clock_divider.value[0]}
  177. #define SPC5_AUX3CLK_SRC SPC5_CGM_SS_${conf.instance.initialization_settings.clocks.aux3_clock_source.value[0]}
  178. #define SPC5_FR_CLK_DIVIDER_VALUE ${conf.instance.initialization_settings.clocks.fr_clock_divider.value[0]}
  179. [#assign options = "SPC5_CMU_CSR_RCDIV(" + conf.instance.initialization_settings.cmu0_settings.rcdiv.@index[0]?trim + ")" /]
  180. [#if conf.instance.initialization_settings.cmu0_settings.cme0.value[0]?lower_case == "true"]
  181. [#assign options = options + " | SPC5_CMU_CSR_CME" /]
  182. [/#if]
  183. #define SPC5_CMU0_CSR_INIT (${options})
  184. #define SPC5_CMU0_HFREFR_INIT ${conf.instance.initialization_settings.cmu0_settings.hfref.value[0]?trim}
  185. #define SPC5_CMU0_LFREFR_INIT ${conf.instance.initialization_settings.cmu0_settings.lfref.value[0]?trim}
  186. #define SPC5_CMU0_MDR_INIT ${conf.instance.initialization_settings.cmu0_settings.md.value[0]?trim}
  187. [#assign options = "" /]
  188. [#if conf.instance.initialization_settings.cmu1_settings.cme1.value[0]?lower_case == "true"]
  189. [#assign options = options + "SPC5_CMU_CSR_CME" /]
  190. [#else]
  191. [#assign options = "0" /]
  192. [/#if]
  193. #define SPC5_CMU1_CSR_INIT (${options})
  194. #define SPC5_CMU1_HFREFR_INIT ${conf.instance.initialization_settings.cmu1_settings.hfref.value[0]?trim}
  195. #define SPC5_CMU1_LFREFR_INIT ${conf.instance.initialization_settings.cmu1_settings.lfref.value[0]?trim}
  196. [#assign options = "" /]
  197. [#if conf.instance.initialization_settings.module_entry.run_modes.reset.value[0]?lower_case == "true"]
  198. [#assign options = options + " | SPC5_ME_ME_RESET" /]
  199. [/#if]
  200. [#if conf.instance.initialization_settings.module_entry.run_modes.safe.value[0]?lower_case == "true"]
  201. [#assign options = options + " | SPC5_ME_ME_SAFE" /]
  202. [/#if]
  203. [#if conf.instance.initialization_settings.module_entry.run_modes.drun.value[0]?lower_case == "true"]
  204. [#assign options = options + " | SPC5_ME_ME_DRUN" /]
  205. [/#if]
  206. [#if conf.instance.initialization_settings.module_entry.run_modes.run0.value[0]?lower_case == "true"]
  207. [#assign options = options + " | SPC5_ME_ME_RUN0" /]
  208. [/#if]
  209. [#if conf.instance.initialization_settings.module_entry.run_modes.run1.value[0]?lower_case == "true"]
  210. [#assign options = options + " | SPC5_ME_ME_RUN1" /]
  211. [/#if]
  212. [#if conf.instance.initialization_settings.module_entry.run_modes.run2.value[0]?lower_case == "true"]
  213. [#assign options = options + " | SPC5_ME_ME_RUN2" /]
  214. [/#if]
  215. [#if conf.instance.initialization_settings.module_entry.run_modes.run3.value[0]?lower_case == "true"]
  216. [#assign options = options + " | SPC5_ME_ME_RUN3" /]
  217. [/#if]
  218. [#if conf.instance.initialization_settings.module_entry.run_modes.halt0.value[0]?lower_case == "true"]
  219. [#assign options = options + " | SPC5_ME_ME_HALT0" /]
  220. [/#if]
  221. [#if conf.instance.initialization_settings.module_entry.run_modes.stop0.value[0]?lower_case == "true"]
  222. [#assign options = options + " | SPC5_ME_ME_STOP0" /]
  223. [/#if]
  224. #define SPC5_ME_ME_BITS (0${options})
  225. #define SPC5_ME_SAFE_MC_BITS (0${decode_mc(conf.instance.initialization_settings.module_entry.run_modes.safe_state_settings)})
  226. #define SPC5_ME_DRUN_MC_BITS (0${decode_mc(conf.instance.initialization_settings.module_entry.run_modes.drun_state_settings)})
  227. #define SPC5_ME_RUN0_MC_BITS (0${decode_mc(conf.instance.initialization_settings.module_entry.run_modes.run0_state_settings)})
  228. #define SPC5_ME_RUN1_MC_BITS (0${decode_mc(conf.instance.initialization_settings.module_entry.run_modes.run1_state_settings)})
  229. #define SPC5_ME_RUN2_MC_BITS (0${decode_mc(conf.instance.initialization_settings.module_entry.run_modes.run2_state_settings)})
  230. #define SPC5_ME_RUN3_MC_BITS (0${decode_mc(conf.instance.initialization_settings.module_entry.run_modes.run3_state_settings)})
  231. #define SPC5_ME_HALT0_MC_BITS (0${decode_mc(conf.instance.initialization_settings.module_entry.run_modes.halt0_state_settings)})
  232. #define SPC5_ME_STOP0_MC_BITS (0${decode_mc(conf.instance.initialization_settings.module_entry.run_modes.stop0_state_settings)})
  233. #define SPC5_ME_RUN_PC3_BITS (0${decode_runpc(conf.instance.initialization_settings.module_entry.peripherals_control__run_.pc3)})
  234. #define SPC5_ME_RUN_PC4_BITS (0${decode_runpc(conf.instance.initialization_settings.module_entry.peripherals_control__run_.pc4)})
  235. #define SPC5_ME_RUN_PC5_BITS (0${decode_runpc(conf.instance.initialization_settings.module_entry.peripherals_control__run_.pc5)})
  236. #define SPC5_ME_RUN_PC6_BITS (0${decode_runpc(conf.instance.initialization_settings.module_entry.peripherals_control__run_.pc6)})
  237. #define SPC5_ME_RUN_PC7_BITS (0${decode_runpc(conf.instance.initialization_settings.module_entry.peripherals_control__run_.pc7)})
  238. #define SPC5_ME_LP_PC4_BITS (0${decode_lppc(conf.instance.initialization_settings.module_entry.peripherals_control__low_power_.pc4)})
  239. #define SPC5_ME_LP_PC5_BITS (0${decode_lppc(conf.instance.initialization_settings.module_entry.peripherals_control__low_power_.pc5)})
  240. #define SPC5_ME_LP_PC6_BITS (0${decode_lppc(conf.instance.initialization_settings.module_entry.peripherals_control__low_power_.pc6)})
  241. #define SPC5_ME_LP_PC7_BITS (0${decode_lppc(conf.instance.initialization_settings.module_entry.peripherals_control__low_power_.pc7)})
  242. #define SPC5_FINAL_RUNMODE SPC5_RUNMODE_${conf.instance.initialization_settings.module_entry.final_run_mode.value[0]?trim}
  243. #define SPC5_CLOCK_FAILURE_HOOK() ${conf.instance.initialization_settings.clocks.clock_failure_hook.value[0]}
  244. /*
  245. * EDMA driver settings.
  246. */
  247. #define SPC5_EDMA_CR_SETTING (EDMA_CR_GRP1PRI(1) | \
  248. EDMA_CR_GRP0PRI(0) | \
  249. EDMA_CR_EMLM | \
  250. EDMA_CR_ERGA)
  251. #define SPC5_EDMA_GROUP0_PRIORITIES [#rt/]
  252. [#list conf.instance.edma_settings.group_0_channels_priorities.* as channel]
  253. [#if channel_has_next]
  254. ${channel.value[0]}, [#rt/]
  255. [#else]
  256. ${channel.value[0]}
  257. [/#if]
  258. [/#list]
  259. #define SPC5_EDMA_ERROR_IRQ_PRIO 12
  260. #define SPC5_EDMA_ERROR_HANDLER() osalSysHalt("DMA failure")
  261. /*
  262. * PWM driver system settings.
  263. */
  264. [#assign pwm0_all_sm = conf.instance.flexpwm_settings.synchronized_flexpwm0.value[0]?upper_case /]
  265. #define SPC5_PWM0_USE_SYNC_SMOD ${pwm0_all_sm}
  266. #define SPC5_PWM1_USE_SYNC_SMOD FALSE
  267. #define SPC5_PWM_USE_SMOD0 ${conf.instance.flexpwm_settings.flexpwm0_sm0.value[0]?upper_case}
  268. [#if pwm0_all_sm == "FALSE"]
  269. #define SPC5_PWM_USE_SMOD1 ${conf.instance.flexpwm_settings.flexpwm0_sm1.value[0]?upper_case}
  270. #define SPC5_PWM_USE_SMOD2 ${conf.instance.flexpwm_settings.flexpwm0_sm2.value[0]?upper_case}
  271. #define SPC5_PWM_USE_SMOD3 ${conf.instance.flexpwm_settings.flexpwm0_sm3.value[0]?upper_case}
  272. [#else]
  273. #define SPC5_PWM_USE_SMOD1 TRUE
  274. #define SPC5_PWM_USE_SMOD2 TRUE
  275. #define SPC5_PWM_USE_SMOD3 TRUE
  276. [/#if]
  277. #define SPC5_PWM_SMOD0_PRIORITY ${conf.instance.irq_priority_settings.flexpwm0_sm0.value[0]}
  278. #define SPC5_PWM_SMOD1_PRIORITY ${conf.instance.irq_priority_settings.flexpwm0_sm1.value[0]}
  279. #define SPC5_PWM_SMOD2_PRIORITY ${conf.instance.irq_priority_settings.flexpwm0_sm2.value[0]}
  280. #define SPC5_PWM_SMOD3_PRIORITY ${conf.instance.irq_priority_settings.flexpwm0_sm3.value[0]}
  281. /*
  282. * ICU driver system settings.
  283. */
  284. #define SPC5_ICU_USE_SMOD0 ${conf.instance.etimer_settings.etimer0_ch0.value[0]?upper_case}
  285. #define SPC5_ICU_USE_SMOD1 ${conf.instance.etimer_settings.etimer0_ch1.value[0]?upper_case}
  286. #define SPC5_ICU_USE_SMOD2 ${conf.instance.etimer_settings.etimer0_ch2.value[0]?upper_case}
  287. #define SPC5_ICU_USE_SMOD3 ${conf.instance.etimer_settings.etimer0_ch3.value[0]?upper_case}
  288. #define SPC5_ICU_USE_SMOD4 ${conf.instance.etimer_settings.etimer0_ch4.value[0]?upper_case}
  289. #define SPC5_ICU_USE_SMOD5 ${conf.instance.etimer_settings.etimer0_ch5.value[0]?upper_case}
  290. #define SPC5_ICU_ETIMER0_PRIORITY ${conf.instance.irq_priority_settings.etimer0.value[0]}
  291. #define SPC5_ICU_USE_SMOD6 ${conf.instance.etimer_settings.etimer1_ch0.value[0]?upper_case}
  292. #define SPC5_ICU_USE_SMOD7 ${conf.instance.etimer_settings.etimer1_ch1.value[0]?upper_case}
  293. #define SPC5_ICU_USE_SMOD8 ${conf.instance.etimer_settings.etimer1_ch2.value[0]?upper_case}
  294. #define SPC5_ICU_USE_SMOD9 ${conf.instance.etimer_settings.etimer1_ch3.value[0]?upper_case}
  295. #define SPC5_ICU_USE_SMOD10 ${conf.instance.etimer_settings.etimer1_ch4.value[0]?upper_case}
  296. #define SPC5_ICU_USE_SMOD11 ${conf.instance.etimer_settings.etimer1_ch5.value[0]?upper_case}
  297. #define SPC5_ICU_ETIMER1_PRIORITY ${conf.instance.irq_priority_settings.etimer1.value[0]}
  298. /*
  299. * SERIAL driver system settings.
  300. */
  301. #define SPC5_SERIAL_USE_LINFLEX0 ${(conf.instance.linflex_settings.linflex0.value[0] == "Serial")?string?upper_case}
  302. #define SPC5_SERIAL_USE_LINFLEX1 ${(conf.instance.linflex_settings.linflex1.value[0] == "Serial")?string?upper_case}
  303. #define SPC5_SERIAL_LINFLEX0_PRIORITY ${conf.instance.irq_priority_settings.linflex0.value[0]}
  304. #define SPC5_SERIAL_LINFLEX1_PRIORITY ${conf.instance.irq_priority_settings.linflex1.value[0]}
  305. /*
  306. * SPI driver system settings.
  307. */
  308. #define SPC5_SPI_USE_DSPI0 ${conf.instance.dspi_settings.dspi_0.value[0]?upper_case}
  309. #define SPC5_SPI_USE_DSPI1 ${conf.instance.dspi_settings.dspi_1.value[0]?upper_case}
  310. #define SPC5_SPI_USE_DSPI2 ${conf.instance.dspi_settings.dspi_2.value[0]?upper_case}
  311. #define SPC5_SPI_USE_DSPI3 ${conf.instance.dspi_settings.dspi_3.value[0]?upper_case}
  312. #define SPC5_SPI_USE_DSPI4 ${conf.instance.dspi_settings.dspi_4.value[0]?upper_case}
  313. #define SPC5_SPI_DMA_MODE SPC5_SPI_DMA_${conf.instance.dspi_settings.dma_mode.value[0]?upper_case?replace(" ", "_")}
  314. [#assign s0 = [""," | SPC5_MCR_PCSIS0"][conf.instance.dspi_settings.inactive_states.dspi_0___pcs0[0].@index[0]?trim?number] /]
  315. [#assign s1 = [""," | SPC5_MCR_PCSIS1"][conf.instance.dspi_settings.inactive_states.dspi_0___pcs1[0].@index[0]?trim?number] /]
  316. [#assign s2 = [""," | SPC5_MCR_PCSIS2"][conf.instance.dspi_settings.inactive_states.dspi_0___pcs2[0].@index[0]?trim?number] /]
  317. [#assign s3 = [""," | SPC5_MCR_PCSIS3"][conf.instance.dspi_settings.inactive_states.dspi_0___pcs3[0].@index[0]?trim?number] /]
  318. [#assign s4 = [""," | SPC5_MCR_PCSIS4"][conf.instance.dspi_settings.inactive_states.dspi_0___pcs4[0].@index[0]?trim?number] /]
  319. [#assign s5 = [""," | SPC5_MCR_PCSIS5"][conf.instance.dspi_settings.inactive_states.dspi_0___pcs5[0].@index[0]?trim?number] /]
  320. [#assign s6 = [""," | SPC5_MCR_PCSIS6"][conf.instance.dspi_settings.inactive_states.dspi_0___pcs6[0].@index[0]?trim?number] /]
  321. [#assign s7 = [""," | SPC5_MCR_PCSIS7"][conf.instance.dspi_settings.inactive_states.dspi_0___pcs7[0].@index[0]?trim?number] /]
  322. #define SPC5_SPI_DSPI0_MCR (0${s0 + s1 + s2 + s3 + s4 + s5 + s6 + s7})
  323. [#assign s0 = [""," | SPC5_MCR_PCSIS0"][conf.instance.dspi_settings.inactive_states.dspi_1___pcs0[0].@index[0]?trim?number] /]
  324. [#assign s1 = [""," | SPC5_MCR_PCSIS1"][conf.instance.dspi_settings.inactive_states.dspi_1___pcs1[0].@index[0]?trim?number] /]
  325. [#assign s2 = [""," | SPC5_MCR_PCSIS2"][conf.instance.dspi_settings.inactive_states.dspi_1___pcs2[0].@index[0]?trim?number] /]
  326. [#assign s3 = [""," | SPC5_MCR_PCSIS3"][conf.instance.dspi_settings.inactive_states.dspi_1___pcs3[0].@index[0]?trim?number] /]
  327. [#assign s4 = [""," | SPC5_MCR_PCSIS4"][conf.instance.dspi_settings.inactive_states.dspi_1___pcs4[0].@index[0]?trim?number] /]
  328. [#assign s5 = [""," | SPC5_MCR_PCSIS5"][conf.instance.dspi_settings.inactive_states.dspi_1___pcs5[0].@index[0]?trim?number] /]
  329. [#assign s6 = [""," | SPC5_MCR_PCSIS6"][conf.instance.dspi_settings.inactive_states.dspi_1___pcs6[0].@index[0]?trim?number] /]
  330. [#assign s7 = [""," | SPC5_MCR_PCSIS7"][conf.instance.dspi_settings.inactive_states.dspi_1___pcs7[0].@index[0]?trim?number] /]
  331. #define SPC5_SPI_DSPI1_MCR (0${s0 + s1 + s2 + s3 + s4 + s5 + s6 + s7})
  332. [#assign s0 = [""," | SPC5_MCR_PCSIS0"][conf.instance.dspi_settings.inactive_states.dspi_2___pcs0[0].@index[0]?trim?number] /]
  333. [#assign s1 = [""," | SPC5_MCR_PCSIS1"][conf.instance.dspi_settings.inactive_states.dspi_2___pcs1[0].@index[0]?trim?number] /]
  334. [#assign s2 = [""," | SPC5_MCR_PCSIS2"][conf.instance.dspi_settings.inactive_states.dspi_2___pcs2[0].@index[0]?trim?number] /]
  335. [#assign s3 = [""," | SPC5_MCR_PCSIS3"][conf.instance.dspi_settings.inactive_states.dspi_2___pcs3[0].@index[0]?trim?number] /]
  336. #define SPC5_SPI_DSPI2_MCR (0${s0 + s1 + s2 + s3})
  337. [#assign s0 = [""," | SPC5_MCR_PCSIS0"][conf.instance.dspi_settings.inactive_states.dspi_3___pcs0[0].@index[0]?trim?number] /]
  338. [#assign s1 = [""," | SPC5_MCR_PCSIS1"][conf.instance.dspi_settings.inactive_states.dspi_3___pcs1[0].@index[0]?trim?number] /]
  339. [#assign s2 = [""," | SPC5_MCR_PCSIS2"][conf.instance.dspi_settings.inactive_states.dspi_3___pcs2[0].@index[0]?trim?number] /]
  340. [#assign s3 = [""," | SPC5_MCR_PCSIS3"][conf.instance.dspi_settings.inactive_states.dspi_3___pcs3[0].@index[0]?trim?number] /]
  341. #define SPC5_SPI_DSPI3_MCR (0${s0 + s1 + s2 + s3})
  342. [#assign s0 = [""," | SPC5_MCR_PCSIS0"][conf.instance.dspi_settings.inactive_states.dspi_4___pcs0[0].@index[0]?trim?number] /]
  343. [#assign s1 = [""," | SPC5_MCR_PCSIS1"][conf.instance.dspi_settings.inactive_states.dspi_4___pcs1[0].@index[0]?trim?number] /]
  344. [#assign s2 = [""," | SPC5_MCR_PCSIS2"][conf.instance.dspi_settings.inactive_states.dspi_4___pcs2[0].@index[0]?trim?number] /]
  345. [#assign s3 = [""," | SPC5_MCR_PCSIS3"][conf.instance.dspi_settings.inactive_states.dspi_4___pcs3[0].@index[0]?trim?number] /]
  346. #define SPC5_SPI_DSPI4_MCR (0${s0 + s1 + s2 + s3})
  347. #define SPC5_SPI_DSPI0_TX1_DMA_CH_ID ${conf.instance.edma_mux_settings.dspi_channels.dspi0_tx1.value[0]}
  348. #define SPC5_SPI_DSPI0_TX2_DMA_CH_ID ${conf.instance.edma_mux_settings.dspi_channels.dspi0_tx2.value[0]}
  349. #define SPC5_SPI_DSPI0_RX_DMA_CH_ID ${conf.instance.edma_mux_settings.dspi_channels.dspi0_rx.value[0]}
  350. #define SPC5_SPI_DSPI1_TX1_DMA_CH_ID ${conf.instance.edma_mux_settings.dspi_channels.dspi1_tx1.value[0]}
  351. #define SPC5_SPI_DSPI1_TX2_DMA_CH_ID ${conf.instance.edma_mux_settings.dspi_channels.dspi1_tx2.value[0]}
  352. #define SPC5_SPI_DSPI1_RX_DMA_CH_ID ${conf.instance.edma_mux_settings.dspi_channels.dspi1_rx.value[0]}
  353. #define SPC5_SPI_DSPI2_TX1_DMA_CH_ID ${conf.instance.edma_mux_settings.dspi_channels.dspi2_tx1.value[0]}
  354. #define SPC5_SPI_DSPI2_TX2_DMA_CH_ID ${conf.instance.edma_mux_settings.dspi_channels.dspi2_tx2.value[0]}
  355. #define SPC5_SPI_DSPI2_RX_DMA_CH_ID ${conf.instance.edma_mux_settings.dspi_channels.dspi2_rx.value[0]}
  356. #define SPC5_SPI_DSPI3_TX1_DMA_CH_ID ${conf.instance.edma_mux_settings.dspi_channels.dspi3_tx1.value[0]}
  357. #define SPC5_SPI_DSPI3_TX2_DMA_CH_ID ${conf.instance.edma_mux_settings.dspi_channels.dspi3_tx2.value[0]}
  358. #define SPC5_SPI_DSPI3_RX_DMA_CH_ID ${conf.instance.edma_mux_settings.dspi_channels.dspi3_rx.value[0]}
  359. #define SPC5_SPI_DSPI4_TX1_DMA_CH_ID ${conf.instance.edma_mux_settings.dspi_channels.dspi4_tx1.value[0]}
  360. #define SPC5_SPI_DSPI4_TX2_DMA_CH_ID ${conf.instance.edma_mux_settings.dspi_channels.dspi4_tx2.value[0]}
  361. #define SPC5_SPI_DSPI4_RX_DMA_CH_ID ${conf.instance.edma_mux_settings.dspi_channels.dspi4_rx.value[0]}
  362. #define SPC5_SPI_DSPI0_DMA_IRQ_PRIO ${conf.instance.irq_priority_settings.dspi_0.value[0]}
  363. #define SPC5_SPI_DSPI1_DMA_IRQ_PRIO ${conf.instance.irq_priority_settings.dspi_1.value[0]}
  364. #define SPC5_SPI_DSPI2_DMA_IRQ_PRIO ${conf.instance.irq_priority_settings.dspi_2.value[0]}
  365. #define SPC5_SPI_DSPI3_DMA_IRQ_PRIO ${conf.instance.irq_priority_settings.dspi_3.value[0]}
  366. #define SPC5_SPI_DSPI4_DMA_IRQ_PRIO ${conf.instance.irq_priority_settings.dspi_4.value[0]}
  367. #define SPC5_SPI_DSPI0_IRQ_PRIO ${conf.instance.irq_priority_settings.dspi_0.value[0]}
  368. #define SPC5_SPI_DSPI1_IRQ_PRIO ${conf.instance.irq_priority_settings.dspi_1.value[0]}
  369. #define SPC5_SPI_DSPI2_IRQ_PRIO ${conf.instance.irq_priority_settings.dspi_2.value[0]}
  370. #define SPC5_SPI_DSPI3_IRQ_PRIO ${conf.instance.irq_priority_settings.dspi_3.value[0]}
  371. #define SPC5_SPI_DSPI4_IRQ_PRIO ${conf.instance.irq_priority_settings.dspi_4.value[0]}
  372. #define SPC5_SPI_DMA_ERROR_HOOK(spip) ${conf.instance.dspi_settings.dma_error_hook.value[0]}
  373. /*
  374. * CAN driver system settings.
  375. */
  376. #define SPC5_CAN_USE_FILTERS ${conf.instance.flexcan_settings.flexcan_enable_filters.value[0]?upper_case}
  377. #define SPC5_CAN_USE_FLEXCAN0 ${conf.instance.flexcan_settings.flexcan0.value[0]?upper_case}
  378. #define SPC5_CAN_FLEXCAN0_USE_EXT_CLK ${conf.instance.flexcan_settings.flexcan0_use_external_clock.value[0]?upper_case}
  379. #define SPC5_CAN_FLEXCAN0_PRIORITY ${conf.instance.irq_priority_settings.flexcan0.value[0]}
  380. #define SPC5_CAN_NUM_RX_MAILBOXES ${conf.instance.flexcan_settings.can_configurations.mailboxes_configuration.number_of_rx_mailboxes.value[0]}
  381. #define SPC5_CAN_NUM_TX_MAILBOXES ${conf.instance.flexcan_settings.can_configurations.mailboxes_configuration.number_of_tx_mailboxes.value[0]}
  382. #define SPC5_CAN_FLEXCAN0_START_PCTL (SPC5_ME_PCTL_RUN(1) | \
  383. SPC5_ME_PCTL_LP(2))
  384. #define SPC5_CAN_FLEXCAN0_STOP_PCTL (SPC5_ME_PCTL_RUN(0) | \
  385. SPC5_ME_PCTL_LP(0))
  386. /*
  387. * ADC driver system settings.
  388. */
  389. [#if conf.instance.adc_settings.adc0_clock_divider.value[0] == "Peripheral clock frequency"]
  390. [#assign clk_f0 = "PERIPHERAL_SET_CLOCK_FREQUENCY"]
  391. [#else]
  392. [#assign clk_f0 = "HALF_PERIPHERAL_SET_CLOCK_FREQUENCY"]
  393. [/#if]
  394. [#if conf.instance.adc_settings.dma_mode.value[0] == "true" ]
  395. [#assign dma_mode = "SPC5_ADC_DMA_ON"]
  396. [#else]
  397. [#assign dma_mode = "SPC5_ADC_DMA_OFF"]
  398. [/#if]
  399. #define SPC5_ADC_DMA_MODE ${dma_mode}
  400. #define SPC5_ADC_USE_ADC0 ${conf.instance.adc_settings.adc0.value[0]?upper_case}
  401. #define SPC5_ADC_ADC0_CLK_FREQUENCY ${clk_f0}
  402. #define SPC5_ADC_ADC0_AUTO_CLOCK_OFF ${conf.instance.adc_settings.adc0_auto_clock_off_mode.value[0]?upper_case}
  403. #define SPC5_ADC_ADC0_WD_PRIORITY ${conf.instance.irq_priority_settings.adc0.value[0]}
  404. #define SPC5_ADC_ADC0_EOC_PRIORITY SPC5_ADC_ADC0_WD_PRIORITY
  405. #define SPC5_ADC_ADC0_DMA_CH_ID ${conf.instance.edma_mux_settings.adc_channels.adc0.value[0]}
  406. #define SPC5_ADC_ADC0_DMA_IRQ_PRIO ${conf.instance.irq_priority_settings.adc0.value[0]}
  407. #define SPC5_ADC_ADC0_START_PCTL (SPC5_ME_PCTL_RUN(1) | \
  408. SPC5_ME_PCTL_LP(2))
  409. #define SPC5_ADC_ADC0_STOP_PCTL (SPC5_ME_PCTL_RUN(0) | \
  410. SPC5_ME_PCTL_LP(0))
  411. [#if conf.instance.adc_settings.adc1_clock_divider.value[0] == "Peripheral clock frequency"]
  412. [#assign clk_f1 = "PERIPHERAL_SET_CLOCK_FREQUENCY"]
  413. [#else]
  414. [#assign clk_f1 = "HALF_PERIPHERAL_SET_CLOCK_FREQUENCY"]
  415. [/#if]
  416. #define SPC5_ADC_USE_ADC1 ${conf.instance.adc_settings.adc1.value[0]?upper_case}
  417. #define SPC5_ADC_ADC1_CLK_FREQUENCY ${clk_f1}
  418. #define SPC5_ADC_ADC1_AUTO_CLOCK_OFF ${conf.instance.adc_settings.adc1_auto_clock_off_mode.value[0]?upper_case}
  419. #define SPC5_ADC_ADC1_WD_PRIORITY ${conf.instance.irq_priority_settings.adc1.value[0]}
  420. #define SPC5_ADC_ADC1_EOC_PRIORITY SPC5_ADC_ADC1_WD_PRIORITY
  421. #define SPC5_ADC_ADC1_DMA_CH_ID ${conf.instance.edma_mux_settings.adc_channels.adc1.value[0]}
  422. #define SPC5_ADC_ADC1_DMA_IRQ_PRIO ${conf.instance.irq_priority_settings.adc1.value[0]}
  423. #define SPC5_ADC_ADC1_START_PCTL (SPC5_ME_PCTL_RUN(1) | \
  424. SPC5_ME_PCTL_LP(2))
  425. #define SPC5_ADC_ADC1_STOP_PCTL (SPC5_ME_PCTL_RUN(0) | \
  426. SPC5_ME_PCTL_LP(0))
  427. #endif /* _MCUCONF_H_ */