|
|
@ -31,13 +31,13 @@ using namespace std; |
|
|
|
if (ecode != kxs_ec_success) return ecode; \ |
|
|
|
} |
|
|
|
|
|
|
|
#define DO_XSYNC_REG_WRITE(reg, value) \
|
|
|
|
#define REG_WRITE(reg, value) \
|
|
|
|
{ \ |
|
|
|
DO_XSYNC(reg_write(reg, value, 10)); \ |
|
|
|
return kxs_ec_success; \ |
|
|
|
} |
|
|
|
|
|
|
|
#define DO_XSYNC_REG_READ(reg, value) \
|
|
|
|
#define REG_READ(reg, value) \
|
|
|
|
{ \ |
|
|
|
uint32_t readbak = 0; \ |
|
|
|
DO_XSYNC(reg_read(reg, readbak, 10)); \ |
|
|
@ -610,136 +610,19 @@ xs_error_code_t Xsync::doaction(uint32_t action, uint32_t actionval, uint32_t *a |
|
|
|
return ecode; |
|
|
|
} |
|
|
|
|
|
|
|
xs_error_code_t Xsync::Basic_setGenlockFormat(GenlockFormat_t format) { |
|
|
|
DO_XSYNC(SigGenerator_setGenlockFormat(format)); |
|
|
|
return kxs_ec_success; |
|
|
|
} |
|
|
|
xs_error_code_t Xsync::Basic_getGenlockFormat(GenlockFormat_t &format) { |
|
|
|
DO_XSYNC(SigGenerator_getGenlockFormat(format)); |
|
|
|
return kxs_ec_success; |
|
|
|
} |
|
|
|
xs_error_code_t Xsync::Basic_setTimecodeFormat(TimecodeFormat_t format) { |
|
|
|
uint32_t readbak = 0; |
|
|
|
return kxs_ec_success; |
|
|
|
} |
|
|
|
// xs_error_code_t Xsync::Basic_getTimecodeFormat(TimecodeFormat_t &format) {
|
|
|
|
// DO_XSYNC(SigGenerator_getTimecodeFormat(format));
|
|
|
|
// xs_error_code_t Xsync::Basic_setGenlockFormat(GenlockFormat_t format) {
|
|
|
|
// DO_XSYNC(SigGenerator_setGenlockFormat(format));
|
|
|
|
// return kxs_ec_success;
|
|
|
|
// }
|
|
|
|
// xs_error_code_t Xsync::Basic_getGenlockFormat(GenlockFormat_t &format) {
|
|
|
|
// DO_XSYNC(SigGenerator_getGenlockFormat(format));
|
|
|
|
// return kxs_ec_success;
|
|
|
|
// }
|
|
|
|
// xs_error_code_t Xsync::Basic_setTimecodeFormat(TimecodeFormat_t format) {
|
|
|
|
// uint32_t readbak = 0;
|
|
|
|
// return kxs_ec_success;
|
|
|
|
// }
|
|
|
|
/*******************************************************************************
|
|
|
|
* TTLOutputModule * |
|
|
|
*******************************************************************************/ |
|
|
|
|
|
|
|
xs_error_code_t Xsync::SigGenerator_setControlMode(sig_generator_module::ControlMode_t mode) { |
|
|
|
uint32_t readbak = 0; |
|
|
|
return reg_write(reg::kSigGenerator_ctl, mode, readbak, 10); |
|
|
|
} |
|
|
|
xs_error_code_t Xsync::SigGenerator_getControlMode(sig_generator_module::ControlMode_t &mode) { |
|
|
|
uint32_t readbak = 0; |
|
|
|
auto ecode = reg_read(reg::kSigGenerator_ctl, readbak, 10); |
|
|
|
if (ecode != kxs_ec_success) return ecode; |
|
|
|
mode = (sig_generator_module::ControlMode_t)readbak; |
|
|
|
return ecode; |
|
|
|
} |
|
|
|
xs_error_code_t Xsync::SigGenerator_manualStart() { |
|
|
|
uint32_t readbak = 0; |
|
|
|
return reg_write(reg::kSigGenerator_control_trigger_reg, 1, readbak, 10); |
|
|
|
} |
|
|
|
xs_error_code_t Xsync::SigGenerator_manualStop() { |
|
|
|
uint32_t readbak = 0; |
|
|
|
return reg_write(reg::kSigGenerator_control_trigger_reg, 0, readbak, 10); |
|
|
|
} |
|
|
|
xs_error_code_t Xsync::SigGenerator_setTimecode(XsyncTimecode_t timecode) { |
|
|
|
uint32_t readbak = 0; |
|
|
|
xs_error_code_t ecode = kxs_ec_success; |
|
|
|
|
|
|
|
Timecode64_t tc64 = timecodeTo64(timecode); |
|
|
|
|
|
|
|
ecode = reg_write(reg::kSigGenerator_timecode0, tc64.tc0, readbak, 10); |
|
|
|
if (ecode != kxs_ec_success) return ecode; |
|
|
|
ecode = reg_write(reg::kSigGenerator_timecode1, tc64.tc1, readbak, 10); |
|
|
|
if (ecode != kxs_ec_success) return ecode; |
|
|
|
|
|
|
|
return ecode; |
|
|
|
} |
|
|
|
xs_error_code_t Xsync::SigGenerator_getTimecode(XsyncTimecode_t &timecode) { |
|
|
|
uint32_t readbak = 0; |
|
|
|
xs_error_code_t ecode = kxs_ec_success; |
|
|
|
|
|
|
|
uint32_t tc0 = 0; |
|
|
|
uint32_t tc1 = 0; |
|
|
|
|
|
|
|
ecode = reg_read(reg::kSigGenerator_timecode0, tc0, 10); |
|
|
|
if (ecode != kxs_ec_success) return ecode; |
|
|
|
ecode = reg_read(reg::kSigGenerator_timecode1, tc1, 10); |
|
|
|
if (ecode != kxs_ec_success) return ecode; |
|
|
|
|
|
|
|
Timecode64_t tc64; |
|
|
|
tc64.tc0 = tc0; |
|
|
|
tc64.tc1 = tc1; |
|
|
|
|
|
|
|
timecode = timecode64ToXsyncTimeCode(tc64); |
|
|
|
return ecode; |
|
|
|
} |
|
|
|
xs_error_code_t Xsync::SigGenerator_setAutoStartTimecode(XsyncTimecode_t timecode) { |
|
|
|
uint32_t readbak = 0; |
|
|
|
xs_error_code_t ecode = kxs_ec_success; |
|
|
|
|
|
|
|
Timecode64_t tc64 = timecodeTo64(timecode); |
|
|
|
|
|
|
|
ecode = reg_write(reg::kSigGenerator_timecode_start0, tc64.tc0, readbak, 10); |
|
|
|
if (ecode != kxs_ec_success) return ecode; |
|
|
|
ecode = reg_write(reg::kSigGenerator_timecode_start1, tc64.tc1, readbak, 10); |
|
|
|
if (ecode != kxs_ec_success) return ecode; |
|
|
|
|
|
|
|
return ecode; |
|
|
|
} |
|
|
|
xs_error_code_t Xsync::SigGenerator_getAutoStartTimecode(XsyncTimecode_t &timecode) { |
|
|
|
uint32_t readbak = 0; |
|
|
|
xs_error_code_t ecode = kxs_ec_success; |
|
|
|
|
|
|
|
uint32_t tc0 = 0; |
|
|
|
uint32_t tc1 = 0; |
|
|
|
|
|
|
|
ecode = reg_read(reg::kSigGenerator_timecode_start0, tc0, 10); |
|
|
|
if (ecode != kxs_ec_success) return ecode; |
|
|
|
ecode = reg_read(reg::kSigGenerator_timecode_start1, tc1, 10); |
|
|
|
if (ecode != kxs_ec_success) return ecode; |
|
|
|
|
|
|
|
Timecode64_t tc64; |
|
|
|
tc64.tc0 = tc0; |
|
|
|
tc64.tc1 = tc1; |
|
|
|
|
|
|
|
timecode = timecode64ToXsyncTimeCode(tc64); |
|
|
|
return ecode; |
|
|
|
} |
|
|
|
xs_error_code_t Xsync::SigGenerator_getWorkState(uint32_t &work_state) { |
|
|
|
uint32_t readbak = 0; |
|
|
|
auto ecode = reg_read(reg::kSigGenerator_work_state, readbak, 10); |
|
|
|
if (ecode != kxs_ec_success) return ecode; |
|
|
|
work_state = readbak; |
|
|
|
return ecode; |
|
|
|
} |
|
|
|
|
|
|
|
xs_error_code_t Xsync::SigGenerator_setGenlockFormat(GenlockFormat_t format) { |
|
|
|
uint32_t readbak = 0; |
|
|
|
return reg_write(reg::kSigGenerator_genlock_format, format, readbak, 10); |
|
|
|
} |
|
|
|
xs_error_code_t Xsync::SigGenerator_getGenlockFormat(GenlockFormat_t &format) { |
|
|
|
uint32_t readbak = 0; |
|
|
|
auto ecode = reg_read(reg::kSigGenerator_genlock_format, readbak, 10); |
|
|
|
if (ecode != kxs_ec_success) return ecode; |
|
|
|
format = (GenlockFormat_t)readbak; |
|
|
|
return ecode; |
|
|
|
} |
|
|
|
xs_error_code_t Xsync::SigGenerator_setTimecodeFormat(TimecodeFormat_t format) { return Basic_setTimecodeFormat(format); } |
|
|
|
xs_error_code_t Xsync::SigGenerator_getTimecodeFormat(TimecodeFormat_t &format) { |
|
|
|
uint32_t readbak = 0; |
|
|
|
auto ecode = reg_read(reg::kSigGenerator_timecode_format, readbak, 10); |
|
|
|
if (ecode != kxs_ec_success) return ecode; |
|
|
|
format = (TimecodeFormat_t)readbak; |
|
|
|
return ecode; |
|
|
|
} |
|
|
|
xs_error_code_t Xsync::CameraSyncPacketGeneratorModule_setTriggerSig(camera_sync_packet_generator_module::TriggerSigType_t sig) { |
|
|
|
uint32_t readbak = 0; |
|
|
|
DO_XSYNC(reg_write(reg::kcamera_sync_out_camera_sync_select, sig, readbak, 10)); |
|
|
@ -824,7 +707,7 @@ xs_error_code_t Xsync::TTLOutputModule1_setSrcSigType(SignalType_t source) { |
|
|
|
} else { |
|
|
|
DO_XSYNC(reg_write(reg::kreg_ttlout1_signal_process_mode, 3, 10)); // 转发模式
|
|
|
|
} |
|
|
|
DO_XSYNC_REG_WRITE(reg::kreg_ttlout1_input_signal_select, source); |
|
|
|
REG_WRITE(reg::kreg_ttlout1_input_signal_select, source); |
|
|
|
} |
|
|
|
xs_error_code_t Xsync::TTLOutputModule2_setSrcSigType(SignalType_t source) { |
|
|
|
if (source == SIGNAL_TTLIN1 || source == SIGNAL_TTLIN2 || source == SIGNAL_TTLIN3 || source == SIGNAL_TTLIN4) { |
|
|
@ -832,7 +715,7 @@ xs_error_code_t Xsync::TTLOutputModule2_setSrcSigType(SignalType_t source) { |
|
|
|
} else { |
|
|
|
DO_XSYNC(reg_write(reg::kreg_ttlout2_signal_process_mode, 3, 10)); // 转发模式
|
|
|
|
} |
|
|
|
DO_XSYNC_REG_WRITE(reg::kreg_ttlout2_input_signal_select, source); |
|
|
|
REG_WRITE(reg::kreg_ttlout2_input_signal_select, source); |
|
|
|
} |
|
|
|
xs_error_code_t Xsync::TTLOutputModule3_setSrcSigType(SignalType_t source) { |
|
|
|
if (source == SIGNAL_TTLIN1 || source == SIGNAL_TTLIN2 || source == SIGNAL_TTLIN3 || source == SIGNAL_TTLIN4) { |
|
|
@ -840,7 +723,7 @@ xs_error_code_t Xsync::TTLOutputModule3_setSrcSigType(SignalType_t source) { |
|
|
|
} else { |
|
|
|
DO_XSYNC(reg_write(reg::kreg_ttlout3_signal_process_mode, 3, 10)); // 转发模式
|
|
|
|
} |
|
|
|
DO_XSYNC_REG_WRITE(reg::kreg_ttlout3_input_signal_select, source); |
|
|
|
REG_WRITE(reg::kreg_ttlout3_input_signal_select, source); |
|
|
|
} |
|
|
|
xs_error_code_t Xsync::TTLOutputModule4_setSrcSigType(SignalType_t source) { |
|
|
|
if (source == SIGNAL_TTLIN1 || source == SIGNAL_TTLIN2 || source == SIGNAL_TTLIN3 || source == SIGNAL_TTLIN4) { |
|
|
@ -848,33 +731,33 @@ xs_error_code_t Xsync::TTLOutputModule4_setSrcSigType(SignalType_t source) { |
|
|
|
} else { |
|
|
|
DO_XSYNC(reg_write(reg::kreg_ttlout4_signal_process_mode, 3, 10)); // 转发模式
|
|
|
|
} |
|
|
|
DO_XSYNC_REG_WRITE(reg::kreg_ttlout4_input_signal_select, source); |
|
|
|
REG_WRITE(reg::kreg_ttlout4_input_signal_select, source); |
|
|
|
} |
|
|
|
|
|
|
|
xs_error_code_t Xsync::TTLOutputModule1_getSrcSigType(SignalType_t &source) { DO_XSYNC_REG_READ(reg::kreg_ttlout1_input_signal_select, source); } |
|
|
|
xs_error_code_t Xsync::TTLOutputModule2_getSrcSigType(SignalType_t &source) { DO_XSYNC_REG_READ(reg::kreg_ttlout2_input_signal_select, source); } |
|
|
|
xs_error_code_t Xsync::TTLOutputModule3_getSrcSigType(SignalType_t &source) { DO_XSYNC_REG_READ(reg::kreg_ttlout3_input_signal_select, source); } |
|
|
|
xs_error_code_t Xsync::TTLOutputModule4_getSrcSigType(SignalType_t &source) { DO_XSYNC_REG_READ(reg::kreg_ttlout4_input_signal_select, source); } |
|
|
|
xs_error_code_t Xsync::TTLOutputModule1_getSrcSigType(SignalType_t &source) { REG_READ(reg::kreg_ttlout1_input_signal_select, source); } |
|
|
|
xs_error_code_t Xsync::TTLOutputModule2_getSrcSigType(SignalType_t &source) { REG_READ(reg::kreg_ttlout2_input_signal_select, source); } |
|
|
|
xs_error_code_t Xsync::TTLOutputModule3_getSrcSigType(SignalType_t &source) { REG_READ(reg::kreg_ttlout3_input_signal_select, source); } |
|
|
|
xs_error_code_t Xsync::TTLOutputModule4_getSrcSigType(SignalType_t &source) { REG_READ(reg::kreg_ttlout4_input_signal_select, source); } |
|
|
|
|
|
|
|
xs_error_code_t Xsync::TTLOutputModule1_setFreqDivision(uint32_t div) { DO_XSYNC_REG_WRITE(reg::kreg_ttlout1_pllout_freq_division_ctrl, div); } |
|
|
|
xs_error_code_t Xsync::TTLOutputModule2_setFreqDivision(uint32_t div) { DO_XSYNC_REG_WRITE(reg::kreg_ttlout2_pllout_freq_division_ctrl, div); } |
|
|
|
xs_error_code_t Xsync::TTLOutputModule3_setFreqDivision(uint32_t div) { DO_XSYNC_REG_WRITE(reg::kreg_ttlout3_pllout_freq_division_ctrl, div); } |
|
|
|
xs_error_code_t Xsync::TTLOutputModule4_setFreqDivision(uint32_t div) { DO_XSYNC_REG_WRITE(reg::kreg_ttlout4_pllout_freq_division_ctrl, div); } |
|
|
|
xs_error_code_t Xsync::TTLOutputModule1_setFreqDivision(uint32_t div) { REG_WRITE(reg::kreg_ttlout1_pllout_freq_division_ctrl, div); } |
|
|
|
xs_error_code_t Xsync::TTLOutputModule2_setFreqDivision(uint32_t div) { REG_WRITE(reg::kreg_ttlout2_pllout_freq_division_ctrl, div); } |
|
|
|
xs_error_code_t Xsync::TTLOutputModule3_setFreqDivision(uint32_t div) { REG_WRITE(reg::kreg_ttlout3_pllout_freq_division_ctrl, div); } |
|
|
|
xs_error_code_t Xsync::TTLOutputModule4_setFreqDivision(uint32_t div) { REG_WRITE(reg::kreg_ttlout4_pllout_freq_division_ctrl, div); } |
|
|
|
|
|
|
|
xs_error_code_t Xsync::TTLOutputModule1_getFreqDivision(uint32_t &div) { DO_XSYNC_REG_READ(reg::kreg_ttlout1_pllout_freq_division_ctrl, div); } |
|
|
|
xs_error_code_t Xsync::TTLOutputModule2_getFreqDivision(uint32_t &div) { DO_XSYNC_REG_READ(reg::kreg_ttlout2_pllout_freq_division_ctrl, div); } |
|
|
|
xs_error_code_t Xsync::TTLOutputModule3_getFreqDivision(uint32_t &div) { DO_XSYNC_REG_READ(reg::kreg_ttlout3_pllout_freq_division_ctrl, div); } |
|
|
|
xs_error_code_t Xsync::TTLOutputModule4_getFreqDivision(uint32_t &div) { DO_XSYNC_REG_READ(reg::kreg_ttlout4_pllout_freq_division_ctrl, div); } |
|
|
|
xs_error_code_t Xsync::TTLOutputModule1_getFreqDivision(uint32_t &div) { REG_READ(reg::kreg_ttlout1_pllout_freq_division_ctrl, div); } |
|
|
|
xs_error_code_t Xsync::TTLOutputModule2_getFreqDivision(uint32_t &div) { REG_READ(reg::kreg_ttlout2_pllout_freq_division_ctrl, div); } |
|
|
|
xs_error_code_t Xsync::TTLOutputModule3_getFreqDivision(uint32_t &div) { REG_READ(reg::kreg_ttlout3_pllout_freq_division_ctrl, div); } |
|
|
|
xs_error_code_t Xsync::TTLOutputModule4_getFreqDivision(uint32_t &div) { REG_READ(reg::kreg_ttlout4_pllout_freq_division_ctrl, div); } |
|
|
|
|
|
|
|
xs_error_code_t Xsync::TTLOutputModule1_setFreqMultiplication(uint32_t multi) { DO_XSYNC_REG_WRITE(reg::kreg_ttlout1_pllout_freq_multiplication_ctrl, multi); } |
|
|
|
xs_error_code_t Xsync::TTLOutputModule2_setFreqMultiplication(uint32_t multi) { DO_XSYNC_REG_WRITE(reg::kreg_ttlout2_pllout_freq_multiplication_ctrl, multi); } |
|
|
|
xs_error_code_t Xsync::TTLOutputModule3_setFreqMultiplication(uint32_t multi) { DO_XSYNC_REG_WRITE(reg::kreg_ttlout3_pllout_freq_multiplication_ctrl, multi); } |
|
|
|
xs_error_code_t Xsync::TTLOutputModule4_setFreqMultiplication(uint32_t multi) { DO_XSYNC_REG_WRITE(reg::kreg_ttlout4_pllout_freq_multiplication_ctrl, multi); } |
|
|
|
xs_error_code_t Xsync::TTLOutputModule1_setFreqMultiplication(uint32_t multi) { REG_WRITE(reg::kreg_ttlout1_pllout_freq_multiplication_ctrl, multi); } |
|
|
|
xs_error_code_t Xsync::TTLOutputModule2_setFreqMultiplication(uint32_t multi) { REG_WRITE(reg::kreg_ttlout2_pllout_freq_multiplication_ctrl, multi); } |
|
|
|
xs_error_code_t Xsync::TTLOutputModule3_setFreqMultiplication(uint32_t multi) { REG_WRITE(reg::kreg_ttlout3_pllout_freq_multiplication_ctrl, multi); } |
|
|
|
xs_error_code_t Xsync::TTLOutputModule4_setFreqMultiplication(uint32_t multi) { REG_WRITE(reg::kreg_ttlout4_pllout_freq_multiplication_ctrl, multi); } |
|
|
|
|
|
|
|
xs_error_code_t Xsync::TTLOutputModule1_getFreqMultiplication(uint32_t &multi) { DO_XSYNC_REG_READ(reg::kreg_ttlout1_pllout_freq_multiplication_ctrl, multi); } |
|
|
|
xs_error_code_t Xsync::TTLOutputModule2_getFreqMultiplication(uint32_t &multi) { DO_XSYNC_REG_READ(reg::kreg_ttlout2_pllout_freq_multiplication_ctrl, multi); } |
|
|
|
xs_error_code_t Xsync::TTLOutputModule3_getFreqMultiplication(uint32_t &multi) { DO_XSYNC_REG_READ(reg::kreg_ttlout3_pllout_freq_multiplication_ctrl, multi); } |
|
|
|
xs_error_code_t Xsync::TTLOutputModule4_getFreqMultiplication(uint32_t &multi) { DO_XSYNC_REG_READ(reg::kreg_ttlout4_pllout_freq_multiplication_ctrl, multi); } |
|
|
|
xs_error_code_t Xsync::TTLOutputModule1_getFreqMultiplication(uint32_t &multi) { REG_READ(reg::kreg_ttlout1_pllout_freq_multiplication_ctrl, multi); } |
|
|
|
xs_error_code_t Xsync::TTLOutputModule2_getFreqMultiplication(uint32_t &multi) { REG_READ(reg::kreg_ttlout2_pllout_freq_multiplication_ctrl, multi); } |
|
|
|
xs_error_code_t Xsync::TTLOutputModule3_getFreqMultiplication(uint32_t &multi) { REG_READ(reg::kreg_ttlout3_pllout_freq_multiplication_ctrl, multi); } |
|
|
|
xs_error_code_t Xsync::TTLOutputModule4_getFreqMultiplication(uint32_t &multi) { REG_READ(reg::kreg_ttlout4_pllout_freq_multiplication_ctrl, multi); } |
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
* TimecodeInputModule * |
|
|
@ -905,15 +788,15 @@ xs_error_code_t Xsync::ExternalTimecode_getSource(InputInterface_t &timecode_sel |
|
|
|
} |
|
|
|
return kxs_ec_success; |
|
|
|
} |
|
|
|
xs_error_code_t Xsync::ExternalTimecode_setFormat(TimecodeFormat_t format) { DO_XSYNC_REG_WRITE(reg::external_timecode_format, format); } |
|
|
|
xs_error_code_t Xsync::ExternalTimecode_getFormat(TimecodeFormat_t &format) { DO_XSYNC_REG_READ(reg::external_timecode_format, format); } |
|
|
|
xs_error_code_t Xsync::ExternalTimecode_setFormat(TimecodeFormat_t format) { REG_WRITE(reg::external_timecode_format, format); } |
|
|
|
xs_error_code_t Xsync::ExternalTimecode_getFormat(TimecodeFormat_t &format) { REG_READ(reg::external_timecode_format, format); } |
|
|
|
xs_error_code_t Xsync::ExternalTimecode_readCode(XsyncTimecode_t &timecode) { return readtimecode(reg::external_timecode_code0, reg::external_timecode_code1, timecode); } |
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
* InternalTimecode * |
|
|
|
*******************************************************************************/ |
|
|
|
xs_error_code_t Xsync::InternalTimecode_setFormat(TimecodeFormat_t format) { DO_XSYNC_REG_WRITE(reg::internal_timecode_format, format); } |
|
|
|
xs_error_code_t Xsync::InternalTimecode_getFormat(TimecodeFormat_t &format) { DO_XSYNC_REG_READ(reg::internal_timecode_format, format); } |
|
|
|
xs_error_code_t Xsync::InternalTimecode_setFormat(TimecodeFormat_t format) { REG_WRITE(reg::internal_timecode_format, format); } |
|
|
|
xs_error_code_t Xsync::InternalTimecode_getFormat(TimecodeFormat_t &format) { REG_READ(reg::internal_timecode_format, format); } |
|
|
|
xs_error_code_t Xsync::InternalTimecode_setCode(XsyncTimecode_t timecode) { |
|
|
|
DO_XSYNC(reg_write(reg::internal_timecode_en, 0)); |
|
|
|
DO_XSYNC(writetimecode(reg::internal_timecode_data0, reg::internal_timecode_data1, timecode)); |
|
|
@ -925,14 +808,50 @@ xs_error_code_t Xsync::InternalTimecode_getCode(XsyncTimecode_t &timecode) { ret |
|
|
|
/*******************************************************************************
|
|
|
|
* SysTimecode * |
|
|
|
*******************************************************************************/ |
|
|
|
xs_error_code_t Xsync::SysTimecode_setSource(uint32_t sig) { DO_XSYNC_REG_WRITE(reg::sys_timecode_select, sig); } |
|
|
|
xs_error_code_t Xsync::SysTimecode_getSource(uint32_t &sig) { DO_XSYNC_REG_READ(reg::sys_timecode_select, sig); } |
|
|
|
xs_error_code_t Xsync::SysTimecode_readFormat(TimecodeFormat_t &format) { DO_XSYNC_REG_READ(reg::sys_timecode_format, format); } |
|
|
|
xs_error_code_t Xsync::SysTimecode_setSource(uint32_t sig) { REG_WRITE(reg::sys_timecode_select, sig); } |
|
|
|
xs_error_code_t Xsync::SysTimecode_getSource(uint32_t &sig) { REG_READ(reg::sys_timecode_select, sig); } |
|
|
|
xs_error_code_t Xsync::SysTimecode_readFormat(TimecodeFormat_t &format) { REG_READ(reg::sys_timecode_format, format); } |
|
|
|
xs_error_code_t Xsync::SysTimecode_readCode(XsyncTimecode_t &timecode) { return readtimecode(reg::sys_timecode_data0, reg::sys_timecode_data1, timecode); } |
|
|
|
/*******************************************************************************
|
|
|
|
* TimecodeOutputModule * |
|
|
|
*******************************************************************************/ |
|
|
|
xs_error_code_t Xsync::TimecodeOutputModule_setBncOutputLevel(int level) { DO_XSYNC_REG_WRITE(reg::timecode_output_bnc_outut_level_select, level); } |
|
|
|
xs_error_code_t Xsync::TimecodeOutputModule_getBncOutputLevel(int &level) { DO_XSYNC_REG_READ(reg::timecode_output_bnc_outut_level_select, level); } |
|
|
|
xs_error_code_t Xsync::TimecodeOutputModule_setHeadphoneOutputLevel(int level) { DO_XSYNC_REG_WRITE(reg::timecode_output_headphone_outut_level_select, level); } |
|
|
|
xs_error_code_t Xsync::TimecodeOutputModule_getHeadphoneOutputLevel(int &level) { DO_XSYNC_REG_READ(reg::timecode_output_headphone_outut_level_select, level); } |
|
|
|
xs_error_code_t Xsync::TimecodeOutputModule_setBncOutputLevel(int level) { REG_WRITE(reg::timecode_output_bnc_outut_level_select, level); } |
|
|
|
xs_error_code_t Xsync::TimecodeOutputModule_getBncOutputLevel(int &level) { REG_READ(reg::timecode_output_bnc_outut_level_select, level); } |
|
|
|
xs_error_code_t Xsync::TimecodeOutputModule_setHeadphoneOutputLevel(int level) { REG_WRITE(reg::timecode_output_headphone_outut_level_select, level); } |
|
|
|
xs_error_code_t Xsync::TimecodeOutputModule_getHeadphoneOutputLevel(int &level) { REG_READ(reg::timecode_output_headphone_outut_level_select, level); } |
|
|
|
/*******************************************************************************
|
|
|
|
* GENLOCK * |
|
|
|
*******************************************************************************/ |
|
|
|
xs_error_code_t Xsync::ExternalGenlock_detectFreq(float &freq) { return readfreq(reg::external_genlock_freq, freq); } |
|
|
|
xs_error_code_t Xsync::InternalGenlock_setFormat(GenlockFormat_t format) { return reg_write(reg::internal_genlock_format, format); } |
|
|
|
xs_error_code_t Xsync::InternalGenlock_getFormat(GenlockFormat_t &format) { REG_READ(reg::internal_genlock_format, format); } |
|
|
|
xs_error_code_t Xsync::SysGenlock_setSrc(SignalType_t sig) { return reg_write(reg::sys_genlock_source, sig); } |
|
|
|
xs_error_code_t Xsync::SysGenlock_getSrc(SignalType_t &sig) { REG_READ(reg::sys_genlock_source, sig); } |
|
|
|
xs_error_code_t Xsync::SysGenlock_readFreq(float &freq) { return readfreq(reg::sys_genlock_freq, freq); } |
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
* INTERNAL_CLOCK * |
|
|
|
*******************************************************************************/ |
|
|
|
xs_error_code_t Xsync::InternalClock_setFreq(float freq) { |
|
|
|
double T = 1.0 / freq; |
|
|
|
double T_ns = T * 1000 * 1000 * 1000; |
|
|
|
double cnt = T_ns / 100 + 0.5; // 10MHZ <=> 100ns
|
|
|
|
|
|
|
|
uint32_t cnt_u32 = uint32_t(cnt); |
|
|
|
return reg_write(reg::internal_clock_freq, cnt_u32); |
|
|
|
return kxs_ec_success; |
|
|
|
} |
|
|
|
xs_error_code_t Xsync::InternalClock_getFreq(float &freq) { return readfreq(reg::internal_clock_freq, freq); } |
|
|
|
/*******************************************************************************
|
|
|
|
* SysClock * |
|
|
|
*******************************************************************************/ |
|
|
|
xs_error_code_t Xsync::SysClock_setSrc(SignalType_t sig) { return reg_write(reg::sys_clock_source, sig); } |
|
|
|
xs_error_code_t Xsync::SysClock_getSrc(SignalType_t &sig) { REG_READ(reg::sys_clock_source, sig); } |
|
|
|
xs_error_code_t Xsync::SysClock_setTriggerEdge(TriggerEdge_t edge) { return reg_write(reg::sys_clock_trigger_edge_select, edge); } |
|
|
|
xs_error_code_t Xsync::SysClock_getTriggerEdge(TriggerEdge_t &edge) { return _reg_read(reg::sys_clock_trigger_edge_select, edge); } |
|
|
|
xs_error_code_t Xsync::SysClock_setFreqDivision(uint32_t div) { return reg_write(reg::sys_clock_freq_division_ctrl, div); } |
|
|
|
xs_error_code_t Xsync::SysClock_geFreqtDivision(uint32_t &div) { return _reg_read(reg::sys_clock_freq_division_ctrl, div); } |
|
|
|
xs_error_code_t Xsync::SysClock_setFreqMultiplication(uint32_t muti) { return reg_write(reg::sys_clock_freq_multiplication_ctrl, muti); } |
|
|
|
xs_error_code_t Xsync::SysClock_getFreqMultiplication(uint32_t &muti) { return _reg_read(reg::sys_clock_freq_multiplication_ctrl, muti); } |
|
|
|
xs_error_code_t Xsync::SysClock_readFreq(float &freq) { return readfreq(reg::sys_clock_outfreq_detect, freq); } |
|
|
|
xs_error_code_t Xsync::SysClock_readInputFreq(float &freq) { return readfreq(reg::sys_clock_infreq_detect, freq); } |