/*!
* @file     Adc_Cfg.c
*
* @version  1.0.0
*
* @brief    This file includes the configuration parameters of the Port module.
*
*/

/*******************************************************************************
 * Project Name      : AUTOSAR MCAL
 * Platform          : Arm
 * Autosar Standard  : Classic Platform 4.4.0
 * Revision Number   :
 * Compiled Version  : G32A10xx_MCAL_1_0_0_30-April-25
 *
 * Copyright (C) 2026 Geehy Semiconductor
 *
 * You may not use this file except in compliance with the GEEHY COPYRIGHT NOTICE
 * (Geehy Semiconductor Software License Agreement).
 *
 * The program is only for reference, which is distributed in the hope that it
 * will be useful and instructional for customers to develop their software.
 * Unless required by applicable law or agreed to in writing, the program is
 * distributed on an "AS IS" BASIS, WITHOUT ANY WARRANTY OR CONDITIONS OF ANY
 * KIND, either express or implied. See the Geehy Semiconductor Software License Agreement for
 * the governing permissions and limitations under the License.
*
*******************************************************************************/

#ifdef __cplusplus
extern "C"{
#endif  /* ifdef __cplusplus */

#include "Adc.h"
/*******************************************************************************
                    VENDOR ID & AUTOSAR VERSION INFO
*******************************************************************************/
/** Vendor ID (vendorId) of the dedicated implementation of this module according to the AUTOSAR vendor list. */
#define ADC_CFG_VENDOR_ID                              0x00C1U
/** Major version number of AUTOSAR release on which the appropriate implementation is based on. */
#define ADC_CFG_AR_RELEASE_MAJOR_VERSION               0x04U
/** Minor version number of AUTOSAR release on which the appropriate implementation is based on. */
#define ADC_CFG_AR_RELEASE_MINOR_VERSION               0x04U
/** Revision version number of AUTOSAR release on which the appropriate implementation is based on. */
#define ADC_CFG_AR_RELEASE_REVISION_VERSION            0x00U
/** Major version number of the vendor specific implementation of the module. The numbering is vendor specific. */ 
#define ADC_CFG_SW_MAJOR_VERSION                       0x01U
/** Minor version number of the vendor specific implementation of the module. The numbering is vendor specific. */
#define ADC_CFG_SW_MINOR_VERSION                       0x00U
/** Patch level version number of the vendor specific implementation of the module. The numbering is vendor specific. */
#define ADC_CFG_SW_PATCH_VERSION                       0x00U

/*******************************************************************************
                             VERSION CHECK
*******************************************************************************/

extern void Adc_Notification_Group0(void); /* AdcGroup_0 */

/*******************************************************************************
                             GLOBAL VARIABLE
*******************************************************************************/
static P2VAR(Adc_ValueGroupType, ADC_VAR, ADC_APPL_DATA) Adc_ResultBuf_Pointer[] =
{
    NULL_PTR
};

#if (STD_ON == ADC_DMA_TRANSFER_MODE)

#define ADC_START_SEC_VAR_NO_INIT_UNSPECIFIED
#include "Adc_MemMap.h"

static uint16 g_adcDmaBuffer[ADC_CONFIG_GROUP0_CHANNEL_NUM];

#define ADC_STOP_SEC_VAR_NO_INIT_UNSPECIFIED
#include "Adc_MemMap.h"

P2VAR(Adc_ValueGroupType, ADC_VAR, ADC_APPL_DATA) Adc_DmaBuf_Pointer[] =
{
    g_adcDmaBuffer
};
#endif

CONST(Adc_GroupConfigType, PORT_CONST) g_adcGroupConfig[ADC_MAXIMUN_GROUPS_SET] =
{
    {
        .groupID = 0,
#if (STD_ON == ADC_PRIORITY_IMPLEMENTATION)
        .adcGroupPriority = 5,
        .enableNonPreemptable = FALSE,
#endif
        .accessModeCfg = 
        {
            .accessMode = ADC_ACCESS_MODE_SINGLE,
            .streamMode = ADC_STREAM_BUFFER_LINEAR,
            .streamNumSamples = ADC_GROUP0_NUMBER_OF_SAMPLES,
        },
        
        .channelCount = ADC_CONFIG_GROUP0_CHANNEL_NUM,
        .channelCfg[0] = {0,ADC_SAMPLE_TIME_239_5,ADC_CHANNEL_1},
        .channelCfg[1] = {1,ADC_SAMPLE_TIME_239_5,ADC_CHANNEL_2},
        .channelCfg[2] = {2,ADC_SAMPLE_TIME_239_5,ADC_CHANNEL_3},
        .channelCfg[3] = {3,ADC_SAMPLE_TIME_239_5,ADC_CHANNEL_4},
        .channelCfg[4] = {4,ADC_SAMPLE_TIME_239_5,ADC_CHANNEL_5},
        
        .selTrigger = ADC_TRIGG_SRC_SW,
        .selHwTriggerSignal = ADC_HW_TRIG_INVALID,
        .triggerEvent = ADC_EXT_TRIG_INVALID,
        
        .enableBack = DISABLE,
        .converMode = ADC_CONV_MODE_ONESHOT,
        .adcGroupResultBuffer = Adc_ResultBuf_Pointer,
        .adcGroupNotification = &Adc_Notification_Group0,
        
        .dataAlignment = ADC_ALIGN_LEFT,
        
#if (STD_ON == ADC_LIMIT_VALUE_DETECTION_ENABLE)
        .AnalogWatchdog = TRUE,
        .lowThreshold = 200,
        .highThreshold = 400,
#endif
    },
};



CONST(Adc_ConfigType, PORT_CONST) g_adcConfig =
{
    .adcSelect = 0,
    .adcClockSel = ADC_CLOCK_MODE_ASYNCLK,
    .dataResolution = ADC_RESOLUTION_12B,
    .selectTranMode = ADC_TRANS_MODE_INTERRUPT,
    .groupMaxNum = ADC_MAXIMUN_GROUPS_SET,
    .addGroupCfg = g_adcGroupConfig,
};


#ifdef __cplusplus
}
#endif  /* ifdef __cplusplus */

