HPM SDK
HPMicro Software Development Kit
PWM driver APIs

PWM driver APIs. More...

Data Structures

struct  pwm_cmp_config
 pwm compare config More...
 
struct  pwm_output_channel
 pwm output channel config More...
 
struct  pwm_fault_source_config
 pwm fault source config More...
 
struct  pwm_config
 pwm config data More...
 
struct  pwm_pair_config
 pair pwm config More...
 

Macros

#define PWM_UNLOCK_KEY   (0xB0382607UL)
 
#define PWM_IRQ_FAULT   PWM_IRQEN_FAULTIRQE_MASK
 
#define PWM_IRQ_EX_RELOAD   PWM_IRQEN_XRLDIRQE_MASK
 
#define PWM_IRQ_HALF_RELOAD   PWM_IRQEN_HALFRLDIRQE_MASK
 
#define PWM_IRQ_RELOAD   PWM_IRQEN_RLDIRQE_MASK
 
#define PWM_IRQ_CMP(x)   PWM_IRQEN_CMPIRQEX_SET((1 << x))
 
#define PWM_FORCE_OUTPUT(pwm_index, force_output)    (force_output << (pwm_index << 1))
 
#define PWM_DUTY_CYCLE_FP_MAX   ((1U << 24) - 1)
 

Typedefs

typedef enum pwm_counter_type pwm_counter_type_t
 pwm trigger mode More...
 
typedef enum pwm_cmp_mode pwm_cmp_mode_t
 pwm cmp mode More...
 
typedef enum pwm_register_update pwm_shadow_register_update_trigger_t
 update time of the shadow register More...
 
typedef enum pwm_fault_mode pwm_fault_mode_t
 configure the state of channel 0-7 outputs when the forced output is in effect More...
 
typedef enum pwm_fault_recovery_trigger pwm_fault_recovery_trigger_t
 select when to recover PWM output after fault More...
 
typedef enum pwm_fault_source pwm_fault_source_t
 fault input signal More...
 
typedef enum pwm_force_source pwm_force_source_t
 Select sources for force output. More...
 
typedef enum pwm_force_cmd_timing pwm_force_cmd_timing_t
 select when the FRCMD shadow register will be loaded to its work register More...
 
typedef enum pwm_output_type pwm_output_type_t
 pwm output type More...
 
typedef struct pwm_cmp_config pwm_cmp_config_t
 pwm compare config More...
 
typedef struct pwm_output_channel pwm_output_channel_t
 pwm output channel config More...
 
typedef struct pwm_fault_source_config pwm_fault_source_config_t
 pwm fault source config More...
 
typedef struct pwm_config pwm_config_t
 pwm config data More...
 
typedef struct pwm_pair_config pwm_pair_config_t
 pair pwm config More...
 

Enumerations

enum  pwm_counter_type { pwm_counter_type_capture_rising_edge , pwm_counter_type_capture_falling_edge }
 pwm trigger mode More...
 
enum  pwm_cmp_mode { pwm_cmp_mode_output_compare = 0 , pwm_cmp_mode_input_capture = 1 }
 pwm cmp mode More...
 
enum  pwm_register_update { pwm_shadow_register_update_on_shlk = 0 , pwm_shadow_register_update_on_modify = 1 , pwm_shadow_register_update_on_hw_event = 2 , pwm_shadow_register_update_on_sh_synci = 3 }
 update time of the shadow register More...
 
enum  pwm_fault_mode { pwm_fault_mode_force_output_0 = 0 , pwm_fault_mode_force_output_1 = 1 , pwm_fault_mode_force_output_highz = 2 }
 configure the state of channel 0-7 outputs when the forced output is in effect More...
 
enum  pwm_fault_recovery_trigger { pwm_fault_recovery_immediately = 0 , pwm_fault_recovery_on_reload = 1 , pwm_fault_recovery_on_hw_event = 2 , pwm_fault_recovery_on_fault_clear = 3 }
 select when to recover PWM output after fault More...
 
enum  pwm_fault_source {
  pwm_fault_source_internal_0 = PWM_GCR_FAULTI0EN_MASK , pwm_fault_source_internal_1 = PWM_GCR_FAULTI1EN_MASK , pwm_fault_source_internal_2 = PWM_GCR_FAULTI2EN_MASK , pwm_fault_source_internal_3 = PWM_GCR_FAULTI3EN_MASK ,
  pwm_fault_source_external_0 = PWM_GCR_FAULTE0EN_MASK , pwm_fault_source_external_1 = PWM_GCR_FAULTE1EN_MASK
}
 fault input signal More...
 
enum  pwm_force_source { pwm_force_source_force_input = 0 , pwm_force_source_software = 1 }
 Select sources for force output. More...
 
enum  pwm_force_cmd_timing { pwm_force_immediately = 0 , pwm_force_at_reload = 1 , pwm_force_at_synci = 2 , pwm_force_none = 3 }
 select when the FRCMD shadow register will be loaded to its work register More...
 
enum  pwm_output_type { pwm_output_0 = 0 , pwm_output_1 = 1 , pwm_output_high_z = 2 , pwm_output_no_force = 3 }
 pwm output type More...
 

Functions

static void pwm_deinit (PWM_Type *pwm_x)
 pwm deinitialize function More...
 
static void pwm_issue_shadow_register_lock_event (PWM_Type *pwm_x)
 issue all shawdow register More...
 
static void pwm_shadow_register_lock (PWM_Type *pwm_x)
 lock all shawdow register More...
 
static void pwm_shadow_register_unlock (PWM_Type *pwm_x)
 unlock all shadow register More...
 
static void pwm_set_start_count (PWM_Type *pwm_x, uint8_t ex_start, uint32_t start)
 set counter start value and extended start value More...
 
static void pwm_set_reload (PWM_Type *pwm_x, uint8_t ex_reload, uint32_t reload)
 set the reload value More...
 
static void pwm_clear_status (PWM_Type *pwm_x, uint32_t mask)
 clear pwm status register More...
 
static uint32_t pwm_get_status (PWM_Type *pwm_x)
 get pwm status register More...
 
static void pwm_disable_irq (PWM_Type *pwm_x, uint32_t mask)
 disable pwm irq More...
 
static void pwm_enable_irq (PWM_Type *pwm_x, uint32_t mask)
 enable pwm irq More...
 
static void pwm_disable_dma_request (PWM_Type *pwm_x, uint32_t mask)
 disable pwm dma request More...
 
static void pwm_enable_dma_request (PWM_Type *pwm_x, uint32_t mask)
 enable pwm dma request More...
 
static void pwm_set_force_cmd_shadow_register_hwevent (PWM_Type *pwm_x, uint8_t target_cmp_index)
 set target cmp as hardware event to trigger force cmd output More...
 
static void pwm_set_load_counter_shadow_register_trigger (PWM_Type *pwm_x, pwm_shadow_register_update_trigger_t trigger, uint8_t target_cmp_index)
 set shadow register control register More...
 
static void pwm_load_cmp_shadow_on_capture (PWM_Type *pwm_x, uint8_t index, bool is_falling_edge)
 Configure input capture cmp to trigger shadow register updates. More...
 
static void pwm_cmp_disable_half_clock (PWM_Type *pwm_x, uint8_t index)
 disable pwn cmp half clock More...
 
static void pwm_cmp_enable_half_clock (PWM_Type *pwm_x, uint8_t index)
 enable pwm cmp half clock More...
 
static void pwm_cmp_update_jitter_value (PWM_Type *pwm_x, uint8_t index, uint8_t jitter)
 update pwm cmp jitter counter compare value More...
 
static void pwm_cmp_update_cmp_value (PWM_Type *pwm_x, uint8_t index, uint32_t cmp, uint16_t ex_cmp)
 update pwm cmp value More...
 
static void pwm_cmp_force_value (PWM_Type *pwm_x, uint8_t index, uint32_t cmp)
 Forced update of pwm cmp register value, cmp content guaranteed accurate by user. More...
 
static void pwm_config_cmp (PWM_Type *pwm_x, uint8_t index, pwm_cmp_config_t *config)
 config pwm cmp More...
 
static void pwm_config_output_channel (PWM_Type *pwm_x, uint8_t index, pwm_output_channel_t *config)
 config pwm output channel More...
 
static void pwm_config_fault_source (PWM_Type *pwm_x, pwm_fault_source_config_t *config)
 config pwm fault source More...
 
static void pwm_clear_fault (PWM_Type *pwm_x)
 clear pwm fault status More...
 
static void pwm_stop_counter (PWM_Type *pwm_x)
 stop the pwm timer counter More...
 
static void pwm_start_counter (PWM_Type *pwm_x)
 start pwm timer counter More...
 
static void pwm_enable_sw_force (PWM_Type *pwm_x)
 enable software force More...
 
static void pwm_disable_sw_force (PWM_Type *pwm_x)
 disable software force , force will take effect More...
 
static void pwm_enable_reload_at_synci (PWM_Type *pwm_x)
 enable pwm reload value by synci More...
 
static void pwm_disable_output (PWM_Type *pwm_x, uint8_t index)
 disable pwm output More...
 
static void pwm_enable_output (PWM_Type *pwm_x, uint8_t index)
 enable pwm output More...
 
static void pwm_set_force_output (PWM_Type *pwm_x, uint32_t output_mask)
 config pwm force output level per output channel More...
 
static void pwm_config_force_polarity (PWM_Type *pwm_x, bool polarity)
 config pwm force polarity More...
 
static void pwm_config_force_cmd_timing (PWM_Type *pwm_x, pwm_force_cmd_timing_t timing)
 config the force effective time More...
 
static void pwm_enable_pwm_sw_force_output (PWM_Type *pwm_x, uint8_t index)
 enable pwm sw force output More...
 
static void pwm_disable_pwm_sw_force_output (PWM_Type *pwm_x, uint8_t index)
 disable pwm sw force output More...
 
static void pwm_config_pwm (PWM_Type *pwm_x, uint8_t index, pwm_config_t *config, bool enable_pair_mode)
 config PWM channel configure registe More...
 
static uint32_t pwm_get_reload_val (PWM_Type *pwm_x)
 getting the counter reload value for a pwm timer More...
 
static uint32_t pwm_get_ex_reload_val (PWM_Type *pwm_x)
 getting the extended counter reload value for a pwm timer More...
 
static uint32_t pwm_get_counter_val (PWM_Type *pwm_x)
 getting the value of the pwm counter More...
 
static uint32_t pwm_get_ex_counter_val (PWM_Type *pwm_x)
 getting the value of the pwm extended counter More...
 
hpm_stat_t pwm_load_cmp_shadow_on_match (PWM_Type *pwm_x, uint8_t index, pwm_cmp_config_t *config)
 pwm load cmp shadow on match More...
 
void pwm_get_captured_count (PWM_Type *pwm_x, uint32_t *buf, pwm_counter_type_t counter, uint8_t start_index, uint8_t num)
 pwm get captured count More...
 
void pwm_get_default_cmp_config (PWM_Type *pwm_x, pwm_cmp_config_t *config)
 get default cmp config More...
 
void pwm_get_default_output_channel_config (PWM_Type *pwm_x, pwm_output_channel_t *config)
 get default output channel config More...
 
void pwm_get_default_pwm_config (PWM_Type *pwm_x, pwm_config_t *config)
 get default pwm config More...
 
void pwm_get_default_pwm_pair_config (PWM_Type *pwm_x, pwm_pair_config_t *config)
 get default pwm pair config More...
 
hpm_stat_t pwm_setup_waveform (PWM_Type *pwm_x, uint8_t pwm_index, pwm_config_t *pwm_config, uint8_t cmp_start_index, pwm_cmp_config_t *cmp, uint8_t cmp_num)
 setup waveform More...
 
hpm_stat_t pwm_setup_waveform_in_pair (PWM_Type *pwm_x, uint8_t pwm_index, pwm_pair_config_t *pwm_pair_config, uint8_t cmp_start_index, pwm_cmp_config_t *cmp, uint8_t cmp_num)
 setup pwm waveform in pair More...
 
hpm_stat_t pwm_update_raw_cmp_edge_aligned (PWM_Type *pwm_x, uint8_t cmp_index, uint32_t target_cmp)
 update raw compare value for edge aligned waveform More...
 
hpm_stat_t pwm_update_raw_cmp_central_aligned (PWM_Type *pwm_x, uint8_t cmp1_index, uint8_t cmp2_index, uint32_t target_cmp1, uint32_t target_cmp2)
 update raw compare value for central aligned waveform More...
 

Detailed Description

PWM driver APIs.

Macro Definition Documentation

◆ PWM_DUTY_CYCLE_FP_MAX

#define PWM_DUTY_CYCLE_FP_MAX   ((1U << 24) - 1)

◆ PWM_FORCE_OUTPUT

#define PWM_FORCE_OUTPUT (   pwm_index,
  force_output 
)     (force_output << (pwm_index << 1))

◆ PWM_IRQ_CMP

#define PWM_IRQ_CMP (   x)    PWM_IRQEN_CMPIRQEX_SET((1 << x))

◆ PWM_IRQ_EX_RELOAD

#define PWM_IRQ_EX_RELOAD   PWM_IRQEN_XRLDIRQE_MASK

◆ PWM_IRQ_FAULT

#define PWM_IRQ_FAULT   PWM_IRQEN_FAULTIRQE_MASK

◆ PWM_IRQ_HALF_RELOAD

#define PWM_IRQ_HALF_RELOAD   PWM_IRQEN_HALFRLDIRQE_MASK

◆ PWM_IRQ_RELOAD

#define PWM_IRQ_RELOAD   PWM_IRQEN_RLDIRQE_MASK

◆ PWM_UNLOCK_KEY

#define PWM_UNLOCK_KEY   (0xB0382607UL)

Typedef Documentation

◆ pwm_cmp_config_t

#include <drivers/inc/hpm_pwm_drv.h>

pwm compare config

◆ pwm_cmp_mode_t

#include <drivers/inc/hpm_pwm_drv.h>

pwm cmp mode

◆ pwm_config_t

typedef struct pwm_config pwm_config_t

#include <drivers/inc/hpm_pwm_drv.h>

pwm config data

◆ pwm_counter_type_t

#include <drivers/inc/hpm_pwm_drv.h>

pwm trigger mode

◆ pwm_fault_mode_t

#include <drivers/inc/hpm_pwm_drv.h>

configure the state of channel 0-7 outputs when the forced output is in effect

◆ pwm_fault_recovery_trigger_t

#include <drivers/inc/hpm_pwm_drv.h>

select when to recover PWM output after fault

◆ pwm_fault_source_config_t

#include <drivers/inc/hpm_pwm_drv.h>

pwm fault source config

◆ pwm_fault_source_t

#include <drivers/inc/hpm_pwm_drv.h>

fault input signal

◆ pwm_force_cmd_timing_t

#include <drivers/inc/hpm_pwm_drv.h>

select when the FRCMD shadow register will be loaded to its work register

◆ pwm_force_source_t

#include <drivers/inc/hpm_pwm_drv.h>

Select sources for force output.

◆ pwm_output_channel_t

#include <drivers/inc/hpm_pwm_drv.h>

pwm output channel config

◆ pwm_output_type_t

#include <drivers/inc/hpm_pwm_drv.h>

pwm output type

◆ pwm_pair_config_t

#include <drivers/inc/hpm_pwm_drv.h>

pair pwm config

◆ pwm_shadow_register_update_trigger_t

#include <drivers/inc/hpm_pwm_drv.h>

update time of the shadow register

Enumeration Type Documentation

◆ pwm_cmp_mode

#include <drivers/inc/hpm_pwm_drv.h>

pwm cmp mode

Enumerator
pwm_cmp_mode_output_compare 

output compare

pwm_cmp_mode_input_capture 

input compare

◆ pwm_counter_type

#include <drivers/inc/hpm_pwm_drv.h>

pwm trigger mode

Enumerator
pwm_counter_type_capture_rising_edge 

rising edge trigger

pwm_counter_type_capture_falling_edge 

falling edge trigger

◆ pwm_fault_mode

#include <drivers/inc/hpm_pwm_drv.h>

configure the state of channel 0-7 outputs when the forced output is in effect

Enumerator
pwm_fault_mode_force_output_0 

fault forced output logic 0

pwm_fault_mode_force_output_1 

fault forced output logic 1

pwm_fault_mode_force_output_highz 

turn off output, pin becomes high resistance

◆ pwm_fault_recovery_trigger

#include <drivers/inc/hpm_pwm_drv.h>

select when to recover PWM output after fault

Enumerator
pwm_fault_recovery_immediately 

immediately

pwm_fault_recovery_on_reload 

after pwm timer counter reload time

pwm_fault_recovery_on_hw_event 

after hardware event assert

pwm_fault_recovery_on_fault_clear 

after software write faultclr bit in GCR register

◆ pwm_fault_source

#include <drivers/inc/hpm_pwm_drv.h>

fault input signal

Enumerator
pwm_fault_source_internal_0 

FAULTI0

pwm_fault_source_internal_1 

FAULTI1

pwm_fault_source_internal_2 

FAULTI2

pwm_fault_source_internal_3 

FAULTI3

pwm_fault_source_external_0 

EXFAULTI0

pwm_fault_source_external_1 

EXFAULTI1

◆ pwm_force_cmd_timing

#include <drivers/inc/hpm_pwm_drv.h>

select when the FRCMD shadow register will be loaded to its work register

Enumerator
pwm_force_immediately 

after software set shlk bit of shlk register

pwm_force_at_reload 

immediately after the register being modified

pwm_force_at_synci 

after hardware event assert

pwm_force_none 

after SHSYNCI assert

◆ pwm_force_source

#include <drivers/inc/hpm_pwm_drv.h>

Select sources for force output.

Enumerator
pwm_force_source_force_input 

force output is enabled when FRCI assert

pwm_force_source_software 

force output is enabled by software write swfrc to 1

◆ pwm_output_type

#include <drivers/inc/hpm_pwm_drv.h>

pwm output type

Enumerator
pwm_output_0 

output 0

pwm_output_1 

output 1

pwm_output_high_z 

output

pwm_output_no_force 

◆ pwm_register_update

#include <drivers/inc/hpm_pwm_drv.h>

update time of the shadow register

Enumerator
pwm_shadow_register_update_on_shlk 

after software set shlk bit of shlk register

pwm_shadow_register_update_on_modify 

immediately after the register being modified

pwm_shadow_register_update_on_hw_event 

after hardware event assert

pwm_shadow_register_update_on_sh_synci 

after SHSYNCI assert

Function Documentation

◆ pwm_clear_fault()

static void pwm_clear_fault ( PWM_Type pwm_x)
inlinestatic

#include <drivers/inc/hpm_pwm_drv.h>

clear pwm fault status

Parameters
[in]pwm_xPWM base address, HPM_PWMx(x=0..n)

◆ pwm_clear_status()

static void pwm_clear_status ( PWM_Type pwm_x,
uint32_t  mask 
)
inlinestatic

#include <drivers/inc/hpm_pwm_drv.h>

clear pwm status register

Parameters
[in]pwm_xPWM base address, HPM_PWMx(x=0..n)
[in]mask:
  • PWM_IRQ_FAULT: fault condition flag
  • PWM_IRQ_EX_RELOAD : extended reload flag, this flag set when xcnt count to xrld value or when SYNCI assert
  • PWM_IRQ_HALF_RELOAD: half reload flag, this flag set when cnt count to rld/2
  • PWM_IRQ_RELOAD: reload flag, this flag set when cnt count to rld value or when SYNCI assert
  • PWM_IRQ_CMP(x)(x=0...n): comparator output compare or input capture flag

◆ pwm_cmp_disable_half_clock()

static void pwm_cmp_disable_half_clock ( PWM_Type pwm_x,
uint8_t  index 
)
inlinestatic

#include <drivers/inc/hpm_pwm_drv.h>

disable pwn cmp half clock

Parameters
[in]pwm_xPWM base address, HPM_PWMx(x=0..n)
[in]indexcmp index (0..(PWM_SOC_CMP_MAX_COUNT-1))

◆ pwm_cmp_enable_half_clock()

static void pwm_cmp_enable_half_clock ( PWM_Type pwm_x,
uint8_t  index 
)
inlinestatic

#include <drivers/inc/hpm_pwm_drv.h>

enable pwm cmp half clock

Parameters
[in]pwm_xPWM base address, HPM_PWMx(x=0..n)
[in]indexcmp index (0..(PWM_SOC_CMP_MAX_COUNT-1))

◆ pwm_cmp_force_value()

static void pwm_cmp_force_value ( PWM_Type pwm_x,
uint8_t  index,
uint32_t  cmp 
)
inlinestatic

#include <drivers/inc/hpm_pwm_drv.h>

Forced update of pwm cmp register value, cmp content guaranteed accurate by user.

Parameters
[in]pwm_xPWM base address, HPM_PWMx(x=0..n)
[in]indexcmp index (0..(PWM_SOC_CMP_MAX_COUNT-1))
[in]cmpcmp register data

◆ pwm_cmp_update_cmp_value()

static void pwm_cmp_update_cmp_value ( PWM_Type pwm_x,
uint8_t  index,
uint32_t  cmp,
uint16_t  ex_cmp 
)
inlinestatic

#include <drivers/inc/hpm_pwm_drv.h>

update pwm cmp value

Parameters
[in]pwm_xPWM base address, HPM_PWMx(x=0..n)
[in]indexcmp index (0..(PWM_SOC_CMP_MAX_COUNT-1))
[in]cmpclock counter compare value
[in]ex_cmpextended counter compare value

◆ pwm_cmp_update_jitter_value()

static void pwm_cmp_update_jitter_value ( PWM_Type pwm_x,
uint8_t  index,
uint8_t  jitter 
)
inlinestatic

#include <drivers/inc/hpm_pwm_drv.h>

update pwm cmp jitter counter compare value

Parameters
[in]pwm_xPWM base address, HPM_PWMx(x=0..n)
[in]indexcmp index (0..(PWM_SOC_CMP_MAX_COUNT-1))
[in]jitterjitter value

◆ pwm_config_cmp()

static void pwm_config_cmp ( PWM_Type pwm_x,
uint8_t  index,
pwm_cmp_config_t config 
)
inlinestatic

#include <drivers/inc/hpm_pwm_drv.h>

config pwm cmp

Parameters
[in]pwm_xPWM base address, HPM_PWMx(x=0..n)
[in]indexcmp index (0..(PWM_SOC_CMP_MAX_COUNT-1))
[in]configpwm_cmp_config_t

◆ pwm_config_fault_source()

static void pwm_config_fault_source ( PWM_Type pwm_x,
pwm_fault_source_config_t config 
)
inlinestatic

#include <drivers/inc/hpm_pwm_drv.h>

config pwm fault source

Parameters
[in]pwm_xPWM base address, HPM_PWMx(x=0..n)
[in]configpwm_fault_source_config_t

◆ pwm_config_force_cmd_timing()

static void pwm_config_force_cmd_timing ( PWM_Type pwm_x,
pwm_force_cmd_timing_t  timing 
)
inlinestatic

#include <drivers/inc/hpm_pwm_drv.h>

config the force effective time

Parameters
[in]pwm_xPWM base address, HPM_PWMx(x=0..n)
[in]timingpwm_force_cmd_timing_t

◆ pwm_config_force_polarity()

static void pwm_config_force_polarity ( PWM_Type pwm_x,
bool  polarity 
)
inlinestatic

#include <drivers/inc/hpm_pwm_drv.h>

config pwm force polarity

Parameters
[in]pwm_xPWM base address, HPM_PWMx(x=0..n)
[in]polaritypolarity of input pwm_force
  • 1- active low
  • 0- active high

◆ pwm_config_output_channel()

static void pwm_config_output_channel ( PWM_Type pwm_x,
uint8_t  index,
pwm_output_channel_t config 
)
inlinestatic

#include <drivers/inc/hpm_pwm_drv.h>

config pwm output channel

Parameters
[in]pwm_xPWM base address, HPM_PWMx(x=0..n)
[in]indexchannel index (0..(PWM_SOC_PWM_MAX_COUNT-1))
[in]configpwm_output_channel_t

◆ pwm_config_pwm()

static void pwm_config_pwm ( PWM_Type pwm_x,
uint8_t  index,
pwm_config_t config,
bool  enable_pair_mode 
)
inlinestatic

#include <drivers/inc/hpm_pwm_drv.h>

config PWM channel configure registe

Parameters
[in]pwm_xPWM base address, HPM_PWMx(x=0..n)
[in]indexpwm channel index (0..(PWM_SOC_PWM_MAX_COUNT-1))
[in]configpwm_config_t
[in]enable_pair_modeenable pair mode
  • 1- PWM output is in pair mode
  • 0- PWM output is in indepandent mode

◆ pwm_deinit()

static void pwm_deinit ( PWM_Type pwm_x)
inlinestatic

#include <drivers/inc/hpm_pwm_drv.h>

pwm deinitialize function

Parameters
[in]pwm_xPWM base address, HPM_PWMx(x=0..n)

◆ pwm_disable_dma_request()

static void pwm_disable_dma_request ( PWM_Type pwm_x,
uint32_t  mask 
)
inlinestatic

#include <drivers/inc/hpm_pwm_drv.h>

disable pwm dma request

Parameters
[in]pwm_xPWM base address, HPM_PWMx(x=0..n)
[in]mask:
  • PWM_IRQ_FAULT: fault condition DMA request enable
  • PWM_IRQ_EX_RELOAD: extended reload flag DMA request enable
  • PWM_IRQ_HALF_RELOAD: half reload flag DMA request enable
  • PWM_IRQ_RELOAD: reload flag DMA request enable
  • PWM_IRQ_CMP(x)(x=0...n): comparator output compare or input capture flag DMA request enable

◆ pwm_disable_irq()

static void pwm_disable_irq ( PWM_Type pwm_x,
uint32_t  mask 
)
inlinestatic

#include <drivers/inc/hpm_pwm_drv.h>

disable pwm irq

Parameters
[in]pwm_xPWM base address, HPM_PWMx(x=0..n)
[in]mask:
  • PWM_IRQ_FAULT: fault condition interrupt enable
  • PWM_IRQ_EX_RELOAD: extended reload flag interrupt enable
  • PWM_IRQ_HALF_RELOAD: half reload flag interrupt enable
  • PWM_IRQ_RELOAD: reload flag interrupt enable
  • PWM_IRQ_CMP(x)(x=0...n): comparator output compare or input capture flag interrupt enable

◆ pwm_disable_output()

static void pwm_disable_output ( PWM_Type pwm_x,
uint8_t  index 
)
inlinestatic

#include <drivers/inc/hpm_pwm_drv.h>

disable pwm output

Parameters
[in]pwm_xPWM base address, HPM_PWMx(x=0..n)
[in]indexpwm index (0..(PWM_SOC_CMP_MAX_COUNT-1))

◆ pwm_disable_pwm_sw_force_output()

static void pwm_disable_pwm_sw_force_output ( PWM_Type pwm_x,
uint8_t  index 
)
inlinestatic

#include <drivers/inc/hpm_pwm_drv.h>

disable pwm sw force output

Parameters
[in]pwm_xPWM base address, HPM_PWMx(x=0..n)
[in]indexpwm cmp index (0..(PWM_SOC_CMP_MAX_COUNT-1))

◆ pwm_disable_sw_force()

static void pwm_disable_sw_force ( PWM_Type pwm_x)
inlinestatic

#include <drivers/inc/hpm_pwm_drv.h>

disable software force , force will take effect

Parameters
[in]pwm_xPWM base address, HPM_PWMx(x=0..n)

◆ pwm_enable_dma_request()

static void pwm_enable_dma_request ( PWM_Type pwm_x,
uint32_t  mask 
)
inlinestatic

#include <drivers/inc/hpm_pwm_drv.h>

enable pwm dma request

Parameters
[in]pwm_xPWM base address, HPM_PWMx(x=0..n)
[in]mask:
  • PWM_IRQ_FAULT: fault condition DMA request enable
  • PWM_IRQ_EX_RELOAD: extended reload flag DMA request enable
  • PWM_IRQ_HALF_RELOAD: half reload flag DMA request enable
  • PWM_IRQ_RELOAD: reload flag DMA request enable
  • PWM_IRQ_CMP(x)(x=0...n): comparator output compare or input capture flag DMA request enable

◆ pwm_enable_irq()

static void pwm_enable_irq ( PWM_Type pwm_x,
uint32_t  mask 
)
inlinestatic

#include <drivers/inc/hpm_pwm_drv.h>

enable pwm irq

Parameters
[in]pwm_xPWM base address, HPM_PWMx(x=0..n)
[in]mask:
  • PWM_IRQ_FAULT: fault condition interrupt enable
  • PWM_IRQ_EX_RELOAD: extended reload flag interrupt enable
  • PWM_IRQ_HALF_RELOAD: half reload flag interrupt enable
  • PWM_IRQ_RELOAD: reload flag interrupt enable
  • PWM_IRQ_CMP(x)(x=0...n): comparator output compare or input capture flag interrupt enable

◆ pwm_enable_output()

static void pwm_enable_output ( PWM_Type pwm_x,
uint8_t  index 
)
inlinestatic

#include <drivers/inc/hpm_pwm_drv.h>

enable pwm output

Parameters
[in]pwm_xPWM base address, HPM_PWMx(x=0..n)
[in]indexpwm index (0..(PWM_SOC_CMP_MAX_COUNT-1))

◆ pwm_enable_pwm_sw_force_output()

static void pwm_enable_pwm_sw_force_output ( PWM_Type pwm_x,
uint8_t  index 
)
inlinestatic

#include <drivers/inc/hpm_pwm_drv.h>

enable pwm sw force output

Parameters
[in]pwm_xPWM base address, HPM_PWMx(x=0..n)
[in]indexpwm cmp index (0..(PWM_SOC_CMP_MAX_COUNT-1))

◆ pwm_enable_reload_at_synci()

static void pwm_enable_reload_at_synci ( PWM_Type pwm_x)
inlinestatic

#include <drivers/inc/hpm_pwm_drv.h>

enable pwm reload value by synci

Parameters
[in]pwm_xPWM base address, HPM_PWMx(x=0..n)

◆ pwm_enable_sw_force()

static void pwm_enable_sw_force ( PWM_Type pwm_x)
inlinestatic

#include <drivers/inc/hpm_pwm_drv.h>

enable software force

Parameters
[in]pwm_xPWM base address, HPM_PWMx(x=0..n)

◆ pwm_get_captured_count()

void pwm_get_captured_count ( PWM_Type pwm_x,
uint32_t *  buf,
pwm_counter_type_t  counter,
uint8_t  start_index,
uint8_t  num 
)

#include <drivers/inc/hpm_pwm_drv.h>

pwm get captured count

Parameters
[in]pwm_xPWM base address, HPM_PWMx(x=0..n)
[out]bufcount value
[in]counterpwm_counter_type_t
[in]start_indexstart capture index (0..(PWM_SOC_CMP_MAX_COUNT-1))
[in]numcapture num (1..PWM_SOC_CMP_MAX_COUNT)

◆ pwm_get_counter_val()

static uint32_t pwm_get_counter_val ( PWM_Type pwm_x)
inlinestatic

#include <drivers/inc/hpm_pwm_drv.h>

getting the value of the pwm counter

Parameters
pwm_xPWM base address, HPM_PWMx(x=0..n)
Return values
pwmcounter value

◆ pwm_get_default_cmp_config()

void pwm_get_default_cmp_config ( PWM_Type pwm_x,
pwm_cmp_config_t config 
)

#include <drivers/inc/hpm_pwm_drv.h>

get default cmp config

Parameters
[in]pwm_xPWM base address, HPM_PWMx(x=0..n)
[out]configpwm_cmp_config_t

◆ pwm_get_default_output_channel_config()

void pwm_get_default_output_channel_config ( PWM_Type pwm_x,
pwm_output_channel_t config 
)

#include <drivers/inc/hpm_pwm_drv.h>

get default output channel config

Parameters
[in]pwm_xPWM base address, HPM_PWMx(x=0..n)
[out]configpwm_output_channel_t

◆ pwm_get_default_pwm_config()

void pwm_get_default_pwm_config ( PWM_Type pwm_x,
pwm_config_t config 
)

#include <drivers/inc/hpm_pwm_drv.h>

get default pwm config

Parameters
[in]pwm_xPWM base address, HPM_PWMx(x=0..n)
[out]configpwm_config_t

◆ pwm_get_default_pwm_pair_config()

void pwm_get_default_pwm_pair_config ( PWM_Type pwm_x,
pwm_pair_config_t config 
)

#include <drivers/inc/hpm_pwm_drv.h>

get default pwm pair config

Parameters
[in]pwm_xPWM base address, HPM_PWMx(x=0..n)
[out]configpwm_pair_config_t

◆ pwm_get_ex_counter_val()

static uint32_t pwm_get_ex_counter_val ( PWM_Type pwm_x)
inlinestatic

#include <drivers/inc/hpm_pwm_drv.h>

getting the value of the pwm extended counter

Parameters
pwm_xPWM base address, HPM_PWMx(x=0..n)
Return values
pwmcounter value

◆ pwm_get_ex_reload_val()

static uint32_t pwm_get_ex_reload_val ( PWM_Type pwm_x)
inlinestatic

#include <drivers/inc/hpm_pwm_drv.h>

getting the extended counter reload value for a pwm timer

Parameters
pwm_xPWM base address, HPM_PWMx(x=0..n)
Return values
pwmextended reload value

◆ pwm_get_reload_val()

static uint32_t pwm_get_reload_val ( PWM_Type pwm_x)
inlinestatic

#include <drivers/inc/hpm_pwm_drv.h>

getting the counter reload value for a pwm timer

Parameters
pwm_xPWM base address, HPM_PWMx(x=0..n)
Return values
pwmreload value

◆ pwm_get_status()

static uint32_t pwm_get_status ( PWM_Type pwm_x)
inlinestatic

#include <drivers/inc/hpm_pwm_drv.h>

get pwm status register

Parameters
[in]pwm_xPWM base address, HPM_PWMx(x=0..n)
Return values
uint32_tSR register value

◆ pwm_issue_shadow_register_lock_event()

static void pwm_issue_shadow_register_lock_event ( PWM_Type pwm_x)
inlinestatic

#include <drivers/inc/hpm_pwm_drv.h>

issue all shawdow register

Parameters
[in]pwm_xPWM base address, HPM_PWMx(x=0..n)

◆ pwm_load_cmp_shadow_on_capture()

static void pwm_load_cmp_shadow_on_capture ( PWM_Type pwm_x,
uint8_t  index,
bool  is_falling_edge 
)
inlinestatic

#include <drivers/inc/hpm_pwm_drv.h>

Configure input capture cmp to trigger shadow register updates.

Parameters
[in]pwm_xPWM base address, HPM_PWMx(x=0..n)
[in]indexcmp index (0..(PWM_SOC_CMP_MAX_COUNT-1))
[in]is_falling_edgewhich edge is used as shadow register hardware load event
  • 1- falling edge
  • 0- rising edge

◆ pwm_load_cmp_shadow_on_match()

hpm_stat_t pwm_load_cmp_shadow_on_match ( PWM_Type pwm_x,
uint8_t  index,
pwm_cmp_config_t config 
)

#include <drivers/inc/hpm_pwm_drv.h>

pwm load cmp shadow on match

Parameters
[in]pwm_xPWM base address, HPM_PWMx(x=0..n)
[in]indexcmp index (0..(PWM_SOC_CMP_MAX_COUNT-1))
[in]configpwm_cmp_config_t
Return values
status_invalid_argumentor status_success

◆ pwm_set_force_cmd_shadow_register_hwevent()

static void pwm_set_force_cmd_shadow_register_hwevent ( PWM_Type pwm_x,
uint8_t  target_cmp_index 
)
inlinestatic

#include <drivers/inc/hpm_pwm_drv.h>

set target cmp as hardware event to trigger force cmd output

Parameters
[in]pwm_xPWM base address, HPM_PWMx(x=0..n)
[in]target_cmp_indexcmp index select one of the cmp as hardware event time to load FRCMD shadow registers [0-23]

◆ pwm_set_force_output()

static void pwm_set_force_output ( PWM_Type pwm_x,
uint32_t  output_mask 
)
inlinestatic

#include <drivers/inc/hpm_pwm_drv.h>

config pwm force output level per output channel

Parameters
[in]pwm_xPWM base address, HPM_PWMx(x=0..n)
[in]output_maskPWM output channel force level, set it using the macro

◆ pwm_set_load_counter_shadow_register_trigger()

static void pwm_set_load_counter_shadow_register_trigger ( PWM_Type pwm_x,
pwm_shadow_register_update_trigger_t  trigger,
uint8_t  target_cmp_index 
)
inlinestatic

#include <drivers/inc/hpm_pwm_drv.h>

set shadow register control register

Note
if trigger is not set to hardware event, target_cmp_index can be passed with any value
Parameters
[in]pwm_xPWM base address, HPM_PWMx(x=0..n)
[in]triggerselect when the counter related shadow registers pwm_shadow_register_update_trigger_t
[in]target_cmp_indexselect one of the comparators as hardware event (0..(PWM_SOC_CMP_MAX_COUNT-1))

◆ pwm_set_reload()

static void pwm_set_reload ( PWM_Type pwm_x,
uint8_t  ex_reload,
uint32_t  reload 
)
inlinestatic

#include <drivers/inc/hpm_pwm_drv.h>

set the reload value

Parameters
[in]pwm_xPWM base address, HPM_PWMx(x=0..n)
[in]ex_reloadpwm timer counter extended reload value
[in]reloadpwm timer counter reload value

◆ pwm_set_start_count()

static void pwm_set_start_count ( PWM_Type pwm_x,
uint8_t  ex_start,
uint32_t  start 
)
inlinestatic

#include <drivers/inc/hpm_pwm_drv.h>

set counter start value and extended start value

Parameters
[in]pwm_xPWM base address, HPM_PWMx(x=0..n)
[in]ex_startpwm timer counter extended start value
[in]startpwm timer counter start value

◆ pwm_setup_waveform()

hpm_stat_t pwm_setup_waveform ( PWM_Type pwm_x,
uint8_t  pwm_index,
pwm_config_t pwm_config,
uint8_t  cmp_start_index,
pwm_cmp_config_t cmp,
uint8_t  cmp_num 
)

#include <drivers/inc/hpm_pwm_drv.h>

setup waveform

Parameters
[in]pwm_xPWM base address, HPM_PWMx(x=0..n)
[in]pwm_indexpwm channel index (0..(PWM_SOC_PWM_MAX_COUNT-1))
[in]pwm_configpwm_config_t
[in]cmp_start_indexpwm cmp index (0..(PWM_SOC_PWM_MAX_COUNT-1))
[in]cmppwm_cmp_config_t
[in]cmp_numcmp num (1..PWM_SOC_CMP_MAX_COUNT), cmp[cmp_num-1] must not overflow
Return values
hpm_stat_t

◆ pwm_setup_waveform_in_pair()

hpm_stat_t pwm_setup_waveform_in_pair ( PWM_Type pwm_x,
uint8_t  pwm_index,
pwm_pair_config_t pwm_pair_config,
uint8_t  cmp_start_index,
pwm_cmp_config_t cmp,
uint8_t  cmp_num 
)

#include <drivers/inc/hpm_pwm_drv.h>

setup pwm waveform in pair

Parameters
[in]pwm_xPWM base address, HPM_PWMx(x=0..n)
[in]pwm_indexpwm channel index (0..(PWM_SOC_PWM_MAX_COUNT-1))
[in]pwm_pair_configpwm_pair_config_t
[in]cmp_start_indexpwm cmp index (0..(PWM_SOC_PWM_MAX_COUNT-1))
[in]cmppwm_cmp_config_t
[in]cmp_numcmp num (1..PWM_SOC_CMP_MAX_COUNT), cmp[cmp_num-1] must not overflow
Return values
hpm_stat_tstatus_invalid_argument or status_success

◆ pwm_shadow_register_lock()

static void pwm_shadow_register_lock ( PWM_Type pwm_x)
inlinestatic

#include <drivers/inc/hpm_pwm_drv.h>

lock all shawdow register

Parameters
[in]pwm_xPWM base address, HPM_PWMx(x=0..n)

◆ pwm_shadow_register_unlock()

static void pwm_shadow_register_unlock ( PWM_Type pwm_x)
inlinestatic

#include <drivers/inc/hpm_pwm_drv.h>

unlock all shadow register

Parameters
[in]pwm_xPWM base address, HPM_PWMx(x=0..n)

◆ pwm_start_counter()

static void pwm_start_counter ( PWM_Type pwm_x)
inlinestatic

#include <drivers/inc/hpm_pwm_drv.h>

start pwm timer counter

Parameters
[in]pwm_xPWM base address, HPM_PWMx(x=0..n)

◆ pwm_stop_counter()

static void pwm_stop_counter ( PWM_Type pwm_x)
inlinestatic

#include <drivers/inc/hpm_pwm_drv.h>

stop the pwm timer counter

Parameters
[in]pwm_xPWM base address, HPM_PWMx(x=0..n)

◆ pwm_update_raw_cmp_central_aligned()

hpm_stat_t pwm_update_raw_cmp_central_aligned ( PWM_Type pwm_x,
uint8_t  cmp1_index,
uint8_t  cmp2_index,
uint32_t  target_cmp1,
uint32_t  target_cmp2 
)

#include <drivers/inc/hpm_pwm_drv.h>

update raw compare value for central aligned waveform

Parameters
[in]pwm_xPWM base address, HPM_PWMx(x=0..n)
[in]cmp1_indexindex of cmp1 to be adjusted (cmp1_index must be even number)
[in]cmp2_indexindex of cmp2 to be adjusted (cmp2_index must be odd number)
[in]target_cmp1target compare value for cmp1
[in]target_cmp2target compare value for cmp2
Return values
hpm_stat_tstatus_invalid_argument or status_success cmp1_index

◆ pwm_update_raw_cmp_edge_aligned()

hpm_stat_t pwm_update_raw_cmp_edge_aligned ( PWM_Type pwm_x,
uint8_t  cmp_index,
uint32_t  target_cmp 
)

#include <drivers/inc/hpm_pwm_drv.h>

update raw compare value for edge aligned waveform

Parameters
[in]pwm_xPWM base address, HPM_PWMx(x=0..n)
[in]cmp_indexindex of cmp to be adjusted (0..(PWM_SOC_PWM_MAX_COUNT-1))
[in]target_cmptarget compare value
Return values
hpm_stat_tstatus_invalid_argument or status_success