13 #include "hpm_soc_feature.h"
64 int32_t _2p2z_clamp_lowth;
65 int32_t _2p2z_clamp_highth;
66 int32_t _3p3z_clamp_lowth;
67 int32_t _3p3z_clamp_highth;
189 return ((clc->
VDVQ_CHAN[chn].
STATUS & irq_mask) == irq_mask) ? true :
false;
421 #if defined(HPM_IP_FEATURE_CLC_DECOUPLING) && HPM_IP_FEATURE_CLC_DECOUPLING
427 static inline void clc_sw_inject_speed_value(
CLC_Type *clc, int32_t value)
438 static inline void clc_set_decoupling_scaling(
CLC_Type *clc,
clc_chn_t chn, uint32_t left_shift_value)
440 clc->
VDVQ_CHAN[chn].DECOUPLE_SCALING = left_shift_value;
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.
Definition: hpm_clc_drv.h:147
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.
Definition: hpm_clc_drv.h:199
static void clc_sw_inject_3p3z_current_value(CLC_Type *clc, clc_chn_t chn, int32_t value)
CLC software inject 3p3z last value.
Definition: hpm_clc_drv.h:365
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.
Definition: hpm_clc_drv.h:396
static uint32_t clc_get_output_value(CLC_Type *clc, clc_chn_t chn)
CLC get output caculated value.
Definition: hpm_clc_drv.h:233
static int32_t clc_get_2p2z_current_value(CLC_Type *clc, clc_chn_t chn)
CLC get 2p2z last value.
Definition: hpm_clc_drv.h:310
static uint32_t clc_get_timestamp(CLC_Type *clc, clc_chn_t chn)
CLC get timestamp.
Definition: hpm_clc_drv.h:244
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.
Definition: hpm_clc_drv.h:129
void clc_config_param(CLC_Type *clc, clc_chn_t chn, clc_param_config_t *param)
CLC parameter configuration.
Definition: hpm_clc_drv.c:10
static bool clc_get_irq_flag(CLC_Type *clc, clc_chn_t chn, uint32_t irq_mask)
CLC check irq request flag.
Definition: hpm_clc_drv.h:187
static void clc_set_expect_adc_value(CLC_Type *clc, clc_chn_t chn, int32_t expect)
CLC set expected adc value.
Definition: hpm_clc_drv.h:376
clc_coeff_zone_t
clc coefficient zone
Definition: hpm_clc_drv.h:33
static void clc_sw_inject_2p2z_previous0_value(CLC_Type *clc, clc_chn_t chn, int32_t value)
CLC software inject 2p2z previous0 value.
Definition: hpm_clc_drv.h:343
void clc_sw_inject_dq_adc_value(CLC_Type *clc, uint32_t d_value, uint32_t q_value)
CLC software inject dq adc value.
Definition: hpm_clc_drv.c:97
static uint32_t clc_get_pwm_period(CLC_Type *clc, clc_chn_t chn)
CLC set pwm period.
Definition: hpm_clc_drv.h:222
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.
Definition: hpm_clc_drv.h:299
static void clc_sw_inject_2p2z_current_value(CLC_Type *clc, clc_chn_t chn, int32_t value)
CLC software inject 2p2z last value.
Definition: hpm_clc_drv.h:321
clc_irq_mask_t
clc irq mask bit
Definition: hpm_clc_drv.h:42
static void clc_clear_irq_status(CLC_Type *clc, clc_chn_t chn, uint32_t irq_mask)
CLC clear irq status.
Definition: hpm_clc_drv.h:174
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.
Definition: hpm_clc_drv.h:113
static int32_t clc_get_eadc_current_value(CLC_Type *clc, clc_chn_t chn)
CLC get error adc latest value.
Definition: hpm_clc_drv.h:255
static int32_t clc_get_eadc_previous0_value(CLC_Type *clc, clc_chn_t chn)
CLC get error adc previous0 value.
Definition: hpm_clc_drv.h:266
static int32_t clc_get_2p2z_previous0_value(CLC_Type *clc, clc_chn_t chn)
CLC get 2p2z previous0 value.
Definition: hpm_clc_drv.h:332
static int32_t clc_get_3p3z_current_value(CLC_Type *clc, clc_chn_t chn)
CLC get 3p3z last value.
Definition: hpm_clc_drv.h:354
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.
Definition: hpm_clc_drv.c:25
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.
Definition: hpm_clc_drv.h:277
clc_chn_t
clc channel
Definition: hpm_clc_drv.h:25
static int32_t clc_get_eadc_previous1_value(CLC_Type *clc, clc_chn_t chn)
CLC get error adc previous1 value.
Definition: hpm_clc_drv.h:288
static void clc_set_pwm_period(CLC_Type *clc, clc_chn_t chn, uint32_t pwm_period)
CLC set pwm period.
Definition: hpm_clc_drv.h:211
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.
Definition: hpm_clc_drv.h:387
static uint32_t clc_get_irq_status(CLC_Type *clc, clc_chn_t chn)
CLC get irq status.
Definition: hpm_clc_drv.h:163
static void clc_set_enable(CLC_Type *clc, clc_chn_t chn, bool enable)
CLC enable or disable.
Definition: hpm_clc_drv.h:97
@ clc_coeff_zone_1
Definition: hpm_clc_drv.h:35
@ clc_coeff_zone_0
Definition: hpm_clc_drv.h:34
@ clc_coeff_zone_2
Definition: hpm_clc_drv.h:36
@ clc_irq_2p2z_over_hi
Definition: hpm_clc_drv.h:46
@ clc_irq_calc_done
Definition: hpm_clc_drv.h:43
@ clc_irq_2p2z_clamp_setting_err
Definition: hpm_clc_drv.h:45
@ clc_irq_2p2z_over_lo
Definition: hpm_clc_drv.h:47
@ clc_irq_forb_setting_err
Definition: hpm_clc_drv.h:52
@ clc_irq_2p2z_over_sf
Definition: hpm_clc_drv.h:48
@ clc_irq_eadc_setting_err
Definition: hpm_clc_drv.h:44
@ clc_irq_3p3z_over_lo
Definition: hpm_clc_drv.h:51
@ clc_irq_3p3z_clamp_setting_err
Definition: hpm_clc_drv.h:49
@ clc_irq_data_in_forbid
Definition: hpm_clc_drv.h:53
@ clc_irq_3p3z_over_hi
Definition: hpm_clc_drv.h:50
@ clc_vd_chn
Definition: hpm_clc_drv.h:26
@ clc_vq_chn
Definition: hpm_clc_drv.h:27
#define BIT4_MASK
Definition: hpm_common.h:90
uint32_t hpm_stat_t
Definition: hpm_common.h:123
#define BIT8_MASK
Definition: hpm_common.h:94
#define BIT2_MASK
Definition: hpm_common.h:88
#define BIT5_MASK
Definition: hpm_common.h:91
#define BIT1_MASK
Definition: hpm_common.h:87
#define BIT7_MASK
Definition: hpm_common.h:93
#define BIT10_MASK
Definition: hpm_common.h:96
#define BIT3_MASK
Definition: hpm_common.h:89
#define BIT6_MASK
Definition: hpm_common.h:92
#define BIT0_MASK
Definition: hpm_common.h:86
#define BIT9_MASK
Definition: hpm_common.h:95
#define CLC_VDVQ_CHAN_STATUS_STATUS_GET(x)
Definition: hpm_clc_regs.h:482
#define CLC_VDVQ_CHAN_VQ
Definition: hpm_clc_regs.h:504
#define CLC_VDVQ_CHAN_STATUS_STATUS_SET(x)
Definition: hpm_clc_regs.h:481
#define CLC_COEFF_0
Definition: hpm_clc_regs.h:498
#define CLC_VDVQ_CHAN_MODE_DQ_MODE_MASK
Definition: hpm_clc_regs.h:86
#define CLC_VDVQ_CHAN_MODE_ENABLE_CLC_MASK
Definition: hpm_clc_regs.h:66
#define CLC_VDVQ_CHAN_MODE_MASK_MODE_MASK
Definition: hpm_clc_regs.h:76
#define CLC_VDVQ_CHAN_VD
Definition: hpm_clc_regs.h:503
#define CLC_VDVQ_CHAN_MODE_ENABLE_IRQ_SET(x)
Definition: hpm_clc_regs.h:109
#define CLC_DQ_ADC_SW_READY_DQ_ADC_SW_READY_MASK
Definition: hpm_clc_regs.h:490
#define CLC_COEFF_2
Definition: hpm_clc_regs.h:500
#define CLC_COEFF_1
Definition: hpm_clc_regs.h:499
Definition: hpm_clc_regs.h:12
__RW uint32_t MODE
Definition: hpm_clc_regs.h:14
__R uint32_t OUTPUT_VALUE
Definition: hpm_clc_regs.h:38
__RW uint32_t P3Z3_CURR
Definition: hpm_clc_regs.h:46
__W uint32_t STATUS
Definition: hpm_clc_regs.h:54
__RW uint32_t ADC_EXPECT
Definition: hpm_clc_regs.h:15
__RW uint32_t ADC_SW
Definition: hpm_clc_regs.h:52
__RW uint32_t ADC_CHAN
Definition: hpm_clc_regs.h:16
__R uint32_t TIMESTAMP
Definition: hpm_clc_regs.h:39
__RW uint32_t P2Z2_CURR
Definition: hpm_clc_regs.h:43
__RW uint32_t EADC_PRE0
Definition: hpm_clc_regs.h:41
__RW uint32_t PWM_PERIOD
Definition: hpm_clc_regs.h:37
__RW uint32_t EADC_PRE1
Definition: hpm_clc_regs.h:42
__RW uint32_t P2Z2_PRE0
Definition: hpm_clc_regs.h:44
__RW uint32_t ADC_OFFSET
Definition: hpm_clc_regs.h:17
__RW uint32_t EADC_CURR
Definition: hpm_clc_regs.h:40
struct CLC_Type::@647 VDVQ_CHAN[2]
__W uint32_t DQ_ADC_SW_READY
Definition: hpm_clc_regs.h:56
clc coefficient configuration
Definition: hpm_clc_drv.h:76
float b3
Definition: hpm_clc_drv.h:80
float a2
Definition: hpm_clc_drv.h:83
float b2
Definition: hpm_clc_drv.h:79
float b0
Definition: hpm_clc_drv.h:77
float b1
Definition: hpm_clc_drv.h:78
float a0
Definition: hpm_clc_drv.h:81
float a1
Definition: hpm_clc_drv.h:82
clc parameter configuration
Definition: hpm_clc_drv.h:59
int32_t eadc_lowth
Definition: hpm_clc_drv.h:60
int32_t output_forbid_highth
Definition: hpm_clc_drv.h:70
int32_t output_forbid_mid
Definition: hpm_clc_drv.h:69
int32_t output_forbid_lowth
Definition: hpm_clc_drv.h:68
int32_t eadc_mid_highth
Definition: hpm_clc_drv.h:62
int32_t eadc_highth
Definition: hpm_clc_drv.h:63
int32_t eadc_mid_lowth
Definition: hpm_clc_drv.h:61