#ifndef COMPILER_H #define COMPILER_H /** \brief AUTOSAR compiler abstraction header ** ** This file contains compiler specific declarations for the ** platform using the compiler GHS for ARM architectures ** ** See "Specification of Compiler Abstraction" ** ** Do not edit this file manually. ** Any change might compromise the safety integrity level of ** the software partition it is contained in. ** ** Product: SW-MCAL42-DRV ** ** (c) 2017-2018, Cypress Semiconductor Corporation. All rights reserved. ** ** Warranty and Disclaimer ** ** This software product is property of Cypress Semiconductor Corporation or ** its subsidiaries. ** Any use and/or distribution rights for this software product are provided ** only under the Cypress Software License Agreement. ** Any use and/or distribution of this software product not in accordance with ** the terms of the Cypress Software License Agreement are unauthorized and ** shall constitute an infringement of Cypress intellectual property rights. */ /*==================[inclusions]=============================================*/ #include /* module specific memory and pointer classes */ /*==================[macros]=================================================*/ /*------------------[Autosar compiler vendor idenfitication]-----------------*/ #if (defined COMPILER_VENDOR_ID) /* to prevent double definition */ #error COMPILER_VENDOR_ID already defined #endif /* if (defined COMPILER_VENDOR_ID) */ /** \brief Vendor ID of the dedicated implementation of this module */ #define COMPILER_VENDOR_ID 66U /* Cypress */ /*------------------[Autosar specification version]--------------------------*/ #if (defined COMPILER_AR_RELEASE_MAJOR_VERSION) /* to prevent double definition */ #error COMPILER_AR_RELEASE_MAJOR_VERSION already defined #endif /* if (defined COMPILER_AR_RELEASE_MAJOR_VERSION) */ #define COMPILER_AR_RELEASE_MAJOR_VERSION 4U /** \brief major version number */ #if (defined COMPILER_AR_RELEASE_MINOR_VERSION) /* to prevent double definition */ #error COMPILER_AR_RELEASE_MINOR_VERSION already defined #endif /* if (defined COMPILER_AR_RELEASE_MINOR_VERSION) */ #define COMPILER_AR_RELEASE_MINOR_VERSION 2U /** \brief minor version number */ #if (defined COMPILER_AR_RELEASE_REVISION_VERSION) /* to prevent double definition */ #error COMPILER_AR_RELEASE_REVISION_VERSION already defined #endif /* if (defined COMPILER_AR_RELEASE_REVISION_VERSION) */ #define COMPILER_AR_RELEASE_REVISION_VERSION 2U /** \brief patch version number */ #if (defined COMPILER_MODULE_ID) /* to prevent double definition */ #error COMPILER_MODULE_ID already defined #endif /* if (defined COMPILER_MODULE_ID) */ #define COMPILER_MODULE_ID 198U /** \brief Defines the module IDr */ /*------------------[Autosar module software version]------------------------*/ #if (defined COMPILER_SW_MAJOR_VERSION) /* to prevent double definition */ #error COMPILER_SW_MAJOR_VERSION already defined #endif /* if (defined COMPILER_SW_MAJOR_VERSION) */ #define COMPILER_SW_MAJOR_VERSION 1U /** \brief major version number */ #if (defined COMPILER_SW_MINOR_VERSION) /* to prevent double definition */ #error COMPILER_SW_MINOR_VERSION already defined #endif /* if (defined COMPILER_SW_MINOR_VERSION) */ #define COMPILER_SW_MINOR_VERSION 1U /** \brief minor version number */ #if (defined COMPILER_SW_PATCH_VERSION) /* to prevent double definition */ #error COMPILER_SW_PATCH_VERSION already defined #endif /* if (defined COMPILER_SW_PATCH_VERSION) */ #define COMPILER_SW_PATCH_VERSION 0U /** \brief patch version number */ /*------------------[compiler symbol]----------------------------------------*/ #if (defined _GREENHILLS_C_MXS40_) /* to prevent double definition */ #error _GREENHILLS_C_MXS40_ already defined #endif /* if (defined _GREENHILLS_C_MXS40_) */ /** \brief compiler symbol for GHS Compiler for MXS40 */ /* Deviation from MISRA-C:2004 rule 1.2, 20.2 and QA-C message 602. Justification: Naming convention is required by AUTOSAR specification. */ /* PRQA S 602 1 */ #define _GREENHILLS_C_MXS40_ 1U /*------------------[storage classes]----------------------------------------*/ #define STATIC static #if (defined AUTOMATIC) /* to prevent double definition */ #error AUTOMATIC already defined #endif /* if (defined AUTOMATIC) */ /** \brief definition of an automatic memory class ** ** To be used for local non static variables */ #define AUTOMATIC #if (defined INLINE) /* to prevent double definition */ #error INLINE already defined #endif /* if (defined INLINE) */ /** \brief abstraction of compiler keyword 'inline' ** ** values: 'inline' or empty */ #define INLINE __inline #if (defined LOCAL_INLINE) /* to prevent double definition */ #error LOCAL_INLINE already defined #endif /* if (defined LOCAL_INLINE) */ /** \brief Definition of an inline keyword with "static" scope */ #define LOCAL_INLINE static __inline #define OS_INLINE static inline #if (defined TYPEDEF) /* to prevent double definition */ #error TYPEDEF already defined #endif /* if (defined TYPEDEF) */ /** \brief definition of TYPEDEF ** ** values: empty */ #define TYPEDEF #if (defined NEAR) /* to prevent double definition */ #error NEAR already defined #endif /* if (defined NEAR) */ /** \brief definition of an near memory class ** ** To be used for near addresses */ #define NEAR #if (defined FAR) /* to prevent double definition */ #error FAR already defined #endif /* if (defined FAR) */ /** \brief definition of an far memory class ** ** To be used for far addresses */ #define FAR /*------------------[null pointer constant]----------------------------------*/ #if (defined NULL_PTR) /* to prevent double definition */ #error NULL_PTR already defined #endif /* if (defined NULL_PTR) */ /** \brief abstraction of the null pointer constant */ #if (defined(__cplusplus)) #if(__cplusplus >= 201100) #define NULL_PTR nullptr #else #define NULL_PTR ((void) 0U) #endif #else #define NULL_PTR ((void*) 0U) #endif /*------------------[macros for functions]-----------------------------------*/ #if (defined FUNC) /* to prevent double definition */ #error FUNC already defined #endif /* if (defined FUNC) */ /** \brief abstraction for function declaration and definition ** ** This macro abstracts the declaration and definition of functions ** and ensures the correct syntax of function declaration as ** required by the specific compiler. ** ** \param[in] rettype return type of the function ** \param[in] memclass classification of the function itself */ /* Deviation from MISRA-C:2004 rule 19.10, 19.7 and QA-C message 3410, 3453. Justification: Macro definition by the AUTOSAR specification. */ /* PRQA S 3410, 3453 1 */ #define FUNC(rettype, memclass) rettype #if (defined ISR_NATIVE) /* to prevent double definition */ #error ISR_NATIVE already defined #endif /* if (defined ISR_NATIVE) */ /* Deviation from MISRA-C:2004 rule 19.7 and QA-C message 3453. Justification: Use the same style with ISR macro defined by the AUTOSAR specification. */ /* PRQA S 3453 1 */ #define _INTERRUPT_ #define ISR_NATIVE(x) void x(void) #if (defined FUNC_P2CONST) /* to prevent double definition */ #error FUNC_P2CONST already defined #endif /* if (defined FUNC_P2CONST) */ /** \brief abstraction for function declaration and definition ** ** This macro abstracts the declaration and definition of functions ** and ensures the correct syntax of function declaration as ** required by the specific compiler. ** ** \param[in] rettype return type of the function ** \param[in] ptrclass classification of the pointer distance ** \param[in] memclass classification of the function itself */ /* Deviation from MISRA-C:2004 rule 19.10, 19.4, 19.7 and QA-C message 3410, 3409, 3453. Justification: Macro definition by the AUTOSAR specification. */ /* PRQA S 3410, 3409, 3453 1 */ #define FUNC_P2CONST(rettype, ptrclass, memclass) const ptrclass rettype * #if (defined FUNC_P2VAR) /* to prevent double definition */ #error FUNC_P2VAR already defined #endif /* if (defined FUNC_P2VAR) */ /** \brief abstraction for function declaration and definition ** ** This macro abstracts the declaration and definition of functions a pointer ** to a variable and ensures the correct syntax of function declaration as ** required by the specific compiler. ** ** \param[in] rettype return type of the function ** \param[in] ptrclass defines the classification of the pointer's distance ** \param[in] memclass classification of the function itself */ /* Deviation from MISRA-C:2004 rule 19.10, 19.4, 19.7 and QA-C message 3410, 3409, 3453. Justification: Macro definition by the AUTOSAR specification. */ /* PRQA S 3410, 3409, 3453 1 */ #define FUNC_P2VAR(rettype, ptrclass, memclass) ptrclass rettype * /*------------------[macros for pointers]------------------------------------*/ #if (defined P2VAR) /* to prevent double definition */ #error P2VAR already defined #endif /* if (defined P2VAR) */ /** \brief abstraction for pointers in RAM pointing to RAM ** ** This macro abstracts the declaration and definition of pointers ** in RAM pointing to variables in RAM. ** ** The pointer itself is modifiable. ** The pointer's target is modifiable. ** ** \param[in] ptrtype type of the referenced variable ** \param[in] memclass classification of the pointer's variable itself ** \param[in] defines the classification of the pointer's distance */ /* Deviation from MISRA-C:2004 rule 19.10, 19.4, 19.7 and QA-C message 3410, 3409, 3453. Justification: Macro definition by the AUTOSAR specification. */ /* PRQA S 3410, 3409, 3453 1 */ #define P2VAR(ptrtype, memclass, ptrclass) ptrtype * #if (defined P2CONST) /* to prevent double definition */ #error P2CONST already defined #endif /* if (defined P2CONST) */ /** \brief abstraction for pointers in RAM pointing to ROM ** ** This macro abstracts the declaration and definition of pointers ** in RAM pointing to constants in ROM. ** ** The pointer itself is modifiable. ** The pointer's target is not modifiable (read only). ** ** \param[in] ptrtype type of the referenced constant ** \param[in] memclass classification of the pointer's variable itself ** \param[in] defines the classification of the pointer's distance */ /* Deviation from MISRA-C:2004 rule 19.10, 19.4, 19.7 and QA-C message 3410, 3409, 3453. Justification: Macro definition by the AUTOSAR specification. */ /* PRQA S 3410, 3409, 3453 1 */ #define P2CONST(ptrtype, memclass, ptrclass) const ptrtype * #if (defined CONSTP2VAR) /* to prevent double definition */ #error CONSTP2VAR already defined #endif /* if (defined CONSTP2VAR) */ /** \brief abstraction for pointers in ROM pointing to RAM ** ** This macro abstracts the declaration and definition of pointers ** in ROM pointing to variables in RAM. ** ** The pointer is not modifiable. (read only). ** The pointer's target is modifiable. ** ** \param[in] ptrtype type of the referenced variable ** \param[in] memclass classification of the pointer's variable itself ** \param[in] defines the classification of the pointer's distance */ /* Deviation from MISRA-C:2004 rule 19.10, 19.4, 19.7 and QA-C message 3410, 3409, 3453. Justification: Macro definition by the AUTOSAR specification. */ /* PRQA S 3410, 3409, 3453 1 */ #define CONSTP2VAR(ptrtype, memclass, ptrclass) ptrtype * const #if (defined CONSTP2CONST) /* to prevent double definition */ #error CONSTP2CONST already defined #endif /* if (defined CONSTP2CONST) */ /** \brief abstraction for pointers in ROM pointing to ROM ** ** This macro abstracts the declaration and definition of pointers ** in ROM pointing to constants in ROM. ** ** The pointer itself is not modifiable (read only). ** The pointer's target is not modifiable (read only). ** ** \param[in] ptrtype type of the referenced constant ** \param[in] memclass classification of the pointer's variable itself ** \param[in] defines the classification of the pointer's distance */ /* Deviation from MISRA-C:2004 rule 19.10, 19.4, 19.7 and QA-C message 3410, 3409, 3453. Justification: Macro definition by the AUTOSAR specification. */ /* PRQA S 3410, 3409, 3453 1 */ #define CONSTP2CONST(ptrtype, memclass, ptrclass) const ptrtype * const #if (defined CONSTP2FUNC) /* to prevent double definition */ #error CONSTP2FUNC already defined #endif /* if (defined CONSTP2FUNC) */ /** \brief abstraction for declaration and definition of function pointers ** ** This macro abstracts the declaration and definition of constant pointers ** to functions. ** ** \param[in] rettype return type of the function ** \param[in] ptrclass defines the classification of the pointer's distance ** \param[in] function name respectively name of the defined type ** */ #ifndef STACK_ANALYSIS_ENABLE /* Deviation from MISRA-C:2004 rule 19.10, 19.7 and QA-C message 3410, 3453. Justification: Macro definition by the AUTOSAR specification. */ /* PRQA S 3410, 3453 1 */ #define CONSTP2FUNC(rettype, ptrclass, fctname) rettype (* const fctname) #else /* Deviation from MISRA-C:2004 rule 19.10, 19.7 and QA-C message 3410, 3453. Justification: Macro definition by the AUTOSAR specification. */ /* PRQA S 3410, 3453 1 */ #define CONSTP2FUNC(rettype, ptrclass, fctname) __attribute__((strong_fptr)) rettype (* const fctname) #endif #if (defined P2FUNC) /* to prevent double definition */ #error P2FUNC already defined #endif /* if (defined P2FUNC) */ /** \brief abstraction for declaration and definition of function pointers ** ** This macro abstracts the declaration and definition of pointers ** to functions. ** ** \param[in] rettype return type of the function ** \param[in] ptrclass defines the classification of the pointer's distance ** \param[in] function name respectively name of the defined type ** */ #ifndef STACK_ANALYSIS_ENABLE /* Deviation from MISRA-C:2004 rule 19.10, 19.7 and QA-C message 3410, 3453. Justification: Macro definition by the AUTOSAR specification. */ /* PRQA S 3410, 3453 1 */ #define P2FUNC(rettype, ptrclass, fctname) rettype (* fctname) #else /* Deviation from MISRA-C:2004 rule 19.10, 19.7 and QA-C message 3410, 3453. Justification: Macro definition by the AUTOSAR specification. */ /* PRQA S 3410, 3453 1 */ #define P2FUNC(rettype, ptrclass, fctname) __attribute__((strong_fptr)) rettype (* fctname) #endif /*------------------[keywords for constants]---------------------------------*/ #if (defined CONST) /* to prevent double definition */ #error CONST already defined #endif /* if (defined CONST) */ /** \brief abstraction for declaration and definition of constants ** ** This macro abstracts the declaration and definition of constants. ** ** \param[in] consttype type of the constant ** \param[in] memclass classification of the constant itself */ /* Deviation from MISRA-C:2004 rule 19.7 and QA-C message 3453. Justification: Macro definition by the AUTOSAR specification. */ /* PRQA S 3453 1 */ #define CONST(consttype, memclass) const consttype /*------------------[keywords for variables]---------------------------------*/ #if (defined VAR) /* to prevent double definition */ #error VAR already defined #endif /* if (defined VAR) */ /** \brief abstraction for the declaration and definition of variables ** ** This macro abstracts the declaration and definition of variables. ** ** \param[in] vartype type of the variable ** \param[in] memclass classification of the variable itself */ /* Deviation from MISRA-C:2004 rule 19.10, 19.7 and QA-C message 3410, 3453. Justification: Macro definition by the AUTOSAR specification. */ /* PRQA S 3410, 3453 1 */ #define VAR(vartype, memclass) vartype #define ASM __asm #define INTERRUPT_FUNC __interrupt #ifndef UNUSED #define UNUSED(variable) ((void)variable) #endif /*==================[type definitions]=======================================*/ /*==================[external function declarations]=========================*/ /*==================[internal function declarations]=========================*/ /*==================[external constants]=====================================*/ /*==================[internal constants]=====================================*/ /*==================[external data]==========================================*/ /*==================[internal data]==========================================*/ /*==================[external function definitions]==========================*/ /*==================[internal function definitions]==========================*/ #endif /* ifndef COMPILER_H */ /*==================[end of file]============================================*/