SDFM Module

The Sigma-Delta Filter Module (SDFM) API provides a set of functions for configuring and using the SDFM module. The functions provided allow the user to setup and configure the Input data type to SDFM filters, the Primary (data) and Secondary (comparator) filters, Data FIFO, the PWM - SDFM sync signals, comparator threshold values and interrupt sources. Functions are also provided to read the filter data and the status of the SDFM module components.

Note that the Secondary (comparator) Filter configuration APIs have the “Comp” key word embedded to represent access to the Comparator sub-module. For example the function SDFM_setComparatorFilterType() sets the comparator filter type while SDFM_setFilterType() sets the primary filter type.

APIs providing higher level abstraction are also available in the sdfm.c source file. These APIs can be used to configure the Comparator, Data Filter and the Data filter FIFO.

{color{red} textsc{Note: The Manchester modulator clock mode is no longer supported in SDFM for this device. The required software changes are scoped for next C2000Ware release and are not supported in this release. Users are advised to not use this feature on this device.}}

group sdfm_api

Defines

SDFM_GET_LOW_THRESHOLD(C) ((uint16_t)(C))

Macro to get the low threshold

SDFM_GET_HIGH_THRESHOLD(C) ((uint16_t)((uint32_t)(C) >> 16U))

Macro to get the high threshold

SDFM_GET_LOW_THRESHOLD_BOTH(C1, C2) ((((uint32_t)(SDFM_GET_LOW_THRESHOLD

(C2))) << 16U) | \

((uint32_t)(

SDFM_GET_LOW_THRESHOLD(C1))))

Macro to get the high threshold 1 & 2 to be passed as lowThreshold parameter to SDFM_setCompFilterLowThreshold().

SDFM_GET_HIGH_THRESHOLD_BOTH(C1, C2) ((((uint32_t)(SDFM_GET_HIGH_THRESHOLD

(C2))) << 16U) | \

((uint32_t)(

SDFM_GET_HIGH_THRESHOLD(C1))))

Macro to get the high threshold 1 & 2 to be passed as highThreshold parameter to SDFM_setCompFilterHighThreshold().

SDFM_SET_OSR(X) (((X) - 1U) << 8U)

Macro to convert comparator over sampling ratio to acceptable bit location

SDFM_SHIFT_VALUE(X) ((X) << 2U)

Macro to convert the data shift bit values to acceptable bit location

SDFM_THRESHOLD(H, L) ((((uint32_t)(H)) << 16U) | (L))

Macro to combine high threshold and low threshold values

SDFM_SET_FIFO_LEVEL(X) ((X) << 7U)

Macro to set the FIFO level to acceptable bit location

SDFM_SET_ZERO_CROSS_THRESH_VALUE(X) (0x8000 | (X))

Macro to set and enable the zero cross threshold value.

SDFM_FILTER_DISABLE 0x0U

Macros to enable or disable filter.

SDFM_FILTER_ENABLE 0x2U
SDFM_SDFIL_OFFSET (SDFM_O_SDCTLPARM2 - SDFM_O_SDCTLPARM1)

< SD filter offset

Event Digital filter offset

SDFM_DIGFIL_OFFSET (SDFM_O_SDCOMP2CTL - SDFM_O_SDCOMP1CTL)

Offset between high threshold 1 & 2 registers.

SDFM_SDFLT1CMPHx_OFFSET (SDFM_O_SDFLT1CMPH2 - SDFM_O_SDFLT1CMPH1)

Offset between low threshold 1 & 2 registers.

SDFM_SDFLT1CMPLx_OFFSET (SDFM_O_SDFLT1CMPL2 - SDFM_O_SDFLT1CMPL1)
SDFM_COMPEVT_FILTER_CONFIG_M (SDFM_SDCOMP1EVT1FLTCTL_SAMPWIN_M

| \

SDFM_SDCOMP1EVT1FLTCTL_THRESH_M)
SDFM_COMPEVT_FILTER_LOCK_M

(SDFM_SDCOMPLOCK_SDCOMPCTL | \

SDFM_SDCOMPLOCK_COMP)


SDFM_CLOCK_SYNCHRONIZER SDFM_SDCTLPARM1_SDCLKSYNC

Define for Clock synchronizer Configuration.

SDFM_DATA_SYNCHRONIZER SDFM_SDCTLPARM1_SDDATASYNC

Define for Data Synchronizer Configuration.

SDFM_MODULATOR_FAILURE_INTERRUPT 0x200U

Interrupt is generated if Modulator fails.

SDFM_LOW_LEVEL_THRESHOLD_INTERRUPT 0x40U

Interrupt on Comparator low-level threshold.

SDFM_HIGH_LEVEL_THRESHOLD_INTERRUPT 0x20U

Interrupt on Comparator high-level threshold.

SDFM_DATA_FILTER_ACKNOWLEDGE_INTERRUPT 0x1U

Interrupt on Acknowledge flag

SDFM_FIFO_INTERRUPT 0x1000U

Interrupt on FIFO level

SDFM_FIFO_OVERFLOW_INTERRUPT 0x8000U

Interrupt on FIFO overflow

SDFM_MAIN_INTERRUPT_FLAG 0x80000000U

Main interrupt flag

SDFM_FILTER_1_HIGH_THRESHOLD_FLAG 0x1U

Filter 1 high -level threshold flag

SDFM_FILTER_1_LOW_THRESHOLD_FLAG 0x2U

Filter 1 low -level threshold flag

SDFM_FILTER_2_HIGH_THRESHOLD_FLAG 0x4U

Filter 2 high -level threshold flag

SDFM_FILTER_2_LOW_THRESHOLD_FLAG 0x8U

Filter 2 low -level threshold flag

SDFM_FILTER_3_HIGH_THRESHOLD_FLAG 0x10U

Filter 3 high -level threshold flag

SDFM_FILTER_3_LOW_THRESHOLD_FLAG 0x20U

Filter 3 low -level threshold flag

SDFM_FILTER_4_HIGH_THRESHOLD_FLAG 0x40U

Filter 4 high -level threshold flag

SDFM_FILTER_4_LOW_THRESHOLD_FLAG 0x80U

Filter 4 low -level threshold flag

SDFM_FILTER_1_MOD_FAILED_FLAG 0x100U

Filter 1 modulator failed flag

SDFM_FILTER_2_MOD_FAILED_FLAG 0x200U

Filter 2 modulator failed flag

SDFM_FILTER_3_MOD_FAILED_FLAG 0x400U

Filter 3 modulator failed flag

SDFM_FILTER_4_MOD_FAILED_FLAG 0x800U

Filter 4 modulator failed flag

SDFM_FILTER_1_NEW_DATA_FLAG 0x1000U

Filter 1 new data flag

SDFM_FILTER_2_NEW_DATA_FLAG 0x2000U

Filter 2 new data flag

SDFM_FILTER_3_NEW_DATA_FLAG 0x4000U

Filter 3 new data flag

SDFM_FILTER_4_NEW_DATA_FLAG 0x8000U

Filter 4 new data flag

SDFM_FILTER_1_FIFO_OVERFLOW_FLAG 0x10000U

Filter 1 FIFO overflow flag

SDFM_FILTER_2_FIFO_OVERFLOW_FLAG 0x20000U

Filter 2 FIFO overflow flag

SDFM_FILTER_3_FIFO_OVERFLOW_FLAG 0x40000U

Filter 3 FIFO overflow flag

SDFM_FILTER_4_FIFO_OVERFLOW_FLAG 0x80000U

Filter 4 FIFO overflow flag

SDFM_FILTER_1_FIFO_INTERRUPT_FLAG 0x100000U

Filter 1 FIFO overflow flag

SDFM_FILTER_2_FIFO_INTERRUPT_FLAG 0x200000U

Filter 2 FIFO overflow flag

SDFM_FILTER_3_FIFO_INTERRUPT_FLAG 0x400000U

Filter 3 FIFO overflow flag

SDFM_FILTER_4_FIFO_INTERRUPT_FLAG 0x800000U

Filter 4 FIFO overflow flag

Enums

enum SDFM_OutputThresholdStatus

Values that can be returned from SDFM_getThresholdStatus()

Values:

enumerator SDFM_OUTPUT_WITHIN_THRESHOLD = 0

SDFM output is within threshold.

enumerator SDFM_OUTPUT_ABOVE_THRESHOLD = 1

SDFM output is above threshold.

enumerator SDFM_OUTPUT_BELOW_THRESHOLD = 2

SDFM output is below threshold.

enum SDFM_FilterNumber

Values that can be passed to all functions as the filterNumber parameter.

Values:

enumerator SDFM_FILTER_1 = 0

Digital filter 1.

enumerator SDFM_FILTER_2 = 1

Digital filter 2.

enumerator SDFM_FILTER_3 = 2

Digital filter 3.

enumerator SDFM_FILTER_4 = 3

Digital filter 4.

enum SDFM_FilterType

Values that can be passed to SDFM_setFilterType(), SDFM_setComparatorFilterType() as the filterType parameter.

Values:

enumerator SDFM_FILTER_SINC_FAST = 0x00

Digital filter with SincFast structure.

enumerator SDFM_FILTER_SINC_1 = 0x10

Digital filter with Sinc1 structure.

enumerator SDFM_FILTER_SINC_2 = 0x20

Digital filter with Sinc3 structure.

enumerator SDFM_FILTER_SINC_3 = 0x30

Digital filter with Sinc4 structure.

enum SDFM_ModulatorClockMode

Values that can be passed to SDFM_setupModulatorClock(),as the clockMode parameter.

Values:

enumerator SDFM_MODULATOR_CLK_EQUAL_DATA_RATE = 0

Modulator clock is identical to the data rate.

enum SDFM_OutputDataFormat

Values that can be passed to SDFM_setOutputDataFormat(),as the dataFormat parameter.

Values:

enumerator SDFM_DATA_FORMAT_16_BIT = 0

Filter output is in 16 bits 2’s complement format.

enumerator SDFM_DATA_FORMAT_32_BIT = 1

Filter output is in 32 bits 2’s complement format.

enum SDFM_DataReadyInterruptSource

Values that can be passed to SDFM_setDataReadyInterruptSource(),as the dataReadySource parameter.

Values:

enumerator SDFM_DATA_READY_SOURCE_DIRECT = 0

Data ready interrupt source is direct (non -FIFO).

enumerator SDFM_DATA_READY_SOURCE_FIFO = 1

Data ready interrupt source is FIFO.

enum SDFM_PWMSyncSource

Values that can be passed to SDFM_setPWMSyncSource(),as the syncSource parameter.

Values:

enumerator SDFM_SYNC_PWM1_SOCA = 0

SDFM sync source is PWM1 SOCA.

enumerator SDFM_SYNC_PWM1_SOCB = 1

SDFM sync source is PWM1 SOCB.

enumerator SDFM_SYNC_PWM2_SOCA = 4

SDFM sync source is PWM2 SOCA.

enumerator SDFM_SYNC_PWM2_SOCB = 5

SDFM sync source is PWM2 SOCB.

enumerator SDFM_SYNC_PWM3_SOCA = 8

SDFM sync source is PWM3 SOCA.

enumerator SDFM_SYNC_PWM3_SOCB = 9

SDFM sync source is PWM3 SOCB.

enumerator SDFM_SYNC_PWM4_SOCA = 12

SDFM sync source is PWM4 SOCA.

enumerator SDFM_SYNC_PWM4_SOCB = 13

SDFM sync source is PWM4 SOCB.

enumerator SDFM_SYNC_PWM5_SOCA = 16

SDFM sync source is PWM5 SOCA.

enumerator SDFM_SYNC_PWM5_SOCB = 17

SDFM sync source is PWM5 SOCB.

enumerator SDFM_SYNC_PWM6_SOCA = 20

SDFM sync source is PWM6 SOCA.

enumerator SDFM_SYNC_PWM6_SOCB = 21

SDFM sync source is PWM6 SOCB.

enumerator SDFM_SYNC_PWM7_SOCA = 24

SDFM sync source is PWM7 SOCA.

enumerator SDFM_SYNC_PWM7_SOCB = 25

SDFM sync source is PWM7 SOCB.

enumerator SDFM_SYNC_PWM8_SOCA = 28

SDFM sync source is PWM8 SOCA.

enumerator SDFM_SYNC_PWM8_SOCB = 29

SDFM sync source is PWM8 SOCB.

enumerator SDFM_SYNC_PWM9_SOCA = 32

SDFM sync source is PWM9 SOCA.

enumerator SDFM_SYNC_PWM9_SOCB = 33

SDFM sync source is PWM9 SOCB.

enumerator SDFM_SYNC_PWM10_SOCA = 36

SDFM sync source is PWM10 SOCA.

enumerator SDFM_SYNC_PWM10_SOCB = 37

SDFM sync source is PWM10 SOCB.

enumerator SDFM_SYNC_PWM11_SOCA = 40

SDFM sync source is PWM11 SOCA.

enumerator SDFM_SYNC_PWM11_SOCB = 41

SDFM sync source is PWM11 SOCB.

enumerator SDFM_SYNC_PWM12_SOCA = 44

SDFM sync source is PWM12 SOCA.

enumerator SDFM_SYNC_PWM12_SOCB = 45

SDFM sync source is PWM12 SOCB.

enumerator SDFM_SYNC_PWM13_SOCA = 48

SDFM sync source is PWM13 SOCA.

enumerator SDFM_SYNC_PWM13_SOCB = 49

SDFM sync source is PWM13 SOCB.

enumerator SDFM_SYNC_PWM14_SOCA = 52

SDFM sync source is PWM14 SOCA.

enumerator SDFM_SYNC_PWM14_SOCB = 53

SDFM sync source is PWM14 SOCB.

enumerator SDFM_SYNC_PWM15_SOCA = 56

SDFM sync source is PWM15 SOCA.

enumerator SDFM_SYNC_PWM15_SOCB = 57

SDFM sync source is PWM15 SOCB.

enumerator SDFM_SYNC_PWM16_SOCA = 60

SDFM sync source is PWM16 SOCA.

enumerator SDFM_SYNC_PWM16_SOCB = 61

SDFM sync source is PWM16 SOCB.

enum SDFM_FIFOClearSyncMode

Values that can be passed to SDFM_setFIFOClearOnSyncMode(),as the fifoClearSyncMode parameter.

Values:

enumerator SDFM_FIFO_NOT_CLEARED_ON_SYNC = 0

SDFM FIFO buffer is not cleared on Sync signal.

enumerator SDFM_FIFO_CLEARED_ON_SYNC = 1

SDFM FIFO buffer is cleared on Sync signal.

enum SDFM_WaitForSyncClearMode

Values that can be passed to SDFM_setWaitForSyncClearMode(),as the syncClearMode parameter.

Values:

enumerator SDFM_MANUAL_CLEAR_WAIT_FOR_SYNC = 0

Wait for sync cleared using software.

enumerator SDFM_AUTO_CLEAR_WAIT_FOR_SYNC = 1

Wait for sync cleared automatically.

enum SDFM_CompEventNumber

Values that can be passed to SDFM_selectCompEventSource() as the compEventNum parameter.

Values:

enumerator SDFM_COMP_EVENT_1 = 11U

Selects CEVT1.

enumerator SDFM_COMP_EVENT_2 = 14U

Selects CEVT2.

enum SDFM_CompEventSource

Values that can be passed to SDFM_selectCompEventSource() as the compEventSource parameter.

Values:

enumerator SDFM_COMP_EVENT_SRC_COMPH1 = 0

COMPH1 event is the source.

enumerator SDFM_COMP_EVENT_SRC_COMPH1_L1 = 1

Either of COMPH1 or COMPL1 event can be the source

enumerator SDFM_COMP_EVENT_SRC_COMPH2 = 2

COMPH2 event is the source.

enumerator SDFM_COMP_EVENT_SRC_COMPH2_L2 = 3

Either of COMPH2 or COMPL2 event can be the source

enumerator SDFM_COMP_EVENT_SRC_COMPL1 = 0

COMPL1 event is the source.

enumerator SDFM_COMP_EVENT_SRC_COMPL2 = 2

COMPL2 event is the source.

enum SDFM_ClockSource

Values that can be passed to SDFM_selectClockSource() as the clkSource parameter.

Values:

enumerator SDFM_CLK_SOURCE_CHANNEL_CLK = 0x0

Source is respective channel clock.

enumerator SDFM_CLK_SOURCE_SD1_CLK = 0x8U

Source is SD1 channel clock is the source.

enum SDFM_CompEventHighSource

Values that can be passed to SDFM_selectCompEventHighSource() as the source parameter.

Values:

enumerator SDFM_COMPHOUT_SOURCE_COMPHIN = 0x0

Comparator event high source is unfiltered event.

enumerator SDFM_COMPHOUT_SOURCE_FILTER = 0x8

Comparator event high source is filtered event.

enum SDFM_CompEventLowSource

Values that can be passed to SDFM_selectCompEventLowSource() as the source parameter.

Values:

enumerator SDFM_COMPLOUT_SOURCE_COMPLIN = 0x000

Comparator event low source is unfiltered event.

enumerator SDFM_COMPLOUT_SOURCE_FILTER = 0x800

Comparator event low source is filtered event.

Functions

void SDFM_enableExternalReset(uint32_t base, SDFM_FilterNumber filterNumber)

Enable external reset

This function enables data filter to be reset by an external source (PWM compare output).

Parameters
  • base: is the base address of the SDFM module

  • filterNumber: is the filter number.

Return

None.

void SDFM_disableExternalReset(uint32_t base, SDFM_FilterNumber filterNumber)

Disable external reset

This function disables data filter from being reset by an external source (PWM compare output).

Parameters
  • base: is the base address of the SDFM module

  • filterNumber: is the filter number.

Return

None.

void SDFM_enableFilter(uint32_t base, SDFM_FilterNumber filterNumber)

Enable filter

This function enables the filter specified by the

filterNumber variable.
Parameters
  • base: is the base address of the SDFM module

  • filterNumber: is the filter number.

Return

None.

void SDFM_disableFilter(uint32_t base, SDFM_FilterNumber filterNumber)

Disable filter

This function disables the filter specified by the

filterNumber variable.
Parameters
  • base: is the base address of the SDFM module

  • filterNumber: is the filter number.

Return

None.

void SDFM_enableFIFOBuffer(uint32_t base, SDFM_FilterNumber filterNumber)

Enable FIFO buffer

This function enables the filter FIFO buffer specified by the

filterNumber variable.
Parameters
  • base: is the base address of the SDFM module

  • filterNumber: is the filter number.

Return

None.

void SDFM_disableFIFOBuffer(uint32_t base, SDFM_FilterNumber filterNumber)

Disable FIFO buffer

This function disables the filter FIFO buffer specified by the

filterNumber variable.
Parameters
  • base: is the base address of the SDFM module

  • filterNumber: is the filter number.

Return

None.

bool SDFM_getZeroCrossTripStatus(uint32_t base, SDFM_FilterNumber filterNumber)

Return the Zero Cross Trip status

This function returns the Zero Cross Trip status for the filter specified by filterNumber variable.

Parameters
  • base: is the base address of the SDFM module

  • filterNumber: is the filter number.

Return

true if Comparator filter output >= High-level threshold (Z) false if Comparator filter output < High-level threshold (Z)

void SDFM_clearZeroCrossTripStatus(uint32_t base, SDFM_FilterNumber filterNumber)

Clear the Zero Cross Trip status

This function clears the Zero Cross Trip status for the filter specified by filterNumber variable.

Parameters
  • base: is the base address of the SDFM module

  • filterNumber: is the filter number.

Return

None.

void SDFM_enableComparator(uint32_t base, SDFM_FilterNumber filterNumber)

Enable Comparator.

This function enables the Comparator for the selected filter.

Parameters
  • base: is the base address of the SDFM module

  • filterNumber: is the filter number.

Return

None.

void SDFM_disableComparator(uint32_t base, SDFM_FilterNumber filterNumber)

Disable Comparator.

This function disables the Comparator for the selected filter.

Parameters
  • base: is the base address of the SDFM module

  • filterNumber: is the filter number.

Return

None.

void SDFM_selectCompEventSource(uint32_t base, SDFM_FilterNumber filterNumber, SDFM_CompEventNumber compEventNum, SDFM_CompEventSource compEventSource)

Selects Comparator Event Source.

This function selects the comparator event source. Valid values for

compEventNum are:
  • SDFM_COMP_EVENT_1 - Selects comparator event 1

  • SDFM_COMP_EVENT_2 - Selects comparator event 2 Valid values for SDFM_COMP_EVENT_1 are:

  • SDFM_COMP_EVENT_SRC_COMPH1 - COMPH1 event is the source for selected event

  • SDFM_COMP_EVENT_SRC_COMPH1_L1 - Either of COMPH1 or COMPL1 event can be the source for selected event

  • SDFM_COMP_EVENT_SRC_COMPH2 - COMPH2 event is the source for selected event

  • SDFM_COMP_EVENT_SRC_COMPH2_L2 - Either of COMPH2 or COMPL2 event can be the source for selected event

Parameters
  • base: is the base address of the SDFM module

  • filterNumber: is the filter number

  • compEventNum: is the event number

  • compEventSource: is the event source

Valid values for SDFM_COMP_EVENT_2 are:

  • SDFM_COMP_EVENT_SRC_COMPL1 - COMPL1 event is the source for selected event

  • SDFM_COMP_EVENT_SRC_COMPH1_L1 - Either of COMPH1 or COMPL1 event can be the source for selected event

  • SDFM_COMP_EVENT_SRC_COMPL2 - COMPL2 event is the source for selected event

  • SDFM_COMP_EVENT_SRC_COMPH2_L2 - Either of COMPH2 or COMPL2 event can be the source for selected event

Return

None.

void SDFM_setFilterType(uint32_t base, SDFM_FilterNumber filterNumber, SDFM_FilterType filterType)

Set filter type.

This function sets the filter type or structure to be used as specified by filterType for the selected filter number as specified by filterNumber.

Parameters
  • base: is the base address of the SDFM module

  • filterNumber: is the filter number.

  • filterType: is the filter type or structure.

Return

None.

void SDFM_setFilterOverSamplingRatio(uint32_t base, SDFM_FilterNumber filterNumber, uint16_t overSamplingRatio)

Set data filter over sampling ratio.

This function sets the filter oversampling ratio for the filter specified by the filterNumber variable.Valid values for the variable overSamplingRatio are 0 to 255 inclusive. The actual oversampling ratio will be this value plus one.

Parameters
  • base: is the base address of the SDFM module

  • filterNumber: is the filter number.

  • overSamplingRatio: is the data filter over sampling ratio.

Return

None.

void SDFM_setupModulatorClock(uint32_t base, SDFM_FilterNumber filterNumber, SDFM_ModulatorClockMode clockMode)

Set modulator clock mode.

This function sets the modulator clock mode specified by clockMode for the filter specified by filterNumber.

Parameters
  • base: is the base address of the SDFM module

  • filterNumber: is the filter number.

  • clockMode: is the modulator clock mode.

Note

This function also enables the data and clock synchronizers for the specified filter.

Return

None.

void SDFM_setOutputDataFormat(uint32_t base, SDFM_FilterNumber filterNumber, SDFM_OutputDataFormat dataFormat)

Set the output data format

This function sets the output data format for the filter specified by filterNumber.

Parameters
  • base: is the base address of the SDFM module

  • filterNumber: is the filter number.

  • dataFormat: is the output data format.

Return

None.

void SDFM_setDataShiftValue(uint32_t base, SDFM_FilterNumber filterNumber, uint16_t shiftValue)

Set data shift value.

This function sets the shift value for the 16 bit 2’s complement data format. The valid maximum value for shiftValue is 31.

Parameters
  • base: is the base address of the SDFM module

  • filterNumber: is the filter number.

  • shiftValue: is the data shift value.

Note: Use this function with 16 bit 2’s complement data format only.

Return

None.

void SDFM_setCompFilterHighThreshold(uint32_t base, SDFM_FilterNumber filterNumber, uint32_t highThreshold)

Set Filter output high-level threshold.

This function sets the unsigned high-level threshold value for the Comparator filter output. If the output value of the filter exceeds highThreshold and interrupt generation is enabled, an interrupt will be issued. The param

highThreshold takes both high threshold 1 & 2 values. The upper 16-bits represent the high threshold 2 value while lower 16-bits represent the threshold 1 values.
Parameters
  • base: is the base address of the SDFM module

  • filterNumber: is the filter number.

  • highThreshold: is the high-level threshold 1 & 2.

Return

None.

void SDFM_setCompFilterLowThreshold(uint32_t base, SDFM_FilterNumber filterNumber, uint32_t lowThreshold)

Set Filter output low-level threshold.

This function sets the unsigned low-level threshold value 1 or 2 for the Comparator filter output. If the output value of the filter gets below lowThreshold and interrupt generation is enabled, an interrupt will be issued. The param

lowThreshold takes both low threshold 1 & 2 values. The upper 16-bits represent the low threshold 2 value while lower 16-bits represent the threshold 1 values.
Parameters
  • base: is the base address of the SDFM module

  • filterNumber: is the filter number

  • lowThreshold: is the low-level threshold

Return

None.

void SDFM_setCompFilterZeroCrossThreshold(uint32_t base, SDFM_FilterNumber filterNumber, uint16_t zeroCrossThreshold)

Set Filter output zero-cross threshold.

This function sets the unsigned zero-cross threshold value for the Comparator filter output.

Parameters
  • base: is the base address of the SDFM module

  • filterNumber: is the filter number.

  • zeroCrossThreshold: is the zero-cross threshold.

Return

None.

void SDFM_enableZeroCrossEdgeDetect(uint32_t base, SDFM_FilterNumber filterNumber)

Enable zero-cross Edge detect mode.

This function enables Zero Cross Edge detection.

Parameters
  • base: is the base address of the SDFM module

  • filterNumber: is the filter number.

Return

None.

void SDFM_disableZeroCrossEdgeDetect(uint32_t base, SDFM_FilterNumber filterNumber)

Disable zero-cross Edge detect mode.

This function disables Zero Cross Edge detection.

Parameters
  • base: is the base address of the SDFM module

  • filterNumber: is the filter number.

Return

None.

void SDFM_enableInterrupt(uint32_t base, SDFM_FilterNumber filterNumber, uint16_t intFlags)

Enable SDFM interrupts.

This function enables the low threshold , high threshold or modulator failure interrupt as determined by intFlags for the filter specified by filterNumber. Valid values for intFlags are: SDFM_MODULATOR_FAILURE_INTERRUPT , SDFM_LOW_LEVEL_THRESHOLD_INTERRUPT, SDFM_HIGH_LEVEL_THRESHOLD_INTERRUPT, SDFM_FIFO_INTERRUPT, SDFM_FIFO_OVERFLOW_INTERRUPT,SDFM_DATA_FILTER_ACKNOWLEDGE_INTERRUPT

Parameters
  • base: is the base address of the SDFM module

  • filterNumber: is the filter number.

  • intFlags: is the interrupt source.

Return

None.

void SDFM_disableInterrupt(uint32_t base, SDFM_FilterNumber filterNumber, uint16_t intFlags)

Disable SDFM interrupts.

This function disables the low threshold , high threshold or modulator failure interrupt as determined by intFlags for the filter specified by filterNumber. Valid values for intFlags are: SDFM_MODULATOR_FAILURE_INTERRUPT , SDFM_LOW_LEVEL_THRESHOLD_INTERRUPT, SDFM_HIGH_LEVEL_THRESHOLD_INTERRUPT, SDFM_FIFO_INTERRUPT, SDFM_FIFO_OVERFLOW_INTERRUPT,SDFM_DATA_FILTER_ACKNOWLEDGE_INTERRUPT

Parameters
  • base: is the base address of the SDFM module

  • filterNumber: is the filter number.

  • intFlags: is the interrupt source.

Return

None.

void SDFM_setComparatorFilterType(uint32_t base, SDFM_FilterNumber filterNumber, SDFM_FilterType filterType)

Set the comparator filter type.

This function sets the Comparator filter type or structure to be used as specified by filterType for the selected filter number as specified by filterNumber.

Parameters
  • base: is the base address of the SDFM module

  • filterNumber: is the filter number.

  • filterType: is the comparator filter type or structure.

Return

None.

void SDFM_setCompFilterOverSamplingRatio(uint32_t base, SDFM_FilterNumber filterNumber, uint16_t overSamplingRatio)

Set Comparator filter over sampling ratio.

This function sets the comparator filter oversampling ratio for the filter specified by the filterNumber.Valid values for the variable overSamplingRatio are 0 to 31 inclusive. The actual oversampling ratio will be this value plus one.

Parameters
  • base: is the base address of the SDFM module

  • filterNumber: is the filter number.

  • overSamplingRatio: is the comparator filter over sampling ration.

Return

None.

uint32_t SDFM_getFilterData(uint32_t base, SDFM_FilterNumber filterNumber)

Get the filter data output.

This function returns the latest data filter output. Depending on the filter data output format selected, the valid value will be the lower 16 bits or the whole 32 bits of the returned value.

Parameters
  • base: is the base address of the SDFM module

  • filterNumber: is the filter number.

Return

Returns the latest data filter output.

SDFM_OutputThresholdStatus SDFM_getThresholdStatus(uint32_t base, SDFM_FilterNumber filterNumber)

Get the Comparator threshold status.

This function returns the Comparator output threshold status for the given filterNumber.

Parameters
  • base: is the base address of the SDFM module

  • filterNumber: is the filter number.

Return

Returns the following status flags.

  • SDFM_OUTPUT_WITHIN_THRESHOLD if the output is within the specified threshold.

  • SDFM_OUTPUT_ABOVE_THRESHOLD if the output is above the high threshold

  • SDFM_OUTPUT_BELOW_THRESHOLD if the output is below the low threshold.

bool SDFM_getModulatorStatus(uint32_t base, SDFM_FilterNumber filterNumber)

Get the Modulator status.

This function returns the Modulator status.

Parameters
  • base: is the base address of the SDFM module

  • filterNumber: is the filter number.

Return

Returns true if the Modulator is operating normally Returns false if the Modulator has failed

bool SDFM_getNewFilterDataStatus(uint32_t base, SDFM_FilterNumber filterNumber)

Check if new Filter data is available.

This function returns new filter data status.

Parameters
  • base: is the base address of the SDFM module

  • filterNumber: is the filter number.

Return

Returns true if new filter data is available Returns false if no new filter data is available

bool SDFM_getFIFOOverflowStatus(uint32_t base, SDFM_FilterNumber filterNumber)

Check if FIFO buffer is overflowed.

This function returns the status of the FIFO buffer overflow for the given filter value.

Parameters
  • base: is the base address of the SDFM module

  • filterNumber: is the filter number.

Return

Returns true if FIFO buffer is overflowed Returns false if FIFO buffer is not overflowed

bool SDFM_getFIFOISRStatus(uint32_t base, SDFM_FilterNumber filterNumber)

Check FIFO buffer interrupt status.

This function returns the status of the FIFO buffer interrupt for the given filter.

Parameters
  • base: is the base address of the SDFM module

  • filterNumber: is the filter number.

Return

Returns true if FIFO buffer interrupt has occurred. Returns false if FIFO buffer interrupt has not occurred.

bool SDFM_getIsrStatus(uint32_t base)

Get pending interrupt.

This function returns any pending interrupt status.

Parameters
  • base: is the base address of the SDFM module

Return

Returns true if there is a pending interrupt. Returns false if no interrupt is pending.

void SDFM_clearInterruptFlag(uint32_t base, uint32_t flag)

Clear pending flags.

This function clears the specified pending interrupt flag. Valid values are SDFM_MAIN_INTERRUPT_FLAG,SDFM_FILTER_1_NEW_DATA_FLAG, SDFM_FILTER_2_NEW_DATA_FLAG,SDFM_FILTER_3_NEW_DATA_FLAG, SDFM_FILTER_4_NEW_DATA_FLAG,SDFM_FILTER_1_MOD_FAILED_FLAG, SDFM_FILTER_2_MOD_FAILED_FLAG,SDFM_FILTER_3_MOD_FAILED_FLAG, SDFM_FILTER_4_MOD_FAILED_FLAG,SDFM_FILTER_1_HIGH_THRESHOLD_FLAG, SDFM_FILTER_1_LOW_THRESHOLD_FLAG,SDFM_FILTER_2_HIGH_THRESHOLD_FLAG, SDFM_FILTER_2_LOW_THRESHOLD_FLAG,SDFM_FILTER_3_HIGH_THRESHOLD_FLAG, SDFM_FILTER_3_LOW_THRESHOLD_FLAG,SDFM_FILTER_4_HIGH_THRESHOLD_FLAG, SDFM_FILTER_4_LOW_THRESHOLD_FLAG,SDFM_FILTER_1_FIFO_OVERFLOW_FLAG, SDFM_FILTER_2_FIFO_OVERFLOW_FLAG,SDFM_FILTER_3_FIFO_OVERFLOW_FLAG SDFM_FILTER_4_FIFO_OVERFLOW_FLAG,SDFM_FILTER_1_FIFO_INTERRUPT_FLAG, SDFM_FILTER_2_FIFO_INTERRUPT_FLAG,SDFM_FILTER_3_FIFO_INTERRUPT_FLAG SDFM_FILTER_4_FIFO_INTERRUPT_FLAG or any combination of the above flags.

Parameters
  • base: is the base address of the SDFM module

  • flag: is the SDFM status

Return

None

void SDFM_enableMainInterrupt(uint32_t base)

Enable main interrupt.

This function enables the main SDFM interrupt.

Parameters
  • base: is the base address of the SDFM module

Return

None

void SDFM_disableMainInterrupt(uint32_t base)

Disable main interrupt.

This function disables the main SDFM interrupt.

Parameters
  • base: is the base address of the SDFM module

Return

None

void SDFM_enableMainFilter(uint32_t base)

Enable main filter.

This function enables main filter.

Parameters
  • base: is the base address of the SDFM module

Return

None

void SDFM_disableMainFilter(uint32_t base)

Disable main filter.

This function disables main filter.

Parameters
  • base: is the base address of the SDFM module

Return

None

uint16_t SDFM_getFIFODataCount(uint32_t base, SDFM_FilterNumber filterNumber)

Return the FIFO data count

This function returns the FIFO data count.

Parameters
  • base: is the base address of the SDFM module

  • filterNumber: is the filter number.

Return

Returns the number of data words available in FIFO buffer.

uint16_t SDFM_getComparatorSincData(uint32_t base, SDFM_FilterNumber filterNumber)

Return the Comparator sinc filter data

This function returns the Comparator sinc filter data output.

Parameters
  • base: is the base address of the SDFM module

  • filterNumber: is the filter number.

Return

Returns the Comparator sinc filter data output.

uint32_t SDFM_getFIFOData(uint32_t base, SDFM_FilterNumber filterNumber)

Return the FIFO data

This function returns the latest FIFO data.

Parameters
  • base: is the base address of the SDFM module

  • filterNumber: is the filter number.

Return

Returns the latest FIFO data.

Note

Discard the upper 16 bits if the output data format is 16bits.

void SDFM_setFIFOInterruptLevel(uint32_t base, SDFM_FilterNumber filterNumber, uint16_t fifoLevel)

Set the FIFO interrupt level.

This function sets the FIFO interrupt level. Interrupt is generated when the FIFO buffer word count gets to or exceeds the value of

fifoLevel. Maximum value for fifoLevel is 16.
Parameters
  • base: is the base address of the SDFM module

  • filterNumber: is the filter number.

  • fifoLevel: is the FIFO interrupt level.

Return

None.

void SDFM_setDataReadyInterruptSource(uint32_t base, SDFM_FilterNumber filterNumber, SDFM_DataReadyInterruptSource dataReadySource)

Set data ready interrupt source.

This function sets the data ready interrupt source. Valid values for

dataReadySource:
  • SDFM_DATA_READY_SOURCE_DIRECT - Direct data ready

  • SDFM_DATA_READY_SOURCE_FIFO - FIFO data ready.

Parameters
  • base: is the base address of the SDFM module

  • filterNumber: is the filter number.

  • dataReadySource: is the data ready interrupt source.

Return

None.

bool SDFM_getWaitForSyncStatus(uint32_t base, SDFM_FilterNumber filterNumber)

Get the wait-for-sync event status.

This function returns the Wait-for-Sync event status.

Parameters
  • base: is the base address of the SDFM module

  • filterNumber: is the filter number.

Return

Returns true if sync event has occurred. Returns false if sync event has not occurred.

void SDFM_clearWaitForSyncFlag(uint32_t base, SDFM_FilterNumber filterNumber)

Clear the Wait-for-sync event status.

This function clears the Wait-for-sync event status.

Parameters
  • base: is the base address of the SDFM module

  • filterNumber: is the filter number.

Return

None.

void SDFM_enableWaitForSync(uint32_t base, SDFM_FilterNumber filterNumber)

Enable wait for sync mode.

This function enables the wait for sync mode. Data to FIFO will be written only after PWM sync event.

Parameters
  • base: is the base address of the SDFM module

  • filterNumber: is the filter number.

Return

None.

void SDFM_disableWaitForSync(uint32_t base, SDFM_FilterNumber filterNumber)

Disable wait for sync mode.

This function disables the wait for sync mode. Data to FIFO will be written every Data ready event.

Parameters
  • base: is the base address of the SDFM module

  • filterNumber: is the filter number.

Return

None.

void SDFM_setPWMSyncSource(uint32_t base, SDFM_FilterNumber filterNumber, SDFM_PWMSyncSource syncSource)

Set the PWM sync mode.

This function sets the PWM sync source for the specific SDFM filter. Valid values for syncSource are SDFM_SYNC_PWMx_CMPy. Where x ranges from 1 to 8 Representing PWM1 to PWM8 respectively and y ranges from A to D representing PWM comparators A to D.

Parameters
  • base: is the base address of the SDFM module

  • filterNumber: is the filter number.

  • syncSource: is the PWM sync source.

Return

None.

void SDFM_setFIFOClearOnSyncMode(uint32_t base, SDFM_FilterNumber filterNumber, SDFM_FIFOClearSyncMode fifoClearSyncMode)

Set FIFO clear on sync mode.

This function sets the FIFO clear mode for the specified filter when a sync happens depending on the value of fifoClearSyncMode. Valid values for fifoClearSyncMode are:

  • SDFM_FIFO_NOT_CLEARED_ON_SYNC - FIFO is not cleared on sync.

  • SDFM_FIFO_CLEARED_ON_SYNC - FIFO is cleared on sync.

Parameters
  • base: is the base address of the SDFM module

  • filterNumber: is the filter number.

  • fifoClearSyncMode: is the FIFO clear on sync mode.

Return

None.

void SDFM_setWaitForSyncClearMode(uint32_t base, SDFM_FilterNumber filterNumber, SDFM_WaitForSyncClearMode syncClearMode)

Set Wait-for-sync clear mode.

This function sets the Wait-For-sync clear mode depending on the value of syncClearMode. Valid values for syncClearMode are:

  • SDFM_MANUAL_CLEAR_WAIT_FOR_SYNC - Wait-for-sync flag is cleared by invoking SDFM_clearWaitForSyncFlag().

  • SDFM_AUTO_CLEAR_WAIT_FOR_SYNC - Wait-for-sync flag is cleared automatically on FIFO interrupt.

Parameters
  • base: is the base address of the SDFM module

  • filterNumber: is the filter number.

  • syncClearMode: is the wait-for-sync clear mode.

Return

None.

void SDFM_selectClockSource(uint32_t base, SDFM_FilterNumber filterNumber, SDFM_ClockSource clkSource)

Selects clock source for SDFM channels.

This function selects the clock for SDFM module filter channels. Valid values for clkSource are:

  • SDFM_CLK_SOURCE_CHANNEL_CLK - Respective channel’s clk is the source

  • SDFM_CLK_SOURCE_SD1_CLK - Filter 1 clock is the source

Parameters
  • base: is the base address of the SDFM module

  • filterNumber: is the filter number.

  • clkSource: is the clock source

Return

None.

void SDFM_enableSynchronizer(uint32_t base, SDFM_FilterNumber filterNumber, uint16_t syncConfig)

Enables Input Synchronizer.

This function enables either data or clock or both synchronizer. Valid values for syncConfig can be the logical OR of any of the values:

  • SDFM_CLOCK_SYNCHRONIZER - Enable SDFM input clock synchronizer

  • SDFM_DATA_SYNCHRONIZER - Enable SDFM input data synchronizer

Parameters
  • base: is the base address of the SDFM module

  • filterNumber: is the filter number.

  • syncConfig: defines which synchronizer to be enabled

Return

None.

void SDFM_disableSynchronizer(uint32_t base, SDFM_FilterNumber filterNumber, uint16_t syncConfig)

Disables Input Synchronizer.

This function disables either data or clock or both synchronizer. Valid values for syncConfig can be the logical OR of any of the values:

  • SDFM_CLOCK_SYNCHRONIZER - Disable SDFM input clock synchronizer

  • SDFM_DATA_SYNCHRONIZER - Disable SDFM input data synchronizer

Parameters
  • base: is the base address of the SDFM module

  • filterNumber: is the filter number.

  • syncConfig: defines which synchronizer to be disabled

Return

None.

void SDFM_selectCompEventHighSource(uint32_t base, SDFM_FilterNumber filterNumber, SDFM_CompEventHighSource source)

Selects comparator event high source.

This function selects the source for comparator event high. Valid values for source are:

  • SDFM_COMPHOUT_SOURCE_COMPHIN - Original COMPHIN/CEVT1 signal is source

  • SDFM_COMPHOUT_SOURCE_FILTER - Filtered COMPHIN/CEVT1 signal is source

Parameters
  • base: is the base address of the SDFM module

  • filterNumber: is the filter number.

  • source: is the comparator event high source

Return

None.

void SDFM_selectCompEventLowSource(uint32_t base, SDFM_FilterNumber filterNumber, SDFM_CompEventLowSource source)

Selects comparator event low source.

This function selects the source for comparator event low. Valid values for source are:

  • SDFM_COMPLOUT_SOURCE_COMPLIN - Original COMPLIN/CEVT2 signal is source

  • SDFM_COMPHOUT_SOURCE_FILTER - Filtered COMPLIN/CEVT2 signal is source

Parameters
  • base: is the base address of the SDFM module

  • filterNumber: is the filter number.

  • source: is the comparator event low source

Return

None.

void SDFM_initCompEventLowFilter(uint32_t base, SDFM_FilterNumber filterNumber)

Initializes Comparator Event Low Filter.

This function initializes Comparator Event Low Filter.

Parameters
  • base: is the base address of the SDFM module

  • filterNumber: is the filter number.

Return

None.

void SDFM_initCompEventHighFilter(uint32_t base, SDFM_FilterNumber filterNumber)

Initializes Comparator Event High Filter.

This function initializes Comparator Event High Filter.

Parameters
  • base: is the base address of the SDFM module

  • filterNumber: is the filter number.

Return

None.

void SDFM_lockCompEventFilterConfig(uint32_t base, SDFM_FilterNumber filterNumber, uint16_t lockConfig)

Lock Comparator Event Filter Configurations

This function locks the comparator event filter configurations. Valid values of the lockConfig can be logical OR of any of the following values:

  • SDFM_SDCOMPLOCK_SDCOMPCTL - Locks write access to SDCOMPCTL register

  • SDFM_SDCOMPLOCK_COMP - Locks write access to SDCOMPxFILCTL & SDCOMPxFILCLKCTL register

Parameters
  • base: is the base address of the SDFM module

  • filterNumber: is the filter number.

  • lockConfig: defines the configurations to be locked

Return

None.

void SDFM_configComparator(uint32_t base, uint16_t config1, uint32_t config2, uint16_t config3)

Configures SDFM comparator for filter config & threshold values

This function configures the comparator filter for filter config and threshold values based on provided inputs.

Parameters
  • base: is the base address of the SDFM module

  • config1: is the filter number, filter type and over sampling ratio.

  • config2: is high-level and low-level threshold 1 values.

  • config3: is the zero-cross threshold value.

The config1 parameter is the logical OR of the filter number, filter type and oversampling ratio. The bit definitions for config1 are as follow:

  • config1.[3:0] filter number

  • config1.[7:4] filter type

  • config1.[15:8] Over sampling Ratio Valid values for filter number and filter type are defined in SDFM_FilterNumber and SDFM_FilterType enumerations respectively. SDFM_SET_OSR(X) macro can be used to set the value of the oversampling ratio ,which ranges [1,32] inclusive, in the appropriate bit location. For example the value (SDFM_FILTER_1 | SDFM_FILTER_SINC_2 | SDFM_SET_OSR(16)) will select Filter 1, SINC 2 type with an oversampling ratio of 16.

The config2 parameter is the logical OR of the filter high and low threshold 1 values. The bit definitions for config2 are as follow:

  • config2.[15:0] low threshold 1

  • config2.[31:16] high threshold 1 The upper 16 bits define the high threshold 1 and the lower 16 bits define the low threshold 1. SDFM_THRESHOLD(H,L) can be used to combine the high and low thresholds. The config3 parameter is the logical OR of the zero cross threshold enable flag and the zero-cross threshold value. The bit definitions for config3 are as follow:

  • config3.[15] - Enable or disable zero cross threshold. Valid values are 1 or 0 to enable or disable the zero cross threshold respectively. -config3.[14:0] - Zero Cross Threshold value. The SDFM_SET_ZERO_CROSS_THRESH_VALUE(X) macro can be used to specify the zero-cross threshold value and OR the 1 to enable it.

Return

None.

void SDFM_configEnhancedComparator(uint32_t base, uint16_t filterConfig, uint32_t highLowThreshold1, uint32_t highLowThreshold2, uint16_t zeroCrossThreshold)

Configure SDFM enhanced comparator for filter config & threshold values

This function configures the comparator filter for filter config and threshold values based on input parameters.

Parameters
  • base: is the base address of the SDFM module

  • filterConfig: is the filter number, filter type & over sampling ratio.

  • highLowThreshold1: is high-level and low-level threshold 1 values.

  • highLowThreshold2: is high-level and low-level threshold 2 values.

  • zeroCrossThreshold: is the zero-cross threshold value.

The filterConfig parameter is the logical OR of the filter number, filter type and oversampling ratio. The bit definitions for filterConfig are as follow:

  • filterConfig.[3:0] filter number

  • filterConfig.[7:4] filter type

  • filterConfig.[15:8] Over sampling Ratio Valid values for filter number and filter type are defined in SDFM_FilterNumber and SDFM_FilterType enumerations respectively. SDFM_SET_OSR(X) macro can be used to set the value of the oversampling ratio ,which ranges [1,32] inclusive, in the appropriate bit location. For example the value (SDFM_FILTER_1 | SDFM_FILTER_SINC_2 | SDFM_SET_OSR(16)) will select Filter 1, SINC 2 type with an oversampling ratio of 16.

The highLowThreshold1 parameter is the logical OR of the filter high & low threshold 1 values. The bit definitions for highLowThreshold1 are as follow:

  • highLowThreshold1.[15:0] low threshold 1

  • highLowThreshold1.[31:16] high threshold 1 The upper 16 bits define the high threshold and the lower 16 bits define the low threshold. SDFM_THRESHOLD(H,L) can be used to combine the high and low thresholds.

The highLowThreshold2 parameter is the logical OR of the filter high & low threshold 2 values. The bit definitions for highLowThreshold2 are as follow:

  • highLowThreshold2.[15:0] low threshold 2

  • highLowThreshold2.[31:16] high threshold 2 The upper 16 bits define the high threshold and the lower 16 bits define the low threshold. SDFM_THRESHOLD(H,L) can be used to combine the high & low thresholds.

The zeroCrossThreshold parameter is the logical OR of the zero cross threshold enable flag and the zero-cross threshold value. The bit definitions for zeroCrossThreshold are as follows:

  • zeroCrossThreshold.[15] - Enable or disable zero cross threshold. Valid values are 1 or 0 to enable or disable the zero cross threshold respectively.

  • zeroCrossThreshold.[14:0] - Zero Cross Threshold value. The SDFM_SET_ZERO_CROSS_THRESH_VALUE(X) macro can be used as parameter zeroCrossThreshold to enable & specify the zero-cross threshold value.

Return

None.

void SDFM_configDataFilter(uint32_t base, uint16_t config1, uint16_t config2)

Configure SDFM data filter

This function configures the data filter based on configurations config1 and config2.

Parameters
  • base: is the base address of the SDFM module

  • config1: is the filter number, filter type and over sampling ratio configuration.

  • config2: is filter switch, data representation and data shift values configuration.

The config1 parameter is the logical OR of the filter number, filter type and oversampling ratio. The bit definitions for config1 are as follow:

  • config1.[3:0] Filter number

  • config1.[7:4] Filter type

  • config1.[15:8] Over sampling Ratio Valid values for filter number and filter type are defined in SDFM_FilterNumber and SDFM_FilterType enumerations respectively. SDFM_SET_OSR(X) macro can be used to set the value of the oversampling ratio , which ranges [1,256] inclusive , in the appropriate bit location for config1. For example the value (SDFM_FILTER_2 | SDFM_FILTER_SINC_3 | SDFM_SET_OSR(64)) will select Filter 2 , SINC 3 type with an oversampling ratio of 64.

The config2 parameter is the logical OR of data representation, filter switch, and data shift values The bit definitions for config2 are as follow:

  • config2.[0] Data representation

  • config2.[1] Filter switch

  • config2.[15:2] Shift values Valid values for data representation are given in SDFM_OutputDataFormat enumeration. SDFM_FILTER_DISABLE or SDFM_FILTER_ENABLE will define the filter switch values.SDFM_SHIFT_VALUE(X) macro can be used to set the value of the data shift value,which ranges [0,31] inclusive, in the appropriate bit location for config2. The shift value is valid only in SDFM_DATA_FORMAT_16_BIT data representation format.

Return

None.

void SDFM_configZeroCrossComparator(uint32_t base, uint16_t config1, uint16_t config2)

Configure SDFM comparator Zero Cross threshold

This function configures the comparator filter zero cross threshold values based on configurations config1 and config2.

Parameters
  • base: is the base address of the SDFM module

  • config1: is the filter number, filter type and over sampling ratio.

  • config2: is the zero cross threshold value.

The config1 parameter is the logical OR of the filter number, filter type and oversampling ratio. The bit definitions for config1 are as follow:

  • config1.[3:0] filter number

  • config1.[7:4] filter type

  • config1.[15:8] Over sampling Ratio Valid values for filter number and filter type are defined in SDFM_FilterNumber and SDFM_FilterType enumerations respectively. SDFM_SET_OSR(X) macro can be used to set the value of the oversampling ratio ,which ranges [1,32] inclusive, in the appropriate bit location. For example the value (SDFM_FILTER_1 | SDFM_FILTER_SINC_2 | SDFM_SET_OSR(16)) will select Filter 1 , SINC 2 type with an oversampling ratio of 16.

The config2 parameter is the value of the zero cross threshold. The maximum acceptable value is 32767.

Return

None.

void SDFM_configDataFilterFIFO(uint32_t base, uint16_t config1, uint16_t config2)

Configure SDFM data filter FIFO

This function enables and configures the data filter FIFO based on configurations config1 and config2.

Parameters
  • base: is the base address of the SDFM module

  • config1: is the filter number, filter type and over sampling ratio configuration.

  • config2: is filter switch, data representation and data shift values and FIFO level configuration.

The config1 parameter is the logical OR of the filter number, filter type and oversampling ratio. The bit definitions for config1 are as follow:

  • config1.[3:0] filter number

  • config1.[7:4] filter type

  • config1.[15:8] Over sampling Ratio Valid values for filter number and filter type are defined in SDFM_FilterNumber and SDFM_FilterType enumerations respectively. SDFM_SET_OSR(X) macro can be used to set the value of the oversampling ratio , which ranges [1,256] inclusive , in the appropriate bit location for config1. For example the value (SDFM_FILTER_2 | SDFM_FILTER_SINC_3 | SDFM_SET_OSR(64)) will select Filter 2 , SINC 3 type with an oversampling ratio of 64.

The config2 parameter is the logical OR of data representation, filter switch, data shift value, and FIFO level The bit definitions for config2 are as follow:

  • config2.[0] Data representation

  • config2.[1] filter switch.

  • config2.[6:2] shift values.

  • config2.[15:7] FIFO level Valid values for data representation are given in SDFM_OutputDataFormat enumeration. SDFM_FILTER_DISABLE or SDFM_FILTER_ENABLE will define the filter switch values.SDFM_SHIFT_VALUE(X) macro can be used to set the value of the data shift value,which ranges [0,31] inclusive, in the appropriate bit location for config2. The value of FIFO level ranges [1,16] inclusive. The macro SDFM_SET_FIFO_LEVEL(X) can be used to set the value of the FIFO level.

Return

None.

void SDFM_configCompEventLowFilter(uint32_t base, SDFM_FilterNumber filterNumber, const SDFM_CompEventFilterConfig *config)

Configure Comparator Event Low Filter

This function configures the sample window, threshold and clock prescale configurations for the comparator event low filter.

Parameters
  • base: is the base address of the SDFM module

  • filterNumber: is the filter number.

  • config: is the comparator event low source

Return

None.

void SDFM_configCompEventHighFilter(uint32_t base, SDFM_FilterNumber filterNumber, const SDFM_CompEventFilterConfig *config)

Configure Comparator Event High Filter

This function configures the sample window, threshold and clock prescale configurations for the comparator event high filter.

Parameters
  • base: is the base address of the SDFM module.

  • filterNumber: is the filter number.

  • config: is the comparator event high source

Return

None.

struct SDFM_CompEventFilterConfig
#include <sdfm.h>

Values that can be passed to SDFM_configCompEventLowFilter() & SDFM_configCompEventHighFilter() as the filterNumber.

The code for this module is contained in driverlib/sdfm.c, with driverlib/sdfm.h containing the API declarations for use by applications.