/**
*     @version 1.0.0
*
*     @brief   AUTOSAR Icu - ICU driver header file.
*     @details ICU driver header file, containing the Autosar API specification and other variables
*              and functions that are exported by the ICU driver.
*
*     @addtogroup ICU_MODULE
*     @{
*/
/*==================================================================================================
*     Project             : AUTOSAR 4.3 MCAL
*     Platform            : PA
*     Peripheral          : eMIOS SIU
*     Dependencies        : none
*
*     Autosar Version     :  4.3.1
*     Autosar Revision    : ASR_REL_4_3_REV_0001
*     Autosar ConfVariant :
*     SWVersion           : 1.0.0
*     BuildVersion        : 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 ICU_TYPES_H
#define ICU_TYPES_H

#ifdef __cplusplus
extern "C"
{
#endif

/**
* @page misra_violations MISRA-C:2012 violations
*
* @section ICU_TYPES_H_REF_1
* Violates MISRA 2012 Advisory Rule 2.3, A project should not contain unused type declarations.
* Enum type 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 "Std_Types.h"
/*==================================================================================================
*                                SOURCE FILE VERSION INFORMATION
==================================================================================================*/
#define ICU_TYPES_VENDOR_ID                       43

#define ICU_TYPES_AR_RELEASE_MAJOR_VERSION        4
#define ICU_TYPES_AR_RELEASE_MINOR_VERSION        3
#define ICU_TYPES_AR_RELEASE_REVISION_VERSION     1
#define ICU_TYPES_SW_MAJOR_VERSION                1
#define ICU_TYPES_SW_MINOR_VERSION                0
#define ICU_TYPES_SW_PATCH_VERSION                0

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


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


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

/**
* @brief Allow enabling or disabling of all interrupts which are not required for the ECU wakeup
* @implements Icu_ModeType_enumeration
*/
typedef enum
{
    ICU_MODE_NORMAL = 0U,     /*< @brief Normal operation, all used interrupts are enabled
                               *          according to the notification requests. */
    ICU_MODE_SLEEP            /*< @brief Reduced power operation. In sleep mode only those
                               *          notifications are available which are configured as wakeup
                               *          capable. */
} Icu_ModeType;

#if (ICU_GET_INPUT_STATE_API == STD_ON)
/**
* @brief          Input state of an ICU channel.
* @implements     Icu_InputStateType_enumeration
*/
typedef enum
{
    ICU_ACTIVE = 0U,         /*< @brief An activation edge has been detected. */
    ICU_IDLE                 /*< @brief No activation edge has been detected since the last call of
                              *          Icu_GetInputState() or Icu_Init(). */
} Icu_InputStateType;
#endif

/**
* @brief Definition of the measurement mode type.
* @implements Icu_MeasurementModeType_enumeration
*/
typedef enum
{
    ICU_MODE_SIGNAL_EDGE_DETECT = 0x01U,   /*< @brief Mode for detecting edges */
    ICU_MODE_SIGNAL_MEASUREMENT = 0x02U,   /*< @brief Mode for measuring different times between
                                            *         various configurable edges */
    ICU_MODE_TIMESTAMP          = 0x04U,   /*< @brief Mode for capturing timer values on
                                            *         configurable edges */
    ICU_MODE_EDGE_COUNTER       = 0x08U    /*< @brief Mode for counting edges on configurable
                                            *         edges*/
} Icu_MeasurementModeType;


#if ((ICU_GET_TIME_ELAPSED_API == STD_ON) || (ICU_SIGNAL_MEASUREMENT_API == STD_ON))
/**
* @brief Definition of the measurement property type.
* @implements Icu_SignalMeasurementPropertyType_enumeration
*/
typedef enum
{
    ICU_LOW_TIME    = 0x01U,            /*< @brief The channel is configured for reading the
                                         *          elapsed Signal Low Time. */
    ICU_HIGH_TIME   = 0x02U,            /*< @brief The channel is configured for reading the
                                         *          elapsed Signal High Time. */                              
    ICU_PERIOD_TIME = 0x04U,            /*< @brief The channel is configured for reading the
                                         *          elapsed Signal Period Time. */
    ICU_DUTY_CYCLE  = 0x08U             /*< @brief The channel is configured to read values which
                                         *          are needed for calculating the duty cycle
                                         *          (coherent Active and Period Time). */
/** @violates @ref ICU_TYPES_H_REF_1 Violates Advisory Rule 2.3, A project should not contain unused type declarations.*/
} Icu_SignalMeasurementPropertyType;
#endif

/**
* @brief Definition of the timestamp measurement property type.
* @implements Icu_TimestampBufferType_enumeration
*/
typedef enum
{
    ICU_LINEAR_BUFFER = 0U,     /*< @brief The buffer will just be filled once. */
    ICU_CIRCULAR_BUFFER         /*< @brief After reaching the end of the buffer, the driver
                                 *          restarts at the beginning of the buffer. */
/** @violates @ref ICU_TYPES_H_REF_1 Violates Advisory Rule 2.3, A project should not contain unused type declarations. */
} Icu_TimestampBufferType;


/**
* @brief Definition of the type of activation of an ICU channel.
* @implements Icu_ActivationType_enumeration
*/
typedef enum
{
    ICU_FALLING_EDGE = 0x0U,     /*< @brief An appropriate action shall be executed when a falling
                                  *          edge occurs on the ICU input signal. */
    ICU_RISING_EDGE  = 0x1U,     /*< @brief An appropriate action shall be executed when a rising
                                  *          edge occurs on the ICU input signal */
    ICU_BOTH_EDGES   = 0x2U      /*< @brief An appropriate action shall be executed when either a
                                  *         rising or falling edge occur on the ICU input signal. */
} Icu_ActivationType;



#if (ICU_GET_INPUT_LEVEL_API == STD_ON)
/**
* @brief   Return the status of the pin.
* @details Enumeration of to check the status of emios pin.
*/
typedef enum
{
    /* Default Input PIN Status */
    ICU_LEVEL_LOW    = 0x0U,
    /* As Icu_GetInputState do not give the Actual PIN status user can call the Non Autosar API
        Icu_GetInputLevel to get the Actual status of PIN*/
    ICU_LEVEL_HIGH = 0x1U
} Icu_LevelType;

#endif /* ICU_GET_INPUT_LEVEL_API */


#if (ICU_DUAL_CLOCK_MODE_API == STD_ON)
/**
* @brief   Definition of prescaler type.
*
*/
typedef enum
{
    ICU_NORMAL_CLOCK_MODE    = 0x0U,           /*< @brief Default channel prescaler. */
    ICU_ALTERNATE_CLOCK_MODE                   /*< @brief Alternate channel prescaler mode */
} Icu_SelectPrescalerType;

#endif /* ICU_DUAL_CLOCK_MODE_API */
/*==================================================================================================
*                                  STRUCTURES AND OTHER TYPEDEFS
==================================================================================================*/

/**
* @brief          This gives the numeric ID (hardware channel number) of an ICU channel
* @implements     Icu_ChannelType_typedef
*/
typedef uint16                          Icu_ChannelType;


/**
* @brief          The Icu_ParamType contains combined bit fields for initialization options, for
*                 different registers.
*
*/
typedef uint32                          Icu_ParamType;

/**
* @brief          Type for saving the timer register width value
* @implements     Icu_ValueType_typedef
* @violates @ref ICU_TYPES_H_REF_1 Violates Advisory Rule 2.3, A project should not contain unused type declarations.
*/
typedef Icu_TimerRegisterWidthType      Icu_ValueType;

/**
* @brief          Type for saving the ICU Hardware specific index
* @implements     Icu_IndexType_typedef
* @violates @ref ICU_TYPES_H_REF_1 Violates Advisory Rule 2.3, A project should not contain unused type declarations.
*/
typedef Icu_HwSpecificIndexType         Icu_IndexType;

/**
* @brief          Type for saving hardware specific edge number
* @implements     Icu_EdgeNumberType_typedef
* @violates @ref ICU_TYPES_H_REF_1 Violates Advisory Rule 2.3, A project should not contain unused type declarations.
*/
typedef Icu_HwSpecificEdgeNumberType    Icu_EdgeNumberType;

#if (ICU_REPORT_WAKEUP_SOURCE == STD_ON)
/**
* @brief          Type for saving the Wakeup value
*/
typedef uint32                          Icu_WakeupValueType;
#endif 

/**
* @brief          Type for saving the ICU measurement submode type
*
*/
typedef uint16                           Icu_MeasurementSubModeType;

/**
* @brief          The notification functions shall have no parameters and no return value.
* @implements     Icu_NotifyType_typedef
*/
typedef void (*Icu_NotifyType)(void);

#if (ICU_GET_DUTY_CYCLE_VALUES_API== STD_ON)
/**
* @brief Structure that contains ICU Duty cycle parameters. It contains the values needed for
*        calculating duty cycles i.e Period time value and active time value.
* @implements Icu_DutyCycleType_struct
*/
typedef struct
{
    Icu_ValueType ActiveTime;          /*< @brief Low or High time value. */
    Icu_ValueType PeriodTime;         /*< @brief Period time value. */
} Icu_DutyCycleType;
#endif

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



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

#ifdef __cplusplus
}
#endif

#endif  /* ICU_TYPES_H */
/** @} */
