Mcu_Cfg.h 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826
  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 Mcu_Cfg.h
  26. * @implements Mcu_Cfg.h_Artifact
  27. * @version 1.0.0
  28. *
  29. * @brief AUTOSAR Mcu - Configuration file for the driver.
  30. * @details Precompile parameters and extern configuration.
  31. *
  32. * @addtogroup MCU
  33. * @{
  34. */
  35. #ifndef MCU_CFG_H
  36. #define MCU_CFG_H
  37. #ifdef __cplusplus
  38. extern "C"{
  39. #endif
  40. /*==================================================================================================
  41. INCLUDE FILES
  42. 1) system and project includes
  43. 2) needed interfaces from external units
  44. 3) internal and external interfaces from this unit
  45. ==================================================================================================*/
  46. #include "Mcal.h"
  47. #include "Clock_Ip_Cfg.h"
  48. #include "Power_Ip_Cfg.h"
  49. #include "Ram_Ip_Cfg.h"
  50. #include "Mcu_VS_0_PBcfg.h"
  51. /*==================================================================================================
  52. SOURCE FILE VERSION INFORMATION
  53. ==================================================================================================*/
  54. #define MCU_CFG_VENDOR_ID 43
  55. #define MCU_CFG_AR_RELEASE_MAJOR_VERSION 4
  56. #define MCU_CFG_AR_RELEASE_MINOR_VERSION 4
  57. #define MCU_CFG_AR_RELEASE_REVISION_VERSION 0
  58. #define MCU_CFG_SW_MAJOR_VERSION 1
  59. #define MCU_CFG_SW_MINOR_VERSION 0
  60. #define MCU_CFG_SW_PATCH_VERSION 0
  61. /*==================================================================================================
  62. * FILE VERSION CHECKS
  63. ==================================================================================================*/
  64. #ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
  65. /* Check if header file and Mcal header file are of the same Autosar version */
  66. #if ((MCU_CFG_AR_RELEASE_MAJOR_VERSION != MCAL_AR_RELEASE_MAJOR_VERSION) || \
  67. (MCU_CFG_AR_RELEASE_MINOR_VERSION != MCAL_AR_RELEASE_MINOR_VERSION))
  68. #error "AutoSar Version Numbers of Mcu_Cfg.h and Mcal.h are different"
  69. #endif
  70. #endif
  71. /* Check if header file and Clock_Ip_Cfg.h file are of the same vendor */
  72. #if (MCU_CFG_VENDOR_ID != CLOCK_IP_CFG_VENDOR_ID)
  73. #error "Mcu_Cfg.h and Clock_Ip_Cfg.h have different vendor ids"
  74. #endif
  75. /* Check if header file and Clock_Ip_Cfg.h file are of the same Autosar version */
  76. #if ((MCU_CFG_AR_RELEASE_MAJOR_VERSION != CLOCK_IP_CFG_AR_RELEASE_MAJOR_VERSION) || \
  77. (MCU_CFG_AR_RELEASE_MINOR_VERSION != CLOCK_IP_CFG_AR_RELEASE_MINOR_VERSION) || \
  78. (MCU_CFG_AR_RELEASE_REVISION_VERSION != CLOCK_IP_CFG_AR_RELEASE_REVISION_VERSION) \
  79. )
  80. #error "AutoSar Version Numbers of Mcu_Cfg.h and Clock_Ip_Cfg.h are different"
  81. #endif
  82. /* Check if header file and Clock_Ip_Cfg.h file are of the same Software version */
  83. #if ((MCU_CFG_SW_MAJOR_VERSION != CLOCK_IP_CFG_SW_MAJOR_VERSION) || \
  84. (MCU_CFG_SW_MINOR_VERSION != CLOCK_IP_CFG_SW_MINOR_VERSION) || \
  85. (MCU_CFG_SW_PATCH_VERSION != CLOCK_IP_CFG_SW_PATCH_VERSION) \
  86. )
  87. #error "Software Version Numbers of Mcu_Cfg.h and Clock_Ip_Cfg.h are different"
  88. #endif
  89. /* Check if header file and Power_Ip_Cfg.h file are of the same vendor */
  90. #if (MCU_CFG_VENDOR_ID != POWER_IP_CFG_VENDOR_ID)
  91. #error "Mcu_Cfg.h and Power_Ip_Cfg.h have different vendor ids"
  92. #endif
  93. /* Check if header file and Power_Ip_Cfg.h file are of the same Autosar version */
  94. #if ((MCU_CFG_AR_RELEASE_MAJOR_VERSION != POWER_IP_CFG_AR_RELEASE_MAJOR_VERSION) || \
  95. (MCU_CFG_AR_RELEASE_MINOR_VERSION != POWER_IP_CFG_AR_RELEASE_MINOR_VERSION) || \
  96. (MCU_CFG_AR_RELEASE_REVISION_VERSION != POWER_IP_CFG_AR_RELEASE_REVISION_VERSION) \
  97. )
  98. #error "AutoSar Version Numbers of Mcu_Cfg.h and Power_Ip_Cfg.h are different"
  99. #endif
  100. /* Check if header file and Power_Ip_Cfg.h file are of the same Software version */
  101. #if ((MCU_CFG_SW_MAJOR_VERSION != POWER_IP_CFG_SW_MAJOR_VERSION) || \
  102. (MCU_CFG_SW_MINOR_VERSION != POWER_IP_CFG_SW_MINOR_VERSION) || \
  103. (MCU_CFG_SW_PATCH_VERSION != POWER_IP_CFG_SW_PATCH_VERSION) \
  104. )
  105. #error "Software Version Numbers of Mcu_Cfg.h and Power_Ip_Cfg.h are different"
  106. #endif
  107. /* Check if header file and Ram_Ip_Cfg.h file are of the same vendor */
  108. #if (MCU_CFG_VENDOR_ID != RAM_IP_CFG_VENDOR_ID)
  109. #error "Mcu_Cfg.h and Ram_Ip_Cfg.h have different vendor ids"
  110. #endif
  111. /* Check if header file and Ram_Ip_Cfg.h file are of the same Autosar version */
  112. #if ((MCU_CFG_AR_RELEASE_MAJOR_VERSION != RAM_IP_CFG_AR_RELEASE_MAJOR_VERSION) || \
  113. (MCU_CFG_AR_RELEASE_MINOR_VERSION != RAM_IP_CFG_AR_RELEASE_MINOR_VERSION) || \
  114. (MCU_CFG_AR_RELEASE_REVISION_VERSION != RAM_IP_CFG_AR_RELEASE_REVISION_VERSION) \
  115. )
  116. #error "AutoSar Version Numbers of Mcu_Cfg.h and Ram_Ip_Cfg.h are different"
  117. #endif
  118. /* Check if header file and Ram_Ip_Cfg.h file are of the same Software version */
  119. #if ((MCU_CFG_SW_MAJOR_VERSION != RAM_IP_CFG_SW_MAJOR_VERSION) || \
  120. (MCU_CFG_SW_MINOR_VERSION != RAM_IP_CFG_SW_MINOR_VERSION) || \
  121. (MCU_CFG_SW_PATCH_VERSION != RAM_IP_CFG_SW_PATCH_VERSION) \
  122. )
  123. #error "Software Version Numbers of Mcu_Cfg.h and Ram_Ip_Cfg.h are different"
  124. #endif
  125. /* Check if header file and Mcu_VS_0_PBcfg.h file are of the same vendor */
  126. #if (MCU_CFG_VENDOR_ID != MCU_VS_0_PBCFG_VENDOR_ID)
  127. #error "Mcu_Cfg.h and Mcu_VS_0_PBcfg.h have different vendor ids"
  128. #endif
  129. /* Check if header file and Mcu_VS_0_PBcfg.h file are of the same Autosar version */
  130. #if ((MCU_CFG_AR_RELEASE_MAJOR_VERSION != MCU_VS_0_PBCFG_AR_RELEASE_MAJOR_VERSION) || \
  131. (MCU_CFG_AR_RELEASE_MINOR_VERSION != MCU_VS_0_PBCFG_AR_RELEASE_MINOR_VERSION) || \
  132. (MCU_CFG_AR_RELEASE_REVISION_VERSION != MCU_VS_0_PBCFG_AR_RELEASE_REVISION_VERSION) \
  133. )
  134. #error "AutoSar Version Numbers of Mcu_Cfg.h and Mcu_VS_0_PBcfg.h are different"
  135. #endif
  136. /* Check if header file and Mcu_VS_0_PBcfg.h file are of the same Software version */
  137. #if ((MCU_CFG_SW_MAJOR_VERSION != MCU_VS_0_PBCFG_SW_MAJOR_VERSION) || \
  138. (MCU_CFG_SW_MINOR_VERSION != MCU_VS_0_PBCFG_SW_MINOR_VERSION) || \
  139. (MCU_CFG_SW_PATCH_VERSION != MCU_VS_0_PBCFG_SW_PATCH_VERSION) \
  140. )
  141. #error "Software Version Numbers of Mcu_Cfg.h and Mcu_VS_0_PBcfg.h are different"
  142. #endif
  143. /*==================================================================================================
  144. DEFINES AND MACROS
  145. ==================================================================================================*/
  146. /**
  147. * @brief Specifies the InstanceId of this module instance.
  148. */
  149. #define MCU_INSTANCE_ID ((uint8)0x0U)
  150. /**
  151. @{
  152. * @brief Service Ids for MCU APIs.
  153. */
  154. #define MCU_INIT_ID ((uint8)0x00U)
  155. #define MCU_INITRAMSECTION_ID ((uint8)0x01U)
  156. #define MCU_INITCLOCK_ID ((uint8)0x02U)
  157. #define MCU_DISTRIBUTEPLLCLOCK_ID ((uint8)0x03U)
  158. #define MCU_GETPLLSTATUS_ID ((uint8)0x04U)
  159. #define MCU_GETRESETREASON_ID ((uint8)0x05U)
  160. #define MCU_GETRESETRAWVALUE_ID ((uint8)0x06U)
  161. #define MCU_PERFORMRESET_ID ((uint8)0x07U)
  162. #define MCU_SETMODE_ID ((uint8)0x08U)
  163. #define MCU_GETVERSIONINFO_ID ((uint8)0x09U)
  164. #define MCU_GETRAMSTATE_ID ((uint8)0x0AU)
  165. /**@}*/
  166. /**
  167. @{
  168. * @brief Service Ids for NonASR MCU APIs.
  169. */
  170. #define MCU_GETPOWERDOMAIN_ID ((uint8)0x0BU)
  171. #define MCU_GETPERIPHERALSTATE_ID ((uint8)0x0CU)
  172. #define MCU_GETSYSTEMSTATE_ID ((uint8)0x0DU)
  173. #define MCU_GETPOWERMODESTATE_ID ((uint8)0x0EU)
  174. #define MCU_GETMEMCONFIG_ID ((uint8)0x13U)
  175. #define MCU_GETMIDRSTRUCTURE_ID ((uint8)0x14U)
  176. #define MCU_SSCMGETSTATUS_ID ((uint8)0x15U)
  177. #define MCU_SSCMGETUOPT_ID ((uint8)0x16U)
  178. #define MCU_DISABLECMU_ID ((uint8)0x17U)
  179. #define MCU_EMIOSCONFIGUREGPREN_ID ((uint8)0x18U)
  180. #define MCU_GETCLOCKFREQUENCY_ID ((uint8)0x19U)
  181. #define MCU_SLEEPONEXIT_ID ((uint8)0x1AU)
  182. #define MCU_SRAMRETENCONFIG_ID ((uint8)0x1BU)
  183. /**@}*/
  184. /**
  185. * @brief Pre-processor switch for enabling the default error detection and reporting to the DET.
  186. * The detection of default errors is configurable (ON / OFF) at pre-compile time.
  187. */
  188. #define MCU_DEV_ERROR_DETECT (STD_OFF)
  189. /**
  190. * @brief If this parameter is set to TRUE, the Power Management Controller (PMC) initialization has to be disabled from the MCU driver.
  191. */
  192. #define MCU_DISABLE_PMC_INIT (STD_OFF)
  193. /**
  194. * @brief If this parameter is set to TRUE, the Reset Control Module (RMC) initialization has to be disabled from the MCU driver.
  195. */
  196. #define MCU_DISABLE_RCM_INIT (STD_OFF)
  197. /**
  198. * @brief If this parameter is set to TRUE, the System Mode Controller (SMC) initialization has to be disabled from the MCU driver.
  199. */
  200. #define MCU_DISABLE_SMC_INIT (STD_OFF)
  201. /**
  202. * @brief Pre-processor switch to enable/disable the API to read out the modules version information.
  203. */
  204. #define MCU_VERSION_INFO_API (STD_OFF)
  205. /**
  206. * @brief Pre-processor switch to enable/disable the API Mcu_GetRamState.
  207. */
  208. #define MCU_GET_RAM_STATE_API (STD_OFF)
  209. /**
  210. * @brief If this parameter is set to FALSE, the clock initialization has to be disabled from the MCU driver.
  211. */
  212. #define MCU_INIT_CLOCK (STD_ON)
  213. /**
  214. * @brief This parameter shall be set True, if the H/W does not have a PLL or the PLL circuitry is enabled after the power on without S/W intervention.
  215. */
  216. #define MCU_NO_PLL (STD_ON)
  217. /**
  218. * @brief define for interrupt CMU, PMC, SCG peripheral
  219. */
  220. #define MCU_CMU_PMC_SCG_INTERRUPT (STD_OFF)
  221. #if (MCU_PERFORM_RESET_API == STD_ON)
  222. /**
  223. * @brief The user callout reset is/isn't available (STD_ON/STD_OFF) - called by MCU right before Mcu_PerformReset().
  224. */
  225. #define MCU_RESET_CALLOUT_USED (STD_OFF)
  226. #endif
  227. /**
  228. * @brief ISR Mcu_CmuClockFail_ISR is/isn't available
  229. */
  230. #define MCU_CMU_ERROR_ISR_USED (STD_OFF)
  231. /**
  232. * @brief Enable the usage of Non-Autosar API Mcu_GetPeripheral_State() for getting infos about peripheral state from MC_ME module.
  233. */
  234. #define MCU_GET_PERIPH_STATE_API (STD_OFF)
  235. /**
  236. * @brief Enable the usage of Non-Autosar API Mcu_GetPowerMode_State() for getting infos system platform configuration.
  237. */
  238. #define MCU_POWERMODE_STATE_API (STD_OFF)
  239. /**
  240. * @brief Enable the usage of Non-Autosar API Mcu_GetPowerDomain_Status. Get PMU state: operable or not.
  241. */
  242. #define MCU_GET_POWER_DOMAIN_API (STD_OFF)
  243. /**
  244. * @brief Enable the usage of Non-Autosar API Mcu_GetSystem_State() for getting system platform configuration information. Get (SSCM_STATUS | SSCM_MEMCONFIG).
  245. */
  246. #define MCU_GET_SYSTEM_STATE_API (STD_OFF)
  247. /**
  248. * @brief Enable the usage of Non-Autosar API Mcu_SscmGetMemConfig(). Get SSCM_MEMCONFIG.
  249. */
  250. #define MCU_GET_MEM_CONFIG_API (STD_OFF)
  251. /**
  252. * @brief Enable the usage of Non-Autosar API Mcu_SscmGetStatus(). Get SSCM_STATUS.
  253. */
  254. #define MCU_SSCM_GET_STATUS_API (STD_OFF)
  255. /**
  256. * @brief Enable the usage of Non-Autosar API Mcu_SscmGetUopt(). Get SSCM_UOPT.
  257. */
  258. #define MCU_SSCM_GET_UOPT_API (STD_OFF)
  259. /**
  260. * @brief Enable the usage of Non-Autosar API Mcu_GetMidrStructure(). Returns .
  261. */
  262. #define MCU_GET_MIDR_API (STD_OFF)
  263. /**
  264. * @brief Enable the usage of Non-Autosar API Mcu_EmiosConfigureGpren().
  265. */
  266. #define MCU_EMIOS_CONFIGURE_GPREN_API (STD_OFF)
  267. /**
  268. * @brief Enable the usage of Non-Autosar API Mcu_Disable_CMU().
  269. */
  270. #define MCU_DISABLE_CMU_API (STD_OFF)
  271. /**
  272. * @brief Enable the usage of Non-Autosar API Mcu_GetClockFrequency().
  273. */
  274. #define MCU_GET_CLOCK_FREQUENCY_API (STD_OFF)
  275. /**
  276. * @brief Enable/Disable the API for reporting the Dem Error.
  277. */
  278. #define MCU_DISABLE_DEM_REPORT_ERROR_STATUS (STD_ON)
  279. /**
  280. * @brief Enable the usage of Non-Autosar API Mcu_SRAMRetentionConfig().
  281. */
  282. #define MCU_SRAM_RETEN_CONFIG_API (STD_OFF)
  283. /**
  284. * @brief Enable/Disable the Ram Notification.
  285. */
  286. #define MCU_DISABLE_RAM_CONFIG (STD_ON)
  287. /**
  288. * @brief Enable/Disable the Flash Notification.
  289. */
  290. #define MCU_DISABLE_FLASH_CONFIG (STD_ON)
  291. /**
  292. * @brief ISR Mcu_VoltageError_ISR is/isn't available (STD_ON/STD_OFF)
  293. */
  294. #if (MCU_CMU_PMC_SCG_INTERRUPT == STD_ON)
  295. #define MCU_VOLTAGE_ERROR_ISR_USED (STD_OFF)
  296. #endif
  297. /**
  298. * @brief Maximum number of MCU Clock configurations.
  299. */
  300. #define MCU_MAX_CLKCONFIGS ((uint32)1U)
  301. /**
  302. * @brief Maximum number of MCU Mode configurations.
  303. */
  304. #define MCU_MAX_MODECONFIGS ((uint32)1U)
  305. /**
  306. * @brief Maximum number of MCU Ram configurations.
  307. */
  308. #define MCU_MAX_RAMCONFIGS ((uint32)0U)
  309. #define MCU_MAX_NORAMCONFIGS
  310. /**
  311. * @brief Pre-compile Support.
  312. */
  313. #define MCU_PRECOMPILE_SUPPORT (STD_ON)
  314. #ifdef MCU_GET_MIDR_API
  315. #if (MCU_GET_MIDR_API == STD_ON)
  316. /**
  317. * @brief Number of total available SIUL2 (SIUL2 + SIUL2_AE) units.
  318. */
  319. #define MCU_SIUL2_TOTAL_UNITS ((uint8)0U)
  320. #endif
  321. #endif
  322. /**
  323. * @brief Number of Clock Muxes per CGM module
  324. */
  325. /**
  326. * @brief Index of CGMs module
  327. */
  328. #ifdef MCU_ERROR_ISR_NOTIFICATION
  329. /* This is used to clear CMU flags from the RGM interrupt */
  330. #define MCU_CMU_CLEAR_CLOCK_IRQ_FLAG (MCU_CMU_ERROR_ISR_USED)
  331. #endif
  332. #if !(defined (CLOCK_IP_S32K1))
  333. /**
  334. * @brief Support for User mode.
  335. * If this parameter has been configured to 'TRUE' the Mcu driver can be executed from both supervisor and user mode.
  336. */
  337. #define MCU_ENABLE_USER_MODE_SUPPORT (STD_OFF)
  338. /** Check the driver user mode is enabled only when the MCAL_ENABLE_USER_MODE_SUPPORT is enabled */
  339. #ifndef MCAL_ENABLE_USER_MODE_SUPPORT
  340. #if (MCU_ENABLE_USER_MODE_SUPPORT == STD_ON)
  341. #error MCAL_ENABLE_USER_MODE_SUPPORT is not enabled. For running Mcu in user mode the MCAL_ENABLE_USER_MODE_SUPPORT needs to be defined.
  342. #endif /* (MCU_ENABLE_USER_MODE_SUPPORT == STD_ON) */
  343. #endif /* ifndef MCAL_ENABLE_USER_MODE_SUPPORT */
  344. #endif /* CLOCK_IP_S32K1 */
  345. /**
  346. * @brief The function Mcu_GetResetRawValue shall return an implementation specific value which does
  347. * not correspond to a valid value of the reset status register and is not equal to 0 if this
  348. * function is called prior to calling of the function Mcu_Init, and if supported by the
  349. * hardware.
  350. *
  351. */
  352. #define MCU_RAW_RESET_DEFAULT ((uint32)0xFFFFFFFFUL)
  353. /** @brief This is the corresponding bit of Stop Acknowledge Error reset in the returned value of Mcu_GetResetRawReason */
  354. #define MCU_RAW_RESET_SACKERR ((uint32)0x00002000U)
  355. /** @brief This is the corresponding bit of MDM-AP System Reset Request in the returned value of Mcu_GetResetRawReason */
  356. #define MCU_RAW_RESET_MDM_AP ((uint32)0x00000800U)
  357. /** @brief This is the corresponding bit of Software reset in the returned value of Mcu_GetResetRawReason */
  358. #define MCU_RAW_RESET_SW ((uint32)0x00000400U)
  359. /** @brief This is the corresponding bit of Stop Core Lockup reset in the returned value of Mcu_GetResetRawReason */
  360. #define MCU_RAW_RESET_LOCKUP ((uint32)0x00000200U)
  361. /** @brief This is the corresponding bit of JTAG generated reset in the returned value of Mcu_GetResetRawReason */
  362. #define MCU_RAW_RESET_JTAG ((uint32)0x00000100U)
  363. /** @brief This is the corresponding bit of Power-on reset in the returned value of Mcu_GetResetRawReason */
  364. #define MCU_RAW_RESET_POR ((uint32)0x00000080U)
  365. /** @brief This is the corresponding bit of external pin reset in the returned value of Mcu_GetResetRawReason */
  366. #define MCU_RAW_RESET_PIN ((uint32)0x00000040U)
  367. /** @brief This is the corresponding bit of watchdog reset in the returned value of Mcu_GetResetRawReason */
  368. #define MCU_RAW_RESET_WDOG ((uint32)0x00000020U)
  369. /** @brief This is the corresponding bit of CMU Loss-of-Lock reset in the returned value of Mcu_GetResetRawReason */
  370. #define MCU_RAW_RESET_CMU_LOC ((uint32)0x00000010U)
  371. /** @brief This is the corresponding bit of Loss-of-Lock reset in the returned value of Mcu_GetResetRawReason */
  372. #define MCU_RAW_RESET_LOL ((uint32)0x00000008U)
  373. /** @brief This is the corresponding bit of Loss-of-Clock reset in the returned value of Mcu_GetResetRawReason */
  374. #define MCU_RAW_RESET_LOC ((uint32)0x00000004U)
  375. /** @brief This is the corresponding bit of Low-Voltage Detect reset or High-Voltage Detect reset in the returned value of Mcu_GetResetRawReason */
  376. #define MCU_RAW_RESET_LVD ((uint32)0x00000002U)
  377. /**
  378. * @brief This define controls the availability of function Mcu_SleepOnExit
  379. */
  380. #define MCU_SLEEPONEXIT_SUPPORT (STD_ON)
  381. /*==================================================================================================
  382. DEFINES AND MACROS
  383. ==================================================================================================*/
  384. #if (MCU_DEV_ERROR_DETECT == STD_ON)
  385. /**
  386. @{
  387. * @brief Default error values are of type uint8.
  388. * The following errors and exceptions shall be detectable by the MCU module depending on its
  389. * build version (Default/production mode).
  390. *
  391. */
  392. #define MCU_E_PARAM_CONFIG ((uint8)0x0AU)
  393. #if (MCU_INIT_CLOCK == STD_ON)
  394. #define MCU_E_PARAM_CLOCK ((uint8)0x0BU)
  395. #endif
  396. #define MCU_E_PARAM_MODE ((uint8)0x0CU)
  397. #ifndef MCU_MAX_NORAMCONFIGS
  398. #define MCU_E_PARAM_RAMSECTION ((uint8)0x0DU)
  399. #endif
  400. #if (MCU_INIT_CLOCK == STD_ON) && (MCU_NO_PLL == STD_OFF)
  401. #define MCU_E_PLL_NOT_LOCKED ((uint8)0x0EU)
  402. #endif
  403. #define MCU_E_UNINIT ((uint8)0x0FU)
  404. #if (MCU_VERSION_INFO_API == STD_ON) || (MCU_GET_MIDR_API == STD_ON)
  405. #define MCU_E_PARAM_POINTER ((uint8)0x10U)
  406. #endif
  407. #define MCU_E_INIT_FAILED ((uint8)0x11U)
  408. #define MCU_E_ALREADY_INITIALIZED ((uint8)0x13U)
  409. #if (MCU_DISABLE_CMU_API == STD_ON)
  410. #define MCU_E_CMU_INDEX_OUT_OF_RANGE ((uint8)0x22U)
  411. #endif
  412. /**@}*/
  413. #endif /* (MCU_DEV_ERROR_DETECT == STD_ON) */
  414. #ifdef MCU_ERROR_ISR_NOTIFICATION
  415. /**
  416. @{
  417. * @brief Error ISR values are of type uint8.
  418. * The following error codes are reported by the error ISR.
  419. */
  420. #if (MCU_CMU_ERROR_ISR_USED == STD_ON)
  421. #define MCU_E_ISR_CLOCK_FAILURE ((uint8)0x01U)
  422. #endif
  423. #endif /* MCU_ERROR_ISR_NOTIFICATION */
  424. /*==================================================================================================
  425. STRUCTURES AND OTHER TYPEDEFS
  426. ==================================================================================================*/
  427. /**
  428. * @brief The Mcu_ModeType specifies the identification (ID) for a MCU mode, configured via configuration structure.
  429. * @details The type shall be uint8, uint16 or uint32.
  430. *
  431. * @implements Mcu_ModeType_typedef
  432. *
  433. */
  434. typedef uint32 Mcu_ModeType;
  435. /**
  436. * @brief The Mcu_RamSectionType specifies the identification (ID) for a RAM section, configured via the configuration structure.
  437. * The type shall be uint8, uint16 or uint32, based on best performance.
  438. * @implements Mcu_RamSectionType_typedef
  439. */
  440. typedef uint32 Mcu_RamSectionType;
  441. /**
  442. * @brief The Mcu_RamWriteSizeType specifies the RAM section write size.
  443. * The type shall be uint8, uint16 or uint32, based on best performance.
  444. *
  445. */
  446. typedef uint32 Mcu_RamWriteSizeType;
  447. #if (MCU_INIT_CLOCK == STD_ON)
  448. /**
  449. * @brief Defines the identification (ID) for clock setting configured via the configuration structure.
  450. * @details The type shall be uint8, uint16 or uint32, depending on uC platform.
  451. *
  452. * @implements Mcu_ClockType_typedef
  453. */
  454. typedef uint32 Mcu_ClockType;
  455. #endif /* (MCU_INIT_CLOCK == STD_ON) */
  456. /**
  457. * @brief The type Mcu_RawResetType specifies the reset reason in raw register format, read from a reset status register.
  458. * @details The type shall be uint8, uint16 or uint32 based on best performance.
  459. *
  460. * @implements Mcu_RawResetType_typedef
  461. *
  462. */
  463. typedef uint32 Mcu_RawResetType; /**< @brief Destructive and Functional Reset Events Log. */
  464. /**
  465. * @brief DEM error reporting configuration.
  466. * @details This structure contains information DEM error reporting
  467. */
  468. typedef struct
  469. {
  470. Mcal_DemErrorType Mcu_E_TimeoutFailureCfg;
  471. Mcal_DemErrorType Mcu_E_InvalidFxoscConfigCfg;
  472. Mcal_DemErrorType Mcu_E_ClockMuxSwitchFailureCfg;
  473. Mcal_DemErrorType Mcu_E_ClockFailureCfg;
  474. Mcal_DemErrorType Mcu_E_SwitchModeFailureCfg;
  475. } Mcu_DemConfigType;
  476. #if (MCU_POWERMODE_STATE_API == STD_ON)
  477. /**
  478. * @brief State of the current power mode.
  479. * @details Used to store the value of register value.
  480. */
  481. typedef uint32 Mcu_PowerModeStateType;
  482. #endif /* (MCU_POWERMODE_STATE_API == STD_ON) */
  483. /*==================================================================================================
  484. CONSTANTS
  485. ==================================================================================================*/
  486. #if (MCU_INIT_CLOCK == STD_ON)
  487. /**
  488. * @brief Create defines with the IDs assigned to Mcu Clock configurations.
  489. * These IDs will be transmitted as input parameters for Mcu_InitClock() API.
  490. */
  491. #define McuClockSettingConfig_0 ((Mcu_ClockType)0U)
  492. #define McuConf_McuClockSettingConfig_McuClockSettingConfig_0 ((Mcu_ClockType)0U)
  493. #endif
  494. /**
  495. * @brief Create defines with the IDs assigned to Mcu Mode configurations.
  496. * These IDs will be transmitted as input parameters for Mcu_SetMode() API.
  497. */
  498. #define McuModeSettingConf_0 ((Mcu_ModeType)0U)
  499. #define McuConf_McuModeSettingConf_McuModeSettingConf_0 ((Mcu_ModeType)0U)
  500. /**
  501. * @brief Create defines with the IDs assigned to Mcu RAM Section configurations.
  502. * These IDs will be transmitted as input parameters for Mcu_InitRamSection() API.
  503. */
  504. /*==================================================================================================
  505. ENUMS
  506. ==================================================================================================*/
  507. /**
  508. * @brief Type of the return value of the function Mcu_GetPllStatus.
  509. * @details The type of Mcu_PllStatusType is an enumeration with the following values:
  510. * MCU_PLL_LOCKED, MCU_PLL_UNLOCKED, MCU_PLL_STATUS_UNDEFINED.
  511. *
  512. * @implements Mcu_PllStatusType_Enumeration
  513. *
  514. */
  515. typedef enum
  516. {
  517. MCU_PLL_LOCKED = 0x33U, /**< @brief PLL is locked. */
  518. MCU_PLL_UNLOCKED = 0xCCU, /**< @brief PLL is unlocked. */
  519. MCU_PLL_STATUS_UNDEFINED = 0x5AU /**< @brief PLL Status is unknown. */
  520. } Mcu_PllStatusType;
  521. /**
  522. * @brief The type Mcu_ResetType, represents the different reset that a specified MCU can have.
  523. * @details The MCU module shall provide at least the values MCU_POWER_ON_RESET and MCU_RESET_UNDEFINED for the enumeration Mcu_ResetType.
  524. *
  525. * @implements Mcu_ResetType_Enumeration
  526. */
  527. typedef Power_Ip_ResetType Mcu_ResetType;
  528. #if (MCU_GET_RAM_STATE_API == STD_ON)
  529. /**
  530. * @brief Ram State of the microcontroller.
  531. * @details This is the Ram State data type returned by the function Mcu_GetRamState() of the Mcu module.
  532. * @implements Mcu_RamStateType_Enumeration
  533. */
  534. typedef enum
  535. {
  536. MCU_RAMSTATE_INVALID = 0x99U, /**< @brief RAM content is not valid or unknown (default). */
  537. MCU_RAMSTATE_VALID = 0x66U /**< @brief RAM content is valid. */
  538. } Mcu_RamStateType;
  539. #endif /* (MCU_GET_RAM_STATE_API == STD_ON) */
  540. #ifdef MCU_PREPARE_MEMORY_CONFIG
  541. /**
  542. * @brief The stage of the flash and ram controllers configuration.
  543. * @details This is used to specify the entry and exit point of the flash and ram controllers configuration.
  544. */
  545. typedef enum
  546. {
  547. MCU_RAM_MEMORY_CONFIG_ENTRY_POINT = 0x77U,
  548. MCU_RAM_MEMORY_CONFIG_EXIT_POINT = 0x88U
  549. } Mcu_MemoryConfigStageType;
  550. #endif
  551. #if (defined(MCU_PMC_NOTIFICATION) && (MCU_ENTER_LOW_POWER_MODE == STD_ON))
  552. /**
  553. * @brief Power management controller events.
  554. * @details The various events triggered by the power management controller.
  555. */
  556. typedef enum
  557. {
  558. MCU_LAST_MILE_REGULATOR_DISABLED = 0x55U
  559. } Mcu_PowerManagementEventType;
  560. #endif
  561. #ifdef MCU_SLEEPONEXIT_SUPPORT
  562. #if (MCU_SLEEPONEXIT_SUPPORT == STD_ON)
  563. typedef enum
  564. {
  565. MCU_SLEEP_ON_EXIT_DISABLED = 0U, /**< @brief Disable SLEEPONEXIT bit (default). */
  566. MCU_SLEEP_ON_EXIT_ENABLED /**< @brief Enable SLEEPONEXIT bit. */
  567. } Mcu_SleepOnExitType;
  568. #endif
  569. #endif
  570. #if (MCU_SRAM_RETEN_CONFIG_API ==STD_ON)
  571. /**
  572. * @brief Type of parameter value of the function Mcu_SRAMRetentionConfig.
  573. * @details The type of Mcu_SRAMRetenConfigType is an enumeration with the following values:
  574. * MCU_SRAML_RETEN, MCU_SRAMU_RETEN, MCU_SRAMLU_RETEN, MCU_NO_SRAMLU_RETEN.
  575. */
  576. typedef Power_Ip_SRAMRetenConfigType Mcu_SRAMRetenConfigType;
  577. #endif
  578. /*==================================================================================================
  579. DEFINES AND MACROS
  580. ==================================================================================================*/
  581. /**
  582. * @brief This macro is used to define the position of the first reset reason.
  583. *
  584. */
  585. #define MCU_FIRST_RESET_REASON_POS_U32 ((uint32)MCU_POWER_ON_RESET)
  586. /*==================================================================================================
  587. GLOBAL VARIABLE DECLARATIONS
  588. ==================================================================================================*/
  589. #if (MCU_DISABLE_DEM_REPORT_ERROR_STATUS == STD_OFF)
  590. #define MCU_START_SEC_VAR_CLEARED_UNSPECIFIED
  591. #include "Mcu_MemMap.h"
  592. /**
  593. * @brief Local copy of the pointer to the configuration data
  594. */
  595. extern const Mcu_DemConfigType * Mcu_pDemCfgPtr;
  596. #define MCU_STOP_SEC_VAR_CLEARED_UNSPECIFIED
  597. #include "Mcu_MemMap.h"
  598. #define MCU_START_SEC_CONFIG_DATA_UNSPECIFIED
  599. #include "Mcu_MemMap.h"
  600. extern const Mcu_DemConfigType Mcu_Dem_Config;
  601. #define MCU_STOP_SEC_CONFIG_DATA_UNSPECIFIED
  602. #include "Mcu_MemMap.h"
  603. #endif /* (MCU_DISABLE_DEM_REPORT_ERROR_STATUS == STD_OFF) */
  604. /*==================================================================================================
  605. * FUNCTION PROTOTYPES
  606. ==================================================================================================*/
  607. #define MCU_START_SEC_CODE
  608. #include "Mcu_MemMap.h"
  609. #define MCU_STOP_SEC_CODE
  610. #include "Mcu_MemMap.h"
  611. #ifdef __cplusplus
  612. }
  613. #endif
  614. #endif /* #ifndef MCU_CFG_H */
  615. /** @} */