From 01c3263691587acaa739251f245181257b5a319b Mon Sep 17 00:00:00 2001 From: Arash Aletayeb Date: Tue, 16 Jan 2024 18:28:20 +0330 Subject: [PATCH] Sono heart beats for master is added. --- developHw.pro.user | 4 +- .../hardware/core/lowLevelApi/TrxBoard.h | 4 + .../lowLevelApi/TrxBoardUtils/e2promFormat.h | 1 + .../core/lowLevelApi/register/misc/Misc.h | 3 +- .../misc/registerDefinition/StatusVector.h | 56 ++-- .../register/scenPlayer/ScenPlayer.h | 3 +- .../registerDefinition/ScenPlayerCtrl.h | 8 +- mainwindow.cpp | 261 +++++++++++------- mainwindow.ui | 52 +++- .../hardware/core/lowLevelApi/TrxBoard.cpp | 49 ++++ .../core/lowLevelApi/register/misc/Misc.cpp | 45 +-- .../register/scenPlayer/ScenPlayer.cpp | 7 + 12 files changed, 327 insertions(+), 166 deletions(-) diff --git a/developHw.pro.user b/developHw.pro.user index 4af91ac..6a3dbad 100644 --- a/developHw.pro.user +++ b/developHw.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -285,7 +285,7 @@ 4096 false false - 1000 + 0 true diff --git a/include/model/hardware/core/lowLevelApi/TrxBoard.h b/include/model/hardware/core/lowLevelApi/TrxBoard.h index 260e686..c48eae0 100644 --- a/include/model/hardware/core/lowLevelApi/TrxBoard.h +++ b/include/model/hardware/core/lowLevelApi/TrxBoard.h @@ -9,6 +9,7 @@ #include #include #include +#include #include "register/clockDistributer/ClockDistributer.h" #include "register/boardsCtrlMngt/BoardsCtrlMngt.h" @@ -48,6 +49,7 @@ class TrxBoard : public QObject Q_OBJECT private: + QTimer* _sonoLiveTimer; QByteArray bin; QVector _swapVec; QVector _unsignedQntzrVec; @@ -60,6 +62,7 @@ private: const quint32 _offsetSlave1; const quint32 _offsetSlave2; + bool _sonoHeartBeats; bool _allow; bool _run; qint32 _swCounter; @@ -155,6 +158,7 @@ private: * _scenParams; + void sonoLiveTimeout(); void sendPacket(void); void delay(quint16 ms) const; diff --git a/include/model/hardware/core/lowLevelApi/TrxBoardUtils/e2promFormat.h b/include/model/hardware/core/lowLevelApi/TrxBoardUtils/e2promFormat.h index f11bc5c..db3d8ed 100644 --- a/include/model/hardware/core/lowLevelApi/TrxBoardUtils/e2promFormat.h +++ b/include/model/hardware/core/lowLevelApi/TrxBoardUtils/e2promFormat.h @@ -59,6 +59,7 @@ struct systemE2proms EepromStatus trx; EepromStatus prbCtrl; EepromStatus mps; + FpgaCodeVersion fpgaCodeVersion; }; #endif // E2PROMFORMAT_H diff --git a/include/model/hardware/core/lowLevelApi/register/misc/Misc.h b/include/model/hardware/core/lowLevelApi/register/misc/Misc.h index f3544af..30e7766 100644 --- a/include/model/hardware/core/lowLevelApi/register/misc/Misc.h +++ b/include/model/hardware/core/lowLevelApi/register/misc/Misc.h @@ -27,7 +27,8 @@ struct StatusVec bool thermalErr; bool pgErr; bool probeDisconnectErr; - bool fanFault; + bool fan1Fault; + bool fan2Fault; bool dintrlvFrameLost; bool dintrlvOffsetAddrErr; bool dintrlvSramOver4MErr; diff --git a/include/model/hardware/core/lowLevelApi/register/misc/registerDefinition/StatusVector.h b/include/model/hardware/core/lowLevelApi/register/misc/registerDefinition/StatusVector.h index 8781025..68a0170 100644 --- a/include/model/hardware/core/lowLevelApi/register/misc/registerDefinition/StatusVector.h +++ b/include/model/hardware/core/lowLevelApi/register/misc/registerDefinition/StatusVector.h @@ -6,29 +6,30 @@ #undef BAR -#define PROBE_DETECTION_INTERRUPT_MASK 0x00000001 -#define SRAM_1_PARITY_ERR_MASK 0x00000002 -#define SRAM_2_PARITY_ERR_MASK 0x00000004 -#define MPS_ERR_MASK 0x00000008 -#define SCEN_RPI_ERR_MASK 0x00000010 -#define SCEN_SYNC_ACK_ERR_MASK 0x00000020 -#define SCEN_SRAM_ERR_MASK 0x00000040 -#define MLA_SYNC_FIFO_ERR_MASK 0x00000080 -#define MLA_SYNC_POINT_ERR_MASK 0x00000100 -#define DINTRLV_FIFO_ERR_MASK 0x00000200 -#define DINTRLV_POINT_ERR_MASK 0x00000400 -#define PULSER_THD_MASK 0x00000800 -#define THERMAL_ERR_MASK 0x00001000 -#define PG_ERR_MASK 0x00002000 -#define PROBE_DISCONNECT_ERR_MASK 0x00004000 -#define FAN_FAULT_MASK 0x00008000 -#define DINTRLV_FRAME_LOST_MASK 0x00020000 -#define DINTRLV_OFFSET_ADDR_ERR_MASK 0x00040000 -#define DINTRLV_SRAM_OVER_4M_ERR_MASK 0x00080000 -#define DDC_LPF_RELOAD_ERR_MASK 0x00100000 -#define ADC_FLAG_SYNC_ERR_MASK 0x00200000 -#define EMUL_DMA_TRANSFER_ERR_MASK 0x40000000 -#define DMA_CTRL_TRANSFER_ERR_MASK 0x80000000 +#define PROBE_DETECTION_INTERRUPT_MASK 0x00000001 +#define SRAM_1_PARITY_ERR_MASK 0x00000002 +#define SRAM_2_PARITY_ERR_MASK 0x00000004 +#define MPS_ERR_MASK 0x00000008 +#define SCEN_RPI_ERR_MASK 0x00000010 +#define SCEN_SYNC_ACK_ERR_MASK 0x00000020 +#define SCEN_SRAM_ERR_MASK 0x00000040 +#define MLA_SYNC_FIFO_ERR_MASK 0x00000080 +#define MLA_SYNC_POINT_ERR_MASK 0x00000100 +#define DINTRLV_FIFO_ERR_MASK 0x00000200 +#define DINTRLV_POINT_ERR_MASK 0x00000400 +#define PULSER_THD_MASK 0x00000800 +#define THERMAL_ERR_MASK 0x00001000 +#define PG_ERR_MASK 0x00002000 +#define PROBE_DISCONNECT_ERR_MASK 0x00004000 +#define FAN1_FAULT_MASK 0x00008000 +#define FAN2_FAULT_MASK 0x00010000 +#define DINTRLV_FRAME_LOST_MASK 0x00020000 +#define DINTRLV_OFFSET_ADDR_ERR_MASK 0x00040000 +#define DINTRLV_SRAM_OVER_4M_ERR_MASK 0x00080000 +#define DDC_LPF_RELOAD_ERR_MASK 0x00100000 +#define ADC_FLAG_SYNC_ERR_MASK 0x00200000 +#define EMUL_DMA_TRANSFER_ERR_MASK 0x40000000 +#define DMA_CTRL_TRANSFER_ERR_MASK 0x80000000 #define BAR 0U #define OFFSET 0x0 @@ -51,7 +52,8 @@ public: Field* thermalErr; Field* pgErr; Field* probeDisconnectErr; - Field* fanFault; + Field* fan1Fault; + Field* fan2Fault; Field* dintrlvFrameLost; Field* dintrlvOffsetAddrErr; Field* dintrlvSramOver4MErr; @@ -77,7 +79,8 @@ public: ADD_UNSIGNED_FIELD(thermalErr, THERMAL_ERR_MASK); ADD_UNSIGNED_FIELD(pgErr, PG_ERR_MASK); ADD_UNSIGNED_FIELD(probeDisconnectErr, PROBE_DISCONNECT_ERR_MASK); - ADD_UNSIGNED_FIELD(fanFault, FAN_FAULT_MASK); + ADD_UNSIGNED_FIELD(fan1Fault, FAN1_FAULT_MASK); + ADD_UNSIGNED_FIELD(fan2Fault, FAN2_FAULT_MASK); ADD_UNSIGNED_FIELD(dintrlvFrameLost, DINTRLV_FRAME_LOST_MASK); ADD_UNSIGNED_FIELD(dintrlvOffsetAddrErr, DINTRLV_OFFSET_ADDR_ERR_MASK); ADD_UNSIGNED_FIELD(dintrlvSramOver4MErr, DINTRLV_SRAM_OVER_4M_ERR_MASK); @@ -103,7 +106,8 @@ public: #undef THERMAL_ERR_MASK #undef PG_ERR_MASK #undef PROBE_DISCONNECT_ERR_MASK -#undef FAN_FAULT_MASK +#undef FAN1_FAULT_MASK +#undef FAN2_FAULT_MASK #undef DINTRLV_FRAME_LOST_MASK #undef DINTRLV_OFFSET_ADDR_ERR_MASK #undef DINTRLV_SRAM_OVER_4M_ERR_MASK diff --git a/include/model/hardware/core/lowLevelApi/register/scenPlayer/ScenPlayer.h b/include/model/hardware/core/lowLevelApi/register/scenPlayer/ScenPlayer.h index 6e63c4f..3b4b3ac 100644 --- a/include/model/hardware/core/lowLevelApi/register/scenPlayer/ScenPlayer.h +++ b/include/model/hardware/core/lowLevelApi/register/scenPlayer/ScenPlayer.h @@ -17,7 +17,8 @@ private: ScenPlayerCtrl* _playerctrl; void setCommand(bool start) const; bool getCommand(void) const; - void pause (bool pause) const; + void pause(bool pause) const; + void setHeartBeats(bool heartBeat) const; }; public: diff --git a/include/model/hardware/core/lowLevelApi/register/scenPlayer/registerDefinition/ScenPlayerCtrl.h b/include/model/hardware/core/lowLevelApi/register/scenPlayer/registerDefinition/ScenPlayerCtrl.h index 5e3bdcc..951e21e 100644 --- a/include/model/hardware/core/lowLevelApi/register/scenPlayer/registerDefinition/ScenPlayerCtrl.h +++ b/include/model/hardware/core/lowLevelApi/register/scenPlayer/registerDefinition/ScenPlayerCtrl.h @@ -6,8 +6,9 @@ #undef BAR -#define START_MASK 0x00000001 -#define PAUSE_MASK 0x00000004 +#define START_MASK 0x00000001 +#define PAUSE_MASK 0x00000004 +#define HEART_BEATS_MASK 0x00000010 #define BAR 0U #define OFFSET 0x800 @@ -17,16 +18,19 @@ class ScenPlayerCtrl : public Register public: Field* start; Field* pause; + Field* heartBeats; ScenPlayerCtrl(SonoDevice* device) : Register(BAR, OFFSET, device) { ADD_UNSIGNED_FIELD(start, START_MASK); ADD_UNSIGNED_FIELD(pause, PAUSE_MASK); + ADD_UNSIGNED_FIELD(heartBeats, HEART_BEATS_MASK); } }; #undef START_MASK #undef PAUSE_MASK +#undef HEART_BEATS_MASK #undef BAR #undef OFFSET diff --git a/mainwindow.cpp b/mainwindow.cpp index bb57cf3..ee3465d 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -460,11 +460,11 @@ void MainWindow::timeout() delay(1); quint32 tachoFan1 = static_cast(_healStatus->fanRpm->fan1); - ui->l_tachoFan1->setText(QString::number(tachoFan1)); + ui->l_tachoFan1->setText((tachoFan1) ? "On" : "Off"); delay(1); quint32 tachoFan2 = static_cast(_healStatus->fanRpm->fan2); - ui->l_tachoFan2->setText(QString::number(tachoFan2)); + ui->l_tachoFan2->setText((tachoFan2) ? "On" : "Off"); delay(1); /******************* Power Good *********************/ @@ -523,7 +523,7 @@ void MainWindow::timeout() changeLabelTextColor(ui->l_frameLost, color); delay(1); - bool fanFault = _vec->fanFault; + bool fanFault = (_vec->fan1Fault) | (_vec->fan2Fault); ui->l_fan->setText(QVariant(fanFault).toString()); color = fanFault ? Qt::red : Qt::green; changeLabelTextColor(ui->l_fan, color); @@ -2978,7 +2978,7 @@ QByteArray str2BigEndianByteArray(QString str, int base, qint8 byteLength) QByteArray qbInt; for(qint8 i = byteLength - 1; i >= 0; i--) { - qbInt.append(static_cast((intStr >> (i*8)) & 0xFF)); + qbInt.append(static_cast((intStr >> (i * 8)) & 0xFF)); } return qbInt; @@ -2989,11 +2989,12 @@ QString bigEndianByteArray2Str(QByteArray btArr, int base) quint32 reconstructedNum(0); for(auto i = btArr.length() - 1; i >= 0; i--) { - reconstructedNum += static_cast((static_cast(btArr[btArr.length() - 1 - i]) << (i*8))); + reconstructedNum += + static_cast((static_cast(btArr[btArr.length() - 1 - i]) << (i * 8))); } QString str = QString::number(reconstructedNum, base); - return str; + return str; } QByteArray str2BigEndianByteArray4SerialNo(QString str) @@ -3011,13 +3012,15 @@ QByteArray str2BigEndianByteArray4SerialNo(QString str) for(qint8 i = 1; i >= 0; i--) { - qbInt.append(static_cast(((strByte34.toShort()) >> (i*8)) & 0xFF)); + qbInt.append(static_cast(((strByte34.toShort()) >> (i * 8)) & 0xFF)); } return qbInt; } else + { throw SonoException("Invalid board serial number."); + } } QString bigEndianByteArray2Str4SerialNo(QByteArray btArr) @@ -3025,11 +3028,14 @@ QString bigEndianByteArray2Str4SerialNo(QByteArray btArr) quint16 reconstructedNum(0); for(auto i = btArr.length() - 3; i >= 0; i--) { - reconstructedNum += static_cast((static_cast(btArr[btArr.length() - 1 - i]) << (i*8))); + reconstructedNum += + static_cast((static_cast(btArr[btArr.length() - 1 - i]) << (i * 8))); } - QString str = "SPN." + QString::number(static_cast(btArr[0])) + "." - + QString::number(static_cast(btArr[1])) + "." + QString::number(reconstructedNum); - return str; + QString str = "SPN." + QString::number(static_cast(btArr[0])) + "." + + QString::number(static_cast(btArr[1])) + "." + QString::number( + reconstructedNum); + + return str; } QByteArray MainWindow::str2ByteArray (QString& str) @@ -3095,6 +3101,7 @@ QByteArray MainWindow::crcCalc(const QByteArray array) quint8 crcValue = _trx.crcGenerator(array); QByteArray crc; crc.append(static_cast(crcValue)); + return crc; } @@ -3244,11 +3251,11 @@ void MainWindow::on_btn_trxRomSerialNumber_clicked() if(trxSerialNoWrEn) { QString serialNoStr = ui->tb_trxRomSerialNumber->text(); + QByteArray sendingArray = str2BigEndianByteArray4SerialNo(serialNoStr); QByteArray clearSerialNo = e2promClear(EEPROM_BOARD_SERIAL_NO_NUMBER); trxEepromWrite(clearSerialNo, EEPROM_BOARD_SERIAL_NO_BEGIN, _bCtrl); - QByteArray sendingArray = str2BigEndianByteArray4SerialNo(serialNoStr); trxEepromWrite(sendingArray, EEPROM_BOARD_SERIAL_NO_BEGIN, _bCtrl); trxCrcWrite(sendingArray, EEPROM_BOARD_SERIAL_NO_CRC); @@ -3338,55 +3345,70 @@ void MainWindow::on_btn_trxRomSlaveCodeVersion_clicked() /*************************************************************************************************/ void MainWindow::on_chk_writeHeaderTrxRom_clicked(bool checked) { - if(checked) + try { - QByteArray clearHeader = e2promClear(EEPROM_HEADER_NUMBER); - trxEepromWrite(clearHeader, EEPROM_HEADER_BEGIN, _bCtrl); + if(checked) + { + QByteArray clearHeader = e2promClear(EEPROM_HEADER_NUMBER); + trxEepromWrite(clearHeader, EEPROM_HEADER_BEGIN, _bCtrl); - trxEepromWrite(headerArray, EEPROM_HEADER_BEGIN, _bCtrl); - qDebug() << _trx.trxRomHeader(); + trxEepromWrite(headerArray, EEPROM_HEADER_BEGIN, _bCtrl); + delay(200); + qDebug() << bigEndianByteArray2Str(_trx.trxRomHeader(), 16); + } + } + catch(SonoException& e) + { + qDebug() << e.what(); } } /*************************************************************************************************/ void MainWindow::on_chk_clearTrxRom_clicked(bool checked) { - if(checked) + try + { + if(checked) + { + QByteArray clearAll = e2promClear(TRX_RLY_MPS_E2PROM_SIZE_BYTE); + trxEepromWrite(clearAll, 0, _bCtrl); + } + } + catch(SonoException& e) { - QByteArray clearAll = e2promClear(TRX_RLY_MPS_E2PROM_SIZE_BYTE); - trxEepromWrite(clearAll, 0, _bCtrl); + qDebug() << e.what(); } } ///*************************************************************************************************/ //void MainWindow::on_btn_trxRomInfoWrite_clicked() //{ -// QString infoStr = ui->tb_trxRomInfo->toPlainText(); -// try -// { -// QByteArray clearInfo = e2promClear(EEPROM_INFO_NUMBER); -// trxEepromWrite(clearInfo, EEPROM_INFO_BEGIN, _bCtrl); - -// QByteArray sendingArray = infoStr.toLatin1(); -// trxEepromWrite(sendingArray, EEPROM_INFO_BEGIN, _bCtrl); -// } -// catch(SonoException& e) -// { -// qDebug() << e.what(); -// } +//QString infoStr = ui->tb_trxRomInfo->toPlainText(); +//try +//{ +//QByteArray clearInfo = e2promClear(EEPROM_INFO_NUMBER); +//trxEepromWrite(clearInfo, EEPROM_INFO_BEGIN, _bCtrl); + +//QByteArray sendingArray = infoStr.toLatin1(); +//trxEepromWrite(sendingArray, EEPROM_INFO_BEGIN, _bCtrl); +//} +//catch(SonoException& e) +//{ +//qDebug() << e.what(); +//} //} ///*************************************************************************************************/ //void MainWindow::on_btn_trxRomInfoRead_clicked() //{ -// try -// { -// QString receivingStr = _trx.trxInfo(); -// ui->tb_trxRomInfo->setText(receivingStr); -// } -// catch(SonoException& e) -// { -// qDebug() << e.what(); -// } +//try +//{ +//QString receivingStr = _trx.trxInfo(); +//ui->tb_trxRomInfo->setText(receivingStr); +//} +//catch(SonoException& e) +//{ +//qDebug() << e.what(); +//} //} /*************************************************************************************************/ @@ -3509,11 +3531,11 @@ void MainWindow::on_btn_mpsRomSerialNumber_clicked() if(mpsSerialNoWrEn) { QString serialNoStr = ui->tb_mpsRomSerialNumber->text(); + QByteArray sendingArray = str2BigEndianByteArray4SerialNo(serialNoStr); QByteArray clearSerialNo = e2promClear(EEPROM_BOARD_SERIAL_NO_NUMBER); mpsEepromWrite(clearSerialNo, EEPROM_BOARD_SERIAL_NO_BEGIN, _bCtrl); - QByteArray sendingArray = str2BigEndianByteArray4SerialNo(serialNoStr); mpsEepromWrite(sendingArray, EEPROM_BOARD_SERIAL_NO_BEGIN, _bCtrl); mpsCrcWrite(sendingArray, EEPROM_BOARD_SERIAL_NO_CRC); @@ -3603,55 +3625,70 @@ void MainWindow::on_btn_mpsRomSupCodeVersion_clicked() /*************************************************************************************************/ void MainWindow::on_chk_writeHeaderMpsRom_clicked(bool checked) { - if(checked) + try { - QByteArray clearHeader = e2promClear(EEPROM_HEADER_NUMBER); - mpsEepromWrite(clearHeader, EEPROM_HEADER_BEGIN, _bCtrl); + if(checked) + { + QByteArray clearHeader = e2promClear(EEPROM_HEADER_NUMBER); + mpsEepromWrite(clearHeader, EEPROM_HEADER_BEGIN, _bCtrl); - mpsEepromWrite(headerArray, EEPROM_HEADER_BEGIN, _bCtrl); - qDebug() << _trx.mpsRomHeader(); + mpsEepromWrite(headerArray, EEPROM_HEADER_BEGIN, _bCtrl); + delay(200); + qDebug() << bigEndianByteArray2Str(_trx.mpsRomHeader(), 16); + } + } + catch(SonoException& e) + { + qDebug() << e.what(); } } /*************************************************************************************************/ void MainWindow::on_chk_clearMpsRom_clicked(bool checked) { - if(checked) + try { - QByteArray clearAll = e2promClear(TRX_RLY_MPS_E2PROM_SIZE_BYTE); - mpsEepromWrite(clearAll, 0, _bCtrl); + if(checked) + { + QByteArray clearAll = e2promClear(TRX_RLY_MPS_E2PROM_SIZE_BYTE); + mpsEepromWrite(clearAll, 0, _bCtrl); + } + } + catch(SonoException& e) + { + qDebug() << e.what(); } } ///*************************************************************************************************/ //void MainWindow::on_btn_mpsRomInfoWrite_clicked() //{ -// QString infoStr = ui->tb_mpsRomInfo->toPlainText(); -// try -// { -// QByteArray clearInfo = e2promClear(EEPROM_INFO_NUMBER); -// mpsEepromWrite(clearInfo, EEPROM_INFO_BEGIN, _bCtrl); - -// QByteArray sendingArray = infoStr.toLatin1(); -// mpsEepromWrite(sendingArray, EEPROM_INFO_BEGIN, _bCtrl); -// } -// catch(SonoException& e) -// { -// qDebug() << e.what(); -// } +//QString infoStr = ui->tb_mpsRomInfo->toPlainText(); +//try +//{ +//QByteArray clearInfo = e2promClear(EEPROM_INFO_NUMBER); +//mpsEepromWrite(clearInfo, EEPROM_INFO_BEGIN, _bCtrl); + +//QByteArray sendingArray = infoStr.toLatin1(); +//mpsEepromWrite(sendingArray, EEPROM_INFO_BEGIN, _bCtrl); +//} +//catch(SonoException& e) +//{ +//qDebug() << e.what(); +//} //} ///*************************************************************************************************/ //void MainWindow::on_btn_mpsRomInfoRead_clicked() //{ -// try -// { -// QString receivingStr = _trx.mpsInfo(); -// ui->tb_mpsRomInfo->setText(receivingStr); -// } -// catch(SonoException& e) -// { -// qDebug() << e.what(); -// } +//try +//{ +//QString receivingStr = _trx.mpsInfo(); +//ui->tb_mpsRomInfo->setText(receivingStr); +//} +//catch(SonoException& e) +//{ +//qDebug() << e.what(); +//} //} /*************************************************************************************************/ @@ -3689,6 +3726,7 @@ void MainWindow::on_btn_prbCtrlRomId_clicked() qDebug() << e.what(); } } + /*************************************************************************************************/ void MainWindow::on_chk_prbCntlPidWrEn_clicked(bool checked) { @@ -3773,11 +3811,11 @@ void MainWindow::on_btn_prbCntlRomSerialNumber_clicked() if(prbCtrlSerialNoWrEn) { QString serialNoStr = ui->tb_prbCtrlRomSerialNumber->text(); + QByteArray sendingArray = str2BigEndianByteArray4SerialNo(serialNoStr); QByteArray clearSerialNo = e2promClear(EEPROM_BOARD_SERIAL_NO_NUMBER); prbCtrlEepromWrite(clearSerialNo, EEPROM_BOARD_SERIAL_NO_BEGIN, _bCtrl); - QByteArray sendingArray = str2BigEndianByteArray4SerialNo(serialNoStr); prbCtrlEepromWrite(sendingArray, EEPROM_BOARD_SERIAL_NO_BEGIN, _bCtrl); prbCtrlCrcWrite(sendingArray, EEPROM_BOARD_SERIAL_NO_CRC); @@ -3797,55 +3835,70 @@ void MainWindow::on_btn_prbCntlRomSerialNumber_clicked() /*************************************************************************************************/ void MainWindow::on_chk_writeHeaderPrbCtrlRom_clicked(bool checked) { - if(checked) + try { - QByteArray clearHeader = e2promClear(EEPROM_HEADER_NUMBER); - prbCtrlEepromWrite(clearHeader, EEPROM_HEADER_BEGIN, _bCtrl); + if(checked) + { + QByteArray clearHeader = e2promClear(EEPROM_HEADER_NUMBER); + prbCtrlEepromWrite(clearHeader, EEPROM_HEADER_BEGIN, _bCtrl); - prbCtrlEepromWrite(headerArray, EEPROM_HEADER_BEGIN, _bCtrl); - qDebug() << _trx.prbCtrlRomHeader(); + prbCtrlEepromWrite(headerArray, EEPROM_HEADER_BEGIN, _bCtrl); + delay(200); + qDebug() << bigEndianByteArray2Str(_trx.prbCtrlRomHeader(), 16); + } + } + catch(SonoException& e) + { + qDebug() << e.what(); } } /*************************************************************************************************/ void MainWindow::on_chk_clearPrbCtrlRom_clicked(bool checked) { - if(checked) + try { - QByteArray clearAll = e2promClear(TRX_RLY_MPS_E2PROM_SIZE_BYTE); - prbCtrlEepromWrite(clearAll, 0, _bCtrl); + if(checked) + { + QByteArray clearAll = e2promClear(TRX_RLY_MPS_E2PROM_SIZE_BYTE); + prbCtrlEepromWrite(clearAll, 0, _bCtrl); + } + } + catch(SonoException& e) + { + qDebug() << e.what(); } } ///*************************************************************************************************/ //void MainWindow::on_btn_prbCtrlRomInfoWrite_clicked() //{ -// QString infoStr = ui->tb_prbCtrlRomInfo->toPlainText(); -// try -// { -// QByteArray clearInfo = e2promClear(EEPROM_INFO_NUMBER); -// prbCtrlEepromWrite(clearInfo, EEPROM_INFO_BEGIN, _bCtrl); - -// QByteArray sendingArray = infoStr.toLatin1(); -// prbCtrlEepromWrite(sendingArray, EEPROM_INFO_BEGIN, _bCtrl); -// } -// catch(SonoException& e) -// { -// qDebug() << e.what(); -// } +//QString infoStr = ui->tb_prbCtrlRomInfo->toPlainText(); +//try +//{ +//QByteArray clearInfo = e2promClear(EEPROM_INFO_NUMBER); +//prbCtrlEepromWrite(clearInfo, EEPROM_INFO_BEGIN, _bCtrl); + +//QByteArray sendingArray = infoStr.toLatin1(); +//prbCtrlEepromWrite(sendingArray, EEPROM_INFO_BEGIN, _bCtrl); +//} +//catch(SonoException& e) +//{ +//qDebug() << e.what(); +//} //} ///*************************************************************************************************/ //void MainWindow::on_btn_prbCtrlRomInfoRead_clicked() //{ -// try -// { -// QString receivingStr = _trx.prbCtrlInfo(); -// ui->tb_prbCtrlRomInfo->setText(receivingStr); -// } -// catch(SonoException& e) -// { -// qDebug() << e.what(); -// } +//try +//{ +//QString receivingStr = _trx.prbCtrlInfo(); +//ui->tb_prbCtrlRomInfo->setText(receivingStr); +//} +//catch(SonoException& e) +//{ +//qDebug() << e.what(); +//} //} /*************************************************************************************************/ diff --git a/mainwindow.ui b/mainwindow.ui index 31b8ff5..1928e1d 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -2273,6 +2273,9 @@ 16777215 + + <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">Master FPGA Version</span></p></body></html> + MFV @@ -2294,6 +2297,9 @@ 16777215 + + <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">Master FPGA Version</span></p></body></html> + @@ -2358,6 +2364,9 @@ 16777215 + + <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">Slave FPGA Version</span></p></body></html> + SFV @@ -2379,6 +2388,9 @@ 16777215 + + <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">Slave FPGA Version</span></p></body></html> + @@ -2567,7 +2579,7 @@ 0 20 - 97 + 102 61 @@ -2580,6 +2592,8 @@ 8 + 50 + false @@ -2592,6 +2606,8 @@ 8 + 50 + false @@ -3224,7 +3240,7 @@ 0 20 - 97 + 102 61 @@ -3237,6 +3253,8 @@ 8 + 50 + false @@ -3249,6 +3267,8 @@ 8 + 50 + false @@ -3263,13 +3283,13 @@ 600 40 - 151 + 181 20 - 10 + 9 @@ -3680,6 +3700,9 @@ 16777215 + + <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">MicroController Version</span></p></body></html> + UCV @@ -3701,6 +3724,9 @@ 16777215 + + <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">MicroController Version</span></p></body></html> + @@ -3765,6 +3791,9 @@ 16777215 + + <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">Supervisory Version</span></p></body></html> + SVV @@ -3786,6 +3815,9 @@ 16777215 + + <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">Supervisory Version</span></p></body></html> + @@ -3804,7 +3836,7 @@ 0 20 - 97 + 102 61 @@ -3814,6 +3846,8 @@ 8 + 50 + false @@ -3826,6 +3860,8 @@ 8 + 50 + false @@ -7889,7 +7925,7 @@ 710 150 101 - 63 + 65 @@ -7897,14 +7933,14 @@ - 8 + 11 75 true true - Tacho Fan(rpm) + Fans state diff --git a/src/model/hardware/core/lowLevelApi/TrxBoard.cpp b/src/model/hardware/core/lowLevelApi/TrxBoard.cpp index 9dd1f86..74c4bf5 100644 --- a/src/model/hardware/core/lowLevelApi/TrxBoard.cpp +++ b/src/model/hardware/core/lowLevelApi/TrxBoard.cpp @@ -22,6 +22,12 @@ T TrxBoard::byteArray2UintLittleEndian(QByteArray& byte) const return data; } +void TrxBoard::sonoLiveTimeout() +{ + _sonoHeartBeats = !_sonoHeartBeats; + this->_scenPlayer->control.setHeartBeats(_sonoHeartBeats); +} + void TrxBoard::sendPacket() { auto counter(0); @@ -341,6 +347,11 @@ QList TrxBoard::systemStructure2List(systemE2proms &systemRoms) dataset.append(systemRoms.trx.secondMbedCodeVersion); dataset.append(systemRoms.mps.secondMbedCodeVersion); + dataset.append(systemRoms.fpgaCodeVersion.masterCode); + dataset.append(systemRoms.fpgaCodeVersion.slave0Code); + dataset.append(systemRoms.fpgaCodeVersion.slave1Code); + dataset.append(systemRoms.fpgaCodeVersion.slave2Code); + return dataset; } @@ -364,6 +375,10 @@ void TrxBoard::systemLutCompletion() systemRoms.mps.firstMbedCodeVersion = 1; systemRoms.trx.secondMbedCodeVersion = 1; systemRoms.mps.secondMbedCodeVersion = 1; + systemRoms.fpgaCodeVersion.masterCode = 2312111600; + systemRoms.fpgaCodeVersion.slave0Code = 2312111647; + systemRoms.fpgaCodeVersion.slave1Code = 2312111647; + systemRoms.fpgaCodeVersion.slave2Code = 2312111647; _systemLut.append(systemStructure2List(systemRoms)); systemRoms.trx.pcbVersion = 2; @@ -373,6 +388,10 @@ void TrxBoard::systemLutCompletion() systemRoms.mps.firstMbedCodeVersion = 1; systemRoms.trx.secondMbedCodeVersion = 1; systemRoms.mps.secondMbedCodeVersion = 1; + systemRoms.fpgaCodeVersion.masterCode = 2312111600; + systemRoms.fpgaCodeVersion.slave0Code = 2312111647; + systemRoms.fpgaCodeVersion.slave1Code = 2312111647; + systemRoms.fpgaCodeVersion.slave2Code = 2312111647; _systemLut.append(systemStructure2List(systemRoms)); systemRoms.trx.pcbVersion = 2; @@ -382,6 +401,10 @@ void TrxBoard::systemLutCompletion() systemRoms.mps.firstMbedCodeVersion = 1; systemRoms.trx.secondMbedCodeVersion = 2; systemRoms.mps.secondMbedCodeVersion = 1; + systemRoms.fpgaCodeVersion.masterCode = 2312111600; + systemRoms.fpgaCodeVersion.slave0Code = 2312111647; + systemRoms.fpgaCodeVersion.slave1Code = 2312111647; + systemRoms.fpgaCodeVersion.slave2Code = 2312111647; _systemLut.append(systemStructure2List(systemRoms)); } @@ -428,6 +451,10 @@ TrxBoard::TrxBoard() : _offsetSlave0(0), _offsetSlave1(0x400000), _offsetSlave2( _coreTemp = new criticalComponentTemperature; _scenParams = new ScenGenHardwareParam; + _sonoLiveTimer = new QTimer; + connect(_sonoLiveTimer, &QTimer::timeout, this, &TrxBoard::sonoLiveTimeout); + + _sonoHeartBeats = false; _allow = false; _run = false; setSwapVector(); @@ -435,6 +462,7 @@ TrxBoard::TrxBoard() : _offsetSlave0(0), _offsetSlave1(0x400000), _offsetSlave2( setFpgaOffset(); setAfeModuleOffset(); systemLutCompletion(); + } TrxBoard::ScenHwRegister::ScenHwRegister() @@ -483,6 +511,8 @@ TrxBoard::~TrxBoard() delete _coreVolt; delete _coreTemp; delete _scenParams; + + delete _sonoLiveTimer; } TrxBoard::ScenHwRegister::~ScenHwRegister() @@ -1571,6 +1601,9 @@ void TrxBoard::scenPlayerStart(bool afeHvPwrOn) #ifndef DEVELOP_UI packetEngine.init(); #endif + _sonoLiveTimer->start(5000); + _sonoHeartBeats = true; + this->_scenPlayer->control.setHeartBeats(_sonoHeartBeats); _run = true; @@ -1594,6 +1627,11 @@ void TrxBoard::scenPlayerStop(bool afeHvPwrOff) while(_device.isDmaBusy()); //uncrustify on + _sonoLiveTimer->stop(); + + _sonoHeartBeats = false; + this->_scenPlayer->control.setHeartBeats(_sonoHeartBeats); + this->_scenPlayer->control.setCommand(false); if(afeHvPwrOff) @@ -1685,6 +1723,10 @@ void TrxBoard::emulatorStart() this->_device.startDma(); + _sonoLiveTimer->start(5000); + _sonoHeartBeats = true; + this->_scenPlayer->control.setHeartBeats(_sonoHeartBeats); + _run = true; QtConcurrent::run(this, &TrxBoard::readData); @@ -1692,6 +1734,11 @@ void TrxBoard::emulatorStart() void TrxBoard::emulatorStop() { + _sonoLiveTimer->stop(); + + _sonoHeartBeats = false; + this->_scenPlayer->control.setHeartBeats(_sonoHeartBeats); + _run = false; this->_device.stopDma(); @@ -1737,6 +1784,8 @@ void TrxBoard::checkSystemCompatibility() currentSystemRoms.prbCtrl = prbCtrlE2prom; currentSystemRoms.mps = mpsE2prom; + getFpgasCodeVersion(¤tSystemRoms.fpgaCodeVersion); + QList currentSystem = systemStructure2List(currentSystemRoms); systemCompare(currentSystem); diff --git a/src/model/hardware/core/lowLevelApi/register/misc/Misc.cpp b/src/model/hardware/core/lowLevelApi/register/misc/Misc.cpp index 1b6153e..ed7fe11 100644 --- a/src/model/hardware/core/lowLevelApi/register/misc/Misc.cpp +++ b/src/model/hardware/core/lowLevelApi/register/misc/Misc.cpp @@ -43,28 +43,29 @@ void Misc::getStatusVector(StatusVec *status) const { this->_status->sync(); - status->pgErr = ((this->_status->pgErr->getValue()) != 0); - status->mpsErr = ((this->_status->mpsErr->getValue()) != 0); - status->fanFault = ((this->_status->fanFault->getValue()) != 0); - status->pulserThd = ((this->_status->pulserThd->getValue()) != 0); - status->scenPriErr = ((this->_status->scenPriErr->getValue()) != 0); - status->thermalErr = ((this->_status->thermalErr->getValue()) != 0); - status->scenSramErr = ((this->_status->scenSramErr->getValue()) != 0); - status->scenSyncAckErr = ((this->_status->scenSyncAckErr->getValue()) != 0); - status->mlaSyncFifoErr = ((this->_status->mlaSyncFifoErr->getValue()) != 0); - status->dintrlvFifoErr = ((this->_status->dintrlvFifoErr->getValue()) != 0); - status->adcFlagSyncErr = ((this->_status->adcFlagSyncErr->getValue()) != 0); - status->sram1ParityErr = ((this->_status->sram1ParityErr->getValue()) != 0); - status->sram2ParityErr = ((this->_status->sram2ParityErr->getValue()) != 0); - status->mlaSyncPointErr = ((this->_status->mlaSyncPointErr->getValue()) != 0); - status->ddcLpfReloadErr = ((this->_status->ddcLpfReloadErr->getValue()) != 0); - status->dintrlvPointErr = ((this->_status->dintrlvPointErr->getValue()) != 0); - status->dintrlvFrameLost = ((this->_status->dintrlvFrameLost->getValue()) != 0); - status->dmaCtrlTransferErr = ((this->_status->dmaCtrlTransferErr->getValue()) != 0); - status->emulDmaTransferErr = ((this->_status->emulDmaTransferErr->getValue()) != 0); - status->probeDisconnectErr = ((this->_status->probeDisconnectErr->getValue()) != 0); - status->dintrlvOffsetAddrErr = ((this->_status->dintrlvOffsetAddrErr->getValue()) != 0); - status->dintrlvSramOver4MErr = ((this->_status->dintrlvSramOver4MErr->getValue()) != 0); + status->pgErr = ((this->_status->pgErr->getValue()) != 0); + status->mpsErr = ((this->_status->mpsErr->getValue()) != 0); + status->fan1Fault = ((this->_status->fan1Fault->getValue()) != 0); + status->fan2Fault = ((this->_status->fan2Fault->getValue()) != 0); + status->pulserThd = ((this->_status->pulserThd->getValue()) != 0); + status->scenPriErr = ((this->_status->scenPriErr->getValue()) != 0); + status->thermalErr = ((this->_status->thermalErr->getValue()) != 0); + status->scenSramErr = ((this->_status->scenSramErr->getValue()) != 0); + status->scenSyncAckErr = ((this->_status->scenSyncAckErr->getValue()) != 0); + status->mlaSyncFifoErr = ((this->_status->mlaSyncFifoErr->getValue()) != 0); + status->dintrlvFifoErr = ((this->_status->dintrlvFifoErr->getValue()) != 0); + status->adcFlagSyncErr = ((this->_status->adcFlagSyncErr->getValue()) != 0); + status->sram1ParityErr = ((this->_status->sram1ParityErr->getValue()) != 0); + status->sram2ParityErr = ((this->_status->sram2ParityErr->getValue()) != 0); + status->mlaSyncPointErr = ((this->_status->mlaSyncPointErr->getValue()) != 0); + status->ddcLpfReloadErr = ((this->_status->ddcLpfReloadErr->getValue()) != 0); + status->dintrlvPointErr = ((this->_status->dintrlvPointErr->getValue()) != 0); + status->dintrlvFrameLost = ((this->_status->dintrlvFrameLost->getValue()) != 0); + status->dmaCtrlTransferErr = ((this->_status->dmaCtrlTransferErr->getValue()) != 0); + status->emulDmaTransferErr = ((this->_status->emulDmaTransferErr->getValue()) != 0); + status->probeDisconnectErr = ((this->_status->probeDisconnectErr->getValue()) != 0); + status->dintrlvOffsetAddrErr = ((this->_status->dintrlvOffsetAddrErr->getValue()) != 0); + status->dintrlvSramOver4MErr = ((this->_status->dintrlvSramOver4MErr->getValue()) != 0); status->probeDetChanInterrupt = ((this->_status->probeDetChanInterrupt->getValue()) != 0); } diff --git a/src/model/hardware/core/lowLevelApi/register/scenPlayer/ScenPlayer.cpp b/src/model/hardware/core/lowLevelApi/register/scenPlayer/ScenPlayer.cpp index 8e38abb..c6992a0 100644 --- a/src/model/hardware/core/lowLevelApi/register/scenPlayer/ScenPlayer.cpp +++ b/src/model/hardware/core/lowLevelApi/register/scenPlayer/ScenPlayer.cpp @@ -55,3 +55,10 @@ void ScenPalyer::PlayerControl::pause(bool pause) const _playerctrl->pause->setValue(pusCmd); _playerctrl->update(); } + +void ScenPalyer::PlayerControl::setHeartBeats(bool heartBeat) const +{ + quint32 pulse = heartBeat ? 1 : 0; + _playerctrl->heartBeats->setValue(pulse); + _playerctrl->update(); +}