Browse Source

The resetCounter function is added in SonoDevice and also called in scenStartPlayer & emulatorStart functions in trxBoard.cpp

master v2.4
Arash Aletayeb 3 years ago
parent
commit
8248ed6541
  1. 2
      developHw.pro.user
  2. 1
      include/model/hardware/device/SonoDevice.h
  3. 500
      mainwindow.cpp
  4. 11
      mainwindow.h
  5. 12
      mainwindow.ui
  6. 4
      src/model/hardware/core/TrxBoard.cpp
  7. 9
      src/model/hardware/device/SonoDevice.cpp

2
developHw.pro.user

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.10.0, 2021-07-25T09:28:30. -->
<!-- Written by QtCreator 4.10.0, 2021-07-28T10:55:49. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>

1
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);

500
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<quint16>(packet[128])) & 0x00FF) |
(((static_cast<quint16>(packet[129])) << 8) & 0xFF00);
quint8 subBatchId = (static_cast<quint8>(packet[130]));
quint8 frmType = (static_cast<quint8>(packet[131]));
quint8 cri = (static_cast<quint8>(packet[132]));
quint16 bLine = ((static_cast<quint16>(packet[136])) & 0x00FF) |
(((static_cast<quint16>(packet[137])) << 8) & 0xFF00);
quint16 bPoint = ((static_cast<quint16>(packet[138])) & 0x00FF) |
(((static_cast<quint16>(packet[139])) << 8) & 0xFF00);
quint8 mLine = (static_cast<quint8>(packet[140]));
quint16 mPoint = ((static_cast<quint16>(packet[141])) & 0x00FF) |
(((static_cast<quint16>(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<quint16>(_lastBuffer[128])) & 0x00FF) |
(((static_cast<quint16>(_lastBuffer[129])) << 8) & 0xFF00);
quint8 subBatchId = (static_cast<quint8>(_lastBuffer[130]));
_mutex.lock();
if(subBatchId == 0)
_dmaBuffer.push_back(packet);
if (_lastBuffer.size() != 0)
{
_frameCount++;
if(_getPacket)
quint16 batchIdBuffer = ((static_cast<quint16>(_lastBuffer[128])) & 0x00FF) |
(((static_cast<quint16>(_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<QByteArray> plotFrame = _bufferedFrame;
_bufferedFrame.clear();
_mutex.unlock();
quint16 batchId = ((static_cast<quint16>(temp[128])) & 0x00FF) |
(((static_cast<quint16>(temp[129])) << 8) & 0xFF00);
quint8 subBatchId = (static_cast<quint8>(temp[130]));
quint8 frmType = (static_cast<quint8>(temp[131]));
quint8 cri = (static_cast<quint8>(temp[132]));
QList<quint8> subBatchId, frmType, cri, mLine;
QList<quint16> batchId, bLine, bPoint, mPoint;
quint16 bLine = ((static_cast<quint16>(temp[136])) & 0x00FF) |
(((static_cast<quint16>(temp[137])) << 8) & 0xFF00);
quint16 bPoint = ((static_cast<quint16>(temp[138])) & 0x00FF) |
(((static_cast<quint16>(temp[139])) << 8) & 0xFF00);
quint8 mLine = (static_cast<quint8>(temp[140]));
quint16 mPoint = ((static_cast<quint16>(temp[141])) & 0x00FF) |
(((static_cast<quint16>(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<quint16>(framePacket[128])) & 0x00FF) |
(((static_cast<quint16>(framePacket[129])) << 8) & 0xFF00));
return;
}
if(frmType != 0)
{
qDebug() << "ERROR :: (Invalid Frame Type)" << frmType;
bPoint.append(((static_cast<quint16>(framePacket[138])) & 0x00FF) |
(((static_cast<quint16>(framePacket[139])) << 8) & 0xFF00));
return;
}
mPoint.append(((static_cast<quint16>(framePacket[141])) & 0x00FF) |
(((static_cast<quint16>(framePacket[142])) << 8) & 0xFF00));
bLine.append(((static_cast<quint16>(framePacket[136])) & 0x00FF) |
(((static_cast<quint16>(framePacket[137])) << 8) & 0xFF00));
subBatchId.append(static_cast<quint8>(framePacket[130]));
frmType.append(static_cast<quint8>(framePacket[131]));
mLine.append(static_cast<quint8>(framePacket[140]));
cri.append(static_cast<quint8>(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<quint32>(temp[indx])) & 0x000000FF) |
(((static_cast<quint32>(temp[indx + 1])) << 8) & 0x0000FF00) |
(((static_cast<quint32>(temp[indx + 2])) << 16) & 0x00FF0000) |
(((static_cast<quint32>(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<quint16>(plotPacket[136])) & 0x00FF) |
(((static_cast<quint16>(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<quint32>(plotPacket[indx])) & 0x000000FF) |
(((static_cast<quint32>(plotPacket[indx + 1])) << 8) & 0x0000FF00) |
(((static_cast<quint32>(plotPacket[indx + 2])) << 16) & 0x00FF0000) |
(((static_cast<quint32>(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<qint32>(logRange));
_progress->setModal(true);
@ -1389,7 +1493,6 @@ void MainWindow::catchLogCount(quint32 counter, quint32 logRange, QProgressDialo
_progress->setValue(static_cast<qint32>(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<qint8>(txDac.at(0).toInt()));
Q.append(static_cast<qint8>(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<qint8>(txDac.at(0).toInt()));
Q.append(static_cast<qint8>(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);

11
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<QByteArray> _dmaBuffer;
QByteArray _lastBuffer;
QList<QByteArray> _frame;
QList<QByteArray> _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();

12
mainwindow.ui

@ -42,7 +42,7 @@
<string/>
</property>
<property name="currentIndex">
<number>0</number>
<number>3</number>
</property>
<widget class="QWidget" name="tab_0">
<attribute name="title">
@ -1408,7 +1408,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>611</width>
<width>651</width>
<height>311</height>
</rect>
</property>
@ -1504,12 +1504,12 @@
</item>
</layout>
</widget>
<widget class="QCheckBox" name="checkBox_5">
<widget class="QCheckBox" name="chk_headerLogEn">
<property name="geometry">
<rect>
<x>670</x>
<y>20</y>
<width>111</width>
<width>121</width>
<height>21</height>
</rect>
</property>
@ -1681,7 +1681,7 @@
<rect>
<x>690</x>
<y>0</y>
<width>71</width>
<width>91</width>
<height>16</height>
</rect>
</property>
@ -1703,7 +1703,7 @@
<rect>
<x>660</x>
<y>50</y>
<width>131</width>
<width>141</width>
<height>21</height>
</rect>
</property>

4
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;

9
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);

Loading…
Cancel
Save