zhaohe 1 year ago
parent
commit
4c95d7f5b4
  1. 24
      src/camera_light_src_timing_controller/clst_controler.cpp
  2. 52
      src/camera_light_src_timing_controller/reginfo.cpp
  3. 7
      src/camera_light_src_timing_controller/reginfo.hpp
  4. 2
      src/version.h

24
src/camera_light_src_timing_controller/clst_controler.cpp

@ -187,12 +187,18 @@ zaf_error_code_t CLSTControler::reg_write(uint32_t regadd, uint32_t regvalue, ui
return kaf_ec_param_error;
}
if (!reg->dirty && reg->regshadow == regvalue) {
return kaf_ec_success;
if (!(reg->flag & kreg_flag_force_write)) {
if (!reg->dirty && reg->regshadow == regvalue) {
return kaf_ec_success;
}
}
reg->dirty = true;
return _reg_write(regadd, regvalue, regbackvalue, overtime_ms);
zaf_error_code_t ecode = _reg_write(regadd, regvalue, regbackvalue, overtime_ms);
if (ecode == kaf_ec_success) {
reg->dirty = false;
reg->regshadow = regvalue;
}
return ecode;
}
zaf_error_code_t CLSTControler::reg_read(uint32_t regadd, uint32_t &regvalue, int32_t overtime_ms) {
Reginfo *reg = GetRegInfo(regadd);
@ -200,9 +206,11 @@ zaf_error_code_t CLSTControler::reg_read(uint32_t regadd, uint32_t &regvalue, in
return kaf_ec_param_error;
}
if (!reg->dirty && !(reg->flag & kreg_flag_volatile)) {
regvalue = reg->regshadow;
return kaf_ec_success;
if (!(reg->flag & kreg_flag_force_read)) {
if (!reg->dirty) {
regvalue = reg->regshadow;
return kaf_ec_success;
}
}
uint32_t regbackvalue = 0;
@ -630,7 +638,7 @@ zaf_error_code_t CLSTControler::LightSrcX_getLightIntensityDuty(int32_t index, f
DO_CMD(reg_read(kreg_light_ctrol_module1_light_intensity_cnt + (index - 1) * 32, cnt));
duty = (cnt * 100.0 / freqcnt);
return kaf_ec_success;
}
zaf_error_code_t CLSTControler::LightSrcX_getLightDriverFreq(int32_t index, float &freq) { //

52
src/camera_light_src_timing_controller/reginfo.cpp

@ -378,31 +378,33 @@ static map<uint32_t, Reginfo> reginfo_map = {
static bool reginfo_initialized = false;
void RegInfoInitialize() {
reginfo_map[kreg_light_ctrol_module1_light_src_error_state].flag |= kreg_flag_volatile;
reginfo_map[kreg_light_ctrol_module2_light_src_error_state].flag |= kreg_flag_volatile;
reginfo_map[kreg_light_ctrol_module3_light_src_error_state].flag |= kreg_flag_volatile;
reginfo_map[kreg_light_ctrol_module4_light_src_error_state].flag |= kreg_flag_volatile;
reginfo_map[kreg_internal_clk_tri_out_signal_freq].flag |= kreg_flag_volatile;
reginfo_map[kreg_trigger_in1_in_signal_freq].flag |= kreg_flag_volatile;
reginfo_map[kreg_trigger_in2_in_signal_freq].flag |= kreg_flag_volatile;
reginfo_map[kreg_trigger_in3_in_signal_freq].flag |= kreg_flag_volatile;
reginfo_map[kreg_trigger_in4_in_signal_freq].flag |= kreg_flag_volatile;
reginfo_map[kreg_trigger_in1_out_signal_freq].flag |= kreg_flag_volatile;
reginfo_map[kreg_trigger_in2_out_signal_freq].flag |= kreg_flag_volatile;
reginfo_map[kreg_trigger_in3_out_signal_freq].flag |= kreg_flag_volatile;
reginfo_map[kreg_trigger_in4_out_signal_freq].flag |= kreg_flag_volatile;
reginfo_map[kreg_light_ctrol_module1_in_sig_freq_detect].flag |= kreg_flag_volatile;
reginfo_map[kreg_light_ctrol_module2_in_sig_freq_detect].flag |= kreg_flag_volatile;
reginfo_map[kreg_light_ctrol_module3_in_sig_freq_detect].flag |= kreg_flag_volatile;
reginfo_map[kreg_light_ctrol_module4_in_sig_freq_detect].flag |= kreg_flag_volatile;
reginfo_map[kreg_light_ctrol_module1_out_sig_freq_detect].flag |= kreg_flag_volatile;
reginfo_map[kreg_light_ctrol_module2_out_sig_freq_detect].flag |= kreg_flag_volatile;
reginfo_map[kreg_light_ctrol_module3_out_sig_freq_detect].flag |= kreg_flag_volatile;
reginfo_map[kreg_light_ctrol_module4_out_sig_freq_detect].flag |= kreg_flag_volatile;
reginfo_map[kreg_light_ctrol_module1_light_src_error_state].flag |= kreg_flag_force_read;
reginfo_map[kreg_light_ctrol_module2_light_src_error_state].flag |= kreg_flag_force_read;
reginfo_map[kreg_light_ctrol_module3_light_src_error_state].flag |= kreg_flag_force_read;
reginfo_map[kreg_light_ctrol_module4_light_src_error_state].flag |= kreg_flag_force_read;
reginfo_map[kreg_internal_clk_tri_out_signal_freq].flag |= kreg_flag_force_read;
reginfo_map[kreg_trigger_in1_in_signal_freq].flag |= kreg_flag_force_read;
reginfo_map[kreg_trigger_in2_in_signal_freq].flag |= kreg_flag_force_read;
reginfo_map[kreg_trigger_in3_in_signal_freq].flag |= kreg_flag_force_read;
reginfo_map[kreg_trigger_in4_in_signal_freq].flag |= kreg_flag_force_read;
reginfo_map[kreg_trigger_in1_out_signal_freq].flag |= kreg_flag_force_read;
reginfo_map[kreg_trigger_in2_out_signal_freq].flag |= kreg_flag_force_read;
reginfo_map[kreg_trigger_in3_out_signal_freq].flag |= kreg_flag_force_read;
reginfo_map[kreg_trigger_in4_out_signal_freq].flag |= kreg_flag_force_read;
reginfo_map[kreg_light_ctrol_module1_in_sig_freq_detect].flag |= kreg_flag_force_read;
reginfo_map[kreg_light_ctrol_module2_in_sig_freq_detect].flag |= kreg_flag_force_read;
reginfo_map[kreg_light_ctrol_module3_in_sig_freq_detect].flag |= kreg_flag_force_read;
reginfo_map[kreg_light_ctrol_module4_in_sig_freq_detect].flag |= kreg_flag_force_read;
reginfo_map[kreg_light_ctrol_module1_out_sig_freq_detect].flag |= kreg_flag_force_read;
reginfo_map[kreg_light_ctrol_module2_out_sig_freq_detect].flag |= kreg_flag_force_read;
reginfo_map[kreg_light_ctrol_module3_out_sig_freq_detect].flag |= kreg_flag_force_read;
reginfo_map[kreg_light_ctrol_module4_out_sig_freq_detect].flag |= kreg_flag_force_read;
reginfo_map[kreg_internal_clk_ctrl].flag |= kreg_flag_force_write;
}
Reginfo* GetRegInfo(uint32_t add) {
if (!reginfo_initialized) {

7
src/camera_light_src_timing_controller/reginfo.hpp

@ -15,9 +15,10 @@ using namespace std;
typedef enum {
kreg_flag_r = 0x01, // 可读
kreg_flag_w = 0x01 << 1, // 可写
kreg_flag_volatile = 0x01 << 2, // 易变寄存器
kreg_flag_r = 0x01, // 可读
kreg_flag_w = 0x01 << 1, // 可写
kreg_flag_force_read = 0x01 << 2, // 易变寄存器
kreg_flag_force_write = 0x01 << 3, // 易变寄存器
kreg_flag_rw = kreg_flag_r | kreg_flag_w,
} reg_flag_t;

2
src/version.h

@ -1,4 +1,4 @@
#pragma once
#define VERSION 10
#define VERSION 11
#define MAUFACTURER "iflytop"
Loading…
Cancel
Save