Clock_Ip_Specific.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453
  1. /*==================================================================================================
  2. * Project : RTD AUTOSAR 4.4
  3. * Platform : CORTEXM
  4. * Peripheral :
  5. * Dependencies : none
  6. *
  7. * Autosar Version : 4.4.0
  8. * Autosar Revision : ASR_REL_4_4_REV_0000
  9. * Autosar Conf.Variant :
  10. * SW Version : 1.0.0
  11. * Build Version : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
  12. *
  13. * (c) Copyright 2020-2021 NXP Semiconductors
  14. * All Rights Reserved.
  15. *
  16. * NXP Confidential. This software is owned or controlled by NXP and may only be
  17. * used strictly in accordance with the applicable license terms. By expressly
  18. * accepting such terms or by downloading, installing, activating and/or otherwise
  19. * using the software, you are agreeing that you have read, and that you agree to
  20. * comply with and are bound by, such license terms. If you do not agree to be
  21. * bound by the applicable license terms, then you may not retain, install,
  22. * activate or otherwise use the software.
  23. ==================================================================================================*/
  24. /**
  25. * @file Clock_Ip_Specific.h
  26. * @version 1.0.0
  27. *
  28. * @brief CLOCK IP specific header file.
  29. * @details CLOCK IP specific header file.
  30. * @addtogroup CLOCK_DRIVER Clock Ip Driver
  31. * @{
  32. */
  33. #if !defined(SPECIFIC_CLOCK_SPECIFIC_H)
  34. #define SPECIFIC_CLOCK_SPECIFIC_H
  35. #include "Clock_Ip_Cfg_Defines.h"
  36. #if defined (CLOCK_IP_S32K148)
  37. #include "S32K148_SIM.h"
  38. #include "S32K148_SCG.h"
  39. #include "S32K148_PCC.h"
  40. #include "S32K148_SMC.h"
  41. #include "S32K148_QUADSPI.h"
  42. #elif defined (CLOCK_IP_S32K116)
  43. #include "S32K116_SIM.h"
  44. #include "S32K116_SCG.h"
  45. #include "S32K116_PCC.h"
  46. #include "S32K116_SMC.h"
  47. #include "S32K116_CMU.h"
  48. #elif defined (CLOCK_IP_S32K118)
  49. #include "S32K118_SIM.h"
  50. #include "S32K118_SCG.h"
  51. #include "S32K118_PCC.h"
  52. #include "S32K118_SMC.h"
  53. #include "S32K118_CMU.h"
  54. #elif defined (CLOCK_IP_S32K142)
  55. #include "S32K142_SIM.h"
  56. #include "S32K142_SCG.h"
  57. #include "S32K142_PCC.h"
  58. #include "S32K142_SMC.h"
  59. #elif defined (CLOCK_IP_S32K142W)
  60. #include "S32K142W_SIM.h"
  61. #include "S32K142W_SCG.h"
  62. #include "S32K142W_PCC.h"
  63. #include "S32K142W_SMC.h"
  64. #elif defined (CLOCK_IP_S32K144)
  65. #include "S32K144_SIM.h"
  66. #include "S32K144_SCG.h"
  67. #include "S32K144_PCC.h"
  68. #include "S32K144_SMC.h"
  69. #elif defined (CLOCK_IP_S32K144W)
  70. #include "S32K144W_SIM.h"
  71. #include "S32K144W_SCG.h"
  72. #include "S32K144W_PCC.h"
  73. #include "S32K144W_SMC.h"
  74. #elif defined (CLOCK_IP_S32K146)
  75. #include "S32K146_SIM.h"
  76. #include "S32K146_SCG.h"
  77. #include "S32K146_PCC.h"
  78. #include "S32K146_SMC.h"
  79. #endif
  80. #include "Mcal.h"
  81. #if defined(__cplusplus)
  82. extern "C" {
  83. #endif /* __cplusplus*/
  84. /*==================================================================================================
  85. SOURCE FILE VERSION INFORMATION
  86. ==================================================================================================*/
  87. #define CLOCK_IP_SPECIFIC_VENDOR_ID 43
  88. #define CLOCK_IP_SPECIFIC_AR_RELEASE_MAJOR_VERSION 4
  89. #define CLOCK_IP_SPECIFIC_AR_RELEASE_MINOR_VERSION 4
  90. #define CLOCK_IP_SPECIFIC_AR_RELEASE_REVISION_VERSION 0
  91. #define CLOCK_IP_SPECIFIC_SW_MAJOR_VERSION 1
  92. #define CLOCK_IP_SPECIFIC_SW_MINOR_VERSION 0
  93. #define CLOCK_IP_SPECIFIC_SW_PATCH_VERSION 0
  94. /*==================================================================================================
  95. FILE VERSION CHECKS
  96. ==================================================================================================*/
  97. /* Check if Clock_Ip_Specific.h file and Clock_Ip_Cfg_Defines.h file are of the same vendor */
  98. #if (CLOCK_IP_SPECIFIC_VENDOR_ID != CLOCK_IP_CFG_DEFINES_VENDOR_ID)
  99. #error "Clock_Ip_Specific.h and Clock_Ip_Cfg_Defines.h have different vendor ids"
  100. #endif
  101. /* Check if Clock_Ip_Specific.h file and Clock_Ip_Cfg_Defines.h file are of the same Autosar version */
  102. #if ((CLOCK_IP_SPECIFIC_AR_RELEASE_MAJOR_VERSION != CLOCK_IP_CFG_DEFINES_AR_RELEASE_MAJOR_VERSION) || \
  103. (CLOCK_IP_SPECIFIC_AR_RELEASE_MINOR_VERSION != CLOCK_IP_CFG_DEFINES_AR_RELEASE_MINOR_VERSION) || \
  104. (CLOCK_IP_SPECIFIC_AR_RELEASE_REVISION_VERSION != CLOCK_IP_CFG_DEFINES_AR_RELEASE_REVISION_VERSION) \
  105. )
  106. #error "AutoSar Version Numbers of Clock_Ip_Specific.h and Clock_Ip_Cfg_Defines.h are different"
  107. #endif
  108. /* Check if Clock_Ip_Specific.h file and Clock_Ip_Cfg_Defines.h file are of the same Software version */
  109. #if ((CLOCK_IP_SPECIFIC_SW_MAJOR_VERSION != CLOCK_IP_CFG_DEFINES_SW_MAJOR_VERSION) || \
  110. (CLOCK_IP_SPECIFIC_SW_MINOR_VERSION != CLOCK_IP_CFG_DEFINES_SW_MINOR_VERSION) || \
  111. (CLOCK_IP_SPECIFIC_SW_PATCH_VERSION != CLOCK_IP_CFG_DEFINES_SW_PATCH_VERSION) \
  112. )
  113. #error "Software Version Numbers of Clock_Ip_Specific.h and Clock_Ip_Cfg_Defines.h are different"
  114. #endif
  115. #ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
  116. /* Check if Clock_Ip_Specific.h file and Mcal.h file are of the same Autosar version */
  117. #if ((CLOCK_IP_SPECIFIC_AR_RELEASE_MAJOR_VERSION != MCAL_AR_RELEASE_MAJOR_VERSION) || \
  118. (CLOCK_IP_SPECIFIC_AR_RELEASE_MINOR_VERSION != MCAL_AR_RELEASE_MINOR_VERSION))
  119. #error "AutoSar Version Numbers of Clock_Ip_Specific.h and Mcal.h are different"
  120. #endif
  121. #endif
  122. #if (defined (CLOCK_IP_S32K118) || defined(CLOCK_IP_S32K116))
  123. #define DIVIDER_CALLBACKS_COUNT 11U
  124. #define SCG_ASYNC_DIV1 1U
  125. #define SCG_ASYNC_DIV2 2U
  126. #define SCG_DIVCORE_RUN 3U
  127. #define SCG_DIVBUS_RUN 4U
  128. #define SCG_DIVSLOW_RUN 5U
  129. #define SCG_DIVCORE_VLPR 6U
  130. #define SCG_DIVBUS_VLPR 7U
  131. #define SCG_DIVSLOW_VLPR 8U
  132. #define SIM_CLKOUT_DIV 9U
  133. #define PCC_PCD_FRAC 10U
  134. #define DIVIDERTRIGGER_CALLBACKS_COUNT 1U
  135. #define XOSC_CALLBACKS_COUNT 2U
  136. #define SOSC_ENABLE 1U
  137. #define IRCOSC_CALLBACKS_COUNT 5U
  138. #define SIRC_ENABLE 1U
  139. #define SIRC_VLP_ENABLE 2U
  140. #define SIRC_STOP_ENABLE 3U
  141. #define FIRC_ENABLE 4U
  142. #define GATE_CALLBACKS_COUNT 6U
  143. #define PCC_CGC_ENABLE 1U
  144. #define SIM_CLKOUT_ENABLE 2U
  145. #define SIM_LPO32K_ENABLE 3U
  146. #define SIM_LPO1K_ENABLE 4U
  147. #define SIM_PLATCGC_CGC 5U
  148. #define FRACTIONAL_DIVIDER_CALLBACKS_COUNT 1U
  149. #define PLL_CALLBACKS_COUNT 1U
  150. #define SELECTOR_CALLBACKS_COUNT 9U
  151. #define SCG_SCS_RUN_SEL 1U
  152. #define SCG_SCS_VLPR_SEL 2U
  153. #define SIM_RTC_SEL 3U
  154. #define SIM_LPO_SEL 4U
  155. #define SCG_CLKOUT_SEL 5U
  156. #define SIM_FTMOPT_SEL 6U
  157. #define SIM_CLKOUT_SEL 7U
  158. #define PCC_PCS_SELECT 8U
  159. #define PCFS_CALLBACKS_COUNT 1U
  160. #define CMU_CALLBACKS_COUNT 2U
  161. #define CMU_FC_FCE_REF_CNT_LFREF_HFREF 1U
  162. #define ALL_CALLBACKS_COUNT 11U
  163. #elif (defined (CLOCK_IP_S32K142W) || defined(CLOCK_IP_S32K144W))
  164. #define DIVIDER_CALLBACKS_COUNT 12U
  165. #define SCG_ASYNC_DIV1 1U
  166. #define SCG_ASYNC_DIV2 2U
  167. #define SCG_DIVCORE_RUN 3U
  168. #define SCG_DIVBUS_RUN 4U
  169. #define SCG_DIVSLOW_RUN 5U
  170. #define SCG_DIVCORE_VLPR 6U
  171. #define SCG_DIVBUS_VLPR 7U
  172. #define SCG_DIVSLOW_VLPR 8U
  173. #define SIM_CLKOUT_DIV 9U
  174. #define PCC_PCD_FRAC 10U
  175. #define SIM_TRACE_DIV_MUL 11U
  176. #define DIVIDERTRIGGER_CALLBACKS_COUNT 1U
  177. #define XOSC_CALLBACKS_COUNT 2U
  178. #define SOSC_ENABLE 1U
  179. #define IRCOSC_CALLBACKS_COUNT 5U
  180. #define SIRC_ENABLE 1U
  181. #define SIRC_VLP_ENABLE 2U
  182. #define SIRC_STOP_ENABLE 3U
  183. #define FIRC_ENABLE 4U
  184. #define GATE_CALLBACKS_COUNT 7U
  185. #define PCC_CGC_ENABLE 1U
  186. #define SIM_CLKOUT_ENABLE 2U
  187. #define SIM_LPO32K_ENABLE 3U
  188. #define SIM_LPO1K_ENABLE 4U
  189. #define SIM_PLATCGC_CGC 5U
  190. #define SIM_TRACE_ENABLE 6U
  191. #define FRACTIONAL_DIVIDER_CALLBACKS_COUNT 1U
  192. #define PLL_CALLBACKS_COUNT 2U
  193. #define SPLL_ENABLE 1U
  194. #define SELECTOR_CALLBACKS_COUNT 10U
  195. #define SCG_SCS_RUN_SEL 1U
  196. #define SCG_SCS_VLPR_SEL 2U
  197. #define SIM_RTC_SEL 3U
  198. #define SIM_LPO_SEL 4U
  199. #define SCG_CLKOUT_SEL 5U
  200. #define SIM_FTMOPT_SEL 6U
  201. #define SIM_CLKOUT_SEL 7U
  202. #define PCC_PCS_SELECT 8U
  203. #define SIM_TRACE_SEL 9U
  204. #define PCFS_CALLBACKS_COUNT 1U
  205. #define CMU_CALLBACKS_COUNT 1U
  206. #define ALL_CALLBACKS_COUNT 12U
  207. #elif (defined (CLOCK_IP_S32K142) || defined(CLOCK_IP_S32K144) || defined(CLOCK_IP_S32K146) || defined(CLOCK_IP_S32K148))
  208. #define DIVIDER_CALLBACKS_COUNT 15U
  209. #define SCG_ASYNC_DIV1 1U
  210. #define SCG_ASYNC_DIV2 2U
  211. #define SCG_DIVCORE_RUN 3U
  212. #define SCG_DIVBUS_RUN 4U
  213. #define SCG_DIVSLOW_RUN 5U
  214. #define SCG_DIVCORE_VLPR 6U
  215. #define SCG_DIVBUS_VLPR 7U
  216. #define SCG_DIVSLOW_VLPR 8U
  217. #define SCG_DIVCORE_HSRUN 9U
  218. #define SCG_DIVBUS_HSRUN 10U
  219. #define SCG_DIVSLOW_HSRUN 11U
  220. #define SIM_CLKOUT_DIV 12U
  221. #define PCC_PCD_FRAC 13U
  222. #define SIM_TRACE_DIV_MUL 14U
  223. #define DIVIDERTRIGGER_CALLBACKS_COUNT 1U
  224. #define XOSC_CALLBACKS_COUNT 2U
  225. #define SOSC_ENABLE 1U
  226. #define IRCOSC_CALLBACKS_COUNT 5U
  227. #define SIRC_ENABLE 1U
  228. #define SIRC_VLP_ENABLE 2U
  229. #define SIRC_STOP_ENABLE 3U
  230. #define FIRC_ENABLE 4U
  231. #define GATE_CALLBACKS_COUNT 7U
  232. #define PCC_CGC_ENABLE 1U
  233. #define SIM_CLKOUT_ENABLE 2U
  234. #define SIM_LPO32K_ENABLE 3U
  235. #define SIM_LPO1K_ENABLE 4U
  236. #define SIM_PLATCGC_CGC 5U
  237. #define SIM_TRACE_ENABLE 6U
  238. #define FRACTIONAL_DIVIDER_CALLBACKS_COUNT 1U
  239. #define PLL_CALLBACKS_COUNT 2U
  240. #define SPLL_ENABLE 1U
  241. #define SELECTOR_CALLBACKS_COUNT 11U
  242. #define SCG_SCS_RUN_SEL 1U
  243. #define SCG_SCS_VLPR_SEL 2U
  244. #define SCG_SCS_HSRUN_SEL 3U
  245. #define SIM_RTC_SEL 4U
  246. #define SIM_LPO_SEL 5U
  247. #define SCG_CLKOUT_SEL 6U
  248. #define SIM_FTMOPT_SEL 7U
  249. #define SIM_CLKOUT_SEL 8U
  250. #define PCC_PCS_SELECT 9U
  251. #define SIM_TRACE_SEL 10U
  252. #define PCFS_CALLBACKS_COUNT 1U
  253. #define CMU_CALLBACKS_COUNT 1U
  254. #define ALL_CALLBACKS_COUNT 15U
  255. #endif
  256. /* The source of HCLK is CORE_CLK. */
  257. #define HCLK CORE_CLK
  258. typedef struct {
  259. uint32 ASYNC_DIV; /* Peripheral asynchronous clock register */
  260. }scgPeriphAsyncDiv_Type;
  261. #if (defined(CLOCK_IP_S32K116) || defined(CLOCK_IP_S32K118))
  262. #define PERIPH_ASYNC_COUNT 3U
  263. #else
  264. #define PERIPH_ASYNC_COUNT 4U
  265. #endif
  266. #if defined(FEATURE_CLOCK_IP_HAS_FIRC_MON1_CLK) || defined(FEATURE_CLOCK_IP_HAS_FIRC_MON2_CLK)
  267. /** CMU - Register Layout Typedef */
  268. typedef struct {
  269. uint32 GCR; /**< Global Configuration Register, offset: 0x0 */
  270. uint32 RCCR; /**< Reference Count Configuration Register, offset: 0x4 */
  271. uint32 HTCR; /**< High Threshold Configuration Register, offset: 0x8 */
  272. uint32 LTCR; /**< Low Threshold Configuration Register, offset: 0xC */
  273. uint32 SR; /**< Status Register, offset: 0x10 */
  274. uint32 IER; /**< Interrupt Enable Register, offset: 0x14 */
  275. } ClockMonitor_Type;
  276. typedef struct{
  277. Clock_Ip_NameType name; /* Name of the clock that can be monitored/supports cmu (clock monitor) */
  278. Clock_Ip_NameType reference; /* Name of the reference clock */
  279. Clock_Ip_NameType bus; /* Name of the bus clock */
  280. volatile ClockMonitor_Type* cmuInstance;
  281. }cmuInfoType;
  282. #endif
  283. #if (defined(CLOCK_IP_S32K116) || defined(CLOCK_IP_S32K118))
  284. #define NUMBER_OF_HARDWARE_PLL 0U
  285. #define CMU_INSTANCES_ARRAY_SIZE 2U
  286. #define CMU_INFO_SIZE 2U
  287. #else
  288. #define NUMBER_OF_HARDWARE_PLL 1U
  289. #define CMU_INSTANCES_ARRAY_SIZE 0U
  290. #define CMU_INFO_SIZE 0U
  291. #endif
  292. #ifdef CMU_GCR_FCE_MASK
  293. #define CMU_FC_GCR_FCE_MASK CMU_GCR_FCE_MASK
  294. #endif
  295. #ifdef CMU_GCR_FCE_SHIFT
  296. #define CMU_FC_GCR_FCE_SHIFT CMU_GCR_FCE_SHIFT
  297. #endif
  298. #ifdef CMU_IER_FHHAIE_MASK
  299. #define CMU_FC_IER_FHHAIE_MASK CMU_IER_FHHAIE_MASK
  300. #endif
  301. #ifdef CMU_IER_FHHIE_MASK
  302. #define CMU_FC_IER_FHHIE_MASK CMU_IER_FHHIE_MASK
  303. #endif
  304. #ifdef CMU_IER_FLLAIE_MASK
  305. #define CMU_FC_IER_FLLAIE_MASK CMU_IER_FLLAIE_MASK
  306. #endif
  307. #ifdef CMU_IER_FLLIE_MASK
  308. #define CMU_FC_IER_FLLIE_MASK CMU_IER_FLLIE_MASK
  309. #endif
  310. #ifdef CMU_SR_FHH_MASK
  311. #define CMU_FC_SR_FHH_MASK CMU_SR_FHH_MASK
  312. #endif
  313. #ifdef CMU_SR_FLL_MASK
  314. #define CMU_FC_SR_FLL_MASK CMU_SR_FLL_MASK
  315. #endif
  316. #ifdef CMU_SR_RS_MASK
  317. #define CMU_FC_SR_RS_MASK CMU_SR_RS_MASK
  318. #endif
  319. #ifdef CMU_FC_FCE_REF_CNT_LFREF_HFREF
  320. #define CMU_FREQUENCY_CHECK_ENABLED CMU_FC_GCR_FCE_MASK
  321. #define CMU_FREQUENCY_CHECK_STOPPED 0U
  322. #define CMU_ISR_MASK 3U
  323. #define CMU_RESET_COUNTER_VALUE 0U
  324. #define CMU_RESET_LOW_LIMIT 3U
  325. #define CMU_RESET_HIGH_LIMIT 0x00FFFFFCU
  326. #endif
  327. /* Clock start constant section data */
  328. #define MCU_START_SEC_CONST_UNSPECIFIED
  329. #include "Mcu_MemMap.h"
  330. extern volatile scgPeriphAsyncDiv_Type* const scgPeriphAsyncDivs[PERIPH_ASYNC_COUNT];
  331. #if CMU_INSTANCES_ARRAY_SIZE > 0U
  332. extern volatile ClockMonitor_Type * const cmu[CMU_INSTANCES_ARRAY_SIZE];
  333. extern Clock_Ip_NameType const cmuNames[CMU_INSTANCES_ARRAY_SIZE];
  334. #endif
  335. #if CMU_INFO_SIZE > 0U
  336. extern const cmuInfoType cmuInfo[CMU_INFO_SIZE];
  337. #endif
  338. /* Clock stop constant section data */
  339. #define MCU_STOP_SEC_CONST_UNSPECIFIED
  340. #include "Mcu_MemMap.h"
  341. /* Clock start constant section data */
  342. #define MCU_START_SEC_CONST_16
  343. #include "Mcu_MemMap.h"
  344. extern const uint8 selectorEntry_hardwareValue[FEATURE_CLOCKS_NO];
  345. extern const uint8 selectorEntrySCS_hardwareValue[FEATURE_CLOCK_PRODUCERS_NO + 1U];
  346. extern const uint8 selectorEntryPCS_hardwareValue[FEATURE_CLOCK_PRODUCERS_NO + 1U];
  347. extern const uint8 dividerValue_hardwareValue[65U];
  348. /* Clock stop constant section data */
  349. #define MCU_STOP_SEC_CONST_16
  350. #include "Mcu_MemMap.h"
  351. /*==================================================================================================
  352. * FUNCTION PROTOTYPES
  353. ==================================================================================================*/
  354. /* Clock start section code */
  355. #define MCU_START_SEC_CODE
  356. #include "Mcu_MemMap.h"
  357. void DisableSafeClock(Clock_Ip_ClockConfigType const * config);
  358. /* Clock stop section code */
  359. #define MCU_STOP_SEC_CODE
  360. #include "Mcu_MemMap.h"
  361. #if defined(__cplusplus)
  362. }
  363. #endif /* __cplusplus*/
  364. /*! @}*/
  365. #endif /* SPECIFIC_CLOCK_SPECIFIC_H */
  366. /*******************************************************************************
  367. * EOF
  368. ******************************************************************************/