You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
579 lines
14 KiB
579 lines
14 KiB
#ifndef MAINWINDOW_H
|
|
#define MAINWINDOW_H
|
|
|
|
#include <QMainWindow>
|
|
#include <QTimer>
|
|
#include <QTime>
|
|
#include <QLabel>
|
|
#include <QList>
|
|
#include <QString>
|
|
#include <QDebug>
|
|
#include <QSettings>
|
|
#include <QtConcurrent/QtConcurrent>
|
|
#include <QMessageBox>
|
|
#include <QFileDialog>
|
|
#include <QColormap>
|
|
#include <QProgressDialog>
|
|
#include <iostream>
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <QFuture>
|
|
#include <QFutureWatcher>
|
|
#include <QMovie>
|
|
#include <QLCDNumber>
|
|
#include <QElapsedTimer>
|
|
|
|
#include "qcustomplot.h"
|
|
#include "include/model/hardware/core/lowLevelApi/TrxBoard.h"
|
|
#include "hdf5Scenario/hdf5Scenario.h"
|
|
#include "api.h"
|
|
|
|
#define MESSAGE_BOX(M) \
|
|
emit showMessage(M)
|
|
|
|
#define TRX_RLY_MPS_E2PROM_SIZE_BYTE 256U
|
|
#define PROBE_E2PROM_BYTE_ORIGIN 0U
|
|
#define PROBE_E2PROM_BYTE_SIZE 4096U
|
|
#define TOTAL_PROBE_ELEMENTS 32U
|
|
|
|
#define SCENARIO_FILE_PATH "scenarioFilePath"
|
|
#define SCENARIOS_FOLDER_PATH "scenariosFolderPath"
|
|
#define BITE_SCEN_FILE_PATH "biteScenarioFilePath"
|
|
#define FRAME_LOG_PATH "frameLogPath"
|
|
#define ADC_LOG_PATH "adcLogPath"
|
|
#define PROBE_LOG_PATH "prbRelayLogPath"
|
|
#define BITE_FILE_PATH "biteFilePath"
|
|
#define FPGA_FILE_PATH "fpgaFilePath"
|
|
#define MCS_FILE_PATH "mcsFilePath"
|
|
#define PRB_FILE_PATH "prbFilePath"
|
|
#define REG_ACCESS_SEL "regAccessType"
|
|
|
|
|
|
#define START "Start"
|
|
#define STOP "Stop"
|
|
|
|
#define PAUSE "Pause"
|
|
#define RESUME "Resume"
|
|
|
|
#define ON "On"
|
|
#define OFF "Off"
|
|
|
|
#define THSD_State_Update "THSD State Update"
|
|
|
|
#define DACS_ENABLE "DACs_Enable"
|
|
|
|
#define UPDATE "Update"
|
|
|
|
#define VALID "Valid"
|
|
|
|
#define ENABLE "Enable"
|
|
#define DISABLE "Disable"
|
|
|
|
#define LOG_COUNT_FROM_FIRST 50U
|
|
|
|
#define TRANSFER_LENGTH 128 * 1024
|
|
#define TRANSFER_RATE 30.0f
|
|
#define RAM_BUFFER_OFFSET 0U
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
namespace Ui { class MainWindow; }
|
|
QT_END_NAMESPACE
|
|
|
|
using namespace std;
|
|
|
|
class MainWindow : public QMainWindow
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
MainWindow(QWidget *parent = nullptr);
|
|
~MainWindow();
|
|
|
|
private:
|
|
const QList<quint8> crcArray = {0x4, 0x0, 0x13, 0x0, 0x27, 0x0, 0x28, 0x0, 0xEB, 0x1, \
|
|
0xAC, 0x5, 0xAC, 0x6, 0x4C, 0x6, 0xB0, 0x6, 0xB2};
|
|
|
|
Ui::MainWindow *ui;
|
|
|
|
TrxBoard _trx;
|
|
|
|
QMovie *movie;
|
|
|
|
QSettings* _settings;
|
|
|
|
UltraSoundDevice* _usd;
|
|
|
|
QMutex _mutex;
|
|
|
|
QCPColorMap *_colorMap;
|
|
|
|
QFutureWatcher<void> biteLogWatcher;
|
|
|
|
QFutureWatcher<void> dmaLogWatcher;
|
|
|
|
QFutureWatcher<void> programWatcher;
|
|
|
|
QFutureWatcher<void> mcsProgWatcher;
|
|
|
|
QFutureWatcher<void> mcsReadWatcher;
|
|
|
|
static QThread* _uiThread;
|
|
|
|
QFile* _headerLogFile;
|
|
|
|
QFile* _headerEndurance;
|
|
|
|
QFile* _statusLogPSFile;
|
|
|
|
QTimer* _timeout;
|
|
|
|
QEventLoop loop;
|
|
|
|
QTimer _flashTimer;
|
|
|
|
EmulatorProperties* _emul;
|
|
|
|
BoardsCtrlMngt* _bCtrl;
|
|
|
|
BpiFlash* _bpi;
|
|
|
|
SpiFlash* _spi;
|
|
|
|
SupervisorRbValue* _supRbValue;
|
|
|
|
MpsFaultStatus* _faultStatus;
|
|
|
|
HealthStatus* _healStatus;
|
|
|
|
FpgaCodeVersion* _version;
|
|
|
|
StatusVec* _vec;
|
|
|
|
PrbCase* _prb;
|
|
|
|
eSelectProbe currentSelectedPrb;
|
|
|
|
bool trxIdWrEn;
|
|
bool trxPidWrEn;
|
|
bool trxPcbVesionWrEn;
|
|
bool trxSerialNoWrEn;
|
|
bool trxMasterCodeVersionWrEn;
|
|
bool trxSlaveCodeVersionWrEn;
|
|
|
|
bool prbCtrlIdWrEn;
|
|
bool prbCtrlPidWrEn;
|
|
bool prbCtrlPcbVesionWrEn;
|
|
bool prbCtrlSerialNoWrEn;
|
|
|
|
bool mpsIdWrEn;
|
|
bool mpsPidWrEn;
|
|
bool mpsPcbVesionWrEn;
|
|
bool mpsSerialNoWrEn;
|
|
bool mpsUcCodeVersionWrEn;
|
|
bool mpsSupCodeVersionWrEn;
|
|
|
|
void setScenarioCompare(const QString& scenPath);
|
|
|
|
void timeout();
|
|
|
|
void delay(quint16 ms);
|
|
|
|
void delayEvents(quint16 ms);
|
|
|
|
const QString enum2String (ePg state) const;
|
|
|
|
void changeLabelTextColor(QLabel* label, QColor color);
|
|
|
|
void afeConfig (AfeConfig &afeConfig);
|
|
|
|
void setAfeConfig (void);
|
|
|
|
void logPcie(QString logPath, quint32 logCount, QLCDNumber* lcdCounter);
|
|
|
|
void continuousFrameRepresent(void);
|
|
|
|
QByteArray str2ByteArray (QString& str);
|
|
|
|
QString uint2IdString (quint16& id);
|
|
|
|
QString byteArray2InfoString (QByteArray& arr);
|
|
|
|
QByteArray crcCalc (const QByteArray array);
|
|
|
|
void trxCrcWrite (const QByteArray array, quint32 offset);
|
|
|
|
void prbCtrlCrcWrite (const QByteArray array, quint32 offset);
|
|
|
|
void mpsCrcWrite (const QByteArray array, quint32 offset);
|
|
|
|
QByteArray e2promClear(quint32 length);
|
|
|
|
QString releaseCodeVersion (quint32 &value);
|
|
|
|
void getProbeColor (const QBrush brush, const int item);
|
|
|
|
void lcdStyle(QLCDNumber* lcdNum);
|
|
|
|
void biteLogThreadFinished();
|
|
|
|
void dmaLogThreadFinished();
|
|
|
|
void dmaLogLayoutVisible(bool show);
|
|
|
|
void fpgaProgram(QString &path);
|
|
|
|
void mcsProgram(QString &path);
|
|
|
|
void mcsRead(QString &path);
|
|
|
|
void programThreadFinish();
|
|
|
|
void mcsThreadFinish();
|
|
|
|
void mcsReadFinish();
|
|
|
|
void mcsButtonsEnable(bool Enable);
|
|
|
|
void slaveProgButtonsEnable(bool Enable);
|
|
|
|
void logButtonsEnable (bool Enable);
|
|
|
|
bool hvPermission();
|
|
|
|
QString _fpgaProgramFolder = "/home/hasis/Desktop/hardware/hwCode";
|
|
QString _mcsProgramFolder = "/home/hasis/Desktop/hardware/hwCode";
|
|
QString _mcsVerifyFolder = "/home/hasis/Desktop/hardware/hwCode";
|
|
QString _scenarioFolder = "/home/hasis/Desktop/hardware/Scenarios";
|
|
QString _scenFolder = "/home/hasis/Desktop/hardware/Log/ScenariosFolder";
|
|
QString _emulFolder = "/home/hasis/Desktop/hardware/emulator";
|
|
QString _BITeScenFolder = "/home/hasis/Desktop/hardware/BITe_IQ";
|
|
QString _BITeIqFolder = "/home/hasis/Desktop/hardware/BITe_IQ";
|
|
QString _frameLogFolder = "/home/hasis/Desktop/hardware/Log/DMA";
|
|
QString _biteLogFolder = "/home/hasis/Desktop/hardware/Log/BITe";
|
|
QString _adcLoggerFolder = "/home/hasis/Desktop/hardware/Log/ADC";
|
|
QString _probeLoggerFolder = "/home/hasis/Desktop/hardware/Log/ProbeElements";
|
|
QString _statusVectorPSPath = "/home/hasis/Desktop/hardware/Log/statusVectorPS";
|
|
QString _headerLogPath = "/home/hasis/Desktop/hardware/Log/frameHeader/headerLog.csv";
|
|
QString _headerEndurancePath = "/home/hasis/Desktop/hardware/Log/header_endurance/headerLog.csv";
|
|
QString _probeRomPath = "/home/hasis/Desktop/hardware/ProbeRom";
|
|
|
|
QVector<QByteArray> _dmaBuffer;
|
|
QByteArray _lastBuffer;
|
|
QList<QByteArray> _frame;
|
|
QList<QByteArray> _bufferedFrame;
|
|
quint32 _dmaLogCount;
|
|
quint16 _frameCount;
|
|
quint16 _batchIdBuff;
|
|
double_t fps;
|
|
double_t fpsBuf;
|
|
bool _dmaLog;
|
|
bool _dmaRun;
|
|
bool _dmaShow;
|
|
bool _headerLogEn;
|
|
bool _headerEndur;
|
|
bool _statusLogEn;
|
|
bool _fpsFlag;
|
|
bool _firstFrameEn;
|
|
bool _programFlag;
|
|
bool _discardTempTest;
|
|
bool _discardAdcLog;
|
|
|
|
// uncrustify off
|
|
private slots:
|
|
|
|
void exitApp();
|
|
|
|
void setScenario(const QString& h5Path);
|
|
|
|
void getFramePacket (QByteArray packet);
|
|
|
|
void getSramBinaryCreateFlag (void);
|
|
|
|
void getRegisterCsvCompareFlag (void);
|
|
|
|
void getSramVerifyMessage(QString message);
|
|
|
|
void getPrbChange();
|
|
|
|
void getFrameLost();
|
|
|
|
void getLabelState(QLabel* label, QString str, QColor color);
|
|
|
|
void getProgrammingGif(QLabel* label);
|
|
|
|
void flashTimerShot(qint32 ms);
|
|
|
|
void flashTimeout(QString message);
|
|
|
|
void flashStopTimer();
|
|
|
|
void catchGtReset(quint32 progCnt, quint32 taskItr, quint16 delayPerTask);
|
|
|
|
void catchStatusLog(quint32 progCnt, quint32 taskItr, quint16 delayPerTask, quint16 scenStartDuration);
|
|
|
|
void catchEndurance(quint32 progCnt, quint32 taskItr, quint16 delayPerTask);
|
|
|
|
void catchAdcLog(void);
|
|
|
|
void catchStatusLogPS(const quint32& statLogPS);
|
|
|
|
void on_rbtn_reg_toggled(bool checked);
|
|
|
|
void on_rbtn_offset_toggled(bool checked);
|
|
|
|
void on_btn_readReg_clicked();
|
|
|
|
void on_btn_writeReg_clicked();
|
|
|
|
void on_btn_fpgaBrowse_clicked();
|
|
|
|
void on_btn_fpgaProgram_clicked();
|
|
|
|
void newMessage(QString message);
|
|
|
|
void on_cb_selectedProbe_currentIndexChanged(int index);
|
|
|
|
void on_btn_updateRdbackValue_clicked();
|
|
|
|
void on_btn_supJump_clicked();
|
|
|
|
void on_btn_setAo_clicked();
|
|
|
|
void on_btn_getFpgaVersion_clicked();
|
|
|
|
void on_btn_setAtgcMode_clicked();
|
|
|
|
void on_btn_scenStart_clicked();
|
|
|
|
void on_btn_emulator_clicked();
|
|
|
|
void on_btn_dmaShow_clicked();
|
|
|
|
void on_btn_dmaLogLast_clicked();
|
|
|
|
void on_btn_afeRead_clicked();
|
|
|
|
void on_chk_continuousShowing_clicked();
|
|
|
|
void show3d();
|
|
|
|
void show2d();
|
|
|
|
void on_chk_mpsInit_clicked();
|
|
|
|
void on_btn_scenBrowse_clicked();
|
|
|
|
void on_btn_setScenario_clicked();
|
|
|
|
void on_btn_setScenVerification_clicked();
|
|
|
|
void on_btn_setIdx_clicked();
|
|
|
|
// void on_btn_trxRomInfoWrite_clicked();
|
|
|
|
// void on_btn_mpsRomInfoWrite_clicked();
|
|
|
|
// void on_btn_prbCtrlRomInfoWrite_clicked();
|
|
|
|
void on_btn_prbRomImpulseRead_clicked();
|
|
|
|
void on_btn_trxRomId_clicked();
|
|
|
|
// void on_btn_trxRomInfoRead_clicked();
|
|
|
|
void on_btn_mpsRomId_clicked();
|
|
|
|
// void on_btn_mpsRomInfoRead_clicked();
|
|
|
|
void on_btn_prbCtrlRomId_clicked();
|
|
|
|
// void on_btn_prbCtrlRomInfoRead_clicked();
|
|
|
|
void on_btn_prbRomIdRead_clicked();
|
|
|
|
void on_btn_scenInfo_clicked();
|
|
|
|
void on_btn_setBiteLog_clicked();
|
|
|
|
void on_btn_biteBrowse_clicked();
|
|
|
|
void on_btn_setAdcLog_clicked();
|
|
|
|
void on_btn_gtReg_clicked();
|
|
|
|
void on_btn_frameLogBrowse_clicked();
|
|
|
|
void on_btn_biteScenBrowse_clicked();
|
|
|
|
void on_chk_logCountEn_clicked(bool checked);
|
|
|
|
void on_chk_syncAdcLog_clicked(bool checked);
|
|
|
|
void on_chk_scenFrameAdcLog_clicked(bool checked);
|
|
|
|
void on_chk_pulserTstModeEn_clicked(bool checked);
|
|
|
|
void on_chk_afeConfig_clicked(bool checked);
|
|
|
|
void on_cb_syncMode_currentIndexChanged(int index);
|
|
|
|
void on_btn_adcLogBrowse_clicked();
|
|
|
|
void on_btn_biteSetScenario_clicked();
|
|
|
|
void on_btn_biteIQ_clicked();
|
|
|
|
void on_cb_pulserTstMode_currentIndexChanged(int index);
|
|
|
|
void on_chk_headerLogEn_clicked(bool checked);
|
|
|
|
void on_btn_mcsProgram_clicked();
|
|
|
|
void on_btn_mcsBrowse_clicked();
|
|
|
|
void on_btn_mcsRead_clicked();
|
|
|
|
void on_btn_tempTest_clicked();
|
|
|
|
void on_chk_powerAo_clicked(bool checked);
|
|
|
|
void on_btn_tempStatusLog_clicked();
|
|
|
|
void on_btn_discard_clicked(void);
|
|
|
|
void on_btn_discardAdcLog_clicked(void);
|
|
|
|
void on_btn_endurance_clicked();
|
|
|
|
void on_btn_builtINTemp_clicked();
|
|
|
|
void on_btn_headerEndurance_clicked();
|
|
|
|
void on_btn_scenFolderBrowse_clicked();
|
|
|
|
void on_btn_scenChange_clicked();
|
|
|
|
void on_chk_statusLogPS_clicked(bool checked);
|
|
|
|
void on_btn_seRead_clicked();
|
|
|
|
void on_chk_batchLogEn_clicked(bool checked);
|
|
|
|
void on_chk_clearTrxRom_clicked(bool checked);
|
|
|
|
void on_chk_writeHeaderTrxRom_clicked(bool checked);
|
|
|
|
void on_chk_clearMpsRom_clicked(bool checked);
|
|
|
|
void on_chk_writeHeaderMpsRom_clicked(bool checked);
|
|
|
|
void on_chk_clearPrbCtrlRom_clicked(bool checked);
|
|
|
|
void on_chk_writeHeaderPrbCtrlRom_clicked(bool checked);
|
|
|
|
void prbRead (const QString& prbSelData, qint32 prbSel);
|
|
|
|
void prbWrite (qint32 prbSel);
|
|
|
|
void on_btn_prbRomBrowse_clicked();
|
|
|
|
void on_btn_prbRomWriteAll_clicked();
|
|
|
|
void on_chk_prbRomWrEn_clicked(bool checked);
|
|
|
|
void on_btn_prbRomReadAll_clicked();
|
|
|
|
void on_sb_Fan1Pwm_valueChanged(int arg1);
|
|
|
|
void on_sb_Fan2Pwm_valueChanged(int arg1);
|
|
|
|
void on_btn_prbRelayLogBrowse_clicked();
|
|
|
|
void on_btn_prbRelayTestStart_clicked();
|
|
|
|
void on_btn_spiFlash_clicked();
|
|
|
|
void on_btn_spiVerify_clicked();
|
|
|
|
void on_chk_trxIdWrEn_clicked(bool checked);
|
|
|
|
void on_chk_trxPidWrEn_clicked(bool checked);
|
|
|
|
void on_btn_trxRomPid_clicked();
|
|
|
|
void on_chk_trxPcbVersionWrEn_clicked(bool checked);
|
|
|
|
void on_btn_trxRomPcbVersion_clicked();
|
|
|
|
void on_chk_trxSerialNumberWrEn_clicked(bool checked);
|
|
|
|
void on_btn_trxRomSerialNumber_clicked();
|
|
|
|
void on_chk_trxMasterCodeVersionWrEn_clicked(bool checked);
|
|
|
|
void on_btn_trxRomMasterCodeVersion_clicked();
|
|
|
|
void on_chk_trxSlaveCodeVersionWrEn_clicked(bool checked);
|
|
|
|
void on_btn_trxRomSlaveCodeVersion_clicked();
|
|
|
|
void on_chk_prbCntlIdWrEn_clicked(bool checked);
|
|
|
|
void on_chk_prbCntlPidWrEn_clicked(bool checked);
|
|
|
|
void on_btn_prbCntlRomPid_clicked();
|
|
|
|
void on_chk_prbCntlPcbVersionWrEn_clicked(bool checked);
|
|
|
|
void on_btn_prbCntlRomPcbVersion_clicked();
|
|
|
|
void on_chk_prbCntlSerialNumberWrEn_clicked(bool checked);
|
|
|
|
void on_btn_prbCntlRomSerialNumber_clicked();
|
|
|
|
void on_chk_mpsIdWrEn_clicked(bool checked);
|
|
|
|
void on_chk_mpsPidWrEn_clicked(bool checked);
|
|
|
|
void on_btn_mpsRomPid_clicked();
|
|
|
|
void on_chk_mpsPcbVersionWrEn_clicked(bool checked);
|
|
|
|
void on_btn_mpsRomPcbVersion_clicked();
|
|
|
|
void on_chk_mpsSerialNumberWrEn_clicked(bool checked);
|
|
|
|
void on_btn_mpsRomSerialNumber_clicked();
|
|
|
|
void on_chk_mpsUcCodeVersionWrEn_clicked(bool checked);
|
|
|
|
void on_btn_mpsRomUcCodeVersion_clicked();
|
|
|
|
void on_chk_mpsSupCodeVersionWrEn_clicked(bool checked);
|
|
|
|
void on_btn_mpsRomSupCodeVersion_clicked();
|
|
|
|
void on_chk_sysCompatibilityCheck_clicked(bool checked);
|
|
|
|
signals:
|
|
void showMessage(QString message);
|
|
void threeDReady();
|
|
void twoDReady();
|
|
void connectedPrbChange();
|
|
void frameLostCall();
|
|
void labelState(QLabel* label, QString str, QColor color);
|
|
void scenarioReady(const QString& h5Path);
|
|
void programmingGif(QLabel* label);
|
|
void adcLog();
|
|
void statusLogPS(const quint32& statLogPS);
|
|
void statusLog(quint32 progCnt,
|
|
quint32 taskItr,
|
|
quint16 delayPerTask,
|
|
quint16 scenStartDuration);
|
|
void gtReset(quint32 progCnt, quint32 taskItr, quint16 delayPerTask);
|
|
void endurance (quint32 progCnt,
|
|
quint32 taskItr,
|
|
quint16 delayPerTask);
|
|
|
|
};
|
|
#endif // MAINWINDOW_H
|
|
|