diff --git a/developHw.pro.user b/developHw.pro.user index 9550037..e35da08 100644 --- a/developHw.pro.user +++ b/developHw.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId diff --git a/include/model/hardware/device/SonoDevice.h b/include/model/hardware/device/SonoDevice.h index 31d7e43..2704e01 100644 --- a/include/model/hardware/device/SonoDevice.h +++ b/include/model/hardware/device/SonoDevice.h @@ -21,6 +21,7 @@ public: void startDma(); void stopDma(); int getCounter(); + void resetCounter(void); bool isDmaBusy (); void copy(int srcIndex, int dstIndex); const char* getBufferPtr(int index); diff --git a/mainwindow.cpp b/mainwindow.cpp index 0a03eed..4c80ebe 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -27,6 +27,7 @@ MainWindow::MainWindow(QWidget* parent) _vec = new StatusVec; _emul = new EmulatorProperties; _prb = new PrbCase; + _headerLogFile = new QFile (_headerLogPath); movie = new QMovie("/home/hasis/Desktop/hardware/Develop_HardwareTest/gifs/Glass lines.gif"); movie->stop(); @@ -112,7 +113,7 @@ MainWindow::MainWindow(QWidget* parent) _dmaRun = false; _fpsFlag = false; _dmaShow = false; - _getPacket = false; + _headerLogEn = false; _firstFrameEn = false; _programFlag = true; _frameCount = 0; @@ -159,6 +160,8 @@ MainWindow::~MainWindow() delete _emul; delete movie; + + delete _headerLogFile; } /*************************************************************************************************/ @@ -780,18 +783,25 @@ void MainWindow::fpgaProgram(QString& path) /*************************************************************************************************/ void MainWindow::programThreadFinish() { + try + { #ifdef DEVELOP_UI _trx.afeAdcsSync(); #endif - QString str = "done"; - QColor color = Qt::green; - emit labelState(ui->l_programDone, str, color); + QString str = "done"; + QColor color = Qt::green; + emit labelState(ui->l_programDone, str, color); - movie->stop(); - ui->l_programming->hide(); - _programFlag = true; - ui->btn_getFpgaVersion->setEnabled(true); + movie->stop(); + ui->l_programming->hide(); + _programFlag = true; + ui->btn_getFpgaVersion->setEnabled(true); + } + catch(SonoException& e) + { + qDebug() << e.what(); + } } /*************************************************************************************************/ @@ -874,6 +884,7 @@ void MainWindow::delay(quint16 ms) //loop.exec(); } +/*************************************************************************************************/ const QString MainWindow::enum2String(ePg state) const { QString pg; @@ -887,28 +898,67 @@ const QString MainWindow::enum2String(ePg state) const /*************************************************************************************************/ void MainWindow::getFramePacket(QByteArray packet) { - _mutex.lock(); - _dmaBuffer.push_back(packet); - _lastBuffer = packet; - _mutex.unlock(); + quint16 batchId = ((static_cast(packet[128])) & 0x00FF) | + (((static_cast(packet[129])) << 8) & 0xFF00); + quint8 subBatchId = (static_cast(packet[130])); + quint8 frmType = (static_cast(packet[131])); + quint8 cri = (static_cast(packet[132])); + + quint16 bLine = ((static_cast(packet[136])) & 0x00FF) | + (((static_cast(packet[137])) << 8) & 0xFF00); + quint16 bPoint = ((static_cast(packet[138])) & 0x00FF) | + (((static_cast(packet[139])) << 8) & 0xFF00); + quint8 mLine = (static_cast(packet[140])); + quint16 mPoint = ((static_cast(packet[141])) & 0x00FF) | + (((static_cast(packet[142])) << 8) & 0xFF00); + + if (_headerLogEn) + { + QTextStream _headerLog (_headerLogFile); + _headerLog << batchId << "," ; + _headerLog << subBatchId << "," ; + _headerLog << bLine << "," ; + _headerLog << bPoint << "," ; + _headerLog << frmType << "," ; + _headerLog << cri << "," ; + _headerLog << mLine << "," ; + _headerLog << mPoint << "," ; + _headerLog << endl; + } - quint16 batchId = ((static_cast(_lastBuffer[128])) & 0x00FF) | - (((static_cast(_lastBuffer[129])) << 8) & 0xFF00); - quint8 subBatchId = (static_cast(_lastBuffer[130])); + _mutex.lock(); - if(subBatchId == 0) + _dmaBuffer.push_back(packet); + if (_lastBuffer.size() != 0) { - _frameCount++; - if(_getPacket) + quint16 batchIdBuffer = ((static_cast(_lastBuffer[128])) & 0x00FF) | + (((static_cast(_lastBuffer[129])) << 8) & 0xFF00); + + if(ui->btn_scenStart->text() == "Scenario Stop") { - if(_batchIdBuff == batchId && (batchId - _batchIdBuff) > 1) + if((batchId - batchIdBuffer) > 1) { - MESSAGE_BOX("The batch id error is happened."); + on_btn_scenStart_clicked(); + qDebug() << "The batch id error is happened."; + _mutex.unlock(); + return; } } - _batchIdBuff = batchId; - _getPacket = true; + + _frame.push_back(_lastBuffer); + + if ((batchId != batchIdBuffer) && (subBatchId == 0)) + { + _bufferedFrame.clear(); + _bufferedFrame = _frame; + _frame.clear(); + _frameCount++; + } } + _lastBuffer = packet; + + _mutex.unlock(); + } /*************************************************************************************************/ @@ -940,6 +990,9 @@ void MainWindow::on_btn_scenStart_clicked() auto str = ui->btn_scenStart->text(); if(str == "Scenario Start") { + _frame.clear(); + _lastBuffer.clear(); + _bufferedFrame.clear(); QString dmaLogPath = ui->tb_frameLogPath->text(); ui->btn_scenStart->setText("Scenario Stop"); ui->btn_emulator->setText("Emulator Start"); @@ -965,14 +1018,22 @@ void MainWindow::on_btn_scenStart_clicked() dmaLogLayoutVisible(false); ui->chk_continuousShowing->hide(); ui->btn_dmaShow->hide(); + ui->chk_headerLogEn->setChecked(false); + on_chk_headerLogEn_clicked(false); _trx.scenPlayerStop(true); } } catch(SonoException& e) { + _frame.clear(); + _lastBuffer.clear(); + _bufferedFrame.clear(); + ui->chk_headerLogEn->setChecked(false); + on_chk_headerLogEn_clicked(false); ui->chk_continuousShowing->hide(); ui->btn_dmaShow->hide(); ui->btn_scenStart->setText("Scenario Start"); + _trx.scenPlayerStop(true); qDebug() << e.what(); } } @@ -980,11 +1041,15 @@ void MainWindow::on_btn_scenStart_clicked() /*************************************************************************************************/ void MainWindow::on_btn_emulator_clicked() { + _frameCount = 0; auto name = ui->btn_emulator->text(); try { if(name == "Emulator Start") { + _frame.clear(); + _lastBuffer.clear(); + _bufferedFrame.clear(); QString dmaLogPath = ui->tb_frameLogPath->text(); QString emulPath = QFileDialog::getOpenFileName(this, tr("emulator"), @@ -1028,14 +1093,22 @@ void MainWindow::on_btn_emulator_clicked() dmaLogLayoutVisible(false); ui->chk_continuousShowing->hide(); ui->btn_dmaShow->hide(); + ui->chk_headerLogEn->setChecked(false); + on_chk_headerLogEn_clicked(false); _trx.emulatorStop(); } } catch(SonoException& e) { + _frame.clear(); + _lastBuffer.clear(); + _bufferedFrame.clear(); + ui->chk_headerLogEn->setChecked(false); + on_chk_headerLogEn_clicked(false); ui->chk_continuousShowing->hide(); ui->btn_dmaShow->hide(); ui->btn_emulator->setText("Emulator Start"); + _trx.emulatorStop(); qDebug() << e.what(); } } @@ -1223,111 +1296,143 @@ void MainWindow::on_btn_dmaShow_clicked() /*************************************************************************************************/ void MainWindow::show3d() { - _mutex.lock(); - QByteArray temp = _lastBuffer; - _mutex.unlock(); - //--------------------------------------------------------------------- - //3D Plot - //--------------------------------------------------------------------- - ui->plot_2->clearGraphs(); - //qDebug() << "//3D Frame Plot //////////////////"; - //ui->plot_2->setInteractions(QCP::iRangeZoom|QCP::iRangeDrag); - ui->plot_2->axisRect()->setupFullAxesBox(true); - ui->plot_2->xAxis->setLabel("Line"); - ui->plot_2->yAxis->setLabel("Point"); + try + { + _mutex.lock(); + QList plotFrame = _bufferedFrame; + _bufferedFrame.clear(); + _mutex.unlock(); - quint16 batchId = ((static_cast(temp[128])) & 0x00FF) | - (((static_cast(temp[129])) << 8) & 0xFF00); - quint8 subBatchId = (static_cast(temp[130])); - quint8 frmType = (static_cast(temp[131])); - quint8 cri = (static_cast(temp[132])); + QList subBatchId, frmType, cri, mLine; + QList batchId, bLine, bPoint, mPoint; - quint16 bLine = ((static_cast(temp[136])) & 0x00FF) | - (((static_cast(temp[137])) << 8) & 0xFF00); - quint16 bPoint = ((static_cast(temp[138])) & 0x00FF) | - (((static_cast(temp[139])) << 8) & 0xFF00); - quint8 mLine = (static_cast(temp[140])); - quint16 mPoint = ((static_cast(temp[141])) & 0x00FF) | - (((static_cast(temp[142])) << 8) & 0xFF00); - if(bLine > 256 * 8) - { - qDebug() << "ERROR :: (B Line)" << bLine; + quint16 line(0), point(0); - return; - } + ui->plot_2->clearGraphs(); + ui->plot_2->axisRect()->setupFullAxesBox(true); + ui->plot_2->xAxis->setLabel("Line"); + ui->plot_2->yAxis->setLabel("Point"); - if(bPoint > 8192) - { - qDebug() << "ERROR :: (B Point)" << bPoint; + if (plotFrame.size() != 0) + { + foreach (const QByteArray& framePacket, plotFrame) + { + batchId.append(((static_cast(framePacket[128])) & 0x00FF) | + (((static_cast(framePacket[129])) << 8) & 0xFF00)); - return; - } - if(frmType != 0) - { - qDebug() << "ERROR :: (Invalid Frame Type)" << frmType; + bPoint.append(((static_cast(framePacket[138])) & 0x00FF) | + (((static_cast(framePacket[139])) << 8) & 0xFF00)); - return; - } + mPoint.append(((static_cast(framePacket[141])) & 0x00FF) | + (((static_cast(framePacket[142])) << 8) & 0xFF00)); + + bLine.append(((static_cast(framePacket[136])) & 0x00FF) | + (((static_cast(framePacket[137])) << 8) & 0xFF00)); + + subBatchId.append(static_cast(framePacket[130])); + frmType.append(static_cast(framePacket[131])); + mLine.append(static_cast(framePacket[140])); + cri.append(static_cast(framePacket[132])); + } + } + else + return; - qDebug() << "batchId" << batchId; - qDebug() << "subBatchId" << subBatchId; - qDebug() << "bLine" << bLine; - qDebug() << "bPoint" << bPoint; - qDebug() << "frmType" << frmType; - qDebug() << "cri" << cri; - qDebug() << "mLine" << mLine; - qDebug() << "mPoint" << mPoint; - - _colorMap->data()->clear(); - _colorMap->data()->setSize(bLine, bPoint); - _colorMap->data()->setRange(QCPRange(1, bLine), QCPRange(1, bPoint)); - //double x,y,z; - //int xIndex = 0; - //int yIndex = 0; - quint32 max = 0; - auto indx = 0; - for(auto line = 0; line < bLine; line += 1) - { - for(auto pnt = 0; pnt < bPoint; pnt += 1) - { - indx = (line * bPoint + pnt) * 4 + 160; - auto val = ((static_cast(temp[indx])) & 0x000000FF) | - (((static_cast(temp[indx + 1])) << 8) & 0x0000FF00) | - (((static_cast(temp[indx + 2])) << 16) & 0x00FF0000) | - (((static_cast(temp[indx + 3])) << 24) & 0xFF000000); - //xIndex = line; - //yIndex = pnt; - //z = double(val); - //colorMap->data()->cellToCoord(xIndex,yIndex,&x,&y); - if(max < val) + foreach (auto& bL, bLine) + { + if(bL > 256 * 8) { - max = val; + qDebug() << "ERROR :: (B Line)" << bLine; + return; } - _colorMap->data()->setCell(line, pnt, double(val)); + line += bL; } - } - //qDebug() << "indx" << indx; - //qDebug() << "max" << max; - //qDebug() << ui->plot_2->plotLayout()->hasElement(0, 1); - if(!ui->plot_2->plotLayout()->hasElement(0, 1)) + foreach (auto& bP, bPoint) + { + if(bP > 8192) + { + qDebug() << "ERROR :: (B Point)" << bPoint; + return; + } + point = bP; + } + + foreach (auto& fType, frmType) + { + if(fType != 0) + { + qDebug() << "ERROR :: (Invalid Frame Type)" << frmType; + + return; + } + } + + qDebug() << "batchId" << batchId; + qDebug() << "subBatchId" << subBatchId; + qDebug() << "bLine" << bLine; + qDebug() << "bPoint" << bPoint; + qDebug() << "frmType" << frmType; + qDebug() << "cri" << cri; + qDebug() << "mLine" << mLine; + qDebug() << "mPoint" << mPoint; + + _colorMap->data()->clear(); + _colorMap->data()->setSize(line, point); + _colorMap->data()->setRange(QCPRange(1, line), QCPRange(1, point)); + + quint32 max = 0; + auto indx = 0; + auto lnSum = 0; + foreach (const QByteArray& plotPacket, plotFrame) + { + auto lnPacket = (((static_cast(plotPacket[136])) & 0x00FF) | + (((static_cast(plotPacket[137])) << 8) & 0xFF00)); + + for(auto ln = 0; ln < lnPacket; ln += 1) + { + for(auto pnt = 0; pnt < point; pnt += 1) + { + + indx = (ln * point + pnt) * 4 + 160; + auto val = ((static_cast(plotPacket[indx])) & 0x000000FF) | + (((static_cast(plotPacket[indx + 1])) << 8) & 0x0000FF00) | + (((static_cast(plotPacket[indx + 2])) << 16) & 0x00FF0000) | + (((static_cast(plotPacket[indx + 3])) << 24) & 0xFF000000); + + if(max < val) + { + max = val; + } + _colorMap->data()->setCell(lnSum + ln, pnt, double(val)); + } + } + lnSum = lnSum + lnPacket; + } + + if(!ui->plot_2->plotLayout()->hasElement(0, 1)) + { + QCPColorScale* colorScale = new QCPColorScale(ui->plot_2); + ui->plot_2->plotLayout()->addElement(0, 1, colorScale); + colorScale->setType(QCPAxis::atRight); + _colorMap->setColorScale(colorScale); + colorScale->axis()->setLabel("Number"); + _colorMap->setGradient((QCPColorGradient::gpJet)); + QCPMarginGroup* marginGroup = new QCPMarginGroup(ui->plot_2); + ui->plot_2->axisRect()->setMarginGroup(QCP::msBottom | QCP::msTop, marginGroup); + colorScale->setMarginGroup(QCP::msBottom | QCP::msTop, marginGroup); + } + _colorMap->setGradient((QCPColorGradient::gpJet)); + _colorMap->rescaleDataRange(); + + ui->plot_2->rescaleAxes(true); + ui->plot_2->replot(); + } + catch (...) { - QCPColorScale* colorScale = new QCPColorScale(ui->plot_2); - ui->plot_2->plotLayout()->addElement(0, 1, colorScale); - colorScale->setType(QCPAxis::atRight); - _colorMap->setColorScale(colorScale); - colorScale->axis()->setLabel("Number"); - _colorMap->setGradient((QCPColorGradient::gpJet)); - //colorMap->rescaleDataRange(); - QCPMarginGroup* marginGroup = new QCPMarginGroup(ui->plot_2); - ui->plot_2->axisRect()->setMarginGroup(QCP::msBottom | QCP::msTop, marginGroup); - colorScale->setMarginGroup(QCP::msBottom | QCP::msTop, marginGroup); + qDebug() << "Error"; } - _colorMap->setGradient((QCPColorGradient::gpJet)); - _colorMap->rescaleDataRange(); - ui->plot_2->rescaleAxes(true); - ui->plot_2->replot(); } /*************************************************************************************************/ @@ -1379,7 +1484,6 @@ void MainWindow::catchLogCount(quint32 counter, quint32 logRange, QProgressDialo { _progress->setMinimumSize(300, 100); _progress->setLabelText("Please wait..."); - //_progress->setWindowTitle("Frame Packets Logging"); _progress->setWindowTitle("Logging"); _progress->setRange(0, static_cast(logRange)); _progress->setModal(true); @@ -1389,7 +1493,6 @@ void MainWindow::catchLogCount(quint32 counter, quint32 logRange, QProgressDialo _progress->setValue(static_cast(counter)); if(_progress->wasCanceled()) { - //throw SonoException("Frame packets logging is canceled"); throw SonoException("The logging process is canceled"); } } @@ -1399,6 +1502,46 @@ void MainWindow::catchLogCount(quint32 counter, quint32 logRange, QProgressDialo } } +/*************************************************************************************************/ +void MainWindow::on_chk_headerLogEn_clicked(bool checked) +{ + try + { + if (checked) + { + if(_headerLogFile->fileName().isEmpty()) + { + throw SonoException("No file is selected"); + } + + if(!_headerLogFile->open(QIODevice::WriteOnly)) + { + throw SonoException("Couldn't open file for logging"); + } + + QTextStream _headerLog (_headerLogFile); + _headerLog << "batchId, " << "subBatchId, " << "bLine, " << "bPoint, "; + _headerLog << "frmType, " << "cri, " << "mLine, " << "mPoint, "; + _headerLog << endl; + + _headerLogEn = true; + } + else + { + _headerLogEn = false; + if(_headerLogFile->open(QIODevice::WriteOnly)) + { + _headerLogFile->flush(); + _headerLogFile->close(); + } + } + } + catch(SonoException& e) + { + qDebug() << e.what(); + } +} + ///*************************************************************************************************/ ///********************************************Power************************************************/ ///*************************************************************************************************/ @@ -1989,16 +2132,23 @@ void MainWindow::on_btn_setScenVerification_clicked() /*************************************************************************************************/ void MainWindow::on_btn_scenBrowse_clicked() { - QString scenPath = QFileDialog::getExistingDirectory(this, - tr("Scenario File"), - _scenarioFolder, - QFileDialog::ShowDirsOnly); - if (scenPath.isEmpty()) - throw SonoException("No file is selected."); + try + { + QString scenPath = QFileDialog::getExistingDirectory(this, + tr("Scenario File"), + _scenarioFolder, + QFileDialog::ShowDirsOnly); + if (scenPath.isEmpty()) + throw SonoException("No file is selected."); - ui->tb_scenFilesPath->setText(scenPath); - _settings->setValue(SCENARIO_FILE_PATH, scenPath); - ui->tb_scenInfo->clear(); + ui->tb_scenFilesPath->setText(scenPath); + _settings->setValue(SCENARIO_FILE_PATH, scenPath); + ui->tb_scenInfo->clear(); + } + catch(SonoException& e) + { + qDebug() << e.what(); + } } /*************************************************************************************************/ @@ -2007,20 +2157,27 @@ void MainWindow::on_btn_scenInfo_clicked() QString scenInfo = "/hardware/systemCheckParam.csv"; QString path = ui->tb_scenFilesPath->text() + scenInfo; - QFile sysFile(path); - if(sysFile.fileName().isEmpty()) + try { - throw SonoException("No file is selected"); + QFile sysFile(path); + if(sysFile.fileName().isEmpty()) + { + throw SonoException("No file is selected"); + } + if(!sysFile.open(QIODevice::ReadOnly)) + { + throw SonoException("Couldn't open system check param file programming"); + } + + QTextStream checkParam(&sysFile); + QString systemStr = checkParam.readAll(); + ui->tb_scenInfo->setPlainText(systemStr); + sysFile.close(); } - if(!sysFile.open(QIODevice::ReadOnly)) + catch(SonoException& e) { - throw SonoException("Couldn't open system check param file programming"); + qDebug() << e.what(); } - - QTextStream checkParam(&sysFile); - QString systemStr = checkParam.readAll(); - ui->tb_scenInfo->setPlainText(systemStr); - sysFile.close(); } /*************************************************************************************************/ @@ -2601,8 +2758,10 @@ void MainWindow::on_btn_biteSetScenario_clicked() /*************************************************************************************************/ void MainWindow::on_btn_biteBrowse_clicked() { - QString biteIqPath = - QFileDialog::getOpenFileName(this, tr("TxDAC File"), _BITeIqFolder, "*.csv"); + QString biteIqPath = QFileDialog::getOpenFileName(this, + tr("TxDAC File"), + _BITeIqFolder, + "*.csv"); ui->tb_biteFilesPath->setText(biteIqPath); _settings->setValue(BITE_FILE_PATH, biteIqPath); } @@ -2610,43 +2769,49 @@ void MainWindow::on_btn_biteBrowse_clicked() /*************************************************************************************************/ void MainWindow::on_btn_biteIQ_clicked() { + try + { + QString str = "doing"; + QColor color = Qt::red; + emit labelState(ui->l_biteIQFillingDone, str, color); - QString str = "doing"; - QColor color = Qt::red; - emit labelState(ui->l_biteIQFillingDone, str, color); + //BITe file reading to determine the I & Q of txDAC + QString bitePath = ui->tb_biteFilesPath->text(); + QFile biteFile(bitePath); + QTextStream biteLog(&biteFile); + if(biteFile.fileName().isEmpty()) + { + throw SonoException("No file is selected"); + } - //BITe file reading to determine the I & Q of txDAC - QString bitePath = ui->tb_biteFilesPath->text(); - QFile biteFile(bitePath); - QTextStream biteLog(&biteFile); - if(biteFile.fileName().isEmpty()) - { - throw SonoException("No file is selected"); - } + if(!biteFile.open(QIODevice::ReadOnly)) + { + throw SonoException("Couldn't open built-in test file for frame logging"); + } - if(!biteFile.open(QIODevice::ReadOnly)) - { - throw SonoException("Couldn't open built-in test file for frame logging"); - } + QStringList txDac; + QByteArray I; + QByteArray Q; + while(!biteLog.atEnd()) + { + txDac.clear(); + txDac = biteLog.readLine().split(","); + I.append(static_cast(txDac.at(0).toInt())); + Q.append(static_cast(txDac.at(1).toInt())); + } + biteFile.close(); + _trx.setBiteDacData(I, Q); + + delay(100); - QStringList txDac; - QByteArray I; - QByteArray Q; - while(!biteLog.atEnd()) + str = "done"; + color = Qt::green; + emit labelState(ui->l_biteIQFillingDone, str, color); + } + catch(SonoException& e) { - txDac.clear(); - txDac = biteLog.readLine().split(","); - I.append(static_cast(txDac.at(0).toInt())); - Q.append(static_cast(txDac.at(1).toInt())); + qDebug() << e.what(); } - biteFile.close(); - _trx.setBiteDacData(I, Q); - - delay(100); - - str = "done"; - color = Qt::green; - emit labelState(ui->l_biteIQFillingDone, str, color); } /*************************************************************************************************/ @@ -3145,6 +3310,7 @@ void MainWindow::exitApp() } + _trx.emulatorStop(); on_chk_pulserTstModeEn_clicked(false); _trx.setTxDacEnable(BITE_INTERVAL, false); _trx.setAdgCfg(adgGnd); diff --git a/mainwindow.h b/mainwindow.h index f031e83..62b73e6 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -103,6 +103,8 @@ private: static QThread* _uiThread; + QFile* _headerLogFile; + QTimer* _timeout; QEventLoop loop; @@ -164,14 +166,17 @@ private: QString _fpgaProgramFolder = "/home/hasis/Desktop/hardware/hwCode"; QString _scenarioFolder = "/home/hasis/Desktop/hardware/Scenarios"; QString _emulFolder = "/home/hasis/Desktop/hardware/emulator"; - QString _BITeScenFolder = "/home/hasis/Desktop/hardware"; + 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 _headerLogPath = "/home/hasis/Desktop/hardware/Log/frameHeader/headerLog.csv"; QVector _dmaBuffer; QByteArray _lastBuffer; + QList _frame; + QList _bufferedFrame; quint32 _dmaLogCount; quint16 _frameCount; quint16 _batchIdBuff; @@ -180,7 +185,7 @@ private: bool _dmaLog; bool _dmaRun; bool _dmaShow; - bool _getPacket; + bool _headerLogEn; bool _fpsFlag; bool _firstFrameEn; bool _programFlag; @@ -324,6 +329,8 @@ private slots: void on_cb_pulserTstMode_currentIndexChanged(int index); + void on_chk_headerLogEn_clicked(bool checked); + signals: void showMessage(QString message); void threeDReady(); diff --git a/mainwindow.ui b/mainwindow.ui index 92068a8..faa2c2e 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -42,7 +42,7 @@ - 0 + 3 @@ -1408,7 +1408,7 @@ 0 0 - 611 + 651 311 @@ -1504,12 +1504,12 @@ - + 670 20 - 111 + 121 21 @@ -1681,7 +1681,7 @@ 690 0 - 71 + 91 16 @@ -1703,7 +1703,7 @@ 660 50 - 131 + 141 21 diff --git a/src/model/hardware/core/TrxBoard.cpp b/src/model/hardware/core/TrxBoard.cpp index 9e28bea..c9939fd 100644 --- a/src/model/hardware/core/TrxBoard.cpp +++ b/src/model/hardware/core/TrxBoard.cpp @@ -1077,6 +1077,8 @@ void TrxBoard::scenPlayerStart(bool afeHvPwrOn) this->_emul->setEmulatorDis(); + this->_device.resetCounter(); + this->_device.startDma(); if(afeHvPwrOn) @@ -1196,6 +1198,8 @@ void TrxBoard::emulatorStart() this->_emul->setEmulatorEn(); + this->_device.resetCounter(); + this->_device.startDma(); _run = true; diff --git a/src/model/hardware/device/SonoDevice.cpp b/src/model/hardware/device/SonoDevice.cpp index 608f518..b9116b7 100644 --- a/src/model/hardware/device/SonoDevice.cpp +++ b/src/model/hardware/device/SonoDevice.cpp @@ -28,13 +28,13 @@ void SonoDevice::init() void SonoDevice::startDma() { - quint32 dmaCtrl = device.readWord(0, 0x8); + quint32 dmaCtrl = device.readWord(BAR_REG, DMA_CTRL_REG); device.writeWord(BAR_REG, DMA_CTRL_REG, START_COMMAND|dmaCtrl); } void SonoDevice::stopDma() { - quint32 dmaCtrl = device.readWord(0, 0x8); + quint32 dmaCtrl = device.readWord(BAR_REG, DMA_CTRL_REG); device.writeWord(BAR_REG, DMA_CTRL_REG, STOP_COMMAND|dmaCtrl); } @@ -45,6 +45,11 @@ int SonoDevice::getCounter() return temp & COUNTER_MASK; } +void SonoDevice::resetCounter() +{ + device.writeWord(BAR_BRAM, COUNTER_REG, 0); +} + bool SonoDevice::isDmaBusy() { auto temp = device.readWord(BAR_BRAM, COUNTER_REG);