2026.02.27 version

This commit is contained in:
2026-03-02 21:40:25 +08:00
parent 222dda1e43
commit 2c4b7bf36a
201 changed files with 43202 additions and 1054 deletions

View File

@@ -0,0 +1,242 @@
/* Copyright (C)
* 2026 - marco <marco.tbls@gmail.com>
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
#ifndef _PROTOCOL_DYT6210_H__
#define _PROTOCOL_DYT6210_H__
#pragma pack(1)
typedef struct _target {
unsigned char target_type;
char conf_thr;
short x;
short y;
short w;
short h;
}ST_AI_TARGE;
typedef struct _target_info {
unsigned char head[2];
unsigned char addr;
unsigned char length;
unsigned char cmd[2];
unsigned int frame_index;//当前AI检测的图像帧编号
unsigned long long frameRef;//当前帧的时间戳
unsigned char image_type;
unsigned char target_num;
ST_AI_TARGE targets[10];
unsigned char modelid; //模型ID
unsigned char crc;
unsigned char tail;
}ST_AI_TARGES;
typedef struct _t_target {
unsigned char target_type;
unsigned char conf_thr;
unsigned short w;
unsigned short h;
unsigned char noise;
unsigned char receved;
unsigned short x;
unsigned short y;
}ST_TRACK_TARGE;
typedef struct _track {
unsigned char head[2];
unsigned char addr;
unsigned char length;
unsigned char cmd[2];
unsigned int frame_index;//当前跟踪的图像帧编号
unsigned long long frameRef;//当前帧的时间戳
unsigned char image_type;
unsigned char track_status;
unsigned char track_num;
unsigned int fly_dis;
unsigned char fly_time;
unsigned char target_num;
ST_TRACK_TARGE targets[10];
unsigned char crc;
unsigned char tail;
}ST_TRACK_TARGES;
typedef struct _mnn_info {
unsigned char head[2];
unsigned char addr;
unsigned char length;
unsigned char cmd[2];
unsigned int frame_index;
unsigned long long frameRef;
unsigned char template_num;
unsigned char id;
unsigned short x1;
unsigned short y1;
unsigned short x2;
unsigned short y2;
unsigned char crc;
unsigned char tail;
}ST_MNN_TARGES;
typedef struct _cmp_data_source {
unsigned short tag; /* 2B 标记 */
unsigned int addr; /* 4B 地址 */
unsigned short length; /* 2B 长度 */
}ST_CMP_D_SOURCE;
typedef struct _cmp_data1 {
unsigned char Pcode[4]; /* 4B 数据源1: 产品代号: 0x44 0x59 0x18 0x42(DY6210) */
unsigned int Mcode; /* 4B 数据源1: 机器码: 0x00 */
short temp; /* 2B 数据源1: 温度 */
unsigned short status; /* 2B 数据源1: 组件结果: 0: 正常 1: 异常 */
unsigned char reserved[20]; /* 20B 数据源1: 预留 */
}ST_CMP_D1;
typedef struct _cmp_data2 {
unsigned short year; /* 2B 数据源2: 系统时间: 年 */
unsigned char month; /* 1B 数据源2: 系统时间: 月 */
unsigned char day; /* 1B 数据源2: 系统时间: 日 */
unsigned int sec; /* 4B 数据源2: 系统时间: 秒 s */
unsigned int pps; /* 4B 数据源2: 系统时间: 时间戳 us */
unsigned int uptime; /* 4B 数据源2: 本次工作时间 s */
unsigned int titaltime; /* 4B 数据源2: 累积工作时间 s */
unsigned int powerup_num; /* 4B 数据源2: 累积开机次数 */
unsigned char FPGA_V0_xx; /* 1B 数据源2: FPGA xx 外部版本 */
unsigned char FPGA_V0_yy; /* 1B 数据源2: FPGA yy */
unsigned char FPGA_V0_mm; /* 1B 数据源2: FPGA mm */
unsigned char FPGA_V0_nn; /* 1B 数据源2: FPGA nn */
unsigned short FPGA_V0_year; /* 2B 数据源2: FPGA year */
unsigned char FPGA_V0_month; /* 1B 数据源2: FPGA month */
unsigned char FPGA_V0_day; /* 1B 数据源2: FPGA day */
unsigned char FPGA_V1_xx; /* 1B 数据源2: FPGA xx 内部版本 */
unsigned char FPGA_V1_yy; /* 1B 数据源2: FPGA yy */
unsigned char FPGA_V1_mm; /* 1B 数据源2: FPGA mm */
unsigned short FPGA_V1_year; /* 2B 数据源2: FPGA year */
unsigned char FPGA_V1_month; /* 1B 数据源2: FPGA month */
unsigned char FPGA_V1_day; /* 1B 数据源2: FPGA day */
unsigned char FPGA_V1_hour; /* 1B 数据源2: FPGA hour */
unsigned char FPGA_V1_min; /* 1B 数据源2: FPGA minute */
unsigned char FPGA_V1_src; /* 1B 数据源2: FPGA second */
union {
//unsigned char _FPGA_status[2];
struct {
unsigned char pl_ddr : 1; /* 数据源2: FPGA b[0] : pl端ddr : 0: 正常 1: 故障 */
unsigned char ps_ddr : 1; /* 数据源2: FPGA b[1] : ps端ddr : 0: 正常 1: 故障 */
unsigned char flash : 1; /* 数据源2: FPGA b[2] : flash: 0: 正常 1: 故障 */
unsigned char emmc : 1; /* 数据源2: FPGA b[3] : emmc: 0: 正常 1: 故障 */
unsigned char comm_srio : 1; /* 数据源2: FPGA b[4] : 与通信控制板的SRIO link: 0: 正常 1: 故障 */
unsigned char dsp_srio : 1; /* 数据源2: FPGA b[5] : 与DSP的SRIO link: 0: 正常 1: 故障 */
unsigned char cm_ir : 1; /* 数据源2: FPGA b[6] : 红外输入: 0: 正常 1: 故障 */
unsigned char cm_rgb : 1; /* 数据源2: FPGA b[7] : 多光谱输入: 0: 正常 1: 故障 */
unsigned char comm_net : 1; /* 数据源2: FPGA b[0] : 与通信控制网络通信 : 0: 正常 1: 故障 */
unsigned char earth_uart: 1; /* 数据源2: FPGA b[1] : 与地测串口通信 : 0: 正常 1: 故障 */
unsigned char comm_uart : 1; /* 数据源2: FPGA b[2] : 与通信控制串口通信 : 0: 正常 1: 故障 */
unsigned char dsp_uart : 1; /* 数据源2: FPGA b[3] : 与DSP串口通信 : 0: 正常 1: 故障 */
unsigned char reserved : 4; /* 数据源2: FPGA b[4-7] : 保留 */
}FPGA_status;
};
union {
//unsigned char _DSP_status[20];
struct {
unsigned char ddr : 1; /* 数据源2: DSP b[0] : DDR: 0: 正常 1: 故障 */
unsigned char flash : 1; /* 数据源2: DSP b[1] : FLASH: 0: 正常 1: 故障 */
unsigned char srio_init : 1; /* 数据源2: DSP b[2] : SRIO初始化: 0: 正常 1: 故障 */
unsigned char recv_param: 1; /* 数据源2: DSP b[3] : 接收参数行: 0: 正常 1: 故障 */
unsigned char fpga_uart : 1; /* 数据源2: DSP b[4] : 与FPGA 串口通信: 0: 正常 1: 故障 */
unsigned char reserved0 : 3; /* 数据源2: DSP b[5-7] : 保留 */
unsigned char dsp_v0[8]; /* 数据源2: DSP 软件版本(外部) */
unsigned char dsp_v1[10]; /* 数据源2: DSP 软件版本(内部) */
unsigned char reserved1; /* 数据源2: 预留 */
}DSP_status;
};
}ST_CMP_D2;
typedef struct _cmp_data3 {
unsigned int pps; /* 4B 数据源3: pps 微秒 */
unsigned int sec; /* 4B 数据源3: 秒 */
}ST_CMP_D3;
typedef struct _cmp_data4 {
unsigned short tag; /* 2B 数据源4: 标记 */
unsigned short length; /* 2B 数据源4: 长度: 有效源长度和时间戳 */
unsigned char info[252]; /* 252B 数据源4: 识别信息: */
}ST_CMP_D4;
typedef struct _cmp_data5 {
unsigned short tag; /* 2B 数据源5: 标记 */
unsigned short length; /* 2B 数据源5: 长度: 有效源长度和时间戳 */
unsigned char info[508]; /* 508B 数据源5: 跟踪结果信息: */
}ST_CMP_D5;
typedef struct _cmp_data6 {
unsigned short tag; /* 2B 数据源6: 标记 */
unsigned short length; /* 2B 数据源6: 长度: 有效源长度和时间戳 */
unsigned char info[124]; /* 124B 数据源6: 惯导信息: */
}ST_CMP_D6;
typedef struct _cmp_data7 {
unsigned short tag; /* 2B 数据源7: 标记 */
unsigned short length; /* 2B 数据源7: 长度: 有效源长度和时间戳 */
unsigned char info[60]; /* 60B 数据源7: 扩充信息: */
}ST_CMP_D7;
typedef struct _cmp_data8 {
unsigned short tag; /* 2B 数据源8: 标记 */
unsigned short length; /* 2B 数据源8: 长度: 有效源长度和时间戳 */
unsigned char info[60]; /* 60B 数据源8: 扩充信息: */
}ST_CMP_D8;
typedef struct _cmp_data9 {
unsigned short tag; /* 2B 数据源9: 标记 */
unsigned short length; /* 2B 数据源9: 长度: 有效源长度和时间戳 */
unsigned char info[60]; /* 60B 数据源9: 扩充信息: */
}ST_CMP_D9;
typedef struct _cmp_dataA {
unsigned short tag; /* 2B 数据源A: 标记 */
unsigned short length; /* 2B 数据源A: 长度: 有效源长度和时间戳 */
unsigned char info[32]; /* 32B 数据源A: 扩充信息: */
}ST_CMP_DA;
typedef struct _cameralinke_param {
unsigned short head[4]; /* 0 - 7 帧头: 0x55AA 0xAA55 0xAAAA 0x5555 */
unsigned int index; /* 8 - 11 帧编号 */
unsigned char type[2]; /* 12 - 13 参数行类别: 0x73 0x62 */
unsigned char ver_xx; /* 14 - 14 版本号: xx */
unsigned char ver_yy; /* 15 - 15 版本号: yy */
unsigned int param_size; /* 16 - 19 参数行长度: 1280 * 2 */
unsigned int source_num; /* 20 - 23 数据源个数: 10 */
ST_CMP_D_SOURCE source[10]; /* 24 - 103 数据 */
ST_CMP_D1 D1; /* 104 - 135 数据源1 - 设备信息 */
ST_CMP_D2 D2; /* 136 - 199 数据源2 - 测试信息 */
ST_CMP_D3 D3; /* 200 - 207 数据源3 - PPS时间戳信息 */
ST_CMP_D4 D4; /* 208 - 463 数据源4 - 识别结果信息 */
ST_CMP_D5 D5; /* 464 - 975 数据源5 - 跟踪结果信息 */
ST_CMP_D6 D6; /* 976 - 1103 数据源6 - 预留信息 */
ST_CMP_D7 D7; /* 1104 - 1167 数据源7 - 预留信息 */
ST_CMP_D8 D8; /* 1168 - 1231 数据源8 - 预留信息 */
ST_CMP_D9 D9; /* 1232 - 1295 数据源9 - 预留信息 */
ST_CMP_DA DA; /* 1296 - 1331 数据源A - 预留信息 */
unsigned int crc; /* 1332 - 1335 校验 */
unsigned short tail[4]; /* 1336 - 1343 帧尾: 0x5555 0xAAAA 0xAA55 0x55AA */
}ST_CAMERALINK_PARAM;
Q_DECLARE_METATYPE(ST_CAMERALINK_PARAM)
#pragma pack()
#endif /* _PROTOCOL_DYT6210_H__ */

View File

@@ -0,0 +1,291 @@
#ifndef PCIEDATAMANAGER_H
#define PCIEDATAMANAGER_H
#include <QObject>
#include "pciedef.h"
#include "systempciesdk_global.h"
//#include "ConditionVariableQueue.h"
struct PCIeDataObjectPrivate;
class SYSTEMSDKSHARED_EXPORT PCIeDataManager
{
public:
PCIeDataManager(ePCIeFrameworkType type = eXDMA_MM, QObject* parent = nullptr);
//******************************************采集接口***************************************************
/**
* @brief StartCapture 开始采集
* @param channelIndex 【in】 采集卡上的光模块端口号(范围0~3),一张采集卡有4个光模块,即4个通道
* @param isCaptureTestImg 【in】 选择采集测试画或者实时图像(测试画由采集卡构造,不需连接前端相机), 默认此处传false(实时图像)
* @param imgW 【in】 要采集的图像宽
* @param imgH 【in】 要采集的图像高
* @param imgType 【in】 要采集的图像类型(取决于前端相机或板卡提供的是什么类型)
* @param err 【out】 如果采集失败,此处为对应的错误码
* @param callback 【out】采集到的图像数据的回调
* @param user 【in】 回调函数的执行实体
* @param pImgData 【in】 存储图像的数据帧缓存,用户开辟后传入,采集过程中保持有效
* @return 【out】 采集是否成功
*/
bool StartCapture(uint channelIndex,
bool isCaptureTestImg,
int imgW,
int imgH,
ePixelType imgType,
eErrorCode& err,
CaptureImgDataCallback callback,
void* user,
char* pImgData);
/**
* @brief StartCapture 开始采集(回调函数增加错误帧指示)
* @param channelIndex 【in】 采集卡上的光模块端口号(范围0~3),一张采集卡有4个光模块,即4个通道
* @param isCaptureTestImg 【in】 选择采集测试画或者实时图像(测试画由采集卡构造,不需连接前端相机), 默认此处传false(实时图像)
* @param imgW 【in】 要采集的图像宽
* @param imgH 【in】 要采集的图像高
* @param imgType 【in】 要采集的图像类型(取决于前端相机或板卡提供的是什么类型)
* @param err 【out】 如果开始采集失败,此处为对应的错误码
* @param callback 【out】采集到的图像数据的回调
* @param user 【in】 回调函数的执行实体
* @param pImgData 【in】 存储图像的数据帧缓存,用户开辟后传入,采集过程中保持有效
* @return 【out】 采集是否成功
*/
bool StartCapture(uint channelIndex,
bool isCaptureTestImg,
int imgW,
int imgH,
ePixelType imgType,
eErrorCode& err,
CaptureImgDataCallbackErrDet callback,
void* user,
char* pImgData);
/**
* @brief 停止采集
* @param channelIndex [in] 采集卡光模块端口号: 0 ~ 7
*/
void StopCapture(int channelIndex);
//******************************************注入接口***************************************************
/**
* @brief StartInject 开始注入
* @param channelIndex 【in】 采集卡上的光模块端口号(范围0~3),一张采集卡有4个光模块,即4个通道
* @param injectFps 【in】注入帧率
* @param imgW 【in】 要注入的图像宽
* @param imgH 【in】 要注入的图像高
* @param imgType 【in】 要注入的图像类型(取决于注入的raw文件中的图像是什么类型)
* @param linePeriod 【in】 注入图像的行周期(用通用PCIe光纤上位机计算)
* @param injectData 【in】要注入的图像数据
* @param err 【out】若操作不成功,对应的错误码
* @return 【out】 返回操作是否成功
*/
bool StartInject(uint channelIndex, int injectFps, int imgW, int imgH, ePixelType imgType, int linePeriod, char* injectData, eErrorCode& err);
/**
* @brief 【接口2】 停止注入
* @param channelIndex [in] 采集卡光模块端口号: 0 ~ 7
*/
void StopInject(int channelIndex);
/**
* @brief 关闭采集卡
*/
void CloseCard();
/**
* @brief 【接口4】 控制命令下发注入---与接口1/2/3独立
* @param iChannelIndex [in] 采集卡光模块端口号: 0 ~ 7
* @param cmdData [in] 控制命令
* @return
*/
bool WriteControlCmd(int iChannelIndex, QByteArray cmdData);
/**
* @brief 开始对某端口的采集数据进行录像存盘
* @param channelIndex [in] 采集卡光模块端口号: 0 ~ 7
*/
bool StartRecord(int channelIndex);
/**
* @brief 停止对某端口的采集数据进行录像存盘
* @param channelIndex [in] 采集卡光模块端口号: 0 ~ 7
*/
void StopRecord(int channelIndex);
/** @brief 通过设置回调来获取每路光纤端口的系统状态数据(如32字节、128字节系统状态根据项目实际要求变化),与 StartCapture() 接口独立。
* @brief SetSystemStatusCallback
* @param channelIndex [in] 采集卡光模块端口号: 0 ~ 7
* @param callback [in] 回调函数
* @param user [in] 回调的parent
* @param isOpen [in] true/false 是否开启回调
*/
void SetSystemStatusCallback(int channelIndex, SystemStateCallback callback, void* user, bool isOpen);
/** --------------------该接口为非必要接口------------------------
* @brief 更新模拟热像仪参数,可实时更新或多次更新(只有在需要模拟热像仪参数注入时才调用,属于非必要接口)
* @param 采集卡光纤端口号
* @param isInjectParamSimulate [in]是否注入该模拟参数
* @param param [in]模拟热像仪参数
*/
void UpdateParamSimulate(int channelindex, bool isInjectParamSimulate, THERMAL_IMG_PARAMS param);
/** --------------------该接口为非必要接口------------------------
* @brief 获取延时信息 返回结构体
*/
InjectDelayStatusInfo* GetInjectDelayStatus(int channelIndex);
/** --------------------该接口为非必要接口------------------------
* @brief 获取延时信息 返回结构体
*/
CaptureDelayStatusInfo* GetCaptureDelayStatus(int channelIndex);
/** --------------------该接口为非必要接口------------------------
* @brief Pcie_ReadData 从采集卡DDR上读取一段数据
* @param address
* @param size
* @param buffer
* @return
*/
bool ReadData(unsigned int address, unsigned int size, unsigned char* buffer);
/** --------------------该接口为非必要接口------------------------
* @brief Pcie_WriteData 向采集卡DDR上写入一段数据
* @param address
* @param size
* @param buffer
* @return
*/
bool WriteData(unsigned int address, unsigned int size, unsigned char* buffer);
/** 读Bar0寄存器
* @brief ReadReg
* @param [in] address 寄存器地址
* @return [out] 寄存器值
*/
uint ReadReg(unsigned int address);
/** 写Bar0寄存器
* @brief WriteReg
* @param [in] address 寄存器地址
* @param [out]buffer 待写入的值
* @return [out]写入的字节数
*/
int WriteReg(unsigned int address, int regValue);
void SetImgDisplayDelayTest(int channelIndex, bool isStart);
/** 设置采集全屏控件
* @brief SetCaptureFullScreenWgt
* @param channelIndex
* @param openglwgt
*/
void SetCaptureFullScreenWgt(int channelIndex, void* openglwgt);
/** 设置注入全屏控件
* @brief SetInjectFullScreenWgt
* @param channelIndex
* @param openglwgt
*/
void SetInjectFullScreenWgt(int channelIndex, void* openglwgt);
/** 采集截图
* @brief ImgSnapShot
* @param iChannelIndex
*/
void ImgSnapShot(int iChannelIndex);
/**
* @brief 【xdma_mm方式】 获取工控机中的所有采集卡列表
* @param [out] devpath 设备路径集合
* @return 采集卡数量
*/
int GetDevices(char** devPaths);
/**
* @brief 【xdma_mm方式】 打开采集卡
* @param[in] devicepath 采集卡路径
* @return 是否成功
*/
bool OpenCard(char* devicepath);
/**
* @brief 【Riffa_Steam方式】 获取工控机中的所有采集卡列表
* @param [out] list 采集卡集合,其中fpga_info_list的num_fpgas表示读取到了几张采集卡
*/
bool GetDevices(fpga_info_list* list);
/**
* @brief 【Riffa_Steam方式】 用于打开采集卡
* @param [in] cardId 通过fpga_info_list.id[i]来选择采集卡id
* @return
*/
bool OpenCard(int cardId);
/**
* @brief 采集卡是否打开
* @return
*/
bool IsCardOpen();
/** 某通道是否开始注入
* @brief IsStartInject
* @param channelIndex
* @return
*/
bool IsStartInject(int channelIndex);
/** 某通道是否开始采集
* @brief IsStartInject
* @param channelIndex
* @return
*/
bool IsStartCapture(int channelIndex);
/** 某通道是否开始保存注入和采集日志
* @brief IsStartInject
* @param channelIndex
* @return
*/
void SetSaveLog(bool isSaved);
/** 设置界面图像显示是否叠加字符
* @brief SetOsdHidden
* @param isHidden
*/
void SetOsdHidden(bool isHidden);
void SetShowErrorFrame(bool isShow);
//用与分配使用的cpu核
uint GetIdealCpuCoreIndex();
void ResetUsedCpuCoreIndex(uint usedCoreIndex);
private:
PCIeDataObjectPrivate* m_pDataObject;
bool PreProcCapture(GFrameFormat &captureParam, uint channelIndex, bool isCaptureTestImg, int imgW, int imgH, ePixelType imgType);
};
#endif // PCIEDATAMANAGER_H

View File

@@ -0,0 +1,226 @@
#ifndef _PCIeDef_H_
#define _PCIeDef_H_
//typedef unsigned char uchar;
typedef unsigned short uint16;
typedef unsigned int uint32;
//typedef unsigned long ulong;
#include <QString>
#define ControlRegBaseAddr 1024*1024 //控制寄存器基地址
#define CaptureChannelRegBaseAddr 0x1000 + 1024*1024 //采集端口基地址--首地址(通道0地址)
#define InjectChannelRegBaseAddr 0x11000 + 1024*1024 //注入端口基地址--首地址(通道0地址)
#define UpgradeChannelRegBaseAddr 0x20000 + 1024*1024 //在线升级端口基地址--首地址
//#define Fpga_Freq 156250000 //FPGA时钟频率 用于计算图像帧周期
#define InjectChannelXRegBaseAddr 0x20000 //注入端口X基地址
#define ChannelCacheNum 8 //每个通道的缓存区数量
#define CaptureChannelNum 4 //采集 端口数
#define InjectChannelNum 4 //注入 端口数
#define PcieDDR_EachBuffSize 4096 * 1024 * 5 //Pcie DDR上每个buff的大小 20M
#define MaxImgHeight 3840
#define MaxImgWidth 2160
#define DefaultImageWidth 640
#define DefaultImageHeight 512
#define DefaultMaxImageSize (3840*2160*4)
#pragma pack(push,1)
typedef struct tagCaptureDelayStatusInfo //采集延时状态信息
{
double uiHostCaptureDelay; //上位机采集延时 单位:秒
double uiHostDealInterruptDelay; //上位机响应中断的延时 单位:秒
double uiFPGACostTime1; //FPGA耗时测量1 单位:秒
double uiFPGACostTime2; //FPGA耗时测量2 单位:秒
int iHostDealImgToDraw; //(自己计算)上位机从采集到图像到开始送到显卡绘制的时间
} CaptureDelayStatusInfo;
#pragma pack(pop)
#pragma pack(push,1)
typedef struct tagInjectDelayStatusInfo //采集延时状态信息
{
double uiHostInjectDelay; //注入延时 单位:秒 CPU 开始写入 → CPU 写入 1 帧数据
double uiFPGADealInterruptDelay; //FPGA响应中断的延时 单位:秒
double uiFPGACostTime; //耗时测量1 单位:秒 FPGA输出1帧图像
double uiCPUSendInterCostTime; //耗时测量2 单位:秒 CPU开始发送数据到发送中断的时间
} InjectDelayStatusInfo;
#pragma pack(pop)
#pragma pack(push,1)
typedef struct tagThermalImgParams //模拟热像参数
{
char szHeader[4]; //标志头 55 aa aa 55 bc bc 52 5a
uint32 iFrameNo; //帧编号
char szReserved01[2]; //保留字节
char szProtocolVersion[2]; //标准协议版本
uint16 sCmdLineBytes; //参数行字节总数
char szReserved02[4]; //保留字节
char szSoftVersion[2]; //软件版本号
char szSoftVersionYear[2]; //软件版本 日期年
char szSoftVersionMonthDay[2]; //软件版本 日期月 日
char szReserved03[10]; //保留字节
uint16 sVideoType; //视频源类型
uint16 sImgWidth; //图像宽度
uint16 sImgHeight; //图像高度
uint16 sFocus; //焦距值
uint16 sPixelSize; //像元尺寸
uint16 sPixalAngularResolution; //像元角分辨率
char szReserved04[4]; //保留字节
float fServoOra; //伺服方位角
float fServoPitch; //伺服俯仰角
float fNortheastSkyOra; //东北天方位角
float fNortheastSkyPitch; //东北天俯仰角
float fCarrierRoll; //载体横滚角
float fCarrierPitch; //载体俯仰角
float fCarrierOra; //载体方位角
/**协议属于不定长协议, 长度默认为图像width*ePt*1 帧尾5a 5a a5 a5 bc bc 52 5a在注入时加上***/
} THERMAL_IMG_PARAMS;
#pragma pack(pop)
//系统状态数据的回调函数
typedef void (*SystemStateCallback)(int channelIndex, const QByteArray& state, void* userData);
/**
* @brief 采集图像数据的回调函数
* @param channelIndex 采集图像的通道号
* @param imgData 采集图像的缓存指针
* @param userData 用户实例指针
*/
typedef void (*CaptureImgDataCallback)(int channelIndex, const char* imgData, void* userData);
/**
* @brief 采集图像数据的回调函数(错误帧指示)
* @param channelIndex 采集图像的通道号
* @param imgData 采集图像的缓存指针
* @param userData 用户实例指针
* @param isErrFrame 该帧是否为错误帧true:错误帧 false:正常帧
*/
typedef void (*CaptureImgDataCallbackErrDet)(int channelIndex, const char* imgData, void* userData, bool isErrFrame);
// 采集模式
enum eCaptureMode
{
eNormalImg = 0, // 正常图像
eTestImg = 1, // 测试图像
};
//注入模式
enum iInjectMode
{
iNormalImg = 0, // 正常图像
iSingleImg = 1, //单帧模式
iTestImg = 2, // 测试画模式
};
//测试图像类型
enum eTestImgType
{
eIncreasingNumber = 0, // 递增数
eCheckerBoard = 1, // 棋盘格
eScrollBar = 2 //滚动条
};
// 字节序
enum eByteOrder
{
eBO_LittleEndian = 1, // 低字节在前
eBO_BigEndian = 2, // 高字节在前
};
// 图像像素格式
enum ePixelType
{
ePT_YUV422 = 0, // packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
ePT_Y8, // Y , 8bpp
ePT_Y16, // Y , 16bpp
ePT_Y16Y8, //Y16+Y8
ePT_BGR24, // packed RGB 8:8:8, 24bpp, RGBRGB...
ePT_Y32, // packed RGB 8:8:8, 24bpp, RGBRGB...
};
// 帧格式
struct GFrameFormat
{
int nChannelIndex; //通道号 1~8
int nImageWidth; // 图像宽度
int nImageHeight; // 图像高度
int nParamStartLine; // 参数起始行
int nParamLineCount; // 注入文件参数行数
int nFrameRate; // 帧率
int nBytesOfPixel; // 像素字节数
int nImgLinePeriod; //图像行周期
eByteOrder eBO; // 字节序
ePixelType ePT; // 像素类型
eCaptureMode eCpMode; //采集模式
iInjectMode iInMode; //注入模式
eTestImgType eTestImageType; //测试图像类型
GFrameFormat()
{
nImageWidth = 1280;
nImageHeight = 1024;
nParamStartLine = 0;
nParamLineCount = 0;
nFrameRate = 50;
nBytesOfPixel = 2;
nImgLinePeriod = 0;
nChannelIndex = 0;
}
};
// Maximum number of RIFFA FPGAs
#define RIFFA_MAX_NUM_FPGAS (5)
//Riffa框架对应的结构体 Holds FPGA information for installed RIFFA FPGAs
struct fpga_info_list
{
int num_fpgas;
int id[RIFFA_MAX_NUM_FPGAS];
int num_chnls[RIFFA_MAX_NUM_FPGAS];
char name[RIFFA_MAX_NUM_FPGAS][16];
int vendor_id[RIFFA_MAX_NUM_FPGAS];
int device_id[RIFFA_MAX_NUM_FPGAS];
};
typedef struct fpga_info_list fpga_info_list;
#define BoardStateControl_BaseAddr 0x0000 //板卡状态控制寄存器 基地址
#define FiberPort_BaseAddr 0x0001 //光纤端口控制寄存器 基地址
#define ChannelConfig_BaseAddr 0x0002 //通道配置寄存器 基地址
#define DDRControl_BaseAddr 0x0003 //DDR控制寄存器 基地址
//PCIe光纤采集整体框架说明
enum ePCIeFrameworkType
{
eXDMA_MM,
eRiffa_Stream,
eXDMA_Stream,
};
//采集异常状态
enum eErrorCode
{
eNotFoundCard, //未检测到采集卡(未安装采集卡驱动、主板未安装卡)
eCardStateError, //采集卡状态异常(采集卡系统时钟未锁定、DDR初始化失败、通道Link失败、通道编码错误等等)
eCapture_ExceedSingleChannelMaxBandwidthError, //单路采集数据帧率超过采集卡光模块单通道能提供的最大带宽
eCapture_ExceedTotalInterEventFrequencyError, //采集总帧率超过上位机能响应的硬件中断频率(上位机能响应的硬件中断频率为500帧/秒左右,即所有通道的采集图像帧率总和应该小于500帧/秒)
eInject_BuffIsFull, //采集卡的注入buff缓存已满请重复注入一下当前帧
eNULL, //未发生错误
};
#endif // _CommDef_H_

View File

@@ -0,0 +1,13 @@
#ifndef SYSTEMPCIESDK_GLOBAL_H
#define SYSTEMPCIESDK_GLOBAL_H
#include <QtCore/qglobal.h>
#if defined(SYSTEMPCIE_LIBRARY)
#define SYSTEMSDKSHARED_EXPORT Q_DECL_EXPORT
#else
#define SYSTEMSDKSHARED_EXPORT Q_DECL_IMPORT
#endif
#endif // SYSTEMPCIESDK_GLOBAL_H