/**
*   @file    Adc_CfgDefines.h
*   @version 1.0.0
*
*   @brief   AUTOSAR Adc - Module configuration interface for Adc driver.
*   @details Contains the module configuration interface 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.
==================================================================================================*/
/*==================================================================================================
==================================================================================================*/

#ifndef ADC_CFG_DEFINES_H
#define ADC_CFG_DEFINES_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.
*
*/

/*==================================================================================================
*                                        INCLUDE FILES
* 1) system and project includes
* 2) needed interfaces from external units
* 3) internal and external interfaces from this unit
==================================================================================================*/

/*==================================================================================================
*                              SOURCE FILE VERSION INFORMATION
==================================================================================================*/
#define ADC_VENDOR_ID_CFG_DEFINES                       43
#define ADC_AR_RELEASE_MAJOR_VERSION_CFG_DEFINES        4
#define ADC_AR_RELEASE_MINOR_VERSION_CFG_DEFINES        3
#define ADC_AR_RELEASE_REVISION_VERSION_CFG_DEFINES     1
#define ADC_SW_MAJOR_VERSION_CFG_DEFINES                1
#define ADC_SW_MINOR_VERSION_CFG_DEFINES                0
#define ADC_SW_PATCH_VERSION_CFG_DEFINES                0

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


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


/*==================================================================================================
*                                      DEFINES AND MACROS
==================================================================================================*/
/**
* @brief          ADC unit 0 available
*/
#define ADC_UNIT_0  0U

/**
* @brief          ADC unit 1 available
*/
#define ADC_UNIT_1  1U

/**
* @brief          ADC unit 2 available
*/
#define ADC_UNIT_2  2U

/**
* @brief          ADC unit 3 available
*/
#define ADC_UNIT_3  3U


/**
* @brief          MHT functionality not activated.
*/
#define ADC_MULTIPLE_HARDWARE_TRIGGERS      (STD_OFF)

/** 
* @brief           Adds/removes ((STD_ON)/(STD_OFF)) the services Adc_EnableHardwareTrigger() and Adc_DisableHardwareTrigger() from the code.
*/
#define ADC_HW_TRIGGER_API                  (STD_OFF)

/** 
* @brief           Set mode api enabled/disabled ((STD_ON)/(STD_OFF)).
*/
#define ADC_SET_MODE_API                    (STD_OFF)

/** 
* @brief           Enables or disables limit checking feature in the ADC driver.
*/
#define ADC_ENABLE_LIMIT_CHECK              (STD_ON)

/** 
* @brief           Group notification mechanism is/isn't ((STD_ON)/(STD_OFF)) available at runtime.
*/
#define ADC_GRP_NOTIF_CAPABILITY            (STD_ON)

/** 
* @brief           Type of prioritization mechanism ADC_PRIORITY_HW, ADC_PRIORITY_HW_SW and ADC_PRIORITY_NONE.
*/
#define ADC_PRIORITY_HW                     0U
#define ADC_PRIORITY_HW_SW                  1U
#define ADC_PRIORITY_NONE                   2U

/** 
* @brief           Priority implementation.
*/
#define ADC_PRIORITY_IMPLEMENTATION         (ADC_PRIORITY_NONE)

/** 
* @brief           Type of alignment mechanism ADC_ALIGN_RIGHT, ADC_ALIGN_LEFT.
*/
#define ADC_ALIGN_RIGHT                     0U
#define ADC_ALIGN_LEFT                      1U

/** 
* @brief           Result Alignment.
*/
#define ADC_RESULT_ALIGNMENT                (ADC_ALIGN_RIGHT)

/** 
* @brief           Adc transfer type.
*/
#define ADC_DMA                             0U
#define ADC_INTERRUPT                       1U

/** 
* @brief         This is a timeout value which is used to wait till
*                  - the conversion is not aborted.
*                  - ADC hardware is not entered in power down state.
*                  - ADC hardware is not entered in idle state.
*/
#define ADC_TIMEOUT_COUNTER                 (0x0000ffffUL)

/** 
* @brief          Add/Remove One time setting of Conversion time resisters from Init() function.
*/
#define ADC_SET_ADC_CONV_TIME_ONCE          (STD_OFF)

/** 
* @brief          CMR Register is not supported by hardware
*/
#define ADC_CMR_REGISTER_NOT_SUPPORTED

/**
* @brief           This is a timeout value which is used to wait till the
*                  conversions pending in the CBuffer are not completed.
*/
#define ADC_CFG_CONV_TIMEOUT                 (0xffffUL)


/** 
* @brief           Max number of hw units - is 4 on Cobra.
*/
#define ADC_MAX_HW_UNITS                          (4U)

/**
 * @brief   Define the number of maximum channels
 */
/* #define ADC_MAXIMUM_HW_CHANNELS                   (255U) */

/** 
* @brief           Add/Remove Autosar Extension Adc_EnableChannel() and Adc_DisableChannel() api.
*/
#define ADC_ENABLE_CH_DISABLE_CH_NONAUTO_API      (STD_OFF)

/** 
* @brief           Get injected conversion status api enabled/disabled (STD_ON/STD_OFF).
*/
#define ADC_GET_INJECTED_CONVERSION_STATUS_API    (STD_OFF)

/** 
* @brief          Add/remove ((STD_ON)/(STD_OFF)) the service Adc_SetChannel() from the code.
*/
#define ADC_SETCHANNEL_API                        (STD_OFF)

/** 
* @brief          Add/Remove Autosar Extension Adc_SetClockMode().
*/
#define ADC_DUAL_CLOCK_MODE   (STD_OFF)

/** 
* @brief           Specifies for reducing the number of interrupts for streaming groups
*/
#define ADC_ENABLE_DOUBLE_BUFFERING  (STD_OFF)
/**
* @brief           Specifies to optimize conversions for hw triggered, one shot group.
*/
#define ADC_OPTIMIZE_ONESHOT_HW_TRIGGER      (STD_OFF)

/**
 * @brief           Add/Remove Autosar Extension Adc_ConfigureThreshold() api.
 */
#define ADC_ENABLE_CONFIGURE_THRESHOLD_NONAUTO_API      (STD_OFF)

/** 
* @brief          Add/remove ((STD_ON)/(STD_OFF)) the service Adc_Calibration() from the code.
*/
#define ADC_CALIBRATION         (STD_OFF)

/** 
* @brief          Add/remove ((STD_ON)/(STD_OFF)) the service Adc_SelfTest() from the code.
*/
#define ADC_SELF_TEST           (STD_OFF)

/**
* @brief  Switch to enable/disable the API for the PR-MCAL-3312, PR-MCAL-3313, PR-MCAL-3314, PR-MCAL-3315 and PR-MCAL-3316.
*/
#define CTUV2_ENABLE_TRIGGER_CONFIGURATION_APIS     (STD_OFF)

/** 
* @brief  Switch to enable/disable the API for the CPR-MCAL-726, CPR-MCAL-727, CPR-MCAL-728.
*/
#define ADC_ENABLE_CTU_CONTROL_MODE_API                 (STD_OFF)

/** 
* @brief  Switch to enable/disable the production error reporting.
*/
#define ADC_DISABLE_DEM_REPORT_ERROR_STATUS           (STD_OFF)

#define ADC_USER_MODE_REG_PROT_ENABLED      (STD_OFF)

   
/** 
* @brief          Development error detection enabled/disabled ((STD_ON)/(STD_OFF)).
*/
#define ADC_DEV_ERROR_DETECT                (STD_ON)

/** 
* @brief          Add/remove ((STD_ON)/(STD_OFF)) the service Adc_GetVersionInfo() from the code.
*/
#define ADC_VERSION_INFO_API                (STD_ON)

/** 
* @brief          Add/remove ((STD_ON)/(STD_OFF)) the service Adc_DeInit() from the code.
*/
#define ADC_DEINIT_API                      (STD_ON)

/** 
* @brief          Add/remove ((STD_ON)/(STD_OFF)) the services Adc_StartGroupConversion()and Adc_StopGroupConversion() from the code.
*/
#define ADC_ENABLE_START_STOP_GROUP_API     (STD_ON)

/** 
* @brief          Add/Remove the services Adc_ReadGroup() from the code.
*/
#define ADC_READ_GROUP_API                  (STD_ON)

/** 
* @brief          This switch is used to enable the hardware trigger Autosar Extension API.
*/
#define ADC_ENABLE_CTUTRIG_NONAUTO_API       (STD_OFF)

/**
* @brief   Switch to enable that power state mode is supported
*
*/
#define ADC_POWER_STATE_SUPPORTED            (STD_OFF)

/**
* @brief   Enable/Disable the asynchronous power mode
*
*/
#define ADC_POWER_STATE_ASYNCH_MODE_SUPPORTED (STD_OFF)

/** 
* @brief           This switch is used to enable the queue.
*/
#define ADC_ENABLE_QUEUING                  (STD_ON)


/** 
* @brief           Maximum number of channels across all hardware units.
*/
#define ADC_MAX_CHANNEL_PER_HW_UNIT         1

/** 
* @brief           EQADC A symbolic name definition
*/
#define ADC_EQADC_A     (0U)

/** 
* @brief           EQADC B symbolic name definition.
*/
#define ADC_EQADC_B     (1U)

/**
* @brief          Maximum eQADC.
*/
#define ADC_EQADC_MAX_U8                     (2U)

/**
* @brief          max number of FIFO available on ADC.
*/
#define ADC_EQADC_MAX_FIFO_U8                (6U)

/**
* @brief          FIFOs in ADC.
*/
#define ADC_FIFO_0                           (0U)
#define ADC_FIFO_1                           (1U)
#define ADC_FIFO_2                           (2U)
#define ADC_FIFO_3                           (3U)
#define ADC_FIFO_4                           (4U)
#define ADC_FIFO_5                           (5U)

/**
* @brief          max number of command FIFOs available on ADC.
*/
#define ADC_MAX_COMMAND_FIFO_U8              (6U)

/**
* @brief          max number of result FIFOs available on ADC.
*/
#define ADC_MAX_RESULT_FIFO_U8               (6U)



/** 
* @brief           Enable/Disable the eQADC_A FIFO0.
*/
#define ADC_EQADC_A_FIFO0_ENABLED   (STD_ON)
/** 
* @brief           Enable/Disable the eQADC_A FIFO1.
*/
#define ADC_EQADC_A_FIFO1_ENABLED   (STD_OFF)
/** 
* @brief           Enable/Disable the eQADC_A FIFO2.
*/
#define ADC_EQADC_A_FIFO2_ENABLED   (STD_OFF)
/** 
* @brief           Enable/Disable the eQADC_A FIFO3.
*/
#define ADC_EQADC_A_FIFO3_ENABLED   (STD_OFF)
/** 
* @brief           Enable/Disable the eQADC_A FIFO4.
*/
#define ADC_EQADC_A_FIFO4_ENABLED   (STD_OFF)
/** 
* @brief           Enable/Disable the eQADC_A FIFO5.
*/
#define ADC_EQADC_A_FIFO5_ENABLED   (STD_OFF)
/** 
* @brief           Enable/Disable the CFIFO and RFIFO.
*/

#define ADC_EQADC_A_CFIFO_ENABLED   (STD_ON)
#define ADC_EQADC_A_RFIFO_ENABLED   (STD_ON)

/** 
* @brief           Enable/Disable the eQADC_B FIFO0.
*/
#define ADC_EQADC_B_FIFO0_ENABLED   (STD_OFF)
/** 
* @brief           Enable/Disable the eQADC_B FIFO1.
*/
#define ADC_EQADC_B_FIFO1_ENABLED   (STD_OFF)
/** 
* @brief           Enable/Disable the eQADC_B FIFO2.
*/
#define ADC_EQADC_B_FIFO2_ENABLED   (STD_OFF)
/** 
* @brief           Enable/Disable the eQADC_B FIFO3.
*/
#define ADC_EQADC_B_FIFO3_ENABLED   (STD_OFF)
/** 
* @brief           Enable/Disable the eQADC_B FIFO4.
*/
#define ADC_EQADC_B_FIFO4_ENABLED   (STD_OFF)
/** 
* @brief           Enable/Disable the eQADC_B FIFO5.
*/
#define ADC_EQADC_B_FIFO5_ENABLED   (STD_OFF)
/** 
* @brief           Enable/Disable the CFIFO and RFIFO.
*/
#define ADC_EQADC_B_CFIFO_ENABLED   (STD_OFF)
#define ADC_EQADC_B_RFIFO_ENABLED   (STD_OFF)

/** 
* @brief           Symbolic names of ADC Hardware units.
*/
#define  AdcHwUnit_0                      (0)

/** 
* @brief           Software injected conversion use
*/
#define ADC_SOFTWARE_INJECTED_CONVERSIONS_USED          (STD_OFF)

/** 
* @brief           Hardware normal conversion use
*/
#define ADC_HARDWARE_NORMAL_CONVERSIONS_USED            (STD_OFF)

/** 
* @brief           ADC Hardware unit macro for register access.
*
*/
#define ADC_HW_UNITS(unit)                  (Adc_pCfgPtr->Misc.au8Adc_HwUnit[(unit)])

/**
* @brief          Adc channel id.
*/
#define ADC_ID_CHANNEL_U8(Id)            ((uint8)(Id))

/**
* @brief          macros to simplify access to structures.
* @details        Streaming number of samples
*/
#define ADC_STREAMING_NUM_SAMPLES(num)      ((Adc_StreamNumSampleType)(num))

/**
* @brief          Configured hardware unit of the group.
*/
#if (ADC_MAX_HW_UNITS == 1U)
  #define Adc_GroupUnit(group)              0U
#else
  #define Adc_GroupUnit(group)              (Adc_pCfgPtr->pGroups[(group)].HwUnit)
#endif /* (ADC_MAX_HW_UNITS == 1U) */

/**
* @brief          Adc group priority.
*/
#define ADC_GROUP_PRIORITY(Priority)        ((Adc_GroupPriorityType)(Priority))

/**
* @brief          Adc hardware trigger source configured for the group.
*/
#define Adc_GroupTriggerSource(group,pos)   (Adc_pCfgPtr->pGroups[(group)].pHwResource[(pos)])

#if (ADC_PRIORITY_IMPLEMENTATION != ADC_PRIORITY_NONE)
/**
* @brief          Adc priority assigned to the group.
*/
#define Adc_GroupPriority(group)          (Adc_pCfgPtr->pGroups[(group)].Priority)
#endif /* ((ADC_PRIORITY_IMPLEMENTATION != ADC_PRIORITY_NONE)) */

/**
* @brief          Maximum boundary for the Adc_QueueIndexType.
*/
#define ADC_QUEUE_INDEX_TYPE_MAXIMUM          (65535U)

/**
* @brief          Check for continuous channels in group is not needed
*/
#define ADC_SKIP_DMA_CONTINUOUS_CHECK

/**
 * @brief       Invalid EXT/TST <-> INT CH mapping
 */
#define ADC_NO_EXT_TEST_CH_MAPPING            (255U)

/** 
* @brief           max queue depth configured across all configset.
*/
#define ADC_QUEUE_MAX_DEPTH_MAX             (1U)


/** 
* @brief           max number of channels in one group across all configset.
*/
#define ADC_MAX_GROUP_CHANNELS              1U

/** 
* @brief           max number of groups configured across all configset.
*/
#define ADC_MAX_GROUPS                      1U

/** 
* @brief           Invalid group Id definition.
*/
#define ADC_INVALID_GROUPS_ID               (0xFFFFU)

/** 
* @brief           Defined to check the hardware triggered groups available in Hw Queue.
* @details         Defined to check the hardware triggered groups available in Hw Queue.
*/
#define ADC_HW_QUEUE                        (1U)

/** 
* @brief           AUTOSAR Symbolic names of channels on all HW units.
*/

#define AdcChannel_0                       0

/** 
* @brief           Symbolic names of groups.
*/

#define AdcGroup_0                       0

/** 
* @brief           Symbolic names of groups - ecuc 2108 compliant.
*/

#define AdcConf_AdcGroup_AdcGroup_0                       0

/** 
* @brief           Adc Autosar Extension Enable/Disable invalid group index.
*/
#if (ADC_ENABLE_CH_DISABLE_CH_NONAUTO_API == STD_ON)
#define ADC_ENABLE_CH_DISABLE_CH_INVALID_GROUP_INDEX   ((Adc_GroupType)0xFFFF)
#endif /* ADC_ENABLE_CH_DISABLE_CH_NONAUTO_API == STD_ON */

/** 
* @brief            Support for User mode.
*                   STD_ON: the Adc driver can be executed from both supervisor and user mode. 
*                   STD_OFF: the Adc driver can be executed only from supervisor mode. 
*/
#define ADC_ENABLE_USER_MODE_SUPPORT     (STD_OFF)

#ifndef MCAL_ENABLE_USER_MODE_SUPPORT
 #ifdef ADC_ENABLE_USER_MODE_SUPPORT
  #if (STD_ON == ADC_ENABLE_USER_MODE_SUPPORT)
   #error MCAL_ENABLE_USER_MODE_SUPPORT is not enabled. For running  ADC in user mode the MCAL_ENABLE_USER_MODE_SUPPORT needs to be defined.
  #endif /* (STD_ON == ADC_ENABLE_USER_MODE_SUPPORT) */
 #endif /* ifndef ADC_ENABLE_USER_MODE_SUPPORT */
#endif /* ifndef MCAL_ENABLE_USER_MODE_SUPPORT*/
/*==================================================================================================
*                                             ENUMS
==================================================================================================*/


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


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


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

#ifdef __cplusplus
}
#endif

#endif /* ADC_CFG_DEFINES_H */

/** @} */
