/**
*   @file    Lin_Cfg.c
*   @implements Lin_Cfg.c_Artifact
*   @version 1.0.0
*
*   @brief   AUTOSAR Lin - Brief file description (one line).
*   @details Detailed file description (can be multiple lines).
*
*   @addtogroup LIN
*   @{
*/
/*==================================================================================================
*   Project              : AUTOSAR 4.3 MCAL
*   Platform             : PA
*   Peripheral           : ESCI
*   Dependencies         : 
*
*   Autosar Version      : 4.3.1
*   Autosar Revision     : ASR_REL_4_3_REV_0001
*   Autosar Conf.Variant :
*   SW Version           : 1.0.0
*   Build Version        : MPC5777C_MCAL_1_0_0_RTM_ASR_REL_4_3_REV_0001_20190315
*
*   (c) Copyright 2006-2016 Freescale Semiconductor, Inc. 
*       Copyright 2017-2019 NXP
*   All Rights Reserved.
==================================================================================================*/
/*==================================================================================================
==================================================================================================*/

#ifdef __cplusplus
extern "C"
{
#endif

/**
* @page misra_violations MISRA-C:2012 violations
*
* @section [global]
* Violates MISRA 2012 Required Rule 5.1, External identifiers shall be distinct.
* The used compilers use more than 31 chars for identifiers.
*
* @section [global]
* Violates MISRA 2012 Required Rule 5.2, Identifiers declared in the same scope and name space shall be distinct.
* The used compilers use more than 31 chars for identifiers.
*
* @section [global]
* Violates MISRA 2012 Required Rule 5.4, Macro identifiers shall be distinct.
* The used compilers use more than 31 chars for identifiers.
*
* @section [global]
* Violates MISRA 2012 Required Rule 5.5, Identifiers shall be distinct from macro names.
* The used compilers use more than 31 chars for identifiers.
*
* @section Lin_Cfg_c_REF_1
* Violates MISRA 2012 Advisory Rule 20.1, #include directives should only be preceded by preprocessor directives or comments.
* <MA>_MemMap.h is included after each section define in order to set the current memory section as defined by AUTOSAR.
*
* @section Lin_Cfg_c_REF_2
* Violates MISRA 2012 Required Directive 4.10, Precautions shall be taken in order to prevent the contents of a header
* file being included more than once.
* This violation is not fixed since the inclusion of <MA>_MemMap.h is as per AUTOSAR requirement [SWS_MemMap_00003].
*/


/*==================================================================================================
*                                        INCLUDE FILES
* 1) system and project includes
* 2) needed interfaces from external units
* 3) internal and external interfaces from this unit
==================================================================================================*/
#include "Std_Types.h"
#include "Lin.h"

#if (LIN_DISABLE_DEM_REPORT_ERROR_STATUS == STD_OFF)
#include "Dem.h"
#endif /* (LIN_DISABLE_DEM_REPORT_ERROR_STATUS == STD_OFF) */

/*==================================================================================================
*                              SOURCE FILE VERSION INFORMATION
==================================================================================================*/
/**
* @file           Lin_Cfg.c
*/
#define LIN_VENDOR_ID_CFG_C                      43
#define LIN_AR_RELEASE_MAJOR_VERSION_CFG_C       4
#define LIN_AR_RELEASE_MINOR_VERSION_CFG_C       3
#define LIN_AR_RELEASE_REVISION_VERSION_CFG_C    1
#define LIN_SW_MAJOR_VERSION_CFG_C               1
#define LIN_SW_MINOR_VERSION_CFG_C               0
#define LIN_SW_PATCH_VERSION_CFG_C               0

/*==================================================================================================
*                                     FILE VERSION CHECKS
==================================================================================================*/
[!NOCODE!][!//
[!INCLUDE "Lin_VersionCheck_Src.m"!][!//
[!ENDNOCODE!][!//
/* Check if current file and Lin.h header file are of the same Autosar version */
#if (LIN_VENDOR_ID_CFG_C != LIN_VENDOR_ID)
    #error "Lin_Cfg.c and Lin.h have different vendor ids"
#endif
#if ((LIN_AR_RELEASE_MAJOR_VERSION_CFG_C    != LIN_AR_RELEASE_MAJOR_VERSION) || \
     (LIN_AR_RELEASE_MINOR_VERSION_CFG_C    != LIN_AR_RELEASE_MINOR_VERSION) || \
     (LIN_AR_RELEASE_REVISION_VERSION_CFG_C != LIN_AR_RELEASE_REVISION_VERSION))
  #error "AutoSar Version Numbers of Lin_Cfg.c and Lin.h are different"
#endif
/* Check if current file and Lin.h header file are of the same Software version */
#if ((LIN_SW_MAJOR_VERSION_CFG_C != LIN_SW_MAJOR_VERSION) || \
     (LIN_SW_MINOR_VERSION_CFG_C != LIN_SW_MINOR_VERSION) || \
     (LIN_SW_PATCH_VERSION_CFG_C != LIN_SW_PATCH_VERSION) )
  #error "Software Version Numbers of Lin_Cfg.c and Lin.h are different"
#endif

#ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
  #if ((LIN_AR_RELEASE_MAJOR_VERSION_CFG_C != STD_AR_RELEASE_MAJOR_VERSION) || \
       (LIN_AR_RELEASE_MINOR_VERSION_CFG_C != STD_AR_RELEASE_MINOR_VERSION))
    #error "AutoSar Version Numbers of Lin_Cfg.c and Std_Types.h are different"
  #endif
  #if (LIN_DISABLE_DEM_REPORT_ERROR_STATUS == STD_OFF)
    /* Check if current file and Dem.h header file are of the same Autosar version */
    #if ((LIN_AR_RELEASE_MAJOR_VERSION_CFG_C != DEM_AR_RELEASE_MAJOR_VERSION) || \
         (LIN_AR_RELEASE_MINOR_VERSION_CFG_C != DEM_AR_RELEASE_MINOR_VERSION))
        #error "AutoSar Version Numbers of Lin_Cfg.c and Dem.h are different"
    #endif
  #endif /* (LIN_DISABLE_DEM_REPORT_ERROR_STATUS == STD_OFF) */
#endif

/*==================================================================================================
*                          LOCAL TYPEDEFS (STRUCTURES, UNIONS, ENUMS)
==================================================================================================*/


/*==================================================================================================
*                                       LOCAL MACROS
==================================================================================================*/


/*==================================================================================================
*                                      LOCAL CONSTANTS
==================================================================================================*/


/*==================================================================================================
*                                      LOCAL VARIABLES
==================================================================================================*/


/*==================================================================================================
*                                      GLOBAL CONSTANTS
==================================================================================================*/
#define LIN_START_SEC_CONFIG_DATA_UNSPECIFIED
/**
* @violates @ref Lin_Cfg_c_REF_1 <MA>_MemMap.h is included after each section define in order to
                 set the current memory section as defined by AUTOSAR.
* @violates @ref Lin_Cfg_c_REF_2 This violation is not fixed since the inclusion of <MA>_MemMap.h
                 is as per AUTOSAR requirement [SWS_MemMap_00003].
*/

#include "Lin_MemMap.h"

[!NOCODE!][!//
[!LOOP "LinGlobalConfig/LinChannel/*"!][!//
    [!VAR "nodeName" = "name(.)"!]
    [!CODE!]
/**
* @brief          Configuration for Lin Channel - Configuration:
*
*
* @api
*/
CONST(Lin_StaticConfig_ChannelConfigType,LIN_CONST) Lin_[!"node:name(.)"!]_PC=
{
(uint8)[!"LinChannelId"!]U,     /* Lin Channel ID */
[!NOCODE!]
[!VAR "HardwareChannel" = "substring-after(LinHwChannel,'_')"!]
[!ENDNOCODE!]
    LinHWCh_[!"$HardwareChannel"!],            /* Lin Hardware channel*/
    [!IF "LinChannelWakeupSupport"!]
    (uint8)STD_ON,                 /* Wakeup support enabled */
    [!ELSE!]
    (uint8)STD_OFF,                /* Wakeup support disabled */
    [!ENDIF!]
    (EcuM_WakeupSourceType)((uint32)1U<<(uint32)[!"as:ref(LinChannelEcuMWakeupSource)/EcuMWakeupSourceId"!]U), /* Wakeup Source transmitted to the Ecu State Manager (used only when Wakeup Support is true) */
};
[!ENDCODE!]
[!ENDLOOP!][!//

[!CODE!]
#if (STD_OFF == LIN_DISABLE_DEM_REPORT_ERROR_STATUS)
/**
 * @brief   DEM error parameters
 */
CONST(Mcal_DemErrorType,LIN_CONST) Lin_E_TimeoutCfg =
{
[!ENDCODE!]

[!VAR "LinDemErrorEnable" = "'false'"!]
[!IF "AutosarExt/LinDisableDemReportErrorStatus ='false'"!][!//
    [!IF "node:exists(LinDemEventParameterRefs)"!]
        [!VAR "LinDemErrorEnable" = "'true'"!]
    [!ENDIF!]
[!ENDIF!]

[!IF "$LinDemErrorEnable"!]
    [!IF "node:exists(LinDemEventParameterRefs/LIN_E_TIMEOUT)"!]
        [!IF "node:exists(node:value(LinDemEventParameterRefs/LIN_E_TIMEOUT))"!]
            [!CODE!]
    (uint32)STD_ON,
    DemConf_DemEventParameter_[!"node:name(node:ref(LinDemEventParameterRefs/LIN_E_TIMEOUT))"!]
            [!ENDCODE!]
        [!ELSE!]
            [!ERROR "Invalid reference for LIN_E_ERROR"!]
        [!ENDIF!]
    [!ELSE!]
        [!CODE!]
    (uint32)STD_OFF,
    0U
        [!ENDCODE!]
    [!ENDIF!]
[!ELSE!]
    [!CODE!]
    (uint32)STD_OFF,
    0U
    [!ENDCODE!]
[!ENDIF!]

[!CODE!]
};
#endif /* STD_OFF == LIN_DISABLE_DEM_REPORT_ERROR_STATUS */
[!ENDCODE!]
[!ENDNOCODE!][!//

#define LIN_STOP_SEC_CONST_UNSPECIFIED
/**
* @violates @ref Lin_Cfg_c_REF_1 <MA>_MemMap.h is included after each section define in order to
                 set the current memory section as defined by AUTOSAR.
* @violates @ref Lin_Cfg_c_REF_2 This violation is not fixed since the inclusion of <MA>_MemMap.h
                 is as per AUTOSAR requirement [SWS_MemMap_00003].
*/
#include "Lin_MemMap.h"

/*==================================================================================================
*                                      GLOBAL VARIABLES
==================================================================================================*/

/*==================================================================================================
*                                   LOCAL FUNCTION PROTOTYPES
==================================================================================================*/


/*==================================================================================================
*                                       LOCAL FUNCTIONS
==================================================================================================*/
#define LIN_START_SEC_CODE
/**
* @violates @ref Lin_Cfg_c_REF_1 <MA>_MemMap.h is included after each section define in order to
                 set the current memory section as defined by AUTOSAR.
* @violates @ref Lin_Cfg_c_REF_2 This violation is not fixed since the inclusion of <MA>_MemMap.h
                 is as per AUTOSAR requirement [SWS_MemMap_00003].
*/
#include "Lin_MemMap.h"

/*==================================================================================================
*                                       GLOBAL FUNCTIONS
==================================================================================================*/

#define LIN_STOP_SEC_CODE
/**
* @violates @ref Lin_Cfg_c_REF_1 <MA>_MemMap.h is included after each section define in order to
                 set the current memory section as defined by AUTOSAR.
* @violates @ref Lin_Cfg_c_REF_2 This violation is not fixed since the inclusion of <MA>_MemMap.h
                 is as per AUTOSAR requirement [SWS_MemMap_00003].
*/
#include "Lin_MemMap.h"

#ifdef __cplusplus
}
#endif

/** @} */
