Browse Source

The adcs of afe is synchronized after slave fpga programming

The mps reset bug is fixed
The dacs of supervisory bug is fixed
The preprocessors of compiler are added to switch between some fitures
master
Arash Aletayeb 4 years ago
parent
commit
b15a64cc30
  1. 2
      developHw.pro
  2. 2
      developHw.pro.user
  3. 4
      hdf5Scenario/hdf5Scenario.cpp
  4. 16
      include/model/hardware/core/TrxBoard.h
  5. 6
      include/model/hardware/core/TrxBoardUtils/PreProcessorDef.h
  6. 7
      include/model/hardware/core/register/afe/Afe.h
  7. 26
      include/model/hardware/core/register/afe/registerDefinition/AdcSyncStatus.h
  8. 2
      include/model/hardware/core/register/beamFormer/registerDefinition/RxBeamformerLut.h
  9. 2
      include/model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.h
  10. 3
      include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorSetupCmd.h
  11. 2
      include/model/hardware/core/register/dsp/registerDefinition/LpfLut.h
  12. 19
      include/model/hardware/core/register/fpgaProgram/FpgaProgram.h
  13. 7
      include/model/hardware/core/register/misc/Misc.h
  14. 30
      include/model/hardware/core/register/misc/registerDefinition/FrameLostCount.h
  15. 4
      include/model/hardware/core/register/misc/registerDefinition/StatusVector.h
  16. 7
      main.cpp
  17. 1946
      mainwindow.cpp
  18. 22
      mainwindow.h
  19. 115
      mainwindow.ui
  20. 378
      src/model/hardware/core/TrxBoard.cpp
  21. 28
      src/model/hardware/core/register/afe/Afe.cpp
  22. 513
      src/model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.cpp
  23. 56
      src/model/hardware/core/register/fpgaProgram/FpgaProgram.cpp
  24. 26
      src/model/hardware/core/register/misc/Misc.cpp

2
developHw.pro

@ -25,7 +25,7 @@ SOURCES += \
$$files(hdf5Scenario/*.cpp, true) \
HEADERS += \
include/model/hardware/core/register/afe/registerDefinition/AdcSyncStatus.h \
include/model/hardware/core/register/misc/registerDefinition/FrameLostCount.h \
mainwindow.h \
qcustomplot.h \
api.h \

2
developHw.pro.user

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.10.0, 2021-06-20T10:23:31. -->
<!-- Written by QtCreator 4.10.0, 2021-06-23T14:01:29. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>

4
hdf5Scenario/hdf5Scenario.cpp

@ -667,8 +667,8 @@ QVector<quint32> Hdf5::stbRead()
QVector<float> Hdf5::lineFilterRead()
{
/**************** /registerParameters/lineFilterLutQ ********************/
datasetBranch <float_t>("/registerParameters/lineFilterLutQ", floatArray);
/**************** /registerParameters/lineFilterLut ********************/
datasetBranch <float_t>("/registerParameters/lineFilterLut", floatArray);
QVector<float> lineFilter;
for (quint8 var = 0; var < 3; var++)
lineFilter.push_back(floatArray[var]);

16
include/model/hardware/core/TrxBoard.h

@ -77,7 +77,6 @@ private:
BeamFormer* _beamFormerSlave1;
BeamFormer* _beamFormerSlave2;
BoardsCtrlMngt* _bCtrlMngt;
FpgaProgram* _fpgaProgram;
ScenPalyer* _scenPlayer;
BpiFlash* _bpiFlash;
Afe* _afeSlave0;
@ -87,6 +86,9 @@ private:
Misc* _misc;
Sram* _sram;
Dsp* _dsp;
#ifndef DEVELOP_UI
FpgaProgram* _fpgaProgram;
#endif
enum eScenParams : quint8
{
@ -140,6 +142,8 @@ private:
void scenParamsFilling(eScenParams cmd);
//QList<quint32> signedVector2unsignedList(QVector<qint32>& sgnVec);
void afeAdcsSync (void) const;
template<class T>
QByteArray uintLittleEndian2ByteArray(T& data) const;
@ -154,8 +158,6 @@ signals:
public:
HardwarePacketEngine packetEngine;
TrxBoard();
~TrxBoard();
@ -227,9 +229,17 @@ public:
void getTrxStatus(StatusVec* status) const;
void getFpgasCodeVersion(FpgaCodeVersion* version) const;
void sramParityClear();
quint32 getFrameLostCounter(void) const;
/////////////////////////////// DMA Data Packet ////////////////////////////////////
void readData();
#ifdef DEVELOP_UI
FpgaProgram* _fpgaProgram;
#endif
#ifndef DEVELOP_UI
HardwarePacketEngine packetEngine;
#endif
};
#endif //TRXBOARD_H

6
include/model/hardware/core/TrxBoardUtils/PreProcessorDef.h

@ -2,9 +2,9 @@
#define PREPROCESSORDEF_H
#define MPS_BOARD
//#undef MPS_BOARD
#undef MPS_BOARD
#define DEVELOP_UI
#undef DEVELOP_UI
//#undef DEVELOP_UI
#endif // PREPROCESSORDEF_H
#endif //PREPROCESSORDEF_H

7
include/model/hardware/core/register/afe/Afe.h

@ -1,6 +1,7 @@
#ifndef AFE_H
#define AFE_H
#include "registerDefinition/AdcSyncStatus.h"
#include "registerDefinition/ActiveTerm.h"
#include "registerDefinition/LnaHpf.h"
#include "registerDefinition/Global.h"
@ -133,6 +134,7 @@ Q_DECLARE_METATYPE(AfeConfig)
class Afe
{
private:
AdcSyncStatus* _adcSync;
ActiveTerm* _actTerm;
LnaHpf* _lnaHpf;
Global* _global;
@ -151,6 +153,11 @@ public:
void setAfeParams(const AfeConfig afe) const;
void setAfeGblPwr(const bool pwrdn) const;
void setReadRegEnable(const bool rdEn) const;
bool getAfeSyncDone(void) const;
quint32 getAfeSyncError(void) const;
quint32 getAfeSyncAddress(void) const;
quint32 getAfeDataValid(void) const;
};
#endif // AFE_H

26
include/model/hardware/core/register/afe/registerDefinition/AdcSyncStatus.h

@ -6,10 +6,10 @@
#undef BAR
#define GEN_SYNC_CHECKER_MASK 0x0000000C
#define SYNC_CHECK_DONE_MASK 0x0000000C
#define SYNC_CHECK_ERROR_MASK 0x0000000C
#define LNA_HPF_PROG_MASK 0x0000000C
#define SYNC_DONE_MASK 0x00000001
#define SYNC_ERROR_MASK 0x000000FE
#define SYNC_ADDRESS_MASK 0x00003F00
#define DATA_VALID_OFFSET_MASK 0x0000C000
#define BAR 0U
#define OFFSET 0x43C384
@ -18,18 +18,24 @@ class AdcSyncStatus : public Register
{
public:
Field* lnaHpfProg;
Field* syncDone;
Field* syncError;
Field* syncAddress;
Field* dataValidOffset;
AdcSyncStatus(SonoDevice* device, quint32 offset) : Register(BAR, OFFSET + offset, device)
{
ADD_UNSIGNED_FIELD(lnaHpfProg, LNA_HPF_PROG_MASK);
ADD_UNSIGNED_FIELD(lnaHpfProg, LNA_HPF_PROG_MASK);
ADD_UNSIGNED_FIELD(lnaHpfProg, LNA_HPF_PROG_MASK);
ADD_UNSIGNED_FIELD(lnaHpfProg, LNA_HPF_PROG_MASK);
ADD_UNSIGNED_FIELD(syncDone, SYNC_DONE_MASK);
ADD_UNSIGNED_FIELD(syncError, SYNC_ERROR_MASK);
ADD_UNSIGNED_FIELD(syncAddress, SYNC_ADDRESS_MASK);
ADD_UNSIGNED_FIELD(dataValidOffset, DATA_VALID_OFFSET_MASK);
}
};
#undef LNA_HPF_PROG_MASK
#undef SYNC_DONE_MASK
#undef SYNC_ERROR_MASK
#undef SYNC_ADDRESS_MASK
#undef DATA_VALID_OFFSET_MASK
#undef BAR
#undef OFFSET

2
include/model/hardware/core/register/beamFormer/registerDefinition/RxBeamformerLut.h

@ -34,7 +34,7 @@ private:
void prepareData(quint32 index) override
{
lagPrp->setValue(_rxBfLut->lag.at(static_cast<qint32>(index)));
lagPrp->setValue(_rxBfLut->lag.at(static_cast<qint32>(index)) - 1);
apodizationSelPrp->setValue(_rxBfLut->apodization.at(static_cast<qint32>(index)) - 1);

2
include/model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.h

@ -195,9 +195,11 @@ private:
bool getI2cBusy(void) const;
void getSupervisorI2cTimeout(void) const;
void getSupervisorI2cDone(void) const;
bool getSetupCmdP24vOnOff(void) const;
void setSetupCmdP24vOnOff(bool p24vOnOff) const;
void setSetupCmdJmp(bool jmpDacCmd) const;
void setSetupCmdDacsOnOff(bool cwd, bool hvb, bool hva) const;
void setPwrDacsValid(bool pwrValid) const;
void setMpsDacsValue(MpsDacs* _mpsDacs) const;
friend void trxEepromWrite(QByteArray arr, quint32 address, BoardsCtrlMngt* boards);

3
include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorSetupCmd.h

@ -11,6 +11,7 @@
#define CWD_ON_OFF_MASK 0x00000004
#define HVB_ON_OFF_MASK 0x00000008
#define HVA_ON_OFF_MASK 0x00000010
#define PWR_DAC_VALID_MASK 0x00000020
#define BAR 0
#define OFFSET 0X26030
@ -23,6 +24,7 @@ public:
Field* cwdOnOff;
Field* hvbOnOff;
Field* hvaOnOff;
Field* pwrDacValid;
SupervisorSetupCmd(SonoDevice* device) : Register(BAR, OFFSET, device)
@ -32,6 +34,7 @@ public:
ADD_UNSIGNED_FIELD(cwdOnOff, CWD_ON_OFF_MASK);
ADD_UNSIGNED_FIELD(hvbOnOff, HVB_ON_OFF_MASK);
ADD_UNSIGNED_FIELD(hvaOnOff, HVA_ON_OFF_MASK);
ADD_UNSIGNED_FIELD(pwrDacValid, PWR_DAC_VALID_MASK);
}
};

2
include/model/hardware/core/register/dsp/registerDefinition/LpfLut.h

@ -6,7 +6,7 @@
#undef BAR
#define LPF_LUT_MASK 0x0000FFFF
#define LPF_LUT_MASK 0x0003FFFF
#define BAR 0
#define OFFSET 0x81000

19
include/model/hardware/core/register/fpgaProgram/FpgaProgram.h

@ -1,6 +1,7 @@
#ifndef FPGAPROGRAM_H
#define FPGAPROGRAM_H
#include <QObject>
#include <QDataStream>
#include <QDebug>
#include <QByteArray>
@ -11,10 +12,6 @@
#include "registerDefinition/SerialProgramData.h"
#include "registerDefinition/SerialProgramStatus.h"
//#define FPGA_S0_DONE 1
//#define FPGA_S1_DONE 2
//#define FPGA_S2_DONE 4
#define FPGA_S0_INIT_B 1
#define FPGA_S1_INIT_B 2
#define FPGA_S2_INIT_B 4
@ -30,8 +27,10 @@ T byteArray2UintBigEndian(QByteArray& byte)
return data;
}
class FpgaProgram
class FpgaProgram : public QObject
{
Q_OBJECT
private:
SerialProgramData* _progData;
SlaveFpgaNumber* _fpgaNumber;
@ -46,18 +45,22 @@ private:
bool getFpgaS0InitB() const;
bool getFpgaS1InitB() const;
bool getFpgaS2InitB() const;
//bool getFpgaS0Done();
//bool getFpgaS1Done();
//bool getFpgaS2Done();
}* _status;
void setSlaveFpgaNumber(quint8& number) const;
#ifdef DEVELOP_UI
signals:
void programmingProgress(qint32 progressValue, qint32 bitFileSize);
#endif
public:
explicit FpgaProgram(SonoDevice* device);
~FpgaProgram();
void program(QByteArray& bitFileData, quint8 number);
};
#endif //PROGRAM_H

7
include/model/hardware/core/register/misc/Misc.h

@ -1,9 +1,10 @@
#ifndef MISC_H
#define MISC_H
#include "registerDefinition/FrameLostCount.h"
#include "registerDefinition/StatusVector.h"
#include "registerDefinition/FpgaVersion.h"
#include "registerDefinition/GtSendMode.h"
#include "registerDefinition/StatusVector.h"
#include "registerDefinition/SyncMode.h"
struct StatusVec
@ -24,6 +25,7 @@ struct StatusVec
bool pgErr;
bool probeDisconnectErr;
bool fanFault;
bool frameLost;
bool emulDmaTransferErr;
bool dmaCtrlTransferErr;
};
@ -65,6 +67,7 @@ private:
StatusVector* _status;
GtSendMode* _gt;
SyncMode* _sync;
FrameLostCount* _lostCount;
template<class T>
quint32 getVersion (T* version) const;
@ -77,6 +80,8 @@ public:
void getFpgaVersion(FpgaCodeVersion* version) const;
void setGtSendMode (eGtSendCtrl gtMode) const;
void setSyncMode (eSyncCtrl syncMode) const;
void setManualSync (bool sync) const;
quint32 getFrameLostCount(void) const;
};

30
include/model/hardware/core/register/misc/registerDefinition/FrameLostCount.h

@ -0,0 +1,30 @@
#ifndef FRAMELOSTCOUNT_H
#define FRAMELOSTCOUNT_H
#include "model/hardware/core/register/Register.h"
#include "model/hardware/core/register/RegUtils.h"
#undef BAR
#define LOST_COUNT 0x000000FF
#define BAR 0U
#define OFFSET 0x86024
class FrameLostCount : public Register
{
public:
Field* lostCount;
FrameLostCount(SonoDevice* device) : Register(BAR, OFFSET, device)
{
ADD_UNSIGNED_FIELD(lostCount, LOST_COUNT);
}
};
#undef LOST_COUNT
#undef BAR
#undef OFFSET
#endif // FRAMELOSTCOUNT_H

4
include/model/hardware/core/register/misc/registerDefinition/StatusVector.h

@ -22,6 +22,7 @@
#define PG_Err_MASK 0x00002000
#define PROBE_DISCONNECT_Err_MASK 0x00004000
#define FAN_FAULT_MASK 0x00008000
#define FRAME_LOST_MASK 0x00020000
#define EMUL_DMA_TRANSFER_Err_MASK 0x40000000
#define DMA_CTRL_TRANSFER_Err_MASK 0x80000000
@ -47,6 +48,7 @@ public:
Field* pgErr;
Field* probeDisconnectErr;
Field* fanFault;
Field* frameLost;
Field* emulDmaTransferErr;
Field* dmaCtrlTransferErr;
@ -68,6 +70,7 @@ public:
ADD_UNSIGNED_FIELD(pgErr, PG_Err_MASK);
ADD_UNSIGNED_FIELD(probeDisconnectErr, PROBE_DISCONNECT_Err_MASK);
ADD_UNSIGNED_FIELD(fanFault, FAN_FAULT_MASK);
ADD_UNSIGNED_FIELD(frameLost, FRAME_LOST_MASK);
ADD_UNSIGNED_FIELD(emulDmaTransferErr, EMUL_DMA_TRANSFER_Err_MASK);
ADD_UNSIGNED_FIELD(dmaCtrlTransferErr, DMA_CTRL_TRANSFER_Err_MASK);
}
@ -89,6 +92,7 @@ public:
#undef PG_Err_MASK
#undef PROBE_DISCONNECT_Err_MASK
#undef FAN_FAULT_MASK
#undef FRAME_LOST_MASK
#undef EMUL_DMA_TRANSFER_Err_MASK
#undef DMA_CTRL_TRANSFER_Err_MASK

7
main.cpp

@ -7,6 +7,8 @@ int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
try
{
w.setGeometry(
QStyle::alignedRect(
Qt::LeftToRight,
@ -17,4 +19,9 @@ int main(int argc, char *argv[])
);
w.show();
return a.exec();
}
catch(SonoException& e)
{
qDebug() << e.what();
}
}

1946
mainwindow.cpp

File diff suppressed because it is too large

22
mainwindow.h

@ -60,7 +60,7 @@
#define TRANSFER_RATE 30.0f
#define RAM_BUFFER_OFFSET 0U
#define ULTIMATE_LOG_COUNT 50
#define ULTIMATE_LOG_COUNT 1000
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
@ -116,14 +116,8 @@ private:
AfeConfig _afeConfig;
QFutureWatcher <void> scenEndWather;
void setScenario(const string& h5Path);
void setScenarioCompare(const QString& scenPath);
void fpgaProgrammer(QString path);
void timeout();
void delay(int ms);
@ -167,6 +161,8 @@ private:
private slots:
void setScenario(const string& h5Path);
void getFramePacket (QByteArray packet);
void getSramBinaryCreateFlag (void);
@ -177,7 +173,13 @@ private slots:
void getPrbChange();
void restartTimer();
void getFrameLost();
void getProgrammingProgress(qint32 progressValue, qint32 bitFileSize);
void getLabelState(QLabel* label, QString str, QColor color);
void getFpgaProgrammer (QString path);
void on_rbtn_reg_toggled(bool checked);
@ -364,6 +366,10 @@ signals:
void twoDReady();
void sendLogCount(qint32 counter, QProgressDialog* _progress);
void connectedPrbChange();
void frameLostCall();
void labelState(QLabel* label, QString str, QColor color);
void fpgaProgrammer(QString path);
void scenarioReady(const string& h5Path);
};
#endif // MAINWINDOW_H

115
mainwindow.ui

@ -296,7 +296,7 @@
<x>0</x>
<y>150</y>
<width>741</width>
<height>105</height>
<height>141</height>
</rect>
</property>
<property name="sizePolicy">
@ -308,13 +308,13 @@
<property name="minimumSize">
<size>
<width>0</width>
<height>105</height>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>105</height>
<height>150</height>
</size>
</property>
<property name="font">
@ -361,8 +361,8 @@
<rect>
<x>10</x>
<y>70</y>
<width>128</width>
<height>17</height>
<width>138</width>
<height>19</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_28">
@ -395,6 +395,19 @@
<string>Program</string>
</property>
</widget>
<widget class="QProgressBar" name="prg_programming">
<property name="geometry">
<rect>
<x>10</x>
<y>100</y>
<width>721</width>
<height>23</height>
</rect>
</property>
<property name="value">
<number>24</number>
</property>
</widget>
</widget>
</widget>
<widget class="QWidget" name="tab_5">
@ -488,7 +501,7 @@
<rect>
<x>0</x>
<y>190</y>
<width>331</width>
<width>321</width>
<height>101</height>
</rect>
</property>
@ -553,9 +566,9 @@
<property name="geometry">
<rect>
<x>250</x>
<y>30</y>
<y>20</y>
<width>71</width>
<height>61</height>
<height>81</height>
</rect>
</property>
<property name="toolTip">
@ -640,8 +653,8 @@
<rect>
<x>690</x>
<y>70</y>
<width>91</width>
<height>48</height>
<width>92</width>
<height>52</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
@ -677,8 +690,8 @@
<rect>
<x>460</x>
<y>70</y>
<width>205</width>
<height>94</height>
<width>222</width>
<height>102</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
@ -757,7 +770,7 @@
<x>10</x>
<y>70</y>
<width>281</width>
<height>60</height>
<height>64</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_27">
@ -1435,8 +1448,8 @@
<rect>
<x>310</x>
<y>30</y>
<width>126</width>
<height>17</height>
<width>136</width>
<height>19</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_15">
@ -1461,8 +1474,8 @@
<rect>
<x>310</x>
<y>50</y>
<width>119</width>
<height>17</height>
<width>128</width>
<height>19</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_16">
@ -1487,8 +1500,8 @@
<rect>
<x>310</x>
<y>70</y>
<width>121</width>
<height>17</height>
<width>131</width>
<height>19</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_24">
@ -1513,8 +1526,8 @@
<rect>
<x>310</x>
<y>90</y>
<width>151</width>
<height>17</height>
<width>163</width>
<height>19</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_23">
@ -1539,8 +1552,8 @@
<rect>
<x>310</x>
<y>110</y>
<width>152</width>
<height>17</height>
<width>164</width>
<height>19</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_22">
@ -1565,8 +1578,8 @@
<rect>
<x>540</x>
<y>30</y>
<width>147</width>
<height>17</height>
<width>158</width>
<height>19</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_17">
@ -1591,8 +1604,8 @@
<rect>
<x>310</x>
<y>130</y>
<width>143</width>
<height>17</height>
<width>154</width>
<height>19</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_18">
@ -1617,8 +1630,8 @@
<rect>
<x>540</x>
<y>50</y>
<width>164</width>
<height>17</height>
<width>178</width>
<height>19</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_25">
@ -1643,8 +1656,8 @@
<rect>
<x>470</x>
<y>30</y>
<width>62</width>
<height>122</height>
<width>63</width>
<height>134</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_15">
@ -1715,7 +1728,7 @@
<rect>
<x>540</x>
<y>90</y>
<width>145</width>
<width>156</width>
<height>62</height>
</rect>
</property>
@ -1769,8 +1782,8 @@
<rect>
<x>0</x>
<y>60</y>
<width>285</width>
<height>67</height>
<width>302</width>
<height>98</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_8">
@ -1975,6 +1988,20 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_42">
<item>
<widget class="QLabel" name="l_frameLost">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:7pt; font-weight:600; font-style:italic;&quot;&gt;Frame Lost&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>false</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
@ -1984,7 +2011,7 @@
<rect>
<x>140</x>
<y>30</y>
<width>163</width>
<width>176</width>
<height>21</height>
</rect>
</property>
@ -2011,7 +2038,7 @@
<x>710</x>
<y>40</y>
<width>101</width>
<height>111</height>
<height>119</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
@ -2091,8 +2118,8 @@
<rect>
<x>540</x>
<y>20</y>
<width>142</width>
<height>25</height>
<width>150</width>
<height>27</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_104">
@ -2134,8 +2161,8 @@
<rect>
<x>0</x>
<y>20</y>
<width>481</width>
<height>61</height>
<width>486</width>
<height>51</height>
</rect>
</property>
<row>
@ -3272,8 +3299,8 @@
<rect>
<x>710</x>
<y>140</y>
<width>82</width>
<height>17</height>
<width>88</width>
<height>19</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_79">
@ -3298,8 +3325,8 @@
<rect>
<x>710</x>
<y>170</y>
<width>82</width>
<height>17</height>
<width>88</width>
<height>19</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_86">

378
src/model/hardware/core/TrxBoard.cpp

@ -4,7 +4,7 @@ template<class T>
QByteArray TrxBoard::uintLittleEndian2ByteArray(T& data) const
{
QByteArray byte;
QDataStream out (&byte, QIODevice::WriteOnly);
QDataStream out(&byte, QIODevice::WriteOnly);
out.setByteOrder(QDataStream::LittleEndian);
out << data;
@ -15,7 +15,7 @@ template<class T>
T TrxBoard::byteArray2UintLittleEndian(QByteArray& byte) const
{
T data;
QDataStream in (byte);
QDataStream in(byte);
in.setByteOrder(QDataStream::LittleEndian);
in >> data;
@ -39,8 +39,10 @@ void TrxBoard::readData()
{
_hwCounter++;
if (_hwCounter > HW_BUFFER_NUM)
if(_hwCounter > HW_BUFFER_NUM)
{
_hwCounter = 1;
}
_device.copy(_hwCounter - 1, _swCounter);
@ -66,20 +68,20 @@ void TrxBoard::readData()
void TrxBoard::sramClear(eSramClear clearMode)
{
quint32 num(0);
if (clearMode == all)
if(clearMode == all)
{
while (num < SRAM_SIZE)
while(num < SRAM_SIZE)
{
this->_device.device.writeLong(BAR_SRAM, static_cast<quint32>(num), 0);
num += sizeof (quint64);
num += sizeof(quint64);
}
}
if (clearMode == first4M)
if(clearMode == first4M)
{
while (num < SRAM_SIZE / 4)
while(num < SRAM_SIZE / 4)
{
this->_device.device.writeLong(BAR_SRAM, static_cast<quint32>(num), 0);
num += sizeof (quint64);
num += sizeof(quint64);
}
}
}
@ -99,6 +101,44 @@ void TrxBoard::scenParamsFilling(TrxBoard::eScenParams cmd)
}
}
void TrxBoard::afeAdcsSync() const
{
quint32 syncErr(0);
this->_bCtrlMngt->timerShot(20);
while(!(this->_bCtrlMngt->checkTimeout()))
{
;
}
this->_misc->setSyncMode(AdcSyncMode);
this->_misc->setManualSync(true);
this->_misc->setManualSync(false);
this->_misc->setManualSync(BfSyncMode);
this->_bCtrlMngt->timerShot(1);
while(!((this->_afeSlave0->getAfeSyncDone()) &&
(this->_afeSlave1->getAfeSyncDone()) &&
(this->_afeSlave2->getAfeSyncDone())))
{
if(this->_bCtrlMngt->checkTimeout())
{
throw SonoException(
"The timeout of the afe adcs sync is happend without receiving of sync done.");
}
}
this->_bCtrlMngt->timerStop();
syncErr = this->_afeSlave0->getAfeSyncError();
syncErr += this->_afeSlave1->getAfeSyncError();
syncErr += this->_afeSlave2->getAfeSyncError();
if(syncErr != 0)
{
throw SonoException("The error of the afe adcs sync is happend.");
}
}
void TrxBoard::setSwapVector()
{
_swapVec.clear();
@ -125,7 +165,9 @@ void TrxBoard::setRomCrc()
unsigned char crcArray[] = {0x4, 0x0, 0x13, 0x0, 0x27, 0x0, 0x28, 0x0, 0xEB, 0x1,
0xAC, 0x5, 0xAC, 0x6, 0x4C, 0x6, 0xB0, 0x6, 0xB2};
for(auto var : crcArray)
{
_eepromCrc.push_back(static_cast<char>(var));
}
}
void TrxBoard::setAfeModuleOffset()
@ -142,15 +184,15 @@ void TrxBoard::setFpgaOffset()
//QList<quint32> TrxBoard::signedVector2unsignedList (QVector<qint32>& sgnVec)
//{
// _unsignedQntzrList.clear();
//_unsignedQntzrList.clear();
//// std::list<uint> _usgnList (sgnVec.begin(), sgnVec.end());
//// _unsignedQntzrList.fromStdList(_usgnList);
// foreach (auto i, sgnVec)
// {
// _unsignedQntzrList.push_back(static_cast<quint32>(i));
// }
//foreach (auto i, sgnVec)
//{
//_unsignedQntzrList.push_back(static_cast<quint32>(i));
//}
// return _unsignedQntzrList;
//return _unsignedQntzrList;
//}
TrxBoard::TrxBoard() : _offsetSlave0(0), _offsetSlave1(0x400000), _offsetSlave2(0x800000)
@ -242,11 +284,13 @@ void TrxBoard::init()
sramClear(all);
}
void TrxBoard::setProbeDependParams(ScenPrbDepHardwareParam &prbDepParams)
void TrxBoard::setProbeDependParams(ScenPrbDepHardwareParam& prbDepParams)
{
/////////////////////////// DSP setting ///////////////////////////
if (prbDepParams.prbDepParams.apodizationLut.size() != APODIZATIONLUT_LUT_MAX)
if(prbDepParams.prbDepParams.apodizationLut.size() != APODIZATIONLUT_LUT_MAX)
{
throw SonoException("Apodization lut is out of range");
}
QList<QList<quint32> > apodizationQ;
foreach(auto vec, prbDepParams.prbDepParams.apodizationLut)
{
@ -257,8 +301,10 @@ void TrxBoard::setProbeDependParams(ScenPrbDepHardwareParam &prbDepParams)
this->_beamFormerSlave2->apodizationLut(apodizationQ);
scenParamsFilling(set);
if (prbDepParams.prbDepParams.atgcLut.size() != ATGC_LUT_MAX)
if(prbDepParams.prbDepParams.atgcLut.size() != ATGC_LUT_MAX)
{
throw SonoException("Atgc lut is out of range");
}
QList<QList<quint32> > atgcLutQ;
foreach(auto vec, prbDepParams.prbDepParams.atgcLut)
{
@ -266,8 +312,10 @@ void TrxBoard::setProbeDependParams(ScenPrbDepHardwareParam &prbDepParams)
}
this->_dsp->atgcLut(atgcLutQ);
if (prbDepParams.prbDepParams.lpfLut.size() != LPF_LUT_MAX)
if(prbDepParams.prbDepParams.lpfLut.size() != LPF_LUT_MAX)
{
throw SonoException("Lpf lut is out of range");
}
QList<QList<quint32> > lpfLutQ;
foreach(auto vec, prbDepParams.prbDepParams.lpfLut)
{
@ -279,73 +327,106 @@ void TrxBoard::setProbeDependParams(ScenPrbDepHardwareParam &prbDepParams)
this->_afeSlave0->setAfeParams(prbDepParams.afeCfg);
this->_afeSlave1->setAfeParams(prbDepParams.afeCfg);
this->_afeSlave2->setAfeParams(prbDepParams.afeCfg);
this->_afeSlave0->setAfeGblPwr(afePwrdnEnable);
this->_afeSlave1->setAfeGblPwr(afePwrdnEnable);
this->_afeSlave2->setAfeGblPwr(afePwrdnEnable);
}
void TrxBoard::setScenario(ScenGenHardwareOutput_t &scenGenHw)
void TrxBoard::setScenario(ScenGenHardwareOutput_t& scenGenHw)
{
if (this->_scenPlayer->control.getCommand())
if(this->_scenPlayer->control.getCommand())
{
scenPlayerStop();
}
emulatorStop();
sramClear(first4M);
scenParams->focusTypeNumber = scenGenHw.focusTypeNumber;
if (scenParams->focusTypeNumber > FOCUS_TYPE_NUMBER_MAX)
if(scenParams->focusTypeNumber > FOCUS_TYPE_NUMBER_MAX)
{
throw SonoException("Focus type number is out of range");
}
scenParams->totalTxShotNumber = scenGenHw.totalTxShotNumber;
if (scenParams->totalTxShotNumber > TOTAL_TX_SHOT_NUMBER_MAX)
if(scenParams->totalTxShotNumber > TOTAL_TX_SHOT_NUMBER_MAX)
{
throw SonoException("Total tx shot number is out of range");
}
scenParams->rxBeamFormerNumber = scenGenHw.rxBeamFormerNumber.toVector();
if (scenParams->rxBeamFormerNumber.size() > RX_BEAMFORMER_NUMBER_MAX)
if(scenParams->rxBeamFormerNumber.size() > RX_BEAMFORMER_NUMBER_MAX)
{
throw SonoException("Rx beam former number is out of range");
}
scenParams->scenarioStartIndex = scenGenHw.hwRegister.scenarioStartIndex;
scenParams->scenarioEndIndex = scenGenHw.hwRegister.scenarioEndIndex;
if (scenParams->scenarioEndIndex > SCENARIO_INDEX_MAX)
if(scenParams->scenarioEndIndex > SCENARIO_INDEX_MAX)
{
throw SonoException("Scenario end index is out of range");
}
if(scenParams->scenarioEndIndex < scenParams->scenarioStartIndex)
{
throw SonoException(
"The scenario end index must be greater than or equal to the scenario start index");
}
scenParams->hwRegister->blendWeight = scenGenHw.hwRegister.blendWeight;
if (scenParams->hwRegister->blendWeight.size() != BLENDWEIGHT_LUT_MAX)
if(scenParams->hwRegister->blendWeight.size() != BLENDWEIGHT_LUT_MAX)
{
throw SonoException("Blend weight lut is out of range");
}
scenParams->hwRegister->elementPosition->xPosition = scenGenHw.hwRegister.elementXPosition;
if (scenParams->hwRegister->elementPosition->xPosition.size() != ELEMENT_POSITION_LUT_MAX)
if(scenParams->hwRegister->elementPosition->xPosition.size() != ELEMENT_POSITION_LUT_MAX)
{
throw SonoException("Element position x is out of range");
}
scenParams->hwRegister->elementPosition->yPosition = scenGenHw.hwRegister.elementYPosition;
if (scenParams->hwRegister->elementPosition->yPosition.size() != ELEMENT_POSITION_LUT_MAX)
if(scenParams->hwRegister->elementPosition->yPosition.size() != ELEMENT_POSITION_LUT_MAX)
{
throw SonoException("Element position y is out of range");
}
scenParams->hwRegister->elementPosition->zPosition = scenGenHw.hwRegister.elementZPosition;
if (scenParams->hwRegister->elementPosition->zPosition.size() != ELEMENT_POSITION_LUT_MAX)
if(scenParams->hwRegister->elementPosition->zPosition.size() != ELEMENT_POSITION_LUT_MAX)
{
throw SonoException("Element position z is out of range");
}
scenParams->hwRegister->freqLut = scenGenHw.hwRegister.freqLut;
if (scenParams->hwRegister->freqLut.size() != FREQUENCY_LUT_MAX)
if(scenParams->hwRegister->freqLut.size() != FREQUENCY_LUT_MAX)
{
throw SonoException("Frequency lut is out of range");
}
scenParams->hwRegister->dtgcLut = scenGenHw.hwRegister.dtgcLut;
if (scenParams->hwRegister->dtgcLut.size() != DTGC_LUT_MAX)
if(scenParams->hwRegister->dtgcLut.size() != DTGC_LUT_MAX)
{
throw SonoException("Dtgc lut is out of range");
}
scenParams->hwRegister->pulseTypeNumber = scenGenHw.hwRegister.pulseTypeNumber;
if (scenParams->hwRegister->pulseTypeNumber > PULSE_LUT_MAX)
if(scenParams->hwRegister->pulseTypeNumber > PULSE_LUT_MAX)
{
throw SonoException("Pulse type number is out of range");
}
scenParams->hwRegister->rxBeamFormerTypeNumber = scenGenHw.hwRegister.rxBeamFormerTypeNumber;
if (scenParams->hwRegister->rxBeamFormerTypeNumber > RXBEAMFORMER_LUT_MAX)
if(scenParams->hwRegister->rxBeamFormerTypeNumber > RXBEAMFORMER_LUT_MAX)
{
throw SonoException("Rx beam former type number is out of range");
}
scenParams->hwRegister->receiverConfigTypeNumber =
scenGenHw.hwRegister.receiverConfigTypeNumber;
if (scenParams->hwRegister->receiverConfigTypeNumber > RRECEIVER_CONFIGURATION_LUT_MAX)
if(scenParams->hwRegister->receiverConfigTypeNumber > RRECEIVER_CONFIGURATION_LUT_MAX)
{
throw SonoException("Receiver config type number is out of range");
}
scenParams->hwRegister->pulse->clear();
foreach(auto i, scenGenHw.hwRegister.pulseProps)
@ -366,7 +447,7 @@ void TrxBoard::setScenario(ScenGenHardwareOutput_t &scenGenHw)
}
scenParams->hwRegister->configLut->clear();
foreach (auto k, scenGenHw.hwRegister.receiverConfigProps)
foreach(auto k, scenGenHw.hwRegister.receiverConfigProps)
{
scenParams->hwRegister->configLut->mla.append(k.mla);
scenParams->hwRegister->configLut->stb.append(k.stb);
@ -386,7 +467,7 @@ void TrxBoard::setScenario(ScenGenHardwareOutput_t &scenGenHw)
}
scenParams->indexParams->dLineNum = scenGenHw.indexParams.dLineNum;
scenParams->indexParams->frameType=scenGenHw.frameType;
scenParams->indexParams->frameType = scenGenHw.frameType;
scenParams->indexParams->dEnsembleNum = scenGenHw.indexParams.dEnsembleNum;
scenParams->indexParams->lastLineInFrame = scenGenHw.indexParams.lastLineInFrame;
scenParams->indexParams->firstLineInFrame = scenGenHw.indexParams.firstLineInFrame;
@ -529,7 +610,8 @@ void TrxBoard::setScenario (ScenGenHardwareParam* scenParams)
QList<quint32> freqLutQ = _unsignedQntzrVec.toList();
this->_dsp->frequencyLut(freqLutQ);
_unsignedQntzrVec = Calculation::qntzr(scenParams->hwRegister->dtgcLut, 0, 12, 8, 0, true, false);
_unsignedQntzrVec =
Calculation::qntzr(scenParams->hwRegister->dtgcLut, 0, 12, 8, 0, true, false);
QList<quint32> dtgcLutQ = _unsignedQntzrVec.toList();
this->_dsp->dtgcLut(dtgcLutQ);
@ -559,13 +641,14 @@ void TrxBoard::setScenario (ScenGenHardwareParam* scenParams)
////////////////////////////// Scen Index setting ////////////////////////////
this->_scenPlayer->setStartIndex(scenParams->scenarioStartIndex);
this->_scenPlayer->setEndIndex(scenParams->scenarioEndIndex);
}
void TrxBoard::setLineFilterCoefficient(QVector<float>& lineFilterLut)
{
if (lineFilterLut.size() != LINE_FILTER_LUT_MAX)
if(lineFilterLut.size() != LINE_FILTER_LUT_MAX)
{
throw SonoException("Line filter lut is out of range");
}
_unsignedQntzrVec = Calculation::qntzr(lineFilterLut, 0, 9, 8, 0, true, false);
QList<quint32> lineFilterLutQ = _unsignedQntzrVec.toList();
this->_dsp->lineFilterCoefficient(lineFilterLutQ);
@ -573,8 +656,10 @@ void TrxBoard::setLineFilterCoefficient(QVector<float>& lineFilterLut)
void TrxBoard::setStbCoefficient(QVector<quint32>& stbLut)
{
if (stbLut.size() != STB_COEFFICIENT_LUT_MAX)
if(stbLut.size() != STB_COEFFICIENT_LUT_MAX)
{
throw SonoException("Stb lut is out of range");
}
QList<quint32> stbLutQ = stbLut.toList();
this->_dsp->stbCoefficient(stbLutQ);
}
@ -586,29 +671,31 @@ void TrxBoard::setAtgcMode(eAtgcMode mode, quint16 value) const
void TrxBoard::setDtgcLut(QVector<float>& dtgcLut)
{
if (dtgcLut.size() != DTGC_LUT_MAX)
if(dtgcLut.size() != DTGC_LUT_MAX)
{
throw SonoException("Dtgc lut is out of range");
}
_unsignedQntzrVec = Calculation::qntzr(dtgcLut, 0, 12, 8, 0, true, false);
QList<quint32> dtgcLutQ = _unsignedQntzrVec.toList();
this->_dsp->dtgcLut(dtgcLutQ);
}
void TrxBoard::setFramesMetaData(const QByteArray &metaData) const
void TrxBoard::setFramesMetaData(const QByteArray& metaData) const
{
QList<quint64> data;
QByteArray temp;
qint32 num(0);
while (num < metaData.size())
while(num < metaData.size())
{
for (quint8 j=0; j < sizeof (quint64); j++)
for(quint8 j = 0; j < sizeof(quint64); j++)
{
temp.append(metaData[j+num]);
temp.append(metaData[j + num]);
}
data.push_back(byteArray2UintLittleEndian <quint64>(temp));
data.push_back(byteArray2UintLittleEndian<quint64>(temp));
temp.clear();
num += sizeof (quint64);
num += sizeof(quint64);
}
this->_sram->setSramMetaData(data);
}
@ -620,18 +707,18 @@ void TrxBoard::setScenarioCompare(const QString scenPath)
QString saveFile = scenPath + createSramBinary;
QFile sramFile(saveFile);
if (!sramFile.open(QIODevice::WriteOnly))
if(!sramFile.open(QIODevice::WriteOnly))
{
throw SonoException("Couldn't create the sram binary file due to the wrong path probably.");
}
quint32 num(0);
quint64 value(0);
while (num < SRAM_SIZE/4)
while(num < SRAM_SIZE / 4)
{
value = _device.device.readLong(BAR_SRAM, static_cast<quint32>(num));
sramFile.write(uintLittleEndian2ByteArray<quint64>(value));
num += sizeof (quint64);
num += sizeof(quint64);
}
sramFile.flush();
@ -648,16 +735,18 @@ void TrxBoard::setScenarioCompare(const QString scenPath)
if(!csvReadFile.open(QFile::ReadOnly))
{
throw SonoException("Could not open the register's scenario params due to the wrong path probably.");
throw SonoException(
"Could not open the register's scenario params due to the wrong path probably.");
}
QString registerCompareScenario = "/hardware/registerCompare.csv";
QString regCompareParamsPath = scenPath + registerCompareScenario;
QFile csvWriteFile(regCompareParamsPath);
if (!csvWriteFile.open(QFile::WriteOnly))
if(!csvWriteFile.open(QFile::WriteOnly))
{
throw SonoException("Couldn't create the register compare file due to the wrong path probably.");
throw SonoException(
"Couldn't create the register compare file due to the wrong path probably.");
}
quint32 bar = 0;
@ -674,7 +763,7 @@ void TrxBoard::setScenarioCompare(const QString scenPath)
auto boardValue = _device.device.readWord(bar, address);
auto res = "NOK";
if (boardValue == baseValue)
if(boardValue == baseValue)
{
res = "OK";
}
@ -684,7 +773,6 @@ void TrxBoard::setScenarioCompare(const QString scenPath)
.arg(baseValue, 8, 16, QLatin1Char('0'))
.arg(boardValue, 8, 16, QLatin1Char('0')).arg(res);
csvWriteFile.write(str.toStdString().c_str(), str.length());
csvWriteFile.write("\r\n", 2);
@ -706,7 +794,8 @@ void TrxBoard::setScenarioCompare(const QString scenPath)
if(!sramReadFile.open(QFile::ReadOnly))
{
throw SonoException("Could not open the sram's scenario params due to the wrong path probably.");
throw SonoException(
"Could not open the sram's scenario params due to the wrong path probably.");
}
qint64 sramScenarioLength = sramReadFile.size();
@ -719,29 +808,28 @@ void TrxBoard::setScenarioCompare(const QString scenPath)
quint64 fileValue(0);
QByteArray temp;
while (num < sramScenarioLength)
while(num < sramScenarioLength)
{
boardValue = _device.device.readLong(BAR_SRAM, static_cast<quint32>(num));
for (quint8 j=0; j < sizeof (quint64); j++)
for(quint8 j = 0; j < sizeof(quint64); j++)
{
temp.append(fileByte[j+num]);
temp.append(fileByte[j + num]);
}
fileValue = byteArray2UintLittleEndian <quint64>(temp);
fileValue = byteArray2UintLittleEndian<quint64>(temp);
if (boardValue != fileValue)
if(boardValue != fileValue)
{
throw SonoException("The sram scenario file is different to the sram params of board.");
}
temp.clear();
num += sizeof (quint64);
num += sizeof(quint64);
}
#ifdef DEVELOP_UI
emit sramVerifyMessage("Successful comparision without any difference.");
#endif
}
QList<quint32> TrxBoard::getAfeReg(eSlaveSelect sel, quint32 afeRegAddr)
@ -750,15 +838,18 @@ QList<quint32> TrxBoard::getAfeReg(eSlaveSelect sel, quint32 afeRegAddr)
quint32 offset(0);
afeRegValue.clear();
switch (sel)
switch(sel)
{
case slave0:
this->_afeSlave0->setReadRegEnable(true);
this->_bCtrlMngt->timerShot(1);
while(!(this->_bCtrlMngt->checkTimeout()));
while(!(this->_bCtrlMngt->checkTimeout()))
{
;
}
for (quint8 i=0; i < _afeModuleOffset.size(); i++)
for(quint8 i = 0; i < _afeModuleOffset.size(); i++)
{
offset = (_fpgaOffset.at(slave0) + _afeModuleOffset.at(i) + afeRegAddr) * 4;
afeRegValue.push_back(this->_device.device.readWord(BAR_REG, offset));
@ -770,9 +861,12 @@ QList<quint32> TrxBoard::getAfeReg(eSlaveSelect sel, quint32 afeRegAddr)
this->_afeSlave1->setReadRegEnable(true);
this->_bCtrlMngt->timerShot(1);
while(!(this->_bCtrlMngt->checkTimeout()));
while(!(this->_bCtrlMngt->checkTimeout()))
{
;
}
for (quint8 i=0; i < _afeModuleOffset.size(); i++)
for(quint8 i = 0; i < _afeModuleOffset.size(); i++)
{
offset = (_fpgaOffset.at(slave1) + _afeModuleOffset.at(i) + afeRegAddr) * 4;
afeRegValue.push_back(this->_device.device.readWord(BAR_REG, offset));
@ -784,9 +878,12 @@ QList<quint32> TrxBoard::getAfeReg(eSlaveSelect sel, quint32 afeRegAddr)
this->_afeSlave2->setReadRegEnable(true);
this->_bCtrlMngt->timerShot(1);
while(!(this->_bCtrlMngt->checkTimeout()));
while(!(this->_bCtrlMngt->checkTimeout()))
{
;
}
for (quint8 i=0; i < _afeModuleOffset.size(); i++)
for(quint8 i = 0; i < _afeModuleOffset.size(); i++)
{
offset = (_fpgaOffset.at(slave2) + _afeModuleOffset.at(i) + afeRegAddr) * 4;
afeRegValue.push_back(this->_device.device.readWord(BAR_REG, offset));
@ -800,7 +897,6 @@ QList<quint32> TrxBoard::getAfeReg(eSlaveSelect sel, quint32 afeRegAddr)
void TrxBoard::slaveFpgaProgram(const QString path)
{
scenParamsFilling(clear);
if(MOUNTED_SLAVE_FPGA <= 0 || MOUNTED_SLAVE_FPGA >= 8)
@ -827,7 +923,7 @@ void TrxBoard::slaveFpgaProgram(const QString path)
this->_fpgaProgram->program(bitFileData, MOUNTED_SLAVE_FPGA);
afeAdcsSync();
}
void TrxBoard::setBeamFormerMode(eClkMode mode) const
@ -837,7 +933,6 @@ void TrxBoard::setBeamFormerMode(eClkMode mode) const
void TrxBoard::scenPlayerStart(void)
{
if(_allow)
{
_run = false;
@ -905,8 +1000,10 @@ void TrxBoard::emulatorInit(EmulatorProperties* config) const
void TrxBoard::fillRam(QString path)
{
if (this->_scenPlayer->control.getCommand())
if(this->_scenPlayer->control.getCommand())
{
scenPlayerStop();
}
emulatorStop();
QFile emulFile(path);
@ -929,16 +1026,18 @@ void TrxBoard::fillRam(QString path)
sramData = emulFile.readAll();
emulFile.close();
while (num < sramData.size())
while(num < sramData.size())
{
for (quint8 j=0; j < sizeof (quint64); j++)
for(quint8 j = 0; j < sizeof(quint64); j++)
{
temp.append(sramData[j+num]);
temp.append(sramData[j + num]);
}
this->_device.device.writeLong(BAR_SRAM, static_cast<quint32>(num), byteArray2UintLittleEndian <quint64>(temp));
this->_device.device.writeLong(BAR_SRAM,
static_cast<quint32>(num),
byteArray2UintLittleEndian<quint64>(temp));
temp.clear();
num += sizeof (quint64);
num += sizeof(quint64);
}
}
@ -980,7 +1079,7 @@ quint32 TrxBoard::vendorId() const
return vid;
}
void TrxBoard::trxState(EepromStatus &romStatus) const
void TrxBoard::trxState(EepromStatus& romStatus) const
{
QByteArray id;
QByteArray crcChk;
@ -988,16 +1087,20 @@ void TrxBoard::trxState(EepromStatus &romStatus) const
romStatus.ConnectionMode = connected;
id = this->_bCtrlMngt->trxEepromRead(EEPROM_ID_BEGIN, EEPROM_ID_NUMBER);
romStatus.id = byteArray2UintBigEndian<quint16> (id);
romStatus.id = byteArray2UintBigEndian<quint16>(id);
crcChk = this->_bCtrlMngt->trxEepromRead(EEPROM_CRC_BEGIN, EEPROM_CRC_NUMBER);
if (crcChk == _eepromCrc)
if(crcChk == _eepromCrc)
{
romStatus.errorCode = EEPROM_NO_ERROR;
}
else
{
romStatus.errorCode = EEPROM_CRC_ERROR;
}
}
void TrxBoard::mpsState(EepromStatus &romStatus) const
void TrxBoard::mpsState(EepromStatus& romStatus) const
{
QByteArray id;
QByteArray crcChk;
@ -1005,16 +1108,20 @@ void TrxBoard::mpsState(EepromStatus &romStatus) const
romStatus.ConnectionMode = connected;
id = this->_bCtrlMngt->mpsEepromRead(EEPROM_ID_BEGIN, EEPROM_ID_NUMBER);
romStatus.id = byteArray2UintBigEndian<quint16> (id);
romStatus.id = byteArray2UintBigEndian<quint16>(id);
crcChk = this->_bCtrlMngt->mpsEepromRead(EEPROM_CRC_BEGIN, EEPROM_CRC_NUMBER);
if (crcChk == _eepromCrc)
if(crcChk == _eepromCrc)
{
romStatus.errorCode = EEPROM_NO_ERROR;
}
else
{
romStatus.errorCode = EEPROM_CRC_ERROR;
}
}
void TrxBoard::prbCtrlState(EepromStatus &romStatus) const
void TrxBoard::prbCtrlState(EepromStatus& romStatus) const
{
QByteArray id;
QByteArray crcChk;
@ -1022,44 +1129,60 @@ void TrxBoard::prbCtrlState(EepromStatus &romStatus) const
romStatus.ConnectionMode = connected;
id = this->_bCtrlMngt->prbCtrlEepromRead(EEPROM_ID_BEGIN, EEPROM_ID_NUMBER);
romStatus.id = byteArray2UintBigEndian<quint16> (id);
romStatus.id = byteArray2UintBigEndian<quint16>(id);
crcChk = this->_bCtrlMngt->prbCtrlEepromRead(EEPROM_CRC_BEGIN, EEPROM_CRC_NUMBER);
if (crcChk == _eepromCrc)
if(crcChk == _eepromCrc)
{
romStatus.errorCode = EEPROM_NO_ERROR;
}
else
{
romStatus.errorCode = EEPROM_CRC_ERROR;
}
}
void TrxBoard::selectedPrbState(EepromStatus &romStatus, eSelectProbe prbSel) const
void TrxBoard::selectedPrbState(EepromStatus& romStatus, eSelectProbe prbSel) const
{
QVector<bool> vec;
QByteArray id;
QByteArray crcChk;
vec = this->_bCtrlMngt->getConnectedPrb();
if (prbSel == prbA && !vec.at(0))
if(prbSel == prbA && !vec.at(0))
{
throw SonoException("This probe is disconnected");
}
if (prbSel == prbB && !vec.at(1))
if(prbSel == prbB && !vec.at(1))
{
throw SonoException("This probe is disconnected");
}
if (prbSel == prbC && !vec.at(2))
if(prbSel == prbC && !vec.at(2))
{
throw SonoException("This probe is disconnected");
}
if (prbSel == prbD && !vec.at(3))
if(prbSel == prbD && !vec.at(3))
{
throw SonoException("This probe is disconnected");
}
romStatus.ConnectionMode = connected;
id = this->_bCtrlMngt->prbEepromRead(EEPROM_ID_BEGIN, EEPROM_ID_NUMBER, prbSel-1);
romStatus.id = byteArray2UintBigEndian<quint16> (id);
id = this->_bCtrlMngt->prbEepromRead(EEPROM_ID_BEGIN, EEPROM_ID_NUMBER, prbSel - 1);
romStatus.id = byteArray2UintBigEndian<quint16>(id);
crcChk = this->_bCtrlMngt->prbEepromRead(EEPROM_CRC_BEGIN, EEPROM_CRC_NUMBER, prbSel-1);
if (crcChk == _eepromCrc)
crcChk = this->_bCtrlMngt->prbEepromRead(EEPROM_CRC_BEGIN, EEPROM_CRC_NUMBER, prbSel - 1);
if(crcChk == _eepromCrc)
{
romStatus.errorCode = EEPROM_NO_ERROR;
}
else
{
romStatus.errorCode = EEPROM_CRC_ERROR;
}
}
void TrxBoard::prbState(PrbCase* prb) const
@ -1080,14 +1203,19 @@ void TrxBoard::prbState(PrbCase* prb) const
prb->prbA.ConnectionMode = connected;
id = this->_bCtrlMngt->prbEepromRead(EEPROM_ID_BEGIN, EEPROM_ID_NUMBER, i);
prb->prbA.id = byteArray2UintBigEndian<quint16> (id);
prb->prbA.id = byteArray2UintBigEndian<quint16>(id);
crcChk = this->_bCtrlMngt->prbEepromRead(EEPROM_CRC_BEGIN, EEPROM_CRC_NUMBER, i);
if (crcChk == _eepromCrc)
crcChk =
this->_bCtrlMngt->prbEepromRead(EEPROM_CRC_BEGIN, EEPROM_CRC_NUMBER, i);
if(crcChk == _eepromCrc)
{
prb->prbA.errorCode = EEPROM_NO_ERROR;
}
else
{
prb->prbA.errorCode = EEPROM_CRC_ERROR;
}
}
else
{
prb->prbA.ConnectionMode = disconnected;
@ -1102,14 +1230,19 @@ void TrxBoard::prbState(PrbCase* prb) const
prb->prbB.ConnectionMode = connected;
id = this->_bCtrlMngt->prbEepromRead(EEPROM_ID_BEGIN, EEPROM_ID_NUMBER, i);
prb->prbB.id = byteArray2UintBigEndian<quint16> (id);
prb->prbB.id = byteArray2UintBigEndian<quint16>(id);
crcChk = this->_bCtrlMngt->prbEepromRead(EEPROM_CRC_BEGIN, EEPROM_CRC_NUMBER, i);
if (crcChk == _eepromCrc)
crcChk =
this->_bCtrlMngt->prbEepromRead(EEPROM_CRC_BEGIN, EEPROM_CRC_NUMBER, i);
if(crcChk == _eepromCrc)
{
prb->prbB.errorCode = EEPROM_NO_ERROR;
}
else
{
prb->prbB.errorCode = EEPROM_CRC_ERROR;
}
}
else
{
prb->prbB.ConnectionMode = disconnected;
@ -1124,14 +1257,19 @@ void TrxBoard::prbState(PrbCase* prb) const
prb->prbC.ConnectionMode = connected;
id = this->_bCtrlMngt->prbEepromRead(EEPROM_ID_BEGIN, EEPROM_ID_NUMBER, i);
prb->prbC.id = byteArray2UintBigEndian<quint16> (id);
prb->prbC.id = byteArray2UintBigEndian<quint16>(id);
crcChk = this->_bCtrlMngt->prbEepromRead(EEPROM_CRC_BEGIN, EEPROM_CRC_NUMBER, i);
if (crcChk == _eepromCrc)
crcChk =
this->_bCtrlMngt->prbEepromRead(EEPROM_CRC_BEGIN, EEPROM_CRC_NUMBER, i);
if(crcChk == _eepromCrc)
{
prb->prbC.errorCode = EEPROM_NO_ERROR;
}
else
{
prb->prbC.errorCode = EEPROM_CRC_ERROR;
}
}
else
{
prb->prbC.ConnectionMode = disconnected;
@ -1146,14 +1284,19 @@ void TrxBoard::prbState(PrbCase* prb) const
prb->prbD.ConnectionMode = connected;
id = this->_bCtrlMngt->prbEepromRead(EEPROM_ID_BEGIN, EEPROM_ID_NUMBER, i);
prb->prbD.id = byteArray2UintBigEndian<quint16> (id);
prb->prbD.id = byteArray2UintBigEndian<quint16>(id);
crcChk = this->_bCtrlMngt->prbEepromRead(EEPROM_CRC_BEGIN, EEPROM_CRC_NUMBER, i);
if (crcChk == _eepromCrc)
crcChk =
this->_bCtrlMngt->prbEepromRead(EEPROM_CRC_BEGIN, EEPROM_CRC_NUMBER, i);
if(crcChk == _eepromCrc)
{
prb->prbD.errorCode = EEPROM_NO_ERROR;
}
else
{
prb->prbD.errorCode = EEPROM_CRC_ERROR;
}
}
else
{
prb->prbD.ConnectionMode = disconnected;
@ -1173,8 +1316,9 @@ QString TrxBoard::trxInfo() const
getFpgasCodeVersion(&version);
QString info = QString(this->_bCtrlMngt->trxEepromRead(EEPROM_INFO_BEGIN, EEPROM_INFO_NUMBER));
return (info + "(FPM-V " + QString::number(version.masterCode, 10)
+ ", FPS-V " + QString::number(version.slave0Code, 10) + ")");
return (info + "(FPM-V " + QString::number(version.masterCode, 10) +
", FPS-V " + QString::number(version.slave0Code, 10) + ")");
}
QString TrxBoard::mpsInfo() const
@ -1189,7 +1333,9 @@ QString TrxBoard::prbCtrlInfo() const
QByteArray TrxBoard::selectedPrbImpulseResponse(quint8 prbSel) const
{
return this->_bCtrlMngt->prbEepromRead(EEPROM_IMPULSE_RESPONSE_BEGIN, EEPROM_IMPULSE_RESPONSE_NUMBER, prbSel);
return this->_bCtrlMngt->prbEepromRead(EEPROM_IMPULSE_RESPONSE_BEGIN,
EEPROM_IMPULSE_RESPONSE_NUMBER,
prbSel);
}
void TrxBoard::prbImpulseResponse(ConnectedPrbInfo* prbInfo) const
@ -1268,7 +1414,10 @@ void TrxBoard::mpsSetAo(float voltA, float voltB) const
void TrxBoard::selectProbe(eSelectProbe prbSel)
{
if(this->_scenPlayer->control.getCommand())
{
scenPlayerStop();
}
this->_bCtrlMngt->setProbeSelect(prbSel);
}
@ -1348,3 +1497,8 @@ void TrxBoard::sramParityClear()
val = this->_device.device.readLong(BAR_SRAM, 0);
this->_device.device.writeLong(BAR_SRAM, 0, val);
}
quint32 TrxBoard::getFrameLostCounter() const
{
return (this->_misc->getFrameLostCount());
}

28
src/model/hardware/core/register/afe/Afe.cpp

@ -51,7 +51,8 @@ void Afe::setPga(const AfeConfig afe) const
Afe::Afe(SonoDevice *device, quint32 offset)
{
_actTerm = new ActiveTerm(device, offset);
_adcSync = new AdcSyncStatus (device, offset);
_actTerm = new ActiveTerm (device, offset);
_lnaHpf = new LnaHpf (device, offset);
_global = new Global (device, offset);
_lowNf = new LowNf (device, offset);
@ -60,6 +61,7 @@ Afe::Afe(SonoDevice *device, quint32 offset)
Afe::~Afe()
{
delete _adcSync;
delete _actTerm;
delete _lnaHpf;
delete _global;
@ -88,3 +90,27 @@ void Afe::setReadRegEnable(const bool rdEn) const
this->_global->regReadEn->setValue(value);
this->_global->update();
}
bool Afe::getAfeSyncDone() const
{
this->_adcSync->sync();
return (this->_adcSync->syncDone->getValue() != 0);
}
quint32 Afe::getAfeSyncError() const
{
this->_adcSync->sync();
return (this->_adcSync->syncError->getValue());
}
quint32 Afe::getAfeSyncAddress() const
{
this->_adcSync->sync();
return (this->_adcSync->syncAddress->getValue());
}
quint32 Afe::getAfeDataValid() const
{
this->_adcSync->sync();
return (this->_adcSync->dataValidOffset->getValue());
}

513
src/model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.cpp

@ -2,86 +2,100 @@
BoardsCtrlMngt::AttenuationFactor::AttenuationFactor()
{
p12v=10.4727f;
p5v=4.3636f;
p4d=4.3636f;
m5v=2.1818f;
curP24v=1.0f;
hvStop=1.0f;
p24v=1.0f;
hva=1.0f;
hvb=1.0f;
cwd=1.0f;
p12v = 10.4727f;
p5v = 4.3636f;
p4d = 4.3636f;
m5v = 2.1818f;
curP24v = 1.0f;
hvStop = 1.0f;
p24v = 1.0f;
hva = 1.0f;
hvb = 1.0f;
cwd = 1.0f;
}
BoardsCtrlMngt::Gain::Gain()
{
curP24v=2.778f;
cwd=6.555f;
m5v=-3.3f;
hvStop=1.0f;
p24v=23.0f;
hva=66.0f;
hvb=66.0f;
p12v=1.0f;
p5v=1.0f;
p4d=1.0f;
curP24v = 2.778f;
cwd = 6.555f;
m5v = -3.3f;
hvStop = 1.0f;
p24v = 23.0f;
hva = 66.0f;
hvb = 66.0f;
p12v = 1.0f;
p5v = 1.0f;
p4d = 1.0f;
}
/***************************************************************************************************/
/************************************* Write Functions Template ************************************/
/************************************* Write Functions Template
************************************/
/***************************************************************************************************/
template<class T1, class T2>
void BoardsCtrlMngt::eepromWrite(QByteArray& arr, quint32 addr, quint8 prbSel, T1* request, T2* status)
void BoardsCtrlMngt::eepromWrite(QByteArray& arr,
quint32 addr,
quint8 prbSel,
T1* request,
T2* status)
{
quint32 j(0);
bool busy=true, error=false, done=false;
bool busy = true, error = false, done = false;
foreach (auto i, arr)
foreach(auto i, arr)
{
status->sync();
busy = ((status->busy->getValue())!=0);
busy = ((status->busy->getValue()) != 0);
timerShot(1);
while (busy)
while(busy)
{
status->sync();
busy = ((status->busy->getValue())!=0);
if (checkTimeout())
busy = ((status->busy->getValue()) != 0);
if(checkTimeout())
{
throw SonoException("Eeprom writing timeout is happened due to the I2C busy");
}
}
timerStop();
timerShot(5); // must be >= 4
while (!checkTimeout());
timerShot(5); //must be >= 4
while(!checkTimeout())
{
;
}
//_rom->dataIn = static_cast<quint32>(i.toLatin1());
_rom->dataIn = i;
_rom->address = addr+j;
_rom->address = addr + j;
_rom->probeSelect = prbSel;
setEepromWrite<T1>(_rom, request);
j++;
status->sync();
done = ((status->reqDone->getValue())!=0);
error = ((status->reqError->getValue())!=0);
done = ((status->reqDone->getValue()) != 0);
error = ((status->reqError->getValue()) != 0);
timerShot(1);
while (!error && !done)
while(!error && !done)
{
status->sync();
done = ((status->reqDone->getValue())!=0);
error = ((status->reqError->getValue())!=0);
if (checkTimeout())
done = ((status->reqDone->getValue()) != 0);
error = ((status->reqError->getValue()) != 0);
if(checkTimeout())
{
throw SonoException("Eeprom writing is corrupted due to the failure to receive done");
}
}
timerStop();
if (error)
if(error)
{
throw SonoException("Eeprom writing is corrupted due to the error occurrence");
}
}
}
template<class T3>
@ -98,66 +112,75 @@ void BoardsCtrlMngt::setEepromWrite(EepromReq* _rom, T3* request)
}
/***************************************************************************************************/
/************************************* Read Functions Template *************************************/
/************************************* Read Functions Template
*************************************/
/***************************************************************************************************/
template<class T4, class T5>
QByteArray BoardsCtrlMngt::eepromRead(quint32 addr, quint32 length, quint8 prbSel, T4 *request, T5 *status)
QByteArray BoardsCtrlMngt::eepromRead(quint32 addr,
quint32 length,
quint8 prbSel,
T4* request,
T5* status)
{
bool busy=true, error=false, done=false;
bool busy = true, error = false, done = false;
QByteArray rdArray;
rdArray.clear();
for (quint32 i(0); i<length; i++)
for(quint32 i(0); i < length; i++)
{
status->sync();
busy = ((status->busy->getValue())!=0);
busy = ((status->busy->getValue()) != 0);
timerShot(1);
while (busy)
while(busy)
{
status->sync();
busy = ((status->busy->getValue())!=0);
if (checkTimeout())
busy = ((status->busy->getValue()) != 0);
if(checkTimeout())
{
throw SonoException("Eeprom reading timeout is happened due to the I2C busy");
}
}
timerStop();
_rom->address = addr+i;
_rom->address = addr + i;
_rom->probeSelect = prbSel;
setEepromRead<T4>(_rom, request);
status->sync();
done = ((status->reqDone->getValue())!=0);
error = ((status->reqError->getValue())!=0);
done = ((status->reqDone->getValue()) != 0);
error = ((status->reqError->getValue()) != 0);
timerShot(1);
while (!error && !done)
while(!error && !done)
{
status->sync();
done = ((status->reqDone->getValue())!=0);
error = ((status->reqError->getValue())!=0);
if (checkTimeout())
done = ((status->reqDone->getValue()) != 0);
error = ((status->reqError->getValue()) != 0);
if(checkTimeout())
{
throw SonoException("Eeprom reading is corrupted due to the failure to receive done");
}
}
timerStop();
if (error)
if(error)
{
throw SonoException("Eeprom reading is corrupted due to the error occurrence");
}
rdArray.append(static_cast<qint8>(status->dataOut->getValue()));
}
return rdArray;
}
template<class T6>
void BoardsCtrlMngt::setEepromRead(BoardsCtrlMngt::EepromReq *_rom, T6 *request)
void BoardsCtrlMngt::setEepromRead(BoardsCtrlMngt::EepromReq* _rom, T6* request)
{
request->address->setValue(_rom->address);
request->prbSel->setValue(_rom->probeSelect);
@ -172,7 +195,8 @@ void BoardsCtrlMngt::setEepromRead(BoardsCtrlMngt::EepromReq *_rom, T6 *request)
/***************************************************************************************************/
float BoardsCtrlMngt::resDiv(float r1, float r2, quint32 adcValue)
{
float result = (static_cast<float>(adcValue)) * (r1+r2)/(r2*1000);
float result = (static_cast<float>(adcValue)) * (r1 + r2) / (r2 * 1000);
return result;
}
@ -180,101 +204,127 @@ QVector<float> BoardsCtrlMngt::voltPg(float adcVolt)
{
QVector<float> pgVec;
pgVec.clear();
pgVec.append(adcVolt * (95.0f/100.0f));
pgVec.append(adcVolt * (105.0f/100.0f));
pgVec.append(adcVolt * (95.0f / 100.0f));
pgVec.append(adcVolt * (105.0f / 100.0f));
return pgVec;
}
float BoardsCtrlMngt::getCWdpValue() const
{
_sRbCwdp->sync();
auto adcValue=_sRbCwdp->cwdpAvgValue->getValue();
auto cwdpValue= ((static_cast<float>(adcValue))/SUPERVISOR_RB_RESOLUTION)*SUPERVISOR_RB_V_REF*_af.cwd*_gn.cwd;
auto adcValue = _sRbCwdp->cwdpAvgValue->getValue();
auto cwdpValue = ((static_cast<float>(adcValue)) / SUPERVISOR_RB_RESOLUTION) *
SUPERVISOR_RB_V_REF * _af.cwd * _gn.cwd;
return cwdpValue;
}
float BoardsCtrlMngt::getCurr24vValue() const
{
_sRbCurr24V->sync();
auto adcValue=_sRbCurr24V->currentP24vAvgValue->getValue();
auto curr24vValue= ((static_cast<float>(adcValue))/SUPERVISOR_RB_RESOLUTION)*SUPERVISOR_RB_V_REF*_af.curP24v*_gn.curP24v;
auto adcValue = _sRbCurr24V->currentP24vAvgValue->getValue();
auto curr24vValue = ((static_cast<float>(adcValue)) / SUPERVISOR_RB_RESOLUTION) *
SUPERVISOR_RB_V_REF * _af.curP24v * _gn.curP24v;
return curr24vValue;
}
float BoardsCtrlMngt::getHVapValue() const
{
_sRbHvap->sync();
auto adcValue=_sRbHvap->hvapAvgValue->getValue();
auto hvapValue= ((static_cast<float>(adcValue))/SUPERVISOR_RB_RESOLUTION)*SUPERVISOR_RB_V_REF*_af.hva*_gn.hva;
auto adcValue = _sRbHvap->hvapAvgValue->getValue();
auto hvapValue = ((static_cast<float>(adcValue)) / SUPERVISOR_RB_RESOLUTION) *
SUPERVISOR_RB_V_REF * _af.hva * _gn.hva;
return hvapValue;
}
float BoardsCtrlMngt::getHVbpValue() const
{
_sRbHvbp->sync();
auto adcValue=_sRbHvbp->hvbpAvgValue->getValue();
auto hvbpValue= ((static_cast<float>(adcValue))/SUPERVISOR_RB_RESOLUTION)*SUPERVISOR_RB_V_REF*_af.hvb*_gn.hvb;
auto adcValue = _sRbHvbp->hvbpAvgValue->getValue();
auto hvbpValue = ((static_cast<float>(adcValue)) / SUPERVISOR_RB_RESOLUTION) *
SUPERVISOR_RB_V_REF * _af.hvb * _gn.hvb;
return hvbpValue;
}
float BoardsCtrlMngt::getHvStopValue() const
{
_sRbHvStop->sync();
auto adcValue=_sRbHvStop->hvStopAvgValue->getValue();
auto hvStopValue= ((static_cast<float>(adcValue))/SUPERVISOR_RB_RESOLUTION)*SUPERVISOR_RB_V_REF*_af.hvStop*_gn.hvStop;
auto adcValue = _sRbHvStop->hvStopAvgValue->getValue();
auto hvStopValue = ((static_cast<float>(adcValue)) / SUPERVISOR_RB_RESOLUTION) *
SUPERVISOR_RB_V_REF * _af.hvStop * _gn.hvStop;
return hvStopValue;
}
float BoardsCtrlMngt::getM5vValue() const
{
_sRbM5V->sync();
auto adcValue=_sRbM5V->m5vAvgValue->getValue();
auto m5vValue= ((static_cast<float>(adcValue))/SUPERVISOR_RB_RESOLUTION)*SUPERVISOR_RB_V_REF*_af.m5v*_gn.m5v;
auto adcValue = _sRbM5V->m5vAvgValue->getValue();
auto m5vValue = ((static_cast<float>(adcValue)) / SUPERVISOR_RB_RESOLUTION) *
SUPERVISOR_RB_V_REF * _af.m5v * _gn.m5v;
return m5vValue;
}
float BoardsCtrlMngt::getP12vValue() const
{
_sRbP12V->sync();
auto adcValue=_sRbP12V->p12vAvgValue->getValue();
auto p12vValue= ((static_cast<float>(adcValue))/SUPERVISOR_RB_RESOLUTION)*SUPERVISOR_RB_V_REF*_af.p12v*_gn.p12v;
auto adcValue = _sRbP12V->p12vAvgValue->getValue();
auto p12vValue = ((static_cast<float>(adcValue)) / SUPERVISOR_RB_RESOLUTION) *
SUPERVISOR_RB_V_REF * _af.p12v * _gn.p12v;
return p12vValue;
}
float BoardsCtrlMngt::getP24vValue() const
{
_sRbP24V->sync();
auto adcValue=_sRbP24V->p24vAvgValue->getValue();
auto p24vValue= ((static_cast<float>(adcValue))/SUPERVISOR_RB_RESOLUTION)*SUPERVISOR_RB_V_REF*_af.p24v*_gn.p24v;
auto adcValue = _sRbP24V->p24vAvgValue->getValue();
auto p24vValue = ((static_cast<float>(adcValue)) / SUPERVISOR_RB_RESOLUTION) *
SUPERVISOR_RB_V_REF * _af.p24v * _gn.p24v;
return p24vValue;
}
float BoardsCtrlMngt::getP4dValue() const
{
_sRbP4D->sync();
auto adcValue=_sRbP4D->p4dAvgValue->getValue();
auto p4dValue= ((static_cast<float>(adcValue))/SUPERVISOR_RB_RESOLUTION)*SUPERVISOR_RB_V_REF*_af.p4d*_gn.p4d;
auto adcValue = _sRbP4D->p4dAvgValue->getValue();
auto p4dValue = ((static_cast<float>(adcValue)) / SUPERVISOR_RB_RESOLUTION) *
SUPERVISOR_RB_V_REF * _af.p4d * _gn.p4d;
return p4dValue;
}
float BoardsCtrlMngt::getP5vValue() const
{
_sRbP5V->sync();
auto adcValue=_sRbP5V->p5vAvgValue->getValue();
auto p5vValue= ((static_cast<float>(adcValue))/SUPERVISOR_RB_RESOLUTION)*SUPERVISOR_RB_V_REF*_af.p5v*_gn.p5v;
auto adcValue = _sRbP5V->p5vAvgValue->getValue();
auto p5vValue = ((static_cast<float>(adcValue)) / SUPERVISOR_RB_RESOLUTION) *
SUPERVISOR_RB_V_REF * _af.p5v * _gn.p5v;
return p5vValue;
}
void BoardsCtrlMngt::setReadbackCmd(bool stopWr, bool avgValue, bool roundRobinConfig) const
{
quint32 stopWrValue=0, avgValueValue=0, roundRobinConfigValue=0;
if (avgValue)
avgValueValue=1;
if (roundRobinConfig)
roundRobinConfigValue=1;
if (stopWr)
stopWrValue=1;
quint32 stopWrValue = 0, avgValueValue = 0, roundRobinConfigValue = 0;
if(avgValue)
{
avgValueValue = 1;
}
if(roundRobinConfig)
{
roundRobinConfigValue = 1;
}
if(stopWr)
{
stopWrValue = 1;
}
_sRbCmd->roundRobinConfig->setValue(roundRobinConfigValue);
_sRbCmd->averageValueRdReq->setValue(avgValueValue);
_sRbCmd->resetStopWr->setValue(stopWrValue);
@ -284,61 +334,84 @@ void BoardsCtrlMngt::setReadbackCmd(bool stopWr, bool avgValue, bool roundRobinC
bool BoardsCtrlMngt::getI2cCmdErr() const
{
_sI2cStatus->sync();
auto status =_sI2cStatus->cmdError->getValue();
return (status!=0);
auto status = _sI2cStatus->cmdError->getValue();
return (status != 0);
}
bool BoardsCtrlMngt::getI2cCmdDone() const
{
_sI2cStatus->sync();
auto status =_sI2cStatus->cmdDone->getValue();
return (status!=0);
auto status = _sI2cStatus->cmdDone->getValue();
return (status != 0);
}
bool BoardsCtrlMngt::getI2cBusy() const
{
_sI2cStatus->sync();
auto status =_sI2cStatus->busy->getValue();
return (status!=0);
auto status = _sI2cStatus->busy->getValue();
return (status != 0);
}
void BoardsCtrlMngt::getSupervisorI2cTimeout() const
{
timerShot(1);
while (getI2cBusy()) {
if (checkTimeout())
while(getI2cBusy())
{
if(checkTimeout())
{
throw SonoException("Supervisor request timeout is happened due to the MPS I2C busy");
}
}
timerStop();
}
void BoardsCtrlMngt::getSupervisorI2cDone() const
{
timerShot(12); // must be >= 11
while (!getI2cCmdDone() && !getI2cCmdErr()){
if (checkTimeout())
throw SonoException("Supervisor request is corrupted due to the failure to receive MPS I2C done");
timerShot(15); //must be >= 11
while(!getI2cCmdDone() && !getI2cCmdErr())
{
if(checkTimeout())
{
throw SonoException(
"Supervisor request is corrupted due to the failure to receive MPS I2C done");
}
}
timerStop();
if (getI2cCmdErr())
if(getI2cCmdErr())
{
throw SonoException("Supervisor request is corrupted due to the MPS I2C error occurrence");
}
}
bool BoardsCtrlMngt::getSetupCmdP24vOnOff() const
{
_sSetupCmd->sync();
return ((_sSetupCmd->p24vOnOff->getValue()) != 0);
}
void BoardsCtrlMngt::setSetupCmdP24vOnOff(bool p24vOnOff) const
{
quint32 p24vOnOffValue=0;
if (p24vOnOff)
p24vOnOffValue=1;
quint32 p24vOnOffValue = 0;
if(p24vOnOff)
{
p24vOnOffValue = 1;
}
_sSetupCmd->p24vOnOff->setValue(p24vOnOffValue);
_sSetupCmd->update();
}
void BoardsCtrlMngt::setSetupCmdJmp(bool jmpDacCmd) const
{
quint32 jmpDacCmdValue=0;
if (jmpDacCmd)
jmpDacCmdValue=1;
quint32 jmpDacCmdValue = 0;
if(jmpDacCmd)
{
jmpDacCmdValue = 1;
}
_sSetupCmd->jmpCmd->setValue(jmpDacCmdValue);
_sSetupCmd->update();
}
@ -346,36 +419,48 @@ void BoardsCtrlMngt::setSetupCmdJmp(bool jmpDacCmd) const
void BoardsCtrlMngt::setSetupCmdDacsOnOff(bool cwd, bool hvb, bool hva) const
{
quint32 cwdValue(0), hvbValue(0), hvaValue(0);
if (cwd)
cwdValue=1;
if(cwd)
{
cwdValue = 1;
}
_sSetupCmd->cwdOnOff->setValue(cwdValue);
if (hvb)
hvbValue=1;
if(hvb)
{
hvbValue = 1;
}
_sSetupCmd->hvbOnOff->setValue(hvbValue);
if (hva)
hvaValue=1;
if(hva)
{
hvaValue = 1;
}
_sSetupCmd->hvaOnOff->setValue(hvaValue);
_sSetupCmd->update();
}
void BoardsCtrlMngt::setMpsDacsValue(BoardsCtrlMngt::MpsDacs *_mpsDacs) const
void BoardsCtrlMngt::setPwrDacsValid(bool pwrValid) const
{
quint32 valid = pwrValid ? 1 : 0;
_sSetupCmd->pwrDacValid->setValue(valid);
_sSetupCmd->update();
}
void BoardsCtrlMngt::setMpsDacsValue(BoardsCtrlMngt::MpsDacs* _mpsDacs) const
{
quint32 value(0);
_sDacValue->dacsValueValid->setValue(1);
value=static_cast<quint32>(((_mpsDacs->cwdValue)-CWD_Offset)*CWD_GAIN);
value = static_cast<quint32>(((_mpsDacs->cwdValue) - CWD_Offset) * CWD_GAIN);
_sDacValue->cwdValue->setValue(value);
value=static_cast<quint32>(((_mpsDacs->hvbValue)-HVB_Offset)*HVB_GAIN);
value = static_cast<quint32>(((_mpsDacs->hvbValue) - HVB_Offset) * HVB_GAIN);
_sDacValue->hvbValue->setValue(value);
value=static_cast<quint32>(((_mpsDacs->hvaValue)-HVA_Offset)*HVA_GAIN);
value = static_cast<quint32>(((_mpsDacs->hvaValue) - HVA_Offset) * HVA_GAIN);
_sDacValue->hvaValue->setValue(value);
_sDacValue->update();
_sDacValue->dacsValueValid->setValue(0);
_sDacValue->update();
}
void BoardsCtrlMngt::timerShot(quint16 ms) const
{
//_timer->singleShot(ms, this, SLOT(checkTimerShot));
@ -386,7 +471,7 @@ void BoardsCtrlMngt::timerShot(quint16 ms) const
bool BoardsCtrlMngt::checkTimeout() const
{
return (_timer->remainingTime()==0) ? true : false;
return (_timer->remainingTime() == 0) ? true : false;
}
void BoardsCtrlMngt::timerStop() const
@ -394,11 +479,11 @@ void BoardsCtrlMngt::timerStop() const
_timer->stop();
}
quint32 BoardsCtrlMngt::getPid() const
{
this->_pcie->sync();
auto pid = this->_pcie->pid->getValue();
return pid;
}
@ -406,6 +491,7 @@ quint32 BoardsCtrlMngt::getVid() const
{
this->_pcie->sync();
auto vid = this->_pcie->vid->getValue();
return vid;
}
@ -414,10 +500,11 @@ QVector<bool> BoardsCtrlMngt::getConnectedPrb() const
QVector<bool> vec;
vec.clear();
this->_pStatus->sync();
vec.append((this->_pStatus->probeADetection->getValue())==0); // active low
vec.append((this->_pStatus->probeBDetection->getValue())==0); // active low
vec.append((this->_pStatus->probeCDetection->getValue())==0); // active low
vec.append((this->_pStatus->probeDDetection->getValue())==0); // active low
vec.append((this->_pStatus->probeADetection->getValue()) == 0); //active low
vec.append((this->_pStatus->probeBDetection->getValue()) == 0); //active low
vec.append((this->_pStatus->probeCDetection->getValue()) == 0); //active low
vec.append((this->_pStatus->probeDDetection->getValue()) == 0); //active low
return vec;
}
@ -439,11 +526,11 @@ void BoardsCtrlMngt::prbCtrlInit() const
this->_pCmd->update();
}
float BoardsCtrlMngt::getTrxTempSensor() const
{
this->_tempSensor->sync();
qint32 temp = static_cast<qint32>(this->_tempSensor->temperature->getValue());
return (temp * TEMP_SENSOR_RESOLUTION);
}
@ -455,88 +542,92 @@ void BoardsCtrlMngt::getTrxBoardVoltages(AdcVoltages* adc, VoltagesPg* pg)
this->_adc3P3V->sync();
value = this->_adc3P3V->channel5Mon->getValue();
voltValue = resDiv(51.0f,100000.0f,value);
voltValue = resDiv(51.0f, 100000.0f, value);
adc->mon3P3V = voltValue;
pgVec= voltPg(3.3f);
pgVec = voltPg(3.3f);
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.0f,value);
voltValue = resDiv(1.2f, 2.0f, value);
adc->mon5Vin = voltValue;
pgVec= voltPg(5.0f);
pgVec = voltPg(5.0f);
pg->mon5Vin = (voltValue >= pgVec.at(0) && voltValue <= pgVec.at(1)) ? good : bad;
this->_adc12Vin->sync();
value = this->_adc12Vin->channel0Mon->getValue();
voltValue = resDiv(30.0f, 10.0f, value);
adc->mon12Vin = voltValue;
pgVec= voltPg(12.0f);
pgVec = voltPg(12.0f);
pg->mon12Vin = (voltValue >= pgVec.at(0) && voltValue <= pgVec.at(1)) ? good : bad;
this->_adcA1P8V->sync();
value = this->_adcA1P8V->channel6Mon->getValue();
voltValue = resDiv(51.0f,100000.0f,value);
voltValue = resDiv(51.0f, 100000.0f, value);
adc->monAfeA1P8V = voltValue;
pgVec= voltPg(1.8f);
pgVec = voltPg(1.8f);
pg->monAfeA1P8V = (voltValue >= pgVec.at(0) && voltValue <= pgVec.at(1)) ? good : bad;
this->_adcD1P8V->sync();
value = this->_adcD1P8V->channel7Mon->getValue();
voltValue = resDiv(51.0f,100000.0f,value);
voltValue = resDiv(51.0f, 100000.0f, value);
adc->monAfeD1P8V = voltValue;
pgVec= voltPg(1.8f);
pgVec = voltPg(1.8f);
pg->monAfeD1P8V = (voltValue >= pgVec.at(0) && voltValue <= pgVec.at(1)) ? good : bad;
this->_adcVcntlp->sync();
value = this->_adcVcntlp->channel4Mon->getValue();
float vcntlp = resDiv(0.0f,100.0f,value);
// Assumptions for Gain Vs. VCNTLP curve:
// first_point=(0,42) , second_point=(1.2,2.5)
if (vcntlp <= 1.2f)
adc->afeVcntlp = (((-39.5f) / 1.2f) * vcntlp ) + 42;
float vcntlp = resDiv(0.0f, 100.0f, value);
//Assumptions for Gain Vs. VCNTLP curve:
//first_point=(0,42) , second_point=(1.2,2.5)
if(vcntlp <= 1.2f)
{
adc->afeVcntlp = (((-39.5f) / 1.2f) * vcntlp) + 42;
}
else
{
adc->afeVcntlp = 2.5f;
}
this->_adcPrb3P3V->sync();
value = this->_adcPrb3P3V->channel3Mon->getValue();
voltValue = resDiv(47.0f,47.0f,value);
voltValue = resDiv(47.0f, 47.0f, value);
adc->prbCtrl3P3V = voltValue;
pgVec= voltPg(3.3f);
pgVec = voltPg(3.3f);
pg->prbCtrl3P3V = (voltValue >= pgVec.at(0) && voltValue <= pgVec.at(1)) ? good : bad;
this->_adcPrbEncoder->sync();
value = this->_adcPrbEncoder->channel2Mon->getValue();
adc->prbZeroEncoder = resDiv(47.0f,47.0f,value);
adc->prbZeroEncoder = resDiv(47.0f, 47.0f, value);
}
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;
pg->regulatorA = ((this->_tRgltorPg->regA->getValue()) != 0) ? good : bad;
pg->regulatorB = ((this->_tRgltorPg->regB->getValue()) != 0) ? good : bad;
}
void BoardsCtrlMngt::getSupervisorValue(SupervisorRbValue *sValue) const
void BoardsCtrlMngt::getSupervisorValue(SupervisorRbValue* sValue) const
{
getSupervisorI2cTimeout();
setReadbackCmd(false, false, true); // roundRobin_pulse
setReadbackCmd(false, false, true); //roundRobin_pulse
setReadbackCmd(false, false, false);
getSupervisorI2cDone();
timerShot(72);
while (!checkTimeout());
while(!checkTimeout())
{
;
}
getSupervisorI2cTimeout();
setReadbackCmd(false, true, false); // avgValueCommand_pulse
setReadbackCmd(false, true, false); //avgValueCommand_pulse
setReadbackCmd(false, false, false);
getSupervisorI2cDone();
getSupervisorI2cTimeout();
setReadbackCmd(true, false, false); // resetStopWrite
setReadbackCmd(true, false, false); //resetStopWrite
setReadbackCmd(false, false, false);
getSupervisorI2cDone();
@ -550,7 +641,6 @@ void BoardsCtrlMngt::getSupervisorValue(SupervisorRbValue *sValue) const
sValue->p24V = getP24vValue();
sValue->hvStop = getHvStopValue();
sValue->curr24V = getCurr24vValue();
}
void BoardsCtrlMngt::getMpsFault(MpsFaultStatus* faultStatus) const
@ -607,9 +697,12 @@ void BoardsCtrlMngt::mpsDeInit() const
void BoardsCtrlMngt::setMpsReset() const
{
if(getSetupCmdP24vOnOff())
{
getSupervisorI2cTimeout();
setSetupCmdP24vOnOff(false);
getSupervisorI2cDone();
}
getSupervisorI2cTimeout();
setSetupCmdJmp(true);
@ -621,6 +714,9 @@ void BoardsCtrlMngt::mpsDacsOff() const
{
getSupervisorI2cTimeout();
setSetupCmdDacsOnOff(false, false, false);
setPwrDacsValid(false);
setPwrDacsValid(true);
setPwrDacsValid(false);
getSupervisorI2cDone();
}
@ -628,14 +724,18 @@ void BoardsCtrlMngt::mpsDacsOn() const
{
getSupervisorI2cTimeout();
setSetupCmdDacsOnOff(false, true, true);
setPwrDacsValid(false);
setPwrDacsValid(true);
setPwrDacsValid(false);
getSupervisorI2cDone();
}
void BoardsCtrlMngt::mpsHvSet(float &hva, float &hvb) const
void BoardsCtrlMngt::mpsHvSet(float& hva, float& hvb) const
{
if (hva > hvb && hva <= HVA_MAX_VALUE)
if(hva > hvb && hva <= HVA_MAX_VALUE)
{
if(hva > 3.3f)
{
if (hva > 3.3f){
_mpsDacs->cwdValue = 0.0f;
_mpsDacs->hvaValue = 3.3f;
_mpsDacs->hvbValue = 1.53f;
@ -648,85 +748,132 @@ void BoardsCtrlMngt::mpsHvSet(float &hva, float &hvb) const
}
getSupervisorI2cTimeout();
setMpsDacsValue (_mpsDacs);
setMpsDacsValue(_mpsDacs);
getSupervisorI2cDone();
}
else
{
throw SonoException("A and B voltage are out of range");
}
}
QByteArray BoardsCtrlMngt::trxEepromRead(quint32 address, quint32 length)
{
if (address + length >= TRX_ROM_MAX_LEN)
if(address + length >= TRX_ROM_MAX_LEN)
{
throw SonoException("Out of range reading from TRX eeprom ");
}
quint8 prbSel = 0;
return eepromRead<TrxEepromRwReq, TrxEepromRwStatus>(address, length, prbSel, _tRomReq, _tRomStatus);
return eepromRead<TrxEepromRwReq, TrxEepromRwStatus>(address,
length,
prbSel,
_tRomReq,
_tRomStatus);
}
QByteArray BoardsCtrlMngt::mpsEepromRead(quint32 address, quint32 length)
{
if (address + length >= MPS_ROM_MAX_LEN)
if(address + length >= MPS_ROM_MAX_LEN)
{
throw SonoException("Out of range reading from MPS eeprom ");
}
quint8 prbSel = 0;
return eepromRead<MpsEepromRwReq, MpsEepromRwStatus>(address, length, prbSel, _mRomReq, _mRomStatus);
return eepromRead<MpsEepromRwReq, MpsEepromRwStatus>(address,
length,
prbSel,
_mRomReq,
_mRomStatus);
}
QByteArray BoardsCtrlMngt::prbCtrlEepromRead(quint32 address, quint32 length)
{
if (address + length >= PRB_CTRL_ROM_MAX_LEN)
if(address + length >= PRB_CTRL_ROM_MAX_LEN)
{
throw SonoException("Out of range reading from Probe Control eeprom ");
}
quint8 prbSel = 0;
return eepromRead<PrbCtrlEepromRwReq, PrbCtrlEepromRwStatus>(address, length, prbSel, _pCtrlRomReq, _pCtrlRomStatus);
return eepromRead<PrbCtrlEepromRwReq, PrbCtrlEepromRwStatus>(address,
length,
prbSel,
_pCtrlRomReq,
_pCtrlRomStatus);
}
QByteArray BoardsCtrlMngt::prbEepromRead(quint32 address, quint32 length, quint8 prbSel)
{
if (address + length >= PRB_ROM_MAX_LEN)
if(address + length >= PRB_ROM_MAX_LEN)
{
throw SonoException("Out of range reading from Probe eeprom ");
}
return eepromRead<PrbEepromRwReq, PrbEepromRwStatus>(address, length, prbSel, _pRomReq, _pRomStatus);
return eepromRead<PrbEepromRwReq, PrbEepromRwStatus>(address,
length,
prbSel,
_pRomReq,
_pRomStatus);
}
void trxEepromWrite(QByteArray arr, quint32 address, BoardsCtrlMngt* boards)
{
if (arr.size() >= static_cast<qint32>(TRX_ROM_MAX_LEN))
if(arr.size() >= static_cast<qint32>(TRX_ROM_MAX_LEN))
{
throw SonoException("Out of range writing into TRX eeprom ");
}
quint8 prbSel = 0;
boards->eepromWrite<TrxEepromRwReq, TrxEepromRwStatus>(arr, address, prbSel, boards->_tRomReq, boards->_tRomStatus);
boards->eepromWrite<TrxEepromRwReq, TrxEepromRwStatus>(arr,
address,
prbSel,
boards->_tRomReq,
boards->_tRomStatus);
}
void mpsEepromWrite(QByteArray arr, quint32 address, BoardsCtrlMngt *boards)
void mpsEepromWrite(QByteArray arr, quint32 address, BoardsCtrlMngt* boards)
{
if (arr.size() >= static_cast<qint32>(MPS_ROM_MAX_LEN))
if(arr.size() >= static_cast<qint32>(MPS_ROM_MAX_LEN))
{
throw SonoException("Out of range writing into MPS eeprom ");
}
quint8 prbSel = 0;
boards->eepromWrite<MpsEepromRwReq, MpsEepromRwStatus>(arr, address, prbSel, boards->_mRomReq, boards->_mRomStatus);
boards->eepromWrite<MpsEepromRwReq, MpsEepromRwStatus>(arr,
address,
prbSel,
boards->_mRomReq,
boards->_mRomStatus);
}
void prbCtrlEepromWrite(QByteArray arr, quint32 address, BoardsCtrlMngt *boards)
void prbCtrlEepromWrite(QByteArray arr, quint32 address, BoardsCtrlMngt* boards)
{
if (arr.size() >= static_cast<qint32>(PRB_CTRL_ROM_MAX_LEN))
if(arr.size() >= static_cast<qint32>(PRB_CTRL_ROM_MAX_LEN))
{
throw SonoException("Out of range writing into Probe Control eeprom ");
}
quint8 prbSel = 0;
boards->eepromWrite<PrbCtrlEepromRwReq, PrbCtrlEepromRwStatus>(arr, address, prbSel, boards->_pCtrlRomReq, boards->_pCtrlRomStatus);
boards->eepromWrite<PrbCtrlEepromRwReq, PrbCtrlEepromRwStatus>(arr,
address,
prbSel,
boards->_pCtrlRomReq,
boards->_pCtrlRomStatus);
}
void prbEepromWrite(QByteArray arr, quint32 address, quint8 prbSel, BoardsCtrlMngt *boards)
void prbEepromWrite(QByteArray arr, quint32 address, quint8 prbSel, BoardsCtrlMngt* boards)
{
if (arr.size() >= static_cast<qint32>(PRB_ROM_MAX_LEN))
if(arr.size() >= static_cast<qint32>(PRB_ROM_MAX_LEN))
{
throw SonoException("Out of range writing into Probe eeprom ");
}
boards->eepromWrite<PrbEepromRwReq, PrbEepromRwStatus>(arr, address, prbSel, boards->_pRomReq, boards->_pRomStatus);
boards->eepromWrite<PrbEepromRwReq, PrbEepromRwStatus>(arr,
address,
prbSel,
boards->_pRomReq,
boards->_pRomStatus);
}

56
src/model/hardware/core/register/fpgaProgram/FpgaProgram.cpp

@ -27,23 +27,14 @@ void FpgaProgram::program(QByteArray& bitFileData, quint8 number)
qint32 progByte(0);
quint32 progData(0);
QByteArray temp;
qint32 bitFileSize = bitFileData.size();
setSlaveFpgaNumber(number);
#ifdef DEVELOP_UI
QProgressDialog progress;
progress.setMinimumSize(300,100);
progress.setLabelText("Please wait...");
progress.setWindowTitle("Slaves FPGA Programming");
progress.setRange(0,bitFileData.size());
progress.setModal(true);
#endif
while(progByte < bitFileData.size())
while(progByte < bitFileSize)
{
for(quint8 i(0); i < sizeof(quint32); i++)
{
//temp.append(bitFileData.at(i+progByte)); assert size
temp.append(bitFileData[i + progByte]);
}
@ -55,15 +46,6 @@ void FpgaProgram::program(QByteArray& bitFileData, quint8 number)
if(_status->getInitFail())
{
//QString fail="";
//if (_status->getFpgaS0InitB())
//fail += "Slave0 FPGA ";
//if (_status->getFpgaS1InitB())
//fail += "Slave1 FPGA ";
//if (_status->getFpgaS2InitB())
//fail += "Slave2 FPGA ";
throw SonoException("init fail happened");
}
if(_status->getProgramTimeout())
@ -72,13 +54,13 @@ void FpgaProgram::program(QByteArray& bitFileData, quint8 number)
"Timeout is happened and the programming of the slave FPGAs is failed");
}
#ifdef DEVELOP_UI
progress.setValue(progByte);
if (progress.wasCanceled())
throw SonoException("Slaves fpga programming is canceled");
#endif
temp.clear();
progByte += sizeof(quint32);
#ifdef DEVELOP_UI
emit programmingProgress(progByte, bitFileSize);
#endif
}
while(!(_status->getProgramFail() || _status->getProgramDone()));
@ -155,27 +137,3 @@ bool FpgaProgram::ProgramStatus::getFpgaS2InitB() const
return (fpgaInitStatus != 0);
}
//bool FpgaProgram::ProgramStatus::getFpgaS0Done()
//{
//_progStatus->sync();
//auto fpgaDoneStatus=_progStatus->slaveFpgaDone->getValue();
//fpgaDoneStatus&=FPGA_S0_DONE;
//return (fpgaDoneStatus!=0);
//}
//bool FpgaProgram::ProgramStatus::getFpgaS1Done()
//{
//_progStatus->sync();
//auto fpgaDoneStatus=_progStatus->slaveFpgaDone->getValue();
//fpgaDoneStatus&=FPGA_S1_DONE;
//return (fpgaDoneStatus!=0);
//}
//bool FpgaProgram::ProgramStatus::getFpgaS2Done()
//{
//_progStatus->sync();
//auto fpgaDoneStatus=_progStatus->slaveFpgaDone->getValue();
//fpgaDoneStatus&=FPGA_S2_DONE;
//return (fpgaDoneStatus!=0);
//}

26
src/model/hardware/core/register/misc/Misc.cpp

@ -6,9 +6,10 @@ Misc::Misc(SonoDevice *device) : _offsetMaster(0), _offsetSlave0(0x50002C), _off
_s1Version = new FpgaVersion (device, _offsetSlave1);
_s2Version = new FpgaVersion (device, _offsetSlave2);
_mVersion = new FpgaVersion (device, _offsetMaster);
_lostCount = new FrameLostCount (device);
_status = new StatusVector (device);
_gt = new GtSendMode (device);
_sync = new SyncMode (device);
_gt = new GtSendMode (device);
}
Misc::~Misc()
@ -16,6 +17,7 @@ Misc::~Misc()
delete _s0Version;
delete _s1Version;
delete _s2Version;
delete _lostCount;
delete _mVersion;
delete _status;
delete _sync;
@ -34,19 +36,20 @@ void Misc::getStatusVector(StatusVec *status) const
this->_status->sync();
status->pgErr = ((this->_status->pgErr->getValue()) != 0);
status->fanFault = ((this->_status->fanFault->getValue()) != 0);
status->mpsErr = ((this->_status->mpsErr->getValue()) != 0);
status->fanFault = ((this->_status->fanFault->getValue()) != 0);
status->frameLost = ((this->_status->frameLost->getValue()) != 0);
status->pulserThd = ((this->_status->pulserThd->getValue()) != 0);
status->scenGtErr = ((this->_status->scenGtErr->getValue()) != 0);
status->syncFifoErr = ((this->_status->syncFifoErr->getValue()) != 0);
status->scenPriErr = ((this->_status->scenPriErr->getValue()) != 0);
status->syncPointErr = ((this->_status->syncPointErr->getValue()) != 0);
status->thermalErr = ((this->_status->thermalErr->getValue()) != 0);
status->syncFifoErr = ((this->_status->syncFifoErr->getValue()) != 0);
status->scenSramErr = ((this->_status->scenSramErr->getValue()) != 0);
status->syncPointErr = ((this->_status->syncPointErr->getValue()) != 0);
status->dintrlvFifoErr = ((this->_status->dintrlvFifoErr->getValue()) != 0);
status->dintrlvPointErr = ((this->_status->dintrlvPointErr->getValue()) != 0);
status->sram1ParityErr = ((this->_status->sram1ParityErr->getValue()) != 0);
status->sram2ParityErr = ((this->_status->sram2ParityErr->getValue()) != 0);
status->dintrlvPointErr = ((this->_status->dintrlvPointErr->getValue()) != 0);
status->dmaCtrlTransferErr = ((this->_status->dmaCtrlTransferErr->getValue()) != 0);
status->emulDmaTransferErr = ((this->_status->emulDmaTransferErr->getValue()) != 0);
status->probeDisconnectErr = ((this->_status->probeDisconnectErr->getValue()) != 0);
@ -65,6 +68,19 @@ void Misc::setSyncMode(eSyncCtrl syncMode) const
this->_sync->update();
}
void Misc::setManualSync(bool sync) const
{
quint32 val = sync ? 1 : 0;
this->_sync->manualSync->setValue(val);
this->_sync->update();
}
quint32 Misc::getFrameLostCount() const
{
this->_lostCount->sync();
return (this->_lostCount->lostCount->getValue());
}
void Misc::getFpgaVersion(FpgaCodeVersion *version) const
{
version->masterCode = this->getVersion<FpgaVersion>(_mVersion);

Loading…
Cancel
Save