Mcal.h 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624
  1. /*==================================================================================================
  2. * Project : RTD AUTOSAR 4.4
  3. * Platform : CORTEXM
  4. * Peripheral : S32K14X
  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 Mcal.h
  26. * @implements Mcal.h_Artifact
  27. * @version 1.0.0
  28. *
  29. * @brief AUTOSAR Base - SWS Compiler abstraction specific for MCAL.
  30. * @details The file Mcal.h provides MCAL specific macros used for compiler abstraction.
  31. *
  32. *
  33. * @addtogroup BASE_COMPONENT
  34. * @{
  35. */
  36. #ifndef MCAL_H
  37. #define MCAL_H
  38. #ifdef __cplusplus
  39. extern "C"{
  40. #endif
  41. /*==================================================================================================
  42. * INCLUDE FILES
  43. * 1) system and project includes
  44. * 2) needed interfaces from external units
  45. * 3) internal and external interfaces from this unit
  46. ==================================================================================================*/
  47. /*
  48. * @file Mcal.h
  49. * @brief Include compiler abstraction
  50. */
  51. #include "Compiler.h"
  52. /*
  53. * @file Mcal.h
  54. * @brief Include standard types
  55. */
  56. #include "StandardTypes.h"
  57. #include "Soc_Ips.h"
  58. #include "Reg_eSys.h"
  59. #include "OsIf_Internal.h"
  60. /*==================================================================================================
  61. * SOURCE FILE VERSION INFORMATION
  62. ==================================================================================================*/
  63. #define MCAL_VENDOR_ID 43
  64. /** @violates @ref Mcal_h_REF_2 unused macro. */
  65. #define MCAL_MODULE_ID 0
  66. #define MCAL_AR_RELEASE_MAJOR_VERSION 4
  67. #define MCAL_AR_RELEASE_MINOR_VERSION 4
  68. #define MCAL_AR_RELEASE_REVISION_VERSION 0
  69. #define MCAL_SW_MAJOR_VERSION 1
  70. #define MCAL_SW_MINOR_VERSION 0
  71. #define MCAL_SW_PATCH_VERSION 0
  72. /*==================================================================================================
  73. * FILE VERSION CHECKS
  74. ==================================================================================================*/
  75. #ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
  76. /* Check if source file and Compiler.h header file are of the same Autosar version */
  77. #if ((MCAL_AR_RELEASE_MAJOR_VERSION != COMPILER_AR_RELEASE_MAJOR_VERSION) || \
  78. (MCAL_AR_RELEASE_MINOR_VERSION != COMPILER_AR_RELEASE_MINOR_VERSION))
  79. #error "AutoSar Version Numbers of Mcal.h and Compiler.h are different"
  80. #endif
  81. #endif
  82. #ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
  83. /* Check if source file and StandardTypes.h header file are of the same Autosar version */
  84. #if ((MCAL_AR_RELEASE_MAJOR_VERSION != STD_AR_RELEASE_MAJOR_VERSION) || \
  85. (MCAL_AR_RELEASE_MINOR_VERSION != STD_AR_RELEASE_MINOR_VERSION))
  86. #error "AutoSar Version Numbers of Mcal.h and StandardTypes.h are different"
  87. #endif
  88. #endif
  89. #ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
  90. /* Check if source file and StandardTypes.h header file are of the same Autosar version */
  91. #if ((MCAL_AR_RELEASE_MAJOR_VERSION != REG_ESYS_AR_RELEASE_MAJOR_VERSION) || \
  92. (MCAL_AR_RELEASE_MINOR_VERSION != REG_ESYS_AR_RELEASE_MINOR_VERSION))
  93. #error "AutoSar Version Numbers of Mcal.h and Reg_eSys.h are different"
  94. #endif
  95. #endif
  96. /* Check if source file and Soc_Ips.h header file have same versions */
  97. #if (MCAL_VENDOR_ID != SOC_IPS_VENDOR_ID)
  98. #error "Soc_Ips.h and Mcal.h have different vendor IDs"
  99. #endif
  100. /* Check if source file and Soc_Ips.h header file are of the same Autosar version */
  101. #if ((MCAL_AR_RELEASE_MAJOR_VERSION != SOC_IPS_AR_RELEASE_MAJOR_VERSION) || \
  102. (MCAL_AR_RELEASE_MINOR_VERSION != SOC_IPS_AR_RELEASE_MINOR_VERSION))
  103. #error "AutoSar Version Numbers of Mcal.h and Soc_Ips.h are different"
  104. #endif
  105. #if ((MCAL_SW_MAJOR_VERSION != SOC_IPS_SW_MAJOR_VERSION) || \
  106. (MCAL_SW_MINOR_VERSION != SOC_IPS_SW_MINOR_VERSION) || \
  107. (MCAL_SW_PATCH_VERSION != SOC_IPS_SW_PATCH_VERSION))
  108. #error "Software Version Numbers of Soc_Ips.h and Mcal.h are different"
  109. #endif
  110. /*==================================================================================================
  111. * CONSTANTS
  112. ==================================================================================================*/
  113. /*==================================================================================================
  114. * DEFINES AND MACROS
  115. ==================================================================================================*/
  116. /**************************************** Green Hills *********************************************/
  117. #ifdef _GREENHILLS_C_S32K1XX_
  118. /**
  119. * @brief Compiler abstraction for the asm keyword.
  120. */
  121. #define ASM_KEYWORD __asm
  122. /**
  123. * @brief Compiler abstraction for the intrinsic wait instruction.
  124. */
  125. /** @violates @ref Mcal_h_REF_1 A function should be used in preference to a function-like macro. */
  126. #define EXECUTE_WAIT() \
  127. do \
  128. { \
  129. OsIf_ResumeAllInterrupts(); \
  130. ASM_KEYWORD(" wfi"); \
  131. OsIf_SuspendAllInterrupts(); \
  132. } while (0)
  133. /**
  134. * @brief Compiler abstraction for the data alignment
  135. */
  136. /** @violates @ref Mcal_h_REF_1 A function should be used in preference to a function-like macro. */
  137. #define ALIGNED_VARS_START(sec_name, align)
  138. /**
  139. * @brief Compiler abstraction for the data alignment
  140. */
  141. /** @violates @ref Mcal_h_REF_1 A function should be used in preference to a function-like macro. */
  142. #define VAR_ALIGN(v, size) __attribute__(( aligned(size) )) v;
  143. /**
  144. * @brief Compiler abstraction for the data alignment
  145. */
  146. /** @violates @ref Mcal_h_REF_1 A function should be used in preference to a function-like macro. */
  147. #define ALIGNED_VARS_STOP()
  148. /**
  149. * @brief Compiler abstraction for the packed qualifier
  150. */
  151. #define PACKED __packed
  152. /**
  153. * @brief Compiler abstraction for MCAL Fault Injection tests
  154. */
  155. #ifdef MCAL_ENABLE_FAULT_INJECTION
  156. /** @violates @ref Mcal_h_REF_1 A function should be used in preference to a function-like macro. */
  157. #define MCAL_PUT_IN_QUOTES(x) #x
  158. /** @violates @ref Mcal_h_REF_1 A function should be used in preference to a function-like macro. */
  159. #define MCAL_FAULT_INJECTION_POINT(label) ASM_KEYWORD(MCAL_PUT_IN_QUOTES(label::))
  160. #else
  161. /** @violates @ref Mcal_h_REF_1 A function should be used in preference to a function-like macro. */
  162. #define MCAL_FAULT_INJECTION_POINT(label)
  163. #endif
  164. #endif /* #ifdef _GREENHILLS_C_S32K1XX_ */
  165. /**************************************** Wind River Diab *****************************************/
  166. #ifdef _DIABDATA_C_S32K1XX_
  167. /**
  168. * @brief Compiler abstraction for the asm keyword.
  169. */
  170. #define ASM_KEYWORD __asm volatile
  171. /**
  172. * @brief Compiler abstraction for the intrinsic wait instruction.
  173. */
  174. /** @violates @ref Mcal_h_REF_1 A function should be used in preference to a function-like macro. */
  175. #define EXECUTE_WAIT() \
  176. do \
  177. { \
  178. OsIf_ResumeAllInterrupts(); \
  179. ASM_KEYWORD(" wfi"); \
  180. OsIf_SuspendAllInterrupts(); \
  181. } while (0)
  182. /**
  183. * @brief Compiler abstraction for the data alignment
  184. */
  185. /** @violates @ref Mcal_h_REF_1 A function should be used in preference to a function-like macro. */
  186. #define ALIGNED_VARS_START(sec_name, align)
  187. /**
  188. * @brief Compiler abstraction for the data alignment
  189. */
  190. /** @violates @ref Mcal_h_REF_1 A function should be used in preference to a function-like macro. */
  191. #define VAR_ALIGN(v, size) __attribute__(( aligned(size) )) v;
  192. /**
  193. * @brief Compiler abstraction for the data alignment
  194. */
  195. /** @violates @ref Mcal_h_REF_1 A function should be used in preference to a function-like macro. */
  196. #define ALIGNED_VARS_STOP()
  197. /**
  198. * @brief Compiler abstraction for the packed qualifier
  199. */
  200. #define PACKED __attribute__((packed))
  201. /**
  202. * @brief Compiler abstraction for MCAL Fault Injection tests
  203. */
  204. #ifdef MCAL_ENABLE_FAULT_INJECTION
  205. /** @violates @ref Mcal_h_REF_1 A function should be used in preference to a function-like macro. */
  206. #define MCAL_PUT_IN_QUOTES(x) #x
  207. /** @violates @ref Mcal_h_REF_1 A function should be used in preference to a function-like macro. */
  208. #define MCAL_FAULT_INJECTION_POINT(label) ASM_KEYWORD(MCAL_PUT_IN_QUOTES(label:))
  209. #else
  210. /** @violates @ref Mcal_h_REF_1 A function should be used in preference to a function-like macro. */
  211. #define MCAL_FAULT_INJECTION_POINT(label)
  212. #endif
  213. #endif /* #ifdef _DIABDATA_C_S32K1XX_ */
  214. /*************************************** CodeWarrior **********************************************/
  215. #ifdef _CODEWARRIOR_C_S32K1XX_
  216. /**
  217. * @brief Compiler abstraction for the asm keyword.
  218. */
  219. #define ASM_KEYWORD asm
  220. /**
  221. * @brief Compiler abstraction for the intrinsic wait instruction.
  222. */
  223. /** @violates @ref Mcal_h_REF_1 A function should be used in preference to a function-like macro. */
  224. #define EXECUTE_WAIT() \
  225. do \
  226. { \
  227. OsIf_ResumeAllInterrupts(); \
  228. ASM_KEYWORD (" opword 0x7C00007C"); \
  229. OsIf_SuspendAllInterrupts(); \
  230. } while (0)
  231. /**
  232. * @brief Compiler abstraction for the data alignment
  233. */
  234. /** @violates @ref Mcal_h_REF_1 A function should be used in preference to a function-like macro. */
  235. #define ALIGNED_VARS_START(sec_name, align)
  236. /**
  237. * @brief Compiler abstraction for the data alignment
  238. */
  239. /** @violates @ref Mcal_h_REF_1 A function should be used in preference to a function-like macro. */
  240. #define VAR_ALIGN(v, size) v __attribute__(( aligned(size) ));
  241. /**
  242. * @brief Compiler abstraction for the data alignment
  243. */
  244. /** @violates @ref Mcal_h_REF_1 A function should be used in preference to a function-like macro. */
  245. #define ALIGNED_VARS_STOP()
  246. /**
  247. * @brief Compiler abstraction for the packed qualifier
  248. */
  249. #define PACKED __packed
  250. #endif /* #ifdef _CODEWARRIOR_C_S32K1XX_ */
  251. /*************************************** Cosmic ***************************************************/
  252. #ifdef _COSMIC_C_S32K1XX_
  253. /**
  254. * @brief Compiler abstraction for the asm keyword.
  255. */
  256. #define ASM_KEYWORD _asm
  257. /**
  258. * @brief Compiler abstraction for the asm keyword.
  259. */
  260. /** @violates @ref Mcal_h_REF_1 A function should be used in preference to a function-like macro. */
  261. #define ASM_PUBLIC_LABEL(label) _asm("\txdef\t" #label "\n" #label ":")
  262. /**
  263. * @brief Compiler abstraction for the intrinsic wait instruction.
  264. */
  265. /** @violates @ref Mcal_h_REF_1 A function should be used in preference to a function-like macro. */
  266. #define EXECUTE_WAIT() \
  267. do \
  268. { \
  269. OsIf_ResumeAllInterrupts(); \
  270. ASM_KEYWORD (" dc.l 0x7C00007C"); \
  271. OsIf_SuspendAllInterrupts(); \
  272. } while (0)
  273. /**
  274. * @brief Compiler abstraction for the data alignment
  275. */
  276. #define ALIGNED_VARS_START(sec_name, align) \#pragma section [sec_name ## align]
  277. /**
  278. * @brief Compiler abstraction for the data alignment
  279. */
  280. #define VAR_ALIGN(v, size) v;
  281. /**
  282. * @brief Compiler abstraction for the data alignment
  283. */
  284. #define ALIGNED_VARS_STOP() \#pragma section []
  285. #endif /* #ifdef _COSMIC_C_S32K1XX_ */
  286. /*************************************** HighTec **********************************************/
  287. #ifdef _HITECH_C_S32K1XX_
  288. /**
  289. * @brief Compiler abstraction for the asm keyword.
  290. */
  291. #define ASM_KEYWORD __asm
  292. /**
  293. * @brief Compiler abstraction for the intrinsic wait instruction.
  294. */
  295. /** @violates @ref Mcal_h_REF_1 A function should be used in preference to a function-like macro. */
  296. #define EXECUTE_WAIT() \
  297. do \
  298. { \
  299. OsIf_ResumeAllInterrupts(); \
  300. ASM_KEYWORD(" wait"); \
  301. OsIf_SuspendAllInterrupts(); \
  302. } while (0)
  303. /**
  304. * @brief Compiler abstraction for the data alignment
  305. */
  306. /** @violates @ref Mcal_h_REF_1 A function should be used in preference to a function-like macro. */
  307. #define ALIGNED_VARS_START(sec_name, align)
  308. /**
  309. * @brief Compiler abstraction for the data alignment
  310. */
  311. /** @violates @ref Mcal_h_REF_1 A function should be used in preference to a function-like macro. */
  312. #define VAR_ALIGN(v, size) __attribute__(( aligned(size) )) v;
  313. /**
  314. * @brief Compiler abstraction for the data alignment
  315. */
  316. /** @violates @ref Mcal_h_REF_1 A function should be used in preference to a function-like macro. */
  317. #define ALIGNED_VARS_STOP()
  318. #endif /* #ifdef _HITECH_C_S32K1XX_ */
  319. /**************************************** Linaro *********************************************/
  320. #ifdef _LINARO_C_S32K1XX_
  321. /**
  322. * @brief Compiler abstraction for the asm keyword.
  323. */
  324. #define ASM_KEYWORD __asm
  325. /**
  326. * @brief Compiler abstraction for the intrinsic wait instruction.
  327. */
  328. /** @violates @ref Mcal_h_REF_1 A function should be used in preference to a function-like macro. */
  329. #define EXECUTE_WAIT() \
  330. do \
  331. { \
  332. OsIf_ResumeAllInterrupts(); \
  333. ASM_KEYWORD(" wfi"); \
  334. OsIf_SuspendAllInterrupts(); \
  335. } while (0)
  336. /**
  337. * @brief Compiler abstraction for the data alignment
  338. */
  339. /** @violates @ref Mcal_h_REF_1 A function should be used in preference to a function-like macro. */
  340. #define ALIGNED_VARS_START(sec_name, align)
  341. /**
  342. * @brief Compiler abstraction for the data alignment
  343. */
  344. /** @violates @ref Mcal_h_REF_1 A function should be used in preference to a function-like macro. */
  345. #define VAR_ALIGN(v, size) __attribute__(( aligned(size) )) v;
  346. /**
  347. * @brief Compiler abstraction for the data alignment
  348. */
  349. /** @violates @ref Mcal_h_REF_1 A function should be used in preference to a function-like macro. */
  350. #define ALIGNED_VARS_STOP()
  351. /**
  352. * @brief Compiler abstraction for the packed qualifier
  353. */
  354. #define PACKED __attribute__((__packed__))
  355. /**
  356. * @brief Compiler abstraction for MCAL Fault Injection tests
  357. */
  358. #ifdef MCAL_ENABLE_FAULT_INJECTION
  359. /** @violates @ref Mcal_h_REF_1 A function should be used in preference to a function-like macro. */
  360. #define MCAL_PUT_IN_QUOTES(x) #x
  361. /** @violates @ref Mcal_h_REF_1 A function should be used in preference to a function-like macro. */
  362. #define MCAL_FAULT_INJECTION_POINT(label) ASM_KEYWORD(MCAL_PUT_IN_QUOTES(label:))
  363. #else
  364. /** @violates @ref Mcal_h_REF_1 A function should be used in preference to a function-like macro. */
  365. #define MCAL_FAULT_INJECTION_POINT(label)
  366. #endif
  367. #endif /* #ifdef _LINARO_C_S32K1XX_ */
  368. /**************************************** DS5 *********************************************/
  369. #ifdef _ARM_DS5_C_S32K1XX_
  370. /**
  371. * @brief Compiler abstraction for the asm keyword.
  372. */
  373. #define ASM_KEYWORD __asm
  374. /**
  375. * @brief Compiler abstraction for the intrinsic wait instruction.
  376. */
  377. /** @violates @ref Mcal_h_REF_1 A function should be used in preference to a function-like macro. */
  378. #define EXECUTE_WAIT() \
  379. do \
  380. { \
  381. OsIf_ResumeAllInterrupts(); \
  382. ASM_KEYWORD(" wfi"); \
  383. OsIf_SuspendAllInterrupts(); \
  384. } while (0)
  385. /**
  386. * @brief Compiler abstraction for the data alignment
  387. */
  388. /** @violates @ref Mcal_h_REF_1 A function should be used in preference to a function-like macro. */
  389. #define ALIGNED_VARS_START(sec_name, align)
  390. /**
  391. * @brief Compiler abstraction for the data alignment
  392. */
  393. /** @violates @ref Mcal_h_REF_1 A function should be used in preference to a function-like macro. */
  394. #define VAR_ALIGN(v, size) __align(size) v;
  395. /**
  396. * @brief Compiler abstraction for the data alignment
  397. */
  398. /** @violates @ref Mcal_h_REF_1 A function should be used in preference to a function-like macro. */
  399. #define ALIGNED_VARS_STOP()
  400. /**
  401. * @brief Compiler abstraction for the packed qualifier
  402. */
  403. #define PACKED __packed
  404. /**
  405. * @brief Compiler abstraction for MCAL Fault Injection tests
  406. */
  407. #ifdef MCAL_ENABLE_FAULT_INJECTION
  408. /** @violates @ref Mcal_h_REF_1 A function should be used in preference to a function-like macro. */
  409. #define MCAL_PUT_IN_QUOTES(x) #x
  410. /** @violates @ref Mcal_h_REF_1 A function should be used in preference to a function-like macro. */
  411. #define MCAL_FAULT_INJECTION_POINT(label) ASM_KEYWORD(MCAL_PUT_IN_QUOTES(label:))
  412. #else
  413. /** @violates @ref Mcal_h_REF_1 A function should be used in preference to a function-like macro. */
  414. #define MCAL_FAULT_INJECTION_POINT(label)
  415. #endif
  416. #endif /* #ifdef _ARM_DS5_C_S32K1XX_ */
  417. /**************************************** IAR *********************************************/
  418. #ifdef _IAR_C_S32K1XX_
  419. /**
  420. * @brief Compiler abstraction for the "Put in Quotes".
  421. */
  422. /** @violates @ref Mcal_h_REF_1 A function should be used in preference to a function-like macro. */
  423. #define MCAL_PUT_IN_QUOTES(x) #x
  424. /**
  425. * @brief Compiler abstraction for the "Double Put in Quotes" - Used by VAL_ALIGN.
  426. */
  427. /** @violates @ref Mcal_h_REF_1 A function should be used in preference to a function-like macro. */
  428. #define MCAL_PUT_IN_QUOTES1(x) MCAL_PUT_IN_QUOTES(x)
  429. /**
  430. * @brief Compiler abstraction for the asm keyword.
  431. */
  432. #define ASM_KEYWORD __asm
  433. /**
  434. * @brief Compiler abstraction for the intrinsic wait instruction.
  435. */
  436. /*
  437. * @violates @ref Mcal_h_REF_1 A function should be used in preference to a function-like macro.
  438. */
  439. #define EXECUTE_WAIT() \
  440. do \
  441. { \
  442. OsIf_ResumeAllInterrupts(); \
  443. ASM_KEYWORD(" wfi"); \
  444. OsIf_SuspendAllInterrupts(); \
  445. } while (0)
  446. /**
  447. * @brief Compiler abstraction for the data alignment
  448. */
  449. /*
  450. * @violates @ref Mcal_h_REF_1 A function should be used in preference to a function-like macro.
  451. */
  452. #define ALIGNED_VARS_START(sec_name, align)
  453. /**
  454. * @brief Compiler abstraction for the data alignment
  455. */
  456. /*
  457. * @violates @ref Mcal_h_REF_1 A function should be used in preference to a function-like macro.
  458. */
  459. #define VAR_ALIGN(v, size) _Pragma(MCAL_PUT_IN_QUOTES1(data_alignment=size)) \
  460. v;
  461. /**
  462. * @brief Compiler abstraction for the data alignment
  463. */
  464. /*
  465. * @violates @ref Mcal_h_REF_1 A function should be used in preference to a function-like macro.
  466. */
  467. #define ALIGNED_VARS_STOP()
  468. /**
  469. * @brief Compiler abstraction for the packed qualifier
  470. */
  471. /*
  472. * @violates @ref Mcal_h_REF_1 A function should be used in preference to a function-like macro.
  473. */
  474. #define PACKED __packed
  475. /**
  476. * @brief Compiler abstraction for MCAL Fault Injection tests
  477. */
  478. #ifdef MCAL_ENABLE_FAULT_INJECTION
  479. /** @violates @ref Mcal_h_REF_1 A function should be used in preference to a function-like macro. */
  480. #define MCAL_FAULT_INJECTION_POINT(label) ASM_KEYWORD(MCAL_PUT_IN_QUOTES(label:))
  481. #else
  482. /** @violates @ref Mcal_h_REF_1 A function should be used in preference to a function-like macro. */
  483. #define MCAL_FAULT_INJECTION_POINT(label)
  484. #endif
  485. #endif /* #ifdef _IAR_C_S32K1XX_ */
  486. /* check that the compiler used is supported (otherwise some defines might not exist) */
  487. #ifndef _GREENHILLS_C_S32K1XX_
  488. #ifndef _DIABDATA_C_S32K1XX_
  489. #ifndef _CODEWARRIOR_C_S32K1XX_
  490. #ifndef _COSMIC_C_S32K1XX_
  491. #ifndef _HITECH_C_S32K1XX_
  492. #ifndef _LINARO_C_S32K1XX_
  493. #ifndef _ARM_DS5_C_S32K1XX_
  494. #ifndef _IAR_C_S32K1XX_
  495. #error "Unsupported compiler. Compiler abstraction needs to be updated to use this compiler."
  496. #endif
  497. #endif
  498. #endif
  499. #endif
  500. #endif
  501. #endif
  502. #endif
  503. #endif
  504. #if (MCAL_PLATFORM_ARM == MCAL_ARM_AARCH64)
  505. /**
  506. * @brief Data Synchronization Barrier (DSB) completes when all instructions before this instruction complete
  507. */
  508. /*
  509. * @violates @ref Mcal_h_REF_1 A function should be used in preference to a function-like macro.
  510. */
  511. #define MCAL_DATA_SYNC_BARRIER() ASM_KEYWORD("dsb sy":::"memory")
  512. /**
  513. * @brief flushes the pipeline in the processor, so that all instructions following the ISB are fetched from cache or memory, after the ISB has been completed.
  514. */
  515. /*
  516. * @violates @ref Mcal_h_REF_1 A function should be used in preference to a function-like macro.
  517. */
  518. #define MCAL_INSTRUCTION_SYNC_BARRIER() ASM_KEYWORD("isb":::"memory")
  519. #else
  520. /**
  521. * @brief Data Synchronization Barrier (DSB) completes when all instructions before this instruction complete
  522. */
  523. /*
  524. * @violates @ref Mcal_h_REF_1 A function should be used in preference to a function-like macro.
  525. */
  526. #define MCAL_DATA_SYNC_BARRIER() ASM_KEYWORD(" DSB")
  527. /**
  528. * @brief flushes the pipeline in the processor, so that all instructions following the ISB are fetched from cache or memory, after the ISB has been completed.
  529. */
  530. /*
  531. * @violates @ref Mcal_h_REF_1 A function should be used in preference to a function-like macro.
  532. */
  533. #define MCAL_INSTRUCTION_SYNC_BARRIER() ASM_KEYWORD(" ISB")
  534. #endif
  535. #if defined(MCAL_PLATFORM_ARM_M4) || defined(MCAL_PLATFORM_ARM_M4F)
  536. #if !defined(USING_OS_AUTOSAROS)
  537. #define EXIT_INTERRUPT() MCAL_DATA_SYNC_BARRIER() /* DSB sy full system */
  538. #else
  539. #define EXIT_INTERRUPT()
  540. #endif /* !defined(USING_OS_AUTOSAROS) */
  541. #else
  542. #define EXIT_INTERRUPT()
  543. #endif
  544. /*==================================================================================================
  545. * ENUMS
  546. ==================================================================================================*/
  547. /*==================================================================================================
  548. * STRUCTURES AND OTHER TYPEDEFS
  549. ==================================================================================================*/
  550. /**
  551. * @brief Typedef for DEM error management implemented by MCAL drivers
  552. */
  553. typedef struct
  554. {
  555. uint32 state; /**< enabling/disabling the DEM error: Active=STD_ON/ Inactive=STD_OFF */
  556. uint32 id ; /**< ID of DEM error (0 if STD_OFF)*/
  557. }Mcal_DemErrorType;
  558. /*==================================================================================================
  559. * GLOBAL VARIABLE DECLARATIONS
  560. ==================================================================================================*/
  561. /*==================================================================================================
  562. * FUNCTION PROTOTYPES
  563. ==================================================================================================*/
  564. #ifdef __cplusplus
  565. }
  566. #endif
  567. #endif /* #ifndef MCAL_H */
  568. /** @} */