/**
*   @file    Ocu_eMios.h
*   @version 1.0.0
*
*   @brief   AUTOSAR Ocu - eMios driver header file.
*   @details eMios driver interface.
*
*   @addtogroup OCU_MODULE
*   @{
*/
/*==================================================================================================
*   Project              : AUTOSAR 4.3 MCAL
*   Platform             : PA
*   Peripheral           : eMios
*   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 OCU_EMIOS_H
#define OCU_EMIOS_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.
* 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 OCU_EMIOS_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].
*
* @section OCU_EMIOS_H_REF_2
* Violates MISRA 2012 Advisory Rule 2.3, A project should not contain unused type declarations.
* Define is used in configuration.
*
*/

/*==================================================================================================
*                                        INCLUDE FILES
* 1) system and project includes
* 2) needed interfaces from external units
* 3) internal and external interfaces from this unit
==================================================================================================*/
#include "Ocu_eMios_Types.h"
/*==================================================================================================
*                              SOURCE FILE VERSION INFORMATION
==================================================================================================*/
#define OCU_EMIOS_VENDOR_ID                       43
#define OCU_EMIOS_AR_RELEASE_MAJOR_VERSION        4
#define OCU_EMIOS_AR_RELEASE_MINOR_VERSION        3
#define OCU_EMIOS_AR_RELEASE_REVISION_VERSION     1
#define OCU_EMIOS_SW_MAJOR_VERSION                1
#define OCU_EMIOS_SW_MINOR_VERSION                0
#define OCU_EMIOS_SW_PATCH_VERSION                0

/*==================================================================================================
*                                     FILE VERSION CHECKS
==================================================================================================*/
#if (OCU_EMIOS_VENDOR_ID != OCU_EMIOS_TYPES_VENDOR_ID)
    #error "Ocu_eMios_Types.h and Ocu_eMios_Types.h have different vendor ids"
#endif
#if ((OCU_EMIOS_AR_RELEASE_MAJOR_VERSION != OCU_EMIOS_TYPES_AR_RELEASE_MAJOR_VERSION) || \
     (OCU_EMIOS_AR_RELEASE_MINOR_VERSION != OCU_EMIOS_TYPES_AR_RELEASE_MINOR_VERSION) || \
     (OCU_EMIOS_AR_RELEASE_REVISION_VERSION != OCU_EMIOS_TYPES_AR_RELEASE_REVISION_VERSION) \
    )
    #error "AutoSar Version Numbers of Ocu_eMios_Types.h and Ocu_eMios_Types.h are different"
#endif
#if ((OCU_EMIOS_SW_MAJOR_VERSION != OCU_EMIOS_TYPES_SW_MAJOR_VERSION) || \
     (OCU_EMIOS_SW_MINOR_VERSION != OCU_EMIOS_TYPES_SW_MINOR_VERSION) || \
     (OCU_EMIOS_SW_PATCH_VERSION != OCU_EMIOS_TYPES_SW_PATCH_VERSION) \
    )
    #error "Software Version Numbers of Ocu_eMios_Types.h and Ocu_eMios_Types.h are different"
#endif
/*==================================================================================================
*                                          CONSTANTS
==================================================================================================*/

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

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

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

/**
 * @brief Definition of prescaler type.
 *
*/
typedef enum
{
    EMIOS_OCU_NORMAL_CLOCK_MODE    = 0x0U,           /*< @brief Default channel prescaler. */
    EMIOS_OCU_ALTERNATE_CLOCK_MODE                   /*< @brief Alternate channel prescaler mode */
/**
* @violates @ref OCU_EMIOS_H_REF_2 Violates Advisory Rule 2.3, A project should not contain unused type declarations.
*/
} Ocu_eMios_SelectPrescalerType;


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

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

#define OCU_START_SEC_CODE
/**
* @violates @ref OCU_EMIOS_H_REF_1 Directive 4.10, Precautions shall be taken in order to prevent the contents
* of a header file being included more than once.
*/
#include "Ocu_MemMap.h"

FUNC(void, GPT_CODE) Ocu_eMios_Init(CONSTP2CONST(Ocu_eMios_IpConfigType, AUTOMATIC, OCU_APPL_CONST)  peMiosIpConfig);

#if (OCU_DEINIT_API == STD_ON)
FUNC(void, OCU_CODE) Ocu_eMios_DeInit(CONSTP2CONST(Ocu_eMios_IpConfigType, AUTOMATIC, OCU_APPL_CONST)  peMiosIpConfig);
#endif

FUNC(void, OCU_CODE) Ocu_eMios_StartChannel(VAR(uint8, AUTOMATIC) u8HwChannelId);

FUNC(void, OCU_CODE) Ocu_eMios_StopChannel(VAR(uint8, AUTOMATIC) u8HwChannelId);

#if (OCU_GET_COUNTER_API == STD_ON)
FUNC(Ocu_ValueType, OCU_CODE) Ocu_eMios_GetCounter(VAR(uint8, AUTOMATIC) u8HwChannelId);
#endif

#if (OCU_SET_PIN_ACTION_API == STD_ON)
FUNC(void, OCU_CODE) Ocu_eMios_SetPinAction(
                                             VAR(uint8,             AUTOMATIC) u8HwChannel, 
                                             VAR(uint8, AUTOMATIC) PinAction,
                                             VAR(boolean,           AUTOMATIC) bIsRunning
                                            );
#endif

#if (OCU_SET_PIN_STATE_API == STD_ON)
FUNC(void, OCU_CODE) Ocu_eMios_SetPinState(
                                            VAR(uint8,            AUTOMATIC) u8HwChannel, 
                                            VAR(Ocu_PinStateType, AUTOMATIC) PinState
                                           );
#endif

#if (OCU_SET_ABSOLUTE_THRESHOLD_API == STD_ON)
FUNC(Ocu_ReturnType, OCU_CODE) Ocu_eMios_SetAbsoluteThreshold(
                                                               VAR(uint8,         AUTOMATIC) u8HwChannel, 
                                                               VAR(Ocu_ValueType, AUTOMATIC) ReferenceValue, VAR(Ocu_ValueType, AUTOMATIC) AbsoluteValue
                                                              ); 
#endif

#if (OCU_SET_RELATIVE_THRESHOLD_API == STD_ON)
FUNC(Ocu_ReturnType, OCU_CODE) Ocu_eMios_SetRelativeThreshold(
                                                               VAR (uint8,         AUTOMATIC) u8HwChannel, 
                                                               VAR (Ocu_ValueType, AUTOMATIC) RelativeValue
                                                              );
#endif

#if (OCU_SET_CLOCK_MODE_API == STD_ON)
FUNC(void, OCU_CODE) Ocu_eMios_SetClockMode(
                                             CONSTP2CONST(Ocu_eMios_IpConfigType, AUTOMATIC, OCU_APPL_CONST)  peMiosIpConfig,
                                             VAR (uint8, AUTOMATIC) ePrescaler
                                            );
#endif

#if ((OCU_SET_RELATIVE_THRESHOLD_API == STD_ON) || (OCU_SET_ABSOLUTE_THRESHOLD_API == STD_ON))
FUNC (Ocu_ValueType, OCU_CODE) Ocu_eMios_GetMaxCountValue(
    VAR(Ocu_ChannelType,    AUTOMATIC)  u8HwChannel
);
#endif

#define OCU_STOP_SEC_CODE
/**
* @violates @ref OCU_EMIOS_H_REF_1 Directive 4.10, Precautions shall be taken in order to prevent the contents
* of a header file being included more than once.
*/
#include "Ocu_MemMap.h"

#ifdef __cplusplus
}
#endif

#endif /*OCU_EMIOS_H*/

/** @} */
