diff --git a/api.cpp b/api.cpp old mode 100755 new mode 100644 diff --git a/api.h b/api.h old mode 100755 new mode 100644 diff --git a/developHw.pro.user b/developHw.pro.user index cc0ae80..43666aa 100644 --- a/developHw.pro.user +++ b/developHw.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -314,7 +314,6 @@ 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 9cc51c7..2feaeea 100644 --- a/include/model/hardware/core/TrxBoard.h +++ b/include/model/hardware/core/TrxBoard.h @@ -3,6 +3,7 @@ #include #include +#include #include #include "model/hardware/core/register/clockDistributer/ClockDistributer.h" @@ -50,6 +51,22 @@ enum eSelectProbe : quint8 prbD, }; +struct ConnectedPrbId +{ + quint32 prbA; + quint32 prbB; + quint32 prbC; + quint32 prbD; +}; + +struct ConnectedPrbInfo +{ + QByteArray prbA; + QByteArray prbB; + QByteArray prbC; + QByteArray prbD; +}; + class TrxBoard { private: @@ -124,10 +141,10 @@ public: void setBeamFormerMode (eClkMode mode) const; /////////////////////////////// Scenario Player API //////////////////////////// - void setScenPlayerIndex (quint32& startIdx, quint32& endIdx) const; - void scenPlayerStart (bool start) const; - void scenPlayerPause (bool pause) const; - void scenPlayerStop (bool stop) const; + 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); @@ -145,13 +162,13 @@ public: quint32 mpsId (void) const; quint32 prbCtrlId (void) const; quint32 prbId (quint8 prbSel) const; - QList getConnectedPrbId (void) const; + void getConnectedPrbId (ConnectedPrbId* prbId) const; QString trxInfo (void) const; QString mpsInfo (void) const; QString prbCtrlInfo (void) const; - QString prbInfo (quint8 prbSel) const; - QList getConnectedPrbInfo (void) const; + QByteArray prbInfo (quint8 prbSel) const; + void getConnectedPrbInfo (ConnectedPrbInfo* prbInfo) const; void supervisorRbValue(SupervisorRbValue* sValue) const; void mpsFaultStatus (MpsFaultStatus* faultStatus) const; diff --git a/include/model/hardware/core/register/Register.h b/include/model/hardware/core/register/Register.h index 0b3b6ea..9cb0e30 100644 --- a/include/model/hardware/core/register/Register.h +++ b/include/model/hardware/core/register/Register.h @@ -6,9 +6,9 @@ class Register { -//private: -// virtual void prepareData(quint32 index); -// virtual void receiveData(void); +private: + virtual void prepareData(quint32){} + virtual void receiveData(void){} protected: quint32 _bar; @@ -16,7 +16,6 @@ protected: quint32 _baseOffset; quint32 _arrayLength; - quint8 _arrayDepth; quint32 _value; @@ -27,9 +26,8 @@ protected: SonoDevice* _device; public: - //Register(quint8 bar, quint32 offset, SonoDevice* device, quint32 arrayLength=0); // Constructor for general Registers: single and array - Register(quint8 bar, quint32 offset, SonoDevice* device); - ~Register(); + Register(quint8 bar, quint32 offset, SonoDevice* device, quint32 arrayLength=0); // Constructor for general Registers: single and array + virtual ~Register(); quint32 getValue(); void setValue(quint32 value); diff --git a/include/model/hardware/core/register/RegisterChain.h b/include/model/hardware/core/register/RegisterChain.h deleted file mode 100644 index 5618719..0000000 --- a/include/model/hardware/core/register/RegisterChain.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef REGISTERCHAIN_H -#define REGISTERCHAIN_H - -#include "model/hardware/core/register/Field.h" -#include "model/hardware/device/SonoDevice.h" - -class RegisterChain -{ -private: - virtual void prepareData(quint32 index)=0; - //virtual void receiveData(void); - -protected: - quint32 _bar; - quint32 _offset; - quint32 _baseOffset; - - quint32 _arrayLength; - quint8 _arrayDepth; - - quint32 _value; - - bool _isUpdated; - - QList _fields; - - SonoDevice* _device; - -public: - RegisterChain(quint8 bar, quint32 offset, SonoDevice* device, quint32 arrayLength); // Constructor for general Registers: single and array - virtual ~RegisterChain(); - - quint32 getValue(); - void setValue(quint32 value); - - void changeOffset(quint32 offset); - quint32 getCurrentOffset (void) const; - - bool isUpdated(); - - void update(); - void upadteArray(); - - void sync(); - void syncArray(); -}; - - -#endif // REGISTERCHAIN_H diff --git a/include/model/hardware/core/register/beamFormer/registerDefinition/AfeLut.h b/include/model/hardware/core/register/beamFormer/registerDefinition/AfeLut.h index 3ab938b..bffcdc0 100644 --- a/include/model/hardware/core/register/beamFormer/registerDefinition/AfeLut.h +++ b/include/model/hardware/core/register/beamFormer/registerDefinition/AfeLut.h @@ -1,7 +1,7 @@ #ifndef AFELUT_H #define AFELUT_H -#include "model/hardware/core/register/RegisterChain.h" +#include "model/hardware/core/register/Register.h" #include "model/hardware/core/register/RegUtils.h" #undef BAR @@ -41,7 +41,7 @@ struct AfeProperties QList lnaHpfProg; }; -class AfeLut : public RegisterChain +class AfeLut : public Register { private: AfeProperties* _AfeLut; @@ -104,7 +104,7 @@ public: _AfeLut = AfeLut; } - AfeLut(SonoDevice* device, quint32 offset) : RegisterChain(BAR, OFFSET+offset, device, LENGTH) + AfeLut(SonoDevice* device, quint32 offset) : Register(BAR, OFFSET+offset, device, LENGTH) { ADD_UNSIGNED_FIELD(lpfProgPrp, LPF_PROG_PRP_MASK); ADD_UNSIGNED_FIELD(pgaHpfDisPrp, PGA_HPF_DIS_PRP_MASK); diff --git a/include/model/hardware/core/register/beamFormer/registerDefinition/ApodizationLut.h b/include/model/hardware/core/register/beamFormer/registerDefinition/ApodizationLut.h index 27a9d3e..4295cd6 100644 --- a/include/model/hardware/core/register/beamFormer/registerDefinition/ApodizationLut.h +++ b/include/model/hardware/core/register/beamFormer/registerDefinition/ApodizationLut.h @@ -1,8 +1,7 @@ #ifndef APODIZATIONLUT_H #define APODIZATIONLUT_H -//#include "model/hardware/core/register/Register.h" -#include "model/hardware/core/register/RegisterChain.h" +#include "model/hardware/core/register/Register.h" #include "model/hardware/core/register/RegUtils.h" #undef BAR @@ -13,7 +12,7 @@ #define OFFSET 0x4C0000 #define LENGTH 3057U -class ApodizationLut : public RegisterChain +class ApodizationLut : public Register { private: QList _apodization; @@ -32,7 +31,7 @@ public: _apodization = apodization; } - ApodizationLut(SonoDevice* device, quint32 offset) : RegisterChain(BAR, OFFSET+offset, device, LENGTH) + ApodizationLut(SonoDevice* device, quint32 offset) : Register(BAR, OFFSET+offset, device, LENGTH) { ADD_UNSIGNED_FIELD(apodizationPrp, APODIZATION_PRP_MASK); } diff --git a/include/model/hardware/core/register/beamFormer/registerDefinition/ElementPositionLut.h b/include/model/hardware/core/register/beamFormer/registerDefinition/ElementPositionLut.h index 78cdd51..950bb78 100644 --- a/include/model/hardware/core/register/beamFormer/registerDefinition/ElementPositionLut.h +++ b/include/model/hardware/core/register/beamFormer/registerDefinition/ElementPositionLut.h @@ -1,8 +1,7 @@ #ifndef ELEMENTPOSITIONLUT_H #define ELEMENTPOSITIONLUT_H -//#include "model/hardware/core/register/Register.h" -#include "model/hardware/core/register/RegisterChain.h" +#include "model/hardware/core/register/Register.h" #include "model/hardware/core/register/RegUtils.h" #undef BAR @@ -13,7 +12,7 @@ #define OFFSET 0X484000 #define LENGTH 64U -class ElementPositionLut : public RegisterChain +class ElementPositionLut : public Register { private: QList _elementPosition; @@ -31,7 +30,7 @@ public: _elementPosition = elementPosition; } - ElementPositionLut(SonoDevice* device, quint32 offset) : RegisterChain(BAR, OFFSET+offset, device, LENGTH) + ElementPositionLut(SonoDevice* device, quint32 offset) : Register(BAR, OFFSET+offset, device, LENGTH) { ADD_UNSIGNED_FIELD(elementPositionPrp, ELEMENT_POSITION_PRP_MASK); } diff --git a/include/model/hardware/core/register/beamFormer/registerDefinition/PulseLut.h b/include/model/hardware/core/register/beamFormer/registerDefinition/PulseLut.h index eb6dcf3..45d31b8 100644 --- a/include/model/hardware/core/register/beamFormer/registerDefinition/PulseLut.h +++ b/include/model/hardware/core/register/beamFormer/registerDefinition/PulseLut.h @@ -1,8 +1,8 @@ #ifndef PULSELUT_H #define PULSELUT_H -#include "model/hardware/core/register/RegisterChain.h" -//#include "model/hardware/core/register/Register.h" + +#include "model/hardware/core/register/Register.h" #include "model/hardware/core/register/RegUtils.h" #undef BAR @@ -26,7 +26,7 @@ struct PulseProperties QList dampingPulseWidth; }; -class PulseLut : public RegisterChain +class PulseLut : public Register { private: PulseProperties* _pulseLut; @@ -60,7 +60,7 @@ public: _pulseLut = pulseLut; } - PulseLut(SonoDevice* device, quint32 offset) : RegisterChain(BAR, OFFSET+offset, device, LENGTH) + PulseLut(SonoDevice* device, quint32 offset) : Register(BAR, OFFSET+offset, device, LENGTH) { ADD_UNSIGNED_FIELD(halfPeriodPrp, HALF_PERIOD_PRP_MASK); ADD_UNSIGNED_FIELD(halfCycleNoPrp, HALF_CYCLE_NO_PRP_MASK); diff --git a/include/model/hardware/core/register/beamFormer/registerDefinition/RxBeamformerLut.h b/include/model/hardware/core/register/beamFormer/registerDefinition/RxBeamformerLut.h index 3827669..1610f6b 100644 --- a/include/model/hardware/core/register/beamFormer/registerDefinition/RxBeamformerLut.h +++ b/include/model/hardware/core/register/beamFormer/registerDefinition/RxBeamformerLut.h @@ -1,8 +1,7 @@ #ifndef RXBEAMFORMERLUT_H #define RXBEAMFORMERLUT_H -#include "model/hardware/core/register/RegisterChain.h" -//#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/Register.h" #include "model/hardware/core/register/RegUtils.h" #undef BAR @@ -22,7 +21,7 @@ struct RxBeamformerProperties QList mla; }; -class RxBeamformerLut : public RegisterChain +class RxBeamformerLut : public Register { private: RxBeamformerProperties* _rxBfLut; @@ -46,7 +45,7 @@ public: _rxBfLut = rxBfLut; } - RxBeamformerLut(SonoDevice* device, quint32 offset) : RegisterChain(BAR, OFFSET+offset, device, LENGTH) + RxBeamformerLut(SonoDevice* device, quint32 offset) : Register(BAR, OFFSET+offset, device, LENGTH) { ADD_UNSIGNED_FIELD(lagPrp, LAG_PRP_MASK); ADD_UNSIGNED_FIELD(apodizationSelPrp, APODIZATION_SEL_PRP_MASK); diff --git a/include/model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.h b/include/model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.h index 60a48b8..dde1759 100644 --- a/include/model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.h +++ b/include/model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.h @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include "registerDefinition/BoardsSpecs.h" #define TRX_ROM_MAX_LEN 131072U @@ -114,7 +114,7 @@ private: struct EepromReq { - quint32 dataIn; + qint32 dataIn; quint32 address; quint32 probeSelect; }*_rom; @@ -159,7 +159,7 @@ private: QTimer* _timer; template - void eepromWrite (QString& str, quint32 addr, quint8 prbSel, T1* request, T2* status); + void eepromWrite (QByteArray& arr, quint32 addr, quint8 prbSel, T1* request, T2* status); template void setEepromWrite (EepromReq* _rom, T3* request); @@ -229,10 +229,10 @@ private: void setSetupCmdDacsOnOff(bool cwd, bool hvb, bool hva) const; void setMpsDacsValue (MpsDacs* _mpsDacs) const; - friend void trxEepromWrite(QString str, quint32 address, BoardsCtrlMngt* boards); - friend void mpsEepromWrite(QString str, quint32 address, BoardsCtrlMngt* boards); - friend void prbCtrlEepromWrite (QString str, quint32 address, BoardsCtrlMngt* boards); - friend void prbEepromWrite (QString str, quint32 address, quint8 prbSel, BoardsCtrlMngt* boards); + friend void trxEepromWrite(QByteArray arr, quint32 address, BoardsCtrlMngt* boards); + friend void mpsEepromWrite(QByteArray arr, quint32 address, BoardsCtrlMngt* boards); + friend void prbCtrlEepromWrite (QByteArray arr, quint32 address, BoardsCtrlMngt* boards); + friend void prbEepromWrite (QByteArray arr, quint32 address, quint8 prbSel, BoardsCtrlMngt* boards); void timerShot (quint16 ms) const; void timerStop (void) const; @@ -281,9 +281,9 @@ public: }; -void trxEepromWrite (QString str, quint32 address, BoardsCtrlMngt* boards); -void mpsEepromWrite (QString str, quint32 address, BoardsCtrlMngt* boards); -void prbCtrlEepromWrite (QString str, quint32 address, BoardsCtrlMngt* boards); -void prbEepromWrite (QString str, quint32 address, quint8 prbSel, BoardsCtrlMngt* boards); +void trxEepromWrite (QByteArray arr, quint32 address, BoardsCtrlMngt* boards); +void mpsEepromWrite (QByteArray arr, quint32 address, BoardsCtrlMngt* boards); +void prbCtrlEepromWrite (QByteArray arr, quint32 address, BoardsCtrlMngt* boards); +void prbEepromWrite (QByteArray arr, quint32 address, quint8 prbSel, BoardsCtrlMngt* boards); #endif // BOARDSCTRLMNGT_H diff --git a/include/model/hardware/core/register/bpiFlash/registerDefinition/McsRdWr.h b/include/model/hardware/core/register/bpiFlash/registerDefinition/McsRdWr.h index 95ee81c..484ef51 100644 --- a/include/model/hardware/core/register/bpiFlash/registerDefinition/McsRdWr.h +++ b/include/model/hardware/core/register/bpiFlash/registerDefinition/McsRdWr.h @@ -1,8 +1,7 @@ #ifndef MCSRDWR_H #define MCSRDWR_H -#include "model/hardware/core/register/RegisterChain.h" -//#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/Register.h" #include "model/hardware/core/register/RegUtils.h" #undef BAR @@ -13,14 +12,14 @@ #define OFFSET 0X8000000 #define MCS_FILE_SIZE 27*1024*1024 // now and must be modified -class McsRdWr : public RegisterChain +class McsRdWr : public Register { private: QList _mcsListWr; void prepareData(quint32 index) override { - masterMcsData->setValue(_mcsListWr.at(static_cast(index))); + masterMcsData->setValue(_mcsListWr[static_cast(index)]); } public: @@ -31,12 +30,12 @@ public: _mcsListWr = mcsList; } - //void receiveData (void) override -// { -// mcsListRd.append(masterMcsData->getValue()); -// } + void receiveData (void) override + { + mcsListRd.append(masterMcsData->getValue()); + } - McsRdWr(SonoDevice* device) : RegisterChain(BAR, OFFSET, device, MCS_FILE_SIZE) + McsRdWr(SonoDevice* device) : Register(BAR, OFFSET, device, MCS_FILE_SIZE) { ADD_UNSIGNED_FIELD(masterMcsData, MASTER_MCS_DATA_MASK); } diff --git a/include/model/hardware/core/register/builtInTest/registerDefinition/BiteDacMemory.h b/include/model/hardware/core/register/builtInTest/registerDefinition/BiteDacMemory.h index bc7733c..62c019e 100644 --- a/include/model/hardware/core/register/builtInTest/registerDefinition/BiteDacMemory.h +++ b/include/model/hardware/core/register/builtInTest/registerDefinition/BiteDacMemory.h @@ -1,8 +1,7 @@ #ifndef BITEDACMEMORY_H #define BITEDACMEMORY_H -#include "model/hardware/core/register/RegisterChain.h" -//#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/Register.h" #include "model/hardware/core/register/RegUtils.h" #undef BAR @@ -21,7 +20,7 @@ struct TxDacMemory }; -class BiteDacMemory : public RegisterChain +class BiteDacMemory : public Register { private: TxDacMemory* _txDacMem; @@ -40,7 +39,7 @@ public: _txDacMem = txDacMem; } - BiteDacMemory(SonoDevice* device) : RegisterChain(BAR, OFFSET, device, LENGTH) + BiteDacMemory(SonoDevice* device) : Register(BAR, OFFSET, device, LENGTH) { ADD_UNSIGNED_FIELD(txDacIData, TxDAC_I_DATA_MASK); ADD_UNSIGNED_FIELD(txDacQData, TxDAC_Q_DATA_MASK); diff --git a/include/model/hardware/core/register/dsp/registerDefinition/AtgcLut.h b/include/model/hardware/core/register/dsp/registerDefinition/AtgcLut.h index 8494867..0278c4f 100644 --- a/include/model/hardware/core/register/dsp/registerDefinition/AtgcLut.h +++ b/include/model/hardware/core/register/dsp/registerDefinition/AtgcLut.h @@ -1,8 +1,7 @@ #ifndef ATGCLUT_H #define ATGCLUT_H -#include "model/hardware/core/register/RegisterChain.h" -//#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/Register.h" #include "model/hardware/core/register/RegUtils.h" #undef BAR @@ -13,7 +12,7 @@ #define OFFSET 0x85000 #define LENGTH 256U -class AtgcLut : public RegisterChain +class AtgcLut : public Register { private: QList _atgcLut; @@ -30,7 +29,7 @@ public: _atgcLut = atgcLut; } - AtgcLut(SonoDevice* device) : RegisterChain(BAR, OFFSET, device, LENGTH) + AtgcLut(SonoDevice* device) : Register(BAR, OFFSET, device, LENGTH) { ADD_UNSIGNED_FIELD(atgcLut, ATGC_LUT_MASK); } diff --git a/include/model/hardware/core/register/dsp/registerDefinition/BlendWeight.h b/include/model/hardware/core/register/dsp/registerDefinition/BlendWeight.h index 66058b8..59ce65a 100644 --- a/include/model/hardware/core/register/dsp/registerDefinition/BlendWeight.h +++ b/include/model/hardware/core/register/dsp/registerDefinition/BlendWeight.h @@ -1,8 +1,7 @@ #ifndef BLENDWEIGHT_H #define BLENDWEIGHT_H -#include "model/hardware/core/register/RegisterChain.h" -//#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/Register.h" #include "model/hardware/core/register/RegUtils.h" #undef BAR @@ -13,7 +12,7 @@ #define OFFSET 0x82000 #define LENGTH 512U -class BlendWeight : public RegisterChain +class BlendWeight : public Register { private: QList _blendWeight; @@ -30,7 +29,7 @@ public: _blendWeight = blendWeight; } - BlendWeight(SonoDevice* device) : RegisterChain(BAR, OFFSET, device, LENGTH) + BlendWeight(SonoDevice* device) : Register(BAR, OFFSET, device, LENGTH) { ADD_UNSIGNED_FIELD(blendWeight, BLEND_WEIGHT_MASK); } diff --git a/include/model/hardware/core/register/dsp/registerDefinition/DtgcLut.h b/include/model/hardware/core/register/dsp/registerDefinition/DtgcLut.h index 5dadf29..040ec44 100644 --- a/include/model/hardware/core/register/dsp/registerDefinition/DtgcLut.h +++ b/include/model/hardware/core/register/dsp/registerDefinition/DtgcLut.h @@ -1,8 +1,7 @@ #ifndef DTGCLUT_H #define DTGCLUT_H -#include "model/hardware/core/register/RegisterChain.h" -//#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/Register.h" #include "model/hardware/core/register/RegUtils.h" #undef BAR @@ -13,7 +12,7 @@ #define OFFSET 0X84000 #define LENGTH 1024U -class DtgcLut : public RegisterChain +class DtgcLut : public Register { private: QList _dtLut; @@ -30,7 +29,7 @@ public: _dtLut = dtLut; } - DtgcLut(SonoDevice* device) : RegisterChain(BAR, OFFSET, device, LENGTH) + DtgcLut(SonoDevice* device) : Register(BAR, OFFSET, device, LENGTH) { ADD_UNSIGNED_FIELD(dtgcLut, DTGC_LUT_MASK); } diff --git a/include/model/hardware/core/register/dsp/registerDefinition/FrequencyLut.h b/include/model/hardware/core/register/dsp/registerDefinition/FrequencyLut.h index be5c66a..f3761d7 100644 --- a/include/model/hardware/core/register/dsp/registerDefinition/FrequencyLut.h +++ b/include/model/hardware/core/register/dsp/registerDefinition/FrequencyLut.h @@ -1,8 +1,7 @@ #ifndef FREQUENCYLUT_H #define FREQUENCYLUT_H -#include "model/hardware/core/register/RegisterChain.h" -//#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/Register.h" #include "model/hardware/core/register/RegUtils.h" #undef BAR @@ -13,7 +12,7 @@ #define OFFSET 0X80800 #define LENGTH 8U -class FrequencyLut : public RegisterChain +class FrequencyLut : public Register { private: QList _fLut; @@ -30,7 +29,7 @@ public: _fLut = fLut; } - FrequencyLut(SonoDevice* device) : RegisterChain(BAR, OFFSET, device, LENGTH) + FrequencyLut(SonoDevice* device) : Register(BAR, OFFSET, device, LENGTH) { ADD_UNSIGNED_FIELD(freqLut, FREQ_LUT_MASK); } diff --git a/include/model/hardware/core/register/dsp/registerDefinition/LineFilterCoefficient.h b/include/model/hardware/core/register/dsp/registerDefinition/LineFilterCoefficient.h index 5b91fac..4f844a7 100644 --- a/include/model/hardware/core/register/dsp/registerDefinition/LineFilterCoefficient.h +++ b/include/model/hardware/core/register/dsp/registerDefinition/LineFilterCoefficient.h @@ -1,8 +1,7 @@ #ifndef LINEFILTERCOEFFICIENT_H #define LINEFILTERCOEFFICIENT_H -#include "model/hardware/core/register/RegisterChain.h" -//#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/Register.h" #include "model/hardware/core/register/RegUtils.h" #undef BAR @@ -14,7 +13,7 @@ #define OFFSET 0x86010 #define LENGTH 2U // 4/2 -class LineFilterCoefficient : public RegisterChain +class LineFilterCoefficient : public Register { private: QList _lineFilterLut; @@ -33,7 +32,7 @@ public: _lineFilterLut = lineFilterLut; } - LineFilterCoefficient(SonoDevice* device) : RegisterChain(BAR, OFFSET, device, LENGTH) + LineFilterCoefficient(SonoDevice* device) : Register(BAR, OFFSET, device, LENGTH) { ADD_UNSIGNED_FIELD(lineFilterLutEven, LINE_FILTER_LUT_EVEN_MASK); ADD_UNSIGNED_FIELD(lineFilterLutOdd , LINE_FILTER_LUT_ODD_MASK ); diff --git a/include/model/hardware/core/register/dsp/registerDefinition/LpfLut.h b/include/model/hardware/core/register/dsp/registerDefinition/LpfLut.h index d68ec52..be1edc8 100644 --- a/include/model/hardware/core/register/dsp/registerDefinition/LpfLut.h +++ b/include/model/hardware/core/register/dsp/registerDefinition/LpfLut.h @@ -1,8 +1,7 @@ #ifndef LPFLUT_H #define LPFLUT_H -#include "model/hardware/core/register/RegisterChain.h" -//#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/Register.h" #include "model/hardware/core/register/RegUtils.h" #undef BAR @@ -13,7 +12,7 @@ #define OFFSET 0x81000 #define LENGTH 48U -class LpfLut : public RegisterChain +class LpfLut : public Register { private: QList _lpfLut; @@ -30,7 +29,7 @@ public: _lpfLut = lpfLut; } - LpfLut(SonoDevice* device) : RegisterChain(BAR, OFFSET, device, LENGTH) + LpfLut(SonoDevice* device) : Register(BAR, OFFSET, device, LENGTH) { ADD_UNSIGNED_FIELD(lpfLut, LPF_LUT_MASK); } diff --git a/include/model/hardware/core/register/dsp/registerDefinition/ReceiverConfigurationLut.h b/include/model/hardware/core/register/dsp/registerDefinition/ReceiverConfigurationLut.h index b37d60e..70fefc7 100644 --- a/include/model/hardware/core/register/dsp/registerDefinition/ReceiverConfigurationLut.h +++ b/include/model/hardware/core/register/dsp/registerDefinition/ReceiverConfigurationLut.h @@ -1,8 +1,7 @@ #ifndef RECEIVERCONFIGURATIONLUT_H #define RECEIVERCONFIGURATIONLUT_H -#include "model/hardware/core/register/RegisterChain.h" -//#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/Register.h" #include "model/hardware/core/register/RegUtils.h" #undef BAR @@ -46,7 +45,7 @@ struct ReceiverConfiguration QList dpeEn; }; -class ReceiverConfigurationLut : public RegisterChain +class ReceiverConfigurationLut : public Register { private: ReceiverConfiguration* _configLut; @@ -116,7 +115,7 @@ public: _configLut = configLut; } - ReceiverConfigurationLut(SonoDevice* device) : RegisterChain(BAR, OFFSET, device, LENGTH) + ReceiverConfigurationLut(SonoDevice* device) : Register(BAR, OFFSET, device, LENGTH) { ADD_UNSIGNED_FIELD(mlaPrp, MLA_PRP_MASK); ADD_UNSIGNED_FIELD(lineModePrp, LINE_MODE_PRP_MASK); diff --git a/include/model/hardware/core/register/dsp/registerDefinition/StbCoefficient.h b/include/model/hardware/core/register/dsp/registerDefinition/StbCoefficient.h index d9891ae..ace6c11 100644 --- a/include/model/hardware/core/register/dsp/registerDefinition/StbCoefficient.h +++ b/include/model/hardware/core/register/dsp/registerDefinition/StbCoefficient.h @@ -1,8 +1,7 @@ #ifndef STBCOEFFICIENT_H #define STBCOEFFICIENT_H -#include "model/hardware/core/register/RegisterChain.h" -//#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/Register.h" #include "model/hardware/core/register/RegUtils.h" #undef BAR @@ -14,7 +13,7 @@ #define OFFSET 0x86000 #define LENGTH 4U // 8/2 -class StbCoefficient : public RegisterChain +class StbCoefficient : public Register { private: QList _stbLut; @@ -33,7 +32,7 @@ public: _stbLut = stbLut; } - StbCoefficient(SonoDevice* device) : RegisterChain(BAR, OFFSET, device, LENGTH) + StbCoefficient(SonoDevice* device) : Register(BAR, OFFSET, device, LENGTH) { ADD_UNSIGNED_FIELD(stbLutEven, STB_LUT_EVEN_MASK); ADD_UNSIGNED_FIELD(stbLutOdd , STB_LUT_ODD_MASK ); diff --git a/include/model/hardware/core/register/fpgaProgram/FpgaProgram.h b/include/model/hardware/core/register/fpgaProgram/FpgaProgram.h index 4ce3dfd..9a8d5ef 100644 --- a/include/model/hardware/core/register/fpgaProgram/FpgaProgram.h +++ b/include/model/hardware/core/register/fpgaProgram/FpgaProgram.h @@ -4,6 +4,8 @@ #include #include #include +#include + #include "registerDefinition/SlaveFpgaNumber.h" #include "registerDefinition/SerialProgramData.h" #include "registerDefinition/SerialProgramStatus.h" diff --git a/mainwindow.cpp b/mainwindow.cpp index d9e4cf5..d737658 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -17,6 +17,9 @@ MainWindow::MainWindow(QWidget *parent) _healStatus = new HealthStatus; _rxBfPrp = new RxBeamformerProperties; _bCtrl = new BoardsCtrlMngt (_usd->device); + + _supRbValue = new SupervisorRbValue; + _faultStatus = new MpsFaultStatus; // _dial = new WaitDialog(); // _dial->setModal(true); @@ -76,19 +79,19 @@ MainWindow::MainWindow(QWidget *parent) // ui->btn_txDacStartStop->setText(START); // ui->btn_txDacOnOff->setText(ON); // ui->btn_HVOnOff->setText(HV_ON); - ui->btn_motorOnOff->setText(MOTOR_ON); - ui->btn_pwr1OnOff->setText(PWR1_ON); - ui->btn_pwr2OnOff->setText(PWR2_ON); - ui->btn_pwr3OnOff->setText(PWR3_ON); - ui->btn_pwr4OnOff->setText(PWR4_ON); +// ui->btn_motorOnOff->setText(MOTOR_ON); +// ui->btn_pwr1OnOff->setText(PWR1_ON); +// ui->btn_pwr2OnOff->setText(PWR2_ON); +// ui->btn_pwr3OnOff->setText(PWR3_ON); +// ui->btn_pwr4OnOff->setText(PWR4_ON); 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_pwrDacsEnable->setText(VALID); +// ui->btn_pwrDacsEnable->setText(VALID); ui->btn_hvRegulatorConfig->setText(ENABLE); ui->btn_pm5RegulatorConfig->setText(ENABLE); - ui->btn_DacsOnOff->setText(DACS_ENABLE); +// ui->btn_DacsOnOff->setText(DACS_ENABLE); ui->btn_updateRdbackValue->setText(UPDATE); // ui->btn_dmaStart_2->setText(START); // ui->btn_dmaStop_2->setVisible(false); @@ -1143,6 +1146,43 @@ void MainWindow::newMessage(QString message) // } //} +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"); + } + else + { + _trx.scenPlayerStop(); + ui->btn_scenStart->setText("Scenario Start"); + } + } + catch(SonoException& e) + { + qDebug(e.what()); + } +} + ///*************************************************************************************************/ //void MainWindow::on_btn_scenarioPauseResume_clicked() //{ @@ -1169,6 +1209,7 @@ void MainWindow::newMessage(QString message) // } //} + ///*************************************************************************************************/ //void MainWindow::on_btn_txDacBrowse_clicked() //{ @@ -1865,8 +1906,6 @@ const QString MainWindow::enum2String(ePg state) const //// pwr.setDAcs(true, cwdValue, hvbValue, hvaValue); //// pwr.setDAcs(false, cwdValue, hvbValue, hvaValue); -// _trx.mpsSetAo(hvaValue, hvbValue); - //// i2cDone=pwr.getI2cCmdDone(); //// while (i2cDone==false){ //// i2cDone=pwr.getI2cCmdDone(); @@ -1879,6 +1918,14 @@ const QString MainWindow::enum2String(ePg state) const //// ui->tb_cwdDacValue->setText(QString::number(real_CWdValue, 'f', 2)); //} +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); +} + ///*************************************************************************************************/ //void MainWindow::on_btn_DacsOnOff_clicked() //{ @@ -1923,295 +1970,293 @@ const QString MainWindow::enum2String(ePg state) const //} ///*************************************************************************************************/ -//void MainWindow::on_chk_sup24v_stateChanged(int arg1) -//{ -// bool i2cBusy, i2cDone; - -//// i2cBusy=pwr.getI2cBusy(); -//// while (i2cBusy==true) { -//// i2cBusy=pwr.getI2cBusy(); -//// } -// if (ui->chk_sup24v->isChecked()) -// { -//// i2cBusy=pwr.getI2cBusy(); -//// while (i2cBusy==true) { -//// i2cBusy=pwr.getI2cBusy(); -//// } -//// // delay (100); - -// _trx.init(); // p24_On -//// i2cDone=pwr.getI2cCmdDone(); -//// while (i2cDone==false){ -//// i2cDone=pwr.getI2cCmdDone(); -//// } -// } - -// else -// { -//// i2cBusy=pwr.getI2cBusy(); -//// while (i2cBusy==true) { -//// i2cBusy=pwr.getI2cBusy(); -//// } -//// // delay (100); - -//// pwr.setSetupCmdP24vOnOff(false); // p24_Off -//// i2cDone=pwr.getI2cCmdDone(); -//// while (i2cDone==false){ -//// i2cDone=pwr.getI2cCmdDone(); -//// } -// } +void MainWindow::on_chk_initBoards_clicked() +{ + // bool i2cBusy, i2cDone; + // i2cBusy=pwr.getI2cBusy(); + // while (i2cBusy==true) { + // i2cBusy=pwr.getI2cBusy(); + // } -//} + if (ui->chk_initBoards->isChecked()) + { + // i2cBusy=pwr.getI2cBusy(); + // while (i2cBusy==true) { + // i2cBusy=pwr.getI2cBusy(); + // } + // // delay (100); + + _trx.init(); // p24_On + // i2cDone=pwr.getI2cCmdDone(); + // while (i2cDone==false){ + // i2cDone=pwr.getI2cCmdDone(); + // } + } + else + { + // i2cBusy=pwr.getI2cBusy(); + // while (i2cBusy==true) { + // i2cBusy=pwr.getI2cBusy(); + // } + // // delay (100); + + // pwr.setSetupCmdP24vOnOff(false); // p24_Off + // i2cDone=pwr.getI2cCmdDone(); + // while (i2cDone==false){ + // i2cDone=pwr.getI2cCmdDone(); + // } + } +} ///*************************************************************************************************/ -//void MainWindow::on_btn_supJump_clicked() -//{ -//// bool i2cBusy, i2cDone; +void MainWindow::on_btn_supJump_clicked() +{ +// bool i2cBusy, i2cDone; -//// i2cBusy=pwr.getI2cBusy(); -//// while (i2cBusy==true) { -//// i2cBusy=pwr.getI2cBusy(); -//// } +// i2cBusy=pwr.getI2cBusy(); +// while (i2cBusy==true) { +// i2cBusy=pwr.getI2cBusy(); +// } -//// pwr.setSetupCmdJmp(true); // jump -//// pwr.setSetupCmdJmp(false); +// pwr.setSetupCmdJmp(true); // jump +// pwr.setSetupCmdJmp(false); -//// i2cDone=pwr.getI2cCmdDone(); -//// while (i2cDone==false){ -//// i2cDone=pwr.getI2cCmdDone(); -//// } -// _trx.mpsReset(); -//} +// i2cDone=pwr.getI2cCmdDone(); +// while (i2cDone==false){ +// i2cDone=pwr.getI2cCmdDone(); +// } + _trx.mpsReset(); +} /*************************************************************************************************/ void MainWindow::on_btn_updateRdbackValue_clicked() { - _trx.supervisorRbValue(supRbValue); + _trx.supervisorRbValue(_supRbValue); - auto hvapValue=supRbValue->hvap; + auto hvapValue=_supRbValue->hvap; ui->l_hvap->setText(QString::number(hvapValue, 'f', 3)); delay(10); - auto hvbpValue=supRbValue->hvbp; + auto hvbpValue=_supRbValue->hvbp; ui->l_hvbp->setText(QString::number(hvbpValue, 'f', 3)); delay(10); - auto cwdpValue=supRbValue->cwdp; + auto cwdpValue=_supRbValue->cwdp; ui->l_cwdp->setText(QString::number(cwdpValue, 'f', 3)); delay(10); - auto curr24vValue=supRbValue->curr24V; + auto curr24vValue=_supRbValue->curr24V; ui->l_curr24v->setText(QString::number(curr24vValue, 'f', 3)); delay(10); - auto p24vValue=supRbValue->p24V; + auto p24vValue=_supRbValue->p24V; ui->l_p24v->setText(QString::number(p24vValue, 'f', 3)); delay(10); - auto p12vValue=supRbValue->p12V; + auto p12vValue=_supRbValue->p12V; ui->l_p12v->setText(QString::number(p12vValue, 'f', 3)); delay(10); - auto p5vValue=supRbValue->p5V; + auto p5vValue=_supRbValue->p5V; ui->l_p5v->setText(QString::number(p5vValue, 'f', 3)); delay(10); - auto m5vValue=supRbValue->m5V; + auto m5vValue=_supRbValue->m5V; ui->l_m5v->setText(QString::number(m5vValue, 'f', 3)); delay(10); - auto hvStopValue=supRbValue->hvStop; + auto hvStopValue=_supRbValue->hvStop; ui->l_hvStop->setText(QString::number(hvStopValue, 'f', 3)); delay(10); - auto p4dValue=supRbValue->p4D; + auto p4dValue=_supRbValue->p4D; ui->l_p4d->setText(QString::number(p4dValue, 'f', 3)); delay(10); /********************Faults***********************/ - _trx.mpsFaultStatus(faultStatus); + _trx.mpsFaultStatus(_faultStatus); - bool hvapFlt=faultStatus->hvap; + bool hvapFlt=_faultStatus->hvap; ui->l_hvapFlt->setText(QVariant(hvapFlt).toString()); auto colorHvapFlt = hvapFlt ? Qt::red : Qt::green; changeLabelTextColor(ui->l_hvapFlt, colorHvapFlt); delay(10); - bool hvbpFlt=faultStatus->hvbp; + bool hvbpFlt=_faultStatus->hvbp; ui->l_hvbpFlt->setText(QVariant(hvbpFlt).toString()); auto colorHvbpFlt = hvbpFlt ? Qt::red : Qt::green; changeLabelTextColor(ui->l_hvbpFlt, colorHvbpFlt); delay(10); - bool cwdpFlt=faultStatus->cwdp; + bool cwdpFlt=_faultStatus->cwdp; ui->l_cwdFlt->setText(QVariant(cwdpFlt).toString()); auto colorCwdpFlt = cwdpFlt ? Qt::red : Qt::green; changeLabelTextColor(ui->l_cwdFlt, colorCwdpFlt); delay(10); - bool cur24vFlt=faultStatus->curr24V; + bool cur24vFlt=_faultStatus->curr24V; ui->l_curr24vFlt->setText(QVariant(cur24vFlt).toString()); auto colorCur24vFlt = cur24vFlt ? Qt::red : Qt::green; changeLabelTextColor(ui->l_curr24vFlt, colorCur24vFlt); delay(10); - bool p24vFlt=faultStatus->p24v; + bool p24vFlt=_faultStatus->p24v; ui->l_p24vFlt->setText(QVariant(p24vFlt).toString()); auto colorP24vFlt = p24vFlt ? Qt::red : Qt::green; changeLabelTextColor(ui->l_p24vFlt, colorP24vFlt); delay(10); - bool p12vFlt=faultStatus->p12v; + bool p12vFlt=_faultStatus->p12v; ui->l_p12vFlt->setText(QVariant(p12vFlt).toString()); auto colorP12vFlt = p12vFlt ? Qt::red : Qt::green; changeLabelTextColor(ui->l_p12vFlt, colorP12vFlt); delay(10); - bool p5vFlt=faultStatus->p5v; + bool p5vFlt=_faultStatus->p5v; ui->l_p5vFlt->setText(QVariant(p5vFlt).toString()); auto colorP5vFlt = p5vFlt ? Qt::red : Qt::green; changeLabelTextColor(ui->l_p5vFlt, colorP5vFlt); delay(10); - bool m5vFlt=faultStatus->m5v; + bool m5vFlt=_faultStatus->m5v; ui->l_m5vFlt->setText(QVariant(m5vFlt).toString()); auto colorM5vFlt = m5vFlt ? Qt::red : Qt::green; changeLabelTextColor(ui->l_m5vFlt, colorM5vFlt); delay(10); - bool hvFlt=faultStatus->hvError; + bool hvFlt=_faultStatus->hvError; ui->l_hvFlt->setText(QVariant(hvFlt).toString()); auto colorHvFlt = hvFlt ? Qt::red : Qt::green; changeLabelTextColor(ui->l_hvFlt, colorHvFlt); delay(10); - bool sup4dFlt=faultStatus->sup4d; + bool sup4dFlt=_faultStatus->sup4d; ui->l_p4dFlt->setText(QVariant(sup4dFlt).toString()); auto colorP4dFlt = sup4dFlt ? Qt::red : Qt::green; changeLabelTextColor(ui->l_p4dFlt, colorP4dFlt); delay(10); /******************Faults_Over*********************/ - bool ovrHvapFlt=faultStatus->overHvap; + bool ovrHvapFlt=_faultStatus->overHvap; ui->l_ovrHVapFlt->setText(QVariant(ovrHvapFlt).toString()); auto colorOvrHvapFlt = ovrHvapFlt ? Qt::red : Qt::green; changeLabelTextColor(ui->l_ovrHVapFlt, colorOvrHvapFlt); delay(10); - bool ovrHvbpFlt=faultStatus->overHvbp; + bool ovrHvbpFlt=_faultStatus->overHvbp; ui->l_ovrHVbpFlt->setText(QVariant(ovrHvbpFlt).toString()); auto colorOvrHvbpFlt = ovrHvbpFlt ? Qt::red : Qt::green; changeLabelTextColor(ui->l_ovrHVbpFlt, colorOvrHvbpFlt); delay(10); - bool ovrCwdpFlt=faultStatus->overCwdp; + bool ovrCwdpFlt=_faultStatus->overCwdp; ui->l_ovrCWdpFlt->setText(QVariant(ovrCwdpFlt).toString()); auto colorOvrCwdpFlt = ovrCwdpFlt ? Qt::red : Qt::green; changeLabelTextColor(ui->l_ovrCWdpFlt, colorOvrCwdpFlt); delay(10); - bool ovrCur24vFlt=faultStatus->overCurr24V; + bool ovrCur24vFlt=_faultStatus->overCurr24V; ui->l_ovrCur24vFlt->setText(QVariant(ovrCur24vFlt).toString()); auto colorOvrCur24vFlt = ovrCur24vFlt ? Qt::red : Qt::green; changeLabelTextColor(ui->l_ovrCur24vFlt, colorOvrCur24vFlt); delay(10); - bool ovrP24vFlt=faultStatus->overP24v; + bool ovrP24vFlt=_faultStatus->overP24v; ui->l_ovrP24vFlt->setText(QVariant(ovrP24vFlt).toString()); auto colorOvrP24vFlt = ovrP24vFlt ? Qt::red : Qt::green; changeLabelTextColor(ui->l_ovrP24vFlt, colorOvrP24vFlt); delay(10); - bool ovrP12vFlt=faultStatus->overP12v; + bool ovrP12vFlt=_faultStatus->overP12v; ui->l_ovrP12vFlt->setText(QVariant(ovrP12vFlt).toString()); auto colorOvrP12vFlt = ovrP12vFlt ? Qt::red : Qt::green; changeLabelTextColor(ui->l_ovrP12vFlt, colorOvrP12vFlt); delay(10); - bool ovrP5vFlt=faultStatus->overP5v; + bool ovrP5vFlt=_faultStatus->overP5v; ui->l_ovrP5vFlt->setText(QVariant(ovrP5vFlt).toString()); auto colorOvrP5vFlt = ovrP5vFlt ? Qt::red : Qt::green; changeLabelTextColor(ui->l_ovrP5vFlt, colorOvrP5vFlt); delay(10); - bool ovrM5vFlt=faultStatus->overM5v; + bool ovrM5vFlt=_faultStatus->overM5v; ui->l_ovrM5vFlt->setText(QVariant(ovrM5vFlt).toString()); auto colorOvrM5vFlt = ovrM5vFlt ? Qt::red : Qt::green; changeLabelTextColor(ui->l_ovrM5vFlt, colorOvrM5vFlt); delay(10); - bool ovrHvFlt=faultStatus->overHvError; + bool ovrHvFlt=_faultStatus->overHvError; ui->l_ovrHvFlt->setText(QVariant(ovrHvFlt).toString()); auto colorOvrHvFlt = ovrHvFlt ? Qt::red : Qt::green; changeLabelTextColor(ui->l_ovrHvFlt, colorOvrHvFlt); delay(10); - bool ovrSup4dFlt=faultStatus->overSup4d; + bool ovrSup4dFlt=_faultStatus->overSup4d; ui->l_ovr4dFlt->setText(QVariant(ovrSup4dFlt).toString()); auto colorOvrP4dFlt = ovrSup4dFlt ? Qt::red : Qt::green; changeLabelTextColor(ui->l_ovr4dFlt, colorOvrP4dFlt); delay(10); /******************Faults_Under*********************/ - bool udrHvapFlt=faultStatus->underHvap; + bool udrHvapFlt=_faultStatus->underHvap; ui->l_udrHVapFlt->setText(QVariant(udrHvapFlt).toString()); auto colorUdrHvapFlt = udrHvapFlt ? Qt::red : Qt::green; changeLabelTextColor(ui->l_udrHVapFlt, colorUdrHvapFlt); delay(10); - bool udrHvbpFlt=faultStatus->underHvbp; + bool udrHvbpFlt=_faultStatus->underHvbp; ui->l_udrHVbpFlt->setText(QVariant(udrHvbpFlt).toString()); auto colorUdrHvbpFlt = udrHvbpFlt ? Qt::red : Qt::green; changeLabelTextColor(ui->l_udrHVbpFlt, colorUdrHvbpFlt); delay(10); - bool udrCwdpFlt=faultStatus->underCwdp; + bool udrCwdpFlt=_faultStatus->underCwdp; ui->l_udrCWdpFlt->setText(QVariant(udrCwdpFlt).toString()); auto colorUdrCwdpFlt = udrCwdpFlt ? Qt::red : Qt::green; changeLabelTextColor(ui->l_udrCWdpFlt, colorUdrCwdpFlt); delay(10); - bool udrCur24vFlt=faultStatus->underCurr24V; + bool udrCur24vFlt=_faultStatus->underCurr24V; ui->l_udrCurr24vFlt->setText(QVariant(udrCur24vFlt).toString()); auto colorUdrCur24vFlt = udrCur24vFlt ? Qt::red : Qt::green; changeLabelTextColor(ui->l_udrCurr24vFlt, colorUdrCur24vFlt); delay(10); - bool udrP24vFlt=faultStatus->underP24v; + bool udrP24vFlt=_faultStatus->underP24v; ui->l_udrP24vFlt->setText(QVariant(udrP24vFlt).toString()); auto colorUdrP24vFlt = udrP24vFlt ? Qt::red : Qt::green; changeLabelTextColor(ui->l_udrP24vFlt, colorUdrP24vFlt); delay(10); - bool udrP12vFlt=faultStatus->underP12v; + bool udrP12vFlt=_faultStatus->underP12v; ui->l_udrP12vFlt->setText(QVariant(udrP12vFlt).toString()); auto colorUdrP12vFlt = udrP12vFlt ? Qt::red : Qt::green; changeLabelTextColor(ui->l_udrP12vFlt, colorUdrP12vFlt); delay(10); - bool udrP5vFlt=faultStatus->underP5v; + bool udrP5vFlt=_faultStatus->underP5v; ui->l_udrP5vFlt->setText(QVariant(udrP5vFlt).toString()); auto colorUdrP5vFlt = udrP5vFlt ? Qt::red : Qt::green; changeLabelTextColor(ui->l_udrP5vFlt, colorUdrP5vFlt); delay(10); - bool udrM5vFlt=faultStatus->underM5v; + bool udrM5vFlt=_faultStatus->underM5v; ui->l_udrM5vFlt->setText(QVariant(udrM5vFlt).toString()); auto colorUdrM5vFlt = udrM5vFlt ? Qt::red : Qt::green; changeLabelTextColor(ui->l_udrM5vFlt, colorUdrM5vFlt); delay(10); - bool udrHvFlt=faultStatus->underHvError; + bool udrHvFlt=_faultStatus->underHvError; ui->l_udrHvFlt->setText(QVariant(udrHvFlt).toString()); auto colorUdrHvFlt = udrHvFlt ? Qt::red : Qt::green; changeLabelTextColor(ui->l_udrHvFlt, colorUdrHvFlt); delay(10); - bool udrSup4dFlt=faultStatus->underSup4d; + bool udrSup4dFlt=_faultStatus->underSup4d; ui->l_udr4dFlt->setText(QVariant(udrSup4dFlt).toString()); auto colorUdrP4dFlt = udrSup4dFlt ? Qt::red : Qt::green; changeLabelTextColor(ui->l_udr4dFlt, colorUdrP4dFlt); @@ -2888,10 +2933,15 @@ void MainWindow::on_btn_setAtgcMode_clicked() void MainWindow::on_btn_trxRomWrite_clicked() { + QByteArray arr; + arr.clear(); + QString txtStr = ui->tb_trxRomWrite->toPlainText(); try { - QString txtStr = ui->tb_trxRomWrite->toPlainText(); - trxEepromWrite(txtStr, 0, _bCtrl); + foreach (auto i, txtStr){ + arr.append(i.toLatin1()); + } + trxEepromWrite(arr, 0, _bCtrl); } catch (SonoException& e) { @@ -2934,10 +2984,15 @@ void MainWindow::on_btn_trxRomInfoRead_clicked() void MainWindow::on_btn_mpsRomWrite_clicked() { + QByteArray arr; + arr.clear(); + QString txtStr = ui->tb_mpsRomWrite->toPlainText(); try { - QString txtStr = ui->tb_mpsRomWrite->toPlainText(); - mpsEepromWrite(txtStr, 0, _bCtrl); + foreach (auto i, txtStr){ + arr.append(i.toLatin1()); + } + mpsEepromWrite(arr, 0, _bCtrl); } catch (SonoException& e) { @@ -2980,10 +3035,15 @@ void MainWindow::on_btn_mpsRomInfoRead_clicked() void MainWindow::on_btn_prbCtrlRomWrite_clicked() { + QByteArray arr; + arr.clear(); + QString txtStr = ui->tb_prbCtrlRomWrite->toPlainText(); try { - QString txtStr = ui->tb_prbCtrlRomWrite->toPlainText(); - prbCtrlEepromWrite(txtStr, 0, _bCtrl); + foreach (auto i, txtStr){ + arr.append(i.toLatin1()); + } + prbCtrlEepromWrite(arr, 0, _bCtrl); } catch (SonoException& e) { @@ -3026,11 +3086,16 @@ void MainWindow::on_btn_prbCtrlRomInfoRead_clicked() void MainWindow::on_btn_prbRomWrite_clicked() { + QByteArray arr; + arr.clear(); + auto sel = ui->cb_prbSelRom->currentIndex(); + QString txtStr = ui->tb_prbRomWrite->toPlainText(); try { - auto sel = ui->cb_prbSelRom->currentIndex(); - QString txtStr = ui->tb_prbRomWrite->toPlainText(); - prbEepromWrite(txtStr, 0, static_cast(sel), _bCtrl); + foreach (auto i, txtStr){ + arr.append(i.toLatin1()); + } + prbEepromWrite(arr, 0, static_cast(sel), _bCtrl); } catch (SonoException& e) { @@ -3061,8 +3126,8 @@ void MainWindow::on_btn_prbRomInfoRead_clicked() try { auto sel = ui->cb_prbSelRom->currentIndex(); - QString infoStr = _trx.prbInfo(static_cast(sel)); - ui->tb_prbRomInfoRead->setText(infoStr); + QByteArray arr = _trx.prbInfo(static_cast(sel)); + ui->tb_prbRomInfoRead->setText(QString(arr)); } catch (SonoException& e) { @@ -3239,3 +3304,4 @@ void MainWindow::on_btn_afeLut_clicked() changeLabelTextColor(ui->l_afeLut, Qt::green); } + diff --git a/mainwindow.h b/mainwindow.h index a103b35..5334d70 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -104,9 +104,9 @@ private: BoardsCtrlMngt* _bCtrl; - SupervisorRbValue* supRbValue; + SupervisorRbValue* _supRbValue; - MpsFaultStatus* faultStatus; + MpsFaultStatus* _faultStatus; HealthStatus* _healStatus; @@ -243,10 +243,11 @@ private slots: void on_btn_updateRdbackValue_clicked(); -// void on_btn_supJump_clicked(); + void on_btn_supJump_clicked(); -// void on_chk_sup24v_stateChanged(int arg1); + void on_btn_setAo_clicked(); + void on_chk_initBoards_clicked(); // void on_btn_dmaStart_2_clicked(); @@ -379,6 +380,10 @@ private slots: void on_btn_afeLut_clicked(); + + void on_btn_scenStart_clicked(); + + signals: // void updateBlockProgressValue(int percentage, QProgressBar* prg); // void updateFpgaProgressValue(int percentage); diff --git a/mainwindow.ui b/mainwindow.ui index 511fb49..683c1a1 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -7,7 +7,7 @@ 0 0 854 - 947 + 907 @@ -27,7 +27,7 @@ - 3 + 0 @@ -361,7 +361,7 @@ 60 70 - 76 + 128 17 @@ -369,7 +369,7 @@ - done: + Programming: @@ -397,6 +397,64 @@ + + + Scen Player + + + + + 20 + 10 + 190 + 58 + + + + + + + + + Start Idx: + + + + + + + + + + + + + + End Idx: + + + + + + + + + + + + + + 230 + 20 + 94 + 23 + + + + Scenario Start + + + DSP Setting @@ -782,7 +840,7 @@ - BeamFormer + BeamFormer Setting @@ -1621,7 +1679,7 @@ - 230 + 240 50 16 111 @@ -1766,7 +1824,7 @@ 140 90 - 80 + 101 23 @@ -2017,8 +2075,8 @@ - 720 - 50 + 700 + 60 91 23 @@ -2030,8 +2088,8 @@ - 720 - 70 + 700 + 90 81 17 @@ -2043,8 +2101,8 @@ - 720 - 90 + 700 + 110 81 17 @@ -2056,8 +2114,8 @@ - 720 - 110 + 700 + 130 81 17 @@ -2069,8 +2127,8 @@ - 720 - 130 + 700 + 150 81 17 @@ -2219,7 +2277,7 @@ 0 510 821 - 101 + 61 @@ -2234,106 +2292,11 @@ false - - - - 0 - 60 - 111 - 17 - - - - Selected probe: - - - - - - 510 - 60 - 83 - 25 - - - - PushButton - - - - - - 670 - 60 - 83 - 25 - - - - PushButton - - - 220 - 60 - 83 - 25 - - - - PushButton - - - - - - 590 - 60 - 83 - 25 - - - - PushButton - - - - - - 110 - 60 - 101 - 25 - - - - - A - - - - - B - - - - - C - - - - - D - - - - - - - 430 - 60 + 390 + 30 83 25 @@ -2345,8 +2308,8 @@ - 310 - 60 + 470 + 30 83 25 @@ -2381,12 +2344,55 @@ + + + + 230 + 30 + 142 + 25 + + + + + + + Selected probe: + + + + + + + + A + + + + + B + + + + + C + + + + + D + + + + + + 0 - 610 + 570 821 321 @@ -2518,25 +2524,6 @@ - - - - 430 - 70 - 91 - 31 - - - - - - - Valid - - - - - @@ -3593,58 +3580,6 @@ - - - - 710 - 210 - 143 - 21 - - - - - - - cmd_error: - - - - - - - Unknown - - - - - - - - - 710 - 240 - 144 - 21 - - - - - - - cmd_done: - - - - - - - Unknown - - - - - @@ -3700,59 +3635,46 @@ - + - 550 - 70 - 261 - 31 + 730 + 110 + 75 + 23 - - - - - DACs_OnOff: - - - - - - - - - - Dacs_Enable - - - - + + Reset MPS + - + - 710 - 120 - 41 - 25 + 730 + 70 + 75 + 17 + + <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">PrbCtrl and MPS</span></p></body></html> + - JMP + Init Boards - + - 760 - 120 - 51 + 440 + 70 + 75 23 - 24V + Set Ao diff --git a/src/model/hardware/core/TrxBoard.cpp b/src/model/hardware/core/TrxBoard.cpp index 75ee9a2..86df955 100644 --- a/src/model/hardware/core/TrxBoard.cpp +++ b/src/model/hardware/core/TrxBoard.cpp @@ -246,8 +246,6 @@ void TrxBoard::setSwapVector() TrxBoard::TrxBoard() : _offsetSlave0(0), _offsetSlave1(0x400000), _offsetSlave2(0x800000) { - _run = true; - _device.init(); _beamFormerSlave0 = new BeamFormer (&_device, _offsetSlave0); _beamFormerSlave1 = new BeamFormer (&_device, _offsetSlave1); @@ -263,8 +261,12 @@ TrxBoard::TrxBoard() : _offsetSlave0(0), _offsetSlave1(0x400000), _offsetSlave2( _adc = new AdcVoltages(); _pg = new VoltagesPg(); - setSwapVector(); + _allow = false; + + _run = true; + _device.init(); + /*************************************************************************************************/ /*************************************************************************************************/ @@ -429,13 +431,18 @@ void TrxBoard::setBeamFormerMode(eClkMode mode) const this->_clkDistributer->clockMode(CLOCK_DIVISION, mode); } -void TrxBoard::setScenPlayerIndex(quint32 &startIdx, quint32 &endIdx) const +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(bool start) const +void TrxBoard::scenPlayerStart(void) const { if (_allow) { @@ -449,17 +456,17 @@ void TrxBoard::scenPlayerStart(bool start) const } - this->_scenPlayer->control.command(start); + this->_scenPlayer->control.command(true); } -void TrxBoard::scenPlayerPause(bool pause) const -{ - this->_scenPlayer->control.pause(pause); -} +//void TrxBoard::scenPlayerPause(bool pause) const +//{ +// this->_scenPlayer->control.pause(pause); +//} -void TrxBoard::scenPlayerStop(bool stop) const +void TrxBoard::scenPlayerStop(void) const { - this->_scenPlayer->control.command(!stop); + this->_scenPlayer->control.command(false); } @@ -499,28 +506,32 @@ quint32 TrxBoard::prbId(quint8 prbSel) const return byteArray2Uint32BigEndian(id); } -QList TrxBoard::getConnectedPrbId() const +void TrxBoard::getConnectedPrbId(ConnectedPrbId* prbId) const { - QList list; QVector vec; QByteArray id; - list.clear(); vec.clear(); id.clear(); + vec = this->_bCtrlMngt->getConnectedPrb(); for (quint8 i=0; i < vec.size(); i++) { if (vec.at(i)) - { id = this->_bCtrlMngt->prbEepromRead(EEPROM_ID_BYTE_BEGIN, EEPROM_ID_BYTE_NUMBER, i); - list.append(byteArray2Uint32BigEndian(id)); - } else - list.append(0); + id.append(nullptr); + + switch (i) + { + case 0: prbId->prbA = byteArray2Uint32BigEndian(id);break; + case 1: prbId->prbB = byteArray2Uint32BigEndian(id);break; + case 2: prbId->prbC = byteArray2Uint32BigEndian(id);break; + case 3: prbId->prbD = byteArray2Uint32BigEndian(id);break; + } + } - return list; } QString TrxBoard::trxInfo() const @@ -541,35 +552,37 @@ QString TrxBoard::prbCtrlInfo() const return str; } -QString TrxBoard::prbInfo(quint8 prbSel) const +QByteArray TrxBoard::prbInfo(quint8 prbSel) const { - QString str = QString(this->_bCtrlMngt->prbEepromRead(EEPROM_INFO_BYTE_BEGIN, EEPROM_INFO_BYTE_NUMBER, prbSel)); - return str; + return this->_bCtrlMngt->prbEepromRead(EEPROM_INFO_BYTE_BEGIN, EEPROM_INFO_BYTE_NUMBER, prbSel); } -QList TrxBoard::getConnectedPrbInfo() const +void TrxBoard::getConnectedPrbInfo(ConnectedPrbInfo* prbInfo) const { - QList list; + QByteArray info; QVector vec; - QString str; - list.clear(); + info.clear(); vec.clear(); - str.clear(); vec = this->_bCtrlMngt->getConnectedPrb(); for (quint8 i=0; i < vec.size(); i++) { if (vec.at(i)) + info = this->_bCtrlMngt->prbEepromRead(EEPROM_INFO_BYTE_BEGIN, EEPROM_INFO_BYTE_NUMBER, i); + else + info.append(nullptr); + + switch (i) { - str = QString(this->_bCtrlMngt->prbEepromRead(EEPROM_INFO_BYTE_BEGIN, EEPROM_INFO_BYTE_NUMBER, i)); - list.append(str); + case 0: prbInfo->prbA = info;break; + case 1: prbInfo->prbB = info;break; + case 2: prbInfo->prbC = info;break; + case 3: prbInfo->prbD = info;break; } - else - list.append("NULL"); + } - return list; } diff --git a/src/model/hardware/core/register/Register.cpp b/src/model/hardware/core/register/Register.cpp index dc9cf1e..fdb778a 100644 --- a/src/model/hardware/core/register/Register.cpp +++ b/src/model/hardware/core/register/Register.cpp @@ -1,13 +1,10 @@ #include "model/hardware/core/register/Register.h" -#include - -//Register::Register(quint8 bar, quint32 offset, SonoDevice *device, quint32 arrayLength) -Register::Register(quint8 bar, quint32 offset, SonoDevice *device) +Register::Register(quint8 bar, quint32 offset, SonoDevice *device, quint32 arrayLength) { _bar = bar; _offset = offset; - // _arrayLength = arrayLength; + _arrayLength = arrayLength; _device = device; } @@ -69,7 +66,7 @@ void Register::upadteArray() //update array register { for(quint32 i = 0; i < _arrayLength; i++) { -// prepareData(i); + prepareData(i); auto value = 0; for(auto j = 0; j < _fields.length(); j++) @@ -101,7 +98,7 @@ void Register::syncArray() _fields[i]->updateValue(value); } - // receiveData(); + receiveData(); } } diff --git a/src/model/hardware/core/register/RegisterChain.cpp b/src/model/hardware/core/register/RegisterChain.cpp deleted file mode 100644 index cc8b539..0000000 --- a/src/model/hardware/core/register/RegisterChain.cpp +++ /dev/null @@ -1,104 +0,0 @@ -#include "model/hardware/core/register/RegisterChain.h" - -RegisterChain::RegisterChain(quint8 bar, quint32 offset, SonoDevice *device, quint32 arrayLength) -{ - _bar = bar; - _offset = offset; - _arrayLength = arrayLength; - _device = device; -} - -RegisterChain::~RegisterChain() -{ - for(auto i = 0; i < _fields.length(); i++) - { - delete _fields[i]; - } - _fields.clear(); -} - -quint32 RegisterChain::getValue() -{ - return _value; -} - -void RegisterChain::setValue(quint32 value) -{ - if(_value == value) - { - return; - } - - _value = value; - _isUpdated = true; -} - -void RegisterChain::changeOffset(quint32 offset) -{ - _offset = offset; -} - -quint32 RegisterChain::getCurrentOffset() const -{ - return _offset; -} - -bool RegisterChain::isUpdated() -{ - auto temp = _isUpdated; - _isUpdated = false; - - return temp; -} - -void RegisterChain::update() //update single RegisterChain -{ - auto value = 0; - for(auto i = 0; i < _fields.length(); i++) - { - value |= _fields[i]->getRegisterWriteValue(); - } - - _device->device.writeWord(_bar, _offset, value); -} - -void RegisterChain::upadteArray() //update array RegisterChain -{ - for(quint32 i = 0; i < _arrayLength; i++) - { - prepareData(i); - - auto value = 0; - for(auto j = 0; j < _fields.length(); j++) - { - value |= _fields[j]->getRegisterWriteValue(); - } - - _device->device.writeWord(_bar, _offset + i*4, value); - } -} - -void RegisterChain::sync() -{ - auto value = _device->device.readWord(_bar, _offset); - for(auto i = 0; i < _fields.length(); i++) - { - _fields[i]->updateValue(value); - } -} - - -void RegisterChain::syncArray() -{ - for(quint32 i = 0; i < _arrayLength; i++) - { - auto value = _device->device.readWord(_bar, _offset + i*4); - for(auto i = 0; i < _fields.length(); i++) - { - _fields[i]->updateValue(value); - } - - //receiveData(); - } - -} diff --git a/src/model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.cpp b/src/model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.cpp index a81d1ce..fe17ef0 100644 --- a/src/model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.cpp +++ b/src/model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.cpp @@ -31,12 +31,12 @@ BoardsCtrlMngt::Gain::Gain() /************************************* Write Functions Template ************************************/ /***************************************************************************************************/ template -void BoardsCtrlMngt::eepromWrite(QString& str, quint32 addr, quint8 prbSel, T1* request, T2* status) +void BoardsCtrlMngt::eepromWrite(QByteArray& arr, quint32 addr, quint8 prbSel, T1* request, T2* status) { quint32 j(0); bool busy=true, error=false, done=false; - foreach (auto i, str) + foreach (auto i, arr) { status->sync(); @@ -56,7 +56,8 @@ void BoardsCtrlMngt::eepromWrite(QString& str, quint32 addr, quint8 prbSel, T1* timerShot(5); // must be >= 4 while (!checkTimeout()); - _rom->dataIn = static_cast(i.toLatin1()); + //_rom->dataIn = static_cast(i.toLatin1()); + _rom->dataIn = i; _rom->address = addr+j; _rom->probeSelect = prbSel; setEepromWrite(_rom, request); @@ -872,39 +873,39 @@ QByteArray BoardsCtrlMngt::prbEepromRead(quint32 address, quint32 length, quint8 } -void trxEepromWrite(QString str, quint32 address, BoardsCtrlMngt* boards) +void trxEepromWrite(QByteArray arr, quint32 address, BoardsCtrlMngt* boards) { - if (str.size() >= static_cast(TRX_ROM_MAX_LEN)) + if (arr.size() >= static_cast(TRX_ROM_MAX_LEN)) throw SonoException("Out of range writing into TRX eeprom "); quint8 prbSel = 0; - boards->eepromWrite(str, address, prbSel, boards->_tRomReq, boards->_tRomStatus); + boards->eepromWrite(arr, address, prbSel, boards->_tRomReq, boards->_tRomStatus); } -void mpsEepromWrite(QString str, quint32 address, BoardsCtrlMngt *boards) +void mpsEepromWrite(QByteArray arr, quint32 address, BoardsCtrlMngt *boards) { - if (str.size() >= static_cast(MPS_ROM_MAX_LEN)) + if (arr.size() >= static_cast(MPS_ROM_MAX_LEN)) throw SonoException("Out of range writing into MPS eeprom "); quint8 prbSel = 0; - boards->eepromWrite(str, address, prbSel, boards->_mRomReq, boards->_mRomStatus); + boards->eepromWrite(arr, address, prbSel, boards->_mRomReq, boards->_mRomStatus); } -void prbCtrlEepromWrite(QString str, quint32 address, BoardsCtrlMngt *boards) +void prbCtrlEepromWrite(QByteArray arr, quint32 address, BoardsCtrlMngt *boards) { - if (str.size() >= static_cast(PRB_CTRL_ROM_MAX_LEN)) + if (arr.size() >= static_cast(PRB_CTRL_ROM_MAX_LEN)) throw SonoException("Out of range writing into Probe Control eeprom "); quint8 prbSel = 0; - boards->eepromWrite(str, address, prbSel, boards->_pCtrlRomReq, boards->_pCtrlRomStatus); + boards->eepromWrite(arr, address, prbSel, boards->_pCtrlRomReq, boards->_pCtrlRomStatus); } -void prbEepromWrite(QString str, quint32 address, quint8 prbSel, BoardsCtrlMngt *boards) +void prbEepromWrite(QByteArray arr, quint32 address, quint8 prbSel, BoardsCtrlMngt *boards) { - if (str.size() >= static_cast(PRB_ROM_MAX_LEN)) + if (arr.size() >= static_cast(PRB_ROM_MAX_LEN)) throw SonoException("Out of range writing into Probe eeprom "); - boards->eepromWrite(str, address, prbSel, boards->_pRomReq, boards->_pRomStatus); + boards->eepromWrite(arr, address, prbSel, boards->_pRomReq, boards->_pRomStatus); } diff --git a/src/model/hardware/core/register/fpgaProgram/FpgaProgram.cpp b/src/model/hardware/core/register/fpgaProgram/FpgaProgram.cpp index 96957fa..e23613e 100644 --- a/src/model/hardware/core/register/fpgaProgram/FpgaProgram.cpp +++ b/src/model/hardware/core/register/fpgaProgram/FpgaProgram.cpp @@ -38,6 +38,13 @@ 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); + setSlaveFpgaNumber(number); while (progByte