Browse Source

sram add

master
Arash Aletayeb 4 years ago
parent
commit
aec57d2627
  1. 3
      developHw.pro.user
  2. 336
      include/model/hardware/core/TrxBoard.h
  3. 30
      include/model/hardware/core/dmaCtrl/DmaCtrl.h
  4. 16
      include/model/hardware/core/register/Field.h
  5. 6
      include/model/hardware/core/register/RegUtils.h
  6. 18
      include/model/hardware/core/register/Register.h
  7. 4
      include/model/hardware/core/register/beamFormer/BeamFormer.h
  8. 12
      include/model/hardware/core/register/beamFormer/registerDefinition/PulseLut.h
  9. 10
      include/model/hardware/core/register/beamFormer/registerDefinition/RxBeamformerLut.h
  10. 33
      include/model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.h
  11. 12
      include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorFaultStatus.h
  12. 2
      include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorI2cStatus.h
  13. 2
      include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbCurr24V.h
  14. 2
      include/model/hardware/core/register/dsp/Dsp.h
  15. 30
      include/model/hardware/core/register/dsp/registerDefinition/ReceiverConfigurationLut.h
  16. 32
      include/model/hardware/core/register/emulator/Emulator.h
  17. 31
      include/model/hardware/core/register/emulator/registerDefinition/EmulatorActivation.h
  18. 30
      include/model/hardware/core/register/emulator/registerDefinition/RamAddress.h
  19. 38
      include/model/hardware/core/register/emulator/registerDefinition/TransferMode.h
  20. 30
      include/model/hardware/core/register/emulator/registerDefinition/TransferRate.h
  21. 84
      include/model/hardware/core/register/misc/Misc.h
  22. 30
      include/model/hardware/core/register/misc/registerDefinition/FpgaVersion.h
  23. 30
      include/model/hardware/core/register/misc/registerDefinition/GtSendMode.h
  24. 98
      include/model/hardware/core/register/misc/registerDefinition/StatusVector.h
  25. 34
      include/model/hardware/core/register/misc/registerDefinition/SyncMode.h
  26. 37
      include/model/hardware/core/register/sram/Sram.h
  27. 97
      include/model/hardware/core/register/sram/registerDefinition/Index.h
  28. 69
      include/model/hardware/core/register/sram/registerDefinition/RxParams.h
  29. 72
      include/model/hardware/core/register/sram/registerDefinition/RxParamsDegree.h
  30. 65
      include/model/hardware/core/register/sram/registerDefinition/RxParamsDelay.h
  31. 71
      include/model/hardware/core/register/sram/registerDefinition/RxParamsPos.h
  32. 52
      include/model/hardware/core/register/sram/registerDefinition/SramStructures.h
  33. 66
      include/model/hardware/core/register/sram/registerDefinition/TxParams.h
  34. 65
      include/model/hardware/core/register/sram/registerDefinition/TxParamsFocus.h
  35. 18
      include/model/hardware/device/SonoConfig.h
  36. 13
      include/model/hardware/device/SonoDevice.h
  37. 805
      mainwindow.cpp
  38. 51
      mainwindow.h
  39. 794
      mainwindow.ui
  40. 597
      src/model/hardware/core/TrxBoard.cpp
  41. 86
      src/model/hardware/core/register/Field.cpp
  42. 144
      src/model/hardware/core/register/Register.cpp
  43. 16
      src/model/hardware/core/register/beamFormer/BeamFormer.cpp
  44. 295
      src/model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.cpp
  45. 2
      src/model/hardware/core/register/bpiFlash/BpiFlash.cpp
  46. 2
      src/model/hardware/core/register/builtInTest/BuiltInTest.cpp
  47. 18
      src/model/hardware/core/register/dsp/Dsp.cpp
  48. 59
      src/model/hardware/core/register/emulator/Emulator.cpp
  49. 18
      src/model/hardware/core/register/fpgaProgram/FpgaProgram.cpp
  50. 74
      src/model/hardware/core/register/misc/Misc.cpp
  51. 72
      src/model/hardware/core/register/sram/Sram.cpp
  52. 130
      src/model/hardware/device/SonoDevice.cpp

3
developHw.pro.user

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.10.0, 2021-05-03T19:45:33. -->
<!-- Written by QtCreator 4.10.0, 2021-05-16T15:18:03. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
@ -314,6 +314,7 @@
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseTerminal">true</value>
<value type="QString" key="RunConfiguration.WorkingDirectory"></value>
<value type="QString" key="RunConfiguration.WorkingDirectory.default">/home/hasis/Desktop/Develop_HardwareTest/build-developHw-Desktop_Qt_5_13_1_GCC_64bit-Debug</value>
</valuemap>

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

@ -13,34 +13,38 @@
#include "model/hardware/core/register/beamFormer/BeamFormer.h"
#include "model/hardware/core/register/scenPlayer/ScenPlayer.h"
#include "model/hardware/core/register/bpiFlash/BpiFlash.h"
#include "model/hardware/core/register/emulator/Emulator.h"
#include "model/hardware/core/register/misc/Misc.h"
#include "model/hardware/core/register/sram/Sram.h"
#include "model/hardware/core/register/dsp/Dsp.h"
#include "model/hardware/core/dmaCtrl/DmaCtrl.h"
#include "model/hardware/device/SonoDevice.h"
#define SLAVE_ELEMENT_SEGMENT 64U
#define TOTAL_SCEN_LUT_SRAM 5U //without sram
#define SLAVE_FPGA_NUMBER 3U
#define TOTAL_SCEN_LUT_SRAM 5U
#define SLAVE_FPGA_NUMBER 1U
#define CLOCK_DIVISION 0x55
#define EEPROM_ID_BYTE_BEGIN 0U
#define EEPROM_ID_BYTE_NUMBER 4U
#define EEPROM_ID_BYTE_BEGIN 19U
#define EEPROM_ID_BYTE_NUMBER 2U
#define EEPROM_INFO_BYTE_BEGIN 0U
#define EEPROM_INFO_BYTE_NUMBER 30U
#define EEPROM_INFO_BYTE_NUMBER 19U
enum eEmulatorOption : bool
{
performance = false,
functionality = true
};
struct ProbeElementPosition
enum eEmulatorMode : bool
{
QList<quint32> xPosition;
QList<quint32> yPosition;
QList<quint32> zPosition;
dynamically = false,
statically = true
};
struct HealthStatus
enum eAfePwrdnMode : bool
{
float systemTemperature;
float criticalComponentTemperature;
AdcVoltages* adcMon;
VoltagesPg* voltsPg;
disable = false,
enable = true
};
enum eSelectProbe : quint8
@ -51,6 +55,30 @@ enum eSelectProbe : quint8
prbD,
};
struct EmulatorProperties
{
quint32 ramBufAddress;
quint32 transferLength;
float transferRate;
eEmulatorMode emulMode;
eEmulatorOption emulOption;
};
struct ProbeElementPosition
{
QVector<float> xPosition;
QVector<float> yPosition;
QVector<float> zPosition;
};
struct HealthStatus
{
float systemTemperature;
float criticalComponentTemperature;
AdcVoltages* adcMon;
VoltagesPg* voltsPg;
};
struct ConnectedPrbId
{
quint32 prbA;
@ -67,16 +95,179 @@ struct ConnectedPrbInfo
QByteArray prbD;
};
typedef struct Pulse_t {
quint32 halfPeriod;
quint32 halfCycleNo;
bool pulseVoltSel;
bool startPhase;
quint32 dampingPulseWidth;
}Pulse_t;
struct RxBeamFormer_t {
quint32 mla;
quint32 lag;
quint32 apodizationSel;
};
struct ReceiverConfig_t {
quint32 mla;
quint32 lineMode;
quint32 aTgcSel;
quint32 stbEn;
quint32 stb;
quint32 subtractFilterEn;
quint32 dcCancelEn;
quint32 ncoFreqSel;
quint32 lpfSel;
quint32 absEn;
quint32 focusNo;
quint32 lineFilterEn;
};
struct SramIndex_t {
QVector<quint32> shotPropertiesIndex;
QVector<quint32> pulsePropertiesIndex;
QVector<quint32> receiverConfigurationIndex;
QVector<bool> firstLineInFrame;
QVector<bool> lastLineInFrame;
QVector<quint32> dLineNum;
QVector<quint32> dEnsembleNum;
};
struct SramTx_t {
QVector<float> txFocusXPos;
QVector<float> txFocusYPos;
QVector<float> txFocusZPos;
QVector<quint32> txStartActiveElementNumber;
QVector<quint32> txActiveElementNumber;
QVector<float> minDelay;
QVector<float> maxDelay;
QVector<quint32> maxDelayQ;
QVector<float> interceptXPos;
QVector<float> interceptYPos;
QVector<float> interceptZPos;
void clear()
{
txFocusXPos.clear();
txFocusYPos.clear();
txFocusZPos.clear();
txStartActiveElementNumber.clear();
txActiveElementNumber.clear();
minDelay.clear();
maxDelay.clear();
maxDelayQ.clear();
interceptXPos.clear();
interceptYPos.clear();
interceptZPos.clear();
}
};
struct SramRx_t {
QVector<quint32> rxR0CenterActiveElementNumber;
QVector<quint32> rxR0ActiveElementNumber;
QVector<float> rxActiveElementStep;
QVector<quint32> interceptPointFiringTime;
QVector<float> r0Position;
QVector<quint32> rxFocusPointNumber;
QVector<float> thetaCos;
QVector<float> thetaSin;
QVector<float> phiCos;
QVector<float> phiSin;
QVector<float> interceptXPos;
QVector<float> interceptYPos;
QVector<float> interceptZPos;
QVector<float> txR0MinDelay;
QVector<float> rxR0MinDelay;
QVector<float> rxR0MaxDelay;
QVector<quint32> txR0MinDelayQ;
QVector<quint32> rxR0MinDelayQ;
QVector<quint32> rxR0MaxDelayQ;
QVector<quint32> rxR0StartActiveElementNumber;
QVector<float> r0XPosition;
QVector<float> r0YPosition;
QVector<float> r0ZPosition;
void clear()
{
rxR0CenterActiveElementNumber.clear();
rxR0ActiveElementNumber.clear();
rxActiveElementStep.clear();
interceptPointFiringTime.clear();
r0Position.clear();
rxFocusPointNumber.clear();
thetaCos.clear();
thetaSin.clear();
phiCos.clear();
phiSin.clear();
interceptXPos.clear();
interceptYPos.clear();
interceptZPos.clear();
txR0MinDelay.clear();
rxR0MinDelay.clear();
rxR0MaxDelay.clear();
txR0MinDelayQ.clear();
rxR0MinDelayQ.clear();
rxR0MaxDelayQ.clear();
rxR0StartActiveElementNumber.clear();
r0XPosition.clear();
r0YPosition.clear();
r0ZPosition.clear();
}
};
struct HwRegister_t {
QVector<float> dtgcLut;
QVector<QVector<float> > blendWeight;
QVector<float> elementXPosition;
QVector<float> elementYPosition;
QVector<float> elementZPosition;
QVector<float> freqLut;
quint32 scenarioStartIndex;
quint32 scenarioEndIndex;
QList<Pulse_t> pulseProps;
quint8 pulseTypeNumber;
quint8 rxBeamFormerTypeNumber;
QList<RxBeamFormer_t> rxBeamFormerProps;
quint8 receiverConfigTypeNumber;
QList<ReceiverConfig_t> receiverConfigProps;
QList<QVector<float>> lpfLut;
QList<QVector<float>> atgcLut;
QList<QVector<int> > apodizationLut;
};
struct ScenGenHardwareOutput_t
{
quint32 focusTypeNumber;
quint32 totalTxShotNumber;
QVector<quint8> rxBeamFormerNumber;
QVector<float> pulseInterval;
HwRegister_t hwRegister;
SramIndex_t indexParams;
SramRx_t rxParams;
SramTx_t txParams;
};
class TrxBoard
{
private:
QVector<quint8> _swapVec;
QList<quint32>* _mcsList;
const quint32 _offsetSlave0;
const quint32 _offsetSlave1;
const quint32 _offsetSlave2;
QVector<quint8> _swapVec;
QVector<quint32> _unsignedQntzrVec;
QList<quint32>* _mcsList;
const quint32 _offsetSlave0;
const quint32 _offsetSlave1;
const quint32 _offsetSlave2;
bool _allow;
int _swCounter;
int _hwCounter;
bool _run;
SonoDevice _device;
AdcVoltages* _adc;
VoltagesPg* _pg;
@ -89,7 +280,9 @@ private:
BeamFormer* _beamFormerSlave2;
ScenPalyer* _scenPlayer;
BpiFlash* _bpiFlash;
DmaCtrl* _dmaCtrl;
Emulator* _emul;
Misc* _misc;
Sram* _sram;
Dsp* _dsp;
enum eScenParams : quint8
@ -98,61 +291,80 @@ private:
set
};
void scenParamsFilling(eScenParams cmd);
void setSwapVector (void);
struct HwRegister
{
///////////// BeamFormer /////////////
RxBeamformerProperties* rxBeamformer;
QList<QVector<quint32>> apodization;
ProbeElementPosition* elementPosition;
PulseProperties* pulse;
//AfeProperties* afe;
quint8 pulseTypeNumber;
quint8 rxBeamFormerTypeNumber;
//////////////// DSP ////////////////
QVector<float> freqLut;
QVector<float> dtgcLut;
QList<QVector<quint32>> lpfLut;
QList<QVector<quint32>> atgcLut;
ReceiverConfiguration* configLut;
QVector<QVector<float>> blendWeight;
quint8 receiverConfigTypeNumber;
HwRegister();
~HwRegister();
};
struct ScenGenHardwareOutput {
quint32 focusTypeNumber;
quint32 totalTxShotNumber;
QVector<quint8> rxBeamFormerNumber;
quint32 scenarioStartIndex;
quint32 scenarioEndIndex;
HwRegister* hwRegister;
SramIndex* indexParams;
SramRx* rxParams;
SramTx* txParams;
ScenGenHardwareOutput();
~ScenGenHardwareOutput();
}*scenParams;
void setScenario (ScenGenHardwareOutput* scenParams);
/////////////////////////// Old TRX ///////////////////////////
QString _name;
QString _version;
int _swCounter;
int _hwCounter;
bool _run;
void scenParamsFilling(eScenParams cmd);
void setSwapVector (void);
//QList<quint32> signedVector2unsignedList (QVector<qint32>& sgnVec);
public:
TrxBoard();
~TrxBoard();
///////////////////////////////// BeamFormer API ///////////////////////////////
void scenRxBeamformerProperties (RxBeamformerProperties* rxBeamformer);
void scenProbeElementPosition (ProbeElementPosition* element);
void scenApodizationLut (QList<QList<quint32>>& apodization);
void scenPulseProperties (PulseProperties* pulse);
void scenAfeLut (AfeProperties* afe);
//////////////////////////////////// DSP API ///////////////////////////////////
void scenReceiverConfigurationLut (ReceiverConfiguration* configLut) const;
void scenLineFilterCoefficient (QList<quint32>& lineFilterLut) const;
void scenBlendWeight (QList<QList<quint32>>& blendWeight) const;
void scenAtgcLut (QList<QList<quint32>>& atgcLut) const;
void scenStbCoefficient (QList<quint32>& stbLut) const;
////////////////////////////////// Scenario API ///////////////////////////////
void setLineFilterCoefficient (QVector<float>& lineFilterLut);
void setStbCoefficient (QVector<quint32>& stbLut);
void setDtgcLut (QVector<float>& dtgcLut);
void setAtgcMode (eAtgcMode mode, quint16 value) const;
void scenFrequencyLut (QList<quint32>& freqLut) const;
void scenLpfLut (QList<QList<quint32>>& lpfLut) const;
void scenDtgcLut (QList<quint32>& dtgcLut) const;
////////////////////////////// Slave Programming API ///////////////////////////
void slaveFpgaProgram (QString path);
void setScenario (ScenGenHardwareOutput_t scenGenHw);
/////////////////////////////// BeamFormer Mode API ////////////////////////////
void setBeamFormerMode (eClkMode mode) const;
void setAfePwrdnMode (eAfePwrdnMode cmd) const;
void setAfeConfig (AfeProperties* afe) const;
/////////////////////////////// Scenario Player API ////////////////////////////
void setScenPlayerIndex (quint32 startIdx, quint32 endIdx) const;
void scenPlayerStart (void) const;
//void scenPlayerPause (bool pause) const;
void scenPlayerStop (void) const;
///////////////////////////////// Sram Fill API ////////////////////////////////
void sramWrite(QList<quint64>& data, quint32 offsetAddr);
////////////////////////////// Slave Programming API ///////////////////////////
void slaveFpgaProgram (QString path);
/////////////////////////////// BeamFormer Mode API ////////////////////////////
void setBeamFormerMode (eClkMode mode) const;
///////////////////////////////// Emulator API /////////////////////////////////
void emulatorInit(EmulatorProperties* config) const;
void emulatorStart(bool start) const;
void emulatorStop(bool stop) const;
void emulatorEnable(void) const;
void emulatorDisable(void) const;
////////////////////////////// BoardCtrlMngt API ///////////////////////////////
quint32 deviceId (void) const;
@ -183,19 +395,13 @@ public:
void mcsProgram (QString path);
void mcsVerify (QString path) const;
//////////////////////////////// Miscellaneous API /////////////////////////////////
void getTrxStatus (StatusVec* status) const;
void getFpgasCodeVersion (FpgaCodeVersion* version) const;
///////////////////////////////// Old TRX //////////////////////////////////////
//HardwarePacketEngine packetEngine;
QString getName();
QString getVersion();
bool selfTest();
bool updateInfo();
bool updateStatus();
void readData();
void start();
void stop();
};
//bool TrxBoard::_allow = false;
#endif // TRXBOARD_H

30
include/model/hardware/core/dmaCtrl/DmaCtrl.h

@ -1,30 +0,0 @@
#ifndef DMACTRL_H
#define DMACTRL_H
#include "model/hardware/device/SonoDevice.h"
//#include "model/hardware/service/HardwarePacketEngine.h"
struct EmulatorProperties
{
EmulatorProperties();
};
class DmaCtrl
{
private:
SonoDevice* _device;
void startTransfer(bool emulatorEn);
void stopTransfer();
void setRamOffsetAddress(qint32 offset);
void setTransferLength(qint32 length);
void setTransferRate(float rate);
void setOptions(bool performanceMode);
void setMode(bool dynamicMode);
public:
DmaCtrl();
void dmaTransactionMode(bool emulActive) const;
};
#endif // DMACTRL_H

16
include/model/hardware/core/register/Field.h

@ -7,32 +7,48 @@ class Field
{
private:
quint32 _value;
quint64 _valueLong;
quint32 _mask;
quint64 _maskLong;
quint8 _length;
quint8 _position;
quint32 _zeroBasedMask;
quint64 _zeroBasedMaskLong;
bool _isSigned;
bool _isUpdated;
Field(quint32 mask, bool isSigned);
Field(quint64 mask);
void findLength();
void findLengthLong();
void findPosition();
void findPositionLong();
void findZeroBasedMask();
void findZeroBasedMaskLong();
public:
static Field* fromBitPosition(quint32 bitPosition);
static Field* fromMaskSigned(quint32 mask);
static Field* fromMaskUnsigned(quint32 mask);
static Field* fromMaskUnsignedLong(quint64 maskLong);
quint32 getValue();
void setValue(quint32 value);
void setValueLong(quint64 valueLong);
bool isUpdated();
void updateValue(quint32 value);
quint32 getRegisterWriteValue();
quint64 getRegisterWriteValueLong();
};
#endif //FIELD_H

6
include/model/hardware/core/register/RegUtils.h

@ -9,6 +9,12 @@
_fields.append(NAME); \
} while(0)
#define ADD_UNSIGNED_FIELD_LONG(NAME, MASK) \
do { \
NAME = Field::fromMaskUnsignedLong(MASK); \
_fields.append(NAME); \
} while(0)
#define ADD_SIGNED_FIELD(NAME, MASK) \
do { \
NAME = Field::fromMaskSigned(MASK); \

18
include/model/hardware/core/register/Register.h

@ -3,6 +3,8 @@
#include "model/hardware/core/register/Field.h"
#include "model/hardware/device/SonoDevice.h"
#include <QtMath>
#include <math.h>
class Register
{
@ -38,10 +40,24 @@ public:
bool isUpdated();
void update();
void upadteArray();
void updateLong();
void updateArray(bool isVariable=false, quint8 arrayLength=0);
void updateArrayLong(quint8 interval, quint32 arrayLength);
void sync();
void syncArray();
static QVector<quint32> qntzr(QVector<float> &data,
quint32 sign,
quint32 wordlength,
quint32 fractionalLength,
float maxLevel,
bool integerOutput,
bool useRound = true,
bool twosCmpl = false);
};
#endif //rEGISTER_H

4
include/model/hardware/core/register/beamFormer/BeamFormer.h

@ -26,9 +26,9 @@ public:
~BeamFormer();
void probeElementPosition (QList<QList<quint32>>& elementPosition) const;
void rxBeamformerProperties (RxBeamformerProperties* rxBeamformer) const;
void rxBeamformerProperties (quint8& rxBeamFormerTypeNumber, RxBeamformerProperties* rxBeamformer) const;
void apodizationLut (QList<QList<quint32>>& apodization) const;
void pulseProperties (PulseProperties* pulse) const;
void pulseProperties (quint8& pulseTypeNumber, PulseProperties* pulse) const;
void afeLut (AfeProperties* afe) const;
void regValid (bool valid) const;
};

12
include/model/hardware/core/register/beamFormer/registerDefinition/PulseLut.h

@ -24,6 +24,14 @@ struct PulseProperties
QList<bool> startPhase;
QList<bool> pulseVoltSel;
QList<quint32> dampingPulseWidth;
void clear (void)
{
halfPeriod.clear();
startPhase.clear();
halfCycleNo.clear();
pulseVoltSel.clear();
dampingPulseWidth.clear();
}
};
class PulseLut : public Register
@ -35,9 +43,9 @@ private:
{
quint32 value=0;
halfPeriodPrp->setValue(_pulseLut->halfPeriod.at(static_cast<qint32>(index)));
halfPeriodPrp->setValue(_pulseLut->halfPeriod.at(static_cast<qint32>(index)) - 1);
halfCycleNoPrp->setValue(_pulseLut->halfCycleNo.at(static_cast<qint32>(index)));
halfCycleNoPrp->setValue(_pulseLut->halfCycleNo.at(static_cast<qint32>(index)) - 1);
value = _pulseLut->startPhase.at(static_cast<qint32>(index)) ? 1 : 0;
startPhasePrp->setValue(value);

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

@ -19,6 +19,12 @@ struct RxBeamformerProperties
QList<quint32> lag;
QList<quint32> apodization;
QList<quint32> mla;
void clear ()
{
lag.clear();
apodization.clear();
mla.clear();
}
};
class RxBeamformerLut : public Register
@ -30,9 +36,9 @@ private:
{
lagPrp->setValue(_rxBfLut->lag.at(static_cast<qint32>(index)));
apodizationSelPrp->setValue(_rxBfLut->apodization.at(static_cast<qint32>(index)));
apodizationSelPrp->setValue(_rxBfLut->apodization.at(static_cast<qint32>(index)) - 1);
mlaPrp->setValue(_rxBfLut->mla.at(static_cast<qint32>(index)));
mlaPrp->setValue(_rxBfLut->mla.at(static_cast<qint32>(index)) - 1);
}
public:

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

@ -185,39 +185,6 @@ private:
float getP4dValue(void) const;
float getP5vValue(void) const;
bool getHvErrFault(void) const;
bool getM5vFault(void) const;
bool getSup4dFault(void) const;
bool getP5vFault(void) const;
bool getP12vFault(void) const;
bool getHvapFault(void) const;
bool getCwdpFault(void) const;
bool getHvbpFault(void) const;
bool getCur24vFault(void) const;
bool getP24vFault(void) const;
bool getOverHvErrFault(void) const;
bool getOverM5vFault(void) const;
bool getOverSup4dFault(void) const;
bool getOverP5vFault(void) const;
bool getOverP12vFault(void) const;
bool getOverHvapFault(void) const;
bool getOverCwdpFault(void) const;
bool getOverHvbpFault(void) const;
bool getOverCur24vFault(void) const;
bool getOverP24vFault(void) const;
bool getUnderHvErrFault(void) const;
bool getUnderM5vFault(void) const;
bool getUnderSup4dFault(void) const;
bool getUnderP5vFault(void) const;
bool getUnderP12vFault(void) const;
bool getUnderHvapFault(void) const;
bool getUnderCwdpFault(void) const;
bool getUnderHvbpFault(void) const;
bool getUnderCur24vFault(void) const;
bool getUnderP24vFault(void) const;
void setReadbackCmd(bool stopWr, bool avgValue, bool roundRobinConfig) const;
bool getI2cCmdErr(void) const;
bool getI2cCmdDone(void) const;

12
include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorFaultStatus.h

@ -53,7 +53,7 @@ public:
Field* hva;
Field* cwd;
Field* hvb;
Field* cur24vOrHvMux;
Field* cur24v;
Field* p24v;
Field* overHvError;
@ -64,7 +64,7 @@ public:
Field* overHva;
Field* overCwd;
Field* overHvb;
Field* overCur24vOrHvMux;
Field* overCur24v;
Field* overP24v;
Field* underHvError;
@ -75,7 +75,7 @@ public:
Field* underHva;
Field* underCwd;
Field* underHvb;
Field* underCur24vOrHvMux;
Field* underCur24v;
Field* underP24v;
SupervisorFaultStatus(SonoDevice* device) : Register(BAR, OFFSET, device)
@ -88,7 +88,7 @@ public:
ADD_UNSIGNED_FIELD(hva, HVA_MASK);
ADD_UNSIGNED_FIELD(cwd, CWD_MASK);
ADD_UNSIGNED_FIELD(hvb, HVB_MASK);
ADD_UNSIGNED_FIELD(cur24vOrHvMux, CUR_24V_OR_HV_MUX_MASK);
ADD_UNSIGNED_FIELD(cur24v, CUR_24V_OR_HV_MUX_MASK);
ADD_UNSIGNED_FIELD(p24v, P24V_MASK);
ADD_UNSIGNED_FIELD(overHvError, OVER_HV_ERROR_MASK);
@ -99,7 +99,7 @@ public:
ADD_UNSIGNED_FIELD(overHva, OVER_HVA_MASK);
ADD_UNSIGNED_FIELD(overCwd, OVER_CWD_MASK);
ADD_UNSIGNED_FIELD(overHvb, OVER_HVB_MASK);
ADD_UNSIGNED_FIELD(overCur24vOrHvMux, OVER_CUR_24V_OR_HV_MUX_MASK);
ADD_UNSIGNED_FIELD(overCur24v, OVER_CUR_24V_OR_HV_MUX_MASK);
ADD_UNSIGNED_FIELD(overP24v, OVER_P24V_MASK);
ADD_UNSIGNED_FIELD(underHvError, UNDER_HV_ERROR_MASK);
@ -110,7 +110,7 @@ public:
ADD_UNSIGNED_FIELD(underHva, UNDER_HVA_MASK);
ADD_UNSIGNED_FIELD(underCwd, UNDER_CWD_MASK);
ADD_UNSIGNED_FIELD(underHvb, UNDER_HVB_MASK);
ADD_UNSIGNED_FIELD(underCur24vOrHvMux, UNDER_CUR_24V_OR_HV_MUX_MASK);
ADD_UNSIGNED_FIELD(underCur24v, UNDER_CUR_24V_OR_HV_MUX_MASK);
ADD_UNSIGNED_FIELD(underP24v, UNDER_P24V_MASK);
}
};

2
include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorI2cStatus.h

@ -11,7 +11,7 @@
#define BUSY_MASK 0x00000004
#define BAR 0
#define OFFSET 0X26
#define OFFSET 0X260C8
class SupervisorI2cStatus : public Register
{

2
include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbCurr24V.h

@ -25,6 +25,6 @@ public:
#undef CURRENT_P24V_AVG_VALUE_MASK
#undef BAR
#undef OFFSETs
#undef OFFSET
#endif

2
include/model/hardware/core/register/dsp/Dsp.h

@ -38,7 +38,7 @@ public:
explicit Dsp(SonoDevice* device);
~Dsp();
void receiverConfigurationLut (ReceiverConfiguration* configLut) const;
void receiverConfigurationLut (quint8& receiverConfigTypeNumber, ReceiverConfiguration* configLut) const;
void lineFilterCoefficient (QList<quint32>& lineFilterLut) const;
void stbCoefficient (QList<quint32>& stbLut) const;
void frequencyLut (QList<quint32>& freqLut) const;

30
include/model/hardware/core/register/dsp/registerDefinition/ReceiverConfigurationLut.h

@ -43,6 +43,24 @@ struct ReceiverConfiguration
QList<bool> ddcEn;
QList<bool> wmfEn;
QList<bool> dpeEn;
void clear()
{
mla.clear();
lineMode.clear();
aTgcSel.clear();
stbEn.clear();
stb.clear();
subtractFilterEn.clear();
dcCancelerEn.clear();
ncoFreqSel.clear();
lpfSel.clear();
absEn.clear();
focusNo.clear();
lineFilterEn.clear();
ddcEn.clear();
wmfEn.clear();
dpeEn.clear();
}
};
class ReceiverConfigurationLut : public Register
@ -54,11 +72,11 @@ private:
{
quint32 value=0;
mlaPrp->setValue(_configLut->mla.at(static_cast<qint32>(index)));
mlaPrp->setValue(_configLut->mla.at(static_cast<qint32>(index)) - 1);
lineModePrp->setValue(_configLut->lineMode.at(static_cast<qint32>(index)));
lineModePrp->setValue(_configLut->lineMode.at(static_cast<qint32>(index)) - 1);
atgcSelPrp->setValue(_configLut->aTgcSel.at(static_cast<qint32>(index)));
atgcSelPrp->setValue(_configLut->aTgcSel.at(static_cast<qint32>(index)) - 1);
value = _configLut->stbEn.at(static_cast<qint32>(index)) ? 1 : 0;
stbEnPrp->setValue(value);
@ -71,14 +89,14 @@ private:
value = _configLut->dcCancelerEn.at(static_cast<qint32>(index)) ? 1 : 0;
dcCancelEnPrp->setValue(value);
ncoFreqSelPrp->setValue(_configLut->ncoFreqSel.at(static_cast<qint32>(index)));
ncoFreqSelPrp->setValue(_configLut->ncoFreqSel.at(static_cast<qint32>(index)) - 1);
lpfSelPrp->setValue(_configLut->lpfSel.at(static_cast<qint32>(index)));
lpfSelPrp->setValue(_configLut->lpfSel.at(static_cast<qint32>(index)) - 1);
value = _configLut->absEn.at(static_cast<qint32>(index)) ? 1 : 0;
absEnPrp->setValue(value);
focusNoPrp->setValue(_configLut->focusNo.at(static_cast<qint32>(index)));
focusNoPrp->setValue(_configLut->focusNo.at(static_cast<qint32>(index)) - 1);
value = _configLut->lineFilterEn.at(static_cast<qint32>(index)) ? 1 : 0;
lineFilterEnPrp->setValue(value);

32
include/model/hardware/core/register/emulator/Emulator.h

@ -0,0 +1,32 @@
#ifndef EMULATOR_H
#define EMULATOR_H
#include "registerDefinition/RamAddress.h"
#include "registerDefinition/TransferMode.h"
#include "registerDefinition/TransferRate.h"
#include "registerDefinition/EmulatorActivation.h"
#define EMULATOR_ENABLE 1U
#define EMULATOR_DISABLE 0U
class Emulator
{
private:
RamAddress* _ramAddr;
TransferMode* _transMode;
TransferRate* _transRate;
EmulatorActivation* _emulAct;
public:
explicit Emulator(SonoDevice* device);
~Emulator();
void setEmulatorEn() const;
void setEmulatorDis() const;
void setTransferMode(bool option, bool mode, quint32 length) const;
void setRamOffsetAddress(quint32 offset) const;
void setTransferRate(float rate) const;
};
#endif // EMULATOR_H

31
include/model/hardware/core/register/emulator/registerDefinition/EmulatorActivation.h

@ -0,0 +1,31 @@
#ifndef EMULATORACTIVATION_H
#define EMULATORACTIVATION_H
#include "model/hardware/core/register/Register.h"
#include "model/hardware/core/register/RegUtils.h"
#undef BAR
#define EMULATOR_ACTIVATION_MASK 0x00000002
#define BAR 0U
#define OFFSET 0X8
class EmulatorActivation : public Register
{
public:
Field* emulatorActivation;
EmulatorActivation(SonoDevice* device) : Register(BAR, OFFSET, device)
{
ADD_UNSIGNED_FIELD(emulatorActivation, EMULATOR_ACTIVATION_MASK);
}
};
#undef EMULATOR_ACTIVATION_MASK
#undef BAR
#undef OFFSET
#endif // EMULATORACTIVATION_H

30
include/model/hardware/core/register/emulator/registerDefinition/RamAddress.h

@ -0,0 +1,30 @@
#ifndef RAMADDRESS_H
#define RAMADDRESS_H
#include "model/hardware/core/register/Register.h"
#include "model/hardware/core/register/RegUtils.h"
#undef BAR
#define RAM_BUF_ADDR_MASK 0x00FFFFFF
#define BAR 2U
#define OFFSET 0X2024
class RamAddress : public Register
{
public:
Field* ramBufAddr;
RamAddress(SonoDevice* device) : Register(BAR, OFFSET, device)
{
ADD_UNSIGNED_FIELD(ramBufAddr, RAM_BUF_ADDR_MASK);
}
};
#undef RAM_BUF_ADDR_MASK
#undef BAR
#undef OFFSET
#endif // RAMADDRESS_H

38
include/model/hardware/core/register/emulator/registerDefinition/TransferMode.h

@ -0,0 +1,38 @@
#ifndef TRANSFERMODE_H
#define TRANSFERMODE_H
#include "model/hardware/core/register/Register.h"
#include "model/hardware/core/register/RegUtils.h"
#undef BAR
#define TRANSFER_LENGTH_MASK 0x007FFFFF
#define EMUL_MODE_MASK 0x40000000
#define EMUL_OPTION_MASK 0x80000000
#define BAR 2U
#define OFFSET 0X2028
class TransferMode : public Register
{
public:
Field* transferLength;
Field* emulMode;
Field* emulOption;
TransferMode(SonoDevice* device) : Register(BAR, OFFSET, device)
{
ADD_UNSIGNED_FIELD(transferLength, TRANSFER_LENGTH_MASK);
ADD_UNSIGNED_FIELD(emulMode, EMUL_MODE_MASK);
ADD_UNSIGNED_FIELD(emulOption, EMUL_OPTION_MASK);
}
};
#undef TRANSFER_LENGTH_MASK
#undef EMUL_MODE_MASK
#undef EMUL_OPTION_MASK
#undef BAR
#undef OFFSET
#endif // TRANSFERMODE_H

30
include/model/hardware/core/register/emulator/registerDefinition/TransferRate.h

@ -0,0 +1,30 @@
#ifndef TRANSFERRATE_H
#define TRANSFERRATE_H
#include "model/hardware/core/register/Register.h"
#include "model/hardware/core/register/RegUtils.h"
#undef BAR
#define TRANSFER_RATE_MASK 0xFFFFFFFF
#define BAR 2U
#define OFFSET 0X202C
class TransferRate : public Register
{
public:
Field* transferRate;
TransferRate(SonoDevice* device) : Register(BAR, OFFSET, device)
{
ADD_UNSIGNED_FIELD(transferRate, TRANSFER_RATE_MASK);
}
};
#undef TRANSFER_RATE_MASK
#undef BAR
#undef OFFSET
#endif // TRANSFERRATE_H

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

@ -0,0 +1,84 @@
#ifndef MISC_H
#define MISC_H
#include "registerDefinition/FpgaVersion.h"
#include "registerDefinition/GtSendMode.h"
#include "registerDefinition/StatusVector.h"
#include "registerDefinition/SyncMode.h"
struct StatusVec
{
bool probeDetChanInterrupt;
bool sram1ParityErr;
bool sram2ParityErr;
bool mpsErr;
bool scenPriErr;
bool scenGtErr;
bool scenSramErr;
bool syncFifoErr;
bool syncPointErr;
bool dintrlvFifoErr;
bool dintrlvPointErr;
bool pulserThd;
bool thermalErr;
bool pgErr;
bool probeDisconnectErr;
bool fanFault;
bool emulDmaTransferErr;
bool dmaCtrlTransferErr;
};
struct FpgaCodeVersion
{
quint32 masterCode;
quint32 slave0Code;
quint32 slave1Code;
quint32 slave2Code;
};
enum eGtSendCtrl : quint8
{
BfMode = 1,
AdcMode,
DbgMode,
};
enum eSyncCtrl : quint8
{
BfSyncMode,
AdcSyncMode,
BfAdcLogMode,
};
class Misc
{
private:
const quint32 _offsetMaster;
const quint32 _offsetSlave0;
const quint32 _offsetSlave1;
const quint32 _offsetSlave2;
FpgaVersion* _s0Version;
FpgaVersion* _s1Version;
FpgaVersion* _s2Version;
FpgaVersion* _mVersion;
StatusVector* _status;
GtSendMode* _gt;
SyncMode* _sync;
template<class T>
quint32 getVersion (T* version) const;
public:
explicit Misc(SonoDevice* device);
~Misc();
void getStatusVector(StatusVec* status) const;
void getFpgaVersion(FpgaCodeVersion* version) const;
void setGtSendMode (eGtSendCtrl gtMode) const;
void setSyncMode (eSyncCtrl syncMode) const;
};
#endif // MISC_H

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

@ -0,0 +1,30 @@
#ifndef FPGAVERSION_H
#define FPGAVERSION_H
#include "model/hardware/core/register/Register.h"
#include "model/hardware/core/register/RegUtils.h"
#undef BAR
#define SYNTHESIS_TIME_MASK 0xFFFFFFFF
#define BAR 0U
#define OFFSET 0x4
class FpgaVersion : public Register
{
public:
Field* synthesisTime;
FpgaVersion(SonoDevice* device, quint32 offset) : Register(BAR, OFFSET+offset, device)
{
ADD_UNSIGNED_FIELD(synthesisTime, SYNTHESIS_TIME_MASK);
}
};
#undef SYNTHESIS_TIME_MASK
#undef BAR
#undef OFFSET
#endif // FPGAVERSION_H

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

@ -0,0 +1,30 @@
#ifndef GTSENDMODE_H
#define GTSENDMODE_H
#include "model/hardware/core/register/Register.h"
#include "model/hardware/core/register/RegUtils.h"
#undef BAR
#define GT_SEND_MODE_CTRL_MASK 0x00000003
#define BAR 0U
#define OFFSET 0X10
class GtSendMode : public Register
{
public:
Field* gtSendModeCtrl;
GtSendMode(SonoDevice* device) : Register(BAR, OFFSET, device)
{
ADD_UNSIGNED_FIELD(gtSendModeCtrl, GT_SEND_MODE_CTRL_MASK);
}
};
#undef GT_SEND_MODE_CTRL_MASK
#undef BAR
#undef OFFSET
#endif // GTSENDMODE_H

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

@ -0,0 +1,98 @@
#ifndef STATUSVECTOR_H
#define STATUSVECTOR_H
#include "model/hardware/core/register/Register.h"
#include "model/hardware/core/register/RegUtils.h"
#undef BAR
#define PROBE_DETECTION_INTERRUPT_MASK 0x00000001
#define SRAM_1_PARITY_Err_MASK 0x00000002
#define SRAM_2_PARITY_Err_MASK 0x00000004
#define MPS_Err_MASK 0x00000008
#define SCEN_RPI_Err_MASK 0x00000010
#define SCEN_GT_Err_MASK 0x00000020
#define SCEN_SRAM_Err_MASK 0x00000040
#define SYNC_FIFO_Err_MASK 0x00000080
#define SYNC_POINT_Err_MASK 0x00000100
#define DINTRLV_FIFO_Err_MASK 0x00000200
#define DINTRLV_POINT_Err_MASK 0x00000400
#define PULSER_THD_MASK 0x00000800
#define THERMAL_Err_MASK 0x00001000
#define PG_Err_MASK 0x00002000
#define PROBE_DISCONNECT_Err_MASK 0x00004000
#define FAN_FAULT_MASK 0x00008000
#define EMUL_DMA_TRANSFER_Err_MASK 0x40000000
#define DMA_CTRL_TRANSFER_Err_MASK 0x80000000
#define BAR 0U
#define OFFSET 0x0
class StatusVector : public Register
{
public:
Field* probeDetChanInterrupt;
Field* sram1ParityErr;
Field* sram2ParityErr;
Field* mpsErr;
Field* scenPriErr;
Field* scenGtErr;
Field* scenSramErr;
Field* syncFifoErr;
Field* syncPointErr;
Field* dintrlvFifoErr;
Field* dintrlvPointErr;
Field* pulserThd;
Field* thermalErr;
Field* pgErr;
Field* probeDisconnectErr;
Field* fanFault;
Field* emulDmaTransferErr;
Field* dmaCtrlTransferErr;
StatusVector(SonoDevice* device) : Register(BAR, OFFSET, device)
{
ADD_UNSIGNED_FIELD(probeDetChanInterrupt, PROBE_DETECTION_INTERRUPT_MASK);
ADD_UNSIGNED_FIELD(sram1ParityErr, SRAM_1_PARITY_Err_MASK);
ADD_UNSIGNED_FIELD(sram2ParityErr, SRAM_2_PARITY_Err_MASK);
ADD_UNSIGNED_FIELD(mpsErr, MPS_Err_MASK);
ADD_UNSIGNED_FIELD(scenPriErr, SCEN_RPI_Err_MASK);
ADD_UNSIGNED_FIELD(scenGtErr, SCEN_GT_Err_MASK);
ADD_UNSIGNED_FIELD(scenSramErr, SCEN_SRAM_Err_MASK);
ADD_UNSIGNED_FIELD(syncFifoErr, SYNC_FIFO_Err_MASK);
ADD_UNSIGNED_FIELD(syncPointErr, SYNC_POINT_Err_MASK);
ADD_UNSIGNED_FIELD(dintrlvFifoErr, DINTRLV_FIFO_Err_MASK);
ADD_UNSIGNED_FIELD(dintrlvPointErr, DINTRLV_POINT_Err_MASK);
ADD_UNSIGNED_FIELD(pulserThd, PULSER_THD_MASK);
ADD_UNSIGNED_FIELD(thermalErr, THERMAL_Err_MASK);
ADD_UNSIGNED_FIELD(pgErr, PG_Err_MASK);
ADD_UNSIGNED_FIELD(probeDisconnectErr, PROBE_DISCONNECT_Err_MASK);
ADD_UNSIGNED_FIELD(fanFault, FAN_FAULT_MASK);
ADD_UNSIGNED_FIELD(emulDmaTransferErr, EMUL_DMA_TRANSFER_Err_MASK);
ADD_UNSIGNED_FIELD(dmaCtrlTransferErr, DMA_CTRL_TRANSFER_Err_MASK);
}
};
#undef PROBE_DETECTION_INTERRUPT_MASK
#undef SRAM_1_PARITY_Err_MASK
#undef SRAM_2_PARITY_Err_MASK
#undef MPS_Err_MASK
#undef SCEN_RPI_Err_MASK
#undef SCEN_GT_Err_MASK
#undef SCEN_SRAM_Err_MASK
#undef SYNC_FIFO_Err_MASK
#undef SYNC_POINT_Err_MASK
#undef DINTRLV_FIFO_Err_MASK
#undef DINTRLV_POINT_Err_MASK
#undef PULSER_THD_MASK
#undef THERMAL_Err_MASK
#undef PG_Err_MASK
#undef PROBE_DISCONNECT_Err_MASK
#undef FAN_FAULT_MASK
#undef EMUL_DMA_TRANSFER_Err_MASK
#undef DMA_CTRL_TRANSFER_Err_MASK
#undef BAR
#undef OFFSET
#endif // STATUSVECTOR_H

34
include/model/hardware/core/register/misc/registerDefinition/SyncMode.h

@ -0,0 +1,34 @@
#ifndef SYNCMODE_H
#define SYNCMODE_H
#include "model/hardware/core/register/Register.h"
#include "model/hardware/core/register/RegUtils.h"
#undef BAR
#define SYNC_MDOE_MASK 0x00000003
#define MANUAL_SYNC_MASK 0x00000004
#define BAR 0U
#define OFFSET 0x14
class SyncMode : public Register
{
public:
Field* syncMode;
Field* manualSync;
SyncMode(SonoDevice* device) : Register(BAR, OFFSET, device)
{
ADD_UNSIGNED_FIELD(syncMode, SYNC_MDOE_MASK);
ADD_UNSIGNED_FIELD(manualSync, MANUAL_SYNC_MASK);
}
};
#undef SYNC_MDOE_MASK
#undef MANUAL_SYNC_MASK
#undef BAR
#undef OFFSET
#endif // SYNCMODE_H

37
include/model/hardware/core/register/sram/Sram.h

@ -0,0 +1,37 @@
#ifndef SRAM_H
#define SRAM_H
#include "registerDefinition/Index.h"
#include "registerDefinition/TxParams.h"
#include "registerDefinition/RxParams.h"
#include "registerDefinition/RxParamsPos.h"
#include "registerDefinition/RxParamsDelay.h"
#include "registerDefinition/TxParamsFocus.h"
#include "registerDefinition/RxParamsDegree.h"
#define INDEX_INTERVAL 1U
#define TX_RX_INTERVAL 27U
#define INNER_RX_INTERVAL 3U
class Sram
{
private:
Index* _index;
TxParams* _tx;
TxParamsFocus* _txFocus;
RxParams* _rx;
RxParamsDegree* _rxDegree;
RxParamsPos* _rxPos;
RxParamsDelay* _rxDelay;
public:
explicit Sram(SonoDevice* device);
~Sram();
void setSramIndex (quint32& totalTxShotNumber, SramIndex* index) const;
void setSramTx (quint32& focusTypeNumber, SramTx* tx) const;
void setSramRx (QVector<quint8>& rxBeamFormerNumber, quint32& focusTypeNumber, SramRx* rx) const;
};
#endif // SRAM_H

97
include/model/hardware/core/register/sram/registerDefinition/Index.h

@ -0,0 +1,97 @@
#ifndef INDEX_H
#define INDEX_H
#include "model/hardware/core/register/Register.h"
#include "model/hardware/core/register/RegUtils.h"
#include "SramStructures.h"
#undef BAR
#define SHOT_PROPERTIES_INDEX_MASK 0x00000000001FFFFF
#define RECEIVER_CONFIGURATION_INDEX_MASK 0x0000000000E00000
#define PULSE_PROPERTIES_INDEX_MASK 0x0000000007000000
#define FIRST_LINE_IN_FRAME_MASK 0x0000000008000000
#define LAST_LINE_IN_FRAME_MASK 0x0000000010000000
#define D_LINE_NUM_MASK 0x0000001FE0000000
#define D_ENSEMBLE_NUM_MASK 0x000003E000000000
#define FRAME_TYPE_MASK 0xFF00000000000000
#define BAR 1U
#define OFFSET 0x0
#define LENGTH 131072U
class Index : public Register
{
private:
SramIndex* _index;
const quint32 txBaseAddr;
const quint32 focusPropertiesSize;
void prepareData(quint32 index) override
{
quint32 value(0);
quint32 offsetAddr = txBaseAddr + (_index->shotPropertiesIndex[static_cast<qint32>(index)] - 1) * focusPropertiesSize;
shotPropertiesIndex->setValueLong(offsetAddr);
receiverConfigurationIndex->setValueLong(_index->receiverConfigurationIndex[static_cast<qint32>(index)] - 1);
pulsePropertiesIndex->setValueLong(_index->pulsePropertiesIndex[static_cast<qint32>(index)] - 1);
value = _index->firstLineInFrame[static_cast<qint32>(index)] ? 1 : 0;
firstLineInFrame->setValueLong(value);
value = _index->lastLineInFrame[static_cast<qint32>(index)] ? 1 : 0;
lastLineInFrame->setValueLong(value);
dLineNum->setValueLong(_index->dLineNum[static_cast<qint32>(index)] - 1);
dEnsembleNum->setValueLong(_index->dEnsembleNum[static_cast<qint32>(index)] - 1);
if (index==0)
frameType->setValueLong(_index->frameType);
}
public:
Field* shotPropertiesIndex;
Field* receiverConfigurationIndex;
Field* pulsePropertiesIndex;
Field* firstLineInFrame;
Field* lastLineInFrame;
Field* dLineNum;
Field* dEnsembleNum;
Field* frameType;
void setIndex (SramIndex* index)
{
_index = index;
}
Index(SonoDevice* device) : Register(BAR, OFFSET, device, LENGTH), txBaseAddr(131072), focusPropertiesSize(27)
{
ADD_UNSIGNED_FIELD_LONG(shotPropertiesIndex, SHOT_PROPERTIES_INDEX_MASK );
ADD_UNSIGNED_FIELD_LONG(receiverConfigurationIndex, RECEIVER_CONFIGURATION_INDEX_MASK);
ADD_UNSIGNED_FIELD_LONG(pulsePropertiesIndex, PULSE_PROPERTIES_INDEX_MASK );
ADD_UNSIGNED_FIELD_LONG(firstLineInFrame, FIRST_LINE_IN_FRAME_MASK );
ADD_UNSIGNED_FIELD_LONG(lastLineInFrame, LAST_LINE_IN_FRAME_MASK );
ADD_UNSIGNED_FIELD_LONG(dLineNum, D_LINE_NUM_MASK );
ADD_UNSIGNED_FIELD_LONG(dEnsembleNum, D_ENSEMBLE_NUM_MASK );
ADD_UNSIGNED_FIELD_LONG(frameType, FRAME_TYPE_MASK );
}
};
#undef SHOT_PROPERTIES_INDEX_MASK
#undef PULSE_PROPERTIES_INDEX_MASK
#undef RECEIVER_CONFIGURATION_INDEX_MASK
#undef FIRST_LINE_IN_FRAME_MASK
#undef LAST_LINE_IN_FRAME_MASK
#undef D_LINE_NUM_MASK
#undef D_ENSEMBLE_NUM_MASK
#undef FRAME_TYPE_MASK
#undef BAR
#undef OFFSET
#undef LENGTH
#endif // INDEX_H

69
include/model/hardware/core/register/sram/registerDefinition/RxParams.h

@ -0,0 +1,69 @@
#ifndef RXPARAMS_H
#define RXPARAMS_H
#include "model/hardware/core/register/Register.h"
#include "model/hardware/core/register/RegUtils.h"
#include "SramStructures.h"
#undef BAR
#define RX_ACTIVE_ELEMENT_STEP_MASK 0x00000000000000FF
#define INTERCEPT_POINT_FIRING_TIME_MASK 0x00000000000FFF00
#define RX_FOCUS_POINT_NUMBER_MASK 0x00000001FFF00000
#define R0_POSITION_MASK 0x0003FFFE00000000
#define BAR 1U
#define OFFSET 0x100010
#define LENGTH 11264U
class RxParams : public Register
{
private:
SramRx* _rx;
QVector<quint32> rxActiveElementStepQ;
QVector<quint32> r0PositionQ;
void prepareData(quint32 index) override
{
rxActiveElementStep->setValueLong(rxActiveElementStepQ[static_cast<qint32>(index)]);
interceptPointFiringTime->setValueLong(_rx->interceptPointFiringTime[static_cast<qint32>(index)]);
rxFocusPointNumber->setValueLong(_rx->rxFocusPointNumber[static_cast<qint32>(index)]) ;
r0Position->setValueLong(r0PositionQ[static_cast<qint32>(index)]);
}
public:
Field* rxActiveElementStep;
Field* interceptPointFiringTime;
Field* rxFocusPointNumber;
Field* r0Position;
void setRxParams (SramRx* rx)
{
_rx = rx;
rxActiveElementStepQ = Register::qntzr(_rx->rxActiveElementStep, 0, 8, 8, 0, true, false);
r0PositionQ = Register::qntzr(_rx->r0Position, 0, 17, 0, 0, true);
}
RxParams(SonoDevice* device) : Register(BAR, OFFSET, device, LENGTH)
{
ADD_UNSIGNED_FIELD_LONG(rxActiveElementStep, RX_ACTIVE_ELEMENT_STEP_MASK );
ADD_UNSIGNED_FIELD_LONG(interceptPointFiringTime, INTERCEPT_POINT_FIRING_TIME_MASK);
ADD_UNSIGNED_FIELD_LONG(rxFocusPointNumber, RX_FOCUS_POINT_NUMBER_MASK );
ADD_UNSIGNED_FIELD_LONG(r0Position, R0_POSITION_MASK );
}
};
#undef RX_ACTIVE_ELEMENT_STEP_MASK
#undef INTERCEPT_POINT_FIRING_TIME_MASK
#undef RX_FOCUS_POINT_NUMBER_MASK
#undef R0_POSITION_MASK
#undef BAR
#undef OFFSET
#undef LENGTH
#endif // RXPARAMS_H

72
include/model/hardware/core/register/sram/registerDefinition/RxParamsDegree.h

@ -0,0 +1,72 @@
#ifndef RXPARAMSDEGREE_H
#define RXPARAMSDEGREE_H
#include "model/hardware/core/register/Register.h"
#include "model/hardware/core/register/RegUtils.h"
#include "SramStructures.h"
#undef BAR
#define THETA_COS_MASK 0x000000000000FFFF
#define THETA_SIN_MASK 0x00000000FFFF0000
#define PHI_COS_MASK 0x0000FFFF00000000
#define PHI_SIN_MASK 0xFFFF000000000000
#define BAR 1U
#define OFFSET 0x100018
#define LENGTH 11264U
class RxParamsDegree : public Register
{
private:
SramRx* _rx;
QVector<quint32> thetaCosQ;
QVector<quint32> thetaSinQ;
QVector<quint32> phiCosQ;
QVector<quint32> phiSinQ;
void prepareData(quint32 index) override
{
thetaCos->setValueLong(thetaCosQ[static_cast<qint32>(index)]);
thetaSin->setValueLong(thetaSinQ[static_cast<qint32>(index)]);
phiCos->setValueLong(phiCosQ[static_cast<qint32>(index)]) ;
phiSin->setValueLong(phiSinQ[static_cast<qint32>(index)]);
}
public:
Field* thetaCos;
Field* thetaSin;
Field* phiCos;
Field* phiSin;
void setRxParamsDegree (SramRx* rx)
{
_rx = rx;
thetaCosQ = Register::qntzr(_rx->thetaCos, 1, 16, 15, 0, true, true, true);
thetaSinQ = Register::qntzr(_rx->thetaSin, 1, 16, 15, 0, true, true, true);
phiCosQ = Register::qntzr(_rx->phiCos, 1, 16, 15, 0, true, true, true);
phiSinQ = Register::qntzr(_rx->phiSin, 1, 16, 15, 0, true, true, true);
}
RxParamsDegree(SonoDevice* device) : Register(BAR, OFFSET, device, LENGTH)
{
ADD_UNSIGNED_FIELD_LONG(thetaCos, THETA_COS_MASK);
ADD_UNSIGNED_FIELD_LONG(thetaSin, THETA_SIN_MASK);
ADD_UNSIGNED_FIELD_LONG(phiCos, PHI_COS_MASK );
ADD_UNSIGNED_FIELD_LONG(phiSin, PHI_SIN_MASK );
}
};
#undef THETA_COS_MASK
#undef THETA_SIN_MASK
#undef PHI_COS_MASK
#undef PHI_SIN_MASK
#undef BAR
#undef OFFSET
#undef LENGTH
#endif // RXPARAMSDEGREE_H

65
include/model/hardware/core/register/sram/registerDefinition/RxParamsDelay.h

@ -0,0 +1,65 @@
#ifndef RXPARAMSDELAY_H
#define RXPARAMSDELAY_H
#include "model/hardware/core/register/Register.h"
#include "model/hardware/core/register/RegUtils.h"
#include "SramStructures.h"
#undef BAR
#define RX_R0_ACTIVE_ELEMENT_NUMBER_MASK 0x00000000000000FF
#define TX_R0_MIN_DELAYQ_MASK 0x0000000001FFFF00
#define RX_R0_MIN_DELAYQ_MASK 0x000003FFFE000000
#define RX_R0_MAX_DELAYQ_MASK 0x07FFFC0000000000
#define BAR 1U
#define OFFSET 0x100028
#define LENGTH 11264U
class RxParamsDelay : public Register
{
private:
SramRx* _rx;
void prepareData(quint32 index) override
{
rxR0ActiveElementNumber->setValueLong(_rx->rxR0ActiveElementNumber[static_cast<qint32>(index)]);
txR0MinDelayQ->setValueLong(_rx->txR0MinDelayQ[static_cast<qint32>(index)]);
rxR0MinDelayQ->setValueLong(_rx->rxR0MinDelayQ[static_cast<qint32>(index)]) ;
rxR0MaxDelayQ->setValueLong(_rx->rxR0MaxDelayQ[static_cast<qint32>(index)]);
}
public:
Field* rxR0ActiveElementNumber;
Field* txR0MinDelayQ;
Field* rxR0MinDelayQ;
Field* rxR0MaxDelayQ;
void setRxParamsDelay (SramRx* rx)
{
_rx = rx;
}
RxParamsDelay(SonoDevice* device) : Register(BAR, OFFSET, device, LENGTH)
{
ADD_UNSIGNED_FIELD_LONG(rxR0ActiveElementNumber, RX_R0_ACTIVE_ELEMENT_NUMBER_MASK);
ADD_UNSIGNED_FIELD_LONG(txR0MinDelayQ, TX_R0_MIN_DELAYQ_MASK );
ADD_UNSIGNED_FIELD_LONG(rxR0MinDelayQ, RX_R0_MIN_DELAYQ_MASK );
ADD_UNSIGNED_FIELD_LONG(rxR0MaxDelayQ, RX_R0_MAX_DELAYQ_MASK );
}
};
#undef RX_R0_ACTIVE_ELEMENT_NUMBER_MASK
#undef TX_R0_MIN_DELAYQ_MASK
#undef RX_R0_MIN_DELAYQ_MASK
#undef RX_R0_MAX_DELAYQ_MASK
#undef BAR
#undef OFFSET
#undef LENGTH
#endif // RXPARAMSDELAY_H

71
include/model/hardware/core/register/sram/registerDefinition/RxParamsPos.h

@ -0,0 +1,71 @@
#ifndef RXPARAMSPOS_H
#define RXPARAMSPOS_H
#include "model/hardware/core/register/Register.h"
#include "model/hardware/core/register/RegUtils.h"
#include "SramStructures.h"
#undef BAR
#define RX_R0_CENTER_ACTIVE_ELEMENT_NUMBER_MASK 0x00000000000000FF
#define INTERCEPT_X_POS_MASK 0x0000000003FFFF00
#define INTERCEPT_Y_POS_MASK 0x00000FFFFC000000
#define INTERCEPT_Z_POS_MASK 0x1FFFF00000000000
#define BAR 1U
#define OFFSET 0x100020
#define LENGTH 11264U
class RxParamsPos : public Register
{
private:
SramRx* _rx;
QVector<quint32> interceptXPosQ;
QVector<quint32> interceptYPosQ;
QVector<quint32> interceptZPosQ;
void prepareData(quint32 index) override
{
rxR0CenterActiveElementNumber->setValueLong(_rx->rxR0CenterActiveElementNumber[static_cast<qint32>(index)] - 1);
interceptXPos->setValueLong(interceptXPosQ[static_cast<qint32>(index)]);
interceptYPos->setValueLong(interceptYPosQ[static_cast<qint32>(index)]) ;
interceptZPos->setValueLong(interceptZPosQ[static_cast<qint32>(index)]);
}
public:
Field* rxR0CenterActiveElementNumber;
Field* interceptXPos;
Field* interceptYPos;
Field* interceptZPos;
void setRxParamsPos (SramRx* rx)
{
_rx = rx;
interceptXPosQ = Register::qntzr(_rx->interceptXPos, 1, 18, 0, 0, true, true, true);
interceptYPosQ = Register::qntzr(_rx->interceptYPos, 1, 18, 0, 0, true, true, true);
interceptZPosQ = Register::qntzr(_rx->interceptZPos, 0, 17, 0, 0, true);
}
RxParamsPos(SonoDevice* device) : Register(BAR, OFFSET, device, LENGTH)
{
ADD_UNSIGNED_FIELD_LONG(rxR0CenterActiveElementNumber, RX_R0_CENTER_ACTIVE_ELEMENT_NUMBER_MASK);
ADD_UNSIGNED_FIELD_LONG(interceptXPos, INTERCEPT_X_POS_MASK );
ADD_UNSIGNED_FIELD_LONG(interceptYPos, INTERCEPT_Y_POS_MASK );
ADD_UNSIGNED_FIELD_LONG(interceptZPos, INTERCEPT_Z_POS_MASK );
}
};
#undef RX_R0_CENTER_ACTIVE_ELEMENT_NUMBER_MASK
#undef INTERCEPT_X_POS_MASK
#undef INTERCEPT_Y_POS_MASK
#undef INTERCEPT_Z_POS_MASK
#undef BAR
#undef OFFSET
#undef LENGTH
#endif // RXPARAMSPOS_H

52
include/model/hardware/core/register/sram/registerDefinition/SramStructures.h

@ -0,0 +1,52 @@
#ifndef SRAMSTRUCTURES_H
#define SRAMSTRUCTURES_H
#include "model/hardware/core/register/Register.h"
#include "model/hardware/core/register/RegUtils.h"
struct SramIndex {
QVector<quint32> shotPropertiesIndex;
QVector<quint32> receiverConfigurationIndex;
QVector<quint32> pulsePropertiesIndex;
QVector<bool> firstLineInFrame;
QVector<bool> lastLineInFrame;
QVector<quint32> dLineNum;
QVector<quint32> dEnsembleNum;
quint8 frameType;
};
struct SramRx {
QVector<float> rxActiveElementStep;
QVector<quint32> interceptPointFiringTime;
QVector<quint32> rxFocusPointNumber;
QVector<float> r0Position;
QVector<float> thetaCos;
QVector<float> thetaSin;
QVector<float> phiCos;
QVector<float> phiSin;
QVector<quint32> rxR0CenterActiveElementNumber;
QVector<float> interceptXPos;
QVector<float> interceptYPos;
QVector<float> interceptZPos;
QVector<quint32> rxR0ActiveElementNumber;
QVector<quint32> txR0MinDelayQ;
QVector<quint32> rxR0MinDelayQ;
QVector<quint32> rxR0MaxDelayQ;
};
struct SramTx {
QVector<float> txFocusXPos;
QVector<float> txFocusYPos;
QVector<float> txFocusZPos;
QVector<quint32> txStartActiveElementNumber;
QVector<quint32> txActiveElementNumber;
QVector<float> pulseInterval;
QVector<quint32> maxDelayQ;
};
#endif // SRAMSTRUCTURES_H

66
include/model/hardware/core/register/sram/registerDefinition/TxParams.h

@ -0,0 +1,66 @@
#ifndef TXPARAMS_H
#define TXPARAMS_H
#include "model/hardware/core/register/Register.h"
#include "model/hardware/core/register/RegUtils.h"
#include "SramStructures.h"
#undef BAR
#define TX_START_ACTIVE_ELEMENT_NUMBER_MASK 0x00000000000000FF
#define TX_ACTIVE_ELEMENT_NUMBER_MASK 0x000000000000FF00
#define PULSE_INTERVAL_MASK 0x00000003FFFF0000
#define MAX_DELAYQ_MASK 0x0007FFFC00000000
#define BAR 1U
#define OFFSET 0x100000
#define LENGTH 11264U
class TxParams : public Register
{
private:
SramTx* _tx;
void prepareData(quint32 index) override
{
txStartActiveElementNumber->setValueLong(_tx->txStartActiveElementNumber[static_cast<qint32>(index)] - 1);
txActiveElementNumber->setValueLong(_tx->txActiveElementNumber[static_cast<qint32>(index)]);
pulseInterval->setValueLong(static_cast<quint32>(_tx->pulseInterval[static_cast<qint32>(index)])) ;
maxDelayQ->setValueLong(_tx->maxDelayQ[static_cast<qint32>(index)]);
}
public:
Field* txStartActiveElementNumber;
Field* txActiveElementNumber;
Field* pulseInterval;
Field* maxDelayQ;
void setTxParams (SramTx* tx)
{
_tx = tx;
}
TxParams(SonoDevice* device) : Register(BAR, OFFSET, device, LENGTH)
{
ADD_UNSIGNED_FIELD_LONG(txStartActiveElementNumber, TX_START_ACTIVE_ELEMENT_NUMBER_MASK);
ADD_UNSIGNED_FIELD_LONG(txActiveElementNumber, TX_ACTIVE_ELEMENT_NUMBER_MASK );
ADD_UNSIGNED_FIELD_LONG(pulseInterval, PULSE_INTERVAL_MASK );
ADD_UNSIGNED_FIELD_LONG(maxDelayQ, MAX_DELAYQ_MASK );
}
};
#undef TX_START_ACTIVE_ELEMENT_NUMBER_MASK
#undef TX_ACTIVE_ELEMENT_NUMBER_MASK
#undef PULSE_INTERVAL_MASK
#undef MAX_DELAYQ_MASK
#undef BAR
#undef OFFSET
#undef LENGTH
#endif // TXPARAMS_H

65
include/model/hardware/core/register/sram/registerDefinition/TxParamsFocus.h

@ -0,0 +1,65 @@
#ifndef TXPARAMSFOCUS_H
#define TXPARAMSFOCUS_H
#include "model/hardware/core/register/Register.h"
#include "model/hardware/core/register/RegUtils.h"
#include "SramStructures.h"
#undef BAR
#define TX_FOCUS_X_POS_MASK 0x000000000003FFFF
#define TX_FOCUS_Y_POS_MASK 0x0000000FFFFC0000
#define TX_FOCUS_Z_POS_MASK 0x001FFFF000000000
#define BAR 1U
#define OFFSET 0x100008
#define LENGTH 11264U
class TxParamsFocus : public Register
{
private:
SramTx* _tx;
QVector<quint32> txFocusXPosQ;
QVector<quint32> txFocusYPosQ;
QVector<quint32> txFocusZPosQ;
void prepareData(quint32 index) override
{
txFocusXPos->setValueLong(txFocusXPosQ[static_cast<qint32>(index)]);
txFocusYPos->setValueLong(txFocusYPosQ[static_cast<qint32>(index)]);
txFocusZPos->setValueLong(txFocusZPosQ[static_cast<qint32>(index)]) ;
}
public:
Field* txFocusXPos;
Field* txFocusYPos;
Field* txFocusZPos;
void setTxParamsFocus (SramTx* tx)
{
_tx = tx;
txFocusXPosQ = Register::qntzr(_tx->txFocusXPos, 1, 18, 0, 0, true, true, true);
txFocusYPosQ = Register::qntzr(_tx->txFocusYPos, 1, 18, 0, 0, true, true, true);
txFocusZPosQ = Register::qntzr(_tx->txFocusZPos, 0, 17, 0, 0, true);
}
TxParamsFocus(SonoDevice* device) : Register(BAR, OFFSET, device, LENGTH)
{
ADD_UNSIGNED_FIELD_LONG(txFocusXPos, TX_FOCUS_X_POS_MASK);
ADD_UNSIGNED_FIELD_LONG(txFocusYPos, TX_FOCUS_Y_POS_MASK);
ADD_UNSIGNED_FIELD_LONG(txFocusZPos, TX_FOCUS_Z_POS_MASK);
}
};
#undef TX_FOCUS_X_POS_MASK
#undef TX_FOCUS_Y_POS_MASK
#undef TX_FOCUS_Z_POS_MASK
#undef BAR
#undef OFFSET
#undef LENGTH
#endif // TXPARAMSFOCUS_H

18
include/model/hardware/device/SonoConfig.h

@ -9,24 +9,24 @@
#define BUFFER_SIZE 4 * 1024 * 1024
#define COUNTER_REG 0x00002020
#define RAM_OFFSET_REG 0x00002024
#define XFER_OPT_REG 0x00002028
#define XFER_RATE_REG 0x0000202C
#define CONTROL_REG 0x00000800
//#define RAM_OFFSET_REG 0x00002024
//#define XFER_OPT_REG 0x00002028
//#define XFER_RATE_REG 0x0000202C
//#define CONTROL_REG 0x00000800
#define START_COMMAND 0x00000001
#define STOP_COMMAND 0x00000000
#define COUNTER_MASK 0x0000001F
#define RAM_OFFSET_MASK 0x00FFFFFF
//#define RAM_OFFSET_MASK 0x00FFFFFF
#define XFER_LEN_MASK 0x007FFFFF
//#define XFER_LEN_MASK 0x007FFFFF
#define AUTO_INC_COMMAND 0x40000000
//#define AUTO_INC_COMMAND 0x40000000
#define PERF_MODE_COMMAND 0x80000000
//#define PERF_MODE_COMMAND 0x80000000
#define XFER_RATE_MASK 0x003FFFFF
//#define XFER_RATE_MASK 0x003FFFFF
#endif //SONOADDRESS_H

13
include/model/hardware/device/SonoDevice.h

@ -18,18 +18,11 @@ public:
~SonoDevice();
void init();
void startTransfer(bool emulatorEn);
void stopTransfer();
void startDma();
void stopDma();
int getCounter();
void setRamOffsetAddress(qint32 offset);
void setTransferLength(qint32 length);
void setTransferRate(float rate);
void setOptions(bool performanceMode);
void setMode(bool dynamicMode);
void copy(int srcIndex, int dstIndex);
void show(int i);
void log(int i);
void fillRam();
//void show(int i);
const char* getBufferPtr(int index);
};

805
mainwindow.cpp

File diff suppressed because it is too large

51
mainwindow.h

@ -84,9 +84,6 @@ private:
Ui::MainWindow *ui;
TrxBoard _trx;
//TrxBoard* _trx;
//WaitDialog* _dial;
QSettings* _settings;
@ -110,28 +107,29 @@ private:
HealthStatus* _healStatus;
ReceiverConfiguration* _receiveConfig;
FpgaCodeVersion* _version;
StatusVec* _vec;
ScenGenHardwareOutput_t _scenParams;
void setReceiverConfiguration (void);
QList<quint32> _lineFilter;
QVector<float> _lineFilter;
void setLineFilter (void);
QList<quint32> _freq;
void setFreqLut (void);
QList<quint32> _stb;
QVector<quint32> _stb;
void setStbCoeff (void);
QList<quint32> _dTgc;
QVector<float> _dTgc;
void setDTgc (void);
QList<QList<quint32>> _aTgc;
void setATgc (void);
QList<QList<quint32>> _blendWeight;
void setBlendWeight (void);
QList<QList<quint32>> _lpf;
void setLpf (void);
void fpgaProgrammer(QString path);
@ -144,19 +142,14 @@ private:
void changeLabelTextColor(QLabel* label, QColor color);
RxBeamformerProperties* _rxBfPrp;
void setRxBeamformerPrp (void);
AfeProperties _afePrp;
void setAfeProperties (void);
//void setAfeProperties (void);
PulseProperties _pulsePrp;
void setPulseProperties (void);
ProbeElementPosition _prbElement;
void setProbeElement (void);
QList<QList<quint32>> _apodization;
void setApodization (void);
private slots:
@ -281,7 +274,7 @@ private slots:
// void on_btn_scenRead_clicked();
// void on_btn_getFpgaVersion_clicked();
void on_btn_getFpgaVersion_clicked();
// void on_btn_txTrig_clicked();
@ -328,24 +321,16 @@ private slots:
// bool checkTermalShutdown(quint8 value);
void on_btn_receiveConfig_clicked();
void on_btn_lineFilter_clicked();
void on_btn_freqLut_clicked();
void on_btn_blendWeight_clicked();
void on_btn_atgc_clicked();
void on_btn_dtgc_clicked();
void on_btn_lpf_clicked();
void on_btn_stbCoeff_clicked();
void on_btn_setAtgcMode_clicked();
void on_btn_trxRomWrite_clicked();
void on_btn_trxRomIdRead_clicked();
@ -370,20 +355,12 @@ 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();
void on_btn_scenStart_clicked();
void on_btn_scenParams_clicked();
signals:
// void updateBlockProgressValue(int percentage, QProgressBar* prg);
// void updateFpgaProgressValue(int percentage);

794
mainwindow.ui

File diff suppressed because it is too large

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

@ -4,217 +4,37 @@
#include <chrono>
#include <thread>
/*************************************************************************************************/
/**
* @brief Return board name
* @details The function will return the name of hardware based on hardware
* provided data
* @attention This value is a shadow value, to update it call @updateInfo()
* @return The name of board
*/
QString TrxBoard::getName()
{
return _name;
}
/*************************************************************************************************/
/**
* @brief Return board version
* @details The function will return the version of hardware based on hardware
* provided data
* @attention This value is a shadow value, to update it call @updateInfo()
* @return The version of board
*/
QString TrxBoard::getVersion()
{
return _version;
}
/*************************************************************************************************/
/**
* @brief PowerBoard::selfTest
* @return
*/
bool TrxBoard::selfTest()
{
return true;
}
/*************************************************************************************************/
/**
* @brief TrxBoard::updateInfo
* @return
*/
/*************************************************************************************************/
bool TrxBoard::updateInfo()
{
return true;
}
/*************************************************************************************************/
/**
* @brief TrxBoard::updateStatus
* @return
*/
/*************************************************************************************************/
bool TrxBoard::updateStatus()
{
return true;
}
///*************************************************************************************************/
///**
// * @brief TrxBoard::slaveProgramming
// */
///*************************************************************************************************/
//void fpgaProgrammer (QString path)
//{
// QFile file(path);
// if (!file.open(QFile::ReadOnly))
// {
// MESSAGE_BOX("Could not open bit file, aborting operation");
// return;
// }
// const auto actualSize = file.size();
// auto readSize = 0;
// while(readSize < actualSize)
// {
// QByteArray chunk = file.read(4);
// _slaveProgRegs.setSlaveProg(chunk);
// try
// {
// auto temp = _slaveProgRegs.getSlaveProgStatus();
// while ((temp & 0x01) == 0x01)
// {
// temp = _slaveProgRegs.getSlaveProgStatus();
// }
// if((temp & 0x08) == 0x08)
// {
// QString failedFpga = _slaveProgRegs.WhichFpgaFailed(temp);
// QString a = "init_fail flag raised, Failed FPGAs: " + failedFpga;
// throw(myexception(a.toUtf8().data()));
// }
// if((temp & 0x10) == 0x10)
// {
// throw(myexception("time_out flag raised"));
// }
// }
// catch (myexception e)
// {
// MESSAGE_BOX(e.what());
// emit updateFpgaProgressVisibility(false);
// file.close();
// return;
// }
// readSize += 4;
// auto percentage = (readSize * 100 / actualSize);
// emit updateFpgaProgressValue(percentage);
// }
// auto temp = _slaveProgRegs.getSlaveProgStatus();
// while(((temp >> 1) & 0x03) == 0)
// {
// temp = _slaveProgRegs.getSlaveProgStatus();
// }
// if((temp & 0x02) == 0x02)
// {
// MESSAGE_BOX("FPGA programming finished with success");
// }
// else if((temp & 0x04) == 0x04)
// {
// QString failedFpga = _slaveProgRegs.WhichFpgaFailed(temp);
// MESSAGE_BOX("FPGA programming failed, Failed FPGAs: " + failedFpga);
// }
// emit updateFpgaProgressVisibility(false);
// file.close();
//}
/*************************************************************************************************/
/**
* @brief TrxBoard::start
*/
/*************************************************************************************************/
void TrxBoard::start()
void TrxBoard::readData()
{
_device.stopTransfer();
while(_run)
{
auto cnt = _device.getCounter();
_swCounter = 0;
_hwCounter = _device.getCounter();
if(cnt == 0)
{
std::this_thread::sleep_for(std::chrono::milliseconds(3));
_hwCounter = 0;
continue;
}
else
if(cnt != _hwCounter)
{
_hwCounter++;
_device.setRamOffsetAddress(0);
_device.setTransferLength(128 * 1024);
_device.setOptions(false);
_device.setMode(true);
_device.setTransferRate(25.0f);
_device.copy(_hwCounter - 1, _swCounter);
_device.startTransfer(true);
_run = true;
//QtConcurrent::run(this, &TrxBoard::readData);
}
auto temp = QByteArray::fromRawData(_device.getBufferPtr(_swCounter), BUFFER_SIZE);
//packetEngine.newData(temp);
/*************************************************************************************************/
/**
* @brief TrxBoard::stop
*/
/*************************************************************************************************/
void TrxBoard::stop()
{
_device.stopTransfer();
_run = false;
_swCounter++;
if(_swCounter >= SW_BUFFER_NUM)
{
_swCounter = 0;
}
}
}
}
/*************************************************************************************************/
/**
* @brief TrxBoard::readData
*/
/*************************************************************************************************/
//void TrxBoard::readData()
//{
// while(_run)
// {
// auto cnt = _device.getCounter();
// if(cnt == 0)
// {
// std::this_thread::sleep_for(std::chrono::milliseconds(3));
// _hwCounter = 0;
// continue;
// }
// else
// if(cnt != _hwCounter)
// {
// _hwCounter++;
// _device.copy(_hwCounter - 1, _swCounter);
// auto temp = QByteArray::fromRawData(_device.getBufferPtr(_swCounter), BUFFER_SIZE);
// packetEngine.newData(temp);
// _swCounter++;
// if(_swCounter >= SW_BUFFER_NUM)
// {
// _swCounter = 0;
// }
// }
// }
//}
/*************************************************************************************************/
/*************************************************************************************************/
void TrxBoard::scenParamsFilling(TrxBoard::eScenParams cmd)
{
@ -244,6 +64,19 @@ void TrxBoard::setSwapVector()
<< 180 << 165 << 86 << 71 << 184 << 169 << 90 << 75 << 188 << 173 << 94 << 79;
}
//QList<quint32> TrxBoard::signedVector2unsignedList (QVector<qint32>& sgnVec)
//{
// _unsignedQntzrList.clear();
//// std::list<uint> _usgnList (sgnVec.begin(), sgnVec.end());
//// _unsignedQntzrList.fromStdList(_usgnList);
// foreach (auto i, sgnVec)
// {
// _unsignedQntzrList.push_back(static_cast<quint32>(i));
// }
// return _unsignedQntzrList;
//}
TrxBoard::TrxBoard() : _offsetSlave0(0), _offsetSlave1(0x400000), _offsetSlave2(0x800000)
{
@ -255,23 +88,40 @@ TrxBoard::TrxBoard() : _offsetSlave0(0), _offsetSlave1(0x400000), _offsetSlave2(
_scenPlayer = new ScenPalyer (&_device);
_bCtrlMngt = new BoardsCtrlMngt (&_device);
_bpiFlash = new BpiFlash (&_device);
//_dmaCtrl = new DmaCtrl (_device);
_emul = new Emulator (&_device);
_misc = new Misc (&_device);
_sram = new Sram (&_device);
_dsp = new Dsp (&_device);
_adc = new AdcVoltages();
_pg = new VoltagesPg();
_adc = new AdcVoltages;
_pg = new VoltagesPg;
scenParams = new ScenGenHardwareOutput;
setSwapVector();
_allow = false;
_run = true;
_device.init();
}
TrxBoard::HwRegister::HwRegister(){
configLut = new ReceiverConfiguration;
elementPosition = new ProbeElementPosition;
rxBeamformer = new RxBeamformerProperties;
pulse = new PulseProperties;
//afe = new AfeProperties;
}
/*************************************************************************************************/
/*************************************************************************************************/
TrxBoard::ScenGenHardwareOutput::ScenGenHardwareOutput()
{
hwRegister = new HwRegister;
indexParams = new SramIndex;
rxParams = new SramRx;
txParams = new SramTx;
}
TrxBoard::~TrxBoard()
{
delete _beamFormerSlave0;
@ -282,27 +132,144 @@ TrxBoard::~TrxBoard()
delete _scenPlayer;
delete _bCtrlMngt;
delete _bpiFlash;
//delete _dmaCtrl;
delete _emul;
delete _misc;
delete _sram;
delete _dsp;
delete _adc;
delete _pg;
delete scenParams;
}
TrxBoard::HwRegister::~HwRegister(){
delete configLut;
delete rxBeamformer;
delete elementPosition;
delete pulse;
//delete afe;
}
TrxBoard::ScenGenHardwareOutput::~ScenGenHardwareOutput()
{
delete hwRegister;
delete indexParams;
delete rxParams;
delete txParams;
}
void TrxBoard::scenProbeElementPosition(ProbeElementPosition *element)
void TrxBoard::setScenario(ScenGenHardwareOutput_t scenGenHw)
{
scenParams->focusTypeNumber = scenGenHw.focusTypeNumber;
scenParams->totalTxShotNumber = scenGenHw.totalTxShotNumber;
scenParams->rxBeamFormerNumber = scenGenHw.rxBeamFormerNumber;
scenParams->scenarioStartIndex = scenGenHw.hwRegister.scenarioStartIndex;
scenParams->scenarioEndIndex = scenGenHw.hwRegister.scenarioEndIndex;
//scenParams->hwRegister->lpfLut = scenGenHw.hwRegister.lpfLut;
//scenParams->hwRegister->atgcLut=scenGenHw.hwRegister.atgcLut;
//scenParams->hwRegister->apodization=scenGenHw.hwRegister.apodizationLut;
scenParams->hwRegister->blendWeight=scenGenHw.hwRegister.blendWeight;
scenParams->hwRegister->elementPosition->xPosition=scenGenHw.hwRegister.elementXPosition;
scenParams->hwRegister->elementPosition->yPosition=scenGenHw.hwRegister.elementYPosition;
scenParams->hwRegister->elementPosition->zPosition=scenGenHw.hwRegister.elementZPosition;
scenParams->hwRegister->freqLut=scenGenHw.hwRegister.freqLut;
scenParams->hwRegister->dtgcLut=scenGenHw.hwRegister.dtgcLut;
scenParams->hwRegister->pulseTypeNumber=scenGenHw.hwRegister.pulseTypeNumber;
scenParams->hwRegister->rxBeamFormerTypeNumber=scenGenHw.hwRegister.rxBeamFormerTypeNumber;
scenParams->hwRegister->receiverConfigTypeNumber=scenGenHw.hwRegister.receiverConfigTypeNumber;
scenParams->hwRegister->pulse->clear();
foreach (auto i, scenGenHw.hwRegister.pulseProps)
{
scenParams->hwRegister->pulse->halfPeriod.append(i.halfPeriod);
scenParams->hwRegister->pulse->startPhase.append(i.startPhase);
scenParams->hwRegister->pulse->halfCycleNo.append(i.halfCycleNo);
scenParams->hwRegister->pulse->pulseVoltSel.append(i.pulseVoltSel);
scenParams->hwRegister->pulse->dampingPulseWidth.append(i.dampingPulseWidth);
}
scenParams->hwRegister->rxBeamformer->clear();
foreach (auto j, scenGenHw.hwRegister.rxBeamFormerProps)
{
scenParams->hwRegister->rxBeamformer->lag.append(j.lag);
scenParams->hwRegister->rxBeamformer->mla.append(j.mla);
scenParams->hwRegister->rxBeamformer->apodization.append(j.apodizationSel);
}
scenParams->hwRegister->configLut->clear();
// foreach (auto k, scenGenHw.hwRegister.receiverConfigProps)
// {
// }
scenParams->indexParams->dLineNum=scenGenHw.indexParams.dLineNum;
//scenParams->indexParams->frameType=scenGenHw.indexParams.
scenParams->indexParams->dEnsembleNum=scenGenHw.indexParams.dEnsembleNum;
scenParams->indexParams->lastLineInFrame=scenGenHw.indexParams.lastLineInFrame;
scenParams->indexParams->firstLineInFrame=scenGenHw.indexParams.firstLineInFrame;
scenParams->indexParams->shotPropertiesIndex=scenGenHw.indexParams.shotPropertiesIndex;
scenParams->indexParams->pulsePropertiesIndex=scenGenHw.indexParams.pulsePropertiesIndex;
scenParams->indexParams->receiverConfigurationIndex=scenGenHw.indexParams.receiverConfigurationIndex;
scenParams->txParams->maxDelayQ=scenGenHw.txParams.maxDelayQ;
scenParams->txParams->txFocusXPos=scenGenHw.txParams.txFocusXPos;
scenParams->txParams->txFocusYPos=scenGenHw.txParams.txFocusYPos;
scenParams->txParams->txFocusZPos=scenGenHw.txParams.txFocusZPos;
scenParams->txParams->pulseInterval=scenGenHw.pulseInterval;
scenParams->txParams->txActiveElementNumber=scenGenHw.txParams.txActiveElementNumber;
scenParams->txParams->txStartActiveElementNumber=scenGenHw.txParams.txStartActiveElementNumber;
scenParams->rxParams->phiCos=scenGenHw.rxParams.phiCos;
scenParams->rxParams->phiSin=scenGenHw.rxParams.phiSin;
scenParams->rxParams->thetaCos=scenGenHw.rxParams.thetaCos;
scenParams->rxParams->thetaSin=scenGenHw.rxParams.thetaSin;
scenParams->rxParams->r0Position=scenGenHw.rxParams.r0Position;
scenParams->rxParams->interceptXPos=scenGenHw.rxParams.interceptXPos;
scenParams->rxParams->interceptYPos=scenGenHw.rxParams.interceptYPos;
scenParams->rxParams->interceptZPos=scenGenHw.rxParams.interceptZPos;
scenParams->rxParams->rxR0MaxDelayQ=scenGenHw.rxParams.rxR0MaxDelayQ;
scenParams->rxParams->rxR0MinDelayQ=scenGenHw.rxParams.rxR0MinDelayQ;
scenParams->rxParams->txR0MinDelayQ=scenGenHw.rxParams.txR0MinDelayQ;
scenParams->rxParams->rxFocusPointNumber=scenGenHw.rxParams.rxFocusPointNumber;
scenParams->rxParams->rxActiveElementStep=scenGenHw.rxParams.rxActiveElementStep;
scenParams->rxParams->rxR0ActiveElementNumber=scenGenHw.rxParams.rxR0ActiveElementNumber;
scenParams->rxParams->interceptPointFiringTime=scenGenHw.rxParams.interceptPointFiringTime;
scenParams->rxParams->rxR0CenterActiveElementNumber=scenGenHw.rxParams.rxR0CenterActiveElementNumber;
this->setScenario(scenParams);
}
void TrxBoard::setScenario (ScenGenHardwareOutput* scenParams)
{
///////////////////////////////// BeamFormer setting ///////////////////////////////
QList<QList<quint32>> elementPosition;
QList<quint32> x;
QList<quint32> y;
QList<quint32> z;
_unsignedQntzrVec.clear();
_unsignedQntzrVec = Register::qntzr(scenParams->hwRegister->elementPosition->xPosition, 1, 18, 0, 0, true, true, true);
QList<quint32> xPosQ = _unsignedQntzrVec.toList();
_unsignedQntzrVec.clear();
_unsignedQntzrVec = Register::qntzr(scenParams->hwRegister->elementPosition->yPosition, 1, 18, 0, 0, true, true, true);
QList<quint32> yPosQ = _unsignedQntzrVec.toList();
_unsignedQntzrVec.clear();
_unsignedQntzrVec = Register::qntzr(scenParams->hwRegister->elementPosition->zPosition, 0, 17, 0, 0, true, true, true);
QList<quint32> zPosQ = _unsignedQntzrVec.toList();
for (quint8 i=0; i<3; i++)
{
for (quint8 j=0; j<SLAVE_ELEMENT_SEGMENT; j++)
{
x.append(element->xPosition.at(_swapVec.at(j + i * SLAVE_ELEMENT_SEGMENT)));
y.append(element->yPosition.at(_swapVec.at(j + i * SLAVE_ELEMENT_SEGMENT)));
z.append(element->zPosition.at(_swapVec.at(j + i * SLAVE_ELEMENT_SEGMENT)));
x.append(xPosQ.at(_swapVec.at(j + i * SLAVE_ELEMENT_SEGMENT)));
y.append(yPosQ.at(_swapVec.at(j + i * SLAVE_ELEMENT_SEGMENT)));
z.append(zPosQ.at(_swapVec.at(j + i * SLAVE_ELEMENT_SEGMENT)));
}
elementPosition.append(x);
@ -322,64 +289,109 @@ void TrxBoard::scenProbeElementPosition(ProbeElementPosition *element)
elementPosition.clear();
}
scenParamsFilling(set);
}
void TrxBoard::scenRxBeamformerProperties(RxBeamformerProperties *rxBeamformer)
{
this->_beamFormerSlave0->rxBeamformerProperties(rxBeamformer);
this->_beamFormerSlave1->rxBeamformerProperties(rxBeamformer);
this->_beamFormerSlave2->rxBeamformerProperties(rxBeamformer);
scenParamsFilling(set);
}
void TrxBoard::scenApodizationLut(QList<QList<quint32> > &apodization)
{
this->_beamFormerSlave0->apodizationLut(apodization);
this->_beamFormerSlave1->apodizationLut(apodization);
this->_beamFormerSlave2->apodizationLut(apodization);
this->_beamFormerSlave0->rxBeamformerProperties(scenParams->hwRegister->rxBeamFormerTypeNumber ,scenParams->hwRegister->rxBeamformer);
this->_beamFormerSlave1->rxBeamformerProperties(scenParams->hwRegister->rxBeamFormerTypeNumber ,scenParams->hwRegister->rxBeamformer);
this->_beamFormerSlave2->rxBeamformerProperties(scenParams->hwRegister->rxBeamFormerTypeNumber ,scenParams->hwRegister->rxBeamformer);
scenParamsFilling(set);
}
void TrxBoard::scenPulseProperties(PulseProperties *pulse)
{
this->_beamFormerSlave0->pulseProperties(pulse);
this->_beamFormerSlave1->pulseProperties(pulse);
this->_beamFormerSlave2->pulseProperties(pulse);
this->_beamFormerSlave0->pulseProperties(scenParams->hwRegister->pulseTypeNumber ,scenParams->hwRegister->pulse);
this->_beamFormerSlave1->pulseProperties(scenParams->hwRegister->pulseTypeNumber ,scenParams->hwRegister->pulse);
this->_beamFormerSlave2->pulseProperties(scenParams->hwRegister->pulseTypeNumber ,scenParams->hwRegister->pulse);
scenParamsFilling(set);
}
void TrxBoard::scenAfeLut(AfeProperties *afe)
{
this->_beamFormerSlave0->afeLut(afe);
this->_beamFormerSlave1->afeLut(afe);
this->_beamFormerSlave2->afeLut(afe);
QList<QList<quint32>> apodizationQ;
foreach (auto vec, scenParams->hwRegister->apodization)
{
apodizationQ.push_back(vec.toList());
}
this->_beamFormerSlave0->apodizationLut(apodizationQ);
this->_beamFormerSlave1->apodizationLut(apodizationQ);
this->_beamFormerSlave2->apodizationLut(apodizationQ);
scenParamsFilling(set);
}
void TrxBoard::scenReceiverConfigurationLut(ReceiverConfiguration *configLut) const
{
this->_dsp->receiverConfigurationLut(configLut);
}
// this->_beamFormerSlave0->afeLut(scenParams->hwRegister->afe);
// this->_beamFormerSlave1->afeLut(scenParams->hwRegister->afe);
// this->_beamFormerSlave2->afeLut(scenParams->hwRegister->afe);
// scenParamsFilling(set);
void TrxBoard::scenLineFilterCoefficient(QList<quint32> &lineFilterLut) const
{
this->_dsp->lineFilterCoefficient(lineFilterLut);
}
///////////////////////////////// DSP setting ///////////////////////////////
this->_dsp->receiverConfigurationLut(scenParams->hwRegister->receiverConfigTypeNumber, scenParams->hwRegister->configLut);
_unsignedQntzrVec.clear();
_unsignedQntzrVec = Register::qntzr(scenParams->hwRegister->freqLut, 0, 24, 0, 0, true);
QList<quint32> freqLutQ = _unsignedQntzrVec.toList();
this->_dsp->frequencyLut(freqLutQ);
_unsignedQntzrVec.clear();
_unsignedQntzrVec = Register::qntzr(scenParams->hwRegister->dtgcLut, 0, 12, 8, 0, true, false);
QList<quint32> dtgcLutQ = _unsignedQntzrVec.toList();
this->_dsp->dtgcLut(dtgcLutQ);
QList<quint32> temp;
QList<QList<quint32>> blendWeightQ;
_unsignedQntzrVec.clear();
foreach (auto vec, scenParams->hwRegister->blendWeight)
{
temp.clear();
_unsignedQntzrVec = Register::qntzr(vec, 0, 9, 8, 0, true, false, true);
temp = _unsignedQntzrVec.toList();
blendWeightQ.push_back(temp);
}
this->_dsp->blendWeight(blendWeightQ);
QList<QList<quint32>> atgcLutQ;
foreach (auto vec, scenParams->hwRegister->atgcLut)
{
atgcLutQ.push_back(vec.toList());
}
this->_dsp->atgcLut(atgcLutQ);
QList<QList<quint32>> lpfLutQ;
foreach (auto vec, scenParams->hwRegister->lpfLut)
{
lpfLutQ.push_back(vec.toList());
}
this->_dsp->lpfLut(lpfLutQ);
///////////////////////////////// Sram setting ///////////////////////////////
this->_sram->setSramIndex(scenParams->totalTxShotNumber, scenParams->indexParams);
this->_sram->setSramTx(scenParams->focusTypeNumber, scenParams->txParams);
this->_sram->setSramRx(scenParams->rxBeamFormerNumber, scenParams->focusTypeNumber, scenParams->rxParams);
scenParamsFilling(set);
////////////////////////////// Scen Index setting ////////////////////////////
if (scenParams->scenarioEndIndex >= scenParams->scenarioStartIndex)
{
this->_scenPlayer->setStartIndex(scenParams->scenarioStartIndex);
this->_scenPlayer->setEndIndex(scenParams->scenarioEndIndex);
}
else
throw SonoException("The scenario end index must be greater than or equal to the scenario start index");
void TrxBoard::scenStbCoefficient(QList<quint32> &stbLut) const
{
this->_dsp->stbCoefficient(stbLut);
}
void TrxBoard::scenFrequencyLut(QList<quint32> &freqLut) const
void TrxBoard::setLineFilterCoefficient(QVector<float> &lineFilterLut)
{
this->_dsp->frequencyLut(freqLut);
_unsignedQntzrVec.clear();
_unsignedQntzrVec = Register::qntzr(lineFilterLut, 0, 9, 8, 0, true, false);
QList<quint32> lineFilterLutQ = _unsignedQntzrVec.toList();
this->_dsp->lineFilterCoefficient(lineFilterLutQ);
}
void TrxBoard::scenBlendWeight(QList<QList<quint32> > &blendWeight) const
void TrxBoard::setStbCoefficient(QVector<quint32> &stbLut)
{
this->_dsp->blendWeight(blendWeight);
QList<quint32> stbLutQ = stbLut.toList();
this->_dsp->stbCoefficient(stbLutQ);
}
void TrxBoard::setAtgcMode(eAtgcMode mode, quint16 value) const
@ -387,19 +399,22 @@ void TrxBoard::setAtgcMode(eAtgcMode mode, quint16 value) const
this->_dsp->atgcMode(mode, value);
}
void TrxBoard::scenDtgcLut(QList<quint32> &dtgcLut) const
void TrxBoard::setDtgcLut(QVector<float> &dtgcLut)
{
this->_dsp->dtgcLut(dtgcLut);
_unsignedQntzrVec.clear();
_unsignedQntzrVec = Register::qntzr(dtgcLut, 0, 12, 8, 0, true, false);
QList<quint32> dtgcLutQ = _unsignedQntzrVec.toList();
this->_dsp->dtgcLut(dtgcLutQ);
}
void TrxBoard::scenAtgcLut(QList<QList<quint32> > &atgcLut) const
void TrxBoard::setAfePwrdnMode(eAfePwrdnMode cmd) const
{
this->_dsp->atgcLut(atgcLut);
}
void TrxBoard::scenLpfLut(QList<QList<quint32> > &lpfLut) const
void TrxBoard::setAfeConfig(AfeProperties *afe) const
{
this->_dsp->lpfLut(lpfLut);
}
void TrxBoard::slaveFpgaProgram(QString path)
@ -431,16 +446,6 @@ void TrxBoard::setBeamFormerMode(eClkMode mode) const
this->_clkDistributer->clockMode(CLOCK_DIVISION, mode);
}
void TrxBoard::setScenPlayerIndex(quint32 startIdx, quint32 endIdx) const
{
if (endIdx >= startIdx)
{
this->_scenPlayer->setStartIndex(startIdx);
this->_scenPlayer->setEndIndex(endIdx);
}
else
throw SonoException("The end index must be greater than or equal to the start index");
}
void TrxBoard::scenPlayerStart(void) const
{
@ -455,6 +460,9 @@ void TrxBoard::scenPlayerStart(void) const
throw SonoException("Total scenario luts and sram parameters are not written compeletely");
}
this->_misc->setGtSendMode(BfMode);
this->_misc->setSyncMode(BfSyncMode);
this->_scenPlayer->control.command(true);
}
@ -469,6 +477,23 @@ void TrxBoard::scenPlayerStop(void) const
this->_scenPlayer->control.command(false);
}
void TrxBoard::emulatorInit(EmulatorProperties *config) const
{
this->_emul->setTransferMode(config->emulOption, config->emulMode, config->transferLength);
this->_emul->setRamOffsetAddress(config->ramBufAddress);
this->_emul->setTransferRate(config->transferRate);
}
void TrxBoard::emulatorEnable() const
{
this->_emul->setEmulatorEn();
}
void TrxBoard::emulatorDisable() const
{
this->_emul->setEmulatorDis();
}
quint32 TrxBoard::deviceId() const
{
@ -635,16 +660,11 @@ void TrxBoard::mcsProgram(QString path)
QFile mcsFile(path);
if (mcsFile.fileName().isEmpty())
{
//throw exception("No file is selected: " + mcsFile.errorString());
return;
}
throw SonoException("No file is selected");
if (!mcsFile.open(QIODevice::ReadOnly))
{
//throw exception("Couldn't open mcs file programming: " + mcsFile.errorString());
return;
}
throw SonoException("Couldn't open mcs file programming");
QByteArray mcsFileData = mcsFile.readAll();
this->_bpiFlash->writeMcs(mcsFileData);
@ -660,16 +680,10 @@ void TrxBoard::mcsVerify(QString path) const
QFile mcsFile(path);
if (mcsFile.fileName().isEmpty())
{
//throw exception("No file is selected: " + mcsFile.errorString());
return;
}
throw SonoException("No file is selected");
if (!mcsFile.open(QIODevice::WriteOnly))
{
//throw exception("Couldn't open mcs file to verify: " + mcsFile.errorString());
return;
}
throw SonoException("Couldn't open mcs file programming");
QTextStream save(&mcsFile);
@ -684,5 +698,14 @@ void TrxBoard::mcsVerify(QString path) const
mcsFile.close();
}
void TrxBoard::getTrxStatus(StatusVec *status) const
{
this->_misc->getStatusVector(status);
}
void TrxBoard::getFpgasCodeVersion(FpgaCodeVersion *version) const
{
this->_misc->getFpgaVersion(version);
}

86
src/model/hardware/core/register/Field.cpp

@ -10,6 +10,16 @@ Field::Field(quint32 mask, bool isSigned)
findZeroBasedMask();
}
Field::Field(quint64 maskLong)
{
_maskLong = maskLong;
findPositionLong();
findLengthLong();
findZeroBasedMaskLong();
}
void Field::findLength()
{
auto temp = _mask >> _position;
@ -19,9 +29,22 @@ void Field::findLength()
{
temp = temp >> 1;
_length++;
}
}
}
void Field::findLengthLong()
{
auto temp = _maskLong >> _position;
_length = 0;
while((temp & 0x1) == 0x1)
{
temp = temp >> 1;
_length++;
}
}
void Field::findPosition()
{
auto temp = _mask;
@ -30,18 +53,40 @@ void Field::findPosition()
{
temp = temp >> 1;
_position++;
}
}
}
void Field::findPositionLong()
{
auto temp = _maskLong;
_position = 0;
while((temp & 0x1) != 0x1)
{
temp = temp >> 1;
_position++;
}
}
void Field::findZeroBasedMask()
{
_zeroBasedMask = 0;
for(auto i = 0; i < _length; i++)
{
_zeroBasedMask |= (1 << i);
}
}
}
void Field::findZeroBasedMaskLong()
{
_zeroBasedMaskLong = 0;
for(auto i = 0; i < _length; i++)
{
_zeroBasedMaskLong |= (1 << i);
}
}
Field* Field::fromBitPosition(quint32 bitPosition)
{
auto mask = 1U << bitPosition;
@ -56,12 +101,18 @@ Field* Field::fromMaskSigned(quint32 mask)
Field* Field::fromMaskUnsigned(quint32 mask)
{
return new Field(mask, false);
return new Field(mask, false);
}
Field *Field::fromMaskUnsignedLong(quint64 mask)
{
return new Field(mask);
}
quint32 Field::getValue()
{
return _value;
return _value;
}
bool Field::isUpdated()
@ -80,7 +131,18 @@ void Field::setValue(quint32 value)
}
_value = value;
_isUpdated = true;
_isUpdated = true;
}
void Field::setValueLong(quint64 valueLong)
{
if(_valueLong == valueLong)
{
return;
}
_valueLong = valueLong;
_isUpdated = true;
}
void Field::updateValue(quint32 value)
@ -96,11 +158,21 @@ void Field::updateValue(quint32 value)
_value = value;
}
quint32 Field::getRegisterWriteValue()
{
auto value = _value & _zeroBasedMask;
value = value << _position;
value &= _mask;
return value;
return value;
}
quint64 Field::getRegisterWriteValueLong()
{
auto valueLong = _valueLong & _zeroBasedMaskLong;
valueLong = valueLong << _position;
valueLong &= _maskLong;
return valueLong;
}

144
src/model/hardware/core/register/Register.cpp

@ -51,9 +51,10 @@ bool Register::isUpdated()
return temp;
}
void Register::update() //update single register
{
auto value = 0;
quint32 value = 0;
for(auto i = 0; i < _fields.length(); i++)
{
value |= _fields[i]->getRegisterWriteValue();
@ -62,13 +63,30 @@ void Register::update() //update single register
_device->device.writeWord(_bar, _offset, value);
}
void Register::upadteArray() //update array register
void Register::updateLong() //update single register for Long Value
{
quint64 value = 0;
for(auto i = 0; i < _fields.length(); i++)
{
value |= _fields[i]->getRegisterWriteValueLong();
}
_device->device.writeLong(_bar, _offset, value);
}
void Register::updateArray(bool isVariable, quint8 arrayLength) //update array register
{
quint32 value;
if (isVariable)
_arrayLength = arrayLength;
for(quint32 i = 0; i < _arrayLength; i++)
{
prepareData(i);
auto value = 0;
value = 0;
for(auto j = 0; j < _fields.length(); j++)
{
value |= _fields[j]->getRegisterWriteValue();
@ -78,6 +96,25 @@ void Register::upadteArray() //update array register
}
}
void Register::updateArrayLong(quint8 interval, quint32 arrayLength) //update array register for Long Value
{
quint64 value;
for(quint32 i = 0; i < arrayLength; i++)
{
prepareData(i);
value = 0;
for(auto j = 0; j < _fields.length(); j++)
{
value |= _fields[j]->getRegisterWriteValueLong();
}
_device->device.writeLong(_bar, _offset + interval*i*8, value);
}
}
void Register::sync()
{
auto value = _device->device.readWord(_bar, _offset);
@ -102,3 +139,104 @@ void Register::syncArray()
}
}
QVector<quint32> Register::qntzr(QVector<float> &data, quint32 sign, quint32 wordlength, quint32 fractionalLength, float maxLevel, bool integerOutput, bool useRound, bool twosCmpl)
{
}
//QVector<qint32> Register::qntzr(QVector<float> &data,
// quint32 sign,
// quint32 wordLength,
// quint32 fractionalLength,
// float maxLevel,
// bool integerOutput,
// bool useRound,
// bool twosCmpl)
//{
// auto fullScale =
// powf(2.0f, wordLength - fractionalLength - sign) - 1 +
// (powf(2.0f, fractionalLength) - 1) /
// powf(2.0f, fractionalLength);
// if(maxLevel > 0)
// {
// if(fractionalLength > 0)
// {
// for(auto i = 0; i < data.length(); i++)
// {
// data[i] /= maxLevel;
// }
// }
// else
// {
// fullScale = maxLevel;
// }
// }
// for(auto i = 0; i < data.length(); i++)
// {
// if(data[i] > fullScale)
// {
// data[i] = fullScale;
// }
// if(data[i] < -fullScale)
// {
// data[i] = -fullScale;
// }
// }
// QVector<qint32> output;
// if(integerOutput)
// {
// for(auto i = 0; i < data.length(); i++)
// {
// qint32 out;
// if(useRound)
// {
// out =
// static_cast<qint32>(roundf(data[i] / fullScale *
// (powf(2.0f, wordLength - sign) - 1)));
// }
// else
// {
// out =
// static_cast<qint32>(floorf(data[i] / fullScale *
// (powf(2.0f, wordLength - sign) - 1)));
// }
// if(out < 0)
// {
// out += powf(2.0f, wordLength);
// }
// output.push_back(out);
// }
// }
// else
// {
// for(auto i = 0; i < data.length(); i++)
// {
// qint32 out;
// if(useRound)
// {
// out =
// static_cast<qint32>(roundf(data[i] / fullScale *
// (powf(2.0f, wordLength - sign) - 1)) /
// (fullScale * (powf(2.0f, wordLength - sign) - 1)));
// }
// else
// {
// out =
// static_cast<qint32>(floorf(data[i] / fullScale *
// (powf(2.0f, wordLength - sign) - 1)) /
// (fullScale * (powf(2.0f, wordLength - sign) - 1)));
// }
// output.push_back(out);
// }
// }
// return output;
//}

16
src/model/hardware/core/register/beamFormer/BeamFormer.cpp

@ -27,7 +27,7 @@ void BeamFormer::probeElementPosition(QList<QList<quint32>> &elementPosition) co
foreach (QList<quint32> temp, elementPosition)
{
this->_elementPosition->setElementPositionLut(temp);
this->_elementPosition->upadteArray();
this->_elementPosition->updateArray();
quint32 curOffset = this->_elementPosition->getCurrentOffset();
this->_elementPosition->changeOffset(curOffset + ELEMENT_POSITION_OFFSET);
}
@ -35,20 +35,20 @@ void BeamFormer::probeElementPosition(QList<QList<quint32>> &elementPosition) co
this->_elementPosition->changeOffset(baseOffset); // return to base offset address
}
void BeamFormer::rxBeamformerProperties(RxBeamformerProperties *rxBeamformer) const
void BeamFormer::rxBeamformerProperties(quint8& rxBeamFormerTypeNumber, RxBeamformerProperties *rxBeamformer) const
{
this->_rxBeamformer->setRxBfLut(rxBeamformer);
this->_rxBeamformer->upadteArray();
this->_rxBeamformer->updateArray(true, rxBeamFormerTypeNumber);
}
void BeamFormer::apodizationLut(QList<QList<quint32>> &apodization) const
void BeamFormer::apodizationLut(QList<QList<quint32>>& apodization) const
{
quint32 baseOffset = this->_apodization->getCurrentOffset();
foreach (QList<quint32> temp, apodization)
{
this->_apodization->setApodizationLut(temp);
this->_apodization->upadteArray();
this->_apodization->updateArray();
quint32 curOffset = this->_apodization->getCurrentOffset();
this->_apodization->changeOffset(curOffset + APODIZATION_OFFSET);
}
@ -56,16 +56,16 @@ void BeamFormer::apodizationLut(QList<QList<quint32>> &apodization) const
this->_apodization->changeOffset(baseOffset); // return to base offset address
}
void BeamFormer::pulseProperties(PulseProperties *pulse) const
void BeamFormer::pulseProperties(quint8& pulseTypeNumber, PulseProperties *pulse) const
{
this->_pulse->setPulseLut(pulse);
this->_pulse->upadteArray();
this->_pulse->updateArray(true, pulseTypeNumber);
}
void BeamFormer::afeLut(AfeProperties *afe) const
{
this->_afe->setAfeLut(afe);
this->_afe->upadteArray();
this->_afe->updateArray();
}
void BeamFormer::regValid(bool valid) const

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

@ -87,7 +87,7 @@ void BoardsCtrlMngt::eepromWrite(QByteArray& arr, quint32 addr, quint8 prbSel, T
template<class T3>
void BoardsCtrlMngt::setEepromWrite(EepromReq* _rom, T3* request)
{
request->dataIn->setValue(_rom->dataIn);
request->dataIn->setValue(static_cast<quint32>(_rom->dataIn));
request->address->setValue(_rom->address);
request->prbSel->setValue(_rom->probeSelect);
request->rdReq->setValue(0);
@ -126,7 +126,6 @@ QByteArray BoardsCtrlMngt::eepromRead(quint32 addr, quint32 length, quint8 prbSe
timerStop();
_rom->dataIn = 0;
_rom->address = addr+i;
_rom->probeSelect = prbSel;
setEepromRead<T4>(_rom, request);
@ -160,7 +159,6 @@ QByteArray BoardsCtrlMngt::eepromRead(quint32 addr, quint32 length, quint8 prbSe
template<class T6>
void BoardsCtrlMngt::setEepromRead(BoardsCtrlMngt::EepromReq *_rom, T6 *request)
{
request->dataIn->setValue(_rom->dataIn);
request->address->setValue(_rom->address);
request->prbSel->setValue(_rom->probeSelect);
request->rdReq->setValue(1);
@ -267,216 +265,6 @@ float BoardsCtrlMngt::getP5vValue() const
return p5vValue;
}
bool BoardsCtrlMngt::getHvErrFault() const
{
_sFaultStatus->sync();
auto fault=_sFaultStatus->hvError->getValue();
return (fault!=0);
}
bool BoardsCtrlMngt::getM5vFault() const
{
_sFaultStatus->sync();
auto fault=_sFaultStatus->m5v->getValue();
return (fault!=0);
}
bool BoardsCtrlMngt::getSup4dFault() const
{
_sFaultStatus->sync();
auto fault=_sFaultStatus->sup4d->getValue();
return (fault!=0);
}
bool BoardsCtrlMngt::getP5vFault() const
{
_sFaultStatus->sync();
auto fault=_sFaultStatus->p5v->getValue();
return (fault!=0);
}
bool BoardsCtrlMngt::getP12vFault() const
{
_sFaultStatus->sync();
auto fault=_sFaultStatus->p12v->getValue();
return (fault!=0);
}
bool BoardsCtrlMngt::getHvapFault() const
{
_sFaultStatus->sync();
auto fault=_sFaultStatus->hva->getValue();
return (fault!=0);
}
bool BoardsCtrlMngt::getCwdpFault() const
{
_sFaultStatus->sync();
auto fault=_sFaultStatus->cwd->getValue();
return (fault!=0);
}
bool BoardsCtrlMngt::getHvbpFault() const
{
_sFaultStatus->sync();
auto fault=_sFaultStatus->hvb->getValue();
return (fault!=0);
}
bool BoardsCtrlMngt::getCur24vFault() const
{
_sFaultStatus->sync();
auto fault=_sFaultStatus->cur24vOrHvMux->getValue();
return (fault!=0);
}
bool BoardsCtrlMngt::getP24vFault() const
{
_sFaultStatus->sync();
auto fault=_sFaultStatus->p24v->getValue();
return (fault!=0);
}
bool BoardsCtrlMngt::getOverHvErrFault() const
{
_sFaultStatus->sync();
auto fault=_sFaultStatus->overHvError->getValue();
return (fault!=0);
}
bool BoardsCtrlMngt::getOverM5vFault() const
{
_sFaultStatus->sync();
auto fault=_sFaultStatus->overM5v->getValue();
return (fault!=0);
}
bool BoardsCtrlMngt::getOverSup4dFault() const
{
_sFaultStatus->sync();
auto fault=_sFaultStatus->overSup4d->getValue();
return (fault!=0);
}
bool BoardsCtrlMngt::getOverP5vFault() const
{
_sFaultStatus->sync();
auto fault=_sFaultStatus->overP5v->getValue();
return (fault!=0);
}
bool BoardsCtrlMngt::getOverP12vFault() const
{
_sFaultStatus->sync();
auto fault=_sFaultStatus->overP12v->getValue();
return (fault!=0);
}
bool BoardsCtrlMngt::getOverHvapFault() const
{
_sFaultStatus->sync();
auto fault=_sFaultStatus->overHva->getValue();
return (fault!=0);
}
bool BoardsCtrlMngt::getOverCwdpFault() const
{
_sFaultStatus->sync();
auto fault=_sFaultStatus->overCwd->getValue();
return (fault!=0);
}
bool BoardsCtrlMngt::getOverHvbpFault() const
{
_sFaultStatus->sync();
auto fault=_sFaultStatus->overHvb->getValue();
return (fault!=0);
}
bool BoardsCtrlMngt::getOverCur24vFault() const
{
_sFaultStatus->sync();
auto fault=_sFaultStatus->overCur24vOrHvMux->getValue();
return (fault!=0);
}
bool BoardsCtrlMngt::getOverP24vFault() const
{
_sFaultStatus->sync();
auto fault=_sFaultStatus->overP24v->getValue();
return (fault!=0);
}
bool BoardsCtrlMngt::getUnderHvErrFault() const
{
_sFaultStatus->sync();
auto fault=_sFaultStatus->underHvError->getValue();
return (fault!=0);
}
bool BoardsCtrlMngt::getUnderM5vFault() const
{
_sFaultStatus->sync();
auto fault=_sFaultStatus->underM5v->getValue();
return (fault!=0);
}
bool BoardsCtrlMngt::getUnderSup4dFault() const
{
_sFaultStatus->sync();
auto fault=_sFaultStatus->underSup4d->getValue();
return (fault!=0);
}
bool BoardsCtrlMngt::getUnderP5vFault() const
{
_sFaultStatus->sync();
auto fault=_sFaultStatus->underP5v->getValue();
return (fault!=0);
}
bool BoardsCtrlMngt::getUnderP12vFault() const
{
_sFaultStatus->sync();
auto fault=_sFaultStatus->underP12v->getValue();
return (fault!=0);
}
bool BoardsCtrlMngt::getUnderHvapFault() const
{
_sFaultStatus->sync();
auto fault=_sFaultStatus->underHva->getValue();
return (fault!=0);
}
bool BoardsCtrlMngt::getUnderCwdpFault() const
{
_sFaultStatus->sync();
auto fault=_sFaultStatus->underCwd->getValue();
return (fault!=0);
}
bool BoardsCtrlMngt::getUnderHvbpFault() const
{
_sFaultStatus->sync();
auto fault=_sFaultStatus->underHvb->getValue();
return (fault!=0);
}
bool BoardsCtrlMngt::getUnderCur24vFault() const
{
_sFaultStatus->sync();
auto fault=_sFaultStatus->underCur24vOrHvMux->getValue();
return (fault!=0);
}
bool BoardsCtrlMngt::getUnderP24vFault() const
{
_sFaultStatus->sync();
auto fault=_sFaultStatus->underP24v->getValue();
return (fault!=0);
}
void BoardsCtrlMngt::setReadbackCmd(bool stopWr, bool avgValue, bool roundRobinConfig) const
{
@ -516,7 +304,7 @@ bool BoardsCtrlMngt::getI2cBusy() const
void BoardsCtrlMngt::getSupervisorI2cTimeout() const
{
timerShot(10);
timerShot(1);
while (getI2cBusy()) {
if (checkTimeout())
throw SonoException("Supervisor request timeout is happened due to the MPS I2C busy");
@ -526,7 +314,7 @@ void BoardsCtrlMngt::getSupervisorI2cTimeout() const
void BoardsCtrlMngt::getSupervisorI2cDone() const
{
timerShot(10);
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");
@ -643,10 +431,10 @@ void BoardsCtrlMngt::prbCtrlInit() const
{
this->_pCmd->HvMuxPwrEn->setValue(0);
this->_pCmd->MotorMuxPwrEn->setValue(0);
this->_pCmd->probeALowPwrEn->setValue(0);
this->_pCmd->probeBLowPwrEn->setValue(0);
this->_pCmd->probeCLowPwrEn->setValue(0);
this->_pCmd->probeDLowPwrEn->setValue(0);
this->_pCmd->probeALowPwrEn->setValue(1);
this->_pCmd->probeBLowPwrEn->setValue(1);
this->_pCmd->probeCLowPwrEn->setValue(1);
this->_pCmd->probeDLowPwrEn->setValue(1);
this->_pCmd->probeConnectorSelect->setValue(0);
this->_pCmd->update();
}
@ -732,6 +520,9 @@ void BoardsCtrlMngt::getSupervisorValue(SupervisorRbValue *sValue) const
setReadbackCmd(false, false, false);
getSupervisorI2cDone();
timerShot(72);
while (!checkTimeout());
getSupervisorI2cTimeout();
setReadbackCmd(false, true, false); // avgValueCommand_pulse
setReadbackCmd(false, false, false);
@ -757,38 +548,40 @@ void BoardsCtrlMngt::getSupervisorValue(SupervisorRbValue *sValue) const
void BoardsCtrlMngt::getMpsFault(MpsFaultStatus* faultStatus) const
{
faultStatus->m5v = getM5vFault();
faultStatus->p5v = getP5vFault();
faultStatus->cwdp = getCwdpFault();
faultStatus->hvap = getHvapFault();
faultStatus->hvbp = getHvbpFault();
faultStatus->p12v = getP12vFault();
faultStatus->p24v = getP24vFault();
faultStatus->sup4d = getSup4dFault();
faultStatus->curr24V = getCur24vFault();
faultStatus->hvError = getHvErrFault();
faultStatus->overM5v = getOverM5vFault();
faultStatus->overP5v = getOverP5vFault();
faultStatus->overCwdp = getOverCwdpFault();
faultStatus->overHvap = getOverHvapFault();
faultStatus->overHvbp = getOverHvbpFault();
faultStatus->overP12v = getOverP12vFault();
faultStatus->overP24v = getOverP24vFault();
faultStatus->overSup4d = getOverSup4dFault();
faultStatus->overCurr24V = getOverCur24vFault();
faultStatus->overHvError = getOverHvErrFault();
faultStatus->underM5v = getUnderM5vFault();
faultStatus->underP5v = getUnderP5vFault();
faultStatus->underCwdp = getUnderCwdpFault();
faultStatus->underHvap = getUnderHvapFault();
faultStatus->underHvbp = getUnderHvbpFault();
faultStatus->underP12v = getUnderP12vFault();
faultStatus->underP24v = getUnderP24vFault();
faultStatus->underSup4d = getUnderSup4dFault();
faultStatus->underCurr24V = getUnderCur24vFault();
faultStatus->underHvError = getUnderHvErrFault();
this->_sFaultStatus->sync();
faultStatus->m5v = ((this->_sFaultStatus->m5v->getValue()) != 0);
faultStatus->p5v = ((this->_sFaultStatus->p5v->getValue()) != 0);
faultStatus->cwdp = ((this->_sFaultStatus->cwd->getValue()) != 0);
faultStatus->hvap = ((this->_sFaultStatus->hva->getValue()) != 0);
faultStatus->hvbp = ((this->_sFaultStatus->hvb->getValue()) != 0);
faultStatus->p12v = ((this->_sFaultStatus->p12v->getValue()) != 0);
faultStatus->p24v = ((this->_sFaultStatus->p24v->getValue()) != 0);
faultStatus->sup4d = ((this->_sFaultStatus->sup4d->getValue()) != 0);
faultStatus->curr24V = ((this->_sFaultStatus->cur24v->getValue()) != 0);
faultStatus->hvError = ((this->_sFaultStatus->hvError->getValue()) != 0);
faultStatus->overM5v = ((this->_sFaultStatus->overM5v->getValue()) != 0);
faultStatus->overP5v = ((this->_sFaultStatus->overP5v->getValue()) != 0);
faultStatus->overCwdp = ((this->_sFaultStatus->overCwd->getValue()) != 0);
faultStatus->overHvap = ((this->_sFaultStatus->overHva->getValue()) != 0);
faultStatus->overHvbp = ((this->_sFaultStatus->overHvb->getValue()) != 0);
faultStatus->overP12v = ((this->_sFaultStatus->overP12v->getValue()) != 0);
faultStatus->overP24v = ((this->_sFaultStatus->overP24v->getValue()) != 0);
faultStatus->overSup4d = ((this->_sFaultStatus->overSup4d->getValue()) != 0);
faultStatus->overCurr24V = ((this->_sFaultStatus->overCur24v->getValue()) != 0);
faultStatus->overHvError = ((this->_sFaultStatus->overHvError->getValue()) != 0);
faultStatus->underM5v = ((this->_sFaultStatus->underM5v->getValue()) != 0);
faultStatus->underP5v = ((this->_sFaultStatus->underP5v->getValue()) != 0);
faultStatus->underCwdp = ((this->_sFaultStatus->underCwd->getValue()) != 0);
faultStatus->underHvap = ((this->_sFaultStatus->underHva->getValue()) != 0);
faultStatus->underHvbp = ((this->_sFaultStatus->underHvb->getValue()) != 0);
faultStatus->underP12v = ((this->_sFaultStatus->underP12v->getValue()) != 0);
faultStatus->underP24v = ((this->_sFaultStatus->underP24v->getValue()) != 0);
faultStatus->underSup4d = ((this->_sFaultStatus->underSup4d->getValue()) != 0);
faultStatus->underCurr24V = ((this->_sFaultStatus->underCur24v->getValue()) != 0);
faultStatus->underHvError = ((this->_sFaultStatus->underHvError->getValue()) != 0);
}
void BoardsCtrlMngt::mpsInit() const

2
src/model/hardware/core/register/bpiFlash/BpiFlash.cpp

@ -34,7 +34,7 @@ void BpiFlash::writeMcs(QByteArray &mcs) const
}
this->_mcsRdWr->mcsWrite(mcsList);
this->_mcsRdWr->upadteArray();
this->_mcsRdWr->updateArray();
}
void BpiFlash::readMcs(QList<quint32>* mcs) const

2
src/model/hardware/core/register/builtInTest/BuiltInTest.cpp

@ -49,7 +49,7 @@ BuiltInTest::~BuiltInTest()
void BuiltInTest::biteDacMemoryWrite(TxDacMemory* txDacMem) const
{
this->_dacMemory->setTxDacMemory(txDacMem);
this->_dacMemory->upadteArray();
this->_dacMemory->updateArray();
}
void BuiltInTest::biteDacEnable(quint8 biteInterval, bool cmd) const

18
src/model/hardware/core/register/dsp/Dsp.cpp

@ -28,28 +28,28 @@ Dsp::~Dsp()
}
void Dsp::receiverConfigurationLut(ReceiverConfiguration* configLut) const
void Dsp::receiverConfigurationLut(quint8& receiverConfigTypeNumber, ReceiverConfiguration* configLut) const
{
this->_configLut->setReceiverConfigurationLut(configLut);
this->_configLut->upadteArray();
this->_configLut->updateArray(true, receiverConfigTypeNumber);
}
void Dsp::lineFilterCoefficient(QList<quint32> &lineFilterLut) const
{
this->_lineFilterLut->setLineFilterLut(lineFilterLut);
this->_lineFilterLut->upadteArray();
this->_lineFilterLut->updateArray();
}
void Dsp::stbCoefficient(QList<quint32> &stbLut) const
{
this->_stbLut->setStbLut(stbLut);
this->_stbLut->upadteArray();
this->_stbLut->updateArray();
}
void Dsp::frequencyLut(QList<quint32> &fLut) const
{
this->_freqLut->setFreqLut(fLut);
this->_freqLut->upadteArray();
this->_freqLut->updateArray();
}
void Dsp::blendWeight(QList<QList<quint32> > &blendWeight) const
@ -59,7 +59,7 @@ void Dsp::blendWeight(QList<QList<quint32> > &blendWeight) const
foreach (QList<quint32> temp, blendWeight)
{
this->_blendWeight->setBlendWeight(temp);
this->_blendWeight->upadteArray();
this->_blendWeight->updateArray();
quint32 curOffset = this->_blendWeight->getCurrentOffset();
this->_blendWeight->changeOffset(curOffset + BLEND_WEIGHT_OFFSET);
}
@ -94,7 +94,7 @@ void Dsp::atgcMode(eAtgcMode mode, quint16 value) const
void Dsp::dtgcLut(QList<quint32> &dtgcLut) const
{
this->_dtgcLut->setDtgcLut(dtgcLut);
this->_dtgcLut->upadteArray();
this->_dtgcLut->updateArray();
}
void Dsp::atgcLut(QList<QList<quint32> > &atgcLut) const
@ -104,7 +104,7 @@ void Dsp::atgcLut(QList<QList<quint32> > &atgcLut) const
foreach (QList<quint32> temp, atgcLut)
{
this->_atgcLut->setAtgcLut(temp);
this->_atgcLut->upadteArray();
this->_atgcLut->updateArray();
quint32 curOffset = this->_atgcLut->getCurrentOffset();
this->_atgcLut->changeOffset(curOffset + ATGC_OFFSET);
}
@ -119,7 +119,7 @@ void Dsp::lpfLut(QList<QList<quint32>> &lpfLut) const
foreach (QList<quint32> temp, lpfLut)
{
this->_lpfLut->setLpfLut(temp);
this->_lpfLut->upadteArray();
this->_lpfLut->updateArray();
quint32 curOffset = this->_lpfLut->getCurrentOffset();
this->_lpfLut->changeOffset(curOffset + LPF_OFFSET); // return to base offset address
}

59
src/model/hardware/core/register/emulator/Emulator.cpp

@ -0,0 +1,59 @@
#include "model/hardware/core/register/emulator/Emulator.h"
Emulator::Emulator(SonoDevice *device)
{
_ramAddr = new RamAddress (device);
_transMode = new TransferMode (device);
_transRate = new TransferRate (device);
_emulAct = new EmulatorActivation (device);
}
Emulator::~Emulator()
{
delete _ramAddr;
delete _transMode;
delete _transRate;
delete _emulAct;
}
void Emulator::setEmulatorEn() const
{
this->_emulAct->emulatorActivation->setValue(EMULATOR_ENABLE);
this->_emulAct->update();
}
void Emulator::setEmulatorDis() const
{
this->_emulAct->emulatorActivation->setValue(EMULATOR_DISABLE);
this->_emulAct->update();
}
void Emulator::setTransferMode(bool option, bool mode, quint32 length) const
{
quint32 value(0);
value = option ? 1:0;
this->_transMode->emulOption->setValue(value);
value = mode ? 1:0;
this->_transMode->emulMode->setValue(value);
this->_transMode->transferLength->setValue(length);
this->_transMode->update();
}
void Emulator::setRamOffsetAddress(quint32 offset) const
{
this->_ramAddr->ramBufAddr->setValue(offset);
this->_ramAddr->update();
}
void Emulator::setTransferRate(float rate) const
{
quint32 realRate = static_cast<quint32>(rate * 1E5f);
this->_transRate->transferRate->setValue(realRate);
this->_transRate->update();
}

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

@ -38,12 +38,12 @@ void FpgaProgram::program(QByteArray& bitFileData, quint8 number)
quint32 progData(0);
QByteArray temp;
QProgressDialog progress;
progress.setMinimumSize(300,100);
progress.setLabelText("Please wait...");
progress.setWindowTitle("Slaves FPGA Programming");
progress.setRange(0,bitFileData.size());
progress.setModal(true);
// QProgressDialog progress;
// progress.setMinimumSize(300,100);
// progress.setLabelText("Please wait...");
// progress.setWindowTitle("Slaves FPGA Programming");
// progress.setRange(0,bitFileData.size());
// progress.setModal(true);
setSlaveFpgaNumber(number);
@ -78,9 +78,9 @@ void FpgaProgram::program(QByteArray& bitFileData, quint8 number)
}
progress.setValue(progByte);
if (progress.wasCanceled())
throw SonoException("Slaves fpga programming is canceled");
// progress.setValue(progByte);
// if (progress.wasCanceled())
// throw SonoException("Slaves fpga programming is canceled");
temp.clear();
progByte += sizeof (quint32);

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

@ -0,0 +1,74 @@
#include "model/hardware/core/register/misc/Misc.h"
Misc::Misc(SonoDevice *device) : _offsetMaster(0), _offsetSlave0(0x50002C), _offsetSlave1(0x90002C), _offsetSlave2(0xD0002C)
{
_s0Version = new FpgaVersion (device, _offsetSlave0);
_s1Version = new FpgaVersion (device, _offsetSlave1);
_s2Version = new FpgaVersion (device, _offsetSlave2);
_mVersion = new FpgaVersion (device, _offsetMaster);
_status = new StatusVector (device);
_gt = new GtSendMode (device);
_sync = new SyncMode (device);
}
Misc::~Misc()
{
delete _s0Version;
delete _s1Version;
delete _s2Version;
delete _mVersion;
delete _status;
delete _sync;
delete _gt;
}
template<class T>
quint32 Misc::getVersion(T *version) const
{
version->sync();
return version->synthesisTime->getValue();
}
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->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->scenSramErr = ((this->_status->scenSramErr->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->dmaCtrlTransferErr = ((this->_status->dmaCtrlTransferErr->getValue()) != 0);
status->emulDmaTransferErr = ((this->_status->emulDmaTransferErr->getValue()) != 0);
status->probeDisconnectErr = ((this->_status->probeDisconnectErr->getValue()) != 0);
status->probeDetChanInterrupt = ((this->_status->probeDetChanInterrupt->getValue()) != 0);
}
void Misc::setGtSendMode(eGtSendCtrl gtMode) const
{
this->_gt->gtSendModeCtrl->setValue(gtMode);
this->_gt->update();
}
void Misc::setSyncMode(eSyncCtrl syncMode) const
{
this->_sync->syncMode->setValue(syncMode);
this->_sync->update();
}
void Misc::getFpgaVersion(FpgaCodeVersion *version) const
{
version->masterCode = this->getVersion<FpgaVersion>(_mVersion);
version->slave0Code = this->getVersion<FpgaVersion>(_s0Version);
version->slave1Code = this->getVersion<FpgaVersion>(_s1Version);
version->slave2Code = this->getVersion<FpgaVersion>(_s2Version);
}

72
src/model/hardware/core/register/sram/Sram.cpp

@ -0,0 +1,72 @@
#include "model/hardware/core/register/sram/Sram.h"
Sram::Sram(SonoDevice *device)
{
_index = new Index (device);
_tx = new TxParams (device);
_txFocus = new TxParamsFocus (device);
_rx = new RxParams (device);
_rxDegree = new RxParamsDegree(device);
_rxPos = new RxParamsPos (device);
_rxDelay = new RxParamsDelay (device);
}
Sram::~Sram()
{
delete _index;
delete _tx;
delete _txFocus;
delete _rx;
delete _rxDegree;
delete _rxPos;
delete _rxDelay;
}
void Sram::setSramIndex(quint32 &totalTxShotNumber, SramIndex *index) const
{
this->_index->setIndex(index);
this->_index->updateArrayLong(INDEX_INTERVAL, totalTxShotNumber);
}
void Sram::setSramTx(quint32 &focusTypeNumber, SramTx *tx) const
{
this->_tx->setTxParams(tx);
this->_tx->updateArrayLong(TX_RX_INTERVAL, focusTypeNumber);
this->_txFocus->setTxParamsFocus(tx);
this->_txFocus->updateArrayLong(TX_RX_INTERVAL, focusTypeNumber);
}
void Sram::setSramRx(QVector<quint8> &rxBeamFormerNumber, quint32 &focusTypeNumber, SramRx *rx) const
{
this->_rx->setRxParams(rx);
this->_rx->updateArrayLong(TX_RX_INTERVAL, focusTypeNumber);
quint32 rxDegreeBaseOffset = this->_rxDegree->getCurrentOffset();
quint32 rxPosBaseOffset = this->_rxPos->getCurrentOffset();
quint32 rxDelayBaseOffset = this->_rxDelay->getCurrentOffset();
for (quint32 i=0; i < focusTypeNumber; i++)
{
this->_rxDegree->setRxParamsDegree(rx);
this->_rxDegree->updateArrayLong(INNER_RX_INTERVAL, rxBeamFormerNumber.at(static_cast<qint32>(i)));
quint32 rxDegreeCurOffset = this->_rxDegree->getCurrentOffset();
this->_rxDegree->changeOffset(rxDegreeCurOffset + TX_RX_INTERVAL);
this->_rxPos->setRxParamsPos(rx);
this->_rxPos->updateArrayLong(INNER_RX_INTERVAL, rxBeamFormerNumber.at(static_cast<qint32>(i)));
quint32 rxPosCurOffset = this->_rxPos->getCurrentOffset();
this->_rxPos->changeOffset(rxPosCurOffset + TX_RX_INTERVAL);
this->_rxDelay->setRxParamsDelay(rx);
this->_rxDelay->updateArrayLong(INNER_RX_INTERVAL, rxBeamFormerNumber.at(static_cast<qint32>(i)));
quint32 rxDelayCurOffset = this->_rxDelay->getCurrentOffset();
this->_rxDelay->changeOffset(rxDelayCurOffset + TX_RX_INTERVAL);
}
this->_rxDegree->changeOffset(rxDegreeBaseOffset); // return to base offset address
this->_rxPos->changeOffset(rxPosBaseOffset); // return to base offset address
this->_rxDelay->changeOffset(rxDelayBaseOffset ); // return to base offset address
}

130
src/model/hardware/device/SonoDevice.cpp

@ -26,17 +26,14 @@ void SonoDevice::init()
}
}
void SonoDevice::startTransfer(bool emulatorEn)
void SonoDevice::startDma()
{
if (emulatorEn)
device.writeWord(0, 0x8,3);//800, START_COMMAND);
else
device.writeWord(0, 0x8,1);//800, START_COMMAND);
device.writeWord(0, 0x8,1);
}
void SonoDevice::stopTransfer()
void SonoDevice::stopDma()
{
device.writeWord(0, 0x8,0);//00, STOP_COMMAND);
device.writeWord(0, 0x8,0);
}
int SonoDevice::getCounter()
@ -46,59 +43,6 @@ int SonoDevice::getCounter()
return temp & COUNTER_MASK;
}
void SonoDevice::setRamOffsetAddress(qint32 offset)
{
auto value = offset & RAM_OFFSET_MASK;
device.writeWord(BAR, RAM_OFFSET_REG, value);
}
void SonoDevice::setTransferLength(qint32 length)
{
auto temp = device.readWord(BAR, XFER_OPT_REG);
temp &= ~XFER_LEN_MASK;
temp |= (length & XFER_LEN_MASK);
device.writeWord(BAR, XFER_OPT_REG, temp);
}
void SonoDevice::setTransferRate(float rate)
{
auto value = static_cast<quint32>(rate * 1E5f) & XFER_RATE_MASK;
device.writeWord(BAR, XFER_RATE_REG, value);
}
void SonoDevice::setOptions(bool performanceMode)
{
auto temp = device.readWord(BAR, XFER_OPT_REG);
if(performanceMode)
{
temp &= ~PERF_MODE_COMMAND;
}
else
{
temp |= PERF_MODE_COMMAND;
}
device.writeWord(BAR, XFER_OPT_REG, temp);
}
void SonoDevice::setMode(bool dynamicMode)
{
auto temp = device.readWord(BAR, XFER_OPT_REG);
if(dynamicMode)
{
temp |= AUTO_INC_COMMAND;
}
else
{
temp &= ~AUTO_INC_COMMAND;
}
device.writeWord(BAR, XFER_OPT_REG, temp);
}
void SonoDevice::copy(int srcIndex, int dstIndex)
{
auto src = device.getBufferPtr(srcIndex);
@ -106,56 +50,22 @@ void SonoDevice::copy(int srcIndex, int dstIndex)
memcpy(dst, src, BUFFER_SIZE);
}
void SonoDevice::show(int i)
{
auto tmp = _buffers[i];
for(auto j = 0; j < 80; j += 8)
{
//quint32 res = 0;
//res = tmp[j] | (tmp[j + 1] << 8) | (tmp[j + 2] << 16) | (tmp[j + 3] << 24);
//qDebug() << QString::number(res, 16);
quint32 res = 0;
quint32 res2 = 0;
res = tmp[j] | (tmp[j + 1] << 8) | (tmp[j + 2] << 16) | (tmp[j + 3] << 24);
res2 = (tmp[j + 4] << 32) | (tmp[j + 5] << 40) | (tmp[j + 6] << 48) | (tmp[j + 7] << 56);
qDebug() << QString("%1 %2").arg(QString::number(res2,
10).rightJustified(
6,
'0')).arg(QString::number(res, 10));
}
}
void SonoDevice::fillRam()
{
// QFile file(
// "/home/hasis/Desktop/PCIE/pcie/PCIe_SGdma_Emulator/PCIe_SGdma_Emulator/_sram_frame_test_data/sram_frame_128x128K/sram_frame.bin");
// file.open(QIODevice::ReadOnly);
// auto temp = file.readAll();
// qDebug() << temp.length() << file.errorString();
auto temp=16777216;
auto din = 0;
qDebug() << "fillRam :: Start";
for(auto i = 0; i < temp; i += 8) // SRAM_DDR3_Counter
//for(auto i = 0; i < temp.length(); i++) // DDR3_Frame
{
device.writeLong(1, i, i / 8); // SRAM_DDR3_Counter
//device.writeByte(1, i, temp[i]); // DDR3_Frame
}
for(auto i = 0; i < temp; i += 8) // SRAM_DDR3_Counter
//for(auto i = 0; i < temp.length(); i++) // DDR3_Frame
{
din = device.readLong(1, i); // SRAM_DDR3_Counter
if (din != i / 8)
qDebug() << i;
//device.writeByte(1, i, temp[i]); // DDR3_Frame
}
qDebug() << "fillRam :: Done";
}
//void SonoDevice::show(int i)
//{
// auto tmp = _buffers[i];
// for(auto j = 0; j < 80; j += 8)
// {
// quint32 res = 0;
// quint32 res2 = 0;
// res = tmp[j] | (tmp[j + 1] << 8) | (tmp[j + 2] << 16) | (tmp[j + 3] << 24);
// res2 = (tmp[j + 4] << 32) | (tmp[j + 5] << 40) | (tmp[j + 6] << 48) | (tmp[j + 7] << 56);
// qDebug() << QString("%1 %2").arg(QString::number(res2,
// 10).rightJustified(
// 6,
// '0')).arg(QString::number(res, 10));
// }
//}
const char* SonoDevice::getBufferPtr(int index)
{

Loading…
Cancel
Save