/*!
* @file     LinIf.c
*
* @version  1.0.0
*
* @brief    AUTOSAR LinIf - LinIf module interface.
*           LinIf module interface.
* @attention
*
* Project Name      : AUTOSAR MCAL
*
* Platform          : Arm
*
* Autosar Standard  : Classic Platform 4.4.0
*
* Compiled Version  : G32A10xx_MCAL_1_0_0_01-Otc-25
*
* Copyright (C) 2026 Geehy Semiconductor
*
* You may not use this file except in compliance with the
* GEEHY COPYRIGHT NOTICE (Geehy Semiconductor Software License Agreement).
*
* The program is only for reference, which is distributed in the hope
* that it will be usefull and instructional for customers to develop
* their software. Unless required by applicable law or agreed to in
* writing, the program is distributed on an "AS IS" BASIS, WITHOUT
* ANY WARRANTY OR CONDITIONS OF ANY KIND, either express or implied.
* See the Geehy Semiconductor Software License Agreement for the governing permissions
* and limitations under the License.
*/

#ifdef __cplusplus
extern "C"{
#endif

#include "Lin.h"
#include "LinIf.h"
#include "Dem.h"
 #include "EcuM.h"
#include "LinIf_Cbk.h"
 #if (LIN_DEV_ERR_DETECT == STD_ON)
  #include "Det.h"
#endif
/** @addtogroup G32A10xx_StdPeriphDriver
  @{
*/

/** @defgroup LINIF_Driver
  * @brief LINIF driver modules
  @{
*/

/** @defgroup LINIF_Macros
  @{
*/
/*******************************************************************************
                    VENDOR ID & AUTOSAR VERSION INFO
*******************************************************************************/

#define LIN_IF_VDR_ID                         193

#define LIN_IF_RELEASE_AUTOSAR_MAJOR_VER      4
#define LIN_IF_RELEASE_AUTOSAR_MINOR_VER      4
#define LIN_IF_RELEASE_AUTOSAR_REVISION_VER   0

#define LIN_IF_SOFTWARE_MAJOR_VER             1
#define LIN_IF_SOFTWARE_MINOR_VER             0
#define LIN_IF_SOFTWARE_PATCH_VER             0
/**@} end of group LINIF_Macros */
/*******************************************************************************
                             VERSION CHECK
*******************************************************************************/
/* Make sure the vendor ids are the same between LinIf.c and LinIf.h */
#if (LIN_IF_VDR_ID != LIN_IF_H_VDR_ID)
    #error "Vendor ids mismatch between LinIf.c and LinIf.h"
#endif /* LIN_IF_VDR_ID != LIN_IF_H_VDR_ID */
/* Make sure the AUTOSAR version numbers are the same between LinIf.c and LinIf.h */
#if ((LIN_IF_RELEASE_AUTOSAR_MAJOR_VER    != LIN_IF_H_RELEASE_AUTOSAR_MAJOR_VER) || \
     (LIN_IF_RELEASE_AUTOSAR_MINOR_VER    != LIN_IF_H_RELEASE_AUTOSAR_MINOR_VER) || \
     (LIN_IF_RELEASE_AUTOSAR_REVISION_VER != LIN_IF_H_RELEASE_AUTOSAR_REVISION_VER ))
#error "AUTOSAR Version Numbers mismatch between LinIf.c and LinIf.h"
#endif /* (LIN_IF_RELEASE_AUTOSAR_MAJOR_VER    != LIN_IF_H_RELEASE_AUTOSAR_MAJOR_VER)... */
/* Make sure the software version are the same between LinIf.c and LinIf.h */
#if ((LIN_IF_SOFTWARE_MAJOR_VER != LIN_IF_H_SOFTWARE_MAJOR_VER) || \
     (LIN_IF_SOFTWARE_MINOR_VER != LIN_IF_H_SOFTWARE_MINOR_VER) || \
     (LIN_IF_SOFTWARE_PATCH_VER != LIN_IF_H_SOFTWARE_PATCH_VER))
#error "Software Version Numbers mismatch between LinIf.c and LinIf.h"
#endif /* (LIN_IF_SOFTWARE_MAJOR_VER != LIN_IF_H_SOFTWARE_MAJOR_VER)... */
/* Make sure the vendor ids are the same between LinIf.c and LinIf_Cbk.h */
#if (LIN_IF_VDR_ID != LINIF_CBK_H_VDR_ID)
    #error "Vendor ids mismatch between LinIf.c and LinIf_Cbk.h"
#endif /* LIN_IF_VDR_ID != LINIF_CBK_H_VDR_ID */
/* Make sure the AUTOSAR version numbers are the same between LinIf.c and LinIf_Cbk.h */
#if ((LIN_IF_RELEASE_AUTOSAR_MAJOR_VER    != LINIF_CBK_H_RELEASE_AUTOSAR_MAJOR_VER) || \
     (LIN_IF_RELEASE_AUTOSAR_MINOR_VER    != LINIF_CBK_H_RELEASE_AUTOSAR_MINOR_VER) || \
     (LIN_IF_RELEASE_AUTOSAR_REVISION_VER != LINIF_CBK_H_RELEASE_AUTOSAR_REVISION_VER))
#error "AUTOSAR Version Numbers mismatch between LinIf.c and LinIf_Cbk.h"
#endif /* (LIN_IF_RELEASE_AUTOSAR_MAJOR_VER    != LINIF_CBK_H_RELEASE_AUTOSAR_MAJOR_VER)... */
/* Make sure the software version are the same between LinIf.c and LinIf_Cbk.h */
#if ((LIN_IF_SOFTWARE_MAJOR_VER != LINIF_CBK_H_SOFTWARE_MAJOR_VER) || \
     (LIN_IF_SOFTWARE_MINOR_VER != LINIF_CBK_H_SOFTWARE_MINOR_VER) || \
     (LIN_IF_SOFTWARE_PATCH_VER != LINIF_CBK_H_SOFTWARE_PATCH_VER))
#error "Software Version Numbers mismatch between LinIf.c and LinIf_Cbk.h"
#endif /* (LIN_IF_SOFTWARE_MAJOR_VER != LINIF_CBK_H_SOFTWARE_MAJOR_VER)... */
#ifdef ENABLE_INTERMODULE_MCAL_CHECK
    /* Make sure the AUTOSAR version numbers are the same between LinIf.c and Lin.h */
    #if ((LIN_IF_RELEASE_AUTOSAR_MAJOR_VER != LIN_H_AR_RELEASE_MAJOR_VERSION) || \
         (LIN_IF_RELEASE_AUTOSAR_MINOR_VER != LIN_H_AR_RELEASE_MINOR_VERSION))
        #error "AUTOSAR Version Numbers mismatch between LinIf.c and Lin.h"
    #endif /* (LIN_IF_RELEASE_AUTOSAR_MAJOR_VER != LIN_H_AR_RELEASE_MAJOR_VERSION)... */
    /* Make sure the AUTOSAR version numbers are the same between LinIf.c and Dem.h */
    #if ((LIN_IF_RELEASE_AUTOSAR_MAJOR_VER != DEM_H_AR_RELEASE_MAJOR_VERSION) || \
         (LIN_IF_RELEASE_AUTOSAR_MINOR_VER != DEM_H_AR_RELEASE_MINOR_VERSION))
        #error "AUTOSAR Version Numbers mismatch between LinIf.c and Dem.h"
    #endif /* (LIN_IF_RELEASE_AUTOSAR_MAJOR_VER != DEM_H_AR_RELEASE_MAJOR_VERSION)... */
    #if (LIN_DEV_ERR_DETECT == STD_ON)
        /* Make sure the AUTOSAR version numbers are the same between LinIf.c and Det.h */
        #if ((LIN_IF_RELEASE_AUTOSAR_MAJOR_VER != DET_H_AR_RELEASE_MAJOR_VERSION) || \
             (LIN_IF_RELEASE_AUTOSAR_MINOR_VER != DET_H_AR_RELEASE_MINOR_VERSION))
            #error "AUTOSAR Version Numbers mismatch between LinIf.c and Det.h"
        #endif /* (LIN_IF_RELEASE_AUTOSAR_MAJOR_VER != DET_H_AR_RELEASE_MAJOR_VERSION)... */
    #endif /* LIN_DEV_ERR_DETECT == STD_ON */
     /* Make sure the AUTOSAR version numbers are the same between LinIf.c and EcuM.h */
     #if ((LIN_IF_RELEASE_AUTOSAR_MAJOR_VER != ECUM_H_AR_RELEASE_MAJOR_VERSION) || \
         (LIN_IF_RELEASE_AUTOSAR_MINOR_VER != ECUM_H_AR_RELEASE_MINOR_VERSION))
        #error "AUTOSAR Version Numbers mismatch between LinIf.c and EcuM.h"
    #endif /* (LIN_IF_RELEASE_AUTOSAR_MAJOR_VER != ECUM_H_AR_RELEASE_MAJOR_VERSION)... */
 #endif
 
#if (LINIF_WAKE_UP_SUPPORT == STD_ON)
/*******************************************************************************
                              GLOBAL VARIABLE
*******************************************************************************/
/** @defgroup LINIF_Variable
  @{
*/
VAR(uint8, ECUM_VAR) g_linifWakeupCounter = 0;

/**@} end of group LINIF_Variable */
/*******************************************************************************
                              GLOBAL FUNCTION
*******************************************************************************/
/** @defgroup LINIF_Fuctions
  @{
*/
/*!
* @brief         The LIN driver or LIN transceiver driver calls this function and
*                report the wake source when it detects the wake.
*
* @param[in]     WakeupSource: The source device that initiates the wake up event: LIN controller or LIN transceiver.
*
* @retval        void
*
* @note          None
*/
FUNC(void, LINIF_CODE) LinIf_WakeupConfirmation(VAR(EcuM_WakeupSourceType, LINIF_VAR) WakeupSource)
{
    (void)WakeupSource;
    g_linifWakeupCounter++;
}

/*!
* @brief         EcuM is notified on a specific LIN channel to be called at wake up time
*
* @param[in]     WakeupSource: The source device that initiates the wake up event: LIN controller or LIN transceiver
*
* @retval        Std_ReturnType
*
* @note          None
*/
FUNC(Std_ReturnType, LINIF_CODE) LinIf_CheckWakeup(VAR(EcuM_WakeupSourceType, LINIF_VAR) WakeupSource)
{
    (void)WakeupSource;
    return E_OK;
}

/**@} end of group LINIF_Fuctions */
#endif /* LINIF_WAKE_UP_SUPPORT == STD_ON */

#ifdef __cplusplus
}
#endif 
/**@} end of group LINIF_Driver */
/**@} end of group G32A10xx_StdPeriphDriver */
