7.11. CDD_CMPSS

7.11.1. Types

Base type

Type Name

Brief

enum

Cdd_Cmpss_LockMaskType

Lock-mask bit values for the Cdd_Cmpss_ApplyLock() LockMask parameter (bitwise-ORable). Values mirror hw_cmpss.h’s CMPSS_COMPLOCK_* register bit positions — this public header cannot include the device-specific hw_cmpss.h, so the match is verified at compile time in Cdd_Cmpss.c instead of aliasing the register header directly.

enum

Cdd_Cmpss_HysLevelType

Hysteresis level applied to both High and Low comparators.

enum

Cdd_Cmpss_CompSourceType

Comparator input source selection.

enum

Cdd_Cmpss_TripSelType

Trip output signal source (applies to CTRIPHSEL, CTRIPOUTHSEL, CTRIPLSEL, CTRIPOUTLSEL)

enum

Cdd_Cmpss_DacSourceType

DAC source — selects whether the DAC drives a static value or a ramp generator value.

enum

Cdd_Cmpss_DacRefType

DAC voltage reference selection. Physically implemented as one field in the High DAC’s control register, but it applies to BOTH the High and Low DAC — there is no independent per-side reference select; the Low DAC has no reference-select bit of its own.

enum

Cdd_Cmpss_DacLoadSelType

Shadow-to-active register load trigger. Physically implemented as one field in the High DAC’s control register, but it applies to BOTH the High and Low DAC shadow registers — there is no independent per-side load trigger.

enum

Cdd_Cmpss_RampDirType

Ramp generator counting direction.

enum

Cdd_Cmpss_RampLoadSelType

Ramp reference reload source, selected on a comparator trip event (RAMPLOADSEL)

enum

Cdd_Cmpss_XtrigCfgType

Ramp cross-trigger configuration (XTRIGCFG in COMPDACHCTL2)

enum

Cdd_Cmpss_FreeSoftType

Ramp emulation control (FREESOFT in COMPDACHCTL) — behaviour when emulation halts.

enum

Cdd_Cmpss_CompSideType

Comparator side selector — used by SetRampShadow to distinguish High from Low.

7.11.1.1. enum Cdd_Cmpss_LockMaskType

Enumerator

Value

Description

CDD_CMPSS_LOCK_COMPCTL

0x01U

Lock mask for COMPCTL register group

CDD_CMPSS_LOCK_COMPHYSCTL

0x02U

Lock mask for COMPHYSCTL register group Lock mask for DAC control registers (COMPDACHCTL, COMPDACHCTL2, COMPDACLCTL, COMPDACLCTL2). Covers only the COMPDACxCTL control register(s) — does NOT lock the DAC or ramp shadow VALUE registers (DACHVALS/DACHVALS2/DACLVALS/DACLVALS2, RAMPxREFS/RAMPxSTEPVALS/RAMPxCTLS/RAMPxDLYS), which remain writable regardless of this bit.

CDD_CMPSS_LOCK_DACCTL

0x04U

CDD_CMPSS_LOCK_CTRIP

0x08U

Lock mask for filter/trip control registers

Brief: Lock-mask bit values for the Cdd_Cmpss_ApplyLock() LockMask parameter (bitwise-ORable). Values mirror hw_cmpss.h’s CMPSS_COMPLOCK_* register bit positions — this public header cannot include the device-specific hw_cmpss.h, so the match is verified at compile time in Cdd_Cmpss.c instead of aliasing the register header directly.

7.11.1.2. enum Cdd_Cmpss_HysLevelType

Enumerator

Value

Description

CDD_CMPSS_HYS_NONE

0U

No hysteresis

CDD_CMPSS_HYS_1X

1U

12 LSB typical (1 LSB = VDAC_REF/4096; scales with DAC reference)

CDD_CMPSS_HYS_2X

2U

24 LSB typical

CDD_CMPSS_HYS_3X

3U

36 LSB typical

CDD_CMPSS_HYS_4X

4U

48 LSB typical

Brief: Hysteresis level applied to both High and Low comparators.

7.11.1.3. enum Cdd_Cmpss_CompSourceType

Enumerator

Value

Description

CDD_CMPSS_COMP_SOURCE_DAC

0U

Internal 12-bit DAC drives the negative comparator input

CDD_CMPSS_COMP_SOURCE_PIN

1U

External pin (CMPIN1H/CMPIN1L) drives the input

Brief: Comparator input source selection.

7.11.1.4. enum Cdd_Cmpss_TripSelType

Enumerator

Value

Description

CDD_CMPSS_TRIP_SEL_ASYNC

0U

Asynchronous comparator output — lowest latency

CDD_CMPSS_TRIP_SEL_SYNC

1U

Synchronous output — latched to SYSCLK edge

CDD_CMPSS_TRIP_SEL_FILTER

2U

Digital filter output

CDD_CMPSS_TRIP_SEL_LATCHED

3U

Latched filter output — held until cleared via COMPSTSCLR

Brief: Trip output signal source (applies to CTRIPHSEL, CTRIPOUTHSEL, CTRIPLSEL, CTRIPOUTLSEL)

7.11.1.5. enum Cdd_Cmpss_DacSourceType

Enumerator

Value

Description

CDD_CMPSS_DAC_SOURCE_SHADOW

0U

DAC value from shadow register (DACHVALS/DACLVALS)

CDD_CMPSS_DAC_SOURCE_RAMP

1U

DAC value from ramp generator output

Brief: DAC source — selects whether the DAC drives a static value or a ramp generator value.

7.11.1.6. enum Cdd_Cmpss_DacRefType

Enumerator

Value

Description

CDD_CMPSS_DAC_REF_VDDA

0U

Internal analog supply VDDA

CDD_CMPSS_DAC_REF_VDAC_EXT

1U

External VDAC_REF pin

Brief: DAC voltage reference selection. Physically implemented as one field in the High DAC’s control register, but it applies to BOTH the High and Low DAC — there is no independent per-side reference select; the Low DAC has no reference-select bit of its own.

7.11.1.7. enum Cdd_Cmpss_DacLoadSelType

Enumerator

Value

Description

CDD_CMPSS_DAC_LOAD_SYSCLK

0U

Load from shadow on next SYSCLK cycle

CDD_CMPSS_DAC_LOAD_SYNCPER

1U

Load from shadow on EPWMnSYNCPER event

Brief: Shadow-to-active register load trigger. Physically implemented as one field in the High DAC’s control register, but it applies to BOTH the High and Low DAC shadow registers — there is no independent per-side load trigger.

Note: CDD_CMPSS_DAC_LOAD_SYNCPER depends on the ramp-source EPWM instance (HighRampCfg.Source) already having a non-zero TBPRD. If that EPWM’s period has not yet been configured (via Cdd_Pwm) when this load trigger takes effect, EPWMSYNCPER is held level-high and the DAC shadow register loads immediately on every write regardless of this setting — silently behaving as CDD_CMPSS_DAC_LOAD_SYSCLK until the EPWM is configured. Configure the referenced EPWM’s period via Cdd_Pwm before Cdd_Cmpss_Init() when using SYNCPER mode.

7.11.1.8. enum Cdd_Cmpss_RampDirType

Enumerator

Value

Description

CDD_CMPSS_RAMP_DIR_DECREMENT

0U

Ramp decrements from reference value toward zero

CDD_CMPSS_RAMP_DIR_INCREMENT

1U

Ramp increments from zero toward reference value

Brief: Ramp generator counting direction.

7.11.1.9. enum Cdd_Cmpss_RampLoadSelType

Enumerator

Value

Description

CDD_CMPSS_RAMP_LOAD_FROM_ACTIVE

0U

Reload ramp reference from active register (RAMPHREFA) on trip

CDD_CMPSS_RAMP_LOAD_FROM_SHADOW

1U

Reload ramp reference from shadow register (RAMPHREFS) on trip

Brief: Ramp reference reload source, selected on a comparator trip event (RAMPLOADSEL)

7.11.1.10. enum Cdd_Cmpss_XtrigCfgType

Enumerator

Value

Description

CDD_CMPSS_XTRIG_INDEPENDENT

0U

High ramp and Low ramp operate independently

CDD_CMPSS_XTRIG_RAMPL_BY_RAMPH

1U

Low ramp triggered by High ramp end-of-ramp

CDD_CMPSS_XTRIG_RAMPH_BY_RAMPL

2U

High ramp triggered by Low ramp end-of-ramp

CDD_CMPSS_XTRIG_INVALID

3U

Sentinel for range validation — not a valid operational value

Brief: Ramp cross-trigger configuration (XTRIGCFG in COMPDACHCTL2)

7.11.1.11. enum Cdd_Cmpss_FreeSoftType

Enumerator

Value

Description

CDD_CMPSS_FREESOFT_STOP

0U

Ramp stops immediately on emulation halt

CDD_CMPSS_FREESOFT_RUN_TO_ZERO

1U

Ramp completes current cycle then stops

CDD_CMPSS_FREESOFT_FREE_RUN

2U

Ramp continues free-running during emulation halt

Brief: Ramp emulation control (FREESOFT in COMPDACHCTL) — behaviour when emulation halts.

7.11.1.12. enum Cdd_Cmpss_CompSideType

Enumerator

Value

Description

CDD_CMPSS_SIDE_HIGH

0U

High comparator / High ramp side

CDD_CMPSS_SIDE_LOW

1U

Low comparator / Low ramp side

CDD_CMPSS_SIDE_INVALID

2U

Sentinel for range validation — not a valid operational value

Brief: Comparator side selector — used by SetRampShadow to distinguish High from Low.

7.11.2. Structures

Name

Brief

Cdd_Cmpss_CompCfgType

Single-side comparator configuration — maps to COMPCTL source/invert/async fields only. Routing fields (CtripSel / CtripoutSel) are in Cdd_Cmpss_CompOutputCfgType.

Cdd_Cmpss_CompOutputCfgType

Trip output routing configuration — maps to CTRIPHSEL/CTRIPOUTHSEL (or CTRIPLSEL/CTRIPOUTLSEL)

Cdd_Cmpss_SingleDacCfgType

Single-side DAC configuration — maps to COMPDACHCTL/COMPDACLCTL, DACHVALS/DACLVALS. DacRef and SwLoadSel are module-level fields in Cdd_Cmpss_HwInstanceCfgType.

Cdd_Cmpss_SingleBlankCfgType

Single-side blanking configuration — maps to BLANKEN/BLANKSOURCE fields.

Cdd_Cmpss_RampCfgType

Ramp generator configuration — used for both High and Low ramps. FreeSoft is now a module-level field in Cdd_Cmpss_HwInstanceCfgType.

Cdd_Cmpss_FilterCfgType

Digital filter configuration — maps to CTRIPHFILCTL / CTRIPLFILCTL and clock registers.

Cdd_Cmpss_DeModeCfgType

Diode Emulation (DE) mode configuration. Physically implemented as DEENABLE/DEACTIVESEL fields in the High DAC’s control register (COMPDACHCTL2), but — like DacRef/SwLoadSel/FreeSoft — it applies to BOTH the High and Low DAC: enabling DE mode swaps both DACHVALA and DACLVALA to their respective InitValueDE shadow value while the selected DEACTIVE signal is asserted.

Cdd_Cmpss_HwInstanceCfgType

Per-instance hardware configuration — one entry per configured CMPSS instance.

Cdd_Cmpss_ConfigType

Top-level driver configuration structure — passed to Cdd_Cmpss_Init()

Cdd_Cmpss_StatusType

Status information read from the COMPSTS register.

Cdd_Cmpss_RampShadowParamsType

Runtime ramp shadow update parameters — used by Cdd_Cmpss_SetRampShadow().

Cdd_Cmpss_RampActiveParamsType

Ramp active parameter readback. All fields reflect what the hardware is using in the CURRENT ramp cycle (loaded from shadow at last EPWMnSYNCPER). Use to verify that a shadow update was correctly loaded before enabling PWM switching.

7.11.3. Defines

Name

Brief

CDD_CMPSS_SW_MAJOR_VERSION

Driver implementation major version.

CDD_CMPSS_SW_MINOR_VERSION

Driver implementation minor version.

CDD_CMPSS_SW_PATCH_VERSION

Driver implementation patch version.

CDD_CMPSS_AR_RELEASE_MAJOR_VERSION

AUTOSAR major version specification implemented by CDD_CMPSS driver.

CDD_CMPSS_AR_RELEASE_MINOR_VERSION

AUTOSAR minor version specification implemented by CDD_CMPSS driver.

CDD_CMPSS_AR_RELEASE_REVISION_VERSION

AUTOSAR patch version specification implemented by CDD_CMPSS driver.

CDD_CMPSS_VENDOR_ID

Texas Instruments Vendor ID.

CDD_CMPSS_MODULE_ID

CDD CMPSS Driver Module ID.

CDD_CMPSS_INSTANCE_ID

CDD CMPSS Instance ID.

CDD_CMPSS_E_UNINIT

API service used without prior module initialization.

CDD_CMPSS_E_ALREADY_INITIALIZED

Init called on an already-initialized driver.

CDD_CMPSS_E_PARAM_POINTER

API service called with invalid pointer argument (NULL_PTR)

CDD_CMPSS_E_PARAM_VALUE

API service called with out-of-range parameter value.

CDD_CMPSS_E_PARAM_SIDE

API service called with invalid Side parameter.

CDD_CMPSS_SID_GET_VERSION_INFO

Cdd_Cmpss_GetVersionInfo() service ID.

CDD_CMPSS_SID_INIT

Cdd_Cmpss_Init() service ID.

CDD_CMPSS_SID_DEINIT

Cdd_Cmpss_DeInit() service ID.

CDD_CMPSS_SID_GET_STATUS

Cdd_Cmpss_GetStatus() service ID.

CDD_CMPSS_SID_SET_MODULE_ENABLE

Cdd_Cmpss_SetModuleEnable() service ID.

CDD_CMPSS_SID_CONFIG_COMPARATOR

Cdd_Cmpss_ConfigComparator() service ID.

CDD_CMPSS_SID_SET_HYSTERESIS

Cdd_Cmpss_SetHysteresis() service ID.

CDD_CMPSS_SID_CONFIG_DAC

Cdd_Cmpss_ConfigDac() service ID.

CDD_CMPSS_SID_SET_DAC_VALUE

Cdd_Cmpss_SetDacValue() service ID.

CDD_CMPSS_SID_GET_DAC_ACTIVE_VALUE

Cdd_Cmpss_GetDacActiveValue() service ID.

CDD_CMPSS_SID_SET_DAC_VALUE_DE

Cdd_Cmpss_SetDacValueDE() service ID.

CDD_CMPSS_SID_CONFIG_RAMP

Cdd_Cmpss_ConfigRamp() service ID.

CDD_CMPSS_SID_SET_RAMP_SHADOW

Cdd_Cmpss_SetRampShadow() service ID.

CDD_CMPSS_SID_GET_RAMP_ACTIVE_PARAMS

Cdd_Cmpss_GetRampActiveParams() service ID.

CDD_CMPSS_SID_GET_RAMP_STATUS

Cdd_Cmpss_GetRampStatus() service ID.

CDD_CMPSS_SID_CONFIG_RAMP_XTRIGGER

Cdd_Cmpss_ConfigRampXTrigger() service ID.

CDD_CMPSS_SID_CONFIG_FILTER

Cdd_Cmpss_ConfigFilter() service ID.

CDD_CMPSS_SID_SET_FILTER_INPUT

Cdd_Cmpss_SetFilterInput() service ID.

CDD_CMPSS_SID_CLEAR_LATCH

Cdd_Cmpss_ClearLatch() service ID.

CDD_CMPSS_SID_CONFIG_SYNC_CLEAR

Cdd_Cmpss_ConfigSyncClear() service ID.

CDD_CMPSS_SID_CONFIG_BLANKING_SOURCE

Cdd_Cmpss_ConfigBlankingSource() service ID.

CDD_CMPSS_SID_SET_BLANKING_ENABLE

Cdd_Cmpss_SetBlankingEnable() service ID.

CDD_CMPSS_SID_CONFIG_DE_ACTIVE_SOURCE

Cdd_Cmpss_ConfigDEActiveSource() service ID.

CDD_CMPSS_SID_SET_DE_MODE_ENABLE

Cdd_Cmpss_SetDEModeEnable() service ID.

CDD_CMPSS_SID_APPLY_LOCK

Cdd_Cmpss_ApplyLock() service ID.

CDD_CMPSS_SID_CONFIG_OUTPUTS

Cdd_Cmpss_ConfigOutputs() service ID.

CDD_CMPSS_SID_INIT_FILTER

Cdd_Cmpss_InitFilter() service ID.

7.11.4. Functions

Return type

Function Name

Brief

void

Cdd_Cmpss_GetVersionInfo(Std_VersionInfoType * VersionInfoPtr)

Service to return the version information of the CDD CMPSS driver.

void

Cdd_Cmpss_Init(const Cdd_Cmpss_ConfigType * ConfigPtr)

Initialize all configured CMPSS instances.

void

Cdd_Cmpss_DeInit(void )

Deinitialize all configured CMPSS instances.

Std_ReturnType

Cdd_Cmpss_GetStatus(uint8 InstanceId, Cdd_Cmpss_StatusType * StatusPtr)

Read the current comparator output and latched-output status for both sides.

Std_ReturnType

Cdd_Cmpss_SetModuleEnable(uint8 InstanceId, boolean Enable)

Enable or disable the CMPSS module at runtime.

Std_ReturnType

Cdd_Cmpss_ConfigComparator(uint8 InstanceId, Cdd_Cmpss_CompSideType Side, const Cdd_Cmpss_CompCfgType * CompCfg)

Reconfigure comparator source, inversion, and async settings for one side at runtime.

Std_ReturnType

Cdd_Cmpss_SetHysteresis(uint8 InstanceId, Cdd_Cmpss_HysLevelType Level)

Set the comparator hysteresis level at runtime.

Std_ReturnType

Cdd_Cmpss_ConfigDac(uint8 InstanceId, Cdd_Cmpss_CompSideType Side, const Cdd_Cmpss_SingleDacCfgType * DacCfg)

Reconfigure DAC source for one side at runtime (DacRef/SwLoadSel are module-level).

Std_ReturnType

Cdd_Cmpss_SetDacValue(uint8 InstanceId, Cdd_Cmpss_CompSideType Side, uint16 Value)

Write the DAC threshold value for one side.

Std_ReturnType

Cdd_Cmpss_GetDacActiveValue(uint8 InstanceId, Cdd_Cmpss_CompSideType Side, uint16 * ValuePtr)

Read the current active DAC value for one side.

Std_ReturnType

Cdd_Cmpss_SetDacValueDE(uint8 InstanceId, Cdd_Cmpss_CompSideType Side, uint16 Value)

Write the DE-mode secondary DAC threshold value for one side.

Std_ReturnType

Cdd_Cmpss_ConfigRamp(uint8 InstanceId, Cdd_Cmpss_CompSideType Side, const Cdd_Cmpss_RampCfgType * RampCfg)

Reconfigure the ramp generator for one side at runtime (FreeSoft is module-level).

Std_ReturnType

Cdd_Cmpss_SetRampShadow(uint8 InstanceId, Cdd_Cmpss_CompSideType Side, const Cdd_Cmpss_RampShadowParamsType * Params)

Update the ramp generator’s reference, step, delay, and clock-divider values for one side at runtime.

Std_ReturnType

Cdd_Cmpss_GetRampActiveParams(uint8 InstanceId, Cdd_Cmpss_CompSideType Side, Cdd_Cmpss_RampActiveParamsType * ParamsPtr)

Read the ramp generator’s currently active reference, step, delay, and clock-divider values for one side.

Std_ReturnType

Cdd_Cmpss_GetRampStatus(uint8 InstanceId, Cdd_Cmpss_CompSideType Side, uint16 * CountPtr)

Read the current ramp counter value for one side.

Std_ReturnType

Cdd_Cmpss_ConfigRampXTrigger(uint8 InstanceId, Cdd_Cmpss_XtrigCfgType XtrigCfg)

Configure the ramp cross-trigger configuration.

Std_ReturnType

Cdd_Cmpss_ConfigFilter(uint8 InstanceId, Cdd_Cmpss_CompSideType Side, const Cdd_Cmpss_FilterCfgType * FilterCfg)

Reconfigure the digital filter parameters for one side.

Std_ReturnType

Cdd_Cmpss_SetFilterInput(uint8 InstanceId, Cdd_Cmpss_CompSideType Side, uint8 FilterInput)

Set the filter input source for one side.

Std_ReturnType

Cdd_Cmpss_ClearLatch(uint8 InstanceId, Cdd_Cmpss_CompSideType Side)

Clear the comparator filter latch for one side.

Std_ReturnType

Cdd_Cmpss_ConfigSyncClear(uint8 InstanceId, Cdd_Cmpss_CompSideType Side, boolean Enable)

Enable or disable automatic latch clear on EPWMnSYNCPER for one side.

Std_ReturnType

Cdd_Cmpss_ConfigBlankingSource(uint8 InstanceId, Cdd_Cmpss_CompSideType Side, Cdd_Cmpss_EpwmSourceType Source)

Configure which EPWM blanks one comparator side.

Std_ReturnType

Cdd_Cmpss_SetBlankingEnable(uint8 InstanceId, Cdd_Cmpss_CompSideType Side, boolean Enable)

Enable or disable blanking for one comparator side.

Std_ReturnType

Cdd_Cmpss_ConfigDEActiveSource(uint8 InstanceId, Cdd_Cmpss_EpwmSourceType Source)

Configure the Diode Emulation active source — module-level, applies to BOTH DAC channels.

Std_ReturnType

Cdd_Cmpss_SetDEModeEnable(uint8 InstanceId, boolean Enable)

Enable or disable Diode Emulation mode — module-level, applies to BOTH DAC channels.

Std_ReturnType

Cdd_Cmpss_ApplyLock(uint8 InstanceId, uint8 LockMask)

Apply write-protection locks to the CMPSS instance’s configuration registers (write-once — cannot be cleared until device reset).

Std_ReturnType

Cdd_Cmpss_ConfigOutputs(uint8 InstanceId, Cdd_Cmpss_CompSideType Side, const Cdd_Cmpss_CompOutputCfgType * CompOutputCfg)

Configure trip output routing for one comparator side.

Std_ReturnType

Cdd_Cmpss_InitFilter(uint8 InstanceId, Cdd_Cmpss_CompSideType Side)

Initialize the digital filter for one side and clear the associated latch.

7.11.4.1. function Cdd_Cmpss_GetVersionInfo

void Cdd_Cmpss_GetVersionInfo(
    Std_VersionInfoType * VersionInfoPtr
)

Brief: Service to return the version information of the CDD CMPSS driver.

This service returns the version information of the Cmpss module.

Parameters:

  • VersionInfoPtr Pointer to Std_VersionInfoType structure to fill.

Returns:

  • None

Return: None

Precondition: This API is available only if CDD_CMPSS_GET_VERSION_INFO_API is STD_ON.

Postcondition: None

7.11.4.2. function Cdd_Cmpss_Init

void Cdd_Cmpss_Init(
    const Cdd_Cmpss_ConfigType * ConfigPtr
)

Brief: Initialize all configured CMPSS instances.

Parameters:

  • ConfigPtr Pointer to the top-level driver configuration.

Precondition:

  • Module must be in UNINIT state.

  • If any instance’s SwLoadSel is CDD_CMPSS_DAC_LOAD_SYNCPER, the EPWM referenced by that instance’s HighRampCfg.Source must already have a non-zero period configured via Cdd_Pwm — otherwise EPWMSYNCPER is held level-high and the DAC shadow value loads immediately on every write regardless of SwLoadSel (see Cdd_Cmpss_DacLoadSelType).

Postcondition: Module transitions to INIT state.

7.11.4.3. function Cdd_Cmpss_DeInit

void Cdd_Cmpss_DeInit(
    void 
)

Brief: Deinitialize all configured CMPSS instances.

Disables all CMPSS module instances and returns the driver to the uninitialized state.

Precondition: Module must be in INIT state.

Postcondition: Module transitions to UNINIT state.

7.11.4.4. function Cdd_Cmpss_GetStatus

Std_ReturnType Cdd_Cmpss_GetStatus(
    uint8 InstanceId,
    Cdd_Cmpss_StatusType * StatusPtr
)

Brief: Read the current comparator output and latched-output status for both sides.

Parameters:

  • InstanceId Symbolic name of the target CMPSS instance (the Cdd_CmpssConf_CddCmpssHwInstance_ constant generated for that instance).

  • StatusPtr Pointer to status structure to populate.

Return: E_OK on success, E_NOT_OK on DET error.

7.11.4.5. function Cdd_Cmpss_SetModuleEnable

Std_ReturnType Cdd_Cmpss_SetModuleEnable(
    uint8 InstanceId,
    boolean Enable
)

Brief: Enable or disable the CMPSS module at runtime.

Parameters:

  • InstanceId Symbolic name of the target CMPSS instance (the Cdd_CmpssConf_CddCmpssHwInstance_ constant generated for that instance).

  • Enable TRUE to enable the module, FALSE to disable it.

Return: E_OK on success, E_NOT_OK on DET error.

Note: If COMPLOCK.COMPCTL is set, hardware silently ignores this write. Cdd_Cmpss_ApplyLock() is the only function that manages COMPLOCK; there is no runtime lock-check or E_LOCKED return.

7.11.4.6. function Cdd_Cmpss_ConfigComparator

Std_ReturnType Cdd_Cmpss_ConfigComparator(
    uint8 InstanceId,
    Cdd_Cmpss_CompSideType Side,
    const Cdd_Cmpss_CompCfgType * CompCfg
)

Brief: Reconfigure comparator source, inversion, and async settings for one side at runtime.

Parameters:

  • InstanceId Symbolic name of the target CMPSS instance (the Cdd_CmpssConf_CddCmpssHwInstance_ constant generated for that instance).

  • Side CDD_CMPSS_SIDE_HIGH or CDD_CMPSS_SIDE_LOW.

  • CompCfg Pointer to single-side comparator configuration.

Return: E_OK on success, E_NOT_OK on DET error.

Note:

  • If COMPLOCK.COMPCTL is set, hardware silently ignores this write. Cdd_Cmpss_ApplyLock() is the only function that manages COMPLOCK; there is no runtime lock-check or E_LOCKED return.

  • If CompCfg->AsyncEn is TRUE, this side’s CURRENT CtripSel/CtripoutSel (as last set by Cdd_Cmpss_ConfigOutputs(), or CDD_CMPSS_TRIP_SEL_ASYNC if never set) must already select CDD_CMPSS_TRIP_SEL_LATCHED on at least one of the two, or this call is DET-rejected with CDD_CMPSS_E_PARAM_VALUE — AsyncEn is a hardware no-op otherwise. Call Cdd_Cmpss_ConfigOutputs() with LATCHED routing first if the async path is required.

7.11.4.7. function Cdd_Cmpss_SetHysteresis

Std_ReturnType Cdd_Cmpss_SetHysteresis(
    uint8 InstanceId,
    Cdd_Cmpss_HysLevelType Level
)

Brief: Set the comparator hysteresis level at runtime.

Applies the selected hysteresis window symmetrically to both the High and Low comparators.

Parameters:

  • InstanceId Symbolic name of the target CMPSS instance (the Cdd_CmpssConf_CddCmpssHwInstance_ constant generated for that instance).

  • Level Hysteresis level (CDD_CMPSS_HYS_NONE through CDD_CMPSS_HYS_4X).

Return: E_OK on success, E_NOT_OK on DET error.

Note: If COMPLOCK.COMPHYSCTL is set, hardware silently ignores this write. Cdd_Cmpss_ApplyLock() is the only function that manages COMPLOCK; there is no runtime lock-check or E_LOCKED return.

7.11.4.8. function Cdd_Cmpss_ConfigDac

Std_ReturnType Cdd_Cmpss_ConfigDac(
    uint8 InstanceId,
    Cdd_Cmpss_CompSideType Side,
    const Cdd_Cmpss_SingleDacCfgType * DacCfg
)

Brief: Reconfigure DAC source for one side at runtime (DacRef/SwLoadSel are module-level).

Updates this side’s DAC source selection and both threshold shadow values in a single call.

Parameters:

  • InstanceId Symbolic name of the target CMPSS instance (the Cdd_CmpssConf_CddCmpssHwInstance_ constant generated for that instance).

  • Side CDD_CMPSS_SIDE_HIGH or CDD_CMPSS_SIDE_LOW.

  • DacCfg Pointer to single-side DAC configuration.

Return: E_OK on success, E_NOT_OK on DET error.

Note: COMPLOCK.DACCTL locks write-access to the COMPDACxCTL/COMPDACxCTL2 control register(s) only — if that bit is set, the DACSOURCE write is hardware-ignored, but the shadow register write (InitValue/InitValueDE) is NOT covered by this lock and always takes effect. Cdd_Cmpss_ApplyLock() is the only function that manages COMPLOCK; there is no runtime lock-check or E_LOCKED return.

7.11.4.9. function Cdd_Cmpss_SetDacValue

Std_ReturnType Cdd_Cmpss_SetDacValue(
    uint8 InstanceId,
    Cdd_Cmpss_CompSideType Side,
    uint16 Value
)

Brief: Write the DAC threshold value for one side.

Parameters:

  • InstanceId Symbolic name of the target CMPSS instance (the Cdd_CmpssConf_CddCmpssHwInstance_ constant generated for that instance).

  • Side CDD_CMPSS_SIDE_HIGH or CDD_CMPSS_SIDE_LOW.

  • Value 12-bit DAC value (0–CDD_CMPSS_DAC_VALUE_MAX).

Return: E_OK on success, E_NOT_OK on DET error.

Note: DACHVALS/DACLVALS are shadow VALUE registers, not COMPDACxCTL control registers. COMPLOCK.DACCTL locks only the COMPDACxCTL/COMPDACxCTL2 control register(s) — it does not cover this register, so this write is never blocked by that lock (or any other COMPLOCK bit). Cdd_Cmpss_ApplyLock() is the only function that manages COMPLOCK.

7.11.4.10. function Cdd_Cmpss_GetDacActiveValue

Std_ReturnType Cdd_Cmpss_GetDacActiveValue(
    uint8 InstanceId,
    Cdd_Cmpss_CompSideType Side,
    uint16 * ValuePtr
)

Brief: Read the current active DAC value for one side.

Parameters:

  • InstanceId Symbolic name of the target CMPSS instance (the Cdd_CmpssConf_CddCmpssHwInstance_ constant generated for that instance).

  • Side CDD_CMPSS_SIDE_HIGH or CDD_CMPSS_SIDE_LOW.

  • ValuePtr Pointer to receive the active DAC value (0–CDD_CMPSS_DAC_VALUE_MAX).

Return: E_OK on success, E_NOT_OK on DET error.

7.11.4.11. function Cdd_Cmpss_SetDacValueDE

Std_ReturnType Cdd_Cmpss_SetDacValueDE(
    uint8 InstanceId,
    Cdd_Cmpss_CompSideType Side,
    uint16 Value
)

Brief: Write the DE-mode secondary DAC threshold value for one side.

Parameters:

  • InstanceId Symbolic name of the target CMPSS instance (the Cdd_CmpssConf_CddCmpssHwInstance_ constant generated for that instance).

  • Side CDD_CMPSS_SIDE_HIGH or CDD_CMPSS_SIDE_LOW.

  • Value 12-bit DAC value (0–CDD_CMPSS_DAC_VALUE_MAX).

Return: E_OK on success, E_NOT_OK on DET error.

Note: DACHVALS2/DACLVALS2 are shadow VALUE registers, not COMPDACxCTL control registers. COMPLOCK.DACCTL locks only the COMPDACxCTL/COMPDACxCTL2 control register(s) — it does not cover this register, so this write is never blocked by that lock (or any other COMPLOCK bit). Cdd_Cmpss_ApplyLock() is the only function that manages COMPLOCK.

7.11.4.12. function Cdd_Cmpss_ConfigRamp

Std_ReturnType Cdd_Cmpss_ConfigRamp(
    uint8 InstanceId,
    Cdd_Cmpss_CompSideType Side,
    const Cdd_Cmpss_RampCfgType * RampCfg
)

Brief: Reconfigure the ramp generator for one side at runtime (FreeSoft is module-level).

Updates this side’s ramp direction, trigger source, and reload behavior together with its reference, step, delay, and clock-divider shadow values in one call.

Parameters:

  • InstanceId Symbolic name of the target CMPSS instance (the Cdd_CmpssConf_CddCmpssHwInstance_ constant generated for that instance).

  • Side CDD_CMPSS_SIDE_HIGH or CDD_CMPSS_SIDE_LOW.

  • RampCfg Pointer to ramp configuration.

Return: E_OK on success, E_NOT_OK on DET error.

Note: COMPLOCK.DACCTL locks write-access to the COMPDACxCTL/COMPDACxCTL2 control register(s) only — if that bit is set, the control-field write is hardware-ignored, but the shadow register writes are NOT covered by this lock and always take effect. Cdd_Cmpss_ApplyLock() is the only function that manages COMPLOCK; there is no runtime lock-check or E_LOCKED return.

7.11.4.13. function Cdd_Cmpss_SetRampShadow

Std_ReturnType Cdd_Cmpss_SetRampShadow(
    uint8 InstanceId,
    Cdd_Cmpss_CompSideType Side,
    const Cdd_Cmpss_RampShadowParamsType * Params
)

Brief: Update the ramp generator’s reference, step, delay, and clock-divider values for one side at runtime.

Parameters:

  • InstanceId Symbolic name of the target CMPSS instance (the Cdd_CmpssConf_CddCmpssHwInstance_ constant generated for that instance).

  • Side CDD_CMPSS_SIDE_HIGH or CDD_CMPSS_SIDE_LOW.

  • Params Pointer to shadow update parameters.

Return: E_OK on success, E_NOT_OK on DET error.

Note: RAMPxREFS/RAMPxSTEPVALS/RAMPxCTLS/RAMPxDLYS are shadow VALUE registers, not COMPDACxCTL control registers. COMPLOCK.DACCTL locks only the COMPDACxCTL/COMPDACxCTL2 control register(s) — it does not cover these registers, so this write is never blocked by that lock (or any other COMPLOCK bit). Cdd_Cmpss_ApplyLock() is the only function that manages COMPLOCK.

7.11.4.14. function Cdd_Cmpss_GetRampActiveParams

Std_ReturnType Cdd_Cmpss_GetRampActiveParams(
    uint8 InstanceId,
    Cdd_Cmpss_CompSideType Side,
    Cdd_Cmpss_RampActiveParamsType * ParamsPtr
)

Brief: Read the ramp generator’s currently active reference, step, delay, and clock-divider values for one side.

Parameters:

  • InstanceId Symbolic name of the target CMPSS instance (the Cdd_CmpssConf_CddCmpssHwInstance_ constant generated for that instance).

  • Side CDD_CMPSS_SIDE_HIGH or CDD_CMPSS_SIDE_LOW.

  • ParamsPtr Pointer to receive active ramp parameters.

Return: E_OK on success, E_NOT_OK on DET error.

7.11.4.15. function Cdd_Cmpss_GetRampStatus

Std_ReturnType Cdd_Cmpss_GetRampStatus(
    uint8 InstanceId,
    Cdd_Cmpss_CompSideType Side,
    uint16 * CountPtr
)

Brief: Read the current ramp counter value for one side.

Parameters:

  • InstanceId Symbolic name of the target CMPSS instance (the Cdd_CmpssConf_CddCmpssHwInstance_ constant generated for that instance).

  • Side CDD_CMPSS_SIDE_HIGH or CDD_CMPSS_SIDE_LOW.

  • CountPtr Pointer to receive the 16-bit ramp counter value.

Return: E_OK on success, E_NOT_OK on DET error.

7.11.4.16. function Cdd_Cmpss_ConfigRampXTrigger

Std_ReturnType Cdd_Cmpss_ConfigRampXTrigger(
    uint8 InstanceId,
    Cdd_Cmpss_XtrigCfgType XtrigCfg
)

Brief: Configure the ramp cross-trigger configuration.

Parameters:

  • InstanceId Symbolic name of the target CMPSS instance (the Cdd_CmpssConf_CddCmpssHwInstance_ constant generated for that instance).

  • XtrigCfg Cross-trigger configuration enum value.

Return: E_OK on success, E_NOT_OK on DET error.

Note: If COMPLOCK.DACCTL is set, hardware silently ignores this write. Cdd_Cmpss_ApplyLock() is the only function that manages COMPLOCK; there is no runtime lock-check or E_LOCKED return.

7.11.4.17. function Cdd_Cmpss_ConfigFilter

Std_ReturnType Cdd_Cmpss_ConfigFilter(
    uint8 InstanceId,
    Cdd_Cmpss_CompSideType Side,
    const Cdd_Cmpss_FilterCfgType * FilterCfg
)

Brief: Reconfigure the digital filter parameters for one side.

Updates this side’s filter input selection, sample window, and majority threshold. Does not restart the filter — call Cdd_Cmpss_InitFilter() afterward to complete initialization.

Parameters:

  • InstanceId Symbolic name of the target CMPSS instance (the Cdd_CmpssConf_CddCmpssHwInstance_ constant generated for that instance).

  • Side CDD_CMPSS_SIDE_HIGH or CDD_CMPSS_SIDE_LOW.

  • FilterCfg Pointer to filter configuration.

Return: E_OK on success, E_NOT_OK on DET error.

Note: If COMPLOCK.CTRIP is set, hardware silently ignores this write. Cdd_Cmpss_ApplyLock() is the only function that manages COMPLOCK; there is no runtime lock-check or E_LOCKED return.

7.11.4.18. function Cdd_Cmpss_SetFilterInput

Std_ReturnType Cdd_Cmpss_SetFilterInput(
    uint8 InstanceId,
    Cdd_Cmpss_CompSideType Side,
    uint8 FilterInput
)

Brief: Set the filter input source for one side.

Parameters:

  • InstanceId Symbolic name of the target CMPSS instance (the Cdd_CmpssConf_CddCmpssHwInstance_ constant generated for that instance).

  • Side CDD_CMPSS_SIDE_HIGH or CDD_CMPSS_SIDE_LOW.

  • FilterInput Filter input select value; see CDD_CMPSS_FILTER_INPUT_SUPPORTED_MAX for the device-supported range.

Return: E_OK on success, E_NOT_OK on DET error.

Note: If COMPLOCK.CTRIP is set, hardware silently ignores this write. Cdd_Cmpss_ApplyLock() is the only function that manages COMPLOCK; there is no runtime lock-check or E_LOCKED return.

7.11.4.19. function Cdd_Cmpss_ClearLatch

Std_ReturnType Cdd_Cmpss_ClearLatch(
    uint8 InstanceId,
    Cdd_Cmpss_CompSideType Side
)

Brief: Clear the comparator filter latch for one side.

Parameters:

  • InstanceId Symbolic name of the target CMPSS instance (the Cdd_CmpssConf_CddCmpssHwInstance_ constant generated for that instance).

  • Side Selects which comparator side’s latched output is cleared.

Return: E_OK on success, E_NOT_OK on DET error.

7.11.4.20. function Cdd_Cmpss_ConfigSyncClear

Std_ReturnType Cdd_Cmpss_ConfigSyncClear(
    uint8 InstanceId,
    Cdd_Cmpss_CompSideType Side,
    boolean Enable
)

Brief: Enable or disable automatic latch clear on EPWMnSYNCPER for one side.

Selects whether this side’s output latch is cleared automatically on every EPWMnSYNCPER event.

Parameters:

  • InstanceId Symbolic name of the target CMPSS instance (the Cdd_CmpssConf_CddCmpssHwInstance_ constant generated for that instance).

  • Side CDD_CMPSS_SIDE_HIGH or CDD_CMPSS_SIDE_LOW.

  • Enable TRUE to enable sync-clear, FALSE to disable.

Return: E_OK on success, E_NOT_OK on DET error.

Note: None of the four COMPLOCK bits (COMPCTL, COMPHYSCTL, DACCTL, CTRIP) cover this setting; it is therefore never blocked by any COMPLOCK bit. Cdd_Cmpss_ApplyLock() is the only function that manages COMPLOCK.

7.11.4.21. function Cdd_Cmpss_ConfigBlankingSource

Std_ReturnType Cdd_Cmpss_ConfigBlankingSource(
    uint8 InstanceId,
    Cdd_Cmpss_CompSideType Side,
    Cdd_Cmpss_EpwmSourceType Source
)

Brief: Configure which EPWM blanks one comparator side.

Selects which EPWM instance’s SYNCPER signal blanks this comparator side’s output.

Parameters:

  • InstanceId Symbolic name of the target CMPSS instance (the Cdd_CmpssConf_CddCmpssHwInstance_ constant generated for that instance).

  • Side CDD_CMPSS_SIDE_HIGH or CDD_CMPSS_SIDE_LOW.

  • Source EPWM whose SYNCPER blanks this comparator output, from the device-scoped choices generated in Cdd_Cmpss_Cfg.h.

Return: E_OK on success, E_NOT_OK on DET error.

Note: If COMPLOCK.DACCTL is set, hardware silently ignores this write. Cdd_Cmpss_ApplyLock() is the only function that manages COMPLOCK; there is no runtime lock-check or E_LOCKED return.

7.11.4.22. function Cdd_Cmpss_SetBlankingEnable

Std_ReturnType Cdd_Cmpss_SetBlankingEnable(
    uint8 InstanceId,
    Cdd_Cmpss_CompSideType Side,
    boolean Enable
)

Brief: Enable or disable blanking for one comparator side.

Enables or disables output blanking for this comparator side.

Parameters:

  • InstanceId Symbolic name of the target CMPSS instance (the Cdd_CmpssConf_CddCmpssHwInstance_ constant generated for that instance).

  • Side CDD_CMPSS_SIDE_HIGH or CDD_CMPSS_SIDE_LOW.

  • Enable TRUE to enable blanking, FALSE to disable.

Return: E_OK on success, E_NOT_OK on DET error.

Note: If COMPLOCK.DACCTL is set, hardware silently ignores this write. Cdd_Cmpss_ApplyLock() is the only function that manages COMPLOCK; there is no runtime lock-check or E_LOCKED return.

7.11.4.23. function Cdd_Cmpss_ConfigDEActiveSource

Std_ReturnType Cdd_Cmpss_ConfigDEActiveSource(
    uint8 InstanceId,
    Cdd_Cmpss_EpwmSourceType Source
)

Brief: Configure the Diode Emulation active source — module-level, applies to BOTH DAC channels.

Parameters:

  • InstanceId Symbolic name of the target CMPSS instance (the Cdd_CmpssConf_CddCmpssHwInstance_ constant generated for that instance).

  • Source EPWM whose DEACTIVE signal trips DE mode, from the device-scoped choices generated in Cdd_Cmpss_Cfg.h.

Return: E_OK on success, E_NOT_OK on DET error.

Note: If COMPLOCK.DACCTL is set, hardware silently ignores this write. Cdd_Cmpss_ApplyLock() is the only function that manages COMPLOCK; there is no runtime lock-check or E_LOCKED return.

7.11.4.24. function Cdd_Cmpss_SetDEModeEnable

Std_ReturnType Cdd_Cmpss_SetDEModeEnable(
    uint8 InstanceId,
    boolean Enable
)

Brief: Enable or disable Diode Emulation mode — module-level, applies to BOTH DAC channels.

Parameters:

  • InstanceId Symbolic name of the target CMPSS instance (the Cdd_CmpssConf_CddCmpssHwInstance_ constant generated for that instance).

  • Enable TRUE to enable DE mode, FALSE to disable.

Return: E_OK on success, E_NOT_OK on DET error.

Note: If COMPLOCK.DACCTL is set, hardware silently ignores this write. Cdd_Cmpss_ApplyLock() is the only function that manages COMPLOCK; there is no runtime lock-check or E_LOCKED return.

7.11.4.25. function Cdd_Cmpss_ApplyLock

Std_ReturnType Cdd_Cmpss_ApplyLock(
    uint8 InstanceId,
    uint8 LockMask
)

Brief: Apply write-protection locks to the CMPSS instance’s configuration registers (write-once — cannot be cleared until device reset).

Parameters:

  • InstanceId Symbolic name of the target CMPSS instance (the Cdd_CmpssConf_CddCmpssHwInstance_ constant generated for that instance).

  • LockMask OR-combination of Cdd_Cmpss_LockMaskType values.

Return: E_OK on success, E_NOT_OK on DET error.

7.11.4.26. function Cdd_Cmpss_ConfigOutputs

Std_ReturnType Cdd_Cmpss_ConfigOutputs(
    uint8 InstanceId,
    Cdd_Cmpss_CompSideType Side,
    const Cdd_Cmpss_CompOutputCfgType * CompOutputCfg
)

Brief: Configure trip output routing for one comparator side.

Must be called after the filter has been initialized via Cdd_Cmpss_InitFilter().

Parameters:

  • InstanceId Symbolic name of the target CMPSS instance (the Cdd_CmpssConf_CddCmpssHwInstance_ constant generated for that instance).

  • Side CDD_CMPSS_SIDE_HIGH or CDD_CMPSS_SIDE_LOW.

  • CompOutputCfg Pointer to output routing configuration.

Return: E_OK on success, E_NOT_OK on DET error.

Note:

  • If COMPLOCK.COMPCTL is set, hardware silently ignores this write. Cdd_Cmpss_ApplyLock() is the only function that manages COMPLOCK; there is no runtime lock-check or E_LOCKED return.

  • If this side’s async bypass (AsyncEn, see Cdd_Cmpss_ConfigComparator()) is CURRENTLY enabled, CompOutputCfg must set CtripSel or CtripoutSel to CDD_CMPSS_TRIP_SEL_LATCHED on at least one of the two, or this call is DET-rejected with CDD_CMPSS_E_PARAM_VALUE — leaving AsyncEn enabled with neither field LATCHED would make it a hardware no-op. Call Cdd_Cmpss_ConfigComparator() with AsyncEn=FALSE first if non-latched routing is required.

7.11.4.27. function Cdd_Cmpss_InitFilter

Std_ReturnType Cdd_Cmpss_InitFilter(
    uint8 InstanceId,
    Cdd_Cmpss_CompSideType Side
)

Brief: Initialize the digital filter for one side and clear the associated latch.

Must be called after Cdd_Cmpss_ConfigFilter() to complete the filter initialization sequence. Restarts the digital filter’s majority-vote state and clears this side’s output latch in one call.

Parameters:

  • InstanceId Symbolic name of the target CMPSS instance (the Cdd_CmpssConf_CddCmpssHwInstance_ constant generated for that instance).

  • Side CDD_CMPSS_SIDE_HIGH or CDD_CMPSS_SIDE_LOW.

Return: E_OK on success, E_NOT_OK on DET error.

Note: COMPLOCK.CTRIP locks write-access to CTRIPxFILTCTL/CTRIPxFILCLKCTLx only — if that bit is set, the FILINIT write is hardware-ignored, but COMPSTSCLR is not covered by any COMPLOCK bit, so the latch-clear write always takes effect regardless of lock state. Cdd_Cmpss_ApplyLock() is the only function that manages COMPLOCK; there is no runtime lock-check or E_LOCKED return.