5.13. CDD_PWM

5.13.1. Types

Base type

Type Name

Brief

enum

Cdd_Pwm_OutputChannelType

Cdd_Pwm_OutputChannelType determines the channel output.

enum

Cdd_Pwm_TimeBaseCountModeType

Enumeration to define the time base counter mode.

enum

Cdd_Pwm_OutputStateType

Output Status type.

enum

Cdd_Pwm_EdgeNotificationType

Edge notification type.

enum

Cdd_Pwm_ChannelClassType

Channel class type.

enum

Cdd_Pwm_ActionQualifierOutputEventType

Cdd_Pwm_ActionQualifierOutputEventType output defines the action qualifier event type.

enum

Cdd_Pwm_ActionQualifierOutputType

enum

Cdd_Pwm_ClockDividerType

enum

Cdd_Pwm_HighSpeedClkDivType

enum

Cdd_Pwm_CounterCompareModuleType

enum

Cdd_Pwm_CounterCompareLoadModeType

Action qualifier Shadow mode load mode.

enum

Cdd_Pwm_InterruptSourceType

Enumeration for interrupt source.

enum

Cdd_Pwm_ActionQualifierLoadModeType

Action qualifier Shadow mode load mode.

enum

Cdd_Pwm_EmulationModeType

enum

Cdd_Pwm_OutputSymmetryType

Cdd_Pwm_OutputSymmetryType determines the symmetry of the output waveform of a PWM instance.

typedef uint8

Cdd_Pwm_ChannelType

Numeric Identifier of a PWM channel.

typedef uint8

Cdd_Pwm_InstanceType

Numeric Identifier of a PWM instance.

typedef uint8

Cdd_Pwm_HrpwmCalInstanceType

Numeric Identifier of a HRPWMCAL instance.

typedef uint16

Cdd_Pwm_PeriodType

Period of the PWM instance.

typedef uint16

Cdd_Pwm_DutyCycleType

Duty cycle of the PWM channel.

typedef void(*)(void)

Cdd_Pwm_NotificationType

Notification function pointer.

5.13.1.1. enum Cdd_Pwm_OutputChannelType

Enumerator

Value

Description

CDD_PWM_OUTPUT_A

0U

Ouput channel A.

CDD_PWM_OUTPUT_B

1U

Ouput channel B.

Brief: Cdd_Pwm_OutputChannelType determines the channel output.

5.13.1.2. enum Cdd_Pwm_TimeBaseCountModeType

Enumerator

Value

Description

CDD_PWM_COUNTER_MODE_UP

0U

CDD_PWM_COUNTER_MODE_DOWN

1U

Up - count mode.

CDD_PWM_COUNTER_MODE_UP_DOWN

2U

Down - count mode.

CDD_PWM_COUNTER_MODE_STOP_FREEZE

3U

Up - down - count mode.

Brief: Enumeration to define the time base counter mode.

5.13.1.3. enum Cdd_Pwm_OutputStateType

Enumerator

Value

Description

CDD_PWM_HIGH

The PWM channel is in high state.

CDD_PWM_LOW

The PWM channel is in low state.

Brief: Output Status type.

5.13.1.4. enum Cdd_Pwm_EdgeNotificationType

Enumerator

Value

Description

CDD_PWM_RISING_EDGE

Notification will be called when a rising edge occurs on the PWM output signal.

CDD_PWM_FALLING_EDGE

Notification will be called when a falling edge occurs on the PWM output signal. Notification will be called when either a rising edge or falling edge occur on the PWM output signal

CDD_PWM_BOTH_EDGES

CDD_PWM_EDGE_NONE

No notification will be called.

Brief: Edge notification type.

5.13.1.5. enum Cdd_Pwm_ChannelClassType

Enumerator

Value

Description

CDD_PWM_VARIABLE_PERIOD

The PWM channel has a variable period. The duty cycle and the period can be changed.

CDD_PWM_FIXED_PERIOD

The PWM channel has a fixed period. Only the duty cycle can be changed.

Brief: Channel class type.

5.13.1.6. enum Cdd_Pwm_ActionQualifierOutputEventType

Enumerator

Value

Description

CDD_PWM_AQ_OUTPUT_ON_TIMEBASE_ZERO

0U

Time base counter equals zero.

CDD_PWM_AQ_OUTPUT_ON_T1_COUNT_UP

1U

T1 event on count up.

CDD_PWM_AQ_OUTPUT_ON_TIMEBASE_PERIOD

2U

Time base counter equals period.

CDD_PWM_AQ_OUTPUT_ON_T1_COUNT_DOWN

3U

T1 event on count down.

CDD_PWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA

4U

Time base counter up equals COMPA.

CDD_PWM_AQ_OUTPUT_ON_T2_COUNT_UP

5U

T2 event on count up.

CDD_PWM_AQ_OUTPUT_ON_TIMEBASE_DOWN_CMPA

6U

Time base counter down equals COMPA.

CDD_PWM_AQ_OUTPUT_ON_T2_COUNT_DOWN

7U

T2 event on count down.

CDD_PWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPB

8U

Time base counter up equals COMPB.

CDD_PWM_AQ_OUTPUT_ON_TIMEBASE_DOWN_CMPB

10U

Time base counter down equals COMPB.

Brief: Cdd_Pwm_ActionQualifierOutputEventType output defines the action qualifier event type.

5.13.1.7. enum Cdd_Pwm_ActionQualifierOutputType

Enumerator

Value

Description

CDD_PWM_AQ_OUTPUT_NO_CHANGE

0U

CDD_PWM_AQ_OUTPUT_LOW

1U

No change in the output pins.

CDD_PWM_AQ_OUTPUT_HIGH

2U

Set output pins to low.

CDD_PWM_AQ_OUTPUT_TOGGLE

3U

Set output pins to High.

5.13.1.8. enum Cdd_Pwm_ClockDividerType

Enumerator

Value

Description

CDD_PWM_CLOCK_DIVIDER_1

0U

CDD_PWM_CLOCK_DIVIDER_2

1U

CDD_PWM_CLOCK_DIVIDER_4

2U

CDD_PWM_CLOCK_DIVIDER_8

3U

CDD_PWM_CLOCK_DIVIDER_16

4U

CDD_PWM_CLOCK_DIVIDER_32

5U

CDD_PWM_CLOCK_DIVIDER_64

6U

CDD_PWM_CLOCK_DIVIDER_128

7U

5.13.1.9. enum Cdd_Pwm_HighSpeedClkDivType

Enumerator

Value

Description

CDD_PWM_HSCLOCK_DIVIDER_1

0U

CDD_PWM_HSCLOCK_DIVIDER_2

1U

CDD_PWM_HSCLOCK_DIVIDER_4

2U

CDD_PWM_HSCLOCK_DIVIDER_6

3U

CDD_PWM_HSCLOCK_DIVIDER_8

4U

CDD_PWM_HSCLOCK_DIVIDER_10

5U

CDD_PWM_HSCLOCK_DIVIDER_12

6U

CDD_PWM_HSCLOCK_DIVIDER_14

7U

5.13.1.10. enum Cdd_Pwm_CounterCompareModuleType

Enumerator

Value

Description

CDD_PWM_COUNTER_COMPARE_A

0U

CDD_PWM_COUNTER_COMPARE_B

2U

CDD_PWM_COUNTER_COMPARE_C

5U

CDD_PWM_COUNTER_COMPARE_D

7U

5.13.1.11. enum Cdd_Pwm_CounterCompareLoadModeType

Enumerator

Value

Description

CDD_PWM_COMP_LOAD_ON_CNTR_ZERO

0U

CDD_PWM_COMP_LOAD_ON_CNTR_PERIOD

1U

CDD_PWM_COMP_LOAD_ON_CNTR_ZERO_PERIOD

2U

CDD_PWM_COMP_LOAD_FREEZE

3U

CDD_PWM_COMP_LOAD_ON_SYNC_CNTR_ZERO

4U

CDD_PWM_COMP_LOAD_ON_SYNC_CNTR_PERIOD

5U

CDD_PWM_COMP_LOAD_ON_SYNC_CNTR_ZERO_PERIOD

6U

CDD_PWM_COMP_LOAD_ON_SYNC_ONLY

8U

Brief: Action qualifier Shadow mode load mode.

5.13.1.12. enum Cdd_Pwm_InterruptSourceType

Enumerator

Value

Description

CDD_PWM_NT_TBCTR_DISABLED

0U

Time-base counter equal to zero.

CDD_PWM_INT_TBCTR_ZERO

1U

Time-base counter equal to zero.

CDD_PWM_INT_TBCTR_PERIOD

2U

Time-base counter equal to period.

CDD_PWM_INT_TBCTR_ETINTMIX

3U

Time-base counter based on mixed events (ETINTMIX)

CDD_PWM_INT_TBCTR_U_CMPA

4U

Time-base counter equal to CMPA when the timer is incrementing.

CDD_PWM_INT_TBCTR_D_CMPA

5U

Time-base counter equal to CMPAwhen the timer is decrementing.

CDD_PWM_INT_TBCTR_U_CMPB

6U

Time-base counter equal to CMPB when the timer is incrementing.

CDD_PWM_INT_TBCTR_D_CMPB

7U

Time-base counter equal to CMPB when the timer is decrementing.

CDD_PWM_INT_TBCTR_U_CMPC

8U

Time-base counter equal to CMPC when the timer is incrementing.

CDD_PWM_INT_TBCTR_D_CMPC

10U

Time-base counter equal to CMPC when the timer is decrementing.

CDD_PWM_INT_TBCTR_U_CMPD

12U

Time-base counter equal to CMPD when the timer is incrementing.

CDD_PWM_INT_TBCTR_D_CMPD

14U

Time-base counter equal to CMPD when the timer is decrementing.

Brief: Enumeration for interrupt source.

5.13.1.13. enum Cdd_Pwm_ActionQualifierLoadModeType

Enumerator

Value

Description

CDD_PWM_AQ_LOAD_ON_CNTR_ZERO

0U

CDD_PWM_AQ_LOAD_ON_CNTR_PERIOD

1U

CDD_PWM_AQ_LOAD_ON_CNTR_ZERO_PERIOD

2U

CDD_PWM_AQ_LOAD_FREEZE

3U

CDD_PWM_AQ_LOAD_ON_SYNC_CNTR_ZERO

4U

CDD_PWM_AQ_LOAD_ON_SYNC_CNTR_PERIOD

5U

CDD_PWM_AQ_LOAD_ON_SYNC_CNTR_ZERO_PERIOD

6U

CDD_PWM_AQ_LOAD_ON_SYNC_ONLY

8U

Brief: Action qualifier Shadow mode load mode.

5.13.1.14. enum Cdd_Pwm_EmulationModeType

Enumerator

Value

Description

CDD_PWM_EMULATION_STOP_AFTER_NEXT_TB

0U

CDD_PWM_EMULATION_STOP_AFTER_FULL_CYCLE

1U

CDD_PWM_EMULATION_FREE_RUN

2U

5.13.1.15. enum Cdd_Pwm_OutputSymmetryType

Enumerator

Value

Description

CDD_PWM_ASYMMETRIC_WAVEFORM

Asymmetric waveform.

CDD_PWM_SYMMETRIC_WAVEFORM

Symmetric waveform.

Brief: Cdd_Pwm_OutputSymmetryType determines the symmetry of the output waveform of a PWM instance.

5.13.1.16. typedef Cdd_Pwm_ChannelType

typedef uint8 Cdd_Pwm_ChannelType;

Brief: Numeric Identifier of a PWM channel.

5.13.1.17. typedef Cdd_Pwm_InstanceType

typedef uint8 Cdd_Pwm_InstanceType;

Brief: Numeric Identifier of a PWM instance.

5.13.1.18. typedef Cdd_Pwm_HrpwmCalInstanceType

typedef uint8 Cdd_Pwm_HrpwmCalInstanceType;

Brief: Numeric Identifier of a HRPWMCAL instance.

5.13.1.19. typedef Cdd_Pwm_PeriodType

typedef uint16 Cdd_Pwm_PeriodType;

Brief: Period of the PWM instance.

5.13.1.20. typedef Cdd_Pwm_DutyCycleType

typedef uint16 Cdd_Pwm_DutyCycleType;

Brief: Duty cycle of the PWM channel.

5.13.1.21. typedef Cdd_Pwm_NotificationType

typedef void(* Cdd_Pwm_NotificationType) (void);

Brief: Notification function pointer.

5.13.2. Structures

Name

Brief

Cdd_Pwm_HwUnitCfgType

Cdd_Pwm_ChannelCfgType

Cdd_Pwm_ConfigType

PWM driver configuration.

5.13.3. Defines

Name

Brief

CDD_PWM_SW_MAJOR_VERSION

Driver Implementation Major Version.

CDD_PWM_SW_MINOR_VERSION

Driver Implementation Minor Version.

CDD_PWM_SW_PATCH_VERSION

Driver Implementation Patch Version.

CDD_PWM_AR_RELEASE_MAJOR_VERSION

AUTOSAR Major version specification implemented by CDD_PWM Driver.

CDD_PWM_AR_RELEASE_MINOR_VERSION

AUTOSAR Minor version specification implemented by CDD_PWM Driver.

CDD_PWM_AR_RELEASE_REVISION_VERSION

AUTOSAR Patch version specification implemented by CDD_PWM Driver.

CDD_PWM_VENDOR_ID

Texas Instruments Vendor ID.

CDD_PWM_MODULE_ID

CDD PWM Driver Module ID.

CDD_PWM_INSTANCE_ID

CDD PWM Instance ID.

CDD_PWM_E_UNINIT

API service used without module initialization.

CDD_PWM_SID_INIT

Cdd_Pwm_Init() API Service ID.

CDD_PWM_SID_ENABLE_NOTIFICATION

Cdd_Pwm_EnableNotification() API Service ID.

CDD_PWM_SID_DISABLE_NOTIFICATION

Cdd_Pwm_DisableNotification() API Service ID.

CDD_PWM_SID_SET_INTEVTCOUNT

Cdd_Pwm_SetInterruptEventCount API Service ID.

CDD_PWM_SID_GET_VERSION_INFO

Cdd_Pwm_GetVersionInfo() API Service ID.

CDD_PWM_SID_DEINIT

Cdd_Pwm_DeInit() API Service ID.

CDD_PWM_SID_SET_DUTY_CYCLE

Cdd_Pwm_SetDutyCycle() API Service ID.

CDD_PWM_SID_SET_PERIOD

Cdd_Pwm_SetPeriod() API Service ID.

CDD_PWM_SID_SET_OUTPUT_TO_IDLE

Cdd_Pwm_SetOutputToIdle() API Service ID.

CDD_PWM_E_ALREADY_INITIALIZED

API Cdd_Pwm_Init service called while the PWM driver has already been initialized.

CDD_PWM_E_INVALID_ID

API service called with invalid parameter ID.

CDD_PWM_E_NOTIF_CAPABILITY

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

CDD_PWM_E_PARAM_POINTER

API service called with invalid pointer.

CDD_PWM_E_INVALID_VALUE

API service called when the event count is invalid/out-of-range.

CDD_PWM_E_INVALID_OUTPUT_CHANNEL

API service called with invalid parameter ID.

CDD_PWM_E_CHANNEL_CLASS

API service called for the instance whose channel class is not variable period.

CDD_PWM_E_NOTIF_ALREADY_ENABLED

API service called when the notification is already enabled.

CDD_PWM_E_INVALID_EDGENOTIFICATION

API service called when the channel configured for the notification is invalid.

CDD_PWM_E_BUSY

API service called when the edge notification type is not valid.

CDD_PWM_E_INVALID_DUTY_CYCLE

API service called with the invalid duty cycle value.

CDD_PWM_CFG_MAJOR_VERSION

CDD_PWM_CFG_MINOR_VERSION

CDD_PWM_CFG_PATCH_VERSION

CDD_PWM_PRE_COMPILE_VARIANT

CDD_PWM_CONFIG_PC

CDD_PWM_ADVANCED_MODE_API

CDD_PWM_INSTANCE_COUNT

CDD_PWM_COUNT

CDD_PWM_INTEVT_COUNT

CDD_PWM_DEV_ERROR_DETECT

CDD_PWM_CHANNEL_COUNT

CDD_PWM_SET_OUTPUT_TO_IDLE_API

CDD_PWM_SET_PERIOD_API

CDD_PWM_SET_DUTY_CYCLE_API

CDD_PWM_DEINIT_API

CDD_PWM_VERSION_INFO_API

CDD_PWM_NOTIFICATION_SUPPORTED

CddPwmConf_CddPwmHwUnitConfig_CddPwmHwUnitConfig_0

CddPwmConf_CddPwmHwUnitConfig_0_Channel_0

CddPwmConf_CddPwmHwUnitConfig_0_Channel_1

CddPwmConf_CddPwmHwUnitConfig_CddPwmHwUnitConfig_1

CddPwmConf_CddPwmHwUnitConfig_1_Channel_0

CddPwmConf_CddPwmHwUnitConfig_1_Channel_1

CDD_PWM1_INT_ENABLE

CDD_PWM1_ISR_CAT1_RTINT

CDD_PWM2_INT_ENABLE

CDD_PWM2_ISR_CAT1_RTINT

5.13.4. Functions

Return type

Function Name

Brief

void

Cdd_Pwm_Init(const Cdd_Pwm_ConfigType * CfgPtr)

Service to initialize Cdd Pwm driver.

void

Cdd_Pwm_GetVersionInfo(Std_VersionInfoType * VersionInfo)

service that returns the version information of the module

void

Cdd_Pwm_DeInit(void )

Service to deinitialize Cdd Pwm driver.

void

Cdd_Pwm_SetDutyCycle(Cdd_Pwm_ChannelType ChannelId, Cdd_Pwm_DutyCycleType DutyCycle)

Service to set the duty cycle.

void

Cdd_Pwm_SetPeriod(Cdd_Pwm_InstanceType InstanceId, Cdd_Pwm_PeriodType Period)

Service to set the period and duty cycle for a PWM channel.

void

Cdd_Pwm_SetOutputToIdle(Cdd_Pwm_ChannelType ChannelId)

Service to set the output to IDLE for a PWM channel.

void

Cdd_Pwm_SetInterruptEventCount(Cdd_Pwm_InstanceType InstanceId, uint16 EventCount)

Sets the EPWM interrupt event counts.

void

Cdd_Pwm_EnableNotification(Cdd_Pwm_ChannelType ChannelId, Cdd_Pwm_EdgeNotificationType EdgeNotification)

Service to enable the PWM signal edge notification according to notification parameter.

void

Cdd_Pwm_DisableNotification(Cdd_Pwm_ChannelType ChannelId)

Service to disable the PWM signal edge notification.

5.13.4.1. function Cdd_Pwm_Init

void Cdd_Pwm_Init(
    const Cdd_Pwm_ConfigType * CfgPtr
)

Brief: Service to initialize Cdd Pwm driver.

This service initializes all the PWM channels with the configured values.

Parameters:

  • CfgPtr Pointer to configuration set (Variant PC requires a NULL_PTR)

Returns:

  • None

Return: None

Postcondition: None

5.13.4.2. function Cdd_Pwm_GetVersionInfo

void Cdd_Pwm_GetVersionInfo(
    Std_VersionInfoType * VersionInfo
)

Brief: service that returns the version information of the module

This service returns the version information of the Pwm module

Parameters:

  • VersionInfo Pointer to where to store the version information of this module

Returns:

  • None

Return: None

Precondition: None

Postcondition: None

5.13.4.3. function Cdd_Pwm_DeInit

void Cdd_Pwm_DeInit(
    void 
)

Brief: Service to deinitialize Cdd Pwm driver.

This service de-initializes the PWM driver.

Returns:

  • None

Return: None

Precondition: None

Postcondition: None

5.13.4.4. function Cdd_Pwm_SetDutyCycle

void Cdd_Pwm_SetDutyCycle(
    Cdd_Pwm_ChannelType ChannelId,
    Cdd_Pwm_DutyCycleType DutyCycle
)

Brief: Service to set the duty cycle.

This service sets the duty cycle for the requested PWM Channel.

Parameters:

  • ChannelId Numeric ID of the requested PWM Channel.

  • DutyCycle Duty cycles for the requested PWM Channel.

Returns:

  • None

Return: None

Precondition: None

Postcondition: None

5.13.4.5. function Cdd_Pwm_SetPeriod

void Cdd_Pwm_SetPeriod(
    Cdd_Pwm_InstanceType InstanceId,
    Cdd_Pwm_PeriodType Period
)

Brief: Service to set the period and duty cycle for a PWM channel.

This service sets period and duty cycle for the requested PWM Channel.

Parameters:

  • InstanceId Numeric ID of the requested PWM instance

  • Period Period for the requested PWM instance

Returns:

  • None

Return: None

Precondition: None

Postcondition: None

5.13.4.6. function Cdd_Pwm_SetOutputToIdle

void Cdd_Pwm_SetOutputToIdle(
    Cdd_Pwm_ChannelType ChannelId
)

Brief: Service to set the output to IDLE for a PWM channel.

This service sets the output to IDLE for the requested PWM Channel.

Parameters:

  • ChannelId Numeric ID of the requested PWM Channel.

Returns:

  • None

Return: None

Precondition: None

Postcondition: None

5.13.4.7. function Cdd_Pwm_SetInterruptEventCount

void Cdd_Pwm_SetInterruptEventCount(
    Cdd_Pwm_InstanceType InstanceId,
    uint16 EventCount
)

Brief: Sets the EPWM interrupt event counts.

This function sets the interrupt event count that determines the number of events that have to occur before an interrupt is issued. Maximum value for EventCount is 15.

Parameters:

  • InstanceId Numeric ID of the requested PWM instance

  • EventCount Event count for interrupt scale

Returns:

  • None

Return: None

Precondition: None

Postcondition: None

5.13.4.8. function Cdd_Pwm_EnableNotification

void Cdd_Pwm_EnableNotification(
    Cdd_Pwm_ChannelType ChannelId,
    Cdd_Pwm_EdgeNotificationType EdgeNotification
)

Brief: Service to enable the PWM signal edge notification according to notification parameter.

This service enables the PWM signal edge notification according to notification parameter

Parameters:

  • ChannelId Numeric ID of the requested PWM Channel.

  • EdgeNotification Type of notification for edge detection.

Returns:

  • None

Return: None

Precondition: None

Postcondition: None

5.13.4.9. function Cdd_Pwm_DisableNotification

void Cdd_Pwm_DisableNotification(
    Cdd_Pwm_ChannelType ChannelId
)

Brief: Service to disable the PWM signal edge notification.

This service disables signal edge notification for the requested PWM Channels.

Parameters:

  • ChannelId Numeric ID of the requested PWM Channel.

Returns:

  • None

Return: None

Precondition: None

Postcondition: None