/**
*   @file    Adc_PBcfg.c
*   @version 1.0.0
*
*   @brief   AUTOSAR Adc - Post Build configuration Adc source file.
*   @details Post Build configuration file for Adc driver.
*
*   @addtogroup ADC
*   @{
*/
/*==================================================================================================
*   Project              : AUTOSAR 4.3 MCAL
*   Platform             : PA
*   Peripheral           : EQADC
*   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.
==================================================================================================*/
/*==================================================================================================
==================================================================================================*/

#ifdef __cplusplus
extern "C"{
#endif

/**
* @page misra_violations MISRA-C:2012 violations
*
* @section Adc_PBcfg_c_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
*          Adc_MemMap.h is as per AUTOSAR requirement [SWS_MemMap_00003].
*
* @section Adc_PBcfg_c_REF_2
*          Violates MISRA 2012 Advisory Rule 20.1, #include directives should only be preceded by preprocessor
*          directives or comments. Adc_MemMap.h is included after each section define in order to set the current
*          memory section as defined by AUTOSAR
*
* @section Adc_PBcfg_c_REF_3
*          Violates MISRA 2012 Required Rule 8.5, An external object or function shall be declared once in one and only one file.
*          This object is defined by user and driver has no control over where it will be defined.
*
* @section Adc_PBcfg_c_REF_4
*          Violates MISRA 2012 Advisory Rule 8.9, An object should be defined at block scope if its identifier only appears in a single function.
*          This constant needs external linkage if threshold watchdog feature is enabled in the configuration.
*
* @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.
*
*/

/*==================================================================================================
*                                        INCLUDE FILES
* 1) system and project includes
* 2) needed interfaces from external units
* 3) internal and external interfaces from this unit
==================================================================================================*/
#include "Adc.h"
#include "Adc_Reg_eSys_Eqadc.h"


/*==================================================================================================
*                              SOURCE FILE VERSION INFORMATION
==================================================================================================*/
#define ADC_VENDOR_ID_PBCFG_C                    43
#define ADC_AR_RELEASE_MAJOR_VERSION_PBCFG_C     4
#define ADC_AR_ERLEASE_MINOR_VERSION_PBCFG_C     3
#define ADC_AR_RELEASE_REVISION_VERSION_PBCFG_C  1
#define ADC_SW_MAJOR_VERSION_PBCFG_C             1
#define ADC_SW_MINOR_VERSION_PBCFG_C             0
#define ADC_SW_PATCH_VERSION_PBCFG_C             0

/*==================================================================================================
*                                     FILE VERSION CHECKS
==================================================================================================*/
/* Check if source file and ADC header file are of the same vendor */
#if (ADC_VENDOR_ID_PBCFG_C != ADC_VENDOR_ID)
    #error "Adc_PBcfg.c and Adc.h have different vendor ids"
#endif

/* Check if source file and ADC header file are of the same Autosar version */
#if ((ADC_AR_RELEASE_MAJOR_VERSION_PBCFG_C != ADC_AR_RELEASE_MAJOR_VERSION) || \
     (ADC_AR_ERLEASE_MINOR_VERSION_PBCFG_C != ADC_AR_RELEASE_MINOR_VERSION) || \
     (ADC_AR_RELEASE_REVISION_VERSION_PBCFG_C != ADC_AR_RELEASE_REVISION_VERSION) \
    )
    #error "AutoSar Version Numbers of Adc_PBcfg.c and Adc.h are different"
#endif

/* Check if source file and ADC header file are of the same Software version */
#if ((ADC_SW_MAJOR_VERSION_PBCFG_C != ADC_SW_MAJOR_VERSION) || \
     (ADC_SW_MINOR_VERSION_PBCFG_C != ADC_SW_MINOR_VERSION) || \
     (ADC_SW_PATCH_VERSION_PBCFG_C != ADC_SW_PATCH_VERSION) \
    )
    #error "Software Version Numbers of Adc_PBcfg.c and Adc.h are different"
#endif

/* Check if source file and Adc_Reg_eSys_Eqadc header file are of the same vendor */
#if (ADC_VENDOR_ID_PBCFG_C != ADC_VENDOR_ID_REG)
    #error "Adc_PBcfg.c and Adc_Reg_eSys_Eqadc.h have different vendor ids"
#endif

/* Check if source file and Adc_Reg_eSys_Eqadc header file are of the same Autosar version */
#if ((ADC_AR_RELEASE_MAJOR_VERSION_PBCFG_C != ADC_AR_RELEASE_MAJOR_VERSION_REG) || \
     (ADC_AR_ERLEASE_MINOR_VERSION_PBCFG_C != ADC_AR_RELEASE_MINOR_VERSION_REG) || \
     (ADC_AR_RELEASE_REVISION_VERSION_PBCFG_C != ADC_AR_RELEASE_REVISION_VERSION_REG) \
    )
    #error "AutoSar Version Numbers of Adc_PBcfg.c and Adc_Reg_eSys_Eqadc.h are different"
#endif

/* Check if source file and Adc_Reg_eSys_Eqadc header file are of the same Software version */
#if ((ADC_SW_MAJOR_VERSION_PBCFG_C != ADC_SW_MAJOR_VERSION_REG) || \
     (ADC_SW_MINOR_VERSION_PBCFG_C != ADC_SW_MINOR_VERSION_REG) || \
     (ADC_SW_PATCH_VERSION_PBCFG_C != ADC_SW_PATCH_VERSION_REG) \
    )
    #error "Software Version Numbers of Adc_PBcfg.c and Adc_Reg_eSys_Eqadc.h are different"
#endif
/*==================================================================================================
                                           DEFINES AND MACROS
==================================================================================================*/

/** 
* @brief           Number of channels configured for each group.
*/

#define ADC_CFGSET_GROUP_0_CHANNELS      1
/*==================================================================================================
*                          LOCAL TYPEDEFS (STRUCTURES, UNIONS, ENUMS)
==================================================================================================*/

/*==================================================================================================
*                                       LOCAL MACROS
==================================================================================================*/
/**
* @brief          Total number of groups in Config.
*
*/
#define ADC_GROUPS           1


/*==================================================================================================
*                                       GLOBAL FUNCTIONS
==================================================================================================*/
#define ADC_START_SEC_CODE
/** @violates @ref Adc_PBcfg_c_REF_1 Precautions shall be taken in order to prevent the contents of a header file being included more than once. */
/** @violates @ref Adc_PBcfg_c_REF_2 #include directives should only be preceded by preprocessor directives or comments. */
#include "Adc_MemMap.h"

/**
* @brief         ADC Notification functions.
* @details       ADC Nofification functions defined inside the Plugin.
*
*/


#define ADC_STOP_SEC_CODE
/** @violates @ref Adc_PBcfg_c_REF_1 Precautions shall be taken in order to prevent the contents of a header file being included more than once. */
/** @violates @ref Adc_PBcfg_c_REF_2 #include directives should only be preceded by preprocessor directives or comments. */
#include "Adc_MemMap.h"

/*==================================================================================================
*                                      LOCAL CONSTANTS
==================================================================================================*/
#define ADC_START_SEC_CONFIG_DATA_UNSPECIFIED
/** @violates @ref Adc_PBcfg_c_REF_1 Precautions shall be taken in order to prevent the contents of a header file being included more than once. */
/** @violates @ref Adc_PBcfg_c_REF_2 #include directives should only be preceded by preprocessor directives or comments. */
#include "Adc_MemMap.h"

/**
* @brief          Group Assignments on ADC Hardware unit 0.
*
*/
static CONST(Adc_ChannelType, ADC_CONST) Adc_Group0_Assignment_0[ADC_CFGSET_GROUP_0_CHANNELS] =
{
    0U
};
/**
* @brief          Group Assignments on ADC Hardware unit 1.
*
*/
/**
* @brief          Group Assignments on ADC Hardware unit 2.
*
*/
/**
* @brief          Group Assignments on ADC Hardware unit 3.
*
*/


/**
* @brief          Definition of ADC Hw units for Configuration variant .
*/
static CONST(Adc_Eqadc_HwUnitConfigurationType, ADC_CONST) Adc_HwUnitCfg[] =
{
    /**< @brief Hardware Unit ADC0 */
    {
        /**< @brief Hardware unit id */
        (Adc_HwUnitType)0,
        (EQADC_ADC_EN_U16| EQADC_ADC_CLK_PS_2_U8),
        /**< @brief Adc resolution */
        ADC_BITS_RESOLUTION_12_U8
#if (ADC_CALIBRATION == STD_ON)
        ,
        (boolean)FALSE /**< @brief calibration is/isn't performed  */
#endif /* (ADC_CALIBRATION == STD_ON) */
#if (ADC_DUAL_CLOCK_MODE == STD_ON)
        ,
        (EQADC_ADC_EN_U16| EQADC_ADC_CLK_PS_31_U8)
#endif /* (ADC_DUAL_CLOCK_MODE == STD_ON) */

    }
};


/**
* @brief          Definition of channels on ADC Hardware unit for configuration variant .
* @details        Array of conversion command messages
*/
static CONST(Adc_Eqadc_ChannelConfigurationType, ADC_CONST) Adc_ChannelsCfg_0[] =
{

    /**< @brief Hardware Unit ADC0  --  AN_0 */
    {
        /**< @brief Adc channel's command */
        (uint32)(EQADC_ADC_CONV_COM_BN0_U32  | EQADC_ADC_128_CLOCK_CYCLES_U32| EQADC_ADC_CONV_COM_FMT_RJU_U32 | ((uint32)ADC_ID_CHANNEL_U8(0)<<8U) | (uint32)EQADC_12BIT_RES_CONFIG_SEL_U16)
    }
};


#define ADC_STOP_SEC_CONFIG_DATA_UNSPECIFIED
/** @violates @ref Adc_PBcfg_c_REF_1 Precautions shall be taken in order to prevent the contents of a header file being included more than once. */
/** @violates @ref Adc_PBcfg_c_REF_2 #include directives should only be preceded by preprocessor directives or comments. */
#include "Adc_MemMap.h"

/*==================================================================================================
*                                      LOCAL VARIABLES
==================================================================================================*/
#define ADC_START_SEC_VAR_INIT_UNSPECIFIED
/** @violates @ref Adc_PBcfg_c_REF_1 Precautions shall be taken in order to prevent the contents of a header file being included more than once. */
/** @violates @ref Adc_PBcfg_c_REF_2 #include directives should only be preceded by preprocessor directives or comments. */
#include "Adc_MemMap.h"
/**
* @brief          Adc Result Buffer RAM initializations.
* @details        Array for all ADC group result ram buffers.
*/
static P2VAR(Adc_ValueGroupType, ADC_VAR, ADC_APPL_DATA) Adc_ResultsBufferPtr[] =
{
    NULL_PTR
};


/**
* @brief          Definition of channels's pointer structure .
*
*/
static P2CONST(Adc_Eqadc_ChannelConfigurationType, ADC_VAR, ADC_APPL_CONST) Adc_ChannelsCfg[] =
{
    Adc_ChannelsCfg_0,
    NULL_PTR,
    NULL_PTR,
    NULL_PTR
};


#define ADC_STOP_SEC_VAR_INIT_UNSPECIFIED
/** @violates @ref Adc_PBcfg_c_REF_1 Precautions shall be taken in order to prevent the contents of a header file being included more than once. */
/** @violates @ref Adc_PBcfg_c_REF_2 #include directives should only be preceded by preprocessor directives or comments. */
#include "Adc_MemMap.h"

/*==================================================================================================
*                                      GLOBAL CONSTANTS
==================================================================================================*/
#define ADC_START_SEC_CONFIG_DATA_UNSPECIFIED
/** @violates @ref Adc_PBcfg_c_REF_1 Precautions shall be taken in order to prevent the contents of a header file being included more than once. */
/** @violates @ref Adc_PBcfg_c_REF_2 #include directives should only be preceded by preprocessor directives or comments. */
#include "Adc_MemMap.h"


/**
* @brief          Definition of all ADC groups .
*/
static CONST(Adc_GroupConfigurationType, ADC_CONST) Adc_GroupsCfg[] =
{
    /**< @brief Group0 -- Hardware Unit ADC0 */
    {
        /**< @brief Hardware unit configured */
        (Adc_HwUnitType)0,
        /**< @brief Access mode */
        ADC_ACCESS_MODE_SINGLE,
        /**< @brief Conversion mode */
        ADC_CONV_MODE_ONESHOT,
        /**< @brief Conversion type */
        ADC_CONV_TYPE_NORMAL,
#if (ADC_PRIORITY_IMPLEMENTATION != ADC_PRIORITY_NONE)
        /**< @brief  Priority configured */
        ADC_GROUP_PRIORITY(0U),
#endif /* (ADC_PRIORITY_IMPLEMENTATION != ADC_PRIORITY_NONE) */
        /**< @brief Replacement mode */
        ADC_GROUP_REPL_ABORT_RESTART,
        /**< @brief Trigger source configured */
        ADC_TRIGG_SRC_SW,
#if (STD_ON==ADC_HW_TRIGGER_API)
        /**< @brief Hardware trigger signal */
        ADC_HW_TRIG_RISING_EDGE,
        /**< @brief Hardware resource for the group */
        NULL_PTR,
#endif /* (STD_ON==ADC_HW_TRIGGER_API) */
#if (STD_ON==ADC_GRP_NOTIF_CAPABILITY)
        /**< @brief Notification function */
        NULL_PTR,
#endif /* (STD_ON==ADC_GRP_NOTIF_CAPABILITY) */
        /**< @brief CFIFO used for group */
        0U,
        /**< @brief ADC Group Result Buffers RAM array */
        Adc_ResultsBufferPtr,
        /**< @brief Group Streaming Buffer Mode */
        ADC_STREAM_BUFFER_LINEAR,
        /**< @brief Number of streaming samples */
        ADC_STREAMING_NUM_SAMPLES(1),
        /**< @brief Channels assigned to the group */
        Adc_Group0_Assignment_0,
        /**< @brief Number of channels in the group */
        (Adc_ChannelIndexType)ADC_CFGSET_GROUP_0_CHANNELS,
        /**< @brief Enables or Disables the ADC and DMA interrupts */
        (uint8)STD_OFF
#ifdef ADC_ENABLE_DOUBLE_BUFFERING
#if (STD_ON == ADC_ENABLE_DOUBLE_BUFFERING)
        ,
        /**< @brief Enables or Disables the ADC double buffering feature */
        (boolean)STD_OFF,
        /**< @brief Enable/disable half interrupt for group with double bufferring*/
        (boolean)STD_OFF
#endif /* (STD_ON == ADC_ENABLE_DOUBLE_BUFFERING) */
#endif /* define ADC_ENABLE_DOUBLE_BUFFERING */
    }
};


/**
* @brief          ADC driver Configuration structure .
*/
/** @violates @ref Adc_PBcfg_c_REF_4 An object should be defined at block scope if its identifier
*only appears in a single function.*/
CONST(Adc_ConfigType, ADC_CONST) AdcConfigSet_0 =
{
    /**< @brief pointer to Hw unit configurations */
    Adc_HwUnitCfg,
    /**< @brief pointer to group configurations */
    Adc_GroupsCfg,
    /**< @brief pointer to channel configurations */
    Adc_ChannelsCfg,
    /**< @brief total number of groups */
    (Adc_GroupType)ADC_GROUPS,
    /**< @brief Miscellaneous configuration parameters. - Adc_Eqadc_MultiConfigType */
    {
        {
            ADC_INTERRUPT,
            ADC_INTERRUPT,
            ADC_INTERRUPT,
            ADC_INTERRUPT

        },
        /**< @brief number of the maximum groups in the current configuration */
        1U,
        /**< @brief number of the maximum hardware units in the current configuration */
        1U,
#if(ADC_HW_TRIGGER_API == STD_ON)
        {
            /**< @brief low 8 bits of EQADC_ETDFR for EQADCA */
            0x5U,
            /**< @brief low 8 bits of EQADC_ETDFR for EQADCB */
            0x5U
        },
#endif
        {
            /**< @brief number of channels of the ADC Hardware unit 0 */
            1U,
            /**< @brief number of channels of the ADC Hardware unit 1 */
            0U,
            /**< @brief number of channels of the ADC Hardware unit 2 */
            0U,
            /**< @brief number of channels of the ADC Hardware unit 3 */
            0U
        },
        {
            /**< @brief ADC0 - ON/OFF */
            (uint8)STD_ON,
            /**< @brief ADC1 - ON/OFF */
            (uint8)STD_OFF,
            /**< @brief ADC2 - ON/OFF */
            (uint8)STD_OFF,
            /**< @brief ADC3 - ON/OFF */
            (uint8)STD_OFF
        },
        {
            /**< @brief First fifo of ADC0 */
            (uint8)ADC_FIFO_0,
            /**< @brief First fifo of ADC1 */
            (uint8)0U,
            /**< @brief First fifo of ADC2 */
            (uint8)0U,
            /**< @brief First fifo of ADC3 */
            (uint8)0U
        },
        {
            0U,
            255U,
            255U,
            255U
        }
    }
};


#define ADC_STOP_SEC_CONFIG_DATA_UNSPECIFIED
/** @violates @ref Adc_PBcfg_c_REF_1 Precautions shall be taken in order to prevent the contents of a header file being included more than once. */
/** @violates @ref Adc_PBcfg_c_REF_2 #include directives should only be preceded by preprocessor directives or comments. */
#include "Adc_MemMap.h"

/*==================================================================================================
*                                      GLOBAL VARIABLES
==================================================================================================*/

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

/*==================================================================================================
*                                       LOCAL FUNCTIONS
==================================================================================================*/

#ifdef __cplusplus
}
#endif

/** @} */

