HPM SDK
HPMicro Software Development Kit
hpm_clc_drv.h File Reference
#include "hpm_common.h"
#include "hpm_clc_regs.h"
#include "hpm_soc_feature.h"

Go to the source code of this file.

Data Structures

struct  clc_param_config_t
 clc parameter configuration More...
 
struct  clc_coeff_config_t
 clc coefficient configuration More...
 

Enumerations

enum  clc_chn_t { clc_vd_chn = CLC_VDVQ_CHAN_VD , clc_vq_chn = CLC_VDVQ_CHAN_VQ }
 clc channel More...
 
enum  clc_coeff_zone_t { clc_coeff_zone_0 = CLC_COEFF_0 , clc_coeff_zone_1 = CLC_COEFF_1 , clc_coeff_zone_2 = CLC_COEFF_2 }
 clc coefficient zone More...
 
enum  clc_irq_mask_t {
  clc_irq_calc_done = (0x00000001UL) , clc_irq_eadc_setting_err = (0x00000002UL) , clc_irq_2p2z_clamp_setting_err = (0x00000004UL) , clc_irq_2p2z_over_hi = (0x00000008UL) ,
  clc_irq_2p2z_over_lo = (0x00000010UL) , clc_irq_2p2z_over_sf = (0x00000020UL) , clc_irq_3p3z_clamp_setting_err = (0x00000040UL) , clc_irq_3p3z_over_hi = (0x00000080UL) ,
  clc_irq_3p3z_over_lo = (0x00000100UL) , clc_irq_forb_setting_err = (0x00000200UL) , clc_irq_data_in_forbid = (0x00000400UL)
}
 clc irq mask bit More...
 

Functions

static void clc_set_enable (CLC_Type *clc, clc_chn_t chn, bool enable)
 CLC enable or disable. More...
 
static void clc_set_mask_mode_enable (CLC_Type *clc, clc_chn_t chn, bool enable)
 CLC keep working even if bad irq status ocurred. More...
 
static void clc_set_sw_inject_dq_mode_enable (CLC_Type *clc, clc_chn_t chn, bool enable)
 CLC set software inject dq work mode. More...
 
static void clc_set_irq_enable (CLC_Type *clc, clc_chn_t chn, uint32_t irq_mask, bool enable)
 CLC set irq enable or disable. More...
 
static uint32_t clc_get_irq_status (CLC_Type *clc, clc_chn_t chn)
 CLC get irq status. More...
 
static void clc_clear_irq_status (CLC_Type *clc, clc_chn_t chn, uint32_t irq_mask)
 CLC clear irq status. More...
 
static bool clc_get_irq_flag (CLC_Type *clc, clc_chn_t chn, uint32_t irq_mask)
 CLC check irq request flag. More...
 
static void clc_set_adc_chn_offset (CLC_Type *clc, clc_chn_t chn, uint32_t adc_chn, uint32_t adc_offset)
 CLC set adc channel. More...
 
static void clc_set_pwm_period (CLC_Type *clc, clc_chn_t chn, uint32_t pwm_period)
 CLC set pwm period. More...
 
static uint32_t clc_get_pwm_period (CLC_Type *clc, clc_chn_t chn)
 CLC set pwm period. More...
 
static uint32_t clc_get_output_value (CLC_Type *clc, clc_chn_t chn)
 CLC get output caculated value. More...
 
static uint32_t clc_get_timestamp (CLC_Type *clc, clc_chn_t chn)
 CLC get timestamp. More...
 
static int32_t clc_get_eadc_current_value (CLC_Type *clc, clc_chn_t chn)
 CLC get error adc latest value. More...
 
static int32_t clc_get_eadc_previous0_value (CLC_Type *clc, clc_chn_t chn)
 CLC get error adc previous0 value. More...
 
static void clc_sw_inject_eadc_previous0_value (CLC_Type *clc, clc_chn_t chn, int32_t value)
 CLC software inject error adc previous0 value. More...
 
static int32_t clc_get_eadc_previous1_value (CLC_Type *clc, clc_chn_t chn)
 CLC get error adc previous1 value. More...
 
static void clc_sw_inject_eadc_previous1_value (CLC_Type *clc, clc_chn_t chn, int32_t value)
 CLC software inject error adc previous1 value. More...
 
static int32_t clc_get_2p2z_current_value (CLC_Type *clc, clc_chn_t chn)
 CLC get 2p2z last value. More...
 
static void clc_sw_inject_2p2z_current_value (CLC_Type *clc, clc_chn_t chn, int32_t value)
 CLC software inject 2p2z last value. More...
 
static int32_t clc_get_2p2z_previous0_value (CLC_Type *clc, clc_chn_t chn)
 CLC get 2p2z previous0 value. More...
 
static void clc_sw_inject_2p2z_previous0_value (CLC_Type *clc, clc_chn_t chn, int32_t value)
 CLC software inject 2p2z previous0 value. More...
 
static int32_t clc_get_3p3z_current_value (CLC_Type *clc, clc_chn_t chn)
 CLC get 3p3z last value. More...
 
static void clc_sw_inject_3p3z_current_value (CLC_Type *clc, clc_chn_t chn, int32_t value)
 CLC software inject 3p3z last value. More...
 
static void clc_set_expect_adc_value (CLC_Type *clc, clc_chn_t chn, int32_t expect)
 CLC set expected adc value. More...
 
static void clc_sw_inject_adc_value (CLC_Type *clc, clc_chn_t chn, uint32_t value)
 CLC software inject adc value. If it's not dq mode, this will trig clc calculation. More...
 
static void clc_set_sw_inject_dq_adc_value_ready (CLC_Type *clc)
 CLC set software inject dq adc value ready, this will trig clc calculation. More...
 
void clc_config_param (CLC_Type *clc, clc_chn_t chn, clc_param_config_t *param)
 CLC parameter configuration. More...
 
hpm_stat_t clc_config_coeff (CLC_Type *clc, clc_chn_t chn, clc_coeff_zone_t zone, clc_coeff_config_t *coeff)
 CLC coefficient configuration. More...
 
void clc_sw_inject_dq_adc_value (CLC_Type *clc, uint32_t d_value, uint32_t q_value)
 CLC software inject dq adc value. More...