XMC Peripheral Library for XMC4000 Family
2.1.16
|
Data Structures | |
struct | XMC_VADC_CHANNEL_CONFIG_t |
struct | XMC_VADC_DETAILED_RESULT_t |
struct | XMC_VADC_GLOBAL_CLASS_t |
struct | XMC_VADC_GLOBAL_CLOCK_t |
struct | XMC_VADC_GLOBAL_CONFIG_t |
struct | XMC_VADC_GROUP_CLASS_t |
struct | XMC_VADC_GROUP_CONFIG_t |
struct | XMC_VADC_GROUP_EMUXCFG_t |
struct | XMC_VADC_QUEUE_CONFIG_t |
struct | XMC_VADC_QUEUE_ENTRY_t |
struct | XMC_VADC_RESULT_CONFIG_t |
struct | XMC_VADC_SCAN_CONFIG_t |
Macros | |
#define | XMC_VADC_NUM_CHANNELS_PER_GROUP (8U) |
Typedefs | |
typedef XMC_VADC_SCAN_CONFIG_t | XMC_VADC_BACKGROUND_CONFIG_t |
typedef VADC_GLOBAL_TypeDef | XMC_VADC_GLOBAL_t |
typedef VADC_G_TypeDef | XMC_VADC_GROUP_t |
typedef uint16_t | XMC_VADC_RESULT_SIZE_t |
Enumerations |
Detailed Description
The XMC microcontroller provides a series of analog input channels connected to a cluster of Analog/Digital Converters using the Successive Approximation Register (SAR) principle to convert analog input values (voltages) to discrete digital values.
Each converter of the ADC cluster can operate independent of the others, controlled by a dedicated set of registers and triggered by a dedicated group request source. The results of each channel can be stored in a dedicated channel-specific result register or in a group-specific result register.
The Versatile Analog to Digital Converter module (VADC) of the XMC comprises a set of converter blocks that can be operated either independently or via a common request source that emulates a background converter. Each converter block is equipped with a dedicated input multiplexer and dedicated request sources, which together build separate groups.
The VADC LLD is split into GLOBAL and GROUP related APIs.
GLOBAL:
- Global APIs act on the entire ADC module. Configures global configuration registers
- Allows configuration of the background request source of the VADC.
- The clock related configurations for the VADC module are configured in the Global APIs/
- The Global API names are prefixed by the XMC_VADC_GLOBAL_ and they accept XMC_VADC_GLOBAL_t as one of its arguments.
- Configures the background request source of the VADC. The APIs which act on the background related registers are prefixed by XMC_VADC_GLOBAL_Background
- Configures the sample and hold unit of the VADC. The APIs which act on the SHS related registers are prefixed by XMC_VADC_GLOBAL_SHS_
GROUP:
- Group APIs act on a VADC group. Configures the group configuration registers
- Configures the queue request source of the VADC. The APIs which act on the queue related registers are prefixed by XMC_VADC_GROUP_Queue
- Configures the scan request source of the VADC. The APIs which act on the scan related registers are prefixed by XMC_VADC_GROUP_Scan
- Configuration of the channels of each group are done by the API which have a prefix as XMC_VADC_GROUP_Channel.
- The Group API names are prefixed by the XMC_VADC_GROUP_ and they accept XMC_VADC_GROUP_t as one of its arguments.
Macro Definition Documentation
#define XMC_VADC_NUM_CHANNELS_PER_GROUP (8U) |
Defines the number of ADC channels per group
Typedef Documentation
Type defined the scan configuration structure for background Request Source
typedef VADC_GLOBAL_TypeDef XMC_VADC_GLOBAL_t |
Type defined the device header file vadc global register structure type to VADC type
typedef VADC_G_TypeDef XMC_VADC_GROUP_t |
Type defined the device header file vadc group register structure type to VADC Group type
typedef uint16_t XMC_VADC_RESULT_SIZE_t |
Type defined the converted result size to unsigned 16 bit integer
Enumeration Type Documentation
Provides possible routing values for the boundary flag.
Defines the boundary select for Channel. Use XMC_VADC_GROUP_BOUNDARY_FLAG_MODE_t for this enumeration.
Enumerator | |
---|---|
XMC_VADC_BOUNDARY_SELECT_LOWER_BOUND |
Select the lower boundary |
XMC_VADC_BOUNDARY_SELECT_UPPER_BOUND |
Selects the upper boundary |
Defines channel alias. All enum items are available for channels 0 and 1. Other Channels can accept only XMC_VADC_CHANNEL_ALIAS_DISABLED.
Defines the criteria for boundary flag assertion. Use XMC_VADC_CHANNEL_BOUNDARY_CONDITION_t for this enumeration.
Defines the references to boundary values used for limit checking feature. Each of these can be assigned as either an upper bound or a lower bound. Use XMC_VADC_CHANNEL_BOUNDARY_t for this enumeration.
Defines the voltage which the capacitor is charged to. Used in Broken wire detection feature. Use XMC_VADC_CHANNEL_BWDCH_t for this enumeration.
Enumerator | |
---|---|
XMC_VADC_CHANNEL_BWDCH_VAGND |
Capacitor pre-charged to ground |
XMC_VADC_CHANNEL_BWDCH_VAREF |
Capacitor pre-charged to reference voltage |
Defines the conversion classes that can be selected for each channel. The enumeration members holds the group or global classes. The conversion classes decides the properties of conversion, like resolution, sampling time etc Use XMC_VADC_CHANNEL_CONV_t for this enumeration.
Defines the criteria for event generation by the channel. Use XMC_VADC_CHANNEL_EVGEN_t for this enumeration.
Defines the reference voltage selection for conversion. Use XMC_VADC_CHANNEL_REF_t for this enumeration.
Enumerator | |
---|---|
XMC_VADC_CHANNEL_REF_INTREF |
Internal VARef |
XMC_VADC_CHANNEL_REF_ALT_CH0 |
External voltage available on Channel-0 of the perticular group |
enum XMC_VADC_CONVMODE_t |
Defines the conversion mode. It defines the resolution of conversion. Use XMC_VADC_CONVMODE_t for this enumeration.
enum XMC_VADC_DMM_t |
Defines the conversion result handling mode. Use XMC_VADC_DMM_t for this enumeration.
Defines the output of a fast compare mode. Use XMC_VADC_FAST_COMPARE_t for this enumeration.
Defines the external gating input selection possibilities, to gate the conversion requests. Refer the VADC interconnects section of the reference manual for details of peripherals which can be used. Also refer xmc_vadc_map.h file for detailed definitions of the peripherals which can take the control of these enumeration items. Use XMC_VADC_GATE_INPUT_SELECT_t for this enumeration.
enum XMC_VADC_GATEMODE_t |
Defines the condition for gating the conversion requests. It can be used to set the ENGT field of ASMR/BSMR/QMR register respectively for auto_scan/background_scan/queue request sources. Use XMC_VADC_GATEMODE_t for this enumeration.
Defines the event which can lead to a global service request assertion. Use XMC_VADC_GLOBAL_EVENT_t for this enumeration.
Enumerator | |
---|---|
XMC_VADC_GLOBAL_EVENT_BKGNDSOURCE |
Background scan request source event |
XMC_VADC_GLOBAL_EVENT_RESULT |
Global result event |
Defines the request source arbiter behavior. Use XMC_VADC_GROUP_ARBMODE_t for this enumeration.
Enumerator | |
---|---|
XMC_VADC_GROUP_ARBMODE_ALWAYS |
Arbiter runs all the time |
XMC_VADC_GROUP_ARBMODE_ONDEMAND |
Arbiter runs only if a conversion request is asserted by any of the request sources |
Defines the various modes for the boundary flag. Use XMC_VADC_GROUP_BOUNDARY_FLAG_MODE_t for this enumeration.
Defines the reference to sample time and conversion mode settings. Use XMC_VADC_GROUP_CONV_t for this enumeration.
Enumerator | |
---|---|
XMC_VADC_GROUP_CONV_STD |
Settings pertaining to channels directly attached to VADC module |
XMC_VADC_GROUP_CONV_EMUX |
Settings pertaining to channels connected to VADC via EMUX |
Defines the EMUX channel selection encoding scheme. Use XMC_VADC_GROUP_EMUXCODE_t for this enumeration.
Enumerator | |
---|---|
XMC_VADC_GROUP_EMUXCODE_BINARY |
A linearly incrementing code serves are MUX-SEL |
XMC_VADC_GROUP_EMUXCODE_GRAY |
The MUX-SEL is gray encoded |
Defines the EMUX mode of operation. Use XMC_VADC_GROUP_EMUXMODE_t for this enumeration.
Defines the group indices. Use XMC_VADC_GROUP_INDEX_t for this enumeration.
enum XMC_VADC_GROUP_IRQ_t |
Defines the service request set used. Use XMC_VADC_GROUP_IRQ_t for this enumeration.
Enumerator | |
---|---|
XMC_VADC_GROUP_IRQ_KERNEL |
Refers to Group specific service request |
XMC_VADC_GROUP_IRQ_SHARED |
Refers to Module wide service request |
Defines the power modes of a VADC Group. Use XMC_VADC_GROUP_POWERMODE_t for this enumeration.
Defines the request source arbitration priority. Use XMC_VADC_GROUP_RS_PRIORITY_t for this enumeration.
Defines the status of a VADC group (also known as kernel). Use XMC_VADC_GROUP_STATE_t for this enumeration.
Enumerator | |
---|---|
XMC_VADC_GROUP_STATE_IDLE |
Idle and can convert if requested |
XMC_VADC_GROUP_STATE_BUSY |
Busy with an ongoing conversion |
Defines the alignment of the converted result. Use XMC_VADC_RESULT_ALIGN_t for this enumeration.
Enumerator | |
---|---|
XMC_VADC_RESULT_ALIGN_LEFT |
Always align result to left |
XMC_VADC_RESULT_ALIGN_RIGHT |
Always align result to right |
enum XMC_VADC_SCAN_LOAD_t |
Defines the behavior of load event for the scan request source. Use XMC_VADC_SCAN_LOAD_t for this enumeration.
enum XMC_VADC_SCAN_TYPE_t |
Defines the type of scan request source to be used. It can choose between auto scan and background scan request source methods. Use XMC_VADC_SCAN_TYPE_t for this enumeration.
enum XMC_VADC_SR_t |
Defines the various service requests lines. Each group can raise up to 4 service requests independently. While all groups together have the possibility of raising 4 module wide service requests. Use XMC_VADC_SR_t for this enumeration.
enum XMC_VADC_STARTMODE_t |
Defines the mode of operation of a channel, when an ongoing conversion gets interrupted in between. Use XMC_VADC_STARTMODE_t for this enumeration.
enum XMC_VADC_STATUS_t |
Defines the return status after execution of VADC specific API's. Use XMC_VADC_STATUS_t for this enumeration.
Enumerator | |
---|---|
XMC_VADC_STATUS_SUCCESS |
Returned when the API has been able to fulfill the callers request |
XMC_VADC_STATUS_ERROR |
Returned when the API cannot fulfill the request |
Defines the edge sensitivity of the trigger signal which can assert a conversion. Use XMC_VADC_TRIGGER_EDGE_t for this enumeration.
Defines the external trigger input selection possibilities, to assert a conversion. Refer the VADC interconnects section of the reference manual for details of peripherals which can be used. Also refer xmc_vadc_map.h file for detailed definitions of the peripherals which can take the control of these enumeration items. Use XMC_VADC_TRIGGER_INPUT_SELECT_t for this enumeration.
Function Documentation
void XMC_VADC_GLOBAL_BackgndAddMultipleChannels | ( | XMC_VADC_GLOBAL_t *const | global_ptr, |
const uint32_t | grp_num, | ||
const uint32_t | ch_mask | ||
) |
- Parameters
-
global_ptr Pointer to the VADC module grp_num ID of the VADC group whose unprioritized channels have been assigned to background scan ch_mask Mask word indicating channels which form part of scan conversion sequence Bit location 0/1/2/3/4/5/6/7 represents channels-0/1/2/3/4/5/6/7 respectively. To Add the channel to the scan sequence enable the respective bit. Passing a 0x0 will clear all the previously selected channels
Range: [0x0 to 0xFF]
- Returns
- None
- Description:
- Adds multiple channels to the scan sequence.
Call this API to insert a multiple channels into the scan request source. This will be added to a scan sequence. The added channels will be a part of the conversion sequence when the next load event occurs. A call to this API would configure the register bit fields of BRSSEL.
- Related APIs:
- XMC_VADC_GLOBAL_BackgroundAddChannelToSequence()
void XMC_VADC_GLOBAL_BackgndRemoveMultipleChannels | ( | XMC_VADC_GLOBAL_t *const | global_ptr, |
const uint32_t | grp_num, | ||
const uint32_t | ch_mask | ||
) |
- Parameters
-
global_ptr Pointer to the VADC module grp_num ID of the VADC group whose unprioritized channels have been assigned to background scan ch_mask Mask word indicating channels which form part of scan conversion sequence Bit location 0/1/2/3/4/5/6/7 represents channels-0/1/2/3/4/5/6/7 respectively. To Add the channel to the scan sequence enable the respective bit. Passing a 0x0 will clear all the previously selected channels
Range: [0x0 to 0xFF]
- Returns
- None
- Description:
- Removes multiple channels to the scan sequence.
Call this API to insert a multiple channels into the scan request source. This will be added to a scan sequence. The added channels will be a part of the conversion sequence when the next load event occurs. A call to this API would configure the register bit fields of BRSSEL.
- Related APIs:
- XMC_VADC_GLOBAL_BackgroundAddChannelToSequence()
void XMC_VADC_GLOBAL_BackgroundAbortSequence | ( | XMC_VADC_GLOBAL_t *const | global_ptr | ) |
- Parameters
-
global_ptr Pointer to the VADC module
- Returns
- None
- Description:
- Aborts an ongoing background scan conversion(sequence).
An ongoing sequence can be aborted at any time. The scan unit picks the pending channels one by one from a pending register and requests for their conversion. This API essentially clears the channel pending register thus creating an illusion that there are no more channels left in the sequence. A call to this API would configure the registers BRSMR, BRSCTRL, GxARBPR(if group is available) to abort the current scan sequence.
- Related APIs:
- None.
void XMC_VADC_GLOBAL_BackgroundAddChannelToSequence | ( | XMC_VADC_GLOBAL_t *const | global_ptr, |
const uint32_t | grp_num, | ||
const uint32_t | ch_num | ||
) |
- Parameters
-
global_ptr Pointer to the VADC module grp_num ID of the VADC group whose unprioritized channels have been assigned to background scan Request source ch_num The unprioritized channel meant to be added to the scan sequence
Range: [0x0 to 0x7]
- Returns
- None
- Description:
- Adds a channel to the background scan sequence.
Call this API to insert a new single channel into the background scan request source. This will be added to the scan sequence. The added channel will be part of the conversion sequence when the next load event occurs. A call to this API would configure the register bit fields of BRSSEL.
- Related APIs:
- XMC_VADC_GLOBAL_BackgroundAddMultipleChannels()
void XMC_VADC_GLOBAL_BackgroundClearReqSrcEvent | ( | XMC_VADC_GLOBAL_t *const | global_ptr | ) |
- Parameters
-
global_ptr Pointer to the VADC module
- Returns
- None
- Description:
- Acknowledges the background scan conversion complete request source event.
This API will clear the request source event that occurred. This will clear a interrupt if it was raised. A call to this API would configure the register bit field GLOBEFLAG.SEVGLB
- Related APIs:
- XMC_VADC_GLOBAL_BackgroundTriggerReqSrcEvent()
void XMC_VADC_GLOBAL_BackgroundDisableContinuousMode | ( | XMC_VADC_GLOBAL_t *const | global_ptr | ) |
- Parameters
-
global_ptr Pointer to the VADC module
- Returns
- None
- Description:
- Disables continuous conversion mode.
Typically for a Background request source to generate conversion request, either a hardware trigger or a software request is a pre-requisite. Using autoscan feature it is possible to start the conversion once and allow the sequence to repeat without any further triggers. Once all channels belonging to a Background request source have been converted, a request source completion event is generated. Generation of this event can restart the Background sequence. By invoking this API the Autoscan mode of operations is disabled. A call to this API would configure the register bit field BRSMR.SCAN.
- Related APIs:
- XMC_VADC_GLOBAL_BackgroundEnableContinuousMode()
void XMC_VADC_GLOBAL_BackgroundDisableEvent | ( | XMC_VADC_GLOBAL_t *const | global_ptr | ) |
- Parameters
-
global_ptr Pointer to the VADC module
- Returns
- None
- Description:
- Disables the background scan request source event .
By using this API the request source event will be deactivated for the background scan request source. Other configurations w.r.t service node pointer are not done in this API. A call to this API would configure the register bit field BRSMR.ENSI.
- Related APIs:
- XMC_VADC_GROUP_BackgroundEnableEvent(),
XMC_VADC_GLOBAL_BackgroundSetReqSrcEventInterruptNode()
void XMC_VADC_GLOBAL_BackgroundDisableExternalTrigger | ( | XMC_VADC_GLOBAL_t *const | global_ptr | ) |
- Parameters
-
global_ptr Pointer to the VADC module
- Returns
- None
- Description:
- Disables the trigger for background scan request source.
By using this API the trigger will be deactivated for the background scan request source. This will just deactivate the H/W trigger for the background scan request source. If any configuration was done to select the trigger input in BRSCTRL will be not be effected. A call to this API would configure the register bit field BRSMR.ENTR.
- Related APIs:
- XMC_VADC_GLOBAL_BackgroundEnableExternalTrigger()
void XMC_VADC_GLOBAL_BackgroundEnableContinuousMode | ( | XMC_VADC_GLOBAL_t *const | global_ptr | ) |
- Parameters
-
global_ptr Pointer to the VADC module
- Returns
- None
- Description:
- Enables continuous conversion mode.
Typically for a Background request source to generate conversion request, either a hardware trigger or a software request is needed. Using autoscan (continuous conversion)feature it is possible to start the conversion once and allow the sequence to repeat without any further triggers. Once all channels belonging to a Background request source have been converted, a request source completion event is generated. Generation of this event can restart the Background configure sequence. Every request source event will cause a load event to occur. A call to this API would access the register bit field BRSMR.SCAN.
- Related APIs:
- XMC_VADC_GROUP_BackgroundDisableContinuousMode()
void XMC_VADC_GLOBAL_BackgroundEnableEvent | ( | XMC_VADC_GLOBAL_t *const | global_ptr | ) |
- Parameters
-
global_ptr Pointer to the VADC module
- Returns
- None
- Description:
- Enables the background scan request source event .
By using this API the request source event will be activated for the background scan request source. Other configurations w.r.t service node pointer are not done in this API. A call to this API would configure the register bit field BRSMR.ENSI.
void XMC_VADC_GLOBAL_BackgroundEnableExternalTrigger | ( | XMC_VADC_GLOBAL_t *const | global_ptr | ) |
- Parameters
-
global_ptr Pointer to the VADC module
- Returns
- None
- Description:
- Enables the trigger for background scan request source.
By using this API the trigger will be activated for the scan request source. The trigger signal and trigger edge will be selected from the BRSCTRL register. The Selection of a input will be done by XMC_VADC_GLOBAL_BackgroundSelectTrigger(). A call to this API would configure the register bit field BRSMR.ENTR.
uint32_t XMC_VADC_GLOBAL_BackgroundGetNumChannelsPending | ( | XMC_VADC_GLOBAL_t *const | global_ptr | ) |
- Parameters
-
global_ptr Pointer to the VADC module
- Returns
uint32_t Returns the total channels pending for conversion.
Range: [0x0 to (0x8*number of groups)]
- Description:
- Returns the number of pending channels.
This API will read the pending channels register and will return the number of channels that are awaiting conversion. When a load event occurs the scan sequence is pushed to a pending conversion register. From the pending register the channels are taken up by the converter. When the API is called it would return the total number of channels pending (BRSPND[grp_num]).
- Related APIs:
- XMC_VADC_GLOBAL_BackgroundIsChannelPending()
bool XMC_VADC_GLOBAL_BackgroundGetReqSrcEventStatus | ( | XMC_VADC_GLOBAL_t *const | global_ptr | ) |
- Parameters
-
global_ptr Pointer to the VADC module
- Returns
- bool returns true if the service request event is raised. returns false if the service request event was not raised.
- Description:
- Determines if the request source event is asserted.
This API will get the status of the background scan request source event. Will return a true if the event has occurred for background scan. A call to this API would configure the register bit field GLOBEFLAG.SEVGLB.
- Related APIs:
- None.
void XMC_VADC_GLOBAL_BackgroundInit | ( | XMC_VADC_GLOBAL_t *const | global_ptr, |
const XMC_VADC_BACKGROUND_CONFIG_t * | config | ||
) |
- Parameters
-
global_ptr Pointer to the VADC module config Pointer to initialization data structure
- Description:
- Initializes the Background scan functional block.
The BACKGROUND SCAN request source functional block converts channels of all VADC groups that have not been assigned as a priority channel (priority channels can be converted only by queue and scan). Background Scan request source converts the unprioritized channels. Unprioritized channels however can also be used with queue and scan. But a channel which is prioritized can not be used with background request source.
bool XMC_VADC_GLOBAL_BackgroundIsChannelPending | ( | XMC_VADC_GLOBAL_t *const | global_ptr, |
const uint32_t | grp_num, | ||
const uint32_t | ch_num | ||
) |
- Parameters
-
global_ptr Pointer to the VADC module grp_num ID of the VADC group whose unprioritized channels have been assigned to background scan RS ch_num The channel being audited for completion of conversion
Range: [0x0 to 0x7]
- Returns
- bool returns true if the channel is pending conversion else returns false
- Description:
- Determine if the channel is pending.
This API will check if the Channel in question is awaiting conversion in the current arbitration round. When a load event occurs the scan sequence is pushed to a pending conversion register. From the pending register the channels are taken up by the converter. This API would return true if the channel is found in the pending register (BRSPND[grp_num]).
- Related APIs:
- XMC_VADC_GLOBAL_BackgroundGetNumChannelsPending()
void XMC_VADC_GLOBAL_BackgroundRemoveChannelFromSequence | ( | XMC_VADC_GLOBAL_t *const | global_ptr, |
const uint32_t | grp_num, | ||
const uint32_t | ch_num | ||
) |
- Parameters
-
global_ptr Pointer to the VADC module grp_num ID of the VADC group whose unprioritized channels have been assigned to background scan Request source ch_num The unprioritized channel meant to be added to the scan sequence
Range: [0x0 to 0x7]
- Returns
- None
- Description:
- Removes a channel to the background scan sequence.
Call this API to insert a new single channel into the background scan request source. This will be added to the scan sequence. The added channel will be part of the conversion sequence when the next load event occurs. A call to this API would configure the register bit fields of BRSSEL.
- Related APIs:
- XMC_VADC_GLOBAL_BackgroundAddChannelToSequence()
void XMC_VADC_GLOBAL_BackgroundSelectGating | ( | XMC_VADC_GLOBAL_t *const | global_ptr, |
const uint32_t | input_num | ||
) |
- Parameters
-
global_ptr Pointer to the VADC module input_num Module input signal meant to be selected as gating input Accepts enum XMC_VADC_GATE_INPUT_SELECT_t
- Returns
- None
- Description:
- Select Gating signal for Background request source.
Passage of the trigger input to the request source can be controlled via a gating signal. Any one of the 16 input lines can be chosen as a gating signal. Trigger signal can be given to the Background request source only when the gating signal's active level is detected. Additionally the GxBRSMR.ENGT has to be configured for the gating signal's active level. A call to this API would configure the register bit field BRSCTRL.GTSEL.
- Related APIs:
- XMC_VADC_GLOBAL_BackgroundSelectTrigger()
void XMC_VADC_GLOBAL_BackgroundSelectTrigger | ( | XMC_VADC_GLOBAL_t *const | global_ptr, |
const uint32_t | input_num | ||
) |
- Parameters
-
global_ptr Pointer to the VADC module input_num Choice of the input earmarked as a trigger line Accepts enum XMC_VADC_TRIGGER_INPUT_SELECT_t
- Returns
- None
- Description:
- Select Trigger signal for Background request source.
A Background request source will raise conversion request only if there were either a request from application or occurrence of a hardware trigger. This API selects one of the 16 input lines as a trigger line. This is needed when a hardware trigger is needed for the conversion of the Background request source. Refer to the reference manual to determine the signal that needs to be connected. A call to this API would configure the register bit field BRSCTRL.XTSEL.
void XMC_VADC_GLOBAL_BackgroundSelectTriggerEdge | ( | XMC_VADC_GLOBAL_t *const | global_ptr, |
const XMC_VADC_TRIGGER_EDGE_t | trigger_edge | ||
) |
- Parameters
-
global_ptr Pointer to the VADC module trigger_edge Select the trigger edge
- Returns
- None
- Description:
- Select Trigger edge for Background request source.
A Background request source will raise conversion request only if there were either a request from application or occurrence of a hardware trigger. This API selects one of the 4 possible values for the trigger edge. This is needed when a hardware trigger is needed for the conversion of the Background request source. A call to this API would configure the register bit field BRSCTRL.XTMODE.
void XMC_VADC_GLOBAL_BackgroundSetGatingMode | ( | XMC_VADC_GLOBAL_t *const | global_ptr, |
XMC_VADC_GATEMODE_t | mode_sel | ||
) |
- Parameters
-
global_ptr Pointer to the VADC module mode_sel Select how the gating is applied to the background scan request source
- Returns
- None
Details of function
Selects the gating mode of background request source.
Passage of the trigger input to the request source can be controlled via a gating signal. This API determines how the gating signal behaves, either active low or active high. If gating signal needs to ignored XMC_VADC_GATEMODE_IGNORE should be used as the mode_sel. A call to this API would configure the register bit field BRSMR.ENGT.
- Related APIs:
- XMC_VADC_GLOBAL_BackgroundSelectGating();
void XMC_VADC_GLOBAL_BackgroundSetReqSrcEventInterruptNode | ( | XMC_VADC_GLOBAL_t *const | global_ptr, |
XMC_VADC_SR_t | sr | ||
) |
- Parameters
-
global_ptr Constant pointer to the VADC module sr The service request to which the global request source event is connected. Refer XMC_VADC_SR_t enum
- Returns
- None
- Description:
- Binds the background request source event to one of the 4 shared service requests.
This API binds the background request source event to one of the 4 module wide shared service requests. Sets GLOBEVNP register with the corresponding sr line.
- Related APIs:
- XMC_VADC_GLOBAL_SetResultEventInterruptNode()
void XMC_VADC_GLOBAL_BackgroundTriggerConversion | ( | XMC_VADC_GLOBAL_t *const | global_ptr | ) |
- Parameters
-
global_ptr Pointer to the VADC module
- Returns
- None
- Description:
- Generates conversion request (Software initiated conversion).
A conversion request can be raised either upon detection of a hardware trigger, or by software. This API forces the scan unit to generate a conversion request to the analog converter. It is assumed that the background scan has already been filled up with entries. A call to this API would set the register bit field BRSMR.LDEV.
- Related APIs:
- None.
void XMC_VADC_GLOBAL_BackgroundTriggerReqSrcEvent | ( | XMC_VADC_GLOBAL_t *const | global_ptr | ) |
- Parameters
-
global_ptr Pointer to the VADC module
- Returns
- None
- Description:
- Manually asserts the conversion complete request source event.
This API will set the request source event for background scan. This will trigger a interrupt if the service node pointer for the scan has been configured. A call to this API would configure the register bit field GLOBEFLAG.SEVGLB.
- Related APIs:
- None.
void XMC_VADC_GLOBAL_BindGroupToEMux | ( | XMC_VADC_GLOBAL_t *const | global_ptr, |
const uint32_t | emuxif, | ||
const uint32_t | group | ||
) |
- Parameters
-
global_ptr Constant pointer to the VADC module emuxif The EMUX interface
Range[0x0 - 0x1]group The VADC group which must be bound to the desired emux
- Returns
- None
- Description:
- Binds a VADC group to an EMUX interface specified in emuxif.
Selects which group's scan request source will control the EMUX interface (set of control select lines for the EMUX). By passing group it would configure that group's scan request source to control the EMUX select lines of the set emuxif.
- Related APIs:
- None
void XMC_VADC_GLOBAL_ClearEvent | ( | XMC_VADC_GLOBAL_t *const | global_ptr, |
const uint32_t | event_type | ||
) |
- Parameters
-
global_ptr Constant pointer to the VADC module event_type Event that must be acknowledged Use the enum XMC_VADC_GLOBAL_EVENT_t to create a mask to be used with this argument
- Returns
- None
- Description:
- Acknowledges an event that has been asserted manually or automatically.
This API acknowledges the requested event by clearing GLOBEFLAG sticky flag.
- Related APIs:
- None
void XMC_VADC_GLOBAL_ClockInit | ( | XMC_VADC_GLOBAL_t *const | global_ptr, |
const XMC_VADC_GLOBAL_CLOCK_t * | config | ||
) |
- Parameters
-
global_ptr Constant pointer to the VADC module. config Pointer to the data structure containing clock configuration data
- Returns
- None
- Description:
- Configures the VADC clock.
Sets up the clock configuration of the VADC module using the config structure pointed by config. The clock to the analog converter and to the request source arbiter is configured by setting the GLOBCFG register.
- Related APIs:
- None
void XMC_VADC_GLOBAL_DisableModule | ( | void | ) |
- Parameters
-
None
- Returns
- None
- Description:
- Disables the VADC module.
This API would gate the clock to the VADC module (if applicable). Also this API would put the VADC module into the reset state(if applicable) by asserting the appropriate registers. This API would invoke XMC_SCU_CLOCK_GatePeripheralClock() and XMC_SCU_RESET_AssertPeripheralReset() if needed.
- Related APIs:
- XMC_VADC_GLOBAL_EnableModule().
void XMC_VADC_GLOBAL_DisableModuleClock | ( | XMC_VADC_GLOBAL_t *const | global_ptr | ) |
- Parameters
-
global_ptr Constant pointer to the VADC module.
- Returns
- None
- Description:
- Disables the VADC module clock.
After this API call, no conversion will occur. Call XMC_VADC_GLOBAL_EnableModuleClock() to enable the VADC module later in the program.
- Related APIs:
- XMC_VADC_GLOBAL_Init()
void XMC_VADC_GLOBAL_DisablePostCalibration | ( | XMC_VADC_GLOBAL_t *const | global_ptr, |
uint32_t | group_number | ||
) |
- Parameters
-
global_ptr Constant pointer to the VADC module group_number group number whose post calibration feature is to be disabled.
Range[0x0 to 0x3] Accepts the enum XMC_VADC_GROUP_INDEX_t
- Returns
- None
- Description:
- Disables the post calibration for a particular group specified as group_number.
It configures the DPCAL0 bit of GLOBCFG register to disable the post calibration feature. Call XMC_VADC_GLOBAL_Enable() and XMC_VADC_GLOBAL_ClockInit() before calling this API in sequence. Calling the API XMC_VADC_GLOBAL_EnablePostCalibration() can enable back the calibration feature at runtime.
- Related APIs:
- XMC_VADC_GLOBAL_Enable()
XMC_VADC_GLOBAL_ClockInit()
XMC_VADC_GLOBAL_DisablePostCalibration()
None
void XMC_VADC_GLOBAL_DisableSleepMode | ( | XMC_VADC_GLOBAL_t *const | global_ptr | ) |
- Parameters
-
global_ptr Constant pointer to the VADC module.
- Returns
- None
- Description:
- Ignores the sleep mode request for the VADC.
With the sleep feature enabled, the module will respond to sleep requests by going into a low power mode. It resets the EDIS bit of CLC register for enabling the sleep mode.
- Related APIs:
- XMC_VADC_GLOBAL_EnableSleepMode().
void XMC_VADC_GLOBAL_DisableStartupCalibration | ( | XMC_VADC_GLOBAL_t *const | global_ptr | ) |
- Parameters
-
global_ptr Constant pointer to the VADC module.
- Returns
- None
- Description:
- Disables the startup calibration feature of the VADC module.
It configures the SUCAL bit of GLOBCFG register to disable the startup calibration feature. Calling the API XMC_VADC_GLOBAL_EnsableStartupCalibration() can enable the calibration feature at runtime.
- Related APIs:
- None
void XMC_VADC_GLOBAL_EnableModule | ( | void | ) |
- Parameters
-
None
- Returns
- None
- Description:
- Enables the VADC module.
This API would ungate the clock to the VADC module (if applicable). Also this API would bring the VADC module out of reset state(if applicable), by asserting the appropriate registers. This API would invoke XMC_SCU_CLOCK_UngatePeripheralClock() and XMC_SCU_RESET_DeassertPeripheralReset() if needed. Directly accessed register is COMPARATOR.ORCCTRL (Refer to the errata for XMC1100).
- Related APIs:
- XMC_VADC_GLOBAL_DisableModule().
void XMC_VADC_GLOBAL_EnableModuleClock | ( | XMC_VADC_GLOBAL_t *const | global_ptr | ) |
- Parameters
-
global_ptr Constant pointer to the VADC module.
- Returns
- None
- Description:
- Enables the VADC module clock.
Call this API before any further configuration of VADC. It sets the DISR bit of CLC register to enable.
- Related APIs:
- XMC_VADC_GLOBAL_Init()
void XMC_VADC_GLOBAL_EnablePostCalibration | ( | XMC_VADC_GLOBAL_t *const | global_ptr, |
uint32_t | group_number | ||
) |
- Parameters
-
global_ptr Constant pointer to the VADC module group_number group number whose post calibration feature is to be enabled.
Range[0x0 to 0x3] Accepts the enum XMC_VADC_GROUP_INDEX_t
- Returns
- None
- Description:
- Enables the post calibration for a particular group specified as group_number.
It configures the DPCAL0 bit of GLOBCFG register to enable the post calibration feature. Calling the API XMC_VADC_GLOBAL_DisablePostCalibration() can disable the calibration feature at runtime.
- Related APIs:
- XMC_VADC_GLOBAL_DisablePostCalibration()
None
void XMC_VADC_GLOBAL_EnableSleepMode | ( | XMC_VADC_GLOBAL_t *const | global_ptr | ) |
- Parameters
-
global_ptr Constant pointer to the VADC module.
- Returns
- None
- Description:
- Enables VADC module to sleep if a sleep request comes.
It resets the EDIS bit of CLC register for enabling the sleep mode.
- Related APIs:
- XMC_VADC_GLOBAL_DisableSleepMode().
XMC_VADC_FAST_COMPARE_t XMC_VADC_GLOBAL_GetCompareResult | ( | XMC_VADC_GLOBAL_t *const | global_ptr | ) |
- Parameters
-
global_ptr Constant pointer to the VADC module
- Returns
- compare high or low. Refer XMC_VADC_FAST_COMPARE_t enum
- None
- Description:
- Determines the result of fast compare operation.
This API returns the result of fast compare operation provided the valid flag in the global result register GLOBRES is set.
- Related APIs:
- None
uint32_t XMC_VADC_GLOBAL_GetDetailedResult | ( | XMC_VADC_GLOBAL_t *const | global_ptr | ) |
- Parameters
-
global_ptr Constant pointer to the VADC module.
- Returns
- uint32_t Complete global result register value GLOBRES
- Description:
- Retrieves the complete result from the global result register associated with the global_ptr.
This API audits the result register GLOBRES for the validity of the data. If the validity is assured, data is first read the global result register, cached locally next and subsequently returned to the caller.
- Related APIs:
- XMC_VADC_GLOBAL_GetResult()
XMC_VADC_RESULT_SIZE_t XMC_VADC_GLOBAL_GetResult | ( | XMC_VADC_GLOBAL_t *const | global_ptr | ) |
- Parameters
-
global_ptr Constant pointer to the VADC module.
- Returns
- XMC_VADC_RESULT_SIZE_t 16 bit result register value.
Range[0x0 - 0X0FFF]
- Description:
- Retrieves the conversion result from the global result register associated with the global_ptr.
This is a lightweight version of XMC_VADC_GLOBAL_GetDetailedResult(). The behavior is exactly the same, just that it is only the 16 bit numeric result returned back to the application instead of the complete GLOBRES register value.
- Related APIs:
- XMC_VADC_GLOBAL_GetDetailedResult()
void XMC_VADC_GLOBAL_Init | ( | XMC_VADC_GLOBAL_t *const | global_ptr, |
const XMC_VADC_GLOBAL_CONFIG_t * | config | ||
) |
- Parameters
-
global_ptr Constant pointer to the VADC module. config Pointer to initialization data structure
- Returns
- None
- Description:
- Initializes the VADC global module with the associated configuration structure pointed by config.
It enables the global access to registers by configuring reset and clock un-gating for selected devices. It initializes global class, boundary , result resources by setting GLOBICLASS,GLOBBOUND,GLOBRCR registers. It also configures the global analog and digital clock dividers by setting GLOBCFG register. Refer related API's to change the configurations later in the program.
- Related APIs:
- XMC_VADC_GLOBAL_ClockInit()
void XMC_VADC_GLOBAL_InputClassInit | ( | XMC_VADC_GLOBAL_t *const | global_ptr, |
const XMC_VADC_GLOBAL_CLASS_t | config, | ||
const XMC_VADC_GROUP_CONV_t | conv_type, | ||
const uint32_t | set_num | ||
) |
- Parameters
-
global_ptr Constant pointer to the VADC module. config Conversion class parameter structure conv_type configure the input call for either standard conversion or EMUX related conversion. set_num Conversion class set
Range: [0x0, 0x1]
- Description:
- Configures the ADC conversion settings like sample time and resolution.
Sets up the conversion settings for vadc global resource associated with config structure. It configures the conversion class properties like sampling time and resolution for selected conv_type channels. It initializes the GLOBALICLASS register specified by set_num with the required settings.
- Related APIs:
- None
void XMC_VADC_GLOBAL_ResultInit | ( | XMC_VADC_GLOBAL_t *const | global_ptr, |
const XMC_VADC_RESULT_CONFIG_t * | config | ||
) |
- Parameters
-
global_ptr Constant pointer to the VADC global module config Pointer to result configuration data structure
- Returns
- None
- Description:
- Initializes global result register.
Initializes Global Result Register with specified settings configured in the config structure.
This API results in configuration of GLOBRCR register. This helps in configuring the Data reduction mode, global result event , wait for read mode on the GLOBRES register.
- Related APIs:
- None
void XMC_VADC_GLOBAL_SetBoundaries | ( | XMC_VADC_GLOBAL_t *const | global_ptr, |
const uint32_t | boundary0, | ||
const uint32_t | boundary1 | ||
) |
- Parameters
-
global_ptr Constant pointer to the VADC module. boundary0 Boundary-0 Value
Range[0 - 4095]boundary1 Boundary-1 Value
Range[0 - 4095]
- Returns
- None
- Description:
- Programs the boundaries with boundary0 and boundary1 for result comparison.
These two boundaries can serve as absolute boundaries. They define a range against which the result of a conversion can be compared. In the fast compare mode, the two boundaries provide hysteresis capability to a compare value. In any case, these boundary values entered here form a boundary pallete. There are dedicated upper and lower boundary registers GLOBBOUND0 and GLOBBOUND1 who will derive their values from this palette.
- Related APIs:
- None
void XMC_VADC_GLOBAL_SetCompareValue | ( | XMC_VADC_GLOBAL_t *const | global_ptr, |
const XMC_VADC_RESULT_SIZE_t | compare_val | ||
) |
- Parameters
-
global_ptr Constant pointer to the VADC module compare_val Compare value which the result of a conversion will be compared against.
Range[0x0 - 0X0FFF]
- Returns
- None
- Description:
- Set compare value in the global result register for fast compare mode.
The result of a conversion will directly be compared to the compare value entered as part of compare_val. The prerequisite is that the channel associated with this global register must select an ICLASS which has the conversion mode configured as fast compare mode. Call XMC_VADC_GLOBAL_GetCompareResult() after this API to
- Related APIs:
- None
void XMC_VADC_GLOBAL_SetIndividualBoundary | ( | XMC_VADC_GLOBAL_t *const | global_ptr, |
const XMC_VADC_CHANNEL_BOUNDARY_t | selection, | ||
const uint16_t | boundary_value | ||
) |
- Parameters
-
global_ptr Constant pointer to the VADC module. selection The boundary value selected for boundary_value. boundary_value Boundary Value
Range[0 - 4095]
- Returns
- None
- Description:
- Programs either the boundary 0 or boundary 1 for result comparison.
This defines a range against which the result of a conversion can be compared. In the fast compare mode, the two boundaries provide hysteresis capability to a compare value.
- Related APIs:
- None
void XMC_VADC_GLOBAL_SetResultEventInterruptNode | ( | XMC_VADC_GLOBAL_t *const | global_ptr, |
XMC_VADC_SR_t | sr | ||
) |
- Parameters
-
global_ptr Constant pointer to the VADC module sr The service request to which the global result event is connected. Refer XMC_VADC_SR_t enum
- Returns
- None
- Description:
- Binds the global result event to one of the 4 shared service requests.
This API binds the global result event to one of the 4 module wide shared service requests .Sets GLOBEVNP register with the corresponding sr line.
void XMC_VADC_GLOBAL_StartupCalibration | ( | XMC_VADC_GLOBAL_t *const | global_ptr | ) |
- Parameters
-
global_ptr Constant pointer to the VADC module.
- Returns
- None
- Description:
- Enables the startup calibration feature of the VADC module.
It configures the SUCAL bit of GLOBCFG register to enable the startup calibration feature. After turning it on, it loops until all active groups finish calibration. Call XMC_VADC_GLOBAL_Enable() and XMC_VADC_GLOBAL_ClockInit() before calling this API in sequence. Calling the API XMC_VADC_GLOBAL_DisableStartupCalibration() can disable the calibration feature at runtime.
- Related APIs:
- XMC_VADC_GLOBAL_Enable()
XMC_VADC_GLOBAL_ClockInit()
None
void XMC_VADC_GLOBAL_TriggerEvent | ( | XMC_VADC_GLOBAL_t *const | global_ptr, |
const uint32_t | event_type | ||
) |
- Parameters
-
global_ptr Constant pointer to the VADC module event_type Desired event that must be manually asserted Use the enum XMC_VADC_GLOBAL_EVENT_t to create a mask to be used with this argument
- Returns
- None
- Description:
- Manually asserts an event that can lead to an interrupt.
This API manually asserts the requested event (Background request source event or a global result event) by setting the GLOBEVFLAG register with the specified event_type.
- Related APIs:
- None
void XMC_VADC_GROUP_AddResultToFifo | ( | XMC_VADC_GROUP_t *const | group_ptr, |
const uint32_t | res_reg | ||
) |
- Parameters
-
group_ptr Constant pointer to the VADC group res_reg Register which is required to be a part of results FIFO
Range: [0x0 to 0xF]
- Returns
- None
- Description:
- Adds result register to Result FIFO.
Sometimes, the rate of consumption of results by application software may not match the rate at which the results are produced. A Result FIFO thus helps a slow consumer to read out results without loss of data. When a result register is added to fifo, it is in fact chained to its higher numbered neighbor. For example, if Result Register-5 is to be added to FIFO, it gets chained to Result Register-6. Results are written to Register-6 while the same can be read out of Register-5 leisurely by software. A call to this API would configure the register bit field GxRCR.FEN.
- Note:
- The FIFO is always read by the software with the lowest numbered result register. The hardware will write the results from the highest numbered result register.
- Related APIs:
- None.
void XMC_VADC_GROUP_BackgroundDisableArbitrationSlot | ( | XMC_VADC_GROUP_t *const | group_ptr | ) |
- Parameters
-
group_ptr Constant pointer to the VADC group which may receive a conversion request from background request source
- Returns
- None
- Description:
- Disables arbitration slot of the Background request source.
If the Background request source must have its conversion request considered by the arbiter, it must participate in the arbitration rounds. Even if a load event occurs the Background channel can only be converted when the arbiter comes to the Background slot.A call to this API will lead to all conversions request by Background to be blocked. A call to this API would configure the register bit field GxARBPR.ASEN2
- Related APIs:
- XMC_VADC_GROUP_BackgroundEnableArbitrationSlot()
void XMC_VADC_GROUP_BackgroundEnableArbitrationSlot | ( | XMC_VADC_GROUP_t *const | group_ptr | ) |
- Parameters
-
group_ptr Constant pointer to the VADC group which may receive a conversion request from background request source
- Returns
- None
- Description:
- Enables arbitration slot of the Background request source.
If the Background request source must have its conversion request considered by the arbiter, it must participate in the arbitration rounds. Even if a load event occurs the Background channel can only be converted when the arbiter comes to the Background slot. Thus this must be enabled if any conversion need to take place. A call to this API would configure the register bit field GxARBPR.ASEN2.
- Related APIs:
- XMC_VADC_GROUP_BackgroundDisableArbitrationSlot()
void XMC_VADC_GROUP_ChannelClearEvent | ( | XMC_VADC_GROUP_t *const | group_ptr, |
const uint32_t | ch_num | ||
) |
- Parameters
-
group_ptr Constant pointer to the VADC group ch_num Channel whose channel event is to be acknowledged
Range: [0x0 to 0x7]
- Returns
- None
- Description:
- Acknowledges a Channel event.
When a channel event is raised after the conversion of that channel, it has to be cleared. This API would clear the Channel event of a particular channel if it has occurred. A call to this API would configure the register bit fields of GxCEFCLR.
- Related APIs:
- XMC_VADC_GROUP_ChannelTriggerEvent().
uint32_t XMC_VADC_GROUP_ChannelGetAssertedEvents | ( | XMC_VADC_GROUP_t *const | group_ptr | ) |
- Parameters
-
group_ptr Constant pointer to the VADC group
- Returns
- uint32_t returns the asserted channel events
- Description:
- Returns the Channel event flag register.
The return is merely the channel events which are asserted. A call to this API would read the register bit fields of GxCEFLAG.
- Related APIs:
- XMC_VADC_GROUP_ChannelClearEvent().
XMC_VADC_CHANNEL_CONV_t XMC_VADC_GROUP_ChannelGetInputClass | ( | XMC_VADC_GROUP_t *const | group_ptr, |
const uint32_t | ch_num | ||
) |
- Parameters
-
group_ptr Constant pointer to the VADC group ch_num Channel whose result alignment is to be returned
Range: [0x0 to 0x7]
- Returns
- XMC_VADC_CHANNEL_CONV_t Returns the configured input class for the ch_num
- Description:
- Returns the channel's input class for conversion for the required channel.
The sampling time and resolution can be taken from any of the 4 possible Input class registers. This API would return the input class register that is taken up by ch_num for conversion. A call to this API would read the register bit field GxCHCTR.RESPOS.
- Related APIs:
- XMC_VADC_GROUP_ChannelSetIclass().
XMC_VADC_RESULT_ALIGN_t XMC_VADC_GROUP_ChannelGetResultAlignment | ( | XMC_VADC_GROUP_t *const | group_ptr, |
const uint32_t | ch_num | ||
) |
- Parameters
-
group_ptr Constant pointer to the VADC group ch_num Channel whose result alignment is to be returned
Range: [0x0 to 0x7]
- Returns
- XMC_VADC_RESULT_ALIGN_LEFT if the result are aligned to the left XMC_VADC_RESULT_ALIGN_RIGHT if the result are aligned to the right
- Description:
- Returns the channel result alignment.
The results are aligned either to the left or to the right. A left aligned 10bit resolution has its LSB at bit2 where as a left aligned 8bit resolution starts at bit4. A call to this API would return the currently configured alignment value. A call to this API would read the register bit field GxCHCTR.RESPOS.
- Related APIs:
- None.
uint8_t XMC_VADC_GROUP_ChannelGetResultRegister | ( | XMC_VADC_GROUP_t *const | group_ptr, |
const uint32_t | ch_num | ||
) |
- Parameters
-
group_ptr Constant pointer to the VADC group ch_num Channel whose associated result register is to be found
Range: [0x0 to 0x7]
- Returns
- uint8_t returns the Group result register to which it is linked to.
Range: [0x0 to 0xF]
- Description:
- Returns the result register associated with this channel.
There are upto 16 result registers which a channel can choose from to store the results of conversion. This returns only the group related result registers. A call to this API would access the register bit field GxCHCTR.RESREG.
- Related APIs:
- None.
void XMC_VADC_GROUP_ChannelInit | ( | XMC_VADC_GROUP_t *const | group_ptr, |
const uint32_t | ch_num, | ||
const XMC_VADC_CHANNEL_CONFIG_t * | config | ||
) |
- Parameters
-
group_ptr Constant pointer to the VADC group ch_num The channel being initialized
Range: [0x0 to 0x7]config Pointer to initialization data
- Returns
- None
- Description:
- Initializes the ADC channel for conversion.
This API will do the channel related initializations. This includes configuration of the CHCTR settings and boundary flag settings. This must be called in the application in order to enable the conversion of a channel. After a request source has been initialized this API has to be called for each channel that has to be converted. A call to this API would configure the registers GxCHCTR GxBFL GxALIAS GxCHASS GxBFLC(depending on device) in order to configure the channel.
- Related APIs:
- None.
bool XMC_VADC_GROUP_ChannelIsResultOutOfBounds | ( | XMC_VADC_GROUP_t *const | group_ptr, |
const uint32_t | ch_num | ||
) |
- Parameters
-
group_ptr Constant pointer to the VADC group ch_num Channel whose input was converted
Range: [0x0 to 0x7]
- Returns
- bool Returns true if there was violation w.r.t the specified boundaries.
- Description:
- Determines if the result of the channel confines with the specified boundaries.
An application may not necessarily always need to know the exact value of the converted result, but merely an indication if the generated result is within stipulated boundaries. Generation of Channel event can be subject to channel event generation criteria (Generate always, Never generate, Generate if result is out of bounds, Generate if result is within bounds). When interrupts are not enabled, this API can be used to determine the nature of the result. A call to this API would access the registers GxCHCTR and GxCEFLAG in order to determine if a violation has occured.
- Related APIs:
- None
void XMC_VADC_GROUP_ChannelSetBoundarySelection | ( | XMC_VADC_GROUP_t *const | group_ptr, |
const uint32_t | ch_num, | ||
XMC_VADC_BOUNDARY_SELECT_t | boundary_sel, | ||
XMC_VADC_CHANNEL_BOUNDARY_t | selection | ||
) |
- Parameters
-
group_ptr Constant pointer to the VADC group ch_num Channel whose channel event is being configured
Range: [0x0 to 0x7]boundary_sel Select the upper/lower boundary configuration . selection The boundary value selected for boundary_sel.
- Returns
- None
- Description:
- Configure the boundary selection for the given channel
The channel event can be generated under the following conditions - Always, Never, Result Out of bounds and Result inside the boundaries. The boundary values to which results are compared can be selected from several sources. A call to this API would configure the register bit field GxCHCTR.BNDSELL or GxCHCTR.BNDSELU .
- Related APIs:
- None.
void XMC_VADC_GROUP_ChannelSetEventInterruptNode | ( | XMC_VADC_GROUP_t *const | group_ptr, |
const uint32_t | ch_num, | ||
const XMC_VADC_SR_t | sr | ||
) |
- Parameters
-
group_ptr Constant pointer to the VADC group ch_num Channel whose channel event is to be connected to a service request line
Range: [0x0 to 0x7]sr The service request line to which the channel event is to be connected
- Returns
- None
- Description:
- Binds a channel event to a requested Service Request line.
The channel event is connected to a service request line. For an event to result in an interrupt, this service request line must be enabled in VADC and the NVIC node which this service request line is connected to must have interrupt generation enabled. A call to this API would configure the register bit fields of GxCEVNP0.
void XMC_VADC_GROUP_ChannelSetIclass | ( | XMC_VADC_GROUP_t *const | group_ptr, |
const uint32_t | ch_num, | ||
const XMC_VADC_CHANNEL_CONV_t | conversion_class | ||
) |
- Parameters
-
group_ptr Constant pointer to the VADC group ch_num Channel whose conversion class is to be configured
Range: [0x0 to 0x7]conversion_class conversion property to be associated with this channel
- Returns
- None
- Description:
- Selects the conversion class registers.
It configures the channel to have a particular conversion class properties like sampling time and resolution. A call to this API would configure the register bit field GxCHCTR.ICLSEL.
- Related APIs:
- XMC_VADC_GROUP_ChannelGetInputClass().
void XMC_VADC_GROUP_ChannelSetInputReference | ( | XMC_VADC_GROUP_t *const | group_ptr, |
const uint32_t | ch_num, | ||
const XMC_VADC_CHANNEL_REF_t | ref | ||
) |
- Parameters
-
group_ptr Constant pointer to the VADC group ch_num Channel whose input is to be converted
Range: [0x0 to 0x7]ref Reference voltage
- Returns
- None
- Description:
- Selects the reference voltage for conversion.
An internal voltage reference (VARef) or an external voltage reference fed to Ch-0 can serve as a voltage reference for conversions. A call to this API would configure the register bit field GxCHCTR.REFSEL.
- Related APIs:
- None.
void XMC_VADC_GROUP_ChannelSetResultRegister | ( | XMC_VADC_GROUP_t *const | group_ptr, |
const uint32_t | ch_num, | ||
const uint32_t | result_reg_num | ||
) |
- Parameters
-
group_ptr Constant pointer to the VADC group ch_num Channel whose i/p is to be converted
Range: [0x0 to 0x7]result_reg_num Result Register associated with this channel
- Returns
- None
- Description:
- Selects the target result register.
There are upto 16 result registers which a channel can choose from to store the results of conversion. This selects only the group related result registers. A call to this API would configure the register bit field GxCHCTR.RESREG.
- Related APIs:
- None.
void XMC_VADC_GROUP_ChannelTriggerEvent | ( | XMC_VADC_GROUP_t *const | group_ptr, |
const uint32_t | ch_num | ||
) |
- Parameters
-
group_ptr Constant pointer to the VADC group ch_num Channel whose channel event is to be asserted
Range: [0x0 to 0x7]
- Returns
- None
- Description:
- Manually asserts a Channel event.
It is merely the channel event which is asserted. For this asserted event to lead to an interrupt, it must have been bound to an SR and that SR must have been enabled. It can potentially lead to an interrupt if the SR line is connected to an NVIC node. A call to this API would configure the register bit fields of GxCEFLAG.
- Related APIs:
- XMC_VADC_GROUP_ChannelClearEvent().
void XMC_VADC_GROUP_ChannelTriggerEventGenCriteria | ( | XMC_VADC_GROUP_t *const | group_ptr, |
const uint32_t | ch_num, | ||
const XMC_VADC_CHANNEL_EVGEN_t | criteria | ||
) |
- Parameters
-
group_ptr Constant pointer to the VADC group ch_num Channel whose channel event is being configured
Range: [0x0 to 0x7]criteria The condition under which the channel may assert its channel event
- Returns
- None
- Description:
- Defines the conditions under which a channel may assert its channel event.
The channel event can be generated under the following conditions - Always, Never, Result Out of bounds and Result inside the boundaries. A call to this API would configure the register bit field GxCHCTR.CHEVMODE.
void XMC_VADC_GROUP_CheckSlaveReadiness | ( | XMC_VADC_GROUP_t *const | group_ptr, |
uint32_t | slave_group | ||
) |
- Parameters
-
group_ptr Pointer to the master VADC Group slave_group The slave VADC Group number
Range: [0x0 to 0x3]
- Returns
- None
- Description:
- Configures the ready signal for master group.
This API would read the slave_group number and determine which EVAL configuration to apply for the given master slave set. Checks the readiness of slaves in synchronized conversions. Conversion of identically numbered channels across groups can be synchronized. For example, when the trigger to convert CH-1 of Group-2 is received, it is possible to simultaneously request conversion of CH-1 of Group-0 and Group-3. Group-2 in this example is therefore the master group while Groups-0 and 3 are the slave groups. Before the master can request its slaves for synchronized conversion, it has the option of checking the readiness of the slaves.
void XMC_VADC_GROUP_ClearResultEvent | ( | XMC_VADC_GROUP_t *const | group_ptr, |
const uint32_t | res_reg | ||
) |
- Parameters
-
group_ptr Constant pointer to the VADC group res_reg Result Register for which the result event is being acknowledged
Range: [0x0 to 0xF]
- Returns
- None
- Description:
- Acknowledges a Result event.
When a Result event is raised after the conversion of that associated channel has produced a result and it has to be cleared. This API would clear the Channel event of a particular channel if it has occurred. A call to this API would access the register bit fields of GxREFCLR.
- Related APIs:
- XMC_VADC_GROUP_ChannelTriggerEvent().
void XMC_VADC_GROUP_DisableChannelSyncRequest | ( | XMC_VADC_GROUP_t *const | group_ptr, |
const uint32_t | ch_num | ||
) |
- Parameters
-
group_ptr Pointer to the master VADC Group ch_num Channel whose conversion triggers conversion in slave groups
- Returns
- None
- Description:
- Disable the synchronization request for the particular channel specified as ch_num. To enable the synchronization call the API XMC_VADC_GROUP_EnableChannelSyncRequest().
- Related APIs:
- None
void XMC_VADC_GROUP_DisableResultEvent | ( | XMC_VADC_GROUP_t *const | group_ptr, |
const uint32_t | res_reg | ||
) |
- Parameters
-
group_ptr Constant pointer to the VADC group res_reg Result Register for which event generation is to be disabled
Range: [0x0 to 0xF]
- Returns
- None
- Description:
- Disable result event generation.
This would just disable the event. It would not alter anything w.r.t the SR line if it was configured. A call to this API would configure the register bit field GxRCR.SRGEN.
- Related APIs:
- XMC_VADC_GROUP_EnableResultEvent().
void XMC_VADC_GROUP_EnableChannelSyncRequest | ( | XMC_VADC_GROUP_t *const | group_ptr, |
const uint32_t | ch_num | ||
) |
- Parameters
-
group_ptr Constant pointer to the master VADC Group ch_num Channel whose conversion triggers conversion in slave groups
- Returns
- None
- Description:
- Sets up a channel for synchronized conversion.
Conversion of identically numbered channels across groups can be synchronized. For example, when the trigger to convert CH-1 of Group-2 is received, it is possible to simultaneously request conversion of CH-1 of Group-0 and Group-3. Group-2 in this example is therefore the master group while Groups-0 and 3 are the slave groups.
Before the master can request its slaves for synchronized conversion, it has the option of checking the readiness of the slaves.
- Related APIs:
- None
void XMC_VADC_GROUP_EnableResultEvent | ( | XMC_VADC_GROUP_t *const | group_ptr, |
const uint32_t | res_reg | ||
) |
- Parameters
-
group_ptr Constant pointer to the VADC group res_reg Result Register for which event generation is to be enabled
Range: [0x0 to 0xF]
- Returns
- None
- Description:
- Enables result event generation.
Once the results of conversion are available, the result event (which is being enabled in this function) if connected to a service request line(Group or Shared service request) can lead to an interrupt. It is therefore not only necessary to enable the event, but also to connect it to a service request line. The service request generation capability must also be enabled and so should the corresponding NVIC node. A call to this API would configure the register bit field GxRCR.SRGEN.
- Related APIs:
- XMC_VADC_GROUP_SetResultInterruptNode().
void XMC_VADC_GROUP_ExternalMuxControlInit | ( | XMC_VADC_GROUP_t *const | group_ptr, |
const XMC_VADC_GROUP_EMUXCFG_t | emux_cfg | ||
) |
- Parameters
-
group_ptr Constant pointer to the VADC group emux_cfg EMUX configuration structure
- Returns
- None
- Description:
- Configures group EMUX parameters associated with the emux_cfg configuration structure.
An external emux interface allows additional channels to be connected to a VADC group. The conversion properties of such channels can be different from the standard channels which are directly connected to the VADC group. This API configures conversion properties of channels connected via EMUX interface.
- Related APIs:
- None
uint32_t XMC_VADC_GROUP_GetAlias | ( | XMC_VADC_GROUP_t *const | group_ptr | ) |
- Parameters
-
group_ptr Constant pointer to the VADC group
- Returns
- uint32_t The complete GxALIAS register
- Description:
- Returns the ALIAS values.
The ALIAS value that is configured for Channel-0 and channel-1 are returned.
- Related APIs:
- None.
uint32_t XMC_VADC_GROUP_GetAssertedResultEvents | ( | XMC_VADC_GROUP_t *const | group_ptr | ) |
- Parameters
-
group_ptr Constant pointer to the VADC group
- Returns
- uint32_t returns the asserted result events
- Description:
- Returns the Result event flag register.
The return is merely the result events which are asserted. A call to this API would read the register bit fields of GxREFLAG.
- Related APIs:
- XMC_VADC_GROUP_TriggerResultEvent().
uint32_t XMC_VADC_GROUP_GetDetailedResult | ( | XMC_VADC_GROUP_t *const | group_ptr, |
const uint32_t | res_reg | ||
) |
- Parameters
-
group_ptr Constant pointer to the VADC group res_reg Result Register from which the result of conversion is to be read out
Range: [0x0 to 0xF]
- Returns
- uint32_t returns the complete result register GxRESy.
- Description:
- Returns the result register completely (result of conversion as well as other info).
The Result register will have information regarding the channel that is requesting the conversion, if the result is valid, if the fast compare bit, Data Reduction Counter, and the request source information. All these information will be returned back. And if the user is polling for the result he can use the result if the valid bit is set. A call to this API would return the complete register GxRES.
- Related APIs:
- XMC_VADC_GROUP_GetResult().
XMC_VADC_FAST_COMPARE_t XMC_VADC_GROUP_GetFastCompareResult | ( | XMC_VADC_GROUP_t *const | group_ptr, |
const uint32_t | res_reg | ||
) |
- Parameters
-
group_ptr Constant pointer to the VADC group res_reg Result Register for which the compare value is being set
Range: [0x0 to 0xF]
- Returns
- XMC_VADC_FAST_COMPARE_t If the input is greater or lower than the compare value returns the appropriate enum. if the valid flag was not set then it would return XMC_VADC_FAST_COMPARE_UNKNOWN.
- Description:
- Determines the input is greater/lower than the compare value.
This API determines if the input is greater/lower than the preset compare value. A call to this API would access the register bit field GxRES.FCM.
- Related APIs:
- XMC_VADC_GROUP_SetResultFastCompareValue().
XMC_VADC_GROUP_CLASS_t XMC_VADC_GROUP_GetInputClass | ( | XMC_VADC_GROUP_t *const | group_ptr, |
const XMC_VADC_CHANNEL_CONV_t | conv_class | ||
) |
- Parameters
-
group_ptr Constant pointer to the VADC group conv_class conversion property to be extracted
- Returns
- XMC_VADC_GROUP_CLASS_t The complete GxICLASSy register
- Description:
- Returns the input class configuration values.
This returns the sampling time configuration and resolution configured in the appropriate group input class conv_class. A call to this API would return the register GxICLASSy.
- Related APIs:
- None.
XMC_VADC_RESULT_SIZE_t XMC_VADC_GROUP_GetResult | ( | XMC_VADC_GROUP_t *const | group_ptr, |
const uint32_t | res_reg | ||
) |
- Parameters
-
group_ptr Constant pointer to the VADC group res_reg Result Register from which the result of conversion is to be read out
Range: [0x0 to 0xF]
- Returns
- XMC_VADC_RESULT_SIZE_t Result register values.
Range:0x0 to 0xFFF
- Description:
- Returns the result of the conversion.
This API will only return the result of the conversion and will strip out the other information that is present in the result register. A call to this API would access the register bit field GxRES.RESULT.
- Related APIs:
- XMC_VADC_GROUP_GetDetailedResult().
uint32_t XMC_VADC_GROUP_GetResultFifoHead | ( | XMC_VADC_GROUP_t *const | group_ptr, |
const uint32_t | res_reg | ||
) |
- Parameters
-
group_ptr Constant pointer to the VADC group res_reg Result Register which forms a part of fifo
Range: [0x0 to 0xF]
- Returns
- uint32_t returns the Result register number which is the head of the FIFO,res_reg is apart of this FIFO.
- Description:
- Returns the the FIFO head (register to which the results are written by H/W).
The analog converter writes to the head of the FIFO. It is the head of the FIFO which is bound to the channel. Applications read the result from the tail of the FIFO. This API would just return the head of the FIFO from where the results are being added to the FIFO. A call to this API would access the register bit field GxRCR.FEN.
- Related APIs:
- XMC_VADC_GROUP_GetResultFifoHead()
uint32_t XMC_VADC_GROUP_GetResultFifoTail | ( | XMC_VADC_GROUP_t *const | group_ptr, |
uint32_t | res_reg | ||
) |
- Parameters
-
group_ptr Constant pointer to the VADC group res_reg Result Register which forms a part of FIFO
Range: [0x0 to 0xF]
- Returns
- uint32_t returns the Result register number which is the tail of the FIFO,res_reg is apart of this FIFO.
- Description:
- Returns the the FIFO tail (register from where to read the results).
The analog converter writes to the head of the FIFO. It is the head of the FIFO which is bound to the channel. Applications read the result from the tail of the FIFO. This API would return the result register from where a user can call the API XMC_VADC_GROUP_GetResult() to read the result stored in the FIFO. A call to this API would access the register bit field GxRCR.FEN.
- Related APIs:
- XMC_VADC_GROUP_GetResultFifoHead()
uint32_t XMC_VADC_GROUP_GetSyncReadySignal | ( | XMC_VADC_GROUP_t *const | group_ptr | ) |
- Parameters
-
group_ptr Constant Pointer to the VADC Group
- Returns
- uint32_t EVAL bits for the group
- Description:
- Get the Eval bits of the group.
For Synchronized conversion the master's ready signal configuration must be copied onto the slaves. A call to this API would return the Sync EVAL Bits (GxSYNCTR.EVALy) which can be used to set in the slaves.
void XMC_VADC_GROUP_IgnoreSlaveReadiness | ( | XMC_VADC_GROUP_t *const | group_ptr, |
uint32_t | slave_group | ||
) |
- Parameters
-
group_ptr Constant Pointer to the master VADC Group slave_group The slave VADC Group number
- Returns
- None
- Description:
- Clears the ready signal for master group.
Ignores the readiness of slaves in synchronized conversions.This API would read the slave_group number and determine which EVAL configuration to apply for the given master slave set. Then clears the configuration if present. This API is called when the master should issue the conversion request without waiting for the slave to assert a ready signal. The ready signal is asserted by the slave group(s) when the conversion is completed in these channels.
void XMC_VADC_GROUP_Init | ( | XMC_VADC_GROUP_t *const | group_ptr, |
const XMC_VADC_GROUP_CONFIG_t * | config | ||
) |
- Parameters
-
group_ptr Constant pointer to the VADC group. config Pointer to the initialization data structure
- Returns
- None
- Description:
- Initializes the VADC group module with the associated configuration structure pointed by config.
It initializes the group specified as part of the group_ptr. It initializes group conversion class, arbiter configuration , boundary configuration by setting GxICLASS,GxARBCFG,GxBOUND, registers. It also configures the EMUX control register if applicable. Refer related API's to change the configurations later in the program.
void XMC_VADC_GROUP_InputClassInit | ( | XMC_VADC_GROUP_t *const | group_ptr, |
const XMC_VADC_GROUP_CLASS_t | config, | ||
const XMC_VADC_GROUP_CONV_t | conv_type, | ||
const uint32_t | set_num | ||
) |
- Parameters
-
group_ptr Constant pointer to the VADC group. config group related conversion class parameter structure conv_type Use direct channels or EMUX channels. Refer XMC_VADC_GROUP_CONV_t enum set_num Conversion class set
Range[0x0, 0x1]
- Returns
- None
- Description:
- Sets up the conversion settings for vadc group resource associated with config structure. It configures the conversion class properties like sampling time and resolution for selected conv_type channels. It initializes the G_ICLASS register specified by set_num with the required settings.
- Related APIs:
- XMC_VADC_GROUP_Init()
XMC_VADC_GROUP_STATE_t XMC_VADC_GROUP_IsConverterBusy | ( | XMC_VADC_GROUP_t *const | group_ptr | ) |
- Parameters
-
group_ptr Constant pointer to the VADC group.
- Returns
- retuns IDLE if converter is free else returns busy. Refer XMC_VADC_GROUP_STATE_t enum
- Description:
- Checks the live status of the analog to digital converter. The converter can either idle doing nothing or busy sampling + converting.
- Related APIs:
- None
bool XMC_VADC_GROUP_IsResultRegisterFifoHead | ( | XMC_VADC_GROUP_t *const | group_ptr, |
const uint32_t | res_reg | ||
) |
- Parameters
-
group_ptr Constant pointer to the VADC group res_reg Result Register in question
Range: [0x0 to 0xF]
- Returns
- bool returns true if the res_reg is the FIFO head.
- Description:
- Determines if the requested register is the head of a FIFO.
The analog converter writes to the head of the FIFO. It is the head of the FIFO which is bound to the channel. Applications read the result from the tail of the FIFO. A call to this API would access the register bit field GxRCR.FEN.
- Related APIs:
- XMC_VADC_GROUP_GetResultFifoHead()
bool XMC_VADC_GROUP_IsResultRegisterInFifo | ( | XMC_VADC_GROUP_t *const | group_ptr, |
const uint32_t | res_reg | ||
) |
- Parameters
-
group_ptr Constant pointer to the VADC group res_reg Result Register number
Range: [0x0 to 0xF]
- Returns
- bool returns true if the res_reg is the FIFO member, else false.
- Description:
- Determines whether the specified register is a FIFO member or not.
The analog converter writes to the head of the FIFO. It is the head of the FIFO which is bound to the channel. Applications read the result from the tail of the FIFO. A call to this API would access the register bit field GxRCR.FEN.
void XMC_VADC_GROUP_QueueAbortSequence | ( | XMC_VADC_GROUP_t *const | group_ptr | ) |
- Parameters
-
group_ptr Constant pointer to the VADC group
- Returns
- None
- Description:
- Aborts an ongoing conversion by flushing the queue.
This API will flush the queue buffer. Ongoing conversion of the Queue request source will not be effected by this API. This would clear all the contents that are present in the queue buffer. A call to this API would configure the registers GxQCTRL0, GxQMR0, GxARBPR in order to abort the queue sequence.
void XMC_VADC_GROUP_QueueClearReqSrcEvent | ( | XMC_VADC_GROUP_t *const | group_ptr | ) |
- Parameters
-
group_ptr Constant pointer to the VADC group
- Returns
- None
- Description:
- Acknowledges the conversion complete request source event.
This API will clear the request source event that occurred. This will clear a interrupt if it was raised. A call to this API would configure the register bit field GxSEFCLR.SEV0.
- Related APIs:
- XMC_VADC_GROUP_QueueTriggerReqSrcEvent()
void XMC_VADC_GROUP_QueueDisableArbitrationSlot | ( | XMC_VADC_GROUP_t *const | group_ptr | ) |
- Parameters
-
group_ptr Constant pointer to the VADC group
- Returns
- None
- Description:
- Disables arbitration slot of the queue request source.
If the QUEUE request source must have its conversion request considered by the arbiter, it must participate in the arbitration rounds. Even if a load event occurs the queue channel can only be converted when the arbiter comes to the queue slot.A call to this API will lead to all conversions request by queue to be blocked. A call to this API would configure the register bit field GxARBPR.ASEN0.
- Related APIs:
- XMC_VADC_GROUP_QueueEnableArbitrationSlot()
void XMC_VADC_GROUP_QueueDisableExternalTrigger | ( | XMC_VADC_GROUP_t *const | group_ptr | ) |
- Parameters
-
group_ptr Constant pointer to the VADC group
- Returns
- None
- Description:
- Disables the trigger for queue request source.
By using this API the trigger will be deactivated for the queue request source. This will just deactivate the H/W trigger for the queue request source. If any configuration was done to select the trigger input in GxQCTRL0 will be not be effected. A call to this API would configure the register bit field GxQMR0.ENTR
- Related APIs:
- XMC_VADC_GROUP_QueueEnableExternalTrigger()
void XMC_VADC_GROUP_QueueEnableArbitrationSlot | ( | XMC_VADC_GROUP_t *const | group_ptr | ) |
- Parameters
-
group_ptr Constant pointer to the VADC group
- Returns
- None
- Description:
- Enables arbitration slot of the queue request source.
If the QUEUE request source must have its conversion request considered by the arbiter, it must participate in the arbitration rounds. Even if a load event occurs the queue channel can only be converted when the arbiter comes to the queue slot. Thus this must be enabled if any conversion need to take place. A call to this API would configure the register bit field GxARBPR.ASEN0.
- Related APIs:
- XMC_VADC_GROUP_QueueDisableArbitrationSlot()
void XMC_VADC_GROUP_QueueEnableExternalTrigger | ( | XMC_VADC_GROUP_t *const | group_ptr | ) |
- Parameters
-
group_ptr Constant pointer to the VADC group
- Returns
- None
- Description:
- Enables the trigger for queue request source.
By using this API the trigger will be activated for the queue request source. The trigger signal and trigger edge will be selected from the QCTRL register. The Selection of a input will be done by XMC_VADC_GROUP_QueueSelectTrigger(). A call to this API would configure the register bit field GxQMR0.ENTR
void XMC_VADC_GROUP_QueueFlushEntries | ( | XMC_VADC_GROUP_t *const | group_ptr | ) |
- Parameters
-
group_ptr Constant pointer to the VADC group
- Returns
- None
- Description:
- Flushing the queue Entry.
This API will flush one entry in the queue buffer. Ongoing conversion of the Queue request source will not be effected by this API. This would clear all the contents that are present in the queue buffer. A call to this API would configure the registers GxQMR0. This is a Blocking API, i.e will only exit when all the entries are removed from the queue.
- Related APIs:
- XMC_VADC_GROUP_QueueRemoveChannel()
XMC_VADC_GROUP_QueueAbortSequence(0
int32_t XMC_VADC_GROUP_QueueGetInterruptedChannel | ( | XMC_VADC_GROUP_t *const | group_ptr | ) |
- Parameters
-
group_ptr Constant pointer to the VADC group
- Returns
- int32_t Returns -1 if there is no channel that have been interrupted. Else would return the channel that is interrupted.
Range: [0x0 to 0x8]
- Description:
- Identifies the channel whose conversion was suspended.
When using cancel inject repeat mode the canceled conversion will be placed in the backup register. This API will return the valid queue channel number from the backup register. This happens when ever there is a high priority conversion interrupts the conversion of queue request source. This forces the channel to goto the backup register. A call to this API would access the register GxQBUR0 to determine the interrupted channel.
- Related APIs:
- None.
uint32_t XMC_VADC_GROUP_QueueGetLength | ( | XMC_VADC_GROUP_t *const | group_ptr | ) |
- Parameters
-
group_ptr Constant pointer to the VADC group
- Returns
- uint32_t returns the total number of channels.
Range: [0x0 to 0x8]
- Description:
- Returns the number of channels present in the queue.
This API will return the queue buffer size. This buffer will be consisting of valid queue entries which will be converted when a trigger event occurs. All the entries that are loaded onto the GxQINR0 will be added to the queue buffer. Hence if an application needs to get the number of valid queue entries this API would provide the interface. A call to this API would access the registers GxQBUR0, GxQSR0 in order to determine the queue length.
- Related APIs:
- XMC_VADC_GROUP_QueueInsertChannel()
int32_t XMC_VADC_GROUP_QueueGetNextChannel | ( | XMC_VADC_GROUP_t *const | group_ptr | ) |
- Parameters
-
group_ptr Constant pointer to the VADC group
- Returns
- int32_t Returns -1 if there are no channels for conversion Else would return the next valid channel for conversion.
Range: [0x0 to 0x8]
- Description:
- Returns the next entry in the queue request source for conversion.
Identifies the channel in the queue lined up for conversion next. API will return a valid queue entry from the queue buffer. First checks for the valid channel entry in the backup register and returns if present. If the valid entry has not been found in the backup register then the queue buffer is searched for a valid entry. A call to this API would access the registers GxQ0R0, GxQBUR0 to determine the next channel.
bool XMC_VADC_GROUP_QueueGetReqSrcEventStatus | ( | XMC_VADC_GROUP_t *const | group_ptr | ) |
- Parameters
-
group_ptr Constant pointer to the VADC group
- Returns
- bool returns true if the service request event is raised. returns false if the service request event was not raised.
- Description:
- Determines if the request source event is asserted.
This API will get the status of the queue request source event. Will return a true if the event has occurred for queue. A call to this API would acces the register bit field GxSEFLAG.SEV0.
- Related APIs:
- None.
void XMC_VADC_GROUP_QueueInit | ( | XMC_VADC_GROUP_t *const | group_ptr, |
const XMC_VADC_QUEUE_CONFIG_t * | config | ||
) |
- Parameters
-
group_ptr Pointer to the VADC group config Pointer to initialization data structure
- Returns
- None
- Description:
- Initializes VADC QUEUE functional block.
The QUEUE request source functional block converts channels stored in a queue. The first channel entered into the queue is converted first. A channel once converted, can be placed back into the queue if desired(refill). A call to this API will first disable the arbitration slot for queue (XMC_VADC_GROUP_QueueEnableArbitrationSlot()) and then it would configure all the related registers with the required configuration values. The arbitration slot is re-enabled at the end of init by invoking XMC_VADC_GROUP_QueueDisableArbitrationSlot(). A call to this API would configure the registers GxARBPR, GxQCTRL0, GxQMR0 to configure the queue request source.
void XMC_VADC_GROUP_QueueInsertChannel | ( | XMC_VADC_GROUP_t *const | group_ptr, |
const XMC_VADC_QUEUE_ENTRY_t | entry | ||
) |
- Parameters
-
group_ptr Constant pointer to the VADC group entry Details of the node being added
- Returns
- None
- Description:
- Inserts a queue entry to the tail of the queue buffer.
This API will insert a new channel into the queue buffer. The Queue will start conversion of the channels from the head of the buffer. This Insert will place the entry after the last valid entry. If no valid entries are present then this API will place the Queue entry at the head of the buffer. Then the successive call to the insert will place the new entry after the last entry. A call to this API would configure the register GxQINR0 for a single queue entry.
- Related APIs:
- XMC_VADC_GROUP_QueueRemoveChannel()
bool XMC_VADC_GROUP_QueueIsArbitrationSlotEnabled | ( | XMC_VADC_GROUP_t *const | group_ptr | ) |
- Parameters
-
group_ptr Constant pointer to the VADC group
- Returns
- bool returns true if the arbitration is enabled else returns false.
- Description:
- Returns the arbitration status of the queue request source.
If the queue request source must have its conversion request considered by the arbiter, it must participate in the arbitration rounds. Even if a load event occurs the queue channel can only be converted when the arbiter comes to the queue slot. A call to this API would return the status of the arbitration slot of queue. A call to this API would read the register bit field GxARBPR.ASEN1.
void XMC_VADC_GROUP_QueueRemoveChannel | ( | XMC_VADC_GROUP_t *const | group_ptr | ) |
- Parameters
-
group_ptr Constant pointer to the VADC group
- Returns
- None
- Description:
- Clears the next valid channel in the queue buffer.
A queue entry lined up for conversion can be removed and replaced by its successor. The call to this API will first check if a valid queue entry is present in the queue backup register if present would clear its valid flag. If no valid queue entries are present in the backup then the first channel present in the queue buffer would be cleared. A call to this API would configure the registers GxQCTRL0, GxQMR0, GxARBPR in order to clear a channel from the queue.
- Related APIs:
- XMC_VADC_GROUP_QueueInsertChannel()
void XMC_VADC_GROUP_QueueSelectGating | ( | XMC_VADC_GROUP_t *const | group_ptr, |
const XMC_VADC_GATE_INPUT_SELECT_t | input_num | ||
) |
- Parameters
-
group_ptr Constant pointer to the VADC group input_num Choice of the input earmarked as the gating line
- Returns
- None
- Description:
- Select Gating signal for queue request source.
Passage of the trigger input to the request source can be controlled via a gating signal. Any one of the 16 input lines can be chosen as a gating signal. Trigger signal can be given to the queue request source only when the gating signal's active level is detected. Additionally the GxQMR0.ENGT has to be configured for the gating signal's active level. A call to this API would configure the register bit field GxQCTRL0.GTSEL.
- Related APIs:
- XMC_VADC_GROUP_QueueSelectTrigger()
void XMC_VADC_GROUP_QueueSelectTrigger | ( | XMC_VADC_GROUP_t *const | group_ptr, |
const XMC_VADC_TRIGGER_INPUT_SELECT_t | input_num | ||
) |
- Parameters
-
group_ptr Constant pointer to the VADC group input_num Choice of the input earmarked as a trigger line
- Returns
- None
- Description:
- Select Trigger signal for queue request source.
A queue request source will raise conversion request only if there were either a request from application or occurrence of a hardware trigger. This API selects one of the 16 input lines as a trigger line. This is needed when a hardware trigger is needed for the conversion of the queue request source. Refer to the reference manual to determine the signal that needs to be connected. A call to this API would configure the register bit field GxQCTRL0.XTSEL.
void XMC_VADC_GROUP_QueueSelectTriggerEdge | ( | XMC_VADC_GROUP_t *const | group_ptr, |
const XMC_VADC_TRIGGER_EDGE_t | trigger_edge | ||
) |
- Parameters
-
group_ptr Constant pointer to the VADC group trigger_edge Choice of the trigger edge
- Returns
- None
- Description:
- Select Trigger signal edge for queue request source.
A queue request source will raise conversion request only if there were either a request from application or occurrence of a hardware trigger. This API selects one of the 4 trigger edges. This is needed when a hardware trigger is needed for the conversion of the queue request source. Refer to the reference manual to determine the signal that needs to be connected. A call to this API would configure the register bit field GxQCTRL0.XTMODE.
void XMC_VADC_GROUP_QueueSetGatingMode | ( | XMC_VADC_GROUP_t *const | group_ptr, |
XMC_VADC_GATEMODE_t | mode_sel | ||
) |
- Parameters
-
group_ptr Constant pointer to the VADC group mode_sel Select how the gating is applied to the queue request source
- Returns
- None
Details of function
Selects the gating mode of queue request source.
Passage of the trigger input to the request source can be controlled via a gating signal. This API determines how the gating signal behaves, either active low or active high. If gating signal needs to ignored XMC_VADC_GATEMODE_IGNORE should be used as the mode_sel. A call to this API would configure the register bit field GxQMR0.ENGT.
- Related APIs:
- XMC_VADC_GROUP_QueueSelectGating();
void XMC_VADC_GROUP_QueueSetReqSrcEventInterruptNode | ( | XMC_VADC_GROUP_t *const | group_ptr, |
const XMC_VADC_SR_t | sr | ||
) |
- Parameters
-
group_ptr Constant pointer to the VADC group sr The service request line (Common SR lines, Group specific SR lines)
- Returns
- None
- Description:
- Connects the event to the SR line of VADC.
This API will connect a Service Request line(SR) to a queue request source event. Hence to get a interrupt on this Service request line one has to enable the required NVIC node. A call to this API would configure the register bit field GxSEVNP.SEVNP0.
- Related APIs:
- None.
void XMC_VADC_GROUP_QueueTriggerConversion | ( | XMC_VADC_GROUP_t *const | group_ptr | ) |
- Parameters
-
group_ptr Constant pointer to the VADC group
- Returns
- None
- Description:
- Generates conversion request (Software initiated conversion).
A conversion request can be raised either upon detection of a hardware trigger, or by software. This API forces the queue unit to generate a conversion request to the analog converter. It is assumed that the queue has already been filled up with entries. A call to this API would configure the register bit field GxQMR0.TREV.
- Note:
- The conversion of queue entry will start immediately after the entry has been loaded into GxQINR0. This happens only if the queue entry has been loaded into the register without the need for the H/W trigger.
If a H/W Trigger is selected while loading the entry, the conversion will occur in one of the 2 ways:- The H/W generates a trigger needed for the queue request source.
- The Conversion is triggered manually by calling this API.
- Related APIs:
- XMC_VADC_GROUP_QueueInsertChannel()
void XMC_VADC_GROUP_QueueTriggerReqSrcEvent | ( | XMC_VADC_GROUP_t *const | group_ptr | ) |
- Parameters
-
group_ptr Constant pointer to the VADC group
- Returns
- None
- Description:
- Manually asserts the conversion complete request source event.
This API will set the request source event for queue. This will trigger a interrupt if the service node pointer for the scan has been configured. A call to this API would configure the register bit field GxSEFLAG.SEV0.
- Related APIs:
- XMC_VADC_GROUP_QueueClearReqSrcEvent()
void XMC_VADC_GROUP_ResultInit | ( | XMC_VADC_GROUP_t *const | group_ptr, |
const uint32_t | res_reg_num, | ||
const XMC_VADC_RESULT_CONFIG_t * | config | ||
) |
- Parameters
-
group_ptr Constant pointer to the VADC group res_reg_num Result register which is intended to be initialized
Range: [0x0 to 0xF]config Pointer to initialization data
- Returns
- None
- Description:
- Initializes a Group Result Register.
Various options needed for the working of the result result will be configured with this API. This would determine the result handling of the group registers. This API must be called after the channel Init (XMC_VADC_GROUP_ChannelInit())to initialize the result register that is selected for the channel. This API would also determine if the result register that is being configured has to a part of a FIFO buffer. In this API one can also configure the various result handling options line FIR/IIR filters and it order. Also configures the Data reduction to accumulate 2/3/4 results need to be done. This API will also configure the result event generation. A call to this API would configure the register GxRCR with the config .
void XMC_VADC_GROUP_ScanAddChannelToSequence | ( | XMC_VADC_GROUP_t *const | group_ptr, |
const uint32_t | ch_num | ||
) |
- Parameters
-
group_ptr Constant pointer to the VADC group ch_num The channel meant to be added to scan sequence
Range: [0x0 to 0x7]
- Returns
- None
- Description:
- Adds a channel to the scan sequence.
Call this API to insert a new single channel into the scan request source. This will be added to the scan sequence. The added channel will be part of the conversion sequence when the next load event occurs. A call to this API would configure the register bit fields of GxASSEL.
- Related APIs:
- XMC_VADC_GROUP_ScanAddMultipleChannels()
void XMC_VADC_GROUP_ScanAddMultipleChannels | ( | XMC_VADC_GROUP_t *const | group_ptr, |
const uint32_t | ch_mask | ||
) |
- Parameters
-
group_ptr Constant pointer to the VADC group ch_mask Mask word indicating channels which form part of scan conversion sequence Bit location 0/1/2/3/4/5/6/7 represents channels-0/1/2/3/4/5/6/7 respectively. To Add the channel to the scan sequence enable the respective bit. Passing a 0x0 will clear all the selected channels
Range: [0x0 to 0xFF]
- Returns
- None
- Description:
- Adds multiple channels to the scan sequence.
Call this API to insert a multiple channels into the scan request source. This will be added to a scan sequence. The added channels will be a part of the conversion sequence when the next load event occurs. A call to this API would configure the register bit fields of GxASSEL.
- Related APIs:
- XMC_VADC_GROUP_ScanAddChannelToSequence()
void XMC_VADC_GROUP_ScanClearReqSrcEvent | ( | XMC_VADC_GROUP_t *const | group_ptr | ) |
- Parameters
-
group_ptr Constant pointer to the VADC group
- Returns
- None
- Description:
- Acknowledges the scan conversion complete request source event.
This API will clear the request source event that occurred. This will clear a interrupt if it was raised. A call to this API would configure the register bit field GxSEFLAG.SEV1.
- Related APIs:
- XMC_VADC_GROUP_ScanTriggerReqSrcEvent()
void XMC_VADC_GROUP_ScanDisableArbitrationSlot | ( | XMC_VADC_GROUP_t *const | group_ptr | ) |
- Parameters
-
group_ptr Constant pointer to the VADC group
- Returns
- None
- Description:
- Disables arbitration slot of the scan request source.
If the scan request source must have its conversion request considered by the arbiter, it must participate in the arbitration rounds. Even if a load event occurs the scan channel can only be converted when the arbiter comes to the scan slot.A call to this API will lead to all conversions request by scan to be blocked. A call to this API would configure the register bit field GxARBPR.ASEN1.
- Related APIs:
- XMC_VADC_GROUP_ScanEnableArbitrationSlot()
void XMC_VADC_GROUP_ScanDisableContinuousMode | ( | XMC_VADC_GROUP_t *const | group_ptr | ) |
- Parameters
-
group_ptr Constant pointer to the VADC group
- Returns
- None
- Description:
- Disables continuous conversion mode.
Typically for a scan request source to generate conversion request, either a hardware trigger or a software request is a pre-requisite. Using autoscan feature it is possible to start the conversion once and allow the sequence to repeat without any further triggers. Once all channels belonging to a scan request source have been converted, a request source completion event is generated. Generation of this event can restart the scan sequence. By invoking this feature the Autoscan mode of operations is disabled. A call to this API would configure the register bit field GxASMR.SCAN.
- Related APIs:
- XMC_VADC_GROUP_ScanEnableContinuousMode()
void XMC_VADC_GROUP_ScanDisableEvent | ( | XMC_VADC_GROUP_t *const | group_ptr | ) |
- Parameters
-
group_ptr Constant pointer to the VADC group
- Returns
- None
- Description:
- Disables the scan request source event .
By using this API the request source event will be deactivated for the scan request source. Other configurations w.r.t service node pointer are not done in this API. A call to this API would configure the register bit field GxASMR.ENSI.
void XMC_VADC_GROUP_ScanDisableExternalTrigger | ( | XMC_VADC_GROUP_t *const | group_ptr | ) |
- Parameters
-
group_ptr Constant pointer to the VADC group
- Returns
- None
- Description:
- Disables the trigger for scan request source.
By using this API the trigger will be deactivated for the scan request source. This will just deactivate the H/W trigger for the scan request source. If any configuration were done to select the trigger input in GxASCTRL, it will be not be effected by this API. A call to this API would configure the register bit field GxASMR.ENTR.
- Related APIs:
- XMC_VADC_GROUP_ScanEnableExternalTrigger()
void XMC_VADC_GROUP_ScanEnableArbitrationSlot | ( | XMC_VADC_GROUP_t *const | group_ptr | ) |
- Parameters
-
group_ptr Constant pointer to the VADC group
- Returns
- None
- Description:
- Enables arbitration slot of the scan request source.
If the scan request source must have its conversion request considered by the arbiter, it must participate in the arbitration rounds. Even if a load event occurs the scan channel can only be converted when the arbiter comes to the scan slot. Thus this must be enabled if any conversion need to take place. A call to this API would configure the register bit field GxARBPR.ASEN1.
- Related APIs:
- XMC_VADC_GROUP_ScanDisableArbitrationSlot()
void XMC_VADC_GROUP_ScanEnableContinuousMode | ( | XMC_VADC_GROUP_t *const | group_ptr | ) |
- Parameters
-
group_ptr Constant pointer to the VADC group
- Returns
- None
- Description:
- Enables continuous conversion mode.
Typically for a scan request source to generate conversion request, either a hardware trigger or a software request is a pre-requisite. Using autoscan feature it is possible to start the conversion once and allow the sequence to repeat without any further triggers. Once all channels belonging to a scan request source have been converted, a request source completion event is generated. Generation of this event can restart the scan sequence. Every request source event will cause a load event to occur. A call to this API would configure the register bit field GxASMR.SCAN.
- Related APIs:
- XMC_VADC_GROUP_ScanDisableContinuousMode()
void XMC_VADC_GROUP_ScanEnableEvent | ( | XMC_VADC_GROUP_t *const | group_ptr | ) |
- Parameters
-
group_ptr Constant pointer to the VADC group
- Returns
- None
- Description:
- Enables the scan request source event .
By using this API the request source event will be activated for the scan request source. Other configurations w.r.t service node pointer are not done in this API. A call to this API would configure the register bit field GxASMR.ENSI.
void XMC_VADC_GROUP_ScanEnableExternalTrigger | ( | XMC_VADC_GROUP_t *const | group_ptr | ) |
- Parameters
-
group_ptr Constant pointer to the VADC group
- Returns
- None
- Description:
- Enables the trigger for scan request source.
By using this API, the trigger signal will be activated for the scan request source. The trigger signal and trigger edge will be selected from the ASCTRL register. The Selection of a input will be done by XMC_VADC_GROUP_ScanSelectTrigger(). A call to this API would configure the register bit field GxASMR.ENTR.
uint32_t XMC_VADC_GROUP_ScanGetNumChannelsPending | ( | XMC_VADC_GROUP_t *const | group_ptr | ) |
- Parameters
-
group_ptr Constant pointer to the VADC group
- Returns
uint32_t Returns the total channels pending for conversion.
Range: [0x0 to 0x8]
- Description:
- Returns the total number of pending channels.
This API will read the pending channels register and will return the number of channels that are awaiting conversion. When a load event occurs the scan sequence is pushed to a pending conversion register. From the pending register the channels are taken up by the converter. When the API is called it would return the total number of channels pending (GxASPND).
- Related APIs:
- XMC_VADC_GROUP_ScanIsChannelPending()
bool XMC_VADC_GROUP_ScanGetReqSrcEventStatus | ( | XMC_VADC_GROUP_t *const | group_ptr | ) |
- Parameters
-
group_ptr Constant pointer to the VADC group
- Returns
- bool returns true if the service request event is raised. returns false if the service request event was not raised.
- Description:
- Determines if the request source event is asserted.
This API will get the status of the scan request source event. Will return a true if the event has occurred for scan. A call to this API would access the register bit field GxSEFLAG.SEV1.
- Related APIs:
- None.
void XMC_VADC_GROUP_ScanInit | ( | XMC_VADC_GROUP_t *const | group_ptr, |
const XMC_VADC_SCAN_CONFIG_t * | config | ||
) |
- Parameters
-
group_ptr Pointer to the VADC group config Pointer to Scan configuration
- Returns
- None
- Description:
- Initializes the VADC SCAN functional block.
The GROUP SCAN request source functional block converts channels sequentially starting with the highest numbered channel to the lowest. Channels must register themselves as being part of the the scan sequence. A call to this API will first disable the arbitration slot for queue (XMC_VADC_GROUP_ScanEnableArbitrationSlot()) and then it would configure all the related registers with the required configuration values. The arbitration slot is re-enabled at the end of init by invoking XMC_VADC_GROUP_ScanDisableArbitrationSlot(). A call to this API would configure the registers GxARBPR, GxASCTRL, GxASMR needed scan request source.
bool XMC_VADC_GROUP_ScanIsArbitrationSlotEnabled | ( | XMC_VADC_GROUP_t *const | group_ptr | ) |
- Parameters
-
group_ptr Constant pointer to the VADC group
- Returns
- bool returns true if the arbitration is enabled else returns false.
- Description:
- Returns the arbitration status of the scan request source.
If the scan request source must have its conversion request considered by the arbiter, it must participate in the arbitration rounds. Even if a load event occurs the scan channel can only be converted when the arbiter comes to the scan slot. A call to this API would return the status of the arbitration slot of scan. A call to this API would read the register bit field GxARBPR.ASEN1.
bool XMC_VADC_GROUP_ScanIsChannelPending | ( | XMC_VADC_GROUP_t *const | group_ptr, |
const uint32_t | ch_num | ||
) |
- Parameters
-
group_ptr Constant pointer to the VADC group ch_num The channel being audited for completion of conversion
Range: [0x0 to 0x7]
- Returns
- bool returns true if the channel is pending conversion else returns false
- Description:
- Determine if the channel is pending for conversion.
This API will check if the Channel in question is awaiting conversion in the current arbitration round. When a load event occurs the scan sequence is pushed to a pending conversion register. From the pending register the channels are taken up by the converter. This API would return true if the channel is found in the pending register (GxASPND).
- Related APIs:
- XMC_VADC_GROUP_ScanGetNumChannelsPending()
void XMC_VADC_GROUP_ScanRemoveChannel | ( | XMC_VADC_GROUP_t *const | group_ptr, |
const uint32_t | channel_num | ||
) |
- Parameters
-
group_ptr Constant pointer to the VADC group channel_num channel number to be removed from the scan sequence.
- Returns
- None
- Description:
- Removes a channel from the scan sequence.
By using this API the it is possible to remove a single channel from the conversion sequence. The remaining channels will continue however they are. A call to this API would configure the register GxASSEL.
- Related APIs:
- None.
void XMC_VADC_GROUP_ScanSelectGating | ( | XMC_VADC_GROUP_t *const | group_ptr, |
XMC_VADC_GATE_INPUT_SELECT_t | gating_input | ||
) |
- Parameters
-
group_ptr Constant pointer to the VADC group gating_input Module input signal meant to be selected as gating input
- Returns
- None
- Description:
- Select Gating signal for scan request source.
Passage of the trigger input to the request source can be controlled via a gating signal. Any one of the 16 input lines can be chosen as a gating signal. Trigger signal can be given to the scan request source only when the gating signal's active level is detected. Additionally the GxASMR.ENGT has to be configured for the gating signal's active level. A call to this API would configure the register bit field GxASCTRL.GTSEL.
- Related APIs:
- XMC_VADC_GROUP_ScanSelectTrigger()
void XMC_VADC_GROUP_ScanSelectTrigger | ( | XMC_VADC_GROUP_t *const | group_ptr, |
XMC_VADC_TRIGGER_INPUT_SELECT_t | trigger_input | ||
) |
- Parameters
-
group_ptr Constant pointer to the VADC group trigger_input Choice of the input earmarked as a trigger line
- Returns
- None
- Description:
- Select Trigger signal for scan request source.
A scan request source will raise conversion request only if there were either a request from application or occurrence of a hardware trigger. This API selects one of the 16 input lines as a trigger line. This is needed when a hardware trigger is needed for the conversion of the scan request source. Refer to the reference manual to determine the signal that needs to be connected. A call to this API would configure the register bit field GxASCTRL.XTSEL.
void XMC_VADC_GROUP_ScanSelectTriggerEdge | ( | XMC_VADC_GROUP_t *const | group_ptr, |
const XMC_VADC_TRIGGER_EDGE_t | trigger_edge | ||
) |
- Parameters
-
group_ptr Constant pointer to the VADC group trigger_edge Trigger edge selection
- Returns
- None
- Description:
- Selects the trigger edge for scan request source.
A scan request source will raise conversion request only if there were either a request from application or occurrence of a hardware trigger. This API selects one of the 4 possible trigger edges. This is needed when a hardware trigger is needed for the conversion of the scan request source. A call to this API would configure the register bit field GxASCTRL.XTMODE.
- Related APIs:
- XMC_VADC_GROUP_ScanSelectTrigger()
void XMC_VADC_GROUP_ScanSequenceAbort | ( | XMC_VADC_GROUP_t *const | group_ptr | ) |
- Parameters
-
group_ptr Constant pointer to the VADC group
- Returns
- None
- Description:
- Aborts an ongoing scan sequence conversion.
An ongoing sequence can be aborted at any time. The scan unit picks the pending channels one by one from a pending register and requests for their conversion. This API essentially clears the channel pending register thus creating an illusion that there are no more channels left in the sequence. A call to this API would configure the registers GxASMR, GxASCTRL, GxARBPR to achieve the sequence abort.
- Related APIs:
- None.
void XMC_VADC_GROUP_ScanSetGatingMode | ( | XMC_VADC_GROUP_t *const | group_ptr, |
XMC_VADC_GATEMODE_t | mode_sel | ||
) |
- Parameters
-
group_ptr Constant pointer to the VADC group mode_sel Select how the gating is applied to the scan request source
- Returns
- None
- Description:
- Selects the gating mode of scan request source.
Passage of the trigger input to the request source can be controlled via a gating signal. This API determines how the gating signal behaves, either active low or active high. If gating signal needs to ignored XMC_VADC_GATEMODE_IGNORE should be used as the mode_sel.
- Related APIs:
- XMC_VADC_GROUP_ScanSelectGating();
void XMC_VADC_GROUP_ScanSetReqSrcEventInterruptNode | ( | XMC_VADC_GROUP_t *const | group_ptr, |
const XMC_VADC_SR_t | sr | ||
) |
- Parameters
-
group_ptr Constant pointer to the VADC group sr Service Request Id
- Returns
- None
- Description:
- Connects the scan request source event to the SR line of VADC.
This API will connect a Service Request line(SR) to a scan request source event. Hence to get a interrupt on this Service request line one has to enable the required NVIC node. A call to this API would configure the register bit field GxSEVNP.SEV1NP .
- Related APIs:
- None.
void XMC_VADC_GROUP_ScanTriggerConversion | ( | XMC_VADC_GROUP_t *const | group_ptr | ) |
- Parameters
-
group_ptr Constant pointer to the VADC group
- Returns
- None
- Description:
- Generates conversion request (Software initiated conversion).
A conversion request can be raised either upon detection of a hardware trigger, or by software. This API forces the scan unit to generate a conversion request to the analog converter. It is assumed that the scan has already been filled up with entries. A call to this API would configure the register bit field GxASMR.LDEV.
- Related APIs:
- None.
void XMC_VADC_GROUP_ScanTriggerReqSrcEvent | ( | XMC_VADC_GROUP_t *const | group_ptr | ) |
- Parameters
-
group_ptr Constant pointer to the VADC group
- Returns
- None
- Description:
- Manually asserts the conversion complete request source event.
This API will set the request source event for scan. This will trigger a interrupt if the service node pointer for the scan has been configured. A call to this API would configure the register bit field GxSEFLAG.SEV1.
- Related APIs:
- None.
void XMC_VADC_GROUP_SetBoundaries | ( | XMC_VADC_GROUP_t *const | group_ptr, |
const uint32_t | boundary0, | ||
const uint32_t | boundary1 | ||
) |
- Parameters
-
group_ptr Constant pointer to the VADC group whose global boundary registers are to be programmed boundary0 Boundary-0 Value
Range: [0x0 - 0x0FFF]boundary1 Boundary-1 Value
Range: [0x0 - 0x0FFF]
- Returns
- None
- Description:
- Programs the boundaries with boundary0 and boundary1 for result comparison.
These two boundaries can serve as absolute boundaries. They defines a range against which the result of a conversion can be compared. In the fast compare mode, the two boundaries provide hysteresis capability to a compare value. In any case, these boundary values entered here form a boundary pallete. There are dedicated upper and lower boundary registers G_BOUND0 and G_BOUND1 who will derive their values from this palette.
- Related APIs:
- None
void XMC_VADC_GROUP_SetBoundaryEventInterruptNode | ( | XMC_VADC_GROUP_t *const | group_ptr, |
const uint8_t | boundary_flag_num, | ||
const XMC_VADC_BOUNDARY_NODE_t | node | ||
) |
- Parameters
-
group_ptr Constant pointer to the VADC group boundary_flag_num The Boundary flag for which the interrupt node needs to be configured. Range: [0x0 to 0x3] node Service Request node Id
- Returns
- None
- Description:
- Connects the boundary event to the SR line of VADC or to a common boundary flag.
This API will connect a Service Request line(SR) to a boundary event. Hence to get a interrupt on this Service request line one has to enable the required NVIC node. A call to this API would configure the register bit field GxBFLNP.BFLxNP.
- Related APIs:
- None.
void XMC_VADC_GROUP_SetChannelAlias | ( | XMC_VADC_GROUP_t *const | group_ptr, |
const uint32_t | src_ch_num, | ||
const uint32_t | alias_ch_num | ||
) |
- Parameters
-
group_ptr Constant pointer to the VADC group src_ch_num Channel which will be converted by alias_ch_num, when called by the request source.
Range:[0x0 to 0x7]alias_ch_num This is the alias channel (Ch-0 or Ch-1)
Range:[0x0, 0x1]
- Returns
- None
- Description:
- Sets the Alias channel(alias_ch_num) to convert from the source channel(src_ch_num).
When a alias configuration takes place the request source(queue/scan/background) will not call channel src_ch_num. The Request sources will call the channel alias_ch_num , this would invoke the conversion of the pin associated with src_ch_num. The configuration of the alias channel (alias_ch_num) will be used for the conversion.
When an alias channel (Ch-0 or Ch-1) receives a trigger, it converts the aliased channel (src_ch_num). The properties of Ch-0 or Ch-1 (as indicated in alias_ch_num ) apply when src_ch_num is converted. A call to this API would configure the register GxALIAS.
- Note:
- Alias Channel (alias_ch_num) and the source channel (src_ch_num) cannot be the same. If they are, that alias feature is not used for the conversion. In order to Reset the alias feature that was previously selected this method can be used.
- Related APIs:
- None.
void XMC_VADC_GROUP_SetIndividualBoundary | ( | XMC_VADC_GROUP_t *const | group_ptr, |
const XMC_VADC_CHANNEL_BOUNDARY_t | selection, | ||
const uint16_t | boundary_value | ||
) |
- Parameters
-
group_ptr Constant pointer to the VADC group selection The boundary value selected for boundary_value. boundary_value Select the boundary value.
- Returns
- None
- Description:
- Programs the boundary with boundary_value for result comparison.
This defines a range against which the result of a conversion can be compared. In the fast compare mode, the two boundaries provide hysteresis capability to a compare value.
- Related APIs:
- None.
void XMC_VADC_GROUP_SetPowerMode | ( | XMC_VADC_GROUP_t *const | group_ptr, |
const XMC_VADC_GROUP_POWERMODE_t | power_mode | ||
) |
- Parameters
-
group_ptr Constant pointer to the VADC Group. power_mode Desired power mode
- Returns
- None
- Description:
- Configures the power mode of a VADC group.
For a VADC group to actually convert an analog signal, its analog converter must be turned on.
- Related APIs:
- None
void XMC_VADC_GROUP_SetResultFastCompareValue | ( | XMC_VADC_GROUP_t *const | group_ptr, |
const uint32_t | res_reg, | ||
const XMC_VADC_RESULT_SIZE_t | compare_val | ||
) |
- Parameters
-
group_ptr Constant pointer to the VADC group res_reg Result Register for which the compare value is being set
Range: [0x0 to 0xF]compare_val The compare value itself
Range: [0x0 to 0xFFF]
- Returns
- None
- Description:
- Configures the compare value (relevant to the Fast Compare Mode).
A channel input can be converted and its value stored in its result register. Alternatively, the channel input can be converted and compared against a compare value. This is the fast compare mode typically utilized by applications that are not interested in absolute converted value of an analog input, but rather a binary decision on how the input fares against a preset compare value. The channel should have had already chosen the correct ICLASS with the fast compare mode enabled. compare_val would be the compare value on which FCM bit in the result register will be set. The FCM bit will be set if the analog voltage is greater than the compare value. A call to this API would configure the register bit field GxRES.RESULT.
- Related APIs:
- XMC_VADC_GROUP_GetFastCompareResult().
void XMC_VADC_GROUP_SetResultInterruptNode | ( | XMC_VADC_GROUP_t *const | group_ptr, |
const uint32_t | res_reg, | ||
const XMC_VADC_SR_t | sr | ||
) |
- Parameters
-
group_ptr Constant pointer to the VADC group res_reg Result Register for which the result event is being asserted
Range: [0x0 to 0xF]sr The SR line to which the result event must be connected
- Returns
- None
- Description:
- Binds a result event to a requested Service Request line.
The result event is connected to a service request line. For an event to result in an interrupt, this service request line must be enabled in VADC and the NVIC node which this service request line is connected to must have interrupt generation enabled. A call to this API would access the registers GxREVNP0 GxREVNP1.
void XMC_VADC_GROUP_SetResultSubtractionValue | ( | XMC_VADC_GROUP_t *const | group_ptr, |
const uint16_t | subtraction_val | ||
) |
- Parameters
-
group_ptr Constant pointer to the VADC group subtraction_val 12 bit subtraction value
Range: [0x0 to 0xFFF]
- Returns
- None
- Description:
- Configures the subtraction value (relevant to the Difference Mode).
A channel input can be converted and its value stored in its result register. Alternatively, the channel input can be converted and subtracted with the value stored in GxRES[0]. This Difference Mode typically utilized by applications that are not interested in absolute converted value of an analog input, but rather a difference of converted values. Subtraction value will always be present in the GxRES[0] and thus this API would configure that register.
- Related APIs:
- None.
void XMC_VADC_GROUP_SetSyncMaster | ( | XMC_VADC_GROUP_t *const | group_ptr | ) |
- Parameters
-
group_ptr Constant pointer to the VADC group.
- Returns
- None
- Description:
- Configures a VADC Group as a master group.
Conversion of identically numbered channels across groups can be synchronized. For example, when the trigger to convert CH-1 of Group-2 is received, it is possible to simultaneously request conversion of CH-1 of Group-0 and Group-3. Group-2 in this example is therefore the master group while Groups-0 and 3 are the slave groups.
- Related APIs:
- None
void XMC_VADC_GROUP_SetSyncReadySignal | ( | XMC_VADC_GROUP_t *const | group_ptr, |
uint32_t | mask | ||
) |
- Parameters
-
group_ptr Constant Pointer to the VADC Group eval_mask mask to configure the eval bits Use XMC_VADC_SYNCTR_EVAL_t to create the mask.
- Returns
- None
- Description:
- Set the Eval bits of the group.
For Synchronized conversion the master's ready signal configuration must be copied onto the slaves. A call to this API would configure the Sync EVAL Bits (GxSYNCTR.EVALy).
void XMC_VADC_GROUP_SetSyncSlave | ( | XMC_VADC_GROUP_t *const | group_ptr, |
uint32_t | master_grp, | ||
uint32_t | slave_group | ||
) |
- Parameters
-
group_ptr Constant pointer to the VADC Group which must be set as a slave master_grp The master group number
Range: [0x0 - 0x3]slave_group The slave group number
Range: [0x0 - 0x3]
- Returns
- None
- Description:
- Configures a VADC Group as a slave group.
Conversion of identically numbered channels across groups can be synchronized. For example, when the trigger to convert CH-1 of Group-2 is received, it is possible to simultaneously request conversion of CH-1 of Group-0 and Group-3. Group-2 in this example is therefore the master group while Groups-0 and 3 are the slave groups. It uses the SYNCCTR register for the configuration settings.
void XMC_VADC_GROUP_SetSyncSlaveReadySignal | ( | XMC_VADC_GROUP_t *const | group_ptr, |
uint32_t | eval_waiting_group, | ||
uint32_t | eval_origin_group | ||
) |
- Parameters
-
group_ptr Constant Pointer to the VADC Group waiting for ready signal eval_waiting_group The VADC Group which expects a ready signal to start it's conversion. eval_origin_group The VADC Group from which the eval_waiting_group will expect a ready signal
- Returns
- None
- Description:
- Sets the ready signal in the eval_waiting_group .
For Synchronized conversion all the slaves participating need to configure the ready signal. A slave group will also need to configure the ready signals coming from the other slave groups. A call to this API would configure the Sync.slave's EVAL Bits (GxSYNCTR.EVALy).
void XMC_VADC_GROUP_TriggerResultEvent | ( | XMC_VADC_GROUP_t *const | group_ptr, |
const uint32_t | res_reg | ||
) |
- Parameters
-
group_ptr Constant pointer to the VADC group res_reg Result Register for which the result event is being asserted
Range: [0x0 to 0xF]
- Returns
- None
- Description:
- Manually asserts the result event.
The result event must necessarily be connected to a SR line. The SR in turn must have been enabled along with the corresponding NVIC node. Only then will the assertion of RES event lead to an interrupt. A call to this API would access the register bit fieldS OF GxREFLAG.
- Related APIs:
- XMC_VADC_GROUP_ClearResultEvent().
void XMC_VADC_GROUP_TriggerServiceRequest | ( | XMC_VADC_GROUP_t *const | group_ptr, |
const uint32_t | sr_num, | ||
const XMC_VADC_GROUP_IRQ_t | type | ||
) |
- Parameters
-
group_ptr Constant pointer to the VADC group sr_num The service request number (0 through 3) type IRQ type (Kernel specific interrupt vs Module wide shared interrupt )
- Returns
- None
- Description:
- Activates a Service Request line(manually trigger).
VADC provides few SR lines for each group and a few more which is shared across all the groups. These SR lines can be connected to an NVIC node which in-turn would generate an interrupt. This API would manually trigger the given SR line. Could be used for evaluation and testing purposes.
- Related APIs:
- None
Generated on Mon Aug 7 2017 11:33:57 for XMC Peripheral Library for XMC4000 Family by 1.8.11