Browse Source

update

master
zhaohe 1 year ago
parent
commit
36482b0407
  1. 2
      include/xsync_v2_sig_type.hpp
  2. 6
      src/xsync_v2_sig_type.cpp
  3. 24
      xsync.cpp
  4. 24
      xsync.hpp

2
include/xsync_v2_sig_type.hpp

@ -113,7 +113,7 @@ typedef enum {
SIGNAL_INTERNAL_TIMECODE_FREQ = 8, // 内部timecode频率信号
SIGNAL_INTERNAL_GENLOCK_FREQ = 9, // 内部genlock频率信号
SIGNAL_INTERNAL_FREQ_SIG = 10, // 内部信号发生器内部频率信号
SIGNAL_INTERNAL_CLOCK_SIG = 10, // 内部信号发生器内部频率信号
/*******************************************************************************
* SYS时钟 *

6
src/xsync_v2_sig_type.cpp

@ -88,7 +88,9 @@ list<string> GenlockFormatStrSet() {
* Signal_Type *
*******************************************************************************/
static map<string, SignalType_t> SignalTypeMap = {{"SIGNAL_TTLIN1", SIGNAL_TTLIN1},
static map<string, SignalType_t> SignalTypeMap = {{"SIGNAL_LOGIC0", SIGNAL_LOGIC0},
{"SIGNAL_LOGIC1", SIGNAL_LOGIC1},
{"SIGNAL_TTLIN1", SIGNAL_TTLIN1},
{"SIGNAL_TTLIN2", SIGNAL_TTLIN2},
{"SIGNAL_TTLIN3", SIGNAL_TTLIN3},
{"SIGNAL_TTLIN4", SIGNAL_TTLIN4},
@ -96,7 +98,7 @@ static map<string, SignalType_t> SignalTypeMap = {{"SIGNAL_TTLIN1", SIGNAL_TTLIN
{"SIGNAL_EXT_TIMECODE_FREQ", SIGNAL_EXT_TIMECODE_FREQ},
{"SIGNAL_INTERNAL_TIMECODE_FREQ", SIGNAL_INTERNAL_TIMECODE_FREQ},
{"SIGNAL_INTERNAL_GENLOCK_FREQ", SIGNAL_INTERNAL_GENLOCK_FREQ},
{"SIGNAL_INTERNAL_FREQ_SIG", SIGNAL_INTERNAL_FREQ_SIG},
{"SIGNAL_INTERNAL_CLOCK_SIG", SIGNAL_INTERNAL_CLOCK_SIG},
{"SIGNAL_SYS_CLK_OUTPUT", SIGNAL_SYS_CLK_OUTPUT},
{"SIGNAL_SYS_GENLOCK_OUTPUT", SIGNAL_SYS_GENLOCK_OUTPUT},
{"SIGNAL_SYS_TIMECODE_FREQ_OUTPUT", SIGNAL_SYS_TIMECODE_FREQ_OUTPUT},

24
xsync.cpp

@ -522,8 +522,9 @@ xs_error_code_t Xsync::readfreq(uint32_t reg, float &freqfloat) {
}
if (freq_cnt != 0) {
uint32_t freq_10x = ((uint32_t)(1.0 / (freq_cnt * 1.0 / (10 * 1000 * 1000))) * 10 + 0.5); //+0.5是因为c++ 小数强转成整数时是取整,而非四舍五入
freqfloat = freq_10x / 10.0;
uint32_t freq_1000x = ((1.0 / (freq_cnt * 1.0 / (10 * 1000 * 1000))) * 1000 + 0.5); //+0.5是因为c++ 小数强转成整数时是取整,而非四舍五入
// ZLOGI(TAG, "freq_10x %f", freq_10x);
freqfloat = freq_1000x / 1000.0;
} else {
freqfloat = 0;
}
@ -759,6 +760,16 @@ xs_error_code_t Xsync::TTLOutputModule2_getFreqMultiplication(uint32_t &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); }
xs_error_code_t Xsync::TTLOutputModule1_readInFreq(float &freq) { return readfreq(reg::kreg_ttlout1_sig_in_freq_detect, freq); }
xs_error_code_t Xsync::TTLOutputModule2_readInFreq(float &freq) { return readfreq(reg::kreg_ttlout2_sig_in_freq_detect, freq); }
xs_error_code_t Xsync::TTLOutputModule3_readInFreq(float &freq) { return readfreq(reg::kreg_ttlout3_sig_in_freq_detect, freq); }
xs_error_code_t Xsync::TTLOutputModule4_readInFreq(float &freq) { return readfreq(reg::kreg_ttlout4_sig_in_freq_detect, freq); }
xs_error_code_t Xsync::TTLOutputModule1_readOutFreq(float &freq) { return readfreq(reg::kreg_ttlout1_sig_out_freq_detect, freq); }
xs_error_code_t Xsync::TTLOutputModule2_readOutFreq(float &freq) { return readfreq(reg::kreg_ttlout2_sig_out_freq_detect, freq); }
xs_error_code_t Xsync::TTLOutputModule3_readOutFreq(float &freq) { return readfreq(reg::kreg_ttlout3_sig_out_freq_detect, freq); }
xs_error_code_t Xsync::TTLOutputModule4_readOutFreq(float &freq) { return readfreq(reg::kreg_ttlout4_sig_out_freq_detect, freq); }
/*******************************************************************************
* TimecodeInputModule *
*******************************************************************************/
@ -825,8 +836,13 @@ xs_error_code_t Xsync::TimecodeOutputModule_getHeadphoneOutputLevel(int &level)
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_setSrc(uint32_t source) { return reg_write(reg::sys_genlock_source, source); }
xs_error_code_t Xsync::SysGenlock_getSrc(uint32_t &extern_or_internal) {
REG_READ(reg::sys_genlock_source, extern_or_internal);
return kxs_ec_success;
}
xs_error_code_t Xsync::SysGenlock_readFreq(float &freq) { return readfreq(reg::sys_genlock_freq, freq); }
/*******************************************************************************

24
xsync.hpp

@ -392,6 +392,16 @@ class Xsync {
xs_error_code_t TTLOutputModule3_getFreqMultiplication(uint32_t &multi);
xs_error_code_t TTLOutputModule4_getFreqMultiplication(uint32_t &multi);
xs_error_code_t TTLOutputModule1_readInFreq(float &freq);
xs_error_code_t TTLOutputModule2_readInFreq(float &freq);
xs_error_code_t TTLOutputModule3_readInFreq(float &freq);
xs_error_code_t TTLOutputModule4_readInFreq(float &freq);
xs_error_code_t TTLOutputModule1_readOutFreq(float &freq);
xs_error_code_t TTLOutputModule2_readOutFreq(float &freq);
xs_error_code_t TTLOutputModule3_readOutFreq(float &freq);
xs_error_code_t TTLOutputModule4_readOutFreq(float &freq);
/*******************************************************************************
* GENLOCK *
*******************************************************************************/
@ -425,13 +435,13 @@ class Xsync {
*
* @param sig
* :
* SIGNAL_EXT_GENLOCK_FREQ
* SIGNAL_INTERNAL_GENLOCK_FREQ
* 0:
* 1:
*
* @return xs_error_code_t
*/
xs_error_code_t SysGenlock_setSrc(SignalType_t sig);
xs_error_code_t SysGenlock_getSrc(SignalType_t &sig);
xs_error_code_t SysGenlock_setSrc(uint32_t source);
xs_error_code_t SysGenlock_getSrc(uint32_t &source);
/**
* @brief Genlock频率
@ -446,9 +456,9 @@ class Xsync {
*******************************************************************************/
/**
* @brief
*
*
* @param freq HZ,0.1HZ
* @return xs_error_code_t
* @return xs_error_code_t
*/
xs_error_code_t InternalClock_setFreq(float freq);
xs_error_code_t InternalClock_getFreq(float &freq);
@ -467,7 +477,7 @@ class Xsync {
* SIGNAL_TTLIN2
* SIGNAL_TTLIN3
* SIGNAL_TTLIN4
* SIGNAL_INTERNAL_FREQ_SIG
* SIGNAL_INTERNAL_CLOCK_SIG
* SIGNAL_SYS_GENLOCK_OUTPUT
*
* @return xs_error_code_t

Loading…
Cancel
Save