123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624 |
- #ifndef MCAL_H
- #define MCAL_H
- #ifdef __cplusplus
- extern "C"{
- #endif
- #include "Compiler.h"
- #include "StandardTypes.h"
- #include "Soc_Ips.h"
- #include "Reg_eSys.h"
- #include "OsIf_Internal.h"
- #define MCAL_VENDOR_ID 43
- #define MCAL_MODULE_ID 0
- #define MCAL_AR_RELEASE_MAJOR_VERSION 4
- #define MCAL_AR_RELEASE_MINOR_VERSION 4
- #define MCAL_AR_RELEASE_REVISION_VERSION 0
- #define MCAL_SW_MAJOR_VERSION 1
- #define MCAL_SW_MINOR_VERSION 0
- #define MCAL_SW_PATCH_VERSION 0
- #ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
-
- #if ((MCAL_AR_RELEASE_MAJOR_VERSION != COMPILER_AR_RELEASE_MAJOR_VERSION) || \
- (MCAL_AR_RELEASE_MINOR_VERSION != COMPILER_AR_RELEASE_MINOR_VERSION))
- #error "AutoSar Version Numbers of Mcal.h and Compiler.h are different"
- #endif
- #endif
- #ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
-
- #if ((MCAL_AR_RELEASE_MAJOR_VERSION != STD_AR_RELEASE_MAJOR_VERSION) || \
- (MCAL_AR_RELEASE_MINOR_VERSION != STD_AR_RELEASE_MINOR_VERSION))
- #error "AutoSar Version Numbers of Mcal.h and StandardTypes.h are different"
- #endif
- #endif
- #ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
-
- #if ((MCAL_AR_RELEASE_MAJOR_VERSION != REG_ESYS_AR_RELEASE_MAJOR_VERSION) || \
- (MCAL_AR_RELEASE_MINOR_VERSION != REG_ESYS_AR_RELEASE_MINOR_VERSION))
- #error "AutoSar Version Numbers of Mcal.h and Reg_eSys.h are different"
- #endif
- #endif
- #if (MCAL_VENDOR_ID != SOC_IPS_VENDOR_ID)
- #error "Soc_Ips.h and Mcal.h have different vendor IDs"
- #endif
- #if ((MCAL_AR_RELEASE_MAJOR_VERSION != SOC_IPS_AR_RELEASE_MAJOR_VERSION) || \
- (MCAL_AR_RELEASE_MINOR_VERSION != SOC_IPS_AR_RELEASE_MINOR_VERSION))
- #error "AutoSar Version Numbers of Mcal.h and Soc_Ips.h are different"
- #endif
- #if ((MCAL_SW_MAJOR_VERSION != SOC_IPS_SW_MAJOR_VERSION) || \
- (MCAL_SW_MINOR_VERSION != SOC_IPS_SW_MINOR_VERSION) || \
- (MCAL_SW_PATCH_VERSION != SOC_IPS_SW_PATCH_VERSION))
- #error "Software Version Numbers of Soc_Ips.h and Mcal.h are different"
- #endif
-
- #ifdef _GREENHILLS_C_S32K1XX_
-
-
- #define ASM_KEYWORD __asm
-
-
- #define EXECUTE_WAIT() \
- do \
- { \
- OsIf_ResumeAllInterrupts()
- ASM_KEYWORD(" wfi")
- OsIf_SuspendAllInterrupts()
- } while (0)
-
-
- #define ALIGNED_VARS_START(sec_name, align)
-
-
- #define VAR_ALIGN(v, size) __attribute__(( aligned(size) )) v;
-
-
- #define ALIGNED_VARS_STOP()
-
-
- #define PACKED __packed
-
- #ifdef MCAL_ENABLE_FAULT_INJECTION
-
- #define MCAL_PUT_IN_QUOTES(x) #x
-
- #define MCAL_FAULT_INJECTION_POINT(label) ASM_KEYWORD(MCAL_PUT_IN_QUOTES(label::))
- #else
-
- #define MCAL_FAULT_INJECTION_POINT(label)
- #endif
-
- #endif
- #ifdef _DIABDATA_C_S32K1XX_
-
- #define ASM_KEYWORD __asm volatile
-
-
- #define EXECUTE_WAIT() \
- do \
- { \
- OsIf_ResumeAllInterrupts()
- ASM_KEYWORD(" wfi")
- OsIf_SuspendAllInterrupts()
- } while (0)
-
-
- #define ALIGNED_VARS_START(sec_name, align)
-
-
- #define VAR_ALIGN(v, size) __attribute__(( aligned(size) )) v;
-
-
- #define ALIGNED_VARS_STOP()
-
-
- #define PACKED __attribute__((packed))
-
-
- #ifdef MCAL_ENABLE_FAULT_INJECTION
-
- #define MCAL_PUT_IN_QUOTES(x) #x
-
- #define MCAL_FAULT_INJECTION_POINT(label) ASM_KEYWORD(MCAL_PUT_IN_QUOTES(label:))
- #else
-
- #define MCAL_FAULT_INJECTION_POINT(label)
- #endif
- #endif
- #ifdef _CODEWARRIOR_C_S32K1XX_
-
- #define ASM_KEYWORD asm
-
-
- #define EXECUTE_WAIT() \
- do \
- { \
- OsIf_ResumeAllInterrupts()
- ASM_KEYWORD (" opword 0x7C00007C")
- OsIf_SuspendAllInterrupts()
- } while (0)
-
-
- #define ALIGNED_VARS_START(sec_name, align)
-
-
- #define VAR_ALIGN(v, size) v __attribute__(( aligned(size) ));
-
-
- #define ALIGNED_VARS_STOP()
-
-
- #define PACKED __packed
- #endif
- #ifdef _COSMIC_C_S32K1XX_
-
- #define ASM_KEYWORD _asm
-
-
- #define ASM_PUBLIC_LABEL(label) _asm("\txdef\t" #label "\n" #label ":")
-
-
- #define EXECUTE_WAIT() \
- do \
- { \
- OsIf_ResumeAllInterrupts()
- ASM_KEYWORD (" dc.l 0x7C00007C")
- OsIf_SuspendAllInterrupts()
- } while (0)
-
- #define ALIGNED_VARS_START(sec_name, align) \#pragma section [sec_name ## align]
-
- #define VAR_ALIGN(v, size) v;
-
- #define ALIGNED_VARS_STOP() \#pragma section []
- #endif
- #ifdef _HITECH_C_S32K1XX_
-
- #define ASM_KEYWORD __asm
-
-
- #define EXECUTE_WAIT() \
- do \
- { \
- OsIf_ResumeAllInterrupts()
- ASM_KEYWORD(" wait")
- OsIf_SuspendAllInterrupts()
- } while (0)
-
-
- #define ALIGNED_VARS_START(sec_name, align)
-
-
- #define VAR_ALIGN(v, size) __attribute__(( aligned(size) )) v;
-
-
- #define ALIGNED_VARS_STOP()
- #endif
- #ifdef _LINARO_C_S32K1XX_
-
-
- #define ASM_KEYWORD __asm
-
-
- #define EXECUTE_WAIT() \
- do \
- { \
- OsIf_ResumeAllInterrupts()
- ASM_KEYWORD(" wfi")
- OsIf_SuspendAllInterrupts()
- } while (0)
-
-
- #define ALIGNED_VARS_START(sec_name, align)
-
-
- #define VAR_ALIGN(v, size) __attribute__(( aligned(size) )) v;
-
-
- #define ALIGNED_VARS_STOP()
-
-
- #define PACKED __attribute__((__packed__))
-
-
- #ifdef MCAL_ENABLE_FAULT_INJECTION
-
- #define MCAL_PUT_IN_QUOTES(x) #x
-
- #define MCAL_FAULT_INJECTION_POINT(label) ASM_KEYWORD(MCAL_PUT_IN_QUOTES(label:))
- #else
-
- #define MCAL_FAULT_INJECTION_POINT(label)
- #endif
-
- #endif
- #ifdef _ARM_DS5_C_S32K1XX_
-
-
- #define ASM_KEYWORD __asm
-
-
- #define EXECUTE_WAIT() \
- do \
- { \
- OsIf_ResumeAllInterrupts()
- ASM_KEYWORD(" wfi")
- OsIf_SuspendAllInterrupts()
- } while (0)
-
-
- #define ALIGNED_VARS_START(sec_name, align)
-
-
- #define VAR_ALIGN(v, size) __align(size) v;
-
-
- #define ALIGNED_VARS_STOP()
-
- #define PACKED __packed
-
-
- #ifdef MCAL_ENABLE_FAULT_INJECTION
-
- #define MCAL_PUT_IN_QUOTES(x) #x
-
- #define MCAL_FAULT_INJECTION_POINT(label) ASM_KEYWORD(MCAL_PUT_IN_QUOTES(label:))
- #else
-
- #define MCAL_FAULT_INJECTION_POINT(label)
- #endif
-
- #endif
- #ifdef _IAR_C_S32K1XX_
-
-
-
- #define MCAL_PUT_IN_QUOTES(x) #x
-
-
- #define MCAL_PUT_IN_QUOTES1(x) MCAL_PUT_IN_QUOTES(x)
-
-
- #define ASM_KEYWORD __asm
-
-
- #define EXECUTE_WAIT() \
- do \
- { \
- OsIf_ResumeAllInterrupts()
- ASM_KEYWORD(" wfi")
- OsIf_SuspendAllInterrupts()
- } while (0)
-
-
- #define ALIGNED_VARS_START(sec_name, align)
-
-
- #define VAR_ALIGN(v, size) _Pragma(MCAL_PUT_IN_QUOTES1(data_alignment=size)) \
- v
-
-
- #define ALIGNED_VARS_STOP()
-
-
-
- #define PACKED __packed
-
-
- #ifdef MCAL_ENABLE_FAULT_INJECTION
-
- #define MCAL_FAULT_INJECTION_POINT(label) ASM_KEYWORD(MCAL_PUT_IN_QUOTES(label:))
- #else
-
- #define MCAL_FAULT_INJECTION_POINT(label)
- #endif
-
- #endif
- #ifndef _GREENHILLS_C_S32K1XX_
- #ifndef _DIABDATA_C_S32K1XX_
- #ifndef _CODEWARRIOR_C_S32K1XX_
- #ifndef _COSMIC_C_S32K1XX_
- #ifndef _HITECH_C_S32K1XX_
- #ifndef _LINARO_C_S32K1XX_
- #ifndef _ARM_DS5_C_S32K1XX_
- #ifndef _IAR_C_S32K1XX_
- #error "Unsupported compiler. Compiler abstraction needs to be updated to use this compiler."
- #endif
- #endif
- #endif
- #endif
- #endif
- #endif
- #endif
- #endif
- #if (MCAL_PLATFORM_ARM == MCAL_ARM_AARCH64)
- #define MCAL_DATA_SYNC_BARRIER() ASM_KEYWORD("dsb sy":::"memory")
- #define MCAL_INSTRUCTION_SYNC_BARRIER() ASM_KEYWORD("isb":::"memory")
- #else
- #define MCAL_DATA_SYNC_BARRIER() ASM_KEYWORD(" DSB")
- #define MCAL_INSTRUCTION_SYNC_BARRIER() ASM_KEYWORD(" ISB")
- #endif
- #if defined(MCAL_PLATFORM_ARM_M4) || defined(MCAL_PLATFORM_ARM_M4F)
- #if !defined(USING_OS_AUTOSAROS)
- #define EXIT_INTERRUPT() MCAL_DATA_SYNC_BARRIER()
- #else
- #define EXIT_INTERRUPT()
- #endif
- #else
- #define EXIT_INTERRUPT()
- #endif
- typedef struct
- {
- uint32 state
- uint32 id
- }Mcal_DemErrorType
- #ifdef __cplusplus
- }
- #endif
- #endif
|