/**
*   @file    Ocu_eMios_Types.h
*   @version 1.0.0
*
*   @brief   AUTOSAR Ocu - eMios driver header file specific to OCU driver
*   @details eMios specific defines which need to be exported to external application
*
*   @addtogroup EMIOS_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_TYPES_H
#define OCU_EMIOS_TYPES_H
/**
*   @file    Ocu_eMios_Types.h
*/

#ifdef __cplusplus
extern "C"{
#endif
/**
* @page misra_violations MISRA-C:2012 violations
*
* @section OCU_EMIOS_TYPES_H_REF_1
* Violates MISRA 2012 Advisory Rule 2.5, A project should not contain unused macro 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 "eMios_Common_Types.h"

#include "Ocu_Cfg.h"
#include "Ocu_EnvCfg.h"
/*==================================================================================================
*                              SOURCE FILE VERSION INFORMATION
==================================================================================================*/
/**
* @{
* @file           Ocu_eMios_Types.h
* @brief          Source file version information
*
*/
#define OCU_EMIOS_TYPES_VENDOR_ID                       43
#define OCU_EMIOS_TYPES_AR_RELEASE_MAJOR_VERSION        4
#define OCU_EMIOS_TYPES_AR_RELEASE_MINOR_VERSION        3
#define OCU_EMIOS_TYPES_AR_RELEASE_REVISION_VERSION     1
#define OCU_EMIOS_TYPES_SW_MAJOR_VERSION                1
#define OCU_EMIOS_TYPES_SW_MINOR_VERSION                0
#define OCU_EMIOS_TYPES_SW_PATCH_VERSION                0
/** @} */

/*==================================================================================================
*                                     FILE VERSION CHECKS
==================================================================================================*/

#ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
    /* Check if the header files are of the same Autosar version */
    #if ((OCU_EMIOS_TYPES_AR_RELEASE_MAJOR_VERSION != EMIOS_COMMON_TYPES_AR_RELEASE_MAJOR_VERSION) || \
         (OCU_EMIOS_TYPES_AR_RELEASE_MINOR_VERSION != EMIOS_COMMON_TYPES_AR_RELEASE_MINOR_VERSION) \
        )
        #error "AutoSar Version Numbers of Ocu_eMios_Types.h and eMios_Common_Types.h are different"
    #endif
#endif



#if ( OCU_EMIOS_TYPES_VENDOR_ID!= OCU_CFG_VENDOR_ID)
    #error "Ocu_eMios_Types.h and Ocu_Cfg.h have different vendor ids"
#endif
/* Check if the header files are of the same Autosar version */
#if ((OCU_EMIOS_TYPES_AR_RELEASE_MAJOR_VERSION != OCU_CFG_AR_RELEASE_MAJOR_VERSION) || \
     (OCU_EMIOS_TYPES_AR_RELEASE_MINOR_VERSION != OCU_CFG_AR_RELEASE_MINOR_VERSION) || \
     (OCU_EMIOS_TYPES_AR_RELEASE_REVISION_VERSION != OCU_CFG_AR_RELEASE_REVISION_VERSION) \
    )
    #error "AutoSar Version Numbers of Ocu_eMios_Types.h and Ocu_Cfg.h are different"
#endif
/* Check if the header files are of the same Software version */
#if ((OCU_EMIOS_TYPES_SW_MAJOR_VERSION != OCU_CFG_SW_MAJOR_VERSION) || \
     (OCU_EMIOS_TYPES_SW_MINOR_VERSION != OCU_CFG_SW_MINOR_VERSION) || \
     (OCU_EMIOS_TYPES_SW_PATCH_VERSION != OCU_CFG_SW_PATCH_VERSION) \
    )
    #error "Software Version Numbers of Ocu_eMios_Types.h and Ocu_Cfg.h are different"
#endif




#if ( OCU_EMIOS_TYPES_VENDOR_ID!= OCU_ENVCFG_VENDOR_ID)
    #error "Ocu_eMios_Types.h and Ocu_EnvCfg.h have different vendor ids"
#endif
/* Check if the header files are of the same Autosar version */
#if ((OCU_EMIOS_TYPES_AR_RELEASE_MAJOR_VERSION != OCU_ENVCFG_AR_RELEASE_MAJOR_VERSION) || \
     (OCU_EMIOS_TYPES_AR_RELEASE_MINOR_VERSION != OCU_ENVCFG_AR_RELEASE_MINOR_VERSION) || \
     (OCU_EMIOS_TYPES_AR_RELEASE_REVISION_VERSION != OCU_ENVCFG_AR_RELEASE_REVISION_VERSION) \
    )
    #error "AutoSar Version Numbers of Ocu_eMios_Types.h and Ocu_EnvCfg.h are different"
#endif
/* Check if the header files are of the same Software version */
#if ((OCU_EMIOS_TYPES_SW_MAJOR_VERSION != OCU_ENVCFG_SW_MAJOR_VERSION) || \
     (OCU_EMIOS_TYPES_SW_MINOR_VERSION != OCU_ENVCFG_SW_MINOR_VERSION) || \
     (OCU_EMIOS_TYPES_SW_PATCH_VERSION != OCU_ENVCFG_SW_PATCH_VERSION) \
    )
    #error "Software Version Numbers of Ocu_eMios_Types.h and Ocu_EnvCfg.h are different"
#endif
/*==================================================================================================
*                                          CONSTANTS
==================================================================================================*/

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

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

/**
* @{
* @brief eMios register define used to configure counter clock source.
*/
/**
* @violates @ref OCU_EMIOS_TYPES_H_REF_1 Violates Advisory Rule 2.5, A project should not contain unused macro declarations.
*/
#define OCU_EMIOS_OUTPUT_DISABLED           ((uint32)(0U))
/**
* @violates @ref OCU_EMIOS_TYPES_H_REF_1 Violates Advisory Rule 2.5, A project should not contain unused macro declarations.
*/
#define OCU_EMIOS_OUTPUT_ENABLE             ((uint32)(1U))
/**
* @violates @ref OCU_EMIOS_TYPES_H_REF_1 Violates Advisory Rule 2.5, A project should not contain unused macro declarations.
*/
#define OCU_EMIOS_BUS_SELECT_PARAM_MASK   ((uint32)(0x3000U))
/**
* @violates @ref OCU_EMIOS_TYPES_H_REF_1 Violates Advisory Rule 2.5, A project should not contain unused macro declarations.
*/
#define OCU_EMIOS_BUS_SELECT_PARAM_SHIFT  ((uint32)(12U))

/**
* @violates @ref OCU_EMIOS_TYPES_H_REF_1 Violates Advisory Rule 2.5, A project should not contain unused macro declarations.
*/
#define OCU_EMIOS_CLOCK_DIV_MASK          ((uint32)(0x0C00U))
/**
* @violates @ref OCU_EMIOS_TYPES_H_REF_1 Violates Advisory Rule 2.5, A project should not contain unused macro declarations.
*/
#define OCU_EMIOS_CLOCK_DIV_SHIFT         ((uint32)(10U))
/**
* @violates @ref OCU_EMIOS_TYPES_H_REF_1 Violates Advisory Rule 2.5, A project should not contain unused macro declarations.
*/
#define OCU_EMIOS_COUNT_DIR_MASK          ((uint32)(0x0200U))
/**
* @violates @ref OCU_EMIOS_TYPES_H_REF_1 Violates Advisory Rule 2.5, A project should not contain unused macro declarations.
*/
#define OCU_EMIOS_COUNT_DIR_SHIFT         ((uint32)(9U))
/**
* @violates @ref OCU_EMIOS_TYPES_H_REF_1 Violates Advisory Rule 2.5, A project should not contain unused macro declarations.
*/
#define OCU_EMIOS_DBG_INFO_MASK           ((uint32)(0x0100U))
/**
* @violates @ref OCU_EMIOS_TYPES_H_REF_1 Violates Advisory Rule 2.5, A project should not contain unused macro declarations.
*/
#define OCU_EMIOS_DBG_INFO_SHIFT          ((uint32)(8U))
/**
* @violates @ref OCU_EMIOS_TYPES_H_REF_1 Violates Advisory Rule 2.5, A project should not contain unused macro declarations.
*/
#define OCU_EMIOS_OUTPIN_USED_MASK        ((uint32)(0x0080U))
/**
* @violates @ref OCU_EMIOS_TYPES_H_REF_1 Violates Advisory Rule 2.5, A project should not contain unused macro declarations.
*/
#define OCU_EMIOS_OUTPIN_USED_SHIFT       ((uint32)(7U))
/**
* @violates @ref OCU_EMIOS_TYPES_H_REF_1 Violates Advisory Rule 2.5, A project should not contain unused macro declarations.
*/
#define OCU_EMIOS_PIN_ACTION_MASK         ((uint32)(0x0060U))
/**
* @violates @ref OCU_EMIOS_TYPES_H_REF_1 Violates Advisory Rule 2.5, A project should not contain unused macro declarations.
*/
#define OCU_EMIOS_PIN_ACTION_SHIFT        ((uint32)(5U))
/**
* @violates @ref OCU_EMIOS_TYPES_H_REF_1 Violates Advisory Rule 2.5, A project should not contain unused macro declarations.
*/
#define OCU_EMIOS_PIN_STATE_MASK          ((uint32)(0x0010U))
/**
* @violates @ref OCU_EMIOS_TYPES_H_REF_1 Violates Advisory Rule 2.5, A project should not contain unused macro declarations.
*/
#define OCU_EMIOS_PIN_STATE_SHIFT         ((uint32)(4U))
/**@}*/


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

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

/*===============================================================================================
                                 STRUCTURES AND OTHER TYPEDEFS
===============================================================================================*/
/**
* @brief          eMios HW module/channel id type
*/
typedef uint8 Ocu_eMios_ChannelType;


/**
* @brief          eMios unified channel control register value
* 
*/
typedef uint32 Ocu_eMios_ControlType;


/**
* @brief            eMios IP channel specific configuration structure for the Ocu functionality
*/
typedef struct
{
    /** @brief Assigned eMios channel id*/
    CONST(Ocu_eMios_ChannelType,  OCU_CONST) HwChannel;
    /** @brief Compare match threshold for the current channel*/
    CONST(Ocu_ValueType,           OCU_CONST) DefaultThreshold;
    /** @brief Maximum counter value for the current channel*/
    CONST(Ocu_ValueType,           OCU_CONST) MaxCounterValue;    
#if (OCU_SET_CLOCK_MODE_API == STD_ON)
    /** @brief eMios channel parameters */
    /** bits 4 .. 5 --> Prescaler configuration */
    CONST(Ocu_eMios_ControlType,  OCU_CONST) AltControlValue;
#endif
    /** @brief eMios configuration parameter */
    /** bit 24        --> Set Edge Polarity bit
        bit 24        --> Edge action on match bit
        bits 21 .. 22 --> Set Counter Bus bits 
        bits 4 .. 5   --> Prescaler configuration
        bit 1         --> Set or Disable output
        bit 0         --> Set or Disable timer functionality in freeze mode*/ 
    CONST(Ocu_eMios_ControlType,  OCU_CONST) ControlValue;
    /** @brief Assigned eMios channel id of counter bus */
    CONST(Ocu_eMios_ChannelType,  OCU_CONST) HwChannel_CounterBus;
    
} Ocu_eMios_ChannelConfigType;


/**
* @brief      eMios IP specific configuration structure type
*/
typedef struct
{
    /** @brief Number of eMios channels in the Ocu configuration */
    CONST(Ocu_eMios_ChannelType,       OCU_CONST) nNumChannels;
    /** @brief Pointer to the configured channels for eMios */
    CONST(Ocu_eMios_ChannelConfigType, OCU_CONST) (*pChannelsConfig)[]; 
} Ocu_eMios_IpConfigType;



#ifdef __cplusplus
}
#endif

#endif

/** @} */
