From dc17cb4c406c558124324c4918dfa851424beac2 Mon Sep 17 00:00:00 2001 From: Arash Aletayeb Date: Sun, 2 May 2021 18:32:46 +0200 Subject: [PATCH] fix BeamFormer address and FPGA program --- developHw.pro | 3 +- developHw.pro.user | 2 +- include/model/hardware/core/TrxBoard.h | 9 +- .../model/hardware/core/register/Register.h | 2 +- .../registerDefinition/ApodizationLut.h | 1 + .../register/boardsCtrlMngt/BoardsCtrlMngt.h | 24 +- .../clockDistributer/ClockDistributer.h | 4 +- .../core/register/fpgaProgram/FpgaProgram.h | 5 +- main.cpp | 2 +- mainwindow.cpp | 725 +++++++++++++----- mainwindow.h | 51 +- mainwindow.ui | 542 +++++++++++-- src/model/hardware/core/TrxBoard.cpp | 30 +- .../boardsCtrlMngt/BoardsCtrlMngt.cpp | 248 +++--- .../core/register/builtInTest/BuiltInTest.cpp | 10 +- .../clockDistributer/ClockDistributer.cpp | 22 +- .../core/register/fpgaProgram/FpgaProgram.cpp | 33 +- 17 files changed, 1239 insertions(+), 474 deletions(-) diff --git a/developHw.pro b/developHw.pro index 51061a0..b84da53 100644 --- a/developHw.pro +++ b/developHw.pro @@ -2,7 +2,8 @@ QT += core gui printsupport greaterThan(QT_MAJOR_VERSION, 4): QT += widgets -CONFIG += c++11 +CONFIG += c++11 \ + console # The following define makes your compiler emit warnings if you use # any Qt feature that has been marked deprecated (the exact warnings diff --git a/developHw.pro.user b/developHw.pro.user index 1b66796..cc0ae80 100644 --- a/developHw.pro.user +++ b/developHw.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId diff --git a/include/model/hardware/core/TrxBoard.h b/include/model/hardware/core/TrxBoard.h index 0ee1fdd..9cc51c7 100644 --- a/include/model/hardware/core/TrxBoard.h +++ b/include/model/hardware/core/TrxBoard.h @@ -3,6 +3,7 @@ #include #include +#include #include "model/hardware/core/register/clockDistributer/ClockDistributer.h" #include "model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.h" @@ -22,8 +23,8 @@ #define EEPROM_ID_BYTE_BEGIN 0U #define EEPROM_ID_BYTE_NUMBER 4U -#define EEPROM_INFO_BYTE_BEGIN 10U -#define EEPROM_INFO_BYTE_NUMBER 5U +#define EEPROM_INFO_BYTE_BEGIN 0U +#define EEPROM_INFO_BYTE_NUMBER 30U struct ProbeElementPosition @@ -59,7 +60,9 @@ private: const quint32 _offsetSlave2; bool _allow; - SonoDevice _device; + SonoDevice _device; + AdcVoltages* _adc; + VoltagesPg* _pg; ClockDistributer* _clkDistributer; BoardsCtrlMngt* _bCtrlMngt; diff --git a/include/model/hardware/core/register/Register.h b/include/model/hardware/core/register/Register.h index bb197e1..0b3b6ea 100644 --- a/include/model/hardware/core/register/Register.h +++ b/include/model/hardware/core/register/Register.h @@ -29,7 +29,7 @@ protected: public: //Register(quint8 bar, quint32 offset, SonoDevice* device, quint32 arrayLength=0); // Constructor for general Registers: single and array Register(quint8 bar, quint32 offset, SonoDevice* device); - virtual ~Register(); + ~Register(); quint32 getValue(); void setValue(quint32 value); diff --git a/include/model/hardware/core/register/beamFormer/registerDefinition/ApodizationLut.h b/include/model/hardware/core/register/beamFormer/registerDefinition/ApodizationLut.h index 1b69b94..27a9d3e 100644 --- a/include/model/hardware/core/register/beamFormer/registerDefinition/ApodizationLut.h +++ b/include/model/hardware/core/register/beamFormer/registerDefinition/ApodizationLut.h @@ -21,6 +21,7 @@ private: void prepareData(quint32 index) override { apodizationPrp->setValue(_apodization.at(static_cast(index))); + //apodizationPrp->setValue(_apodization[static_cast(index)]); } public: diff --git a/include/model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.h b/include/model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.h index 4060ef6..60a48b8 100644 --- a/include/model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.h +++ b/include/model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.h @@ -2,6 +2,7 @@ #define BOARDSCTRLMNGT_H #include +#include #include #include #include "registerDefinition/BoardsSpecs.h" @@ -113,9 +114,9 @@ private: struct EepromReq { - qint8 dataIn; - quint32 address; - quint8 probeSelect; + quint32 dataIn; + quint32 address; + quint32 probeSelect; }*_rom; struct AttenuationFactor @@ -157,8 +158,6 @@ private: QTimer* _timer; - VoltagesPg* _pg; - template void eepromWrite (QString& str, quint32 addr, quint8 prbSel, T1* request, T2* status); @@ -238,17 +237,22 @@ private: void timerShot (quint16 ms) const; void timerStop (void) const; -private slots: - bool checkTimerShot (void) const; +//private slots: + bool checkTimeout (void) const; + public: explicit BoardsCtrlMngt(SonoDevice* device) : BoardsSpecs(device) { - _timer = new QTimer(this); + _timer = new QTimer(); + _rom = new EepromReq(); + _mpsDacs = new MpsDacs(); } ~BoardsCtrlMngt() { delete _timer; + delete _rom; + delete _mpsDacs; } quint32 getPid (void) const; @@ -260,8 +264,8 @@ public: float getTrxTempSensor (void) const; float getTrxFpgaTemp (void) const; - AdcVoltages* getTrxBoardVoltages (void); - VoltagesPg* getTrxVoltagesPg (void); + void getTrxBoardVoltages (AdcVoltages* adc, VoltagesPg* pg); + void getTrxVoltagesPg (VoltagesPg* pg); void getSupervisorValue (SupervisorRbValue* sValue) const; void getMpsFault (MpsFaultStatus* faultStatus) const; diff --git a/include/model/hardware/core/register/clockDistributer/ClockDistributer.h b/include/model/hardware/core/register/clockDistributer/ClockDistributer.h index f8410b9..7a7c823 100644 --- a/include/model/hardware/core/register/clockDistributer/ClockDistributer.h +++ b/include/model/hardware/core/register/clockDistributer/ClockDistributer.h @@ -26,7 +26,7 @@ private: quint32 cwClkDivision; bool cwClkEnable; bool spiClkDistStart; - }*_cwModeEnable; + }_cwModeEnable; struct ModeStatus { @@ -36,7 +36,7 @@ private: bool getEepromClkDistDone(void) const; }_cwModeStatus; - void setCwModeEnable(ModeEnable*); + void setCwModeEnable(ModeEnable &_enable); bool connectionCheck(void) const; public: diff --git a/include/model/hardware/core/register/fpgaProgram/FpgaProgram.h b/include/model/hardware/core/register/fpgaProgram/FpgaProgram.h index ada8b1f..4ce3dfd 100644 --- a/include/model/hardware/core/register/fpgaProgram/FpgaProgram.h +++ b/include/model/hardware/core/register/fpgaProgram/FpgaProgram.h @@ -2,6 +2,8 @@ #define FPGAPROGRAM_H #include +#include +#include #include "registerDefinition/SlaveFpgaNumber.h" #include "registerDefinition/SerialProgramData.h" #include "registerDefinition/SerialProgramStatus.h" @@ -33,10 +35,11 @@ private: // bool getFpgaS0Done(); // bool getFpgaS1Done(); // bool getFpgaS2Done(); - }_status; + }*_status; void setSlaveFpgaNumber (quint8& number) const; + public: explicit FpgaProgram(SonoDevice* device); ~FpgaProgram(); diff --git a/main.cpp b/main.cpp index 555b9dc..9d59637 100644 --- a/main.cpp +++ b/main.cpp @@ -1,7 +1,7 @@ #include "mainwindow.h" +#include #include #include -#include int main(int argc, char *argv[]) { diff --git a/mainwindow.cpp b/mainwindow.cpp index 69a218c..d9e4cf5 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -11,7 +11,12 @@ MainWindow::MainWindow(QWidget *parent) _usd = new UltraSoundDevice(); _usd->device->init(); - _timer = new QTimer(); + _timeout = new QTimer(); + + _receiveConfig = new ReceiverConfiguration; + _healStatus = new HealthStatus; + _rxBfPrp = new RxBeamformerProperties; + _bCtrl = new BoardsCtrlMngt (_usd->device); // _dial = new WaitDialog(); // _dial->setModal(true); @@ -64,7 +69,7 @@ MainWindow::MainWindow(QWidget *parent) //connect(this, &MainWindow::updateAdcLoggerProgressVisibility, this, &MainWindow::newAdcLoggerProgressVisibility); connect(this, &MainWindow::showMessage, this, &MainWindow::newMessage); - connect(_timer, &QTimer::timeout, this, &MainWindow::timeout); + connect(_timeout, &QTimer::timeout, this, &MainWindow::timeout); // ui->btn_scenarioStartStop->setText(START); // ui->btn_scenarioPauseResume->setText(PAUSE); @@ -117,7 +122,7 @@ MainWindow::MainWindow(QWidget *parent) // if(value != 0) // ui->ch_testMode->setCheckState(Qt::CheckState::Checked); - //_timer->start(5000); + _timeout->start(1000); setReceiverConfiguration(); setBlendWeight(); @@ -127,6 +132,12 @@ MainWindow::MainWindow(QWidget *parent) setDTgc(); setATgc(); setLpf(); + + setRxBeamformerPrp(); + setPulseProperties(); + setAfeProperties(); + setProbeElement(); + setApodization(); } MainWindow::~MainWindow() @@ -139,7 +150,11 @@ MainWindow::~MainWindow() //delete _dial; - delete _timer; + delete _timeout; + + delete _receiveConfig; + + delete _healStatus; } @@ -518,10 +533,20 @@ MainWindow::~MainWindow() //} /*************************************************************************************************/ -//void MainWindow::fpgaProgrammer(QString path) -//{ -// trx.slaveFpgaProgram(path); -//} +void MainWindow::fpgaProgrammer(QString path) +{ + try + { + _trx.slaveFpgaProgram(path); + ui->l_programDone->setText("done"); + changeLabelTextColor(ui->l_programDone, Qt::green); + } + catch (SonoException& e) + { + qDebug() << e.what(); + } + +} /*************************************************************************************************/ //quint64 MainWindow::byteArrayTo64LittleEndian(QByteArray data) @@ -567,130 +592,165 @@ MainWindow::~MainWindow() /*************************************************************************************************/ void MainWindow::timeout() { -// auto pcie_id = _usd->readWord(0, 2); + //auto pcie_id = _usd->readWord(0, 2); - auto pcie_pid = trx.deviceId(); - auto pcie_vid = trx.vendorId(); + auto pcie_pid = _trx.deviceId(); + auto pcie_vid = _trx.vendorId(); auto pcie_id = (pcie_pid << 16)|pcie_vid; ui->l_PCIeID->setText(QString::number(pcie_id, 16)); - delay(1); + delay(10); -// bool probeADetected=_bCtrl->getConnectedPrb().at(0); -// bool probeBDetected=_bCtrl->getConnectedPrb().at(1); -// bool probeCDetected=_bCtrl->getConnectedPrb().at(2); -// bool probeDDetected=_bCtrl->getConnectedPrb().at(3); + bool probeADetected=_bCtrl->getConnectedPrb().at(0); + bool probeBDetected=_bCtrl->getConnectedPrb().at(1); + bool probeCDetected=_bCtrl->getConnectedPrb().at(2); + bool probeDDetected=_bCtrl->getConnectedPrb().at(3); -// if(probeDDetected == true){ -// ui->l_detectedProbe->setText("D"); -// } -// else if (probeCDetected == true) { -// ui->l_detectedProbe->setText("C"); -// } -// else if (probeBDetected == true) { -// ui->l_detectedProbe->setText("B"); -// } -// else if (probeADetected == true) { -// ui->l_detectedProbe->setText("A"); -// } -// else{ -// ui->l_detectedProbe->setText("None"); -// } + if(probeDDetected == true){ + ui->l_detectedProbe->setText("D"); + } + else if (probeCDetected == true) { + ui->l_detectedProbe->setText("C"); + } + else if (probeBDetected == true) { + ui->l_detectedProbe->setText("B"); + } + else if (probeADetected == true) { + ui->l_detectedProbe->setText("A"); + } + else{ + ui->l_detectedProbe->setText("None"); + } -//auto detectedPrb = _usd->readWord(0x26078, 0); -// detectedPrb = detectedPrb & (0xF); -// if(detectedPrb == 0x7){ -// ui->l_detectedProbe->setText("D"); -// } -// else if (detectedPrb == 0xB) { -// ui->l_detectedProbe->setText("C"); -// } -// else if (detectedPrb == 0xD) { -// ui->l_detectedProbe->setText("B"); -// } -// else if (detectedPrb == 0xE) { -// ui->l_detectedProbe->setText("A"); -// } -// else{ -// ui->l_detectedProbe->setText("None"); -// } +////auto detectedPrb = _usd->readWord(0x26078, 0); +//// detectedPrb = detectedPrb & (0xF); +//// if(detectedPrb == 0x7){ +//// ui->l_detectedProbe->setText("D"); +//// } +//// else if (detectedPrb == 0xB) { +//// ui->l_detectedProbe->setText("C"); +//// } +//// else if (detectedPrb == 0xD) { +//// ui->l_detectedProbe->setText("B"); +//// } +//// else if (detectedPrb == 0xE) { +//// ui->l_detectedProbe->setText("A"); +//// } +//// else{ +//// ui->l_detectedProbe->setText("None"); +//// } delay(10); -// auto tempSensor = _usd->readWord(0x26078, 0); -// float temp = tempSensor; -// if (((tempSensor >> 10) & 0x01) == 0x01) -// { -// temp *= -1; -// } -// temp *= 0.125f; - // auto detected_probe = _usd->readWord(0, 0); - // ui->l_detectedProbe->setText(QString::number(detected_probe, 16)); - // delay(100); +//// auto tempSensor = _usd->readWord(0x26078, 0); +//// float temp = tempSensor; +//// if (((tempSensor >> 10) & 0x01) == 0x01) +//// { +//// temp *= -1; +//// } +//// temp *= 0.125f; +// // auto detected_probe = _usd->readWord(0, 0); +// // ui->l_detectedProbe->setText(QString::number(detected_probe, 16)); +// // delay(100); + +// //auto interruptVec = _usd->readWord(0x0, 0); +// //ui->l_intrVector->setText(QString::number(interruptVec, 16)); - //auto interruptVec = _usd->readWord(0x0, 0); - //ui->l_intrVector->setText(QString::number(interruptVec, 16)); + _trx.getHealthStatus(_healStatus); - HealthStatus* healStatus; - trx.getHealthStatus(healStatus); + /******************* System Monitoring *********************/ - float tempSensor = healStatus->systemTemperature; + float tempSensor = _healStatus->systemTemperature; ui->l_Temp->setText(QString("%1").arg(tempSensor)); delay(10); - auto adcCh1 = healStatus->adcMon->mon12Vin; + auto adcCh1 = _healStatus->adcMon->mon12Vin; ui->l_adcCh1->setText(QString("%1").arg(adcCh1)); delay(10); - auto adcCh2 = healStatus->adcMon->mon5Vin; + auto adcCh2 = _healStatus->adcMon->mon5Vin; ui->l_adcCh2->setText(QString("%1").arg(adcCh2)); delay(10); - auto adcCh3 = healStatus->adcMon->prbZeroEncoder; + auto adcCh3 = _healStatus->adcMon->prbZeroEncoder; ui->l_adcCh3->setText(QString("%1").arg(adcCh3)); delay(10); - auto adcCh4 = healStatus->adcMon->prbCtrl3P3V; + auto adcCh4 = _healStatus->adcMon->prbCtrl3P3V; ui->l_adcCh4->setText(QString("%1").arg(adcCh4)); delay(10); - auto adcCh5 = healStatus->adcMon->afeVcntlp; + auto adcCh5 = _healStatus->adcMon->afeVcntlp; ui->l_adcCh5->setText(QString("%1").arg(adcCh5)); delay(10); - auto adcCh6 = healStatus->adcMon->mon3P3V; + auto adcCh6 = _healStatus->adcMon->mon3P3V; ui->l_adcCh6->setText(QString("%1").arg(adcCh6)); delay(10); - auto adcCh7 = healStatus->adcMon->monAfeA1P8V; + auto adcCh7 = _healStatus->adcMon->monAfeA1P8V; ui->l_adcCh7->setText(QString("%1").arg(adcCh7)); delay(10); - auto adcCh8 = healStatus->adcMon->monAfeD1P8V; + auto adcCh8 = _healStatus->adcMon->monAfeD1P8V; ui->l_adcCh8->setText(QString("%1").arg(adcCh8)); delay(10); -// bool fan1=pwr.getFan1Fault(); -// ui->l_fan1Flt->setText(QVariant(fan1).toString()); -// auto colorFan1 = fan1 ? Qt::red : Qt::green; -// changeLabelTextColor(ui->l_fan1Flt, colorFan1); -// delay(10); + /******************* Power Good *********************/ -// bool fan2=pwr.getFan2Fault(); -// ui->l_fan2Flt->setText(QVariant(fan2).toString()); -// auto colorFan2 = fan2 ? Qt::red : Qt::green; -// changeLabelTextColor(ui->l_fan2Flt, colorFan2); -// delay(10); + auto regAPg = _healStatus->voltsPg->regulatorA; + ui->l_pgRegA->setText(enum2String(regAPg)); + delay(10); -// bool cmdDoneI2c=pwr.getI2cCmdDone(); -// ui->l_cmdDone->setText(QVariant(cmdDoneI2c).toString()); -// auto colorCmdDone = cmdDoneI2c ? Qt::green : Qt::red; -// changeLabelTextColor(ui->l_cmdDone, colorCmdDone); -// delay(10); + auto regBPg = _healStatus->voltsPg->regulatorB; + ui->l_pgRegB->setText(enum2String(regBPg)); + delay(10); -// bool cmdErrorI2c=pwr.getI2cCmdErr(); -// ui->l_cmdError->setText(QVariant(cmdErrorI2c).toString()); -// auto colorCmdError = cmdErrorI2c ? Qt::red : Qt::green; -// changeLabelTextColor(ui->l_cmdError, colorCmdError); -// delay(10); + auto pg12v = _healStatus->voltsPg->mon12Vin; + ui->l_pg12Vin->setText(enum2String(pg12v)); + delay(10); + + auto pg5v = _healStatus->voltsPg->mon5Vin; + ui->l_pg5Vin->setText(enum2String(pg5v)); + delay(10); + + auto Pg3P3 = _healStatus->voltsPg->mon3P3V; + ui->l_pg3P3->setText(enum2String(Pg3P3)); + delay(10); + + auto pgAvdd = _healStatus->voltsPg->monAfeA1P8V; + ui->l_pg1P8Avdd->setText(enum2String(pgAvdd)); + delay(10); + + auto pgDvdd = _healStatus->voltsPg->monAfeD1P8V; + ui->l_pg1P8Dvdd->setText(enum2String(pgDvdd)); + delay(10); + + auto pgPrbCtrl = _healStatus->voltsPg->prbCtrl3P3V; + ui->l_pgPrbCtrl3P3->setText(enum2String(pgPrbCtrl)); + delay(10); + +//// bool fan1=pwr.getFan1Fault(); +//// ui->l_fan1Flt->setText(QVariant(fan1).toString()); +//// auto colorFan1 = fan1 ? Qt::red : Qt::green; +//// changeLabelTextColor(ui->l_fan1Flt, colorFan1); +//// delay(10); + +//// bool fan2=pwr.getFan2Fault(); +//// ui->l_fan2Flt->setText(QVariant(fan2).toString()); +//// auto colorFan2 = fan2 ? Qt::red : Qt::green; +//// changeLabelTextColor(ui->l_fan2Flt, colorFan2); +//// delay(10); + +//// bool cmdDoneI2c=pwr.getI2cCmdDone(); +//// ui->l_cmdDone->setText(QVariant(cmdDoneI2c).toString()); +//// auto colorCmdDone = cmdDoneI2c ? Qt::green : Qt::red; +//// changeLabelTextColor(ui->l_cmdDone, colorCmdDone); +//// delay(10); + +//// bool cmdErrorI2c=pwr.getI2cCmdErr(); +//// ui->l_cmdError->setText(QVariant(cmdErrorI2c).toString()); +//// auto colorCmdError = cmdErrorI2c ? Qt::red : Qt::green; +//// changeLabelTextColor(ui->l_cmdError, colorCmdError); +//// delay(10); } @@ -884,22 +944,23 @@ void MainWindow::on_btn_fpgaBrowse_clicked() /*************************************************************************************************/ void MainWindow::on_btn_fpgaProgram_clicked() { -// auto bar = 0; -// auto offset = 0x400; + ui->l_programDone->setText("doing"); + changeLabelTextColor(ui->l_programDone, Qt::red); auto path = ui->tb_fpgaBit->text(); - try { - trx.slaveFpgaProgram(path); - return; - } - catch (SonoException& e) { - qDebug() << e.what(); - } + //return; + + //catch (SonoException& e) { + // qDebug() << e.what(); + // + //} // QFutureWatcher watcher; // connect(&watcher, &QFutureWatcher::finished, this, &MainWindow::threadFinished); -// auto future = QtConcurrent::run(this, &MainWindow::fpgaProgrammer, bar, offset, path); + + QtConcurrent::run(this, &MainWindow::fpgaProgrammer, path); + // watcher.setFuture(future); // _dial->exec(); // disconnect(&watcher, &QFutureWatcher::finished, this, &MainWindow::threadFinished); @@ -1210,13 +1271,13 @@ void MainWindow::on_cb_selectedProbe_currentIndexChanged(int index) // } if(indx == 0){ - trx.selectProbe(prbA); + _trx.selectProbe(prbA); }else if(indx == 1){ - trx.selectProbe(prbB); + _trx.selectProbe(prbB); }else if(indx == 2){ - trx.selectProbe(prbC); + _trx.selectProbe(prbC); }else { - trx.selectProbe(prbD); + _trx.selectProbe(prbD); } } @@ -1338,7 +1399,7 @@ void MainWindow::on_cb_selectedProbe_currentIndexChanged(int index) //// auto value = 0; //// value = _usd->readWord(offset, bar); //// _usd->writeWord(offset, bar, value | 0x100); -// trx.init(); +// _trx.init(); // ui->btn_HVOnOff->setText("Probe ctrl init"); // } // else{ @@ -1365,7 +1426,7 @@ void MainWindow::on_cb_selectedProbe_currentIndexChanged(int index) //// _usd->writeWord(offset, bar, value | 0x200); //// relay.setMotorMuxPwrEn(true); //// ui->btn_motorOnOff->setText(MOTOR_OFF); -// trx.init(); +// _trx.init(); // ui->btn_motorOnOff->setText("Probe ctrl init"); // } // else{ @@ -1391,7 +1452,7 @@ void MainWindow::on_cb_selectedProbe_currentIndexChanged(int index) //// _usd->writeWord(offset, bar, value | (0x10)); //// relay.setProbeALowPwrEn(true); //// ui->btn_pwr1OnOff->setText(PWR1_OFF); -// trx.init(); +// _trx.init(); // ui->btn_pwr1OnOff->setText("Probe ctrl init"); // } // else{ @@ -1417,7 +1478,7 @@ void MainWindow::on_cb_selectedProbe_currentIndexChanged(int index) //// _usd->writeWord(offset, bar, value | (0x20)); //// relay.setProbeBLowPwrEn(true); //// ui->btn_pwr2OnOff->setText(PWR2_OFF); -// trx.init(); +// _trx.init(); // ui->btn_pwr2OnOff->setText("Probe ctrl init"); // } // else{ @@ -1443,7 +1504,7 @@ void MainWindow::on_cb_selectedProbe_currentIndexChanged(int index) //// _usd->writeWord(offset, bar, value | (0x40)); //// relay.setProbeCLowPwrEn(true); //// ui->btn_pwr3OnOff->setText(PWR3_OFF); -// trx.init(); +// _trx.init(); // ui->btn_pwr3OnOff->setText("Probe ctrl init"); // } // else{ @@ -1469,7 +1530,7 @@ void MainWindow::on_cb_selectedProbe_currentIndexChanged(int index) //// _usd->writeWord(offset, bar, value | (0x80)); //// relay.setProbeDLowPwrEn(true); //// ui->btn_pwr4OnOff->setText(PWR4_OFF); -// trx.init(); +// _trx.init(); // ui->btn_pwr4OnOff->setText("Probe ctrl init"); // } // else{ @@ -1511,13 +1572,15 @@ void MainWindow::on_cb_selectedProbe_currentIndexChanged(int index) /********************************************************************/ void MainWindow::delay(int ms) { - QEventLoop* loop; - QTimer* timer; - timer->singleShot(ms, loop, SLOT(QEventLoop::quit)); -// connect(&timer, &QTimer::timeout, &loop, &QEventLoop::quit); -// timer.start(msec); - loop->exec(); -// timer.stop(); + delayTimer.singleShot(ms, &loop, &QEventLoop::quit); + loop.exec(); +} + +const QString MainWindow::enum2String(ePg state) const +{ + QString pg; + pg = (state) ? "good" : "bad"; + return pg; } /*************************************************************************************************/ @@ -1802,7 +1865,7 @@ void MainWindow::delay(int ms) //// pwr.setDAcs(true, cwdValue, hvbValue, hvaValue); //// pwr.setDAcs(false, cwdValue, hvbValue, hvaValue); -// trx.mpsSetAo(hvaValue, hvbValue); +// _trx.mpsSetAo(hvaValue, hvbValue); //// i2cDone=pwr.getI2cCmdDone(); //// while (i2cDone==false){ @@ -1877,7 +1940,7 @@ void MainWindow::delay(int ms) //// } //// // delay (100); -// trx.init(); // p24_On +// _trx.init(); // p24_On //// i2cDone=pwr.getI2cCmdDone(); //// while (i2cDone==false){ //// i2cDone=pwr.getI2cCmdDone(); @@ -1920,16 +1983,14 @@ void MainWindow::delay(int ms) //// while (i2cDone==false){ //// i2cDone=pwr.getI2cCmdDone(); //// } -// trx.mpsReset(); +// _trx.mpsReset(); //} /*************************************************************************************************/ void MainWindow::on_btn_updateRdbackValue_clicked() { - SupervisorRbValue* supRbValue; - trx.supervisorRbValue(supRbValue); - + _trx.supervisorRbValue(supRbValue); auto hvapValue=supRbValue->hvap; ui->l_hvap->setText(QString::number(hvapValue, 'f', 3)); @@ -1972,8 +2033,7 @@ void MainWindow::on_btn_updateRdbackValue_clicked() delay(10); /********************Faults***********************/ - MpsFaultStatus* faultStatus; - trx.mpsFaultStatus(faultStatus); + _trx.mpsFaultStatus(faultStatus); bool hvapFlt=faultStatus->hvap; ui->l_hvapFlt->setText(QVariant(hvapFlt).toString()); @@ -2479,7 +2539,7 @@ void MainWindow::on_btn_updateRdbackValue_clicked() //// ptmMngt.trxEepromWrite(eepromData,addr,len); //// eepromData = ptmMngt.trxEepromRead(addr, len); // trxEepromWrite(eepromData, addr, _bCtrl); -// trx.trxInfo(); +// _trx.trxInfo(); // qDebug() << "EEPROM Data : "<< eepromData; // } @@ -2574,7 +2634,9 @@ void MainWindow::on_btn_updateRdbackValue_clicked() // delay(20); //} - +/*************************************************************************************************/ +/**************************************** DSP ****************************************************/ +/*************************************************************************************************/ void MainWindow::setReceiverConfiguration() { _receiveConfig->mla.clear(); @@ -2594,13 +2656,13 @@ void MainWindow::setReceiverConfiguration() _receiveConfig->subtractFilterEn.clear(); for (quint8 i = 0; i < 8; i++){ - _receiveConfig->mla.append(i); - _receiveConfig->stb.append(i*2); - _receiveConfig->lpfSel.append(i*3); - _receiveConfig->aTgcSel.append(i*4); - _receiveConfig->focusNo.append(i*5); - _receiveConfig->lineMode.append(i*6); - _receiveConfig->ncoFreqSel.append(i*7); + _receiveConfig->mla.append(i % 7); + _receiveConfig->stb.append((i*2) % 3); + _receiveConfig->lpfSel.append((i*3) % 3); + _receiveConfig->aTgcSel.append((i*4) % 3); + _receiveConfig->focusNo.append((i*5) % 3); + _receiveConfig->lineMode.append((i*6) % 15); + _receiveConfig->ncoFreqSel.append((i*7) % 7); _receiveConfig->absEn.append((i % 2)!=0); _receiveConfig->ddcEn.append((i % 2)!=0); _receiveConfig->dpeEn.append((i % 2)!=0); @@ -2615,12 +2677,12 @@ void MainWindow::setReceiverConfiguration() void MainWindow::on_btn_receiveConfig_clicked() { - ui->l_receiveConfigState->setText("false"); + ui->l_receiveConfigState->setText("doing"); changeLabelTextColor(ui->l_receiveConfigState, Qt::red); - trx.scenReceiverConfigurationLut(_receiveConfig); + _trx.scenReceiverConfigurationLut(_receiveConfig); - ui->l_receiveConfigState->setText("true"); + ui->l_receiveConfigState->setText("done"); changeLabelTextColor(ui->l_receiveConfigState, Qt::green); } @@ -2631,19 +2693,19 @@ void MainWindow::setLineFilter() _lineFilter.clear(); for (quint8 i = 0; i < 4; i++) { - _lineFilter.append(i*10); + _lineFilter.append(i); } } void MainWindow::on_btn_lineFilter_clicked() { - ui->l_lineFilter->setText("false"); + ui->l_lineFilter->setText("doing"); changeLabelTextColor(ui->l_lineFilter, Qt::red); - trx.scenLineFilterCoefficient(_lineFilter); + _trx.scenLineFilterCoefficient(_lineFilter); - ui->l_lineFilter->setText("true"); + ui->l_lineFilter->setText("done"); changeLabelTextColor(ui->l_lineFilter, Qt::green); } @@ -2661,12 +2723,12 @@ void MainWindow::setFreqLut() void MainWindow::on_btn_freqLut_clicked() { - ui->l_freq->setText("false"); + ui->l_freq->setText("doing"); changeLabelTextColor(ui->l_freq, Qt::red); - trx.scenFrequencyLut(_freq); + _trx.scenFrequencyLut(_freq); - ui->l_freq->setText("true"); + ui->l_freq->setText("done"); changeLabelTextColor(ui->l_freq, Qt::green); } @@ -2677,19 +2739,19 @@ void MainWindow::setStbCoeff() _stb.clear(); for (quint8 i = 0; i < 8; i++) { - _stb.append(i*10); + _stb.append(i); } } void MainWindow::on_btn_stbCoeff_clicked() { - ui->l_stbCoeff->setText("false"); + ui->l_stbCoeff->setText("doing"); changeLabelTextColor(ui->l_stbCoeff, Qt::red); - trx.scenStbCoefficient(_stb); + _trx.scenStbCoefficient(_stb); - ui->l_stbCoeff->setText("true"); + ui->l_stbCoeff->setText("done"); changeLabelTextColor(ui->l_stbCoeff, Qt::green); } @@ -2714,12 +2776,12 @@ void MainWindow::setATgc() void MainWindow::on_btn_atgc_clicked() { - ui->l_atgc->setText("false"); + ui->l_atgc->setText("doing"); changeLabelTextColor(ui->l_atgc, Qt::red); - trx.scenAtgcLut(_aTgc); + _trx.scenAtgcLut(_aTgc); - ui->l_atgc->setText("true"); + ui->l_atgc->setText("done"); changeLabelTextColor(ui->l_atgc, Qt::green); } @@ -2730,19 +2792,19 @@ void MainWindow::setDTgc() _dTgc.clear(); for (quint16 i = 0; i < 1024; i++) { - _dTgc.append(i*10); + _dTgc.append(i); } } void MainWindow::on_btn_dtgc_clicked() { - ui->l_dtgc->setText("false"); + ui->l_dtgc->setText("doing"); changeLabelTextColor(ui->l_dtgc, Qt::red); - trx.scenDtgcLut(_dTgc); + _trx.scenDtgcLut(_dTgc); - ui->l_dtgc->setText("true"); + ui->l_dtgc->setText("done"); changeLabelTextColor(ui->l_dtgc, Qt::green); } @@ -2767,12 +2829,12 @@ void MainWindow::setBlendWeight() void MainWindow::on_btn_blendWeight_clicked() { - ui->l_blendWeight->setText("false"); + ui->l_blendWeight->setText("doing"); changeLabelTextColor(ui->l_blendWeight, Qt::red); - trx.scenBlendWeight(_blendWeight); + _trx.scenBlendWeight(_blendWeight); - ui->l_blendWeight->setText("true"); + ui->l_blendWeight->setText("done"); changeLabelTextColor(ui->l_blendWeight, Qt::green); } @@ -2797,12 +2859,12 @@ void MainWindow::setLpf() void MainWindow::on_btn_lpf_clicked() { - ui->l_lpf->setText("false"); + ui->l_lpf->setText("doing"); changeLabelTextColor(ui->l_lpf, Qt::red); - trx.scenLpfLut(_lpf); + _trx.scenLpfLut(_lpf); - ui->l_lpf->setText("true"); + ui->l_lpf->setText("done"); changeLabelTextColor(ui->l_lpf, Qt::green); } @@ -2814,87 +2876,366 @@ void MainWindow::on_btn_setAtgcMode_clicked() auto aTgcValue = ui->tb_aTgcValue->text().toUInt(); if (aTgcMode == 0) - trx.setAtgcMode(Auto, 0); + _trx.setAtgcMode(Auto, 0); else - trx.setAtgcMode(Manual, static_cast(aTgcValue)); + _trx.setAtgcMode(Manual, static_cast(aTgcValue)); } - +/*************************************************************************************************/ +/**************************************** EEPROM *************************************************/ +/*************************************************************************************************/ void MainWindow::on_btn_trxRomWrite_clicked() { - QString txtStr = ui->tb_trxRomWrite->toPlainText(); - trxEepromWrite(txtStr, 0, _bCtrl); + + try + { + QString txtStr = ui->tb_trxRomWrite->toPlainText(); + trxEepromWrite(txtStr, 0, _bCtrl); + } + catch (SonoException& e) + { + qDebug() << e.what(); + } + } void MainWindow::on_btn_trxRomIdRead_clicked() { - quint32 id = trx.trxId(); - ui->tb_trxRomIdRead->setText(QString::number(id, 16)); + + try + { + quint32 id = _trx.trxId(); + ui->tb_trxRomIdRead->setText(QString::number(id, 16)); + } + catch (SonoException& e) + { + qDebug() << e.what(); + } + } void MainWindow::on_btn_trxRomInfoRead_clicked() { - QString infoStr = trx.trxInfo(); - ui->tb_trxRomInfoRead->setText(infoStr); + + try + { + QString infoStr = _trx.trxInfo(); + ui->tb_trxRomInfoRead->setText(infoStr); + } + catch (SonoException& e) + { + qDebug() << e.what(); + } + } void MainWindow::on_btn_mpsRomWrite_clicked() { - QString txtStr = ui->tb_mpsRomWrite->toPlainText(); - mpsEepromWrite(txtStr, 0, _bCtrl); + + try + { + QString txtStr = ui->tb_mpsRomWrite->toPlainText(); + mpsEepromWrite(txtStr, 0, _bCtrl); + } + catch (SonoException& e) + { + qDebug() << e.what(); + } + } void MainWindow::on_btn_mpsRomIdRead_clicked() { - quint32 id = trx.mpsId(); - ui->tb_mpsRomIdRead->setText(QString::number(id, 16)); + + try + { + quint32 id = _trx.mpsId(); + ui->tb_mpsRomIdRead->setText(QString::number(id, 16)); + } + catch (SonoException& e) + { + qDebug() << e.what(); + } + } void MainWindow::on_btn_mpsRomInfoRead_clicked() { - QString infoStr = trx.mpsInfo(); - ui->tb_mpsRomInfoRead->setText(infoStr); + + try + { + QString infoStr = _trx.mpsInfo(); + ui->tb_mpsRomInfoRead->setText(infoStr); + } + catch (SonoException& e) + { + qDebug() << e.what(); + } + } void MainWindow::on_btn_prbCtrlRomWrite_clicked() { - QString txtStr = ui->tb_prbCtrlRomWrite->toPlainText(); - prbCtrlEepromWrite(txtStr, 0, _bCtrl); + + try + { + QString txtStr = ui->tb_prbCtrlRomWrite->toPlainText(); + prbCtrlEepromWrite(txtStr, 0, _bCtrl); + } + catch (SonoException& e) + { + qDebug() << e.what(); + } + } void MainWindow::on_btn_prbCtrlRomIdRead_clicked() { - quint32 id = trx.prbCtrlId(); - ui->tb_prbCtrlRomIdRead->setText(QString::number(id, 16)); + + try + { + quint32 id = _trx.prbCtrlId(); + ui->tb_prbCtrlRomIdRead->setText(QString::number(id, 16)); + } + catch (SonoException& e) + { + qDebug() << e.what(); + } + } void MainWindow::on_btn_prbCtrlRomInfoRead_clicked() { - QString infoStr = trx.prbCtrlInfo(); - ui->tb_prbCtrlRomInfoRead->setText(infoStr); + + try + { + QString infoStr = _trx.prbCtrlInfo(); + ui->tb_prbCtrlRomInfoRead->setText(infoStr); + } + catch (SonoException& e) + { + qDebug() << e.what(); + } + } void MainWindow::on_btn_prbRomWrite_clicked() { - auto sel = ui->cb_prbSelRom->currentIndex(); - QString txtStr = ui->tb_prbRomWrite->toPlainText(); - prbEepromWrite(txtStr, 0, static_cast(sel), _bCtrl); + + try + { + auto sel = ui->cb_prbSelRom->currentIndex(); + QString txtStr = ui->tb_prbRomWrite->toPlainText(); + prbEepromWrite(txtStr, 0, static_cast(sel), _bCtrl); + } + catch (SonoException& e) + { + qDebug() << e.what(); + } + } void MainWindow::on_btn_prbRomIdRead_clicked() { - auto sel = ui->cb_prbSelRom->currentIndex(); - quint32 id = trx.prbId(static_cast(sel)); - ui->tb_prbRomIdRead->setText(QString::number(id, 16)); + + try + { + auto sel = ui->cb_prbSelRom->currentIndex(); + quint32 id = _trx.prbId(static_cast(sel)); + ui->tb_prbRomIdRead->setText(QString::number(id, 16)); + } + catch (SonoException& e) + { + qDebug() << e.what(); + } + } void MainWindow::on_btn_prbRomInfoRead_clicked() { - auto sel = ui->cb_prbSelRom->currentIndex(); - QString infoStr = trx.prbInfo(static_cast(sel)); - ui->tb_prbRomInfoRead->setText(infoStr); + + try + { + auto sel = ui->cb_prbSelRom->currentIndex(); + QString infoStr = _trx.prbInfo(static_cast(sel)); + ui->tb_prbRomInfoRead->setText(infoStr); + } + catch (SonoException& e) + { + qDebug() << e.what(); + } + +} + +/*************************************************************************************************/ +/************************************** BeamFormer ***********************************************/ +/*************************************************************************************************/ +void MainWindow::setRxBeamformerPrp() +{ + _rxBfPrp->lag.clear(); + _rxBfPrp->mla.clear(); + _rxBfPrp->apodization.clear(); + + for (quint8 i = 0; i < 8; i++){ + _rxBfPrp->lag.append(i); + _rxBfPrp->mla.append((i*2) % 7); + _rxBfPrp->apodization.append((i*3) % 3); + } +} + +void MainWindow::on_btn_rxBeamformerPrp_clicked() +{ + + ui->l_rxBeamformerPrp->setText("doing"); + changeLabelTextColor(ui->l_rxBeamformerPrp, Qt::red); + + _trx.scenRxBeamformerProperties(_rxBfPrp); + + ui->l_rxBeamformerPrp->setText("done"); + changeLabelTextColor(ui->l_rxBeamformerPrp, Qt::green); + +} + + +void MainWindow::setProbeElement() +{ + _prbElement.xPosition.clear(); + _prbElement.yPosition.clear(); + _prbElement.zPosition.clear(); + + for (quint8 i = 0; i < 192; i++){ + _prbElement.xPosition.append(i); + _prbElement.yPosition.append(i*2); + _prbElement.zPosition.append(i*3); + } +} + +void MainWindow::on_btn_prbElementPosition_clicked() +{ + + ui->l_prbElementPosition->setText("doing"); + changeLabelTextColor(ui->l_prbElementPosition, Qt::red); + + _trx.scenProbeElementPosition(&_prbElement); + + ui->l_prbElementPosition->setText("done"); + changeLabelTextColor(ui->l_prbElementPosition, Qt::green); + +} + + +void MainWindow::setApodization() +{ + QList temp; + _apodization.clear(); + + for (quint8 i = 0; i < 4; i++) + { + temp.clear(); + for (quint16 j = 0; j < 3057; j++) + { + temp.append(j); + } + _apodization.append(temp); + } +} + +void MainWindow::on_btn_apodization_clicked() +{ + + ui->l_apodization->setText("doing"); + changeLabelTextColor(ui->l_apodization, Qt::red); + + _trx.scenApodizationLut(_apodization); + + ui->l_apodization->setText("done"); + changeLabelTextColor(ui->l_apodization, Qt::green); + +} + + +void MainWindow::setPulseProperties() +{ + _pulsePrp.halfPeriod.clear(); + _pulsePrp.halfCycleNo.clear(); + _pulsePrp.startPhase.clear(); + _pulsePrp.pulseVoltSel.clear(); + _pulsePrp.dampingPulseWidth.clear(); + + + for (quint8 i = 0; i < 8; i++){ + + _pulsePrp.halfPeriod.append(i); + _pulsePrp.halfCycleNo.append(i*2); + _pulsePrp.startPhase.append((i % 2)==0); + _pulsePrp.pulseVoltSel.append((i % 2)==0); + _pulsePrp.dampingPulseWidth.append(i*3); + + } +} + +void MainWindow::on_btn_pulsePrp_clicked() +{ + + ui->l_pulsePrp->setText("doing"); + changeLabelTextColor(ui->l_pulsePrp, Qt::red); + + _trx.scenPulseProperties(&_pulsePrp); + + ui->l_pulsePrp->setText("done"); + changeLabelTextColor(ui->l_pulsePrp, Qt::green); + +} + + +void MainWindow::setAfeProperties() +{ + _afePrp.lpfProg.clear(); + _afePrp.pgaHpfDis.clear(); + _afePrp.pgaClampDis.clear(); + _afePrp.pgaGain.clear(); + _afePrp.gblActiveTerm.clear(); + _afePrp.actTermEn.clear(); + _afePrp.inputClampLvl.clear(); + _afePrp.lnaHpfDis.clear(); + _afePrp.lnaGainGbl.clear(); + _afePrp.lowNf.clear(); + _afePrp.powModes.clear(); + _afePrp.gblPdwn.clear(); + _afePrp.lnaHpfProg.clear(); + + for (quint8 i = 0; i < 8; i++){ + + _afePrp.lpfProg.append(i); + _afePrp.pgaHpfDis.append((i % 2)==0); + _afePrp.pgaClampDis.append((i % 2)==0); + _afePrp.pgaGain.append((i % 2)==0); + _afePrp.gblActiveTerm.append((i*2) % 3); + _afePrp.actTermEn.append((i % 2)==0); + _afePrp.inputClampLvl.append((i*3) % 7); + _afePrp.lnaHpfDis.append((i % 2)==0); + _afePrp.lnaGainGbl.append((i*4) % 3); + _afePrp.lowNf.append((i % 2)==0); + _afePrp.powModes.append((i*5) % 3); + _afePrp.gblPdwn.append((i % 2)==0); + _afePrp.lnaHpfProg.append((i*6) % 3); + + } +} + +void MainWindow::on_btn_afeLut_clicked() +{ + + ui->l_afeLut->setText("doing"); + changeLabelTextColor(ui->l_afeLut, Qt::red); + + _trx.scenAfeLut(&_afePrp); + + ui->l_afeLut->setText("done"); + changeLabelTextColor(ui->l_afeLut, Qt::green); + } diff --git a/mainwindow.h b/mainwindow.h index c4c0283..a103b35 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -1,7 +1,9 @@ #ifndef MAINWINDOW_H #define MAINWINDOW_H +#include #include +#include #include #include #include @@ -10,7 +12,6 @@ #include #include #include -#include #include "include/model/hardware/core/TrxBoard.h" #include "api.h" @@ -82,7 +83,8 @@ public: private: Ui::MainWindow *ui; - TrxBoard trx; + TrxBoard _trx; + //TrxBoard* _trx; //WaitDialog* _dial; @@ -90,7 +92,11 @@ private: UltraSoundDevice* _usd; - QTimer* _timer; + QTimer* _timeout; + + QEventLoop loop; + + QTimer delayTimer; int _counter = 0; @@ -98,6 +104,12 @@ private: BoardsCtrlMngt* _bCtrl; + SupervisorRbValue* supRbValue; + + MpsFaultStatus* faultStatus; + + HealthStatus* _healStatus; + ReceiverConfiguration* _receiveConfig; void setReceiverConfiguration (void); @@ -122,12 +134,31 @@ private: QList> _lpf; void setLpf (void); - //void fpgaProgrammer(QString path); + void fpgaProgrammer(QString path); void timeout(); + void delay(int ms); + + const QString enum2String (ePg state) const; + void changeLabelTextColor(QLabel* label, QColor color); + RxBeamformerProperties* _rxBfPrp; + void setRxBeamformerPrp (void); + + AfeProperties _afePrp; + void setAfeProperties (void); + + PulseProperties _pulsePrp; + void setPulseProperties (void); + + ProbeElementPosition _prbElement; + void setProbeElement (void); + + QList> _apodization; + void setApodization (void); + private slots: void on_rbtn_reg_toggled(bool checked); @@ -192,7 +223,7 @@ private slots: // void on_btn_pwr4OnOff_clicked(); - void delay(int ms); + // float resDiv(uint32_t r1, uint32_t r2, uint adcValue); @@ -338,6 +369,16 @@ private slots: void on_btn_prbRomInfoRead_clicked(); + void on_btn_rxBeamformerPrp_clicked(); + + void on_btn_prbElementPosition_clicked(); + + void on_btn_apodization_clicked(); + + void on_btn_pulsePrp_clicked(); + + void on_btn_afeLut_clicked(); + signals: // void updateBlockProgressValue(int percentage, QProgressBar* prg); // void updateFpgaProgressValue(int percentage); diff --git a/mainwindow.ui b/mainwindow.ui index 8a1451f..511fb49 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -27,7 +27,7 @@ - 2 + 3 @@ -356,6 +356,32 @@ + + + + 60 + 70 + 76 + 17 + + + + + + + done: + + + + + + + doing + + + + + @@ -397,7 +423,7 @@ - false + doing @@ -434,7 +460,7 @@ - false + doing @@ -471,7 +497,7 @@ - false + doing @@ -508,7 +534,7 @@ - false + doing @@ -545,7 +571,7 @@ - false + doing @@ -582,7 +608,7 @@ - false + doing @@ -619,7 +645,7 @@ - false + doing @@ -656,7 +682,7 @@ - false + doing @@ -754,6 +780,196 @@ + + + BeamFormer + + + + + 20 + 20 + 170 + 48 + + + + + + + + + done: + + + + + + + doing + + + + + + + + + Rx Beamformer Properties + + + + + + + + + 230 + 20 + 149 + 48 + + + + + + + + + done: + + + + + + + doing + + + + + + + + + Probe Element Position + + + + + + + + + 410 + 20 + 104 + 48 + + + + + + + + + done: + + + + + + + doing + + + + + + + + + Apodization Lut + + + + + + + + + 20 + 100 + 107 + 48 + + + + + + + + + done: + + + + + + + doing + + + + + + + + + Pulse Properties + + + + + + + + + 230 + 100 + 82 + 48 + + + + + + + + + done: + + + + + + + doing + + + + + + + + + Afe Lut + + + + + + E2PROMs @@ -776,7 +992,7 @@ 0 20 291 - 72 + 51 @@ -789,8 +1005,17 @@ + + + 162 + 49 + + - + <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">Write to TRX ROM</span></p></body></html> + + + <html><head/><body><p><br/></p></body></html> @@ -828,6 +1053,9 @@ true + + + @@ -845,7 +1073,7 @@ 510 20 281 - 72 + 51 @@ -858,8 +1086,11 @@ - - + + + 160 + 49 + true @@ -894,7 +1125,7 @@ 0 20 291 - 72 + 51 @@ -907,8 +1138,17 @@ + + + 162 + 49 + + - + <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">Write to MPS ROM</span></p></body></html> + + + <html><head/><body><p><br/></p></body></html> @@ -963,7 +1203,7 @@ 510 20 281 - 72 + 51 @@ -976,6 +1216,12 @@ + + + 160 + 49 + + @@ -1012,7 +1258,7 @@ 0 20 291 - 72 + 51 @@ -1025,8 +1271,14 @@ + + + 162 + 49 + + - + <html><head/><body><p><span style=" font-size:6pt; font-weight:600; font-style:italic;">Write to probe ctrl ROM</span></p></body></html> @@ -1081,7 +1333,7 @@ 510 20 281 - 72 + 51 @@ -1094,6 +1346,12 @@ + + + 160 + 49 + + @@ -1130,7 +1388,7 @@ 100 20 251 - 72 + 51 @@ -1143,8 +1401,14 @@ + + + 122 + 49 + + - + <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">Write to probe ROM</span></p></body></html> @@ -1199,7 +1463,7 @@ 550 20 241 - 72 + 51 @@ -1212,6 +1476,12 @@ + + + 120 + 49 + + @@ -1233,13 +1503,13 @@ 10 - 40 + 20 79 23 - + <html><head/><body><p><span style=" font-size:8pt; font-weight:600; font-style:italic;">Select Probe</span></p></body></html> @@ -1262,19 +1532,6 @@ - - - - 10 - 20 - 65 - 15 - - - - Prb Select: - - @@ -1364,7 +1621,7 @@ - 300 + 230 50 16 111 @@ -1377,9 +1634,9 @@ - 540 - 130 - 166 + 510 + 160 + 163 17 @@ -1394,7 +1651,7 @@ - TextLabel + Unknown @@ -1507,10 +1764,10 @@ - 160 + 140 90 - 141 - 25 + 80 + 23 @@ -1526,10 +1783,10 @@ - 320 + 260 50 - 191 - 19 + 126 + 17 @@ -1552,10 +1809,10 @@ - 320 + 260 70 - 191 - 19 + 119 + 17 @@ -1578,10 +1835,10 @@ - 320 + 260 90 - 191 - 19 + 121 + 17 @@ -1604,10 +1861,10 @@ - 320 + 260 110 - 191 - 19 + 151 + 17 @@ -1630,10 +1887,10 @@ - 320 + 260 130 - 191 - 21 + 152 + 17 @@ -1656,10 +1913,10 @@ - 540 + 510 50 - 171 - 19 + 147 + 17 @@ -1682,10 +1939,10 @@ - 540 - 70 - 171 - 19 + 260 + 150 + 143 + 17 @@ -1708,10 +1965,10 @@ - 540 - 90 - 172 - 19 + 510 + 70 + 165 + 17 @@ -1734,10 +1991,10 @@ - 160 - 50 - 134 - 19 + 0 + 150 + 124 + 17 @@ -1822,6 +2079,139 @@ TextLabel + + + + 420 + 50 + 62 + 122 + + + + + + + <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">PG_12v</span></p></body></html> + + + Unknown + + + + + + + <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">PG_5v</span></p></body></html> + + + Unknown + + + + + + + <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">PG_3.3v</span></p></body></html> + + + Unknown + + + + + + + <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">PG_1.8v Afe A</span></p></body></html> + + + Unknown + + + + + + + <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">PG_1.8v Afe D</span></p></body></html> + + + Unknown + + + + + + + <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">PG_3.3v PrbCtrl</span></p></body></html> + + + Unknown + + + + + + + + + 510 + 90 + 145 + 63 + + + + + + + + + Regulator A: + + + + + + + <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">PG_Reg A</span></p></body></html> + + + Unknown + + + + + + + + + + + Regulator B: + + + + + + + <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">PG_Reg B</span></p></body></html> + + + Unknown + + + + + + + + + + + + + + diff --git a/src/model/hardware/core/TrxBoard.cpp b/src/model/hardware/core/TrxBoard.cpp index 87bd637..75ee9a2 100644 --- a/src/model/hardware/core/TrxBoard.cpp +++ b/src/model/hardware/core/TrxBoard.cpp @@ -244,8 +244,11 @@ void TrxBoard::setSwapVector() << 180 << 165 << 86 << 71 << 184 << 169 << 90 << 75 << 188 << 173 << 94 << 79; } -TrxBoard::TrxBoard() : _offsetSlave0(0), _offsetSlave1(0x4000000), _offsetSlave2(0x8000000) +TrxBoard::TrxBoard() : _offsetSlave0(0), _offsetSlave1(0x400000), _offsetSlave2(0x800000) { + _run = true; + _device.init(); + _beamFormerSlave0 = new BeamFormer (&_device, _offsetSlave0); _beamFormerSlave1 = new BeamFormer (&_device, _offsetSlave1); _beamFormerSlave2 = new BeamFormer (&_device, _offsetSlave2); @@ -257,11 +260,12 @@ TrxBoard::TrxBoard() : _offsetSlave0(0), _offsetSlave1(0x4000000), _offsetSlave2 //_dmaCtrl = new DmaCtrl (_device); _dsp = new Dsp (&_device); + _adc = new AdcVoltages(); + _pg = new VoltagesPg(); + + setSwapVector(); - ///////////////////////////////// Old TRX ////////////////////////////////// - _run = true; - //_device.init(); /*************************************************************************************************/ /*************************************************************************************************/ } @@ -278,6 +282,9 @@ TrxBoard::~TrxBoard() delete _bpiFlash; //delete _dmaCtrl; delete _dsp; + + delete _adc; + delete _pg; } void TrxBoard::scenProbeElementPosition(ProbeElementPosition *element) @@ -395,7 +402,9 @@ void TrxBoard::scenLpfLut(QList > &lpfLut) const void TrxBoard::slaveFpgaProgram(QString path) { + QByteArray bitFileData; QFile bitFile(path); + bitFileData.clear(); if (bitFile.fileName().isEmpty()) { @@ -407,12 +416,11 @@ void TrxBoard::slaveFpgaProgram(QString path) throw SonoException("Couldn't open bit file programming"); } - QByteArray bitFileData = bitFile.readAll(); - this->_fpgaProgram->program(bitFileData, SLAVE_FPGA_NUMBER); - - bitFileData.clear(); + bitFileData = bitFile.readAll(); bitFile.close(); + this->_fpgaProgram->program(bitFileData, SLAVE_FPGA_NUMBER); + scenParamsFilling(clear); } @@ -595,8 +603,10 @@ void TrxBoard::getHealthStatus(HealthStatus* healStat) const { // healStat->criticalComponentTemperature = this->_bCtrlMngt->getTrxFpgaTemp(); healStat->systemTemperature = this->_bCtrlMngt->getTrxTempSensor(); - healStat->adcMon = this->_bCtrlMngt->getTrxBoardVoltages(); - healStat->voltsPg = this->_bCtrlMngt->getTrxVoltagesPg(); + this->_bCtrlMngt->getTrxBoardVoltages(_adc, _pg); + this->_bCtrlMngt->getTrxVoltagesPg(_pg); + healStat->adcMon = _adc; + healStat->voltsPg = _pg; } void TrxBoard::init() const diff --git a/src/model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.cpp b/src/model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.cpp index 9854206..a81d1ce 100644 --- a/src/model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.cpp +++ b/src/model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.cpp @@ -6,12 +6,12 @@ BoardsCtrlMngt::AttenuationFactor::AttenuationFactor() p5v=4.3636f; p4d=4.3636f; m5v=2.1818f; - curP24v=1; - hvStop=1; - p24v=1; - hva=1; - hvb=1; - cwd=1; + curP24v=1.0f; + hvStop=1.0f; + p24v=1.0f; + hva=1.0f; + hvb=1.0f; + cwd=1.0f; } BoardsCtrlMngt::Gain::Gain() @@ -19,13 +19,13 @@ BoardsCtrlMngt::Gain::Gain() curP24v=2.778f; cwd=6.555f; m5v=-3.3f; - hvStop=1; - p24v=23; - hva=66; - hvb=66; - p12v=1; - p5v=1; - p4d=1; + hvStop=1.0f; + p24v=23.0f; + hva=66.0f; + hvb=66.0f; + p12v=1.0f; + p5v=1.0f; + p4d=1.0f; } /***************************************************************************************************/ /************************************* Write Functions Template ************************************/ @@ -39,59 +39,56 @@ void BoardsCtrlMngt::eepromWrite(QString& str, quint32 addr, quint8 prbSel, T1* foreach (auto i, str) { - timerShot(500); + status->sync(); + busy = ((status->busy->getValue())!=0); + + timerShot(1); while (busy) { status->sync(); busy = ((status->busy->getValue())!=0); - if (checkTimerShot()) - { - // throw exception("Eeprom writing timeout is happened due to the I2C busy"); - timerStop(); - return; - } + if (checkTimeout()) + throw SonoException("Eeprom writing timeout is happened due to the I2C busy"); } timerStop(); - _rom->dataIn = i.toLatin1(); + timerShot(5); // must be >= 4 + while (!checkTimeout()); + + _rom->dataIn = static_cast(i.toLatin1()); _rom->address = addr+j; _rom->probeSelect = prbSel; setEepromWrite(_rom, request); j++; - timerShot(100); + status->sync(); + done = ((status->reqDone->getValue())!=0); + error = ((status->reqError->getValue())!=0); + + timerShot(1); while (!error && !done) { status->sync(); done = ((status->reqDone->getValue())!=0); error = ((status->reqError->getValue())!=0); - if (checkTimerShot()) - { - // throw exception("Eeprom finish writing is corrupted due to the failure to receive done"); - timerStop(); - return; - } + if (checkTimeout()) + throw SonoException("Eeprom writing is corrupted due to the failure to receive done"); } timerStop(); if (error) - { - // throw exception("Eeprom finish writing is corrupted due to the error occurrence"); - return; - } - + throw SonoException("Eeprom writing is corrupted due to the error occurrence"); } - } template void BoardsCtrlMngt::setEepromWrite(EepromReq* _rom, T3* request) { - request->dataIn->setValue(static_cast(_rom->dataIn)); - request->address->setValue(static_cast(_rom->address)); - request->prbSel->setValue(static_cast(_rom->probeSelect)); + request->dataIn->setValue(_rom->dataIn); + request->address->setValue(_rom->address); + request->prbSel->setValue(_rom->probeSelect); request->rdReq->setValue(0); request->wrReq->setValue(1); request->update(); @@ -114,17 +111,16 @@ QByteArray BoardsCtrlMngt::eepromRead(quint32 addr, quint32 length, quint8 prbSe for (quint32 i(0); isync(); + busy = ((status->busy->getValue())!=0); + + timerShot(1); while (busy) { status->sync(); busy = ((status->busy->getValue())!=0); - if (checkTimerShot()) - { - // throw exception("Eeprom reading timeout is happened due to the I2C busy"); - timerStop(); - return nullptr; - } + if (checkTimeout()) + throw SonoException("Eeprom reading timeout is happened due to the I2C busy"); } timerStop(); @@ -134,27 +130,24 @@ QByteArray BoardsCtrlMngt::eepromRead(quint32 addr, quint32 length, quint8 prbSe _rom->probeSelect = prbSel; setEepromRead(_rom, request); - timerShot(100); + status->sync(); + done = ((status->reqDone->getValue())!=0); + error = ((status->reqError->getValue())!=0); + + timerShot(1); while (!error && !done) { status->sync(); done = ((status->reqDone->getValue())!=0); error = ((status->reqError->getValue())!=0); - if (checkTimerShot()) - { - // throw exception("Eeprom finish reading is corrupted due to the failure to receive done"); - timerStop(); - return nullptr; - } + if (checkTimeout()) + throw SonoException("Eeprom reading is corrupted due to the failure to receive done"); } timerStop(); if (error) - { - // throw exception("Eeprom finish reading is corrupted due to the error occurrence"); - return nullptr; - } + throw SonoException("Eeprom reading is corrupted due to the error occurrence"); rdArray.append(static_cast(status->dataOut->getValue())); @@ -166,9 +159,9 @@ QByteArray BoardsCtrlMngt::eepromRead(quint32 addr, quint32 length, quint8 prbSe template void BoardsCtrlMngt::setEepromRead(BoardsCtrlMngt::EepromReq *_rom, T6 *request) { - request->dataIn->setValue(static_cast(_rom->dataIn)); - request->address->setValue(static_cast(_rom->address)); - request->prbSel->setValue(static_cast(_rom->probeSelect)); + request->dataIn->setValue(_rom->dataIn); + request->address->setValue(_rom->address); + request->prbSel->setValue(_rom->probeSelect); request->rdReq->setValue(1); request->wrReq->setValue(0); request->update(); @@ -188,8 +181,8 @@ QVector BoardsCtrlMngt::voltPg(float adcVolt) { QVector pgVec; pgVec.clear(); - pgVec.append(adcVolt * (95/100)); - pgVec.append(adcVolt * (105/100)); + pgVec.append(adcVolt * (95.0f/100.0f)); + pgVec.append(adcVolt * (105.0f/100.0f)); return pgVec; } @@ -522,14 +515,10 @@ bool BoardsCtrlMngt::getI2cBusy() const void BoardsCtrlMngt::getSupervisorI2cTimeout() const { - + timerShot(10); while (getI2cBusy()) { - if (checkTimerShot()) - { - // throw exception("Supervisor request timeout is happened due to the MPS I2C busy"); - timerStop(); - return; - } + if (checkTimeout()) + throw SonoException("Supervisor request timeout is happened due to the MPS I2C busy"); } timerStop(); } @@ -538,20 +527,13 @@ void BoardsCtrlMngt::getSupervisorI2cDone() const { timerShot(10); while (!getI2cCmdDone() && !getI2cCmdErr()){ - if (checkTimerShot()) - { - // throw exception("Supervisor request is corrupted due to the failure to receive MPS I2C done"); - timerStop(); - return; - } + if (checkTimeout()) + throw SonoException("Supervisor request is corrupted due to the failure to receive MPS I2C done"); } timerStop(); if (getI2cCmdErr()) - { - // throw exception("Supervisor request is corrupted due to the MPS I2C error occurrence"); - return; - } + throw SonoException("Supervisor request is corrupted due to the MPS I2C error occurrence"); } void BoardsCtrlMngt::setSetupCmdP24vOnOff(bool p24vOnOff) const @@ -607,12 +589,15 @@ void BoardsCtrlMngt::setMpsDacsValue(BoardsCtrlMngt::MpsDacs *_mpsDacs) const void BoardsCtrlMngt::timerShot(quint16 ms) const { - _timer->singleShot(ms, this, SLOT(checkTimerShot)); + //_timer->singleShot(ms, this, SLOT(checkTimerShot)); + _timer->setSingleShot(true); + _timer->setInterval(ms); + _timer->start(); } -bool BoardsCtrlMngt::checkTimerShot() const +bool BoardsCtrlMngt::checkTimeout() const { - return _timer->isSingleShot(); + return (_timer->remainingTime()==0) ? true : false; } void BoardsCtrlMngt::timerStop() const @@ -673,73 +658,68 @@ float BoardsCtrlMngt::getTrxTempSensor() const return (temp * TEMP_SENSOR_RESOLUTION); } -AdcVoltages *BoardsCtrlMngt::getTrxBoardVoltages() +void BoardsCtrlMngt::getTrxBoardVoltages(AdcVoltages* adc, VoltagesPg* pg) { quint32 value(0); float voltValue(0); QVector pgVec; - AdcVoltages* adc; this->_adc3P3V->sync(); value = this->_adc3P3V->channel5Mon->getValue(); - voltValue = resDiv(51,100000,value); + voltValue = resDiv(51.0f,100000.0f,value); adc->mon3P3V = voltValue; pgVec= voltPg(3.3f); - _pg->mon3P3V = (voltValue >= pgVec.at(0) && voltValue <= pgVec.at(1)) ? good : bad; + pg->mon3P3V = (voltValue >= pgVec.at(0) && voltValue <= pgVec.at(1)) ? good : bad; this->_adc5Vin->sync(); value = this->_adc5Vin->channel1Mon->getValue(); - voltValue = resDiv(1.2f,2,value); + voltValue = resDiv(1.2f,2.0f,value); adc->mon5Vin = voltValue; pgVec= voltPg(5.0f); - _pg->mon5Vin = (voltValue >= pgVec.at(0) && voltValue <= pgVec.at(1)) ? good : bad; + pg->mon5Vin = (voltValue >= pgVec.at(0) && voltValue <= pgVec.at(1)) ? good : bad; this->_adc12Vin->sync(); value = this->_adc12Vin->channel0Mon->getValue(); - voltValue = resDiv(30, 10, value); + voltValue = resDiv(30.0f, 10.0f, value); adc->mon12Vin = voltValue; pgVec= voltPg(12.0f); - _pg->mon12Vin = (voltValue >= pgVec.at(0) && voltValue <= pgVec.at(1)) ? good : bad; + pg->mon12Vin = (voltValue >= pgVec.at(0) && voltValue <= pgVec.at(1)) ? good : bad; this->_adcA1P8V->sync(); value = this->_adcA1P8V->channel6Mon->getValue(); - voltValue = resDiv(51,100000,value); + voltValue = resDiv(51.0f,100000.0f,value); adc->monAfeA1P8V = voltValue; pgVec= voltPg(1.8f); - _pg->monAfeA1P8V = (voltValue >= pgVec.at(0) && voltValue <= pgVec.at(1)) ? good : bad; + pg->monAfeA1P8V = (voltValue >= pgVec.at(0) && voltValue <= pgVec.at(1)) ? good : bad; this->_adcD1P8V->sync(); value = this->_adcD1P8V->channel7Mon->getValue(); - voltValue = resDiv(51,100000,value); + voltValue = resDiv(51.0f,100000.0f,value); adc->monAfeD1P8V = voltValue; pgVec= voltPg(1.8f); - _pg->monAfeD1P8V = (voltValue >= pgVec.at(0) && voltValue <= pgVec.at(1)) ? good : bad; + pg->monAfeD1P8V = (voltValue >= pgVec.at(0) && voltValue <= pgVec.at(1)) ? good : bad; this->_adcVcntlp->sync(); value = this->_adcVcntlp->channel4Mon->getValue(); - adc->afeVcntlp = resDiv(0,100,value); + adc->afeVcntlp = resDiv(0.0f,100.0f,value); this->_adcPrb3P3V->sync(); value = this->_adcPrb3P3V->channel3Mon->getValue(); - voltValue = resDiv(47,47,value); + voltValue = resDiv(47.0f,47.0f,value); adc->prbCtrl3P3V = voltValue; pgVec= voltPg(3.3f); - _pg->prbCtrl3P3V = (voltValue >= pgVec.at(0) && voltValue <= pgVec.at(1)) ? good : bad; + pg->prbCtrl3P3V = (voltValue >= pgVec.at(0) && voltValue <= pgVec.at(1)) ? good : bad; this->_adcPrbEncoder->sync(); value = this->_adcPrbEncoder->channel2Mon->getValue(); - adc->prbZeroEncoder = resDiv(47,47,value); - - return adc; + adc->prbZeroEncoder = resDiv(47.0f,47.0f,value); } -VoltagesPg *BoardsCtrlMngt::getTrxVoltagesPg() +void BoardsCtrlMngt::getTrxVoltagesPg(VoltagesPg* pg) { this->_tRgltorPg->sync(); - _pg->regulatorA = ((this->_tRgltorPg->regA->getValue())!=0) ? good : bad; - _pg->regulatorB = ((this->_tRgltorPg->regB->getValue())!=0) ? good : bad; - - return _pg; + pg->regulatorA = ((this->_tRgltorPg->regA->getValue())!=0) ? good : bad; + pg->regulatorB = ((this->_tRgltorPg->regB->getValue())!=0) ? good : bad; } @@ -850,10 +830,8 @@ void BoardsCtrlMngt::mpsHvSet(float &hva, float &hvb) const getSupervisorI2cDone(); } else - { - // throw exception("A and B voltage are out of range"); - return; - } + throw SonoException("A and B voltage are out of range"); + } @@ -861,54 +839,44 @@ void BoardsCtrlMngt::mpsHvSet(float &hva, float &hvb) const QByteArray BoardsCtrlMngt::trxEepromRead(quint32 address, quint32 length) { if (address + length >= TRX_ROM_MAX_LEN) - { - // throw exception("Out of range reading from TRX eeprom "); - return nullptr; - } + throw SonoException("Out of range reading from TRX eeprom "); + quint8 prbSel = 0; - eepromRead(address, length, prbSel, _tRomReq, _tRomStatus); + return eepromRead(address, length, prbSel, _tRomReq, _tRomStatus); } QByteArray BoardsCtrlMngt::mpsEepromRead(quint32 address, quint32 length) { if (address + length >= MPS_ROM_MAX_LEN) - { - // throw exception("Out of range reading from MPS eeprom "); - return nullptr; - } + throw SonoException("Out of range reading from MPS eeprom "); + quint8 prbSel = 0; - eepromRead(address, length, prbSel, _mRomReq, _mRomStatus); + return eepromRead(address, length, prbSel, _mRomReq, _mRomStatus); } QByteArray BoardsCtrlMngt::prbCtrlEepromRead(quint32 address, quint32 length) { if (address + length >= PRB_CTRL_ROM_MAX_LEN) - { - // throw exception("Out of range reading from Probe Control eeprom "); - return nullptr; - } + throw SonoException("Out of range reading from Probe Control eeprom "); + quint8 prbSel = 0; - eepromRead(address, length, prbSel, _pCtrlRomReq, _pCtrlRomStatus); + return eepromRead(address, length, prbSel, _pCtrlRomReq, _pCtrlRomStatus); } QByteArray BoardsCtrlMngt::prbEepromRead(quint32 address, quint32 length, quint8 prbSel) { if (address + length >= PRB_ROM_MAX_LEN) - { - // throw exception("Out of range reading from Probe eeprom "); - return nullptr; - } - eepromRead(address, length, prbSel, _pRomReq, _pRomStatus); + throw SonoException("Out of range reading from Probe eeprom "); + + return eepromRead(address, length, prbSel, _pRomReq, _pRomStatus); } void trxEepromWrite(QString str, quint32 address, BoardsCtrlMngt* boards) { if (str.size() >= static_cast(TRX_ROM_MAX_LEN)) - { - // throw exception("Out of range writing into TRX eeprom "); - return; - } + throw SonoException("Out of range writing into TRX eeprom "); + quint8 prbSel = 0; boards->eepromWrite(str, address, prbSel, boards->_tRomReq, boards->_tRomStatus); } @@ -916,10 +884,8 @@ void trxEepromWrite(QString str, quint32 address, BoardsCtrlMngt* boards) void mpsEepromWrite(QString str, quint32 address, BoardsCtrlMngt *boards) { if (str.size() >= static_cast(MPS_ROM_MAX_LEN)) - { - // throw exception("Out of range writing into MPS eeprom "); - return; - } + throw SonoException("Out of range writing into MPS eeprom "); + quint8 prbSel = 0; boards->eepromWrite(str, address, prbSel, boards->_mRomReq, boards->_mRomStatus); } @@ -927,10 +893,8 @@ void mpsEepromWrite(QString str, quint32 address, BoardsCtrlMngt *boards) void prbCtrlEepromWrite(QString str, quint32 address, BoardsCtrlMngt *boards) { if (str.size() >= static_cast(PRB_CTRL_ROM_MAX_LEN)) - { - // throw exception("Out of range writing into Probe Control eeprom "); - return; - } + throw SonoException("Out of range writing into Probe Control eeprom "); + quint8 prbSel = 0; boards->eepromWrite(str, address, prbSel, boards->_pCtrlRomReq, boards->_pCtrlRomStatus); } @@ -938,10 +902,8 @@ void prbCtrlEepromWrite(QString str, quint32 address, BoardsCtrlMngt *boards) void prbEepromWrite(QString str, quint32 address, quint8 prbSel, BoardsCtrlMngt *boards) { if (str.size() >= static_cast(PRB_ROM_MAX_LEN)) - { - // throw exception("Out of range writing into Probe eeprom "); - return; - } + throw SonoException("Out of range writing into Probe eeprom "); + boards->eepromWrite(str, address, prbSel, boards->_pRomReq, boards->_pRomStatus); } diff --git a/src/model/hardware/core/register/builtInTest/BuiltInTest.cpp b/src/model/hardware/core/register/builtInTest/BuiltInTest.cpp index b2a88e3..f7b4ab1 100644 --- a/src/model/hardware/core/register/builtInTest/BuiltInTest.cpp +++ b/src/model/hardware/core/register/builtInTest/BuiltInTest.cpp @@ -30,9 +30,11 @@ void BuiltInTest::setDacMemoryCmd(BuiltInTest::BiteMemoryCmd *_memoryCmd) const BuiltInTest::BuiltInTest(SonoDevice *device) { - _dacMemory = new BiteDacMemory (device); - _dacCmd = new BiteDacMemoryCmd (device); - _dacOutput = new BiteDacOutputSelect (device); + _dacMemory = new BiteDacMemory (device); + _dacCmd = new BiteDacMemoryCmd (device); + _dacOutput = new BiteDacOutputSelect (device); + _dacOutputSelect = new BiteOutputSelect(); + _dacMemoryCmd = new BiteMemoryCmd(); } BuiltInTest::~BuiltInTest() @@ -40,6 +42,8 @@ BuiltInTest::~BuiltInTest() delete _dacMemory; delete _dacCmd; delete _dacOutput; + delete _dacOutputSelect; + delete _dacMemoryCmd; } void BuiltInTest::biteDacMemoryWrite(TxDacMemory* txDacMem) const diff --git a/src/model/hardware/core/register/clockDistributer/ClockDistributer.cpp b/src/model/hardware/core/register/clockDistributer/ClockDistributer.cpp index b23f553..385062f 100644 --- a/src/model/hardware/core/register/clockDistributer/ClockDistributer.cpp +++ b/src/model/hardware/core/register/clockDistributer/ClockDistributer.cpp @@ -1,13 +1,13 @@ #include "model/hardware/core/register/clockDistributer/ClockDistributer.h" -void ClockDistributer::setCwModeEnable(ClockDistributer::ModeEnable* _enable) +void ClockDistributer::setCwModeEnable(ClockDistributer::ModeEnable &_enable) { - _cwEnable->cwClkdivision->setValue(_enable->cwClkDivision); + _cwEnable->cwClkdivision->setValue(_enable.cwClkDivision); - quint32 enVal = _enable->cwClkEnable ? 1 : 0; + quint32 enVal = _enable.cwClkEnable ? 1 : 0; _cwEnable->cwClkEn->setValue(enVal); - quint32 strVal = _enable->spiClkDistStart ? 1 : 0; + quint32 strVal = _enable.spiClkDistStart ? 1 : 0; _cwEnable->spiClkDistStart->setValue(strVal); _cwEnable->update(); @@ -36,21 +36,19 @@ ClockDistributer::~ClockDistributer() void ClockDistributer::clockMode(quint32 clkDiv, eClkMode mode) { - if (!connectionCheck()){ - //throw exception("Clock modifing is failed due to the disconnect of the clock distributer"); - return; - } + if (!connectionCheck()) + throw SonoException("Clock modifing is failed due to the disconnect of the clock distributer"); while (!_cwModeStatus.getEepromClkDistDone()); while (_cwModeStatus.getSpiClkDistBusy()); - this->_cwModeEnable->cwClkDivision=clkDiv; - this->_cwModeEnable->cwClkEnable=mode; - this->_cwModeEnable->spiClkDistStart=true; + this->_cwModeEnable.cwClkDivision=clkDiv; + this->_cwModeEnable.cwClkEnable=mode; + this->_cwModeEnable.spiClkDistStart=true; this->setCwModeEnable(_cwModeEnable); - this->_cwModeEnable->spiClkDistStart=false; + this->_cwModeEnable.spiClkDistStart=false; this->setCwModeEnable(_cwModeEnable); } diff --git a/src/model/hardware/core/register/fpgaProgram/FpgaProgram.cpp b/src/model/hardware/core/register/fpgaProgram/FpgaProgram.cpp index 2c8053a..96957fa 100644 --- a/src/model/hardware/core/register/fpgaProgram/FpgaProgram.cpp +++ b/src/model/hardware/core/register/fpgaProgram/FpgaProgram.cpp @@ -15,16 +15,21 @@ void FpgaProgram::setSlaveFpgaNumber(quint8 &number) const _fpgaNumber->update(); } + FpgaProgram::FpgaProgram(SonoDevice* device) { - _progData = new SerialProgramData(device); - _status._progStatus = new SerialProgramStatus(device); + _status = new ProgramStatus(); + _progData = new SerialProgramData(device); + _status->_progStatus = new SerialProgramStatus(device); + _fpgaNumber = new SlaveFpgaNumber(device); } FpgaProgram::~FpgaProgram() { delete _progData; - delete _status._progStatus; + delete _status->_progStatus; + delete _fpgaNumber; + delete _status; } void FpgaProgram::program(QByteArray& bitFileData, quint8 number) @@ -37,29 +42,30 @@ void FpgaProgram::program(QByteArray& bitFileData, quint8 number) while (progByteslaveConfigData->setValue(progData); _progData->update(); - while (_status.getProgramBusy()); + while (_status->getProgramBusy()); - if (_status.getInitFail()) + if (_status->getInitFail()) { // QString fail=""; -// if (_status.getFpgaS0InitB()) +// if (_status->getFpgaS0InitB()) // fail += "Slave0 FPGA "; -// if (_status.getFpgaS1InitB()) +// if (_status->getFpgaS1InitB()) // fail += "Slave1 FPGA "; -// if (_status.getFpgaS2InitB()) +// if (_status->getFpgaS2InitB()) // fail += "Slave2 FPGA "; throw SonoException("init fail happened"); } - if (_status.getProgramTimeout()) + if (_status->getProgramTimeout()) { throw SonoException("Timeout is happened and the programming of the slave FPGAs is failed"); } @@ -68,9 +74,10 @@ void FpgaProgram::program(QByteArray& bitFileData, quint8 number) progByte += sizeof (quint32); } - while (!(_status.getProgramFail()||_status.getProgramDone())); - if (_status.getProgramFail()){ + while (!(_status->getProgramFail()||_status->getProgramDone())); + + if (_status->getProgramFail()){ throw SonoException("programming was not successful"); } }