MCUSW
ADC Handler and Driver API

Introduction

The ADC Driver MCAL provides low level access to ADC peripheral present on Device.
The ADC Driver implements a standardized interface specified in the AUTOSAR_SWS_ADCDriver document.

Only the following combinations of modes are supported:

Following combinations of modes are not supported:

See also
ADC Configuration

Sub Modules

 ADC Configuration
 

Data Structures

struct  Adc_GroupLogEntryType
 ADC log structure per group entry. More...
 

Functions

void Adc_Init (const Adc_ConfigType *CfgPtr)
 Service for ADC initialization. More...
 
void Adc_DeInit (void)
 This service sets all ADC HW Units to a state comparable to their power on reset state. More...
 
Std_ReturnType Adc_SetupResultBuffer (Adc_GroupType Group, const Adc_ValueGroupType *DataBufferPtr)
 This service initializes ADC driver with the group specific result buffer start address where the conversion results will be stored. More...
 
Adc_StatusType Adc_GetGroupStatus (Adc_GroupType Group)
 Returns the conversion status of the requested ADC Channel group. More...
 
Adc_StreamNumSampleType Adc_GetStreamLastPointer (Adc_GroupType Group, Adc_ValueGroupType **PtrToSamplePtr)
 Returns the number of valid samples per channel, stored in the result buffer. More...
 
void Adc_StartGroupConversion (Adc_GroupType Group)
 Starts the conversion of all channels of the requested ADC Channel group. More...
 
void Adc_StopGroupConversion (Adc_GroupType Group)
 Stops the conversion of the requested ADC Channel group. More...
 
Std_ReturnType Adc_ReadGroup (Adc_GroupType Group, Adc_ValueGroupType *DataBufferPtr)
 Reads the group conversion result of the last completed conversion round of the requested group and stores the channel values starting at the DataBufferPtr address. More...
 
void Adc_EnableGroupNotification (Adc_GroupType Group)
 Enables the notification mechanism for the requested ADC Channel group. More...
 
void Adc_DisableGroupNotification (Adc_GroupType Group)
 Disables the notification mechanism for the requested ADC Channel group. More...
 
void Adc_GetVersionInfo (Std_VersionInfoType *versioninfo)
 This service returns the version information of this module. More...
 
Std_ReturnType Adc_RegisterReadback (Adc_HWUnitType HWUnit, Adc_RegisterReadbackType *RegRbPtr)
 This function reads the important registers of the hardware unit and returns the value in the structure. More...
 
Std_ReturnType Adc_EnableInternalDiagnostic (Adc_GroupType Group, Adc_RefSelType RefSelect)
 This function enables the Functional Internal Diagnostic Debug mode and selects a known voltage source(REFP or VMID) that connects to the AFE. More...
 
Std_ReturnType Adc_DisableInternalDiagnostic (Adc_GroupType Group)
 This function disables the Functional Internal Diagnostic Debug mode. More...
 

Typedefs

typedef uint8 Adc_ChannelType
 Numeric ID of an ADC channel. More...
 
typedef uint8 Adc_GroupType
 Numeric ID of an ADC channel group. More...
 
typedef uint32 Adc_ValueGroupType
 Type for reading the converted values of a channel group (raw, without further scaling, right aligned). More...
 
typedef uint32 Adc_PrescaleType
 Type of clock prescaler factor. More...
 
typedef uint16 Adc_ConversionTimeType
 Type of conversion time, i.e. the time during which the sampled analogue value is converted into digital representation. More...
 
typedef uint16 Adc_SamplingTimeType
 Type of sampling time, i.e. the time during which the value is sampled (in clockcycles). More...
 
typedef uint8 Adc_ResolutionType
 Type of channel resolution in number of bits. More...
 
typedef uint8 Adc_GroupPriorityType
 Priority level of the channel. Lowest priority is 0. More...
 
typedef uint32 Adc_GroupDefType
 Type of assignment of channels to a channel group. More...
 
typedef uint16 Adc_StreamNumSampleType
 Type for configuring the number of group conversions in streaming access mode (in single access mode, parameter is 1). More...
 
typedef uint8 Adc_HwTriggerTimerType
 Type for the value of the ADC module embedded timer. More...
 
typedef uint8 Adc_HWUnitType
 Specifies the identification (ID) for a ADC Hardware microcontroller peripheral (unit) More...
 
typedef uint8 Adc_RefSelType
 Specifies the Reference select for functional internal diagnostic debug mode. More...
 

Macros

#define ADC_DEF_CHANNEL_RESOLUTION   ((uint8) 12U)
 The default channel resolution supported by the current ADC hardware. No other value is supported by the hardware. More...
 
#define ADC_NUM_CHANNEL   (10U)
 Number of MCAL channels - in terms of ADC HW, this represents the number of hardware steps. Note: In terms of ADC IP number of steps is 16. Due to AUTOSAR specification, the channel ID's should be unique i.e each channel Id and actual HW channel should have one to one mapping. So ADC_NUM_CHANNEL is fixed to 9 as number of actual HW channels available is also 9. More...
 
#define ADC_MIN_CHANNEL_ID   (0U)
 Minimum value of channel ID. More...
 
#define ADC_MAX_CHANNEL_ID   (ADC_NUM_CHANNEL - 1U)
 Maximum value of channel ID. More...
 
#define ADC_NUM_HW_CHANNEL   (10U)
 Number of actual HW channels - in terms of ADC HW, this represents the actual channel input to the ADC module. Note: This is a fixed value as per the ADC module and can't be changed. More...
 
#define ADC_MIN_HW_CHANNEL_ID   (0U)
 Minimum value of HW channel ID. More...
 
#define ADC_MAX_HW_CHANNEL_ID   (ADC_NUM_HW_CHANNEL - 1U)
 Maximum value of HW channel ID. More...
 
#define ADC_MIN_OPEN_DELAY   (0x00U)
 Minimum value of open delay. More...
 
#define ADC_MAX_OPEN_DELAY   (0x3FFFFU)
 Maximum value of open delay. More...
 
#define ADC_MIN_SAMPLE_DELAY   (0x00U)
 Minimum value of sample delay. More...
 
#define ADC_MAX_SAMPLE_DELAY   (0xFFU)
 Maximum value of sample delay. More...
 
#define ADC_MIN_RANGE   (0x00U)
 Minimum value of range. More...
 
#define ADC_MAX_RANGE   (0xFFFU)
 Maximum value of range. More...
 

ADC Driver Module SW Version Info

Defines for ADC Driver version used for compatibility checks

#define ADC_SW_MAJOR_VERSION   (9U)
 Driver Implementation Major Version. More...
 
#define ADC_SW_MINOR_VERSION   (0U)
 Driver Implementation Minor Version. More...
 
#define ADC_SW_PATCH_VERSION   (1U)
 Driver Implementation Patch Version. More...
 

ADC Driver Module AUTOSAR Version Info

Defines for ADC Driver AUTOSAR version used for compatibility checks

#define ADC_AR_RELEASE_MAJOR_VERSION   (4U)
 AUTOSAR Major version specification implemented by ADC Driver. More...
 
#define ADC_AR_RELEASE_MINOR_VERSION   (3U)
 AUTOSAR Minor version specification implemented by ADC Driver. More...
 
#define ADC_AR_RELEASE_REVISION_VERSION   (1U)
 AUTOSAR Patch version specification implemented by ADC Driver. More...
 

ADC Driver ID Info

#define ADC_VENDOR_ID   ((uint16) 44U)
 Texas Instruments Vendor ID. More...
 
#define ADC_MODULE_ID   ((uint16) 123U)
 ADC Driver Module ID. More...
 
#define ADC_INSTANCE_ID   ((uint8) 0U)
 ADC Driver Instance ID. More...
 

ADC Error Codes

Error codes returned by ADC functions

#define ADC_E_UNINIT   ((uint8) 0x0AU)
 API service used without module initiali-zation. More...
 
#define ADC_E_BUSY   ((uint8) 0x0BU)
 API service called during ongoing process. More...
 
#define ADC_E_IDLE   ((uint8) 0x0CU)
 API service called while no conversion is ongoing. More...
 
#define ADC_E_ALREADY_INITIALIZED   ((uint8) 0x0DU)
 API Adc_Init service called while the ADC driver has already been initialized. More...
 
#define ADC_E_PARAM_CONFIG   ((uint8) 0x0EU)
 API service called with incorrect configuration parameter. More...
 
#define ADC_E_PARAM_POINTER   ((uint8) 0x14U)
 API servcie called with invalid data buffer pointer. More...
 
#define ADC_E_PARAM_GROUP   ((uint8) 0x15U)
 API servcie called with invalid group ID. More...
 
#define ADC_E_WRONG_CONV_MODE   ((uint8) 0x16U)
 API servcie called on a group with conversion mode configured as continuous. More...
 
#define ADC_E_WRONG_TRIGG_SRC   ((uint8) 0x17U)
 API servcie called for group with wrong trigger source. More...
 
#define ADC_E_NOTIF_CAPABILITY   ((uint8) 0x18U)
 Enable/disable notification function for a group whose configuration set has no notification available. More...
 
#define ADC_E_BUFFER_UNINIT   ((uint8) 0x19U)
 Conversion started and result buffer pointer is not initialized. More...
 
#define ADC_E_NOT_DISENGAGED   ((uint8) 0x1AU)
 One or more ADC group/channel not in IDLE state. More...
 
#define ADC_E_POWER_STATE_NOT_SUPPORTED   ((uint8) 0x1BU)
 Unsupported power state request. More...
 
#define ADC_E_TRANSITION_NOT_POSSIBLE   ((uint8) 0x1CU)
 Requested power state can not be reached directly. More...
 
#define ADC_E_PERIPHERAL_NOT_PREPARED   ((uint8) 0x1DU)
 ADC not prepared for target power state. More...
 

ADC Service Ids

The Service Id is one of the argument to Det_ReportError function and is used to identify the source of the error

#define ADC_SID_INIT   ((uint8) 0x00U)
 Adc_Init() API Service ID. More...
 
#define ADC_SID_DEINIT   ((uint8) 0x01U)
 Adc_DeInit() API Service ID. More...
 
#define ADC_SID_START_GROUP_CONVERSION   ((uint8) 0x02U)
 Adc_StartGroupConversion() API Service ID. More...
 
#define ADC_SID_STOP_GROUP_CONVERSION   ((uint8) 0x03U)
 Adc_StopGroupConversion() API Service ID. More...
 
#define ADC_SID_READ_GROUP   ((uint8) 0x04U)
 Adc_ReadGroup() API Service ID. More...
 
#define ADC_SID_ENABLE_HARDWARE_TRIGGER   ((uint8) 0x05U)
 Adc_EnableHardwareTrigger() API Service ID. More...
 
#define ADC_SID_DISABLE_HARDWARE_TRIGGER   ((uint8) 0x06U)
 Adc_DisableHardwareTrigger() API Service ID. More...
 
#define ADC_SID_ENABLE_GROUP_NOTIFICATION   ((uint8) 0x07U)
 Adc_EnableGroupNotification() API Service ID. More...
 
#define ADC_SID_DISABLE_GROUP_NOTIFICATION   ((uint8) 0x08U)
 Adc_DisableGroupNotification() API Service ID. More...
 
#define ADC_SID_GET_GROUP_STATUS   ((uint8) 0x09U)
 Adc_GetGroupStatus() API Service ID. More...
 
#define ADC_SID_GET_VERSION_INFO   ((uint8) 0x0AU)
 Adc_GetVersionInfo() API Service ID. More...
 
#define ADC_SID_GET_STREAM_LAST_POINTER   ((uint8) 0x0BU)
 Adc_GetStreamLastPointer() API Service ID. More...
 
#define ADC_SID_SETUP_RESULT_BUFFER   ((uint8) 0x0CU)
 Adc_SetupResultBuffer() API Service ID. More...
 
#define ADC_SID_SET_POWER_STATE   ((uint8) 0x10U)
 Adc_SetPowerState() API Service ID. More...
 
#define ADC_SID_GET_CURRENT_POWER_STATE   ((uint8) 0x11U)
 Adc_GetCurrentPowerState() API Service ID. More...
 
#define ADC_SID_GET_TARGET_POWER_STATE   ((uint8) 0x12U)
 Adc_GetTargetPowerState() API Service ID. More...
 
#define ADC_SID_PREPARE_POWER_STATE   ((uint8) 0x13U)
 Adc_PreparePowerState() API Service ID. More...
 
#define ADC_SID_MAIN_POWER_TRANSITION_MANAGER   ((uint8) 0x14U)
 Adc_Main_PowerTransitionManager() API Service ID. More...
 
#define ADC_SID_IOHWAB_NOTIFICATION   ((uint8) 0x20U)
 IoHwAb_AdcNotification() API Service ID. More...
 
#define ADC_SID_IOHWAB_NOTIFY_READY_FOR_POWER_STATE   ((uint8) 0x70U)
 IoHwAb_Adc_NotifyReadyForPowerState() API Service ID. More...
 

Macro Definition Documentation

◆ ADC_SW_MAJOR_VERSION

#define ADC_SW_MAJOR_VERSION   (9U)

Driver Implementation Major Version.

◆ ADC_SW_MINOR_VERSION

#define ADC_SW_MINOR_VERSION   (0U)

Driver Implementation Minor Version.

◆ ADC_SW_PATCH_VERSION

#define ADC_SW_PATCH_VERSION   (1U)

Driver Implementation Patch Version.

◆ ADC_AR_RELEASE_MAJOR_VERSION

#define ADC_AR_RELEASE_MAJOR_VERSION   (4U)

AUTOSAR Major version specification implemented by ADC Driver.

◆ ADC_AR_RELEASE_MINOR_VERSION

#define ADC_AR_RELEASE_MINOR_VERSION   (3U)

AUTOSAR Minor version specification implemented by ADC Driver.

◆ ADC_AR_RELEASE_REVISION_VERSION

#define ADC_AR_RELEASE_REVISION_VERSION   (1U)

AUTOSAR Patch version specification implemented by ADC Driver.

◆ ADC_VENDOR_ID

#define ADC_VENDOR_ID   ((uint16) 44U)

Texas Instruments Vendor ID.

◆ ADC_MODULE_ID

#define ADC_MODULE_ID   ((uint16) 123U)

ADC Driver Module ID.

◆ ADC_INSTANCE_ID

#define ADC_INSTANCE_ID   ((uint8) 0U)

ADC Driver Instance ID.

◆ ADC_DEF_CHANNEL_RESOLUTION

#define ADC_DEF_CHANNEL_RESOLUTION   ((uint8) 12U)

The default channel resolution supported by the current ADC hardware. No other value is supported by the hardware.

◆ ADC_NUM_CHANNEL

#define ADC_NUM_CHANNEL   (10U)

Number of MCAL channels - in terms of ADC HW, this represents the number of hardware steps. Note: In terms of ADC IP number of steps is 16. Due to AUTOSAR specification, the channel ID's should be unique i.e each channel Id and actual HW channel should have one to one mapping. So ADC_NUM_CHANNEL is fixed to 9 as number of actual HW channels available is also 9.

◆ ADC_MIN_CHANNEL_ID

#define ADC_MIN_CHANNEL_ID   (0U)

Minimum value of channel ID.

◆ ADC_MAX_CHANNEL_ID

#define ADC_MAX_CHANNEL_ID   (ADC_NUM_CHANNEL - 1U)

Maximum value of channel ID.

◆ ADC_NUM_HW_CHANNEL

#define ADC_NUM_HW_CHANNEL   (10U)

Number of actual HW channels - in terms of ADC HW, this represents the actual channel input to the ADC module. Note: This is a fixed value as per the ADC module and can't be changed.

◆ ADC_MIN_HW_CHANNEL_ID

#define ADC_MIN_HW_CHANNEL_ID   (0U)

Minimum value of HW channel ID.

◆ ADC_MAX_HW_CHANNEL_ID

#define ADC_MAX_HW_CHANNEL_ID   (ADC_NUM_HW_CHANNEL - 1U)

Maximum value of HW channel ID.

◆ ADC_MIN_OPEN_DELAY

#define ADC_MIN_OPEN_DELAY   (0x00U)

Minimum value of open delay.

◆ ADC_MAX_OPEN_DELAY

#define ADC_MAX_OPEN_DELAY   (0x3FFFFU)

Maximum value of open delay.

◆ ADC_MIN_SAMPLE_DELAY

#define ADC_MIN_SAMPLE_DELAY   (0x00U)

Minimum value of sample delay.

◆ ADC_MAX_SAMPLE_DELAY

#define ADC_MAX_SAMPLE_DELAY   (0xFFU)

Maximum value of sample delay.

◆ ADC_MIN_RANGE

#define ADC_MIN_RANGE   (0x00U)

Minimum value of range.

◆ ADC_MAX_RANGE

#define ADC_MAX_RANGE   (0xFFFU)

Maximum value of range.

◆ ADC_E_UNINIT

#define ADC_E_UNINIT   ((uint8) 0x0AU)

API service used without module initiali-zation.

◆ ADC_E_BUSY

#define ADC_E_BUSY   ((uint8) 0x0BU)

API service called during ongoing process.

◆ ADC_E_IDLE

#define ADC_E_IDLE   ((uint8) 0x0CU)

API service called while no conversion is ongoing.

◆ ADC_E_ALREADY_INITIALIZED

#define ADC_E_ALREADY_INITIALIZED   ((uint8) 0x0DU)

API Adc_Init service called while the ADC driver has already been initialized.

◆ ADC_E_PARAM_CONFIG

#define ADC_E_PARAM_CONFIG   ((uint8) 0x0EU)

API service called with incorrect configuration parameter.

◆ ADC_E_PARAM_POINTER

#define ADC_E_PARAM_POINTER   ((uint8) 0x14U)

API servcie called with invalid data buffer pointer.

◆ ADC_E_PARAM_GROUP

#define ADC_E_PARAM_GROUP   ((uint8) 0x15U)

API servcie called with invalid group ID.

◆ ADC_E_WRONG_CONV_MODE

#define ADC_E_WRONG_CONV_MODE   ((uint8) 0x16U)

API servcie called on a group with conversion mode configured as continuous.

◆ ADC_E_WRONG_TRIGG_SRC

#define ADC_E_WRONG_TRIGG_SRC   ((uint8) 0x17U)

API servcie called for group with wrong trigger source.

◆ ADC_E_NOTIF_CAPABILITY

#define ADC_E_NOTIF_CAPABILITY   ((uint8) 0x18U)

Enable/disable notification function for a group whose configuration set has no notification available.

◆ ADC_E_BUFFER_UNINIT

#define ADC_E_BUFFER_UNINIT   ((uint8) 0x19U)

Conversion started and result buffer pointer is not initialized.

◆ ADC_E_NOT_DISENGAGED

#define ADC_E_NOT_DISENGAGED   ((uint8) 0x1AU)

One or more ADC group/channel not in IDLE state.

◆ ADC_E_POWER_STATE_NOT_SUPPORTED

#define ADC_E_POWER_STATE_NOT_SUPPORTED   ((uint8) 0x1BU)

Unsupported power state request.

◆ ADC_E_TRANSITION_NOT_POSSIBLE

#define ADC_E_TRANSITION_NOT_POSSIBLE   ((uint8) 0x1CU)

Requested power state can not be reached directly.

◆ ADC_E_PERIPHERAL_NOT_PREPARED

#define ADC_E_PERIPHERAL_NOT_PREPARED   ((uint8) 0x1DU)

ADC not prepared for target power state.

◆ ADC_SID_INIT

#define ADC_SID_INIT   ((uint8) 0x00U)

Adc_Init() API Service ID.

◆ ADC_SID_DEINIT

#define ADC_SID_DEINIT   ((uint8) 0x01U)

Adc_DeInit() API Service ID.

◆ ADC_SID_START_GROUP_CONVERSION

#define ADC_SID_START_GROUP_CONVERSION   ((uint8) 0x02U)

Adc_StartGroupConversion() API Service ID.

◆ ADC_SID_STOP_GROUP_CONVERSION

#define ADC_SID_STOP_GROUP_CONVERSION   ((uint8) 0x03U)

Adc_StopGroupConversion() API Service ID.

◆ ADC_SID_READ_GROUP

#define ADC_SID_READ_GROUP   ((uint8) 0x04U)

Adc_ReadGroup() API Service ID.

◆ ADC_SID_ENABLE_HARDWARE_TRIGGER

#define ADC_SID_ENABLE_HARDWARE_TRIGGER   ((uint8) 0x05U)

Adc_EnableHardwareTrigger() API Service ID.

◆ ADC_SID_DISABLE_HARDWARE_TRIGGER

#define ADC_SID_DISABLE_HARDWARE_TRIGGER   ((uint8) 0x06U)

Adc_DisableHardwareTrigger() API Service ID.

◆ ADC_SID_ENABLE_GROUP_NOTIFICATION

#define ADC_SID_ENABLE_GROUP_NOTIFICATION   ((uint8) 0x07U)

◆ ADC_SID_DISABLE_GROUP_NOTIFICATION

#define ADC_SID_DISABLE_GROUP_NOTIFICATION   ((uint8) 0x08U)

◆ ADC_SID_GET_GROUP_STATUS

#define ADC_SID_GET_GROUP_STATUS   ((uint8) 0x09U)

Adc_GetGroupStatus() API Service ID.

◆ ADC_SID_GET_VERSION_INFO

#define ADC_SID_GET_VERSION_INFO   ((uint8) 0x0AU)

Adc_GetVersionInfo() API Service ID.

◆ ADC_SID_GET_STREAM_LAST_POINTER

#define ADC_SID_GET_STREAM_LAST_POINTER   ((uint8) 0x0BU)

Adc_GetStreamLastPointer() API Service ID.

◆ ADC_SID_SETUP_RESULT_BUFFER

#define ADC_SID_SETUP_RESULT_BUFFER   ((uint8) 0x0CU)

Adc_SetupResultBuffer() API Service ID.

◆ ADC_SID_SET_POWER_STATE

#define ADC_SID_SET_POWER_STATE   ((uint8) 0x10U)

Adc_SetPowerState() API Service ID.

◆ ADC_SID_GET_CURRENT_POWER_STATE

#define ADC_SID_GET_CURRENT_POWER_STATE   ((uint8) 0x11U)

Adc_GetCurrentPowerState() API Service ID.

◆ ADC_SID_GET_TARGET_POWER_STATE

#define ADC_SID_GET_TARGET_POWER_STATE   ((uint8) 0x12U)

Adc_GetTargetPowerState() API Service ID.

◆ ADC_SID_PREPARE_POWER_STATE

#define ADC_SID_PREPARE_POWER_STATE   ((uint8) 0x13U)

Adc_PreparePowerState() API Service ID.

◆ ADC_SID_MAIN_POWER_TRANSITION_MANAGER

#define ADC_SID_MAIN_POWER_TRANSITION_MANAGER   ((uint8) 0x14U)

Adc_Main_PowerTransitionManager() API Service ID.

◆ ADC_SID_IOHWAB_NOTIFICATION

#define ADC_SID_IOHWAB_NOTIFICATION   ((uint8) 0x20U)

IoHwAb_AdcNotification() API Service ID.

◆ ADC_SID_IOHWAB_NOTIFY_READY_FOR_POWER_STATE

#define ADC_SID_IOHWAB_NOTIFY_READY_FOR_POWER_STATE   ((uint8) 0x70U)

IoHwAb_Adc_NotifyReadyForPowerState() API Service ID.

Typedef Documentation

◆ Adc_ChannelType

typedef uint8 Adc_ChannelType

Numeric ID of an ADC channel.

◆ Adc_GroupType

typedef uint8 Adc_GroupType

Numeric ID of an ADC channel group.

◆ Adc_ValueGroupType

typedef uint32 Adc_ValueGroupType

Type for reading the converted values of a channel group (raw, without further scaling, right aligned).

Note: Even though the resolution for this ADC HW is 10-bit, we set this to 32-bit integer as the register read access is 32-bit.

◆ Adc_PrescaleType

typedef uint32 Adc_PrescaleType

Type of clock prescaler factor.

◆ Adc_ConversionTimeType

typedef uint16 Adc_ConversionTimeType

Type of conversion time, i.e. the time during which the sampled analogue value is converted into digital representation.

◆ Adc_SamplingTimeType

typedef uint16 Adc_SamplingTimeType

Type of sampling time, i.e. the time during which the value is sampled (in clockcycles).

◆ Adc_ResolutionType

typedef uint8 Adc_ResolutionType

Type of channel resolution in number of bits.

◆ Adc_GroupPriorityType

typedef uint8 Adc_GroupPriorityType

Priority level of the channel. Lowest priority is 0.

◆ Adc_GroupDefType

typedef uint32 Adc_GroupDefType

Type of assignment of channels to a channel group.

◆ Adc_StreamNumSampleType

typedef uint16 Adc_StreamNumSampleType

Type for configuring the number of group conversions in streaming access mode (in single access mode, parameter is 1).

◆ Adc_HwTriggerTimerType

typedef uint8 Adc_HwTriggerTimerType

Type for the value of the ADC module embedded timer.

◆ Adc_HWUnitType

typedef uint8 Adc_HWUnitType

Specifies the identification (ID) for a ADC Hardware microcontroller peripheral (unit)

◆ Adc_RefSelType

typedef uint8 Adc_RefSelType

Specifies the Reference select for functional internal diagnostic debug mode.

Function Documentation

◆ Adc_Init()

void Adc_Init ( const Adc_ConfigType CfgPtr)

Service for ADC initialization.

*  Service name        : Adc_Init
*  Syntax              : void Adc_Init( const Adc_ConfigType* CfgPtr )
*  Mode                : Supervisor Mode (Privileged Mode)
*  Service ID[hex]     : 0x00
*  Sync/Async          : Synchronous
*  Reentrancy          : Non Reentrant
*  Parameters (in)     : Pointer to configuration set in Variant PB
*                        (Variant PC requires a NULL_PTR).
*  Parameters (inout)  : None
*  Parameters (out)    : None
*  Return value        : None
*  Description         : Initializes the ADC hardware units and driver
*  

◆ Adc_DeInit()

void Adc_DeInit ( void  )

This service sets all ADC HW Units to a state comparable to their power on reset state.

*  Service name        : Adc_DeInit
*  Syntax              : void Adc_DeInit(void)
*  Mode                : Supervisor Mode (Privileged Mode)
*  Service ID[hex]     : 0x01
*  Sync/Async          : Synchronous
*  Reentrancy          : Non Reentrant
*  Parameters (in)     : None
*  Parameters (inout)  : None
*  Parameters (out)    : None
*  Return value        : None
*  Description         : Returns all ADC HW Units to a state comparable to
*                        their power on reset state
*  

◆ Adc_SetupResultBuffer()

Std_ReturnType Adc_SetupResultBuffer ( Adc_GroupType  Group,
const Adc_ValueGroupType DataBufferPtr 
)

This service initializes ADC driver with the group specific result buffer start address where the conversion results will be stored.

*  Service name        : Adc_SetupResultBuffer
*  Syntax              : Std_ReturnType Adc_SetupResultBuffer(
*                                          Adc_GroupType Group,
*                                          Adc_ValueGroupType* DataBufferPtr)
*  Mode                : User Mode (Non-Privileged Mode)
*  Service ID[hex]     : 0x0C
*  Sync/Async          : Synchronous
*  Reentrancy          : Reentrant
*  Parameters (in)     : Group - Numeric ID of requested ADC channel group.
*                        DataBufferPtr - pointer to result data buffer
*  Parameters (inout)  : None
*  Parameters (out)    : None
*  Return value        : Std_ReturnType
*                        E_OK: result buffer pointer initialized correctly
*                        E_NOT_OK: operation failed or development error occured
*  Description         : Initializes ADC driver with the group specific result
*                        buffer start address where the conversion results
*                        will be stored. The application has to ensure that
*                        the application buffer, where DataBufferPtr points
*                        to, can hold all the conversion results of the
*                        specified group. The initialization with
*                        Adc_SetupResultBuffer is required after reset,
*                        before a group conversion can be started.
*  

◆ Adc_GetGroupStatus()

Adc_StatusType Adc_GetGroupStatus ( Adc_GroupType  Group)

Returns the conversion status of the requested ADC Channel group.

*  Service name        : Adc_GetGroupStatus
*  Syntax              : Adc_StatusType Adc_GetGroupStatus( Adc_GroupType Group )
*  Mode                : User Mode (Non-Privileged Mode)
*  Service ID[hex]     : 0x09
*  Sync/Async          : Synchronous
*  Reentrancy          : Reentrant
*  Parameters (in)     : Group - Numeric ID of requested ADC channel group.
*  Parameters (inout)  : None
*  Parameters (out)    : None
*  Return value        : Adc_StatusType - Conversion status for the requested
*                        group
*  Description         : Returns the conversion status of the requested ADC
*                        Channel group.
*  

◆ Adc_GetStreamLastPointer()

Adc_StreamNumSampleType Adc_GetStreamLastPointer ( Adc_GroupType  Group,
Adc_ValueGroupType **  PtrToSamplePtr 
)

Returns the number of valid samples per channel, stored in the result buffer.

*  Service name        : Adc_GetStreamLastPointer
*  Syntax              : Adc_StreamNumSampleType Adc_GetStreamLastPointer(
*                              Adc_GroupType Group,
*                              Adc_ValueGroupType** PtrToSamplePtr )
*  Mode                : User Mode (Non-Privileged Mode)
*  Service ID[hex]     : 0x0B
*  Sync/Async          : Synchronous
*  Reentrancy          : Reentrant
*  Parameters (in)     : Group - Numeric ID of requested ADC channel group.
*  Parameters (inout)  : None
*  Parameters (out)    : PtrToSamplePtr - Pointer to result buffer pointer.
*  Return value        : Adc_StreamNumSampleType - Number of valid samples
*                        per channel
*  Description         : Returns the number of valid samples per channel,
*                        stored in the result buffer. Reads a pointer,
*                        pointing to a position in the group result buffer.
*                        With the pointer position, the results of all group
*                        channels of the last completed conversion round can
*                        be accessed. With the pointer and the return value,
*                        all valid group conversion results can be accessed
*                        (the user has to take the layout of the result buffer
*                        into account).
*  

◆ Adc_StartGroupConversion()

void Adc_StartGroupConversion ( Adc_GroupType  Group)

Starts the conversion of all channels of the requested ADC Channel group.

*  Service name        : Adc_StartGroupConversion
*  Syntax              : void Adc_StartGroupConversion( Adc_GroupType Group )
*  Mode                : Supervisor Mode (Privileged Mode)
*  Service ID[hex]     : 0x02
*  Sync/Async          : Asynchronous
*  Reentrancy          : Reentrant
*  Parameters (in)     : Group - Numeric ID of requested ADC Channel group.
*  Parameters (inout)  : None
*  Parameters (out)    : None
*  Return value        : None
*  Description         : Starts the conversion of all channels of the
*                        requested ADC Channel group.
*  

◆ Adc_StopGroupConversion()

void Adc_StopGroupConversion ( Adc_GroupType  Group)

Stops the conversion of the requested ADC Channel group.

*  Service name        : Adc_StopGroupConversion
*  Syntax              : void Adc_StopGroupConversion( Adc_GroupType Group )
*  Mode                : Supervisor Mode (Privileged Mode)
*  Service ID[hex]     : 0x03
*  Sync/Async          : Synchronous
*  Reentrancy          : Reentrant
*  Parameters (in)     : Group - Numeric ID of requested ADC Channel group.
*  Parameters (inout)  : None
*  Parameters (out)    : None
*  Return value        : None
*  Description         : Stops the conversion of the requested ADC Channel
*                        group.
*  

◆ Adc_ReadGroup()

Std_ReturnType Adc_ReadGroup ( Adc_GroupType  Group,
Adc_ValueGroupType DataBufferPtr 
)

Reads the group conversion result of the last completed conversion round of the requested group and stores the channel values starting at the DataBufferPtr address.

*  Service name        : Adc_ReadGroup
*  Syntax              : Std_ReturnType Adc_ReadGroup(
*                              Adc_GroupType Group,
*                              Adc_ValueGroupType* DataBufferPtr )
*  Mode                : User Mode (Non-Privileged Mode)
*  Service ID[hex]     : 0x04
*  Sync/Async          : Synchronous
*  Reentrancy          : Reentrant
*  Parameters (in)     : Group - Numeric ID of requested ADC channel group.
*                        DataBufferPtr - ADC results of all channels of the
*                        selected group are stored in the data buffer
*                        addressed with the pointer
*  Parameters (inout)  : None
*  Parameters (out)    : None
*  Return value        : Std_ReturnType
*                        E_OK: results are available and written to the data buffer
*                        E_NOT_OK: no results are available or development error occured
*  Description         : Reads the group conversion result of the last
*                        completed conversion round of the requested group
*                        and stores the channel values starting at the
*                        DataBufferPtr address. The group channel values are
*                        stored in ascending channel number order (in contrast
*                        to the storage layout of the result buffer if
*                        streaming access is configured).
*  

◆ Adc_EnableGroupNotification()

void Adc_EnableGroupNotification ( Adc_GroupType  Group)

Enables the notification mechanism for the requested ADC Channel group.

*  Service name        : Adc_EnableGroupNotification
*  Syntax              : void Adc_EnableGroupNotification( Adc_GroupType Group )
*  Mode                : User Mode (Non-Privileged Mode)
*  Service ID[hex]     : 0x07
*  Sync/Async          : Synchronous
*  Reentrancy          : Reentrant
*  Parameters (in)     : Group - Numeric ID of requested ADC channel group.
*  Parameters (inout)  : None
*  Parameters (out)    : None
*  Return value        : None
*  Description         : Enables the notification mechanism for the requested
*                        ADC Channel group.
*  

◆ Adc_DisableGroupNotification()

void Adc_DisableGroupNotification ( Adc_GroupType  Group)

Disables the notification mechanism for the requested ADC Channel group.

*  Service name        : Adc_DisableGroupNotification
*  Syntax              : void Adc_DisableGroupNotification( Adc_GroupType Group )
*  Mode                : User Mode (Non-Privileged Mode)
*  Service ID[hex]     : 0x08
*  Sync/Async          : Synchronous
*  Reentrancy          : Reentrant
*  Parameters (in)     : Group - Numeric ID of requested ADC channel group.
*  Parameters (inout)  : None
*  Parameters (out)    : None
*  Return value        : None
*  Description         : Disables the notification mechanism for the requested
*                        ADC Channel group.
*  

◆ Adc_GetVersionInfo()

void Adc_GetVersionInfo ( Std_VersionInfoType *  versioninfo)

This service returns the version information of this module.

*  Service name        : Adc_GetVersionInfo
*  Syntax              : void Adc_GetVersionInfo( Std_VersionInfoType* versioninfo )
*  Mode                : User Mode (Non-Privileged Mode)
*  Service ID[hex]     : 0x0A
*  Sync/Async          : Synchronous
*  Reentrancy          : Reentrant
*  Parameters (in)     : None
*  Parameters (inout)  : None
*  Parameters (out)    : versioninfo - Pointer to where to store the version
*                        information of this module
*  Return value        : None
*  Description         : Returns the version information of this module
*  

◆ Adc_RegisterReadback()

Std_ReturnType Adc_RegisterReadback ( Adc_HWUnitType  HWUnit,
Adc_RegisterReadbackType RegRbPtr 
)

This function reads the important registers of the hardware unit and returns the value in the structure.

This API should be called after Adc_Init is called. Otherwise this API will return E_NOT_OK.

This API could be used to readback the register contents after Adc_Init and then the readback value could be compared during ADC execution to check the correctness of the HW unit. Since this API is used for this purpose, the register returned are the ones which doesn't change after init based on conv or channel config.

*  Service name        : Adc_RegisterReadback
*  Mode                : Supervisor Mode (Privileged Mode)
*  Sync/Async          : Synchronous
*  Reentrancy          : Reentrant
*  Parameters (in)     : HWUnit - ADC Hardware microcontroller peripheral
*                        unit ID. If this is invalid, then the API will
*                        return E_NOT_OK.
*  Parameters (inout)  : RegRbPtr - Pointer to where to store the readback
*                        values. If this pointer is NULL_PTR, then the API
*                        will return E_NOT_OK.
*  Return value        : Std_ReturnType
*                        E_OK: Register read back has been done
*                        E_NOT_OK: Register read back failed
*  

◆ Adc_EnableInternalDiagnostic()

Std_ReturnType Adc_EnableInternalDiagnostic ( Adc_GroupType  Group,
Adc_RefSelType  RefSelect 
)

This function enables the Functional Internal Diagnostic Debug mode and selects a known voltage source(REFP or VMID) that connects to the AFE.

*  Service name        : Adc_EnableInternalDiagnostic
*  Mode                : Supervisor Mode (Privileged Mode)
*  Sync/Async          : Synchronous
*  Reentrancy          : Reentrant
*  Parameters (in)     : Group - Numeric ID of requested ADC channel group.
*                        If this is invalid, then the API will return E_NOT_OK.
*                        RefSelect - Reference select for functional internal
*                        diagnostic debug mode.
*                        0 = VMID
*                        1 = REFP
*  Parameters (inout)  : None
*  Return value        : Std_ReturnType
*                        E_OK: Functional Internal Diagnostic Debug Mode
*                        has been enabled Successfully.
*                        E_NOT_OK: Functional Internal Diagnostic Debug Mode
*                        enable failed.
*  

◆ Adc_DisableInternalDiagnostic()

Std_ReturnType Adc_DisableInternalDiagnostic ( Adc_GroupType  Group)

This function disables the Functional Internal Diagnostic Debug mode.

*  Service name        : Adc_DisableInternalDiagnostic
*  Mode                : Supervisor Mode (Privileged Mode)
*  Sync/Async          : Synchronous
*  Reentrancy          : Reentrant
*  Parameters (in)     : Group - Numeric ID of requested ADC channel group.
*                        If this is invalid, then the API will return E_NOT_OK.
*  Parameters (inout)  : None
*  Return value        : Std_ReturnType
*                        E_OK: Functional Internal Diagnostic Debug Mode
*                        has been disabled Successfully.
*                        E_NOT_OK: Functional Internal Diagnostic Debug Mode
*                        disable failed.
*