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.

370 lines
8.0 KiB

4 years ago
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
4 years ago
#include <QTimer>
#include <QTime>
4 years ago
#include <QLabel>
#include <QList>
4 years ago
#include <QString>
4 years ago
#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 "qcustomplot.h"
4 years ago
#include "include/model/hardware/core/TrxBoard.h"
#include "hdf5Scenario/hdf5Scenario.h"
4 years ago
#include "api.h"
#define MESSAGE_BOX(M) \
emit showMessage(M)
#define SCENARIO_FILE_PATH "scenarioFilePath"
#define ADC_SIM_FILE_PATH "adcSimFilePath"
#define PARAM_FILE_PATH "paramFilePath"
#define TX_DAC_FILE_PATH "txDacFilePath"
#define FPGA_FILE_PATH "fpgaFilePath"
#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 TRANSFER_LENGTH 4 * 1024 * 1024
#define TRANSFER_RATE 30.0f
#define RAM_BUFFER_OFFSET 0U
#define ULTIMATE_LOG_COUNT 50
4 years ago
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE
using namespace std;
4 years ago
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent = nullptr);
~MainWindow();
private:
4 years ago
Ui::MainWindow *ui;
TrxBoard _trx;
4 years ago
QSettings* _settings;
UltraSoundDevice* _usd;
QMutex _mutex;
QCPColorMap *_colorMap;
static QThread* _uiThread;
QTimer* _timeout;
QEventLoop loop;
QTimer delayTimer;
4 years ago
EmulatorProperties* _emul;
4 years ago
BoardsCtrlMngt* _bCtrl;
SupervisorRbValue* _supRbValue;
MpsFaultStatus* _faultStatus;
HealthStatus* _healStatus;
4 years ago
FpgaCodeVersion* _version;
StatusVec* _vec;
PrbCase* _prb;
AfeConfig _afeConfig;
4 years ago
QFutureWatcher <void> scenEndWather;
4 years ago
void setScenario(const string& h5Path);
4 years ago
void setScenarioCompare(const QString& scenPath);
void fpgaProgrammer(QString path);
4 years ago
void timeout();
void delay(int ms);
const QString enum2String (ePg state) const;
4 years ago
void changeLabelTextColor(QLabel* label, QColor color);
void setAfeConfig (void);
void fillRam(QString path);
void logPcie();
void continuousFrameRepresent(void);
QByteArray str2ByteArray (QString& str);
QString uint2IdString (quint32& id);
QString byteArray2InfoString (QByteArray& arr);
QString releaseCodeVersion (quint32 &value);
void getProbeColor (const QBrush brush, const int item);
QString _logFolder = "/home/hasis/Desktop/TrxBoardFile/_log/dma/";
QString _emulFolder = "/home/hasis/Desktop/Develop_HardwareTest/developHw/sram_frame.bin";
QVector<QByteArray> _dmaBuffer;
QByteArray _lastBuffer;
qint32 _dmaLogCount;
bool _dmaLog;
bool _dmaRun;
bool _dmaShow;
// QString _adcloggerFolder = "/home/hasis/Desktop/TrxBoardFile/_log/adc/";
// bool _csvReadStopFlag = false;
// bool _adcLoggerDone = false;
// bool _adcLoggerTrnsDone = false;
4 years ago
private slots:
void getFramePacket (QByteArray packet);
void getSramBinaryCreateFlag (void);
void getRegisterCsvCompareFlag (void);
void getSramVerifyMessage(QString message);
void getPrbChange();
void restartTimer();
4 years ago
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 newBlockProgressValue(int percentage, QProgressBar* prg);
// void newFpgaProgressValue(int percentage);
// void newBlockProgressVisibility(bool show, QProgressBar* prg);
// void newFpgaProgressVisibility(bool show);
void on_btn_fpgaBrowse_clicked();
void on_btn_fpgaProgram_clicked();
void newMessage(QString message);
// void on_btn_scenarioBrowse_clicked();
// void on_btn_scenarioVerify_clicked();
// void on_btn_ParamBrowse_clicked();
// void on_btn_scenarioUpload_clicked();
// void on_btn_scenarioStartStop_clicked();
// void on_btn_scenarioPauseResume_clicked();
// void on_btn_txDacBrowse_clicked();
// void on_btn_txDacUpload_clicked();
// void on_btn_txDacStartStop_clicked();
// void on_btn_txDacOnOff_clicked();
void on_cb_selectedProbe_currentIndexChanged(int index);
// void on_btn_pllClkSt_clicked();
// void on_btn_pllClkTps_clicked();
// void on_btn_mulDacTrig_clicked();
// void on_pushButton_3_clicked();
// void on_btn_hvRegulatorConfig_clicked();
// void on_btn_pm5RegulatorConfig_clicked();
// void on_btn_DacsOnOff_clicked();
void on_btn_updateRdbackValue_clicked();
void on_btn_supJump_clicked();
4 years ago
void on_btn_setAo_clicked();
4 years ago
// void on_chk_usrMulDac_stateChanged(int arg1);
// void on_btn_afeProg_clicked();
// void on_btn_gtReg_clicked();
// void on_btn_browse_clicked();
// void on_btn_dbgTransferStrt_clicked();
// void on_btn_adcLoggerStrt_clicked();
// void on_prg_adcLoggerFileWr_valueChanged(int value);
// void on_btn_adcSimBrowse_clicked();
// void on_btn_adcSimStart_clicked();
// void on_btn_adcLoggerAutoCount_clicked();
// void on_btn_scenRead_clicked();
4 years ago
void on_btn_getFpgaVersion_clicked();
4 years ago
// void on_btn_txTrig_clicked();
// void adcLoggerStatusCheck();
// void binFileUploader(quint32 bar, quint32 offset, QString path, QProgressBar* prg);
// void binAdcFileUploader(quint32 bar, QString path, QProgressBar* prg);
// void CsvFileUploader(quint32 bar, QString path, QProgressBar *prg);
// void CsvFileChecker(quint32 bar, QString pathBase, QString pathTarget, QProgressBar* prg);
// void AdcLogCsvFileWriter(QString folderPath, QProgressBar* prg);
// void scenarioFileVerifier(quint32 bar, quint32 offset, QString path);
//
// quint64 byteArrayTo64LittleEndian(QByteArray data);
// quint32 byteArrayTo32LittleEndian(QByteArray data);
// quint32 byteArrayTo32BigEndian(QByteArray data);
//
4 years ago
// void scenarioStart();
// void scenarioStop();
// bool checkTermalShutdown(quint8 value);
void on_btn_setAtgcMode_clicked();
void on_btn_scenStart_clicked();
void on_btn_emulator_clicked();
void on_btn_dmaShow_clicked();
void on_btn_emulBrowse_clicked();
void on_btn_logBrowse_clicked();
void on_btn_dmaLogLast_clicked();
void on_btn_afeRead_clicked();
void on_chk_continuousShowing_clicked();
void show3d();
void show2d();
void catchLogCount(qint32 counter, QProgressDialog* _progress);
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_trxRomIdWrite_clicked();
void on_btn_mpsRomIdWrite_clicked();
void on_btn_mpsRomInfoWrite_clicked();
void on_btn_prbCtrlRomIdWrite_clicked();
void on_btn_prbCtrlRomInfoWrite_clicked();
void on_btn_prbRomImpulseRead_clicked();
void on_btn_trxRomIdRead_clicked();
void on_btn_trxRomInfoRead_clicked();
void on_btn_mpsRomIdRead_clicked();
void on_btn_mpsRomInfoRead_clicked();
void on_btn_prbCtrlRomIdRead_clicked();
void on_btn_prbCtrlRomInfoRead_clicked();
void on_btn_prbRomIdRead_clicked();
4 years ago
signals:
// void updateBlockProgressValue(int percentage, QProgressBar* prg);
// void updateFpgaProgressValue(int percentage);
// void updateBlockProgressVisibility(bool show, QProgressBar* prg);
// void updateFpgaProgressVisibility(bool show);
void showMessage(QString message);
void threeDReady();
void twoDReady();
void sendLogCount(qint32 counter, QProgressDialog* _progress);
void connectedPrbChange();
4 years ago
};
#endif // MAINWINDOW_H