Microchip® Advanced Software Framework

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PWM - Pulse Width Modulation (>v4.0.0)

Pulse Width Modulation (PWM) Software Driver for modules above revision >v4.0.0.

This driver provides an API to get access to the main features of the PWM controller.

Modules

 

Data Structures

struct  pwm_compare_opt_t
 
struct  pwm_opt_t
 Input parameters when initializing a PWM channel. More...
 
struct  pwm_output_override_opt_t
 

Macros

#define AVR32_PWM_LINES_MSB   4
 Local Definition for the number of PWM Lines. More...
 
#define PWM_CKSEL_GCLK   1
 PWM Clock Input is Generic Clock. More...
 
#define PWM_CKSEL_MCK   0
 PWM Clock Input is Master Clock. More...
 
#define PWM_COMPARE_MODE_DOWN   1
 PWM Compare DOWN. More...
 
#define PWM_COMPARE_MODE_UP   0
 PWM Compare UP. More...
 
#define PWM_COMPARE_OFF   0
 PWM Compare OFF. More...
 
#define PWM_COMPARE_ON   1
 PWM Compare ON. More...
 
#define PWM_EVENT_LINE0   (1<<AVR32_PWM_EL0MR_CSEL0_OFFSET)
 
#define PWM_EVENT_LINE1   (1<<AVR32_PWM_EL0MR_CSEL1_OFFSET)
 
#define PWM_EVENT_LINE2   (1<<AVR32_PWM_EL0MR_CSEL2_OFFSET)
 
#define PWM_EVENT_LINE3   (1<<AVR32_PWM_EL0MR_CSEL3_OFFSET)
 
#define PWM_EVENT_LINE4   (1<<AVR32_PWM_EL0MR_CSEL4_OFFSET)
 
#define PWM_EVENT_LINE5   (1<<AVR32_PWM_EL0MR_CSEL5_OFFSET)
 
#define PWM_EVENT_LINE6   (1<<AVR32_PWM_EL0MR_CSEL6_OFFSET)
 
#define PWM_EVENT_LINE7   (1<<AVR32_PWM_EL0MR_CSEL7_OFFSET)
 
#define PWM_FAILURE   -1
 Value returned by function when it was unable to complete successfully for some unspecified reason. More...
 
#define PWM_FAULT_INPUT_ACTIVE_HIGH   1
 PWM Fault Input Active High State. More...
 
#define PWM_FAULT_INPUT_ACTIVE_LOW   0
 PWM Fault Input Active Low State. More...
 
#define PWM_FAULT_INPUT_FILTER_OFF   0
 PWM Fault Input Filtering Option OFF. More...
 
#define PWM_FAULT_INPUT_FILTER_ON   1
 PWM Fault Input Filtering Option ON. More...
 
#define PWM_FAULT_INPUT_NOT_USED   0
 PWM Fault Input Not Used. More...
 
#define PWM_FAULT_INPUT_USED   1
 PWM Fault Input Used. More...
 
#define PWM_FAULT_LINES   8
 PWM Number of Fault Lines. More...
 
#define PWM_FAULT_MODE_LEVEL   0
 PWM Fault Mode Level. More...
 
#define PWM_FAULT_MODE_TGL   1
 PWM Fault Mode Toggle. More...
 
#define PWM_FAULT_OUTPUT   4
 PWM Fault Output Lines: PWM0,1,2,3 => 4. More...
 
#define PWM_INVALID_ARGUMENT   1
 Value returned by function when the channel number is invalid. More...
 
#define PWM_INVALID_INPUT   1
 Value returned by function when the input parameters are out of range. More...
 
#define PWM_MODE_CENTER_ALIGNED   1
 Operate PWM channel in center aligned mode. More...
 
#define PWM_MODE_LEFT_ALIGNED   0
 Operate PWM channel in left aligned mode. More...
 
#define PWM_NO_WRITE_PROTECT_VIOLATION   0xFFFFFFFF
 PWM No Write To Protected Register Status. More...
 
#define PWM_OOV_CTRL_OFF   0
 PWM Output Override Control OFF. More...
 
#define PWM_OOV_CTRL_ON   1
 PWM Output Override Control ON. More...
 
#define PWM_OOV_LINES   4
 PWM Ouptut Override Number of Lines: PWM0,1,2,3 => 4. More...
 
#define PWM_OOV_VALUE_HIGH   1
 PWM Output Override Value High Level. More...
 
#define PWM_OOV_VALUE_LOW   0
 PWM Output Override Value Low Level. More...
 
#define PWM_OUTPUT_HIGH_WHEN_FAULT_DETECTION   1
 PWM Output High Level when fault detection. More...
 
#define PWM_OUTPUT_LOW_WHEN_FAULT_DETECTION   0
 PWM Output Low Level when fault detection. More...
 
#define PWM_POLARITY_HIGH   1
 PWM channel starts output high level. More...
 
#define PWM_POLARITY_LOW   0
 PWM channel starts output low level. More...
 
#define PWM_SUCCESS   0
 Value returned by function when it completed successfully. More...
 
#define PWM_SYNC_CHANNEL_OFF   1
 PWM Sync channel OFF. More...
 
#define PWM_SYNC_CHANNEL_ON   1
 PWM Sync channel ON. More...
 
#define PWM_SYNC_UPDATE_AUTO_WRITE_AUTO_UPDATE   2
 PWM Automatic Write And Automatic Update Period, Duty Cycle and Event Method. More...
 
#define PWM_SYNC_UPDATE_MANUAL_WRITE_AUTO_UPDATE   1
 PWM Manual Write And Automatic Update Period, Duty Cycle and Event Method. More...
 
#define PWM_SYNC_UPDATE_MANUAL_WRITE_MANUAL_UPDATE   0
 PWM Manual Write And Manual Update Period, Duty Cycle and Event Method. More...
 
#define PWM_UPDATE_DUTY   0
 PWM channel write in CUPDx updates duty cycle at the next period start event. More...
 
#define PWM_UPDATE_PERIOD   1
 PWM channel write in CUPDx updates period at the next period start event. More...
 
#define PWM_UPDLOCK_TRIGGER   1
 PWM Update Lock State. More...
 
#define PWM_WPKEY   0x50574D
 PWM Protection Key. More...
 

Functions

int pwm_channel_init (unsigned int channel_id, const avr32_pwm_channel_t *pwm_channel)
 Initialize a specific PWM channel. More...
 
void pwm_clr_fault_status (void)
 Return Fault Status. More...
 
int pwm_compare_disable (int line)
 Compare Match Disable. More...
 
int pwm_compare_enable (int line)
 Compare Match Enable. More...
 
int pwm_compare_event_disable (int line, int event_line)
 Compare Event Disable. More...
 
int pwm_compare_event_enable (int line, int event_line)
 Compare Event Enable. More...
 
int pwm_compare_match_reload_setup (int line, pwm_compare_opt_t *pwm_compare_t)
 Compare Match Reload Setup. More...
 
int pwm_compare_match_setup (int line, pwm_compare_opt_t *pwm_compare_t)
 Compare Match Setup. More...
 
int pwm_compare_reload_update_period_value (int line, pwm_compare_opt_t *pwm_compare_t)
 Compare Reload Update Period. More...
 
int pwm_compare_update_period_value (int line, pwm_compare_opt_t *pwm_compare_t)
 Fault Lines Enable function. More...
 
int pwm_fault_lines_enable (U8 line, U8 channel)
 Fault Lines Enable function. More...
 
int pwm_fault_lines_level_setup (U8 line, U8 channel_high, U8 channel_low)
 Fault Lines Level Setup Function. More...
 
int pwm_fault_lines_polarity_setup (U8 line, U8 polarity, U8 mode, U8 filter)
 Fault Lines Level Polarity Function. More...
 
int pwm_get_fault_status (void)
 Get Fault Status. More...
 
unsigned int pwm_get_update_period_counter_value (void)
 Return Current Counter of Update Period Value. More...
 
int pwm_init (pwm_opt_t *opt)
 This function initialize the PWM controller (mode register) and disable the interrupt. More...
 
int pwm_interrupt_update_channel (unsigned int channel_id, const avr32_pwm_channel_t *pwm_channel)
 Update channel register CPRDx or CDTYx with the interrupt method. This function uses the CUPDx register as a double buffer for the period or the duty cycle. Only the first 20 bits of cupd are significant. More...
 
int pwm_output_override_setup (pwm_output_override_opt_t *opt)
 Output Override Configuration. This function uses the OS and OOV registers. More...
 
int pwm_output_override_write (pwm_output_override_opt_t *opt)
 Output Override Set. This function uses the OS and OOV registers. More...
 
int pwm_start_channels (unsigned long channels_bitmask)
 Start PWM channels. More...
 
int pwm_stop_channels (unsigned long channels_bitmask)
 Stop PWM channels. More...
 
int pwm_synchronous_prepare_update (unsigned int channel_id, const avr32_pwm_channel_t *pwm_channel)
 Prepare a Synchronous Channel, User should call this function for all the synchronous channel. More...
 
int pwm_update_auto_write_auto_update_check_eot (void)
 Synchronous Update with Manual Write and Auto Update Method. More...
 
int pwm_update_auto_write_auto_update_check_ready (void)
 Synchronous Update with Manual Write and Auto Update Method. More...
 
int pwm_update_channel (unsigned int channel_id, const avr32_pwm_channel_t *pwm_channel)
 Update channel register CPRDx or CDTYx with the polling method. This function uses the CUPDx register as a double buffer for the period or the duty cycle. Only the first 20 bits of cupd are significant. More...
 
int pwm_update_manual_write_auto_update (void)
 Synchronous Update with Manual Write and Auto Update Method. More...
 
int pwm_update_manual_write_manual_update (void)
 Synchronous Update with Manual Write and Manual Update Method. More...
 
int pwm_update_period_value (unsigned int value)
 Define Update Period Value For Update Of Synchronous Channel. More...
 
int pwm_update_period_value_update (unsigned int value)
 Define Update Period Value For Update Of Synchronous Channel after a first init. More...
 
int pwm_write_protect_hw_lock (int group)
 Hardware Write Protect Lock Function. This function uses the WPMR register. More...
 
U32 pwm_write_protect_status (void)
 Write Protect Status Function. This function uses the WPSR register. More...
 
int pwm_write_protect_sw_lock (int group)
 Software Write Protect Lock Function. This function uses the WPMR register. More...
 
int pwm_write_protect_sw_unlock (int group)
 Software Write Protect Unlock Function. This function uses the WPMR register. More...
 

#define AVR32_PWM_LINES_MSB   4
#define PWM_CKSEL_GCLK   1

PWM Clock Input is Generic Clock.

Referenced by main().

#define PWM_CKSEL_MCK   0

PWM Clock Input is Master Clock.

#define PWM_COMPARE_MODE_DOWN   1

PWM Compare DOWN.

#define PWM_COMPARE_MODE_UP   0

PWM Compare UP.

#define PWM_COMPARE_OFF   0

PWM Compare OFF.

#define PWM_COMPARE_ON   1

PWM Compare ON.

#define PWM_EVENT_LINE0   (1<<AVR32_PWM_EL0MR_CSEL0_OFFSET)
#define PWM_EVENT_LINE1   (1<<AVR32_PWM_EL0MR_CSEL1_OFFSET)
#define PWM_EVENT_LINE2   (1<<AVR32_PWM_EL0MR_CSEL2_OFFSET)
#define PWM_EVENT_LINE3   (1<<AVR32_PWM_EL0MR_CSEL3_OFFSET)
#define PWM_EVENT_LINE4   (1<<AVR32_PWM_EL0MR_CSEL4_OFFSET)
#define PWM_EVENT_LINE5   (1<<AVR32_PWM_EL0MR_CSEL5_OFFSET)
#define PWM_EVENT_LINE6   (1<<AVR32_PWM_EL0MR_CSEL6_OFFSET)
#define PWM_EVENT_LINE7   (1<<AVR32_PWM_EL0MR_CSEL7_OFFSET)
#define PWM_FAILURE   -1

Value returned by function when it was unable to complete successfully for some unspecified reason.

Referenced by pwm_write_protect_hw_lock(), pwm_write_protect_sw_lock(), and pwm_write_protect_sw_unlock().

#define PWM_FAULT_INPUT_ACTIVE_HIGH   1

PWM Fault Input Active High State.

#define PWM_FAULT_INPUT_ACTIVE_LOW   0

PWM Fault Input Active Low State.

#define PWM_FAULT_INPUT_FILTER_OFF   0

PWM Fault Input Filtering Option OFF.

#define PWM_FAULT_INPUT_FILTER_ON   1

PWM Fault Input Filtering Option ON.

#define PWM_FAULT_INPUT_NOT_USED   0

PWM Fault Input Not Used.

#define PWM_FAULT_INPUT_USED   1

PWM Fault Input Used.

#define PWM_FAULT_LINES   8

PWM Number of Fault Lines.

#define PWM_FAULT_MODE_LEVEL   0

PWM Fault Mode Level.

#define PWM_FAULT_MODE_TGL   1

PWM Fault Mode Toggle.

#define PWM_FAULT_OUTPUT   4

PWM Fault Output Lines: PWM0,1,2,3 => 4.

#define PWM_INVALID_ARGUMENT   1

Value returned by function when the channel number is invalid.

Referenced by pwm_channel_init().

#define PWM_MODE_CENTER_ALIGNED   1

Operate PWM channel in center aligned mode.

#define PWM_MODE_LEFT_ALIGNED   0

Operate PWM channel in left aligned mode.

Referenced by main(), and tft_bl_init().

#define PWM_NO_WRITE_PROTECT_VIOLATION   0xFFFFFFFF

PWM No Write To Protected Register Status.

Referenced by pwm_write_protect_status().

#define PWM_OOV_CTRL_OFF   0

PWM Output Override Control OFF.

#define PWM_OOV_CTRL_ON   1

PWM Output Override Control ON.

#define PWM_OOV_LINES   4

PWM Ouptut Override Number of Lines: PWM0,1,2,3 => 4.

Referenced by pwm_init(), pwm_output_override_setup(), and pwm_output_override_write().

#define PWM_OOV_VALUE_HIGH   1

PWM Output Override Value High Level.

#define PWM_OOV_VALUE_LOW   0

PWM Output Override Value Low Level.

#define PWM_OUTPUT_HIGH_WHEN_FAULT_DETECTION   1

PWM Output High Level when fault detection.

#define PWM_OUTPUT_LOW_WHEN_FAULT_DETECTION   0

PWM Output Low Level when fault detection.

#define PWM_POLARITY_HIGH   1

PWM channel starts output high level.

Referenced by tft_bl_init().

#define PWM_POLARITY_LOW   0

PWM channel starts output low level.

Referenced by main().

#define PWM_SYNC_CHANNEL_OFF   1

PWM Sync channel OFF.

#define PWM_SYNC_CHANNEL_ON   1

PWM Sync channel ON.

#define PWM_SYNC_UPDATE_AUTO_WRITE_AUTO_UPDATE   2

PWM Automatic Write And Automatic Update Period, Duty Cycle and Event Method.

Referenced by pwm_init().

#define PWM_SYNC_UPDATE_MANUAL_WRITE_AUTO_UPDATE   1

PWM Manual Write And Automatic Update Period, Duty Cycle and Event Method.

#define PWM_SYNC_UPDATE_MANUAL_WRITE_MANUAL_UPDATE   0

PWM Manual Write And Manual Update Period, Duty Cycle and Event Method.

Referenced by main().

#define PWM_UPDATE_DUTY   0

PWM channel write in CUPDx updates duty cycle at the next period start event.

Referenced by tft_bl_init().

#define PWM_UPDATE_PERIOD   1

PWM channel write in CUPDx updates period at the next period start event.

#define PWM_UPDLOCK_TRIGGER   1

PWM Update Lock State.

#define PWM_WPKEY   0x50574D

PWM Protection Key.

int pwm_channel_init ( unsigned int  channel_id,
const avr32_pwm_channel_t *  pwm_channel 
)

Initialize a specific PWM channel.

Parameters
channel_idThe channel identifier mask
*pwm_channelPointer to PWM channel struct avr32_pwm_channel_t
Returns
PWM_SUCCESS, PWM_INVALID_INPUT or PWM_INVALID_ARGUMENT

References AVR32_PWM_LINES_MSB, PWM_INVALID_ARGUMENT, PWM_INVALID_INPUT, and PWM_SUCCESS.

Referenced by main(), and tft_bl_init().

void pwm_clr_fault_status ( void  )

Return Fault Status.

int pwm_compare_disable ( int  line)

Compare Match Disable.

Parameters
lineCompare Line to be used
Returns
PWM_SUCCESS or PWM_INVALID_INPUT
int pwm_compare_enable ( int  line)

Compare Match Enable.

Parameters
lineCompare Line to be used
Returns
PWM_SUCCESS or PWM_INVALID_INPUT
int pwm_compare_event_disable ( int  line,
int  event_line 
)

Compare Event Disable.

Parameters
lineCompare Line to be used
event_lineEvent Line to be used
Returns
PWM_SUCCESS or PWM_INVALID_INPUT

References PWM_INVALID_INPUT, and PWM_SUCCESS.

int pwm_compare_event_enable ( int  line,
int  event_line 
)

Compare Event Enable.

Parameters
lineCompare Line to be used
event_lineEvent Line to be used
Returns
PWM_SUCCESS or PWM_INVALID_INPUT

References PWM_INVALID_INPUT, and PWM_SUCCESS.

int pwm_compare_match_reload_setup ( int  line,
pwm_compare_opt_t pwm_compare_t 
)
int pwm_compare_match_setup ( int  line,
pwm_compare_opt_t pwm_compare_t 
)
int pwm_compare_reload_update_period_value ( int  line,
pwm_compare_opt_t pwm_compare_t 
)

Compare Reload Update Period.

Parameters
lineCompare Line to be used
pwm_compare_tParameter
Returns
PWM_SUCCESS or PWM_INVALID_INPUT
int pwm_compare_update_period_value ( int  line,
pwm_compare_opt_t pwm_compare_t 
)

Fault Lines Enable function.

Parameters
lineCompare Line to be used
pwm_compare_tParameter
Returns
PWM_SUCCESS or PWM_INVALID_INPUT
int pwm_fault_lines_enable ( U8  line,
U8  channel 
)

Fault Lines Enable function.

Parameters
lineLine
channelChannel
Returns
PWM_SUCCESS or PWM_INVALID_INPUT

References PWM_INVALID_INPUT, and PWM_SUCCESS.

int pwm_fault_lines_level_setup ( U8  line,
U8  channel_high,
U8  channel_low 
)

Fault Lines Level Setup Function.

Parameters
lineLine
channel_highChannel High
channel_lowChannel Low
Returns
PWM_SUCCESS or PWM_INVALID_INPUT

References PWM_INVALID_INPUT, and PWM_SUCCESS.

int pwm_fault_lines_polarity_setup ( U8  line,
U8  polarity,
U8  mode,
U8  filter 
)

Fault Lines Level Polarity Function.

Parameters
lineLine
polarityPolarity
modeMode
filterFilter
Returns
PWM_SUCCESS or PWM_INVALID_INPUT

References PWM_INVALID_INPUT, and PWM_SUCCESS.

int pwm_get_fault_status ( void  )

Get Fault Status.

Returns
Value of FSR register
unsigned int pwm_get_update_period_counter_value ( void  )

Return Current Counter of Update Period Value.

Returns
Value of Counter
int pwm_interrupt_update_channel ( unsigned int  channel_id,
const avr32_pwm_channel_t *  pwm_channel 
)

Update channel register CPRDx or CDTYx with the interrupt method. This function uses the CUPDx register as a double buffer for the period or the duty cycle. Only the first 20 bits of cupd are significant.

Parameters
channel_idThe channel identifier (0 to max channel-1)
*pwm_channelPointer to PWM channel struct avr32_pwm_channel_t
Returns
PWM_SUCCESS or PWM_INVALID_INPUT

References AVR32_PWM_LINES_MSB, PWM_INVALID_INPUT, and PWM_SUCCESS.

int pwm_output_override_setup ( pwm_output_override_opt_t opt)

Output Override Configuration. This function uses the OS and OOV registers.

Parameters
optOutput Override Parameter
Returns
PWM_SUCCESS or PWM_INVALID_INPUT

References i, pwm_output_override_opt_t::oov, PWM_INVALID_INPUT, PWM_OOV_LINES, and PWM_SUCCESS.

int pwm_output_override_write ( pwm_output_override_opt_t opt)

Output Override Set. This function uses the OS and OOV registers.

Parameters
optOutput Override Parameter
Returns
PWM_SUCCESS or PWM_INVALID_INPUT

References i, pwm_output_override_opt_t::os, PWM_INVALID_INPUT, PWM_OOV_LINES, PWM_SUCCESS, and tmp.

int pwm_start_channels ( unsigned long  channels_bitmask)

Start PWM channels.

Parameters
channels_bitmaskA bit-mask with set bits indicating channels to start.
Returns
PWM_SUCCESS or PWM_INVALID_INPUT

References AVR32_PWM_LINES_MSB, PWM_INVALID_INPUT, and PWM_SUCCESS.

Referenced by main(), and tft_bl_init().

int pwm_stop_channels ( unsigned long  channels_bitmask)

Stop PWM channels.

Parameters
channels_bitmaskA bit-mask with set bits indicating channels to stop.
Returns
PWM_SUCCESS or PWM_INVALID_INPUT

References AVR32_PWM_LINES_MSB, PWM_INVALID_INPUT, and PWM_SUCCESS.

int pwm_synchronous_prepare_update ( unsigned int  channel_id,
const avr32_pwm_channel_t *  pwm_channel 
)

Prepare a Synchronous Channel, User should call this function for all the synchronous channel.

Returns
PWM_SUCCESS or PWM_INVALID_INPUT

References AVR32_PWM_LINES_MSB, PWM_INVALID_INPUT, and PWM_SUCCESS.

int pwm_update_auto_write_auto_update_check_eot ( void  )

Synchronous Update with Manual Write and Auto Update Method.

Returns
PWM_SUCCESS or PWM_INVALID_INPUT

References PWM_SUCCESS.

int pwm_update_auto_write_auto_update_check_ready ( void  )

Synchronous Update with Manual Write and Auto Update Method.

Returns
PWM_SUCCESS or PWM_INVALID_INPUT

References PWM_SUCCESS.

int pwm_update_channel ( unsigned int  channel_id,
const avr32_pwm_channel_t *  pwm_channel 
)

Update channel register CPRDx or CDTYx with the polling method. This function uses the CUPDx register as a double buffer for the period or the duty cycle. Only the first 20 bits of cupd are significant.

Parameters
channel_idThe channel identifier (0 to max channel-1)
*pwm_channelPointer to PWM channel struct avr32_pwm_channel_t
Returns
PWM_SUCCESS or PWM_INVALID_INPUT

References AVR32_PWM_LINES_MSB, PWM_INVALID_INPUT, and PWM_SUCCESS.

int pwm_update_manual_write_auto_update ( void  )

Synchronous Update with Manual Write and Auto Update Method.

Returns
PWM_SUCCESS or PWM_INVALID_INPUT

References PWM_SUCCESS.

int pwm_update_manual_write_manual_update ( void  )

Synchronous Update with Manual Write and Manual Update Method.

Returns
PWM_SUCCESS or PWM_INVALID_INPUT

References PWM_SUCCESS.

int pwm_update_period_value ( unsigned int  value)

Define Update Period Value For Update Of Synchronous Channel.

Parameters
valueUpdate Period Value
Returns
PWM_SUCCESS or PWM_INVALID_INPUT

References PWM_SUCCESS.

Referenced by main().

int pwm_update_period_value_update ( unsigned int  value)

Define Update Period Value For Update Of Synchronous Channel after a first init.

Parameters
valueUpdate Period Value
Returns
PWM_SUCCESS or PWM_INVALID_INPUT
int pwm_write_protect_hw_lock ( int  group)

Hardware Write Protect Lock Function. This function uses the WPMR register.

Parameters
group
Returns
PWM_SUCCESS or PWM_INVALID_INPUT

References PWM_FAILURE, and PWM_SUCCESS.

U32 pwm_write_protect_status ( void  )

Write Protect Status Function. This function uses the WPSR register.

Returns
PWM_NO_WRITE_PROTECT_VIOLATION or Write Protection Violation Source

References PWM_NO_WRITE_PROTECT_VIOLATION, and status.

int pwm_write_protect_sw_lock ( int  group)

Software Write Protect Lock Function. This function uses the WPMR register.

Parameters
group
Returns
PWM_SUCCESS or PWM_INVALID_INPUT

References PWM_FAILURE, and PWM_SUCCESS.

int pwm_write_protect_sw_unlock ( int  group)

Software Write Protect Unlock Function. This function uses the WPMR register.

Parameters
group
Returns
PWM_SUCCESS or PWM_INVALID_INPUT

References PWM_FAILURE, and PWM_SUCCESS.

Referenced by pwm_init().