/**
*   @file    Mcl_Sema4.h
*   @version 1.0.0
*
*   @brief   AUTOSAR Mcl - Sema4 Low level driver header file.
*   @details Sema4 module low level driver.
*
*   @addtogroup MCL
*   @{
*/
/*==================================================================================================
*   Project              : AUTOSAR 4.3 MCAL
*   Platform             : PA
*   Peripheral           : eDMA
*   Dependencies         : none
*
*   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.
==================================================================================================*/
/*==================================================================================================
==================================================================================================*/

#ifndef MCL_Sema4_H
#define MCL_Sema4_H

#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.
* Identifiers (internal and external) shall not rely on the significance of more than 31 characters. 
* 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 namespace shall be distinct.
* This violation is due to the requirement that requests to have a file version check.
*
* @section [global]
* Violates MISRA 2012 Required Rule 5.4, Macro identifiers shall be distinct.
* This violation is due to the requirement that requests to have a file version check.
*
* @section [global]
* Violates MISRA 2012 Required Rule 5.5, Identifiers shall be distinct from macro names.
* This violation is due to the requirement that requests to have a file version check.
*
* @section WDG_Sema4_h_REF_1
* 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 "Mcl_Sema4_Types.h"
#include "Reg_eSys_Sema4.h"
#include "CDD_Mcl_Cfg.h"

/*==================================================================================================
*                              SOURCE FILE VERSION INFORMATION
==================================================================================================*/

#define MCL_SEMA4_VENDOR_ID                      43
#define MCL_SEMA4_AR_RELEASE_MAJOR_VERSION       4
#define MCL_SEMA4_AR_RELEASE_MINOR_VERSION       3
#define MCL_SEMA4_AR_RELEASE_REVISION_VERSION    1
#define MCL_SEMA4_SW_MAJOR_VERSION               1
#define MCL_SEMA4_SW_MINOR_VERSION               0
#define MCL_SEMA4_SW_PATCH_VERSION               0

/*==================================================================================================
*                                     FILE VERSION CHECKS
==================================================================================================*/
#ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
    /* Check if the header file and Std_Types.h are of the same Autosar version */
    #if ((MCL_SEMA4_AR_RELEASE_MAJOR_VERSION != STD_AR_RELEASE_MAJOR_VERSION) || \
         (MCL_SEMA4_AR_RELEASE_MINOR_VERSION != STD_AR_RELEASE_MINOR_VERSION))
        #error "AutoSar Version Numbers of Mcl_Sema4.h and Std_Types.h are different"
    #endif
#endif

/* Check if the header file and Mcl_Sema4_Types.h header file are of the same vendor */
#if (MCL_SEMA4_TYPES_VENDOR_ID != MCL_SEMA4_VENDOR_ID)
    #error "Mcl_Sema4.h and Mcl_Sema4_Types.h have different vendor ids"
#endif
/* Check if the header file and Mcl_Sema4_Types.h header file are of the same Autosar version */
#if ((MCL_SEMA4_TYPES_AR_RELEASE_MAJOR_VERSION    != MCL_SEMA4_AR_RELEASE_MAJOR_VERSION) || \
     (MCL_SEMA4_TYPES_AR_RELEASE_MINOR_VERSION    != MCL_SEMA4_AR_RELEASE_MINOR_VERSION) || \
     (MCL_SEMA4_TYPES_AR_RELEASE_REVISION_VERSION != MCL_SEMA4_AR_RELEASE_REVISION_VERSION))
    #error "AutoSar Version Numbers of Mcl_Sema4.h and Mcl_Sema4_Types.h are different"
#endif
/* Check if the header file and Mcl_Sema4_Types.h header file are of the same software version */
#if ((MCL_SEMA4_TYPES_SW_MAJOR_VERSION != MCL_SEMA4_SW_MAJOR_VERSION) || \
     (MCL_SEMA4_TYPES_SW_MINOR_VERSION != MCL_SEMA4_SW_MINOR_VERSION) || \
     (MCL_SEMA4_TYPES_SW_PATCH_VERSION != MCL_SEMA4_SW_PATCH_VERSION))
    #error "Software Version Numbers of Mcl_Sema4.h and Mcl_Sema4_Types.h are different"
#endif

/* Check if the header file and Reg_eSys_Sema4.h header file are of the same vendor */
#if (SEMA4_REG_VENDOR_ID != MCL_SEMA4_VENDOR_ID)
    #error "Mcl_Sema4.h and Reg_eSys_Sema4.h have different vendor ids"
#endif
/* Check if the header file and Reg_eSys_Sema4.h header file are of the same Autosar version */
#if ((SEMA4_REG_AR_RELEASE_MAJOR_VERSION    != MCL_SEMA4_AR_RELEASE_MAJOR_VERSION) || \
     (SEMA4_REG_AR_RELEASE_MINOR_VERSION    != MCL_SEMA4_AR_RELEASE_MINOR_VERSION) || \
     (SEMA4_REG_AR_RELEASE_REVISION_VERSION != MCL_SEMA4_AR_RELEASE_REVISION_VERSION))
    #error "AutoSar Version Numbers of Mcl_Sema4.h and Reg_eSys_Sema4.h are different"
#endif
/* Check if the header file and Reg_eSys_Sema4.h header file are of the same software version */
#if ((SEMA4_REG_SW_MAJOR_VERSION != MCL_SEMA4_SW_MAJOR_VERSION) || \
     (SEMA4_REG_SW_MINOR_VERSION != MCL_SEMA4_SW_MINOR_VERSION) || \
     (SEMA4_REG_SW_PATCH_VERSION != MCL_SEMA4_SW_PATCH_VERSION))
    #error "Software Version Numbers of Mcl_Sema4.h and Reg_eSys_Sema4.h are different"
#endif



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

/*==================================================================================================
*                                      DEFINES AND MACROS
==================================================================================================*/

/*==================================================================================================
*                                             ENUMS
==================================================================================================*/


/*==================================================================================================
*                                STRUCTURES AND OTHER TYPEDEFS
==================================================================================================*/


/*==================================================================================================
*                                GLOBAL VARIABLE DECLARATIONS
==================================================================================================*/

/*==================================================================================================
*                                    FUNCTION PROTOTYPES
==================================================================================================*/
#ifdef MCL_SEMA4_FEATURE_API
#if (STD_ON == MCL_SEMA4_FEATURE_API)

/* @violates @ref WDG_Sema4_h_REF_1 MISRA 2012 Required 4.10*/
#define MCL_START_SEC_CODE
/* @violates @ref WDG_Sema4_h_REF_1 MISRA 2012 Required 4.10*/
#include "Mcl_MemMap.h"


FUNC(uint8, MCL_CODE) Mcl_Sema4_GetGateStatus(VAR(Mcl_Sema4ChannelType, AUTOMATIC) ChannelId);

FUNC(Mcl_Sema4ReturnType, MCL_CODE) Mcl_Sema4_LockGate(VAR(Mcl_Sema4ChannelType, AUTOMATIC) ChannelId);

FUNC(Mcl_Sema4ReturnType, MCL_CODE) Mcl_Sema4_UnlockGate(VAR(Mcl_Sema4ChannelType, AUTOMATIC) ChannelId);

FUNC(void, MCL_CODE) Mcl_Sema4_ResetSemaphore(VAR(Mcl_Sema4ChannelType, AUTOMATIC) ChannelId);

FUNC(void, MCL_CODE) Mcl_Sema4_ResetAllSemaphores(void);
/* @violates @ref WDG_Sema4_h_REF_1 MISRA 2012 Required 4.10*/
#define MCL_STOP_SEC_CODE
/* @violates @ref WDG_Sema4_h_REF_1 MISRA 2012 Required 4.10*/
#include "Mcl_MemMap.h"

#endif
#endif /* MCL_SEMA4_FEATURE_API */
#ifdef __cplusplus
}
#endif

#endif /* MCL_Sema4_H */

/** @} */
