/**
*     @file    Icu_Siu_Types.h
*     @version 1.0.0
*
*     @brief   AUTOSAR Icu - SIU low level driver exported structures.
*     @details Interface between the high level driver (Autosar dependent) and the low level driver(platform dependent).
*
*     @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_SIU_TYPES
#define ICU_SIU_TYPES


#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 ICU_SIU_TYPES_H_REF_1
* Violates MISRA 2012 Advisory Rule 2.5, A project should not contain unused macro declarations.
* Define is/might be used in configuration.
*
* @section ICU_SIU_TYPES_H_REF_2
* Violates MISRA 2012 Advisory Rule 2.3, A project should not contain unused type declarations.
* Enum type is used in configuration.
*
*/

/*==================================================================================================
*                                SOURCE FILE VERSION INFORMATION
==================================================================================================*/
#define ICU_SIU_TYPES_VENDOR_ID          43
#define ICU_SIU_TYPES_AR_RELEASE_MAJOR_VERSION   4
#define ICU_SIU_TYPES_AR_RELEASE_MINOR_VERSION   3
#define ICU_SIU_TYPES_AR_RELEASE_REVISION_VERSION   1
#define ICU_SIU_TYPES_SW_MAJOR_VERSION   1
#define ICU_SIU_TYPES_SW_MINOR_VERSION   0
#define ICU_SIU_TYPES_SW_PATCH_VERSION   0

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


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

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

/*==================================================================================================
*                                        DEFINES AND MACROS
==================================================================================================*/
/**
* @brief SIU External Interrupt Channels defines
*/
/** @violates @ref ICU_SIU_TYPES_H_REF_1 Violates Advisory Rule 2.5, A project should not contain unused macro declarations. */
#define ICU_SIU_IRQ_0    ((uint8) 0U)
/** @violates @ref ICU_SIU_TYPES_H_REF_1 Violates Advisory Rule 2.5, A project should not contain unused macro declarations. */
#define ICU_SIU_IRQ_1    ((uint8) 1U)
/** @violates @ref ICU_SIU_TYPES_H_REF_1 Violates Advisory Rule 2.5, A project should not contain unused macro declarations. */
#define ICU_SIU_IRQ_2    ((uint8) 2U)
/** @violates @ref ICU_SIU_TYPES_H_REF_1 Violates Advisory Rule 2.5, A project should not contain unused macro declarations. */
#define ICU_SIU_IRQ_3    ((uint8) 3U)
/** @violates @ref ICU_SIU_TYPES_H_REF_1 Violates Advisory Rule 2.5, A project should not contain unused macro declarations. */
#define ICU_SIU_IRQ_4    ((uint8) 4U)
/** @violates @ref ICU_SIU_TYPES_H_REF_1 Violates Advisory Rule 2.5, A project should not contain unused macro declarations. */
#define ICU_SIU_IRQ_5    ((uint8) 5U)
/** @violates @ref ICU_SIU_TYPES_H_REF_1 Violates Advisory Rule 2.5, A project should not contain unused macro declarations. */
#define ICU_SIU_IRQ_6    ((uint8) 6U)
/** @violates @ref ICU_SIU_TYPES_H_REF_1 Violates Advisory Rule 2.5, A project should not contain unused macro declarations. */
#define ICU_SIU_IRQ_7    ((uint8) 7U)
/** @violates @ref ICU_SIU_TYPES_H_REF_1 Violates Advisory Rule 2.5, A project should not contain unused macro declarations. */
#define ICU_SIU_IRQ_8    ((uint8) 8U)
/** @violates @ref ICU_SIU_TYPES_H_REF_1 Violates Advisory Rule 2.5, A project should not contain unused macro declarations. */
#define ICU_SIU_IRQ_9    ((uint8) 9U)
/** @violates @ref ICU_SIU_TYPES_H_REF_1 Violates Advisory Rule 2.5, A project should not contain unused macro declarations. */
#define ICU_SIU_IRQ_10   ((uint8)10U)
/** @violates @ref ICU_SIU_TYPES_H_REF_1 Violates Advisory Rule 2.5, A project should not contain unused macro declarations. */
#define ICU_SIU_IRQ_11   ((uint8)11U)
/** @violates @ref ICU_SIU_TYPES_H_REF_1 Violates Advisory Rule 2.5, A project should not contain unused macro declarations. */
#define ICU_SIU_IRQ_12   ((uint8)12U)
/** @violates @ref ICU_SIU_TYPES_H_REF_1 Violates Advisory Rule 2.5, A project should not contain unused macro declarations. */
#define ICU_SIU_IRQ_13   ((uint8)13U)
/** @violates @ref ICU_SIU_TYPES_H_REF_1 Violates Advisory Rule 2.5, A project should not contain unused macro declarations. */
#define ICU_SIU_IRQ_14   ((uint8)14U)
/** @violates @ref ICU_SIU_TYPES_H_REF_1 Violates Advisory Rule 2.5, A project should not contain unused macro declarations. */
#define ICU_SIU_IRQ_15   ((uint8)15U)

/**
* @brief Filter for enabling the SIU interrupt
* @violates @ref ICU_SIU_TYPES_H_REF_1 Violates Advisory Rule 2.5, A project should not contain unused macro declarations.
*/
#define ICU_SIU_INT_FILTER_ENABLE  0x1U

/**
* @{
* @brief SIU Channel Parameters
* @remarks Interrupt Filter Enable Register (IFER)
*          These macros are used in ICU plug-in
*
* @violates @ref ICU_SIU_TYPES_H_REF_1 Violates Advisory Rule 2.5, A project should not contain unused macro declarations.
*/
#define ICU_SIU_INT_FILTER_ENABLE_PARAM_MASK       ((uint32)BIT4)
/** @violates @ref ICU_SIU_TYPES_H_REF_1 Violates Advisory Rule 2.5, A project should not contain unused macro declarations. */
#define ICU_SIU_INT_FILTER_ENABLE_PARAM_SHIFT      ((uint32)4U)
/**@}*/

/**
* @{
* @brief SIU Channel Parameters
* @remarks Interrupt Filter Maximum Counter Registers (IFMC0-FMC23)
*          These macros are used in ICU plug-in
* @violates @ref ICU_SIU_TYPES_H_REF_1 Violates Advisory Rule 2.5, A project should not contain unused macro declarations.
*/
#define ICU_SIU_INT_FILTER_COUNTER_PARAM_MASK      (BIT3|BIT2|BIT1|BIT0)
/** @violates @ref ICU_SIU_TYPES_H_REF_1 Violates Advisory Rule 2.5, A project should not contain unused macro declarations. */
#define ICU_SIU_INT_FILTER_COUNTER_PARAM_SHIFT     ((uint32)0U)
/**@}*/

/**
* @{
* @brief SIU Global Configuration Parameter
* @remarks Digital Filter Register(SIU_IDFR)
* @violates @ref ICU_SIU_TYPES_H_REF_1 Violates Advisory Rule 2.5, A project should not contain unused macro declarations.
*/
#define ICU_SIU_INT_FILTER_CLOCK_PRESCALER_GC_MASK      (BIT3|BIT2|BIT1|BIT0)
/** @violates @ref ICU_SIU_TYPES_H_REF_1 Violates Advisory Rule 2.5, A project should not contain unused macro declarations. */
#define ICU_SIU_INT_FILTER_CLOCK_PRESCALER_GC_SHIFT     ((uint32)0U)

/**
* @{
* @brief SIU Global Configuration Parameter
* @remarks Digital Filter Register in Alternate Mode(SIU_IDFR)
* @violates @ref ICU_SIU_TYPES_H_REF_1 Violates Advisory Rule 2.5, A project should not contain unused macro declarations.
*/
#define ICU_SIU_INT_ALTERNATE_FILTER_CLOCK_PRESCALER_GC_MASK      (BIT7|BIT6|BIT5|BIT4)
/** @violates @ref ICU_SIU_TYPES_H_REF_1 Violates Advisory Rule 2.5, A project should not contain unused macro declarations. */
#define ICU_SIU_INT_ALTERNATE_FILTER_CLOCK_PRESCALER_GC_SHIFT     ((uint32)4U)

#if (ICU_DUAL_CLOCK_MODE_API == STD_ON)
/**
 * @brief   Definition of prescaler type.
 *
*/
/*< @brief Default channel prescaler. */
#define SIU_ICU_NORMAL_CLOCK_MODE       0x0U
/*< @brief Alternate channel prescaler mode */
/** @violates @ref ICU_SIU_TYPES_H_REF_1 Violates Advisory Rule 2.5, A project should not contain unused macro declarations.*/
#define SIU_ICU_ALTERNATE_CLOCK_MODE    0x1U
#endif
/*==================================================================================================
*                                              ENUMS
==================================================================================================*/
/**
* @brief         Icu_Siu_ActivationType
* @details       This indicates the activation type SIU channel (Rising, Falling or Both)
*/
typedef enum
{
    SIU_FALLING_EDGE = 0x0U,  /**< @brief  An appropriate action shall be executed when a falling
                                 * edge occurs on the SIUL input signal. */
    SIU_RISING_EDGE  = 0x1U,  /**< @brief  An appropriate action shall be executed when a rising
                                 *   edge occurs on the ICU input signal. */
    SIU_BOTH_EDGES   = 0x2U  /**< @brief  An appropriate action shall be executed when a rising
                                *   edge or falling edge occurs on the ICU input signal. */
/** @violates @ref ICU_SIU_TYPES_H_REF_2 Violates Advisory Rule 2.3, A project should not contain unused type declarations. */
} Icu_Siu_ActivationType;
/**@}*/

/*==================================================================================================
*                                  STRUCTURES AND OTHER TYPEDEFS
==================================================================================================*/
/**
* @brief            Icu_Siu_ChannelType
* @details          Type for saving the SIUL interrupt channel id
* @violates @ref ICU_SIU_TYPES_H_REF_2 Violates Advisory Rule 2.3, A project should not contain unused type declarations.
* */
typedef uint8  Icu_Siu_ChannelType;



typedef uint16 Icu_Siu_ControlType;

typedef uint16 Icu_Siu_GlobalConfigurationType;

typedef struct
{
    /** @brief Assigned Siu channel id*/
    CONST(Icu_Siu_ChannelType,  ICU_CONST) nHwChannel;
    /** @brief Siu channel parameters */
    CONST(Icu_Siu_ControlType,  ICU_CONST) nControlValue;
    /** @brief Siu Default Start Edge */
    CONST(Icu_Siu_ActivationType,  ICU_CONST) nDefaultStartEdge;
} Icu_Siu_ChannelConfigType;

/**
* @brief      Siu IP specific configuration structure type
*/
typedef struct
{
    /** @brief Number of Siu channels in the Icu configuration */
    CONST(Icu_Siu_ChannelType,       ICU_CONST) nNumChannels;
    /** @brief The Siu global configuration paramters */
    CONST(Icu_Siu_GlobalConfigurationType, ICU_CONST) Icu_GlobalConfiguration;
    /** @brief Pointer to the configured channels for Siu */
    CONST(Icu_Siu_ChannelConfigType, ICU_CONST) (*pChannelsConfig)[];
} Icu_Siu_IpConfigType;
/*==================================================================================================
                                     FUNCTION PROTOTYPES
==================================================================================================*/


#ifdef __cplusplus
}
#endif

#endif  /* ICU_SIU_TYPES */
/** @} */
