From aec57d2627517c2dd6e6812cd456eb8cb79e1e30 Mon Sep 17 00:00:00 2001 From: Arash Aletayeb Date: Sun, 16 May 2021 15:20:59 +0200 Subject: [PATCH] sram add --- developHw.pro.user | 3 +- include/model/hardware/core/TrxBoard.h | 336 ++++++-- include/model/hardware/core/dmaCtrl/DmaCtrl.h | 30 - include/model/hardware/core/register/Field.h | 16 + .../model/hardware/core/register/RegUtils.h | 6 + .../model/hardware/core/register/Register.h | 18 +- .../core/register/beamFormer/BeamFormer.h | 4 +- .../beamFormer/registerDefinition/PulseLut.h | 12 +- .../registerDefinition/RxBeamformerLut.h | 10 +- .../register/boardsCtrlMngt/BoardsCtrlMngt.h | 33 - .../mps/SupervisorFaultStatus.h | 12 +- .../mps/SupervisorI2cStatus.h | 2 +- .../mps/SupervisorRbCurr24V.h | 2 +- .../model/hardware/core/register/dsp/Dsp.h | 2 +- .../ReceiverConfigurationLut.h | 30 +- .../core/register/emulator/Emulator.h | 32 + .../registerDefinition/EmulatorActivation.h | 31 + .../emulator/registerDefinition/RamAddress.h | 30 + .../registerDefinition/TransferMode.h | 38 + .../registerDefinition/TransferRate.h | 30 + .../model/hardware/core/register/misc/Misc.h | 84 ++ .../misc/registerDefinition/FpgaVersion.h | 30 + .../misc/registerDefinition/GtSendMode.h | 30 + .../misc/registerDefinition/StatusVector.h | 98 +++ .../misc/registerDefinition/SyncMode.h | 34 + .../model/hardware/core/register/sram/Sram.h | 37 + .../register/sram/registerDefinition/Index.h | 97 +++ .../sram/registerDefinition/RxParams.h | 69 ++ .../sram/registerDefinition/RxParamsDegree.h | 72 ++ .../sram/registerDefinition/RxParamsDelay.h | 65 ++ .../sram/registerDefinition/RxParamsPos.h | 71 ++ .../sram/registerDefinition/SramStructures.h | 52 ++ .../sram/registerDefinition/TxParams.h | 66 ++ .../sram/registerDefinition/TxParamsFocus.h | 65 ++ include/model/hardware/device/SonoConfig.h | 18 +- include/model/hardware/device/SonoDevice.h | 13 +- mainwindow.cpp | 805 +++++++++--------- mainwindow.h | 51 +- mainwindow.ui | 794 ++++++----------- src/model/hardware/core/TrxBoard.cpp | 597 ++++++------- src/model/hardware/core/register/Field.cpp | 86 +- src/model/hardware/core/register/Register.cpp | 144 +++- .../core/register/beamFormer/BeamFormer.cpp | 16 +- .../boardsCtrlMngt/BoardsCtrlMngt.cpp | 295 +------ .../core/register/bpiFlash/BpiFlash.cpp | 2 +- .../core/register/builtInTest/BuiltInTest.cpp | 2 +- src/model/hardware/core/register/dsp/Dsp.cpp | 18 +- .../core/register/emulator/Emulator.cpp | 59 ++ .../core/register/fpgaProgram/FpgaProgram.cpp | 18 +- .../hardware/core/register/misc/Misc.cpp | 74 ++ .../hardware/core/register/sram/Sram.cpp | 72 ++ src/model/hardware/device/SonoDevice.cpp | 130 +-- 52 files changed, 2926 insertions(+), 1815 deletions(-) delete mode 100644 include/model/hardware/core/dmaCtrl/DmaCtrl.h create mode 100644 include/model/hardware/core/register/emulator/Emulator.h create mode 100644 include/model/hardware/core/register/emulator/registerDefinition/EmulatorActivation.h create mode 100644 include/model/hardware/core/register/emulator/registerDefinition/RamAddress.h create mode 100644 include/model/hardware/core/register/emulator/registerDefinition/TransferMode.h create mode 100644 include/model/hardware/core/register/emulator/registerDefinition/TransferRate.h create mode 100644 include/model/hardware/core/register/misc/Misc.h create mode 100644 include/model/hardware/core/register/misc/registerDefinition/FpgaVersion.h create mode 100644 include/model/hardware/core/register/misc/registerDefinition/GtSendMode.h create mode 100644 include/model/hardware/core/register/misc/registerDefinition/StatusVector.h create mode 100644 include/model/hardware/core/register/misc/registerDefinition/SyncMode.h create mode 100644 include/model/hardware/core/register/sram/Sram.h create mode 100644 include/model/hardware/core/register/sram/registerDefinition/Index.h create mode 100644 include/model/hardware/core/register/sram/registerDefinition/RxParams.h create mode 100644 include/model/hardware/core/register/sram/registerDefinition/RxParamsDegree.h create mode 100644 include/model/hardware/core/register/sram/registerDefinition/RxParamsDelay.h create mode 100644 include/model/hardware/core/register/sram/registerDefinition/RxParamsPos.h create mode 100644 include/model/hardware/core/register/sram/registerDefinition/SramStructures.h create mode 100644 include/model/hardware/core/register/sram/registerDefinition/TxParams.h create mode 100644 include/model/hardware/core/register/sram/registerDefinition/TxParamsFocus.h create mode 100644 src/model/hardware/core/register/emulator/Emulator.cpp create mode 100644 src/model/hardware/core/register/misc/Misc.cpp create mode 100644 src/model/hardware/core/register/sram/Sram.cpp diff --git a/developHw.pro.user b/developHw.pro.user index 43666aa..e00b9b1 100644 --- a/developHw.pro.user +++ b/developHw.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -314,6 +314,7 @@ false false true + true /home/hasis/Desktop/Develop_HardwareTest/build-developHw-Desktop_Qt_5_13_1_GCC_64bit-Debug diff --git a/include/model/hardware/core/TrxBoard.h b/include/model/hardware/core/TrxBoard.h index 2feaeea..a145d21 100644 --- a/include/model/hardware/core/TrxBoard.h +++ b/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 xPosition; - QList yPosition; - QList 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 xPosition; + QVector yPosition; + QVector 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 shotPropertiesIndex; + QVector pulsePropertiesIndex; + QVector receiverConfigurationIndex; + QVector firstLineInFrame; + QVector lastLineInFrame; + QVector dLineNum; + QVector dEnsembleNum; +}; + +struct SramTx_t { + QVector txFocusXPos; + QVector txFocusYPos; + QVector txFocusZPos; + QVector txStartActiveElementNumber; + QVector txActiveElementNumber; + QVector minDelay; + QVector maxDelay; + QVector maxDelayQ; + QVector interceptXPos; + QVector interceptYPos; + QVector 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 rxR0CenterActiveElementNumber; + QVector rxR0ActiveElementNumber; + QVector rxActiveElementStep; + QVector interceptPointFiringTime; + QVector r0Position; + QVector rxFocusPointNumber; + QVector thetaCos; + QVector thetaSin; + QVector phiCos; + QVector phiSin; + QVector interceptXPos; + QVector interceptYPos; + QVector interceptZPos; + QVector txR0MinDelay; + QVector rxR0MinDelay; + QVector rxR0MaxDelay; + QVector txR0MinDelayQ; + QVector rxR0MinDelayQ; + QVector rxR0MaxDelayQ; + QVector rxR0StartActiveElementNumber; + QVector r0XPosition; + QVector r0YPosition; + QVector 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 dtgcLut; + QVector > blendWeight; + QVector elementXPosition; + QVector elementYPosition; + QVector elementZPosition; + QVector freqLut; + quint32 scenarioStartIndex; + quint32 scenarioEndIndex; + QList pulseProps; + quint8 pulseTypeNumber; + quint8 rxBeamFormerTypeNumber; + QList rxBeamFormerProps; + quint8 receiverConfigTypeNumber; + QList receiverConfigProps; + QList> lpfLut; + QList> atgcLut; + QList > apodizationLut; +}; + +struct ScenGenHardwareOutput_t +{ + quint32 focusTypeNumber; + quint32 totalTxShotNumber; + QVector rxBeamFormerNumber; + QVector pulseInterval; + + HwRegister_t hwRegister; + SramIndex_t indexParams; + SramRx_t rxParams; + SramTx_t txParams; +}; + + class TrxBoard { private: - QVector _swapVec; - QList* _mcsList; - const quint32 _offsetSlave0; - const quint32 _offsetSlave1; - const quint32 _offsetSlave2; + QVector _swapVec; + QVector _unsignedQntzrVec; + QList* _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> apodization; + ProbeElementPosition* elementPosition; + PulseProperties* pulse; + //AfeProperties* afe; + quint8 pulseTypeNumber; + quint8 rxBeamFormerTypeNumber; + + //////////////// DSP //////////////// + QVector freqLut; + QVector dtgcLut; + QList> lpfLut; + QList> atgcLut; + ReceiverConfiguration* configLut; + QVector> blendWeight; + quint8 receiverConfigTypeNumber; + HwRegister(); + ~HwRegister(); + }; + struct ScenGenHardwareOutput { + quint32 focusTypeNumber; + quint32 totalTxShotNumber; + QVector 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 signedVector2unsignedList (QVector& sgnVec); public: TrxBoard(); ~TrxBoard(); - ///////////////////////////////// BeamFormer API /////////////////////////////// - void scenRxBeamformerProperties (RxBeamformerProperties* rxBeamformer); - void scenProbeElementPosition (ProbeElementPosition* element); - void scenApodizationLut (QList>& apodization); - void scenPulseProperties (PulseProperties* pulse); - void scenAfeLut (AfeProperties* afe); - - //////////////////////////////////// DSP API /////////////////////////////////// - void scenReceiverConfigurationLut (ReceiverConfiguration* configLut) const; - void scenLineFilterCoefficient (QList& lineFilterLut) const; - void scenBlendWeight (QList>& blendWeight) const; - void scenAtgcLut (QList>& atgcLut) const; - void scenStbCoefficient (QList& stbLut) const; + ////////////////////////////////// Scenario API /////////////////////////////// + void setLineFilterCoefficient (QVector& lineFilterLut); + void setStbCoefficient (QVector& stbLut); + void setDtgcLut (QVector& dtgcLut); + void setAtgcMode (eAtgcMode mode, quint16 value) const; - void scenFrequencyLut (QList& freqLut) const; - void scenLpfLut (QList>& lpfLut) const; - void scenDtgcLut (QList& 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& 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 diff --git a/include/model/hardware/core/dmaCtrl/DmaCtrl.h b/include/model/hardware/core/dmaCtrl/DmaCtrl.h deleted file mode 100644 index 28db643..0000000 --- a/include/model/hardware/core/dmaCtrl/DmaCtrl.h +++ /dev/null @@ -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 diff --git a/include/model/hardware/core/register/Field.h b/include/model/hardware/core/register/Field.h index 8d94966..c5d4a7a 100644 --- a/include/model/hardware/core/register/Field.h +++ b/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 diff --git a/include/model/hardware/core/register/RegUtils.h b/include/model/hardware/core/register/RegUtils.h index dd6c353..bf233ac 100644 --- a/include/model/hardware/core/register/RegUtils.h +++ b/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); \ diff --git a/include/model/hardware/core/register/Register.h b/include/model/hardware/core/register/Register.h index 9cb0e30..cbb965f 100644 --- a/include/model/hardware/core/register/Register.h +++ b/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 +#include 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 qntzr(QVector &data, + quint32 sign, + quint32 wordlength, + quint32 fractionalLength, + float maxLevel, + bool integerOutput, + bool useRound = true, + bool twosCmpl = false); + }; + #endif //rEGISTER_H diff --git a/include/model/hardware/core/register/beamFormer/BeamFormer.h b/include/model/hardware/core/register/beamFormer/BeamFormer.h index de48675..c647e70 100644 --- a/include/model/hardware/core/register/beamFormer/BeamFormer.h +++ b/include/model/hardware/core/register/beamFormer/BeamFormer.h @@ -26,9 +26,9 @@ public: ~BeamFormer(); void probeElementPosition (QList>& elementPosition) const; - void rxBeamformerProperties (RxBeamformerProperties* rxBeamformer) const; + void rxBeamformerProperties (quint8& rxBeamFormerTypeNumber, RxBeamformerProperties* rxBeamformer) const; void apodizationLut (QList>& apodization) const; - void pulseProperties (PulseProperties* pulse) const; + void pulseProperties (quint8& pulseTypeNumber, PulseProperties* pulse) const; void afeLut (AfeProperties* afe) const; void regValid (bool valid) const; }; diff --git a/include/model/hardware/core/register/beamFormer/registerDefinition/PulseLut.h b/include/model/hardware/core/register/beamFormer/registerDefinition/PulseLut.h index 45d31b8..881bde9 100644 --- a/include/model/hardware/core/register/beamFormer/registerDefinition/PulseLut.h +++ b/include/model/hardware/core/register/beamFormer/registerDefinition/PulseLut.h @@ -24,6 +24,14 @@ struct PulseProperties QList startPhase; QList pulseVoltSel; QList 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(index))); + halfPeriodPrp->setValue(_pulseLut->halfPeriod.at(static_cast(index)) - 1); - halfCycleNoPrp->setValue(_pulseLut->halfCycleNo.at(static_cast(index))); + halfCycleNoPrp->setValue(_pulseLut->halfCycleNo.at(static_cast(index)) - 1); value = _pulseLut->startPhase.at(static_cast(index)) ? 1 : 0; startPhasePrp->setValue(value); diff --git a/include/model/hardware/core/register/beamFormer/registerDefinition/RxBeamformerLut.h b/include/model/hardware/core/register/beamFormer/registerDefinition/RxBeamformerLut.h index 1610f6b..868aeec 100644 --- a/include/model/hardware/core/register/beamFormer/registerDefinition/RxBeamformerLut.h +++ b/include/model/hardware/core/register/beamFormer/registerDefinition/RxBeamformerLut.h @@ -19,6 +19,12 @@ struct RxBeamformerProperties QList lag; QList apodization; QList 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(index))); - apodizationSelPrp->setValue(_rxBfLut->apodization.at(static_cast(index))); + apodizationSelPrp->setValue(_rxBfLut->apodization.at(static_cast(index)) - 1); - mlaPrp->setValue(_rxBfLut->mla.at(static_cast(index))); + mlaPrp->setValue(_rxBfLut->mla.at(static_cast(index)) - 1); } public: diff --git a/include/model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.h b/include/model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.h index dde1759..29c51d8 100644 --- a/include/model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.h +++ b/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; diff --git a/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorFaultStatus.h b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorFaultStatus.h index 292730b..af1e087 100644 --- a/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorFaultStatus.h +++ b/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); } }; diff --git a/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorI2cStatus.h b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorI2cStatus.h index accbf75..68efb35 100644 --- a/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorI2cStatus.h +++ b/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 { diff --git a/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbCurr24V.h b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbCurr24V.h index cb3556f..230bee6 100644 --- a/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbCurr24V.h +++ b/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 diff --git a/include/model/hardware/core/register/dsp/Dsp.h b/include/model/hardware/core/register/dsp/Dsp.h index 6a5a6a7..a18a06c 100644 --- a/include/model/hardware/core/register/dsp/Dsp.h +++ b/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& lineFilterLut) const; void stbCoefficient (QList& stbLut) const; void frequencyLut (QList& freqLut) const; diff --git a/include/model/hardware/core/register/dsp/registerDefinition/ReceiverConfigurationLut.h b/include/model/hardware/core/register/dsp/registerDefinition/ReceiverConfigurationLut.h index 70fefc7..ab6f1aa 100644 --- a/include/model/hardware/core/register/dsp/registerDefinition/ReceiverConfigurationLut.h +++ b/include/model/hardware/core/register/dsp/registerDefinition/ReceiverConfigurationLut.h @@ -43,6 +43,24 @@ struct ReceiverConfiguration QList ddcEn; QList wmfEn; QList 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(index))); + mlaPrp->setValue(_configLut->mla.at(static_cast(index)) - 1); - lineModePrp->setValue(_configLut->lineMode.at(static_cast(index))); + lineModePrp->setValue(_configLut->lineMode.at(static_cast(index)) - 1); - atgcSelPrp->setValue(_configLut->aTgcSel.at(static_cast(index))); + atgcSelPrp->setValue(_configLut->aTgcSel.at(static_cast(index)) - 1); value = _configLut->stbEn.at(static_cast(index)) ? 1 : 0; stbEnPrp->setValue(value); @@ -71,14 +89,14 @@ private: value = _configLut->dcCancelerEn.at(static_cast(index)) ? 1 : 0; dcCancelEnPrp->setValue(value); - ncoFreqSelPrp->setValue(_configLut->ncoFreqSel.at(static_cast(index))); + ncoFreqSelPrp->setValue(_configLut->ncoFreqSel.at(static_cast(index)) - 1); - lpfSelPrp->setValue(_configLut->lpfSel.at(static_cast(index))); + lpfSelPrp->setValue(_configLut->lpfSel.at(static_cast(index)) - 1); value = _configLut->absEn.at(static_cast(index)) ? 1 : 0; absEnPrp->setValue(value); - focusNoPrp->setValue(_configLut->focusNo.at(static_cast(index))); + focusNoPrp->setValue(_configLut->focusNo.at(static_cast(index)) - 1); value = _configLut->lineFilterEn.at(static_cast(index)) ? 1 : 0; lineFilterEnPrp->setValue(value); diff --git a/include/model/hardware/core/register/emulator/Emulator.h b/include/model/hardware/core/register/emulator/Emulator.h new file mode 100644 index 0000000..98aad2a --- /dev/null +++ b/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 diff --git a/include/model/hardware/core/register/emulator/registerDefinition/EmulatorActivation.h b/include/model/hardware/core/register/emulator/registerDefinition/EmulatorActivation.h new file mode 100644 index 0000000..3993e35 --- /dev/null +++ b/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 diff --git a/include/model/hardware/core/register/emulator/registerDefinition/RamAddress.h b/include/model/hardware/core/register/emulator/registerDefinition/RamAddress.h new file mode 100644 index 0000000..9d6c6ea --- /dev/null +++ b/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 diff --git a/include/model/hardware/core/register/emulator/registerDefinition/TransferMode.h b/include/model/hardware/core/register/emulator/registerDefinition/TransferMode.h new file mode 100644 index 0000000..bc4a4b0 --- /dev/null +++ b/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 diff --git a/include/model/hardware/core/register/emulator/registerDefinition/TransferRate.h b/include/model/hardware/core/register/emulator/registerDefinition/TransferRate.h new file mode 100644 index 0000000..d839e2c --- /dev/null +++ b/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 diff --git a/include/model/hardware/core/register/misc/Misc.h b/include/model/hardware/core/register/misc/Misc.h new file mode 100644 index 0000000..318d663 --- /dev/null +++ b/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 + 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 diff --git a/include/model/hardware/core/register/misc/registerDefinition/FpgaVersion.h b/include/model/hardware/core/register/misc/registerDefinition/FpgaVersion.h new file mode 100644 index 0000000..4b8b1f8 --- /dev/null +++ b/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 diff --git a/include/model/hardware/core/register/misc/registerDefinition/GtSendMode.h b/include/model/hardware/core/register/misc/registerDefinition/GtSendMode.h new file mode 100644 index 0000000..548b15d --- /dev/null +++ b/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 diff --git a/include/model/hardware/core/register/misc/registerDefinition/StatusVector.h b/include/model/hardware/core/register/misc/registerDefinition/StatusVector.h new file mode 100644 index 0000000..d8f453e --- /dev/null +++ b/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 diff --git a/include/model/hardware/core/register/misc/registerDefinition/SyncMode.h b/include/model/hardware/core/register/misc/registerDefinition/SyncMode.h new file mode 100644 index 0000000..03818f6 --- /dev/null +++ b/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 diff --git a/include/model/hardware/core/register/sram/Sram.h b/include/model/hardware/core/register/sram/Sram.h new file mode 100644 index 0000000..9f2a355 --- /dev/null +++ b/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& rxBeamFormerNumber, quint32& focusTypeNumber, SramRx* rx) const; + +}; + +#endif // SRAM_H diff --git a/include/model/hardware/core/register/sram/registerDefinition/Index.h b/include/model/hardware/core/register/sram/registerDefinition/Index.h new file mode 100644 index 0000000..70f71c4 --- /dev/null +++ b/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(index)] - 1) * focusPropertiesSize; + shotPropertiesIndex->setValueLong(offsetAddr); + + receiverConfigurationIndex->setValueLong(_index->receiverConfigurationIndex[static_cast(index)] - 1); + + pulsePropertiesIndex->setValueLong(_index->pulsePropertiesIndex[static_cast(index)] - 1); + + value = _index->firstLineInFrame[static_cast(index)] ? 1 : 0; + firstLineInFrame->setValueLong(value); + + value = _index->lastLineInFrame[static_cast(index)] ? 1 : 0; + lastLineInFrame->setValueLong(value); + + dLineNum->setValueLong(_index->dLineNum[static_cast(index)] - 1); + + dEnsembleNum->setValueLong(_index->dEnsembleNum[static_cast(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 diff --git a/include/model/hardware/core/register/sram/registerDefinition/RxParams.h b/include/model/hardware/core/register/sram/registerDefinition/RxParams.h new file mode 100644 index 0000000..6721792 --- /dev/null +++ b/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 rxActiveElementStepQ; + QVector r0PositionQ; + + void prepareData(quint32 index) override + { + rxActiveElementStep->setValueLong(rxActiveElementStepQ[static_cast(index)]); + + interceptPointFiringTime->setValueLong(_rx->interceptPointFiringTime[static_cast(index)]); + + rxFocusPointNumber->setValueLong(_rx->rxFocusPointNumber[static_cast(index)]) ; + + r0Position->setValueLong(r0PositionQ[static_cast(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 diff --git a/include/model/hardware/core/register/sram/registerDefinition/RxParamsDegree.h b/include/model/hardware/core/register/sram/registerDefinition/RxParamsDegree.h new file mode 100644 index 0000000..7e05b82 --- /dev/null +++ b/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 thetaCosQ; + QVector thetaSinQ; + QVector phiCosQ; + QVector phiSinQ; + + void prepareData(quint32 index) override + { + thetaCos->setValueLong(thetaCosQ[static_cast(index)]); + + thetaSin->setValueLong(thetaSinQ[static_cast(index)]); + + phiCos->setValueLong(phiCosQ[static_cast(index)]) ; + + phiSin->setValueLong(phiSinQ[static_cast(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 diff --git a/include/model/hardware/core/register/sram/registerDefinition/RxParamsDelay.h b/include/model/hardware/core/register/sram/registerDefinition/RxParamsDelay.h new file mode 100644 index 0000000..b3e188b --- /dev/null +++ b/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(index)]); + + txR0MinDelayQ->setValueLong(_rx->txR0MinDelayQ[static_cast(index)]); + + rxR0MinDelayQ->setValueLong(_rx->rxR0MinDelayQ[static_cast(index)]) ; + + rxR0MaxDelayQ->setValueLong(_rx->rxR0MaxDelayQ[static_cast(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 diff --git a/include/model/hardware/core/register/sram/registerDefinition/RxParamsPos.h b/include/model/hardware/core/register/sram/registerDefinition/RxParamsPos.h new file mode 100644 index 0000000..8ab8ad1 --- /dev/null +++ b/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 interceptXPosQ; + QVector interceptYPosQ; + QVector interceptZPosQ; + + void prepareData(quint32 index) override + { + rxR0CenterActiveElementNumber->setValueLong(_rx->rxR0CenterActiveElementNumber[static_cast(index)] - 1); + + interceptXPos->setValueLong(interceptXPosQ[static_cast(index)]); + + interceptYPos->setValueLong(interceptYPosQ[static_cast(index)]) ; + + interceptZPos->setValueLong(interceptZPosQ[static_cast(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 diff --git a/include/model/hardware/core/register/sram/registerDefinition/SramStructures.h b/include/model/hardware/core/register/sram/registerDefinition/SramStructures.h new file mode 100644 index 0000000..b6b431e --- /dev/null +++ b/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 shotPropertiesIndex; + QVector receiverConfigurationIndex; + QVector pulsePropertiesIndex; + QVector firstLineInFrame; + QVector lastLineInFrame; + QVector dLineNum; + QVector dEnsembleNum; + quint8 frameType; +}; + + +struct SramRx { + QVector rxActiveElementStep; + QVector interceptPointFiringTime; + QVector rxFocusPointNumber; + QVector r0Position; + + QVector thetaCos; + QVector thetaSin; + QVector phiCos; + QVector phiSin; + + QVector rxR0CenterActiveElementNumber; + QVector interceptXPos; + QVector interceptYPos; + QVector interceptZPos; + + QVector rxR0ActiveElementNumber; + QVector txR0MinDelayQ; + QVector rxR0MinDelayQ; + QVector rxR0MaxDelayQ; +}; + +struct SramTx { + QVector txFocusXPos; + QVector txFocusYPos; + QVector txFocusZPos; + + QVector txStartActiveElementNumber; + QVector txActiveElementNumber; + QVector pulseInterval; + QVector maxDelayQ; +}; + +#endif // SRAMSTRUCTURES_H diff --git a/include/model/hardware/core/register/sram/registerDefinition/TxParams.h b/include/model/hardware/core/register/sram/registerDefinition/TxParams.h new file mode 100644 index 0000000..ea8016c --- /dev/null +++ b/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(index)] - 1); + + txActiveElementNumber->setValueLong(_tx->txActiveElementNumber[static_cast(index)]); + + pulseInterval->setValueLong(static_cast(_tx->pulseInterval[static_cast(index)])) ; + + maxDelayQ->setValueLong(_tx->maxDelayQ[static_cast(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 diff --git a/include/model/hardware/core/register/sram/registerDefinition/TxParamsFocus.h b/include/model/hardware/core/register/sram/registerDefinition/TxParamsFocus.h new file mode 100644 index 0000000..a4d8fb9 --- /dev/null +++ b/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 txFocusXPosQ; + QVector txFocusYPosQ; + QVector txFocusZPosQ; + + void prepareData(quint32 index) override + { + txFocusXPos->setValueLong(txFocusXPosQ[static_cast(index)]); + + txFocusYPos->setValueLong(txFocusYPosQ[static_cast(index)]); + + txFocusZPos->setValueLong(txFocusZPosQ[static_cast(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 diff --git a/include/model/hardware/device/SonoConfig.h b/include/model/hardware/device/SonoConfig.h index 0600807..e2bffce 100644 --- a/include/model/hardware/device/SonoConfig.h +++ b/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 diff --git a/include/model/hardware/device/SonoDevice.h b/include/model/hardware/device/SonoDevice.h index 0becea3..e2737ee 100644 --- a/include/model/hardware/device/SonoDevice.h +++ b/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); }; diff --git a/mainwindow.cpp b/mainwindow.cpp index d737658..7808cb4 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -13,15 +13,15 @@ MainWindow::MainWindow(QWidget *parent) _timeout = new QTimer(); - _receiveConfig = new ReceiverConfiguration; _healStatus = new HealthStatus; - _rxBfPrp = new RxBeamformerProperties; _bCtrl = new BoardsCtrlMngt (_usd->device); _supRbValue = new SupervisorRbValue; _faultStatus = new MpsFaultStatus; -// _dial = new WaitDialog(); -// _dial->setModal(true); + + _version = new FpgaCodeVersion; + + _vec = new StatusVec; // ui->plot_2->setInteractions(QCP::iRangeZoom|QCP::iRangeDrag); @@ -87,7 +87,7 @@ MainWindow::MainWindow(QWidget *parent) ui->btn_pllClkSt->setText(ON); ui->btn_pllClkTps->setText(ON); //ui->btn_mulDacTrig->setText(TRIG_ON); - ui->btn_thsdStateUpdate->setText(THSD_State_Update); + //ui->btn_thsdStateUpdate->setText(THSD_State_Update); // ui->btn_pwrDacsEnable->setText(VALID); ui->btn_hvRegulatorConfig->setText(ENABLE); ui->btn_pm5RegulatorConfig->setText(ENABLE); @@ -138,7 +138,7 @@ MainWindow::MainWindow(QWidget *parent) setRxBeamformerPrp(); setPulseProperties(); - setAfeProperties(); + //setAfeProperties(); setProbeElement(); setApodization(); } @@ -151,14 +151,19 @@ MainWindow::~MainWindow() delete _usd; - //delete _dial; - delete _timeout; - delete _receiveConfig; - delete _healStatus; + delete _bCtrl; + + delete _supRbValue; + + delete _faultStatus; + + delete _version; + + delete _vec; } /*************************************************************************************************/ @@ -601,7 +606,7 @@ void MainWindow::timeout() auto pcie_vid = _trx.vendorId(); auto pcie_id = (pcie_pid << 16)|pcie_vid; ui->l_PCIeID->setText(QString::number(pcie_id, 16)); - delay(10); + delay(1); bool probeADetected=_bCtrl->getConnectedPrb().at(0); bool probeBDetected=_bCtrl->getConnectedPrb().at(1); @@ -624,136 +629,192 @@ void MainWindow::timeout() ui->l_detectedProbe->setText("None"); } -////auto detectedPrb = _usd->readWord(0x26078, 0); -//// detectedPrb = detectedPrb & (0xF); -//// if(detectedPrb == 0x7){ -//// ui->l_detectedProbe->setText("D"); -//// } -//// else if (detectedPrb == 0xB) { -//// ui->l_detectedProbe->setText("C"); -//// } -//// else if (detectedPrb == 0xD) { -//// ui->l_detectedProbe->setText("B"); -//// } -//// else if (detectedPrb == 0xE) { -//// ui->l_detectedProbe->setText("A"); -//// } -//// else{ -//// ui->l_detectedProbe->setText("None"); -//// } - - delay(10); -//// auto tempSensor = _usd->readWord(0x26078, 0); -//// float temp = tempSensor; -//// if (((tempSensor >> 10) & 0x01) == 0x01) -//// { -//// temp *= -1; -//// } -//// temp *= 0.125f; -// // auto detected_probe = _usd->readWord(0, 0); -// // ui->l_detectedProbe->setText(QString::number(detected_probe, 16)); -// // delay(100); - -// //auto interruptVec = _usd->readWord(0x0, 0); -// //ui->l_intrVector->setText(QString::number(interruptVec, 16)); + delay(1); _trx.getHealthStatus(_healStatus); - + delay(10); /******************* System Monitoring *********************/ float tempSensor = _healStatus->systemTemperature; - ui->l_Temp->setText(QString("%1").arg(tempSensor)); - delay(10); + ui->l_Temp->setText(QString("%1").arg(static_cast(tempSensor))); + delay(1); auto adcCh1 = _healStatus->adcMon->mon12Vin; - ui->l_adcCh1->setText(QString("%1").arg(adcCh1)); - delay(10); + ui->l_adcCh1->setText(QString("%1").arg(static_cast(adcCh1))); + delay(1); auto adcCh2 = _healStatus->adcMon->mon5Vin; - ui->l_adcCh2->setText(QString("%1").arg(adcCh2)); - delay(10); + ui->l_adcCh2->setText(QString("%1").arg(static_cast(adcCh2))); + delay(1); auto adcCh3 = _healStatus->adcMon->prbZeroEncoder; - ui->l_adcCh3->setText(QString("%1").arg(adcCh3)); - delay(10); + ui->l_adcCh3->setText(QString("%1").arg(static_cast(adcCh3))); + delay(1); auto adcCh4 = _healStatus->adcMon->prbCtrl3P3V; - ui->l_adcCh4->setText(QString("%1").arg(adcCh4)); - delay(10); + ui->l_adcCh4->setText(QString("%1").arg(static_cast(adcCh4))); + delay(1); auto adcCh5 = _healStatus->adcMon->afeVcntlp; - ui->l_adcCh5->setText(QString("%1").arg(adcCh5)); - delay(10); + ui->l_adcCh5->setText(QString("%1").arg(static_cast(adcCh5))); + delay(1); auto adcCh6 = _healStatus->adcMon->mon3P3V; - ui->l_adcCh6->setText(QString("%1").arg(adcCh6)); - delay(10); + ui->l_adcCh6->setText(QString("%1").arg(static_cast(adcCh6))); + delay(1); auto adcCh7 = _healStatus->adcMon->monAfeA1P8V; - ui->l_adcCh7->setText(QString("%1").arg(adcCh7)); - delay(10); + ui->l_adcCh7->setText(QString("%1").arg(static_cast(adcCh7))); + delay(1); auto adcCh8 = _healStatus->adcMon->monAfeD1P8V; - ui->l_adcCh8->setText(QString("%1").arg(adcCh8)); - delay(10); + ui->l_adcCh8->setText(QString("%1").arg(static_cast(adcCh8))); + delay(1); /******************* Power Good *********************/ auto regAPg = _healStatus->voltsPg->regulatorA; ui->l_pgRegA->setText(enum2String(regAPg)); - delay(10); + delay(1); auto regBPg = _healStatus->voltsPg->regulatorB; ui->l_pgRegB->setText(enum2String(regBPg)); - delay(10); + delay(1); auto pg12v = _healStatus->voltsPg->mon12Vin; ui->l_pg12Vin->setText(enum2String(pg12v)); - delay(10); + delay(1); auto pg5v = _healStatus->voltsPg->mon5Vin; ui->l_pg5Vin->setText(enum2String(pg5v)); - delay(10); + delay(1); auto Pg3P3 = _healStatus->voltsPg->mon3P3V; ui->l_pg3P3->setText(enum2String(Pg3P3)); - delay(10); + delay(1); auto pgAvdd = _healStatus->voltsPg->monAfeA1P8V; ui->l_pg1P8Avdd->setText(enum2String(pgAvdd)); - delay(10); + delay(1); auto pgDvdd = _healStatus->voltsPg->monAfeD1P8V; ui->l_pg1P8Dvdd->setText(enum2String(pgDvdd)); - delay(10); + delay(1); auto pgPrbCtrl = _healStatus->voltsPg->prbCtrl3P3V; ui->l_pgPrbCtrl3P3->setText(enum2String(pgPrbCtrl)); + delay(1); + + /******************* Status Vector *********************/ + _trx.getTrxStatus(_vec); delay(10); -//// bool fan1=pwr.getFan1Fault(); -//// ui->l_fan1Flt->setText(QVariant(fan1).toString()); -//// auto colorFan1 = fan1 ? Qt::red : Qt::green; -//// changeLabelTextColor(ui->l_fan1Flt, colorFan1); -//// delay(10); - -//// bool fan2=pwr.getFan2Fault(); -//// ui->l_fan2Flt->setText(QVariant(fan2).toString()); -//// auto colorFan2 = fan2 ? Qt::red : Qt::green; -//// changeLabelTextColor(ui->l_fan2Flt, colorFan2); -//// delay(10); - -//// bool cmdDoneI2c=pwr.getI2cCmdDone(); -//// ui->l_cmdDone->setText(QVariant(cmdDoneI2c).toString()); -//// auto colorCmdDone = cmdDoneI2c ? Qt::green : Qt::red; -//// changeLabelTextColor(ui->l_cmdDone, colorCmdDone); -//// delay(10); - -//// bool cmdErrorI2c=pwr.getI2cCmdErr(); -//// ui->l_cmdError->setText(QVariant(cmdErrorI2c).toString()); -//// auto colorCmdError = cmdErrorI2c ? Qt::red : Qt::green; -//// changeLabelTextColor(ui->l_cmdError, colorCmdError); -//// delay(10); + bool pgErr=_vec->pgErr; + ui->l_pg->setText(QVariant(pgErr).toString()); + auto color = pgErr ? Qt::red : Qt::green; + changeLabelTextColor(ui->l_pg, color); + delay(1); + + bool mpsErr=_vec->mpsErr; + ui->l_mps->setText(QVariant(mpsErr).toString()); + color = mpsErr ? Qt::red : Qt::green; + changeLabelTextColor(ui->l_mps, color); + delay(1); + + bool fanFault=_vec->fanFault; + ui->l_fan->setText(QVariant(fanFault).toString()); + color = fanFault ? Qt::red : Qt::green; + changeLabelTextColor(ui->l_fan, color); + delay(1); + + bool pulserThd=_vec->pulserThd; + ui->l_pulserThd->setText(QVariant(pulserThd).toString()); + color = pulserThd ? Qt::red : Qt::green; + changeLabelTextColor(ui->l_pulserThd, color); + delay(1); + + bool scenGtErr=_vec->scenGtErr; + ui->l_scenGt->setText(QVariant(scenGtErr).toString()); + color = scenGtErr ? Qt::red : Qt::green; + changeLabelTextColor(ui->l_scenGt, color); + delay(1); + + bool scenPriErr=_vec->scenPriErr; + ui->l_scenPri->setText(QVariant(scenPriErr).toString()); + color = scenPriErr ? Qt::red : Qt::green; + changeLabelTextColor(ui->l_scenPri, color); + delay(1); + + bool thermalErr=_vec->thermalErr; + ui->l_thermal->setText(QVariant(thermalErr).toString()); + color = thermalErr ? Qt::red : Qt::green; + changeLabelTextColor(ui->l_thermal, color); + delay(1); + + bool scenSramErr=_vec->scenSramErr; + ui->l_scenSram->setText(QVariant(scenSramErr).toString()); + color = scenSramErr ? Qt::red : Qt::green; + changeLabelTextColor(ui->l_scenSram, color); + delay(1); + + bool syncFifoErr=_vec->syncFifoErr; + ui->l_syncFifo->setText(QVariant(syncFifoErr).toString()); + color = syncFifoErr ? Qt::red : Qt::green; + changeLabelTextColor(ui->l_syncFifo, color); + delay(1); + + bool syncPointErr=_vec->syncPointErr; + ui->l_syncPoint->setText(QVariant(syncPointErr).toString()); + color = syncPointErr ? Qt::red : Qt::green; + changeLabelTextColor(ui->l_syncPoint, color); + delay(1); + + bool dintrlvFifoErr=_vec->dintrlvFifoErr; + ui->l_dintrlvFifo->setText(QVariant(dintrlvFifoErr).toString()); + color = dintrlvFifoErr ? Qt::red : Qt::green; + changeLabelTextColor(ui->l_dintrlvFifo, color); + delay(1); + + bool dintrlvPointErr=_vec->dintrlvPointErr; + ui->l_dintrlvPoint->setText(QVariant(dintrlvPointErr).toString()); + color = dintrlvPointErr ? Qt::red : Qt::green; + changeLabelTextColor(ui->l_dintrlvPoint, color); + delay(1); + + bool sram1ParityErr=_vec->sram1ParityErr; + ui->l_sram1Parity->setText(QVariant(sram1ParityErr).toString()); + color = sram1ParityErr ? Qt::red : Qt::green; + changeLabelTextColor(ui->l_sram1Parity, color); + delay(1); + + bool sram2ParityErr=_vec->sram2ParityErr; + ui->l_sram2Parity->setText(QVariant(sram2ParityErr).toString()); + color = sram2ParityErr ? Qt::red : Qt::green; + changeLabelTextColor(ui->l_sram2Parity, color); + delay(1); + + bool dmaCtrlTransferErr=_vec->dmaCtrlTransferErr; + ui->l_DmaCtrlTrans->setText(QVariant(dmaCtrlTransferErr).toString()); + color = dmaCtrlTransferErr ? Qt::red : Qt::green; + changeLabelTextColor(ui->l_DmaCtrlTrans, color); + delay(1); + + bool emulDmaTransferErr=_vec->emulDmaTransferErr; + ui->l_emulDmaTrans->setText(QVariant(emulDmaTransferErr).toString()); + color = emulDmaTransferErr ? Qt::red : Qt::green; + changeLabelTextColor(ui->l_emulDmaTrans, color); + delay(1); + + bool probeDisconnectErr=_vec->probeDisconnectErr; + ui->l_prbDiscon->setText(QVariant(probeDisconnectErr).toString()); + color = probeDisconnectErr ? Qt::red : Qt::green; + changeLabelTextColor(ui->l_prbDiscon, color); + delay(1); + + bool probeDetChanInterrupt=_vec->probeDetChanInterrupt; + ui->l_prbDetChg->setText(QVariant(probeDetChanInterrupt).toString()); + color = probeDetChanInterrupt ? Qt::red : Qt::green; + changeLabelTextColor(ui->l_prbDetChg, color); } @@ -895,7 +956,7 @@ void MainWindow::on_btn_writeReg_clicked() case 0: if(ui->rbtn_reg->isChecked()) offset *= 4; - _usd->writeWord(offset, bar, value); + _usd->writeWord(offset, bar, static_cast(value)); break; case 1: if(ui->rbtn_reg->isChecked()) @@ -1150,24 +1211,9 @@ void MainWindow::on_btn_scenStart_clicked() { try { - auto startIndex = ui->tb_startIdx->text().toUInt(Q_NULLPTR, 16); - if(startIndex == 0 && ui->tb_startIdx->text() != "0") - { - MESSAGE_BOX("Invalid input format for start index"); - return; - } - - auto endIndex = ui->tb_endIdx->text().toUInt(Q_NULLPTR, 16); - if(endIndex == 0 && ui->tb_endIdx->text() != "0") - { - MESSAGE_BOX("Invalid input format for stop index"); - return; - } - auto str = ui->btn_scenStart->text(); if(str == "Scenario Start") { - _trx.setScenPlayerIndex(startIndex, endIndex); _trx.scenPlayerStart(); ui->btn_scenStart->setText("Scenario Stop"); } @@ -1179,7 +1225,7 @@ void MainWindow::on_btn_scenStart_clicked() } catch(SonoException& e) { - qDebug(e.what()); + qDebug() << e.what(); } } @@ -1296,8 +1342,8 @@ void MainWindow::on_cb_selectedProbe_currentIndexChanged(int index) // auto bar = 0; // auto offset = 0x26008; - //on probe change - auto indx = ui->cb_selectedProbe->currentIndex(); + auto indx = index; + //indx = ui->cb_selectedProbe->currentIndex(); // auto value = 0; // value = _usd->readWord(offset, bar); // value = value & 0xFFFFFFF0; @@ -1363,7 +1409,7 @@ void MainWindow::on_cb_selectedProbe_currentIndexChanged(int index) } -/*************************************************************************************************/ + //void MainWindow::on_btn_pllClkTps_clicked() //{ // auto bar = 0; @@ -1401,7 +1447,7 @@ void MainWindow::on_cb_selectedProbe_currentIndexChanged(int index) //} -/*************************************************************************************************/ +//&************************************************************************************************* //void MainWindow::on_btn_mulDacTrig_clicked() //{ // auto bar = 0; @@ -1428,7 +1474,7 @@ void MainWindow::on_cb_selectedProbe_currentIndexChanged(int index) // //} //} -///*************************************************************************************************/ +//&************************************************************************************************* //void MainWindow::on_btn_HVOnOff_clicked() //{ //// auto bar = 0; @@ -1453,7 +1499,7 @@ void MainWindow::on_cb_selectedProbe_currentIndexChanged(int index) //} -///*************************************************************************************************/ +//&************************************************************************************************* //void MainWindow::on_btn_motorOnOff_clicked() //{ //// auto bar = 0; @@ -1479,7 +1525,7 @@ void MainWindow::on_cb_selectedProbe_currentIndexChanged(int index) // } //} -///*************************************************************************************************/ +//&************************************************************************************************* //void MainWindow::on_btn_pwr1OnOff_clicked() //{ //// auto bar = 0; @@ -1505,7 +1551,7 @@ void MainWindow::on_cb_selectedProbe_currentIndexChanged(int index) // } //} -///*************************************************************************************************/ +//&************************************************************************************************* //void MainWindow::on_btn_pwr2OnOff_clicked() //{ //// auto bar = 0; @@ -1531,7 +1577,7 @@ void MainWindow::on_cb_selectedProbe_currentIndexChanged(int index) // } //} -///*************************************************************************************************/ +//&************************************************************************************************* //void MainWindow::on_btn_pwr3OnOff_clicked() //{ //// auto bar = 0; @@ -1557,7 +1603,7 @@ void MainWindow::on_cb_selectedProbe_currentIndexChanged(int index) // } //} -///*************************************************************************************************/ +//&************************************************************************************************* //void MainWindow::on_btn_pwr4OnOff_clicked() //{ //// auto bar = 0; @@ -1583,7 +1629,7 @@ void MainWindow::on_cb_selectedProbe_currentIndexChanged(int index) // } //} -/*************************************************************************************************/ +//&************************************************************************************************* //void MainWindow::on_btn_thsdStateUpdate_clicked() //{ // auto bar = 0; @@ -1923,7 +1969,15 @@ void MainWindow::on_btn_setAo_clicked() auto hvaValue=ui->tb_hvaDacValue->text().toFloat(Q_NULLPTR); auto hvbValue=ui->tb_hvbDacValue->text().toFloat(Q_NULLPTR); //auto cwdValue=ui->tb_cwdDacValue->text().toFloat(Q_NULLPTR); - _trx.mpsSetAo(hvaValue, hvbValue); + try + { + _trx.mpsSetAo(hvaValue, hvbValue); + } + catch (SonoException& e) + { + qDebug() << e.what(); + } + } ///*************************************************************************************************/ @@ -1987,8 +2041,15 @@ void MainWindow::on_chk_initBoards_clicked() // i2cBusy=pwr.getI2cBusy(); // } // // delay (100); + try + { + _trx.init(); // p24_On + } + catch (SonoException& e) + { + qDebug() << e.what(); + } - _trx.init(); // p24_On // i2cDone=pwr.getI2cCmdDone(); // while (i2cDone==false){ // i2cDone=pwr.getI2cCmdDone(); @@ -2028,57 +2089,81 @@ void MainWindow::on_btn_supJump_clicked() // while (i2cDone==false){ // i2cDone=pwr.getI2cCmdDone(); // } - _trx.mpsReset(); + try + { + _trx.mpsReset(); //jump + } + catch (SonoException& e) + { + qDebug() << e.what(); + } + } /*************************************************************************************************/ void MainWindow::on_btn_updateRdbackValue_clicked() { - _trx.supervisorRbValue(_supRbValue); + try + { + _trx.supervisorRbValue(_supRbValue); + } + catch (SonoException& e) + { + qDebug() << e.what(); + } + auto hvapValue=_supRbValue->hvap; - ui->l_hvap->setText(QString::number(hvapValue, 'f', 3)); + ui->l_hvap->setText(QString::number(static_cast(hvapValue), 'f', 3)); delay(10); auto hvbpValue=_supRbValue->hvbp; - ui->l_hvbp->setText(QString::number(hvbpValue, 'f', 3)); + ui->l_hvbp->setText(QString::number(static_cast(hvbpValue), 'f', 3)); delay(10); auto cwdpValue=_supRbValue->cwdp; - ui->l_cwdp->setText(QString::number(cwdpValue, 'f', 3)); + ui->l_cwdp->setText(QString::number(static_cast(cwdpValue), 'f', 3)); delay(10); auto curr24vValue=_supRbValue->curr24V; - ui->l_curr24v->setText(QString::number(curr24vValue, 'f', 3)); + ui->l_curr24v->setText(QString::number(static_cast(curr24vValue), 'f', 3)); delay(10); auto p24vValue=_supRbValue->p24V; - ui->l_p24v->setText(QString::number(p24vValue, 'f', 3)); + ui->l_p24v->setText(QString::number(static_cast(p24vValue), 'f', 3)); delay(10); auto p12vValue=_supRbValue->p12V; - ui->l_p12v->setText(QString::number(p12vValue, 'f', 3)); + ui->l_p12v->setText(QString::number(static_cast(p12vValue), 'f', 3)); delay(10); auto p5vValue=_supRbValue->p5V; - ui->l_p5v->setText(QString::number(p5vValue, 'f', 3)); + ui->l_p5v->setText(QString::number(static_cast(p5vValue), 'f', 3)); delay(10); auto m5vValue=_supRbValue->m5V; - ui->l_m5v->setText(QString::number(m5vValue, 'f', 3)); + ui->l_m5v->setText(QString::number(static_cast(m5vValue), 'f', 3)); delay(10); auto hvStopValue=_supRbValue->hvStop; - ui->l_hvStop->setText(QString::number(hvStopValue, 'f', 3)); + ui->l_hvStop->setText(QString::number(static_cast(hvStopValue), 'f', 3)); delay(10); auto p4dValue=_supRbValue->p4D; - ui->l_p4d->setText(QString::number(p4dValue, 'f', 3)); + ui->l_p4d->setText(QString::number(static_cast(p4dValue), 'f', 3)); delay(10); /********************Faults***********************/ - _trx.mpsFaultStatus(_faultStatus); + try + { + _trx.mpsFaultStatus(_faultStatus); + } + catch (SonoException& e) + { + qDebug() << e.what(); + } + bool hvapFlt=_faultStatus->hvap; ui->l_hvapFlt->setText(QVariant(hvapFlt).toString()); @@ -2608,20 +2693,18 @@ void MainWindow::on_btn_updateRdbackValue_clicked() //} -//void MainWindow::on_btn_getFpgaVersion_clicked() -//{ -// uint32_t offsetVersion[4] = {0x4,0x14000C*4,0x24000C*4,0x34000C*4}; -// auto value = _usd->readWord(offsetVersion[0], 0); -// ui->l_masterVersion->setText(QStringLiteral("%1").arg(value, 8, 10)); -// value = _usd->readWord(offsetVersion[1], 0); -// ui->l_slave0Version->setText(QStringLiteral("%1").arg(value, 8, 10)); -// value = _usd->readWord(offsetVersion[2], 0); -// ui->l_slave1Version->setText(QStringLiteral("%1").arg(value, 8, 10)); -// value = _usd->readWord(offsetVersion[3], 0); -// ui->l_slave2Version->setText(QStringLiteral("%1").arg(value, 8, 10)); - - -//} +void MainWindow::on_btn_getFpgaVersion_clicked() +{ + _trx.getFpgasCodeVersion(_version); + auto value = _version->masterCode; + ui->l_masterVersion->setText(QStringLiteral("%1").arg(value, 8, 10)); + value = _version->slave0Code; + ui->l_slave0Version->setText(QStringLiteral("%1").arg(value, 8, 10)); + value = _version->slave1Code; + ui->l_slave1Version->setText(QStringLiteral("%1").arg(value, 8, 10)); + value = _version->slave2Code; + ui->l_slave2Version->setText(QStringLiteral("%1").arg(value, 8, 10)); +} //void MainWindow::on_btn_txTrig_clicked() //{ @@ -2684,59 +2767,46 @@ void MainWindow::on_btn_updateRdbackValue_clicked() /*************************************************************************************************/ void MainWindow::setReceiverConfiguration() { - _receiveConfig->mla.clear(); - _receiveConfig->stb.clear(); - _receiveConfig->lpfSel.clear(); - _receiveConfig->aTgcSel.clear(); - _receiveConfig->focusNo.clear(); - _receiveConfig->lineMode.clear(); - _receiveConfig->ncoFreqSel.clear(); - _receiveConfig->absEn.clear(); - _receiveConfig->ddcEn.clear(); - _receiveConfig->dpeEn.clear(); - _receiveConfig->stbEn.clear(); - _receiveConfig->wmfEn.clear(); - _receiveConfig->dcCancelerEn.clear(); - _receiveConfig->lineFilterEn.clear(); - _receiveConfig->subtractFilterEn.clear(); - - for (quint8 i = 0; i < 8; i++){ - _receiveConfig->mla.append(i % 7); - _receiveConfig->stb.append((i*2) % 3); - _receiveConfig->lpfSel.append((i*3) % 3); - _receiveConfig->aTgcSel.append((i*4) % 3); - _receiveConfig->focusNo.append((i*5) % 3); - _receiveConfig->lineMode.append((i*6) % 15); - _receiveConfig->ncoFreqSel.append((i*7) % 7); - _receiveConfig->absEn.append((i % 2)!=0); - _receiveConfig->ddcEn.append((i % 2)!=0); - _receiveConfig->dpeEn.append((i % 2)!=0); - _receiveConfig->stbEn.append((i % 2)!=0); - _receiveConfig->wmfEn.append((i % 2)!=0); - _receiveConfig->dcCancelerEn.append((i % 2)!=0); - _receiveConfig->lineFilterEn.append((i % 2)!=0); - _receiveConfig->subtractFilterEn.append((i % 2)!=0); - } -} - -void MainWindow::on_btn_receiveConfig_clicked() -{ - - ui->l_receiveConfigState->setText("doing"); - changeLabelTextColor(ui->l_receiveConfigState, Qt::red); - - _trx.scenReceiverConfigurationLut(_receiveConfig); - - ui->l_receiveConfigState->setText("done"); - changeLabelTextColor(ui->l_receiveConfigState, Qt::green); - +// _scenParams.hwRegister.->mla.clear(); +// _scenParams->hwRegister->configLut->stb.clear(); +// _scenParams->hwRegister->configLut->lpfSel.clear(); +// _scenParams->hwRegister->configLut->aTgcSel.clear(); +// _scenParams->hwRegister->configLut->focusNo.clear(); +// _scenParams->hwRegister->configLut->lineMode.clear(); +// _scenParams->hwRegister->configLut->ncoFreqSel.clear(); +// _scenParams->hwRegister->configLut->absEn.clear(); +// _scenParams->hwRegister->configLut->ddcEn.clear(); +// _scenParams->hwRegister->configLut->dpeEn.clear(); +// _scenParams->hwRegister->configLut->stbEn.clear(); +// _scenParams->hwRegister->configLut->wmfEn.clear(); +// _scenParams->hwRegister->configLut->dcCancelerEn.clear(); +// _scenParams->hwRegister->configLut->lineFilterEn.clear(); +// _scenParams->hwRegister->configLut->subtractFilterEn.clear(); + +// for (quint8 i = 0; i < 8; i++){ +// _scenParams.hwRegister.receiverConfigProps.append(); +// _scenParams.hwRegister->configLut->stb.append((i*2) % 3); +// _scenParams.hwRegister->configLut->lpfSel.append((i*3) % 3); +// _scenParams.hwRegister->configLut->aTgcSel.append((i*4) % 3); +// _scenParams.hwRegister->configLut->focusNo.append((i*5) % 3); +// _scenParams.hwRegister->configLut->lineMode.append((i*6) % 15); +// _scenParams.hwRegister->configLut->ncoFreqSel.append((i*7) % 7); +// _scenParams.hwRegister->configLut->absEn.append((i % 2)!=0); +// _scenParams.hwRegister->configLut->ddcEn.append((i % 2)!=0); +// _scenParams.hwRegister->configLut->dpeEn.append((i % 2)!=0); +// _scenParams.hwRegister->configLut->stbEn.append((i % 2)!=0); +// _scenParams.hwRegister->configLut->wmfEn.append((i % 2)!=0); +// _scenParams.hwRegister->configLut->dcCancelerEn.append((i % 2)!=0); +// _scenParams.hwRegister->configLut->lineFilterEn.append((i % 2)!=0); +// _scenParams.hwRegister->configLut->subtractFilterEn.append((i % 2)!=0); +// } } void MainWindow::setLineFilter() { _lineFilter.clear(); - for (quint8 i = 0; i < 4; i++) + for (auto i = 0; i < 4; i++) { _lineFilter.append(i); } @@ -2748,7 +2818,7 @@ void MainWindow::on_btn_lineFilter_clicked() ui->l_lineFilter->setText("doing"); changeLabelTextColor(ui->l_lineFilter, Qt::red); - _trx.scenLineFilterCoefficient(_lineFilter); + _trx.setLineFilterCoefficient(_lineFilter); ui->l_lineFilter->setText("done"); changeLabelTextColor(ui->l_lineFilter, Qt::green); @@ -2758,26 +2828,13 @@ void MainWindow::on_btn_lineFilter_clicked() void MainWindow::setFreqLut() { - _freq.clear(); + _scenParams.hwRegister.freqLut.clear(); for (quint8 i = 0; i < 8; i++) { - _freq.append(i*10); + _scenParams.hwRegister.freqLut.append(i*10); } } -void MainWindow::on_btn_freqLut_clicked() -{ - - ui->l_freq->setText("doing"); - changeLabelTextColor(ui->l_freq, Qt::red); - - _trx.scenFrequencyLut(_freq); - - ui->l_freq->setText("done"); - changeLabelTextColor(ui->l_freq, Qt::green); - -} - void MainWindow::setStbCoeff() { @@ -2794,7 +2851,7 @@ void MainWindow::on_btn_stbCoeff_clicked() ui->l_stbCoeff->setText("doing"); changeLabelTextColor(ui->l_stbCoeff, Qt::red); - _trx.scenStbCoefficient(_stb); + _trx.setStbCoefficient(_stb); ui->l_stbCoeff->setText("done"); changeLabelTextColor(ui->l_stbCoeff, Qt::green); @@ -2804,31 +2861,18 @@ void MainWindow::on_btn_stbCoeff_clicked() void MainWindow::setATgc() { - QList temp; - _aTgc.clear(); - - for (quint8 i = 0; i < 4; i++) - { - temp.clear(); - for (quint16 j = 0; j < 256; j++) - { - temp.append(j); - } - _aTgc.append(temp); - } -} - -void MainWindow::on_btn_atgc_clicked() -{ - - ui->l_atgc->setText("doing"); - changeLabelTextColor(ui->l_atgc, Qt::red); - - _trx.scenAtgcLut(_aTgc); - - ui->l_atgc->setText("done"); - changeLabelTextColor(ui->l_atgc, Qt::green); +// QVector temp; +// _scenParams.hwRegister.atgcLut.clear(); +// for (quint8 i = 0; i < 4; i++) +// { +// temp.clear(); +// for (quint16 j = 0; j < 256; j++) +// { +// temp.append(j); +// } +// _scenParams.hwRegister.atgcLut.append(temp); +// } } @@ -2847,7 +2891,7 @@ void MainWindow::on_btn_dtgc_clicked() ui->l_dtgc->setText("doing"); changeLabelTextColor(ui->l_dtgc, Qt::red); - _trx.scenDtgcLut(_dTgc); + _trx.setDtgcLut(_dTgc); ui->l_dtgc->setText("done"); changeLabelTextColor(ui->l_dtgc, Qt::green); @@ -2857,8 +2901,8 @@ void MainWindow::on_btn_dtgc_clicked() void MainWindow::setBlendWeight() { - QList temp; - _blendWeight.clear(); + QVector temp; + _scenParams.hwRegister.blendWeight.clear(); for (quint8 i = 0; i < 4; i++) { @@ -2867,51 +2911,25 @@ void MainWindow::setBlendWeight() { temp.append(j); } - _blendWeight.append(temp); + _scenParams.hwRegister.blendWeight.append(temp); } } -void MainWindow::on_btn_blendWeight_clicked() -{ - - ui->l_blendWeight->setText("doing"); - changeLabelTextColor(ui->l_blendWeight, Qt::red); - - _trx.scenBlendWeight(_blendWeight); - - ui->l_blendWeight->setText("done"); - changeLabelTextColor(ui->l_blendWeight, Qt::green); - -} - void MainWindow::setLpf() { - QList temp; - _lpf.clear(); - - for (quint8 i = 0; i < 4; i++) - { - temp.clear(); - for (quint8 j = 0; j < 48; j++) - { - temp.append(j); - } - _lpf.append(temp); - } -} - -void MainWindow::on_btn_lpf_clicked() -{ - - ui->l_lpf->setText("doing"); - changeLabelTextColor(ui->l_lpf, Qt::red); - - _trx.scenLpfLut(_lpf); - - ui->l_lpf->setText("done"); - changeLabelTextColor(ui->l_lpf, Qt::green); +// QVector temp; +// _scenParams->hwRegister->lpfLut.clear(); +// for (quint8 i = 0; i < 4; i++) +// { +// temp.clear(); +// for (quint8 j = 0; j < 48; j++) +// { +// temp.append(j); +// } +// _scenParams->hwRegister->lpfLut.append(temp); +// } } @@ -3141,167 +3159,140 @@ void MainWindow::on_btn_prbRomInfoRead_clicked() /*************************************************************************************************/ void MainWindow::setRxBeamformerPrp() { - _rxBfPrp->lag.clear(); - _rxBfPrp->mla.clear(); - _rxBfPrp->apodization.clear(); - - for (quint8 i = 0; i < 8; i++){ - _rxBfPrp->lag.append(i); - _rxBfPrp->mla.append((i*2) % 7); - _rxBfPrp->apodization.append((i*3) % 3); - } -} - -void MainWindow::on_btn_rxBeamformerPrp_clicked() -{ - - ui->l_rxBeamformerPrp->setText("doing"); - changeLabelTextColor(ui->l_rxBeamformerPrp, Qt::red); - - _trx.scenRxBeamformerProperties(_rxBfPrp); - - ui->l_rxBeamformerPrp->setText("done"); - changeLabelTextColor(ui->l_rxBeamformerPrp, Qt::green); +// _scenParams->hwRegister->rxBeamformer->lag.clear(); +// _scenParams->hwRegister->rxBeamformer->mla.clear(); +// _scenParams->hwRegister->rxBeamformer->apodization.clear(); +// for (quint8 i = 0; i < 8; i++){ +// _scenParams->hwRegister->rxBeamformer->lag.append(i); +// _scenParams->hwRegister->rxBeamformer->mla.append((i*2) % 7); +// _scenParams->hwRegister->rxBeamformer->apodization.append((i*3) % 3); +// } } - void MainWindow::setProbeElement() { - _prbElement.xPosition.clear(); - _prbElement.yPosition.clear(); - _prbElement.zPosition.clear(); + _scenParams.hwRegister.elementXPosition.clear(); + _scenParams.hwRegister.elementYPosition.clear(); + _scenParams.hwRegister.elementZPosition.clear(); for (quint8 i = 0; i < 192; i++){ - _prbElement.xPosition.append(i); - _prbElement.yPosition.append(i*2); - _prbElement.zPosition.append(i*3); + _scenParams.hwRegister.elementXPosition.append(i); + _scenParams.hwRegister.elementYPosition.append(i*2); + _scenParams.hwRegister.elementZPosition.append(i*3); } } -void MainWindow::on_btn_prbElementPosition_clicked() -{ - - ui->l_prbElementPosition->setText("doing"); - changeLabelTextColor(ui->l_prbElementPosition, Qt::red); - - _trx.scenProbeElementPosition(&_prbElement); - - ui->l_prbElementPosition->setText("done"); - changeLabelTextColor(ui->l_prbElementPosition, Qt::green); - -} - - void MainWindow::setApodization() { - QList temp; - _apodization.clear(); - - for (quint8 i = 0; i < 4; i++) - { - temp.clear(); - for (quint16 j = 0; j < 3057; j++) - { - temp.append(j); - } - _apodization.append(temp); - } -} - -void MainWindow::on_btn_apodization_clicked() -{ - - ui->l_apodization->setText("doing"); - changeLabelTextColor(ui->l_apodization, Qt::red); - - _trx.scenApodizationLut(_apodization); - - ui->l_apodization->setText("done"); - changeLabelTextColor(ui->l_apodization, Qt::green); +// QVector temp; +// _scenParams->hwRegister->apodization.clear(); +// for (quint8 i = 0; i < 4; i++) +// { +// temp.clear(); +// for (quint16 j = 0; j < 3057; j++) +// { +// temp.append(j); +// } +// _scenParams->hwRegister->apodization.append(temp); +// } } - void MainWindow::setPulseProperties() { - _pulsePrp.halfPeriod.clear(); - _pulsePrp.halfCycleNo.clear(); - _pulsePrp.startPhase.clear(); - _pulsePrp.pulseVoltSel.clear(); - _pulsePrp.dampingPulseWidth.clear(); +// _scenParams->hwRegister->pulse->halfPeriod.clear(); +// _scenParams->hwRegister->pulse->halfCycleNo.clear(); +// _scenParams->hwRegister->pulse->startPhase.clear(); +// _scenParams->hwRegister->pulse->pulseVoltSel.clear(); +// _scenParams->hwRegister->pulse->dampingPulseWidth.clear(); - for (quint8 i = 0; i < 8; i++){ +// for (quint8 i = 0; i < 8; i++){ - _pulsePrp.halfPeriod.append(i); - _pulsePrp.halfCycleNo.append(i*2); - _pulsePrp.startPhase.append((i % 2)==0); - _pulsePrp.pulseVoltSel.append((i % 2)==0); - _pulsePrp.dampingPulseWidth.append(i*3); +// _scenParams->hwRegister->pulse->halfPeriod.append(i); +// _scenParams->hwRegister->pulse->halfCycleNo.append(i*2); +// _scenParams->hwRegister->pulse->startPhase.append((i % 2)==0); +// _scenParams->hwRegister->pulse->pulseVoltSel.append((i % 2)==0); +// _scenParams->hwRegister->pulse->dampingPulseWidth.append(i*3); - } +// } } -void MainWindow::on_btn_pulsePrp_clicked() -{ - - ui->l_pulsePrp->setText("doing"); - changeLabelTextColor(ui->l_pulsePrp, Qt::red); - - _trx.scenPulseProperties(&_pulsePrp); - - ui->l_pulsePrp->setText("done"); - changeLabelTextColor(ui->l_pulsePrp, Qt::green); +//void MainWindow::setAfeProperties() +//{ +// _scenParams->afe->lpfProg.clear(); +// _scenParams->afe->pgaHpfDis.clear(); +// _scenParams->afe->pgaClampDis.clear(); +// _scenParams->afe->pgaGain.clear(); +// _scenParams->afe->gblActiveTerm.clear(); +// _scenParams->afe->actTermEn.clear(); +// _scenParams->afe->inputClampLvl.clear(); +// _scenParams->afe->lnaHpfDis.clear(); +// _scenParams->afe->lnaGainGbl.clear(); +// _scenParams->afe->lowNf.clear(); +// _scenParams->afe->powModes.clear(); +// _scenParams->afe->gblPdwn.clear(); +// _scenParams->afe->lnaHpfProg.clear(); + +// for (quint8 i = 0; i < 8; i++){ + +// _scenParams->afe->lpfProg.append(i); +// _scenParams->afe->pgaHpfDis.append((i % 2)==0); +// _scenParams->afe->pgaClampDis.append((i % 2)==0); +// _scenParams->afe->pgaGain.append((i % 2)==0); +// _scenParams->afe->gblActiveTerm.append((i*2) % 3); +// _scenParams->afe->actTermEn.append((i % 2)==0); +// _scenParams->afe->inputClampLvl.append((i*3) % 7); +// _scenParams->afe->lnaHpfDis.append((i % 2)==0); +// _scenParams->afe->lnaGainGbl.append((i*4) % 3); +// _scenParams->afe->lowNf.append((i % 2)==0); +// _scenParams->afe->powModes.append((i*5) % 3); +// _scenParams->afe->gblPdwn.append((i % 2)==0); +// _scenParams->afe->lnaHpfProg.append((i*6) % 3); -} +// } +//} -void MainWindow::setAfeProperties() +void MainWindow::on_btn_scenParams_clicked() { - _afePrp.lpfProg.clear(); - _afePrp.pgaHpfDis.clear(); - _afePrp.pgaClampDis.clear(); - _afePrp.pgaGain.clear(); - _afePrp.gblActiveTerm.clear(); - _afePrp.actTermEn.clear(); - _afePrp.inputClampLvl.clear(); - _afePrp.lnaHpfDis.clear(); - _afePrp.lnaGainGbl.clear(); - _afePrp.lowNf.clear(); - _afePrp.powModes.clear(); - _afePrp.gblPdwn.clear(); - _afePrp.lnaHpfProg.clear(); - - for (quint8 i = 0; i < 8; i++){ - - _afePrp.lpfProg.append(i); - _afePrp.pgaHpfDis.append((i % 2)==0); - _afePrp.pgaClampDis.append((i % 2)==0); - _afePrp.pgaGain.append((i % 2)==0); - _afePrp.gblActiveTerm.append((i*2) % 3); - _afePrp.actTermEn.append((i % 2)==0); - _afePrp.inputClampLvl.append((i*3) % 7); - _afePrp.lnaHpfDis.append((i % 2)==0); - _afePrp.lnaGainGbl.append((i*4) % 3); - _afePrp.lowNf.append((i % 2)==0); - _afePrp.powModes.append((i*5) % 3); - _afePrp.gblPdwn.append((i % 2)==0); - _afePrp.lnaHpfProg.append((i*6) % 3); + ui->l_scenParams->setText("doing"); + changeLabelTextColor(ui->l_scenParams, Qt::red); + + _scenParams.focusTypeNumber = 100; + _scenParams.totalTxShotNumber = 100; + for (int var = 0; var < 100; var++) { + _scenParams.rxBeamFormerNumber.append(5); } -} -void MainWindow::on_btn_afeLut_clicked() -{ + auto startIndex = ui->tb_startIdx->text().toUInt(Q_NULLPTR, 16); + if(startIndex == 0 && ui->tb_startIdx->text() != "0") + { + MESSAGE_BOX("Invalid input format for start index"); + return; + } - ui->l_afeLut->setText("doing"); - changeLabelTextColor(ui->l_afeLut, Qt::red); + auto endIndex = ui->tb_endIdx->text().toUInt(Q_NULLPTR, 16); + if(endIndex == 0 && ui->tb_endIdx->text() != "0") + { + MESSAGE_BOX("Invalid input format for stop index"); + return; + } + _scenParams.hwRegister.scenarioStartIndex = startIndex; + _scenParams.hwRegister.scenarioEndIndex = endIndex; - _trx.scenAfeLut(&_afePrp); + try + { + _trx.setScenario(_scenParams); + } - ui->l_afeLut->setText("done"); - changeLabelTextColor(ui->l_afeLut, Qt::green); + catch(SonoException& e) + { + qDebug() << e.what(); + } + ui->l_scenParams->setText("done"); + changeLabelTextColor(ui->l_scenParams, Qt::green); } - diff --git a/mainwindow.h b/mainwindow.h index 5334d70..e0a75bc 100644 --- a/mainwindow.h +++ b/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 _lineFilter; + QVector _lineFilter; void setLineFilter (void); - QList _freq; void setFreqLut (void); - QList _stb; + QVector _stb; void setStbCoeff (void); - QList _dTgc; + QVector _dTgc; void setDTgc (void); - QList> _aTgc; void setATgc (void); - QList> _blendWeight; void setBlendWeight (void); - QList> _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> _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); diff --git a/mainwindow.ui b/mainwindow.ui index 683c1a1..6b60236 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -27,7 +27,7 @@ - 0 + 1 @@ -445,7 +445,7 @@ 230 - 20 + 30 94 23 @@ -454,32 +454,27 @@ Scenario Start - - - - DSP Setting - - + - 30 - 20 - 148 - 48 + 20 + 110 + 160 + 51 - + - + - + - done: + Filling: - + doing @@ -488,9 +483,12 @@ - + + + <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">Write Scenario Parameters</span></p></body></html> + - Receiver Configuration + Scenario Parameters @@ -499,10 +497,10 @@ - 220 - 20 + 230 + 110 106 - 48 + 51 @@ -511,7 +509,7 @@ - done: + Filling: @@ -533,124 +531,13 @@ - - - - 360 - 20 - 91 - 48 - - - - - - - - - done: - - - - - - - doing - - - - - - - - - Blend Weight - - - - - - - - - 490 - 20 - 96 - 48 - - - - - - - - - done: - - - - - - - doing - - - - - - - - - Frequency Lut - - - - - - - - - 30 - 100 - 82 - 48 - - - - - - - - - done: - - - - - - - doing - - - - - - - - - ATgc - - - - - - 220 - 100 - 82 - 48 + 390 + 110 + 84 + 51 @@ -659,7 +546,7 @@ - done: + Filling: @@ -681,49 +568,12 @@ - - - - 360 - 100 - 82 - 48 - - - - - - - - - done: - - - - - - - doing - - - - - - - - - LPF - - - - - - 490 - 100 - 82 + 520 + 110 + 84 48 @@ -733,7 +583,7 @@ - done: + Filling: @@ -838,196 +688,6 @@ - - - BeamFormer Setting - - - - - 20 - 20 - 170 - 48 - - - - - - - - - done: - - - - - - - doing - - - - - - - - - Rx Beamformer Properties - - - - - - - - - 230 - 20 - 149 - 48 - - - - - - - - - done: - - - - - - - doing - - - - - - - - - Probe Element Position - - - - - - - - - 410 - 20 - 104 - 48 - - - - - - - - - done: - - - - - - - doing - - - - - - - - - Apodization Lut - - - - - - - - - 20 - 100 - 107 - 48 - - - - - - - - - done: - - - - - - - doing - - - - - - - - - Pulse Properties - - - - - - - - - 230 - 100 - 82 - 48 - - - - - - - - - done: - - - - - - - doing - - - - - - - - - Afe Lut - - - - - - E2PROMs @@ -1679,7 +1339,7 @@ - 240 + 300 50 16 111 @@ -1692,7 +1352,7 @@ - 510 + 550 160 163 17 @@ -1718,8 +1378,8 @@ - 0 - 50 + 10 + 60 126 19 @@ -1741,107 +1401,10 @@ - - - - 0 - 70 - 139 - 19 - - - - - - - THSD_F1: - - - - - - - TextLabel - - - - - - - - - 0 - 90 - 139 - 19 - - - - - - - THSD_F2: - - - - - - - TextLabel - - - - - - - - - 0 - 110 - 139 - 19 - - - - - - - THSD_F3: - - - - - - - TextLabel - - - - - - - - - 140 - 90 - 101 - 23 - - - - - 0 - 0 - - - - PushButton - - - 260 + 310 50 126 17 @@ -1867,7 +1430,7 @@ - 260 + 310 70 119 17 @@ -1893,7 +1456,7 @@ - 260 + 310 90 121 17 @@ -1919,7 +1482,7 @@ - 260 + 310 110 151 17 @@ -1945,7 +1508,7 @@ - 260 + 310 130 152 17 @@ -1971,7 +1534,7 @@ - 510 + 550 50 147 17 @@ -1997,7 +1560,7 @@ - 260 + 310 150 143 17 @@ -2023,7 +1586,7 @@ - 510 + 540 70 165 17 @@ -2046,36 +1609,10 @@ - - - - 0 - 150 - 124 - 17 - - - - - - - Interrupt: - - - - - - - TextLabel - - - - - - 700 + 710 60 91 23 @@ -2088,12 +1625,15 @@ - 700 + 720 90 81 17 + + <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">Master Code</span></p></body></html> + TextLabel @@ -2101,12 +1641,15 @@ - 700 + 720 110 81 17 + + <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">Slave0 Code</span></p></body></html> + TextLabel @@ -2114,12 +1657,15 @@ - 700 + 720 130 81 17 + + <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">Slave1 Code</span></p></body></html> + TextLabel @@ -2127,12 +1673,15 @@ - 700 + 720 150 81 17 + + <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">Slave2 Code</span></p></body></html> + TextLabel @@ -2140,7 +1689,7 @@ - 420 + 470 50 62 122 @@ -2212,7 +1761,7 @@ - 510 + 560 90 145 63 @@ -2270,6 +1819,221 @@ + + + + 10 + 90 + 285 + 67 + + + + + + + Status Vec: + + + + + + + + + + + <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">Prb Det Change</span></p></body></html> + + + false + + + + + + + <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">Sram 1 Parity</span></p></body></html> + + + false + + + + + + + <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">Sram 2 Parity</span></p></body></html> + + + false + + + + + + + <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">MPS</span></p></body></html> + + + false + + + + + + + <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">Scen PRI</span></p></body></html> + + + false + + + + + + + <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">Scen GT</span></p></body></html> + + + false + + + + + + + + + + + <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">Scen SRAM</span></p></body></html> + + + false + + + + + + + <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">Sync FIFO</span></p></body></html> + + + false + + + + + + + <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">Sync Point</span></p></body></html> + + + false + + + + + + + <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">D Interleave FIFO</span></p></body></html> + + + false + + + + + + + <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">D Interleave Point</span></p></body></html> + + + false + + + + + + + <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">Pulser THD</span></p></body></html> + + + false + + + + + + + + + + + <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">Thermal</span></p></body></html> + + + false + + + + + + + <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">PG</span></p></body></html> + + + false + + + + + + + <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">Prb Disconnect</span></p></body></html> + + + false + + + + + + + <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">Fan</span></p></body></html> + + + false + + + + + + + <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">Emulator DMA Transfer</span></p></body></html> + + + false + + + + + + + <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">DMA Ctrl Transfer</span></p></body></html> + + + false + + + + + + + + + @@ -3651,10 +3415,10 @@ - 730 + 720 70 - 75 - 17 + 90 + 21 diff --git a/src/model/hardware/core/TrxBoard.cpp b/src/model/hardware/core/TrxBoard.cpp index 86df955..0055b49 100644 --- a/src/model/hardware/core/TrxBoard.cpp +++ b/src/model/hardware/core/TrxBoard.cpp @@ -4,217 +4,37 @@ #include #include -/*************************************************************************************************/ -/** - * @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 TrxBoard::signedVector2unsignedList (QVector& sgnVec) +//{ +// _unsignedQntzrList.clear(); +//// std::list _usgnList (sgnVec.begin(), sgnVec.end()); +//// _unsignedQntzrList.fromStdList(_usgnList); +// foreach (auto i, sgnVec) +// { +// _unsignedQntzrList.push_back(static_cast(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> elementPosition; QList x; QList y; QList z; + _unsignedQntzrVec.clear(); + _unsignedQntzrVec = Register::qntzr(scenParams->hwRegister->elementPosition->xPosition, 1, 18, 0, 0, true, true, true); + QList xPosQ = _unsignedQntzrVec.toList(); + + _unsignedQntzrVec.clear(); + _unsignedQntzrVec = Register::qntzr(scenParams->hwRegister->elementPosition->yPosition, 1, 18, 0, 0, true, true, true); + QList yPosQ = _unsignedQntzrVec.toList(); + + _unsignedQntzrVec.clear(); + _unsignedQntzrVec = Register::qntzr(scenParams->hwRegister->elementPosition->zPosition, 0, 17, 0, 0, true, true, true); + QList zPosQ = _unsignedQntzrVec.toList(); + for (quint8 i=0; i<3; i++) { for (quint8 j=0; jxPosition.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 > &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> 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 &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 freqLutQ = _unsignedQntzrVec.toList(); + this->_dsp->frequencyLut(freqLutQ); + + _unsignedQntzrVec.clear(); + _unsignedQntzrVec = Register::qntzr(scenParams->hwRegister->dtgcLut, 0, 12, 8, 0, true, false); + QList dtgcLutQ = _unsignedQntzrVec.toList(); + this->_dsp->dtgcLut(dtgcLutQ); + + QList temp; + QList> 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> atgcLutQ; + foreach (auto vec, scenParams->hwRegister->atgcLut) + { + atgcLutQ.push_back(vec.toList()); + } + this->_dsp->atgcLut(atgcLutQ); + + + QList> 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 &stbLut) const -{ - this->_dsp->stbCoefficient(stbLut); } -void TrxBoard::scenFrequencyLut(QList &freqLut) const + +void TrxBoard::setLineFilterCoefficient(QVector &lineFilterLut) { - this->_dsp->frequencyLut(freqLut); + _unsignedQntzrVec.clear(); + _unsignedQntzrVec = Register::qntzr(lineFilterLut, 0, 9, 8, 0, true, false); + QList lineFilterLutQ = _unsignedQntzrVec.toList(); + this->_dsp->lineFilterCoefficient(lineFilterLutQ); } -void TrxBoard::scenBlendWeight(QList > &blendWeight) const +void TrxBoard::setStbCoefficient(QVector &stbLut) { - this->_dsp->blendWeight(blendWeight); + QList 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 &dtgcLut) const +void TrxBoard::setDtgcLut(QVector &dtgcLut) { - this->_dsp->dtgcLut(dtgcLut); + _unsignedQntzrVec.clear(); + _unsignedQntzrVec = Register::qntzr(dtgcLut, 0, 12, 8, 0, true, false); + QList dtgcLutQ = _unsignedQntzrVec.toList(); + this->_dsp->dtgcLut(dtgcLutQ); } -void TrxBoard::scenAtgcLut(QList > &atgcLut) const +void TrxBoard::setAfePwrdnMode(eAfePwrdnMode cmd) const { - this->_dsp->atgcLut(atgcLut); + } -void TrxBoard::scenLpfLut(QList > &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); +} diff --git a/src/model/hardware/core/register/Field.cpp b/src/model/hardware/core/register/Field.cpp index 66bc01e..b46fc5a 100644 --- a/src/model/hardware/core/register/Field.cpp +++ b/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; } diff --git a/src/model/hardware/core/register/Register.cpp b/src/model/hardware/core/register/Register.cpp index fdb778a..093b566 100644 --- a/src/model/hardware/core/register/Register.cpp +++ b/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 Register::qntzr(QVector &data, quint32 sign, quint32 wordlength, quint32 fractionalLength, float maxLevel, bool integerOutput, bool useRound, bool twosCmpl) +{ + +} + + + +//QVector Register::qntzr(QVector &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 output; +// if(integerOutput) +// { +// for(auto i = 0; i < data.length(); i++) +// { +// qint32 out; +// if(useRound) +// { +// out = +// static_cast(roundf(data[i] / fullScale * +// (powf(2.0f, wordLength - sign) - 1))); +// } +// else +// { +// out = +// static_cast(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(roundf(data[i] / fullScale * +// (powf(2.0f, wordLength - sign) - 1)) / +// (fullScale * (powf(2.0f, wordLength - sign) - 1))); +// } +// else +// { +// out = +// static_cast(floorf(data[i] / fullScale * +// (powf(2.0f, wordLength - sign) - 1)) / +// (fullScale * (powf(2.0f, wordLength - sign) - 1))); +// } + +// output.push_back(out); +// } +// } + +// return output; +//} diff --git a/src/model/hardware/core/register/beamFormer/BeamFormer.cpp b/src/model/hardware/core/register/beamFormer/BeamFormer.cpp index 4e18a8c..71ccfd1 100644 --- a/src/model/hardware/core/register/beamFormer/BeamFormer.cpp +++ b/src/model/hardware/core/register/beamFormer/BeamFormer.cpp @@ -27,7 +27,7 @@ void BeamFormer::probeElementPosition(QList> &elementPosition) co foreach (QList 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> &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> &apodization) const +void BeamFormer::apodizationLut(QList>& apodization) const { quint32 baseOffset = this->_apodization->getCurrentOffset(); foreach (QList 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> &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 diff --git a/src/model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.cpp b/src/model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.cpp index fe17ef0..581bb98 100644 --- a/src/model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.cpp +++ b/src/model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.cpp @@ -87,7 +87,7 @@ void BoardsCtrlMngt::eepromWrite(QByteArray& arr, quint32 addr, quint8 prbSel, T template void BoardsCtrlMngt::setEepromWrite(EepromReq* _rom, T3* request) { - request->dataIn->setValue(_rom->dataIn); + request->dataIn->setValue(static_cast(_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(_rom, request); @@ -160,7 +159,6 @@ QByteArray BoardsCtrlMngt::eepromRead(quint32 addr, quint32 length, quint8 prbSe template 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 diff --git a/src/model/hardware/core/register/bpiFlash/BpiFlash.cpp b/src/model/hardware/core/register/bpiFlash/BpiFlash.cpp index 4b17baf..323f9b7 100644 --- a/src/model/hardware/core/register/bpiFlash/BpiFlash.cpp +++ b/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* mcs) const diff --git a/src/model/hardware/core/register/builtInTest/BuiltInTest.cpp b/src/model/hardware/core/register/builtInTest/BuiltInTest.cpp index f7b4ab1..70d2646 100644 --- a/src/model/hardware/core/register/builtInTest/BuiltInTest.cpp +++ b/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 diff --git a/src/model/hardware/core/register/dsp/Dsp.cpp b/src/model/hardware/core/register/dsp/Dsp.cpp index 9bdc99f..ac97e06 100644 --- a/src/model/hardware/core/register/dsp/Dsp.cpp +++ b/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 &lineFilterLut) const { this->_lineFilterLut->setLineFilterLut(lineFilterLut); - this->_lineFilterLut->upadteArray(); + this->_lineFilterLut->updateArray(); } void Dsp::stbCoefficient(QList &stbLut) const { this->_stbLut->setStbLut(stbLut); - this->_stbLut->upadteArray(); + this->_stbLut->updateArray(); } void Dsp::frequencyLut(QList &fLut) const { this->_freqLut->setFreqLut(fLut); - this->_freqLut->upadteArray(); + this->_freqLut->updateArray(); } void Dsp::blendWeight(QList > &blendWeight) const @@ -59,7 +59,7 @@ void Dsp::blendWeight(QList > &blendWeight) const foreach (QList 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 &dtgcLut) const { this->_dtgcLut->setDtgcLut(dtgcLut); - this->_dtgcLut->upadteArray(); + this->_dtgcLut->updateArray(); } void Dsp::atgcLut(QList > &atgcLut) const @@ -104,7 +104,7 @@ void Dsp::atgcLut(QList > &atgcLut) const foreach (QList 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> &lpfLut) const foreach (QList 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 } diff --git a/src/model/hardware/core/register/emulator/Emulator.cpp b/src/model/hardware/core/register/emulator/Emulator.cpp new file mode 100644 index 0000000..3b4478d --- /dev/null +++ b/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(rate * 1E5f); + this->_transRate->transferRate->setValue(realRate); + this->_transRate->update(); + +} + diff --git a/src/model/hardware/core/register/fpgaProgram/FpgaProgram.cpp b/src/model/hardware/core/register/fpgaProgram/FpgaProgram.cpp index e23613e..099ef7f 100644 --- a/src/model/hardware/core/register/fpgaProgram/FpgaProgram.cpp +++ b/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); diff --git a/src/model/hardware/core/register/misc/Misc.cpp b/src/model/hardware/core/register/misc/Misc.cpp new file mode 100644 index 0000000..8485cfa --- /dev/null +++ b/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 +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(_mVersion); + version->slave0Code = this->getVersion(_s0Version); + version->slave1Code = this->getVersion(_s1Version); + version->slave2Code = this->getVersion(_s2Version); +} diff --git a/src/model/hardware/core/register/sram/Sram.cpp b/src/model/hardware/core/register/sram/Sram.cpp new file mode 100644 index 0000000..91a7573 --- /dev/null +++ b/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 &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(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(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(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 +} + + diff --git a/src/model/hardware/device/SonoDevice.cpp b/src/model/hardware/device/SonoDevice.cpp index 000fc0f..31c72fc 100644 --- a/src/model/hardware/device/SonoDevice.cpp +++ b/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(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) {