From 6f3e46f8e2a119941a5d3a026f4d146728653786 Mon Sep 17 00:00:00 2001 From: zhaohe Date: Tue, 26 Mar 2024 16:11:05 +0800 Subject: [PATCH] update --- include/ixsync.hpp | 10 ++++++++++ include/xsync_v2.hpp | 4 +++- src/xsync_v2.cpp | 20 ++++++++++++++++++++ 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/include/ixsync.hpp b/include/ixsync.hpp index f930b18..91674df 100644 --- a/include/ixsync.hpp +++ b/include/ixsync.hpp @@ -25,6 +25,12 @@ typedef struct { bool placeholder; } xsync_config_t; +typedef struct { + uint32_t main; + uint32_t sub; + uint32_t fix; +} version_t; + class IXsync { public: virtual ~IXsync() {} @@ -76,6 +82,10 @@ class IXsync { virtual xs_error_code_t readMac(string &mac) = 0; virtual xs_error_code_t storageConfig() = 0; + virtual xs_error_code_t readSDKVersion(version_t &version) = 0; + virtual xs_error_code_t readARMSoftwareVersion(version_t &version) = 0; + virtual xs_error_code_t readFPGASoftwareVersion(version_t &version) = 0; + // virtual xs_error_code_t changeNetworkConfig(string ip, string mask, string gateway) = 0; public: diff --git a/include/xsync_v2.hpp b/include/xsync_v2.hpp index a6a2279..2499350 100644 --- a/include/xsync_v2.hpp +++ b/include/xsync_v2.hpp @@ -9,12 +9,14 @@ #include #include #include -#include #include +#include // #include "i_xsync_udp.hpp" #include "ixsync.hpp" +#define VERSION(main, sub, fix) (main << 16 | sub << 8 | fix << 0) +#define PC_VERSION VERSION(3, 1, 0) namespace xsync { using namespace std; diff --git a/src/xsync_v2.cpp b/src/xsync_v2.cpp index 929da80..5a59f49 100644 --- a/src/xsync_v2.cpp +++ b/src/xsync_v2.cpp @@ -268,6 +268,26 @@ class Xsync : public IXsync { return kxs_ec_success; } + virtual xs_error_code_t readSDKVersion(version_t &version) { + version.main = PC_VERSION >> 16; + version.sub = (PC_VERSION >> 8) & 0xff; + version.fix = PC_VERSION & 0xff; + } + virtual xs_error_code_t readARMSoftwareVersion(version_t &version) { + uint32_t version_u32; + DO_XSYNC(reg_read(reg::ksoftware_version, version_u32, 10)); + version.main = version_u32 >> 16; + version.sub = (version_u32 >> 8) & 0xff; + version.fix = version_u32 & 0xff; + } + virtual xs_error_code_t readFPGASoftwareVersion(version_t &version) { + uint32_t version_u32; + DO_XSYNC(reg_read(reg::kfpga_info_reg0, version_u32, 10)); + version.main = version_u32 >> 16; + version.sub = (version_u32 >> 8) & 0xff; + version.fix = version_u32 & 0xff; + } + virtual void registerOnTimecodeMsgCallback(xsync_on_timecode_msg_t cb) override { m_on_timecode_msg_cb = cb; } virtual void registerOnCameraSyncMsgCallback(xsync_on_camera_sync_msg_t cb) override { m_on_camera_sync_msg_cb = cb; } virtual void registerOnRecordSigChangeMsgCallback(xsync_on_record_sig_change_msg_t cb) override { m_on_record_sig_change_msg_cb = cb; }