diff --git a/api.cpp b/api.cpp old mode 100644 new mode 100755 diff --git a/api.h b/api.h old mode 100644 new mode 100755 diff --git a/developHw.pro b/developHw.pro old mode 100644 new mode 100755 diff --git a/developHw.pro.user b/developHw.pro.user old mode 100644 new mode 100755 index 11a6a24..4c4cc8d --- a/developHw.pro.user +++ b/developHw.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId diff --git a/developHw.pro.user.14f6a8b.4.10-pre1 b/developHw.pro.user.14f6a8b.4.10-pre1 old mode 100644 new mode 100755 diff --git a/developHw.pro.user.78e1b4e b/developHw.pro.user.78e1b4e old mode 100644 new mode 100755 diff --git a/developHw.pro.user.78e1b4e.22 b/developHw.pro.user.78e1b4e.22 old mode 100644 new mode 100755 diff --git a/developHw.pro.user.c192e63 b/developHw.pro.user.c192e63 old mode 100644 new mode 100755 diff --git a/hdf5Scenario/hdf5Scenario.cpp b/hdf5Scenario/hdf5Scenario.cpp old mode 100644 new mode 100755 diff --git a/hdf5Scenario/hdf5Scenario.h b/hdf5Scenario/hdf5Scenario.h old mode 100644 new mode 100755 diff --git a/include/config/Configuration.h b/include/config/Configuration.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/Hardware.h b/include/model/hardware/Hardware.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/Fan.h b/include/model/hardware/core/Fan.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/HardwareCore.h b/include/model/hardware/core/HardwareCore.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/HwBoard.h b/include/model/hardware/core/HwBoard.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/IBoard.h b/include/model/hardware/core/IBoard.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/IBoardFactory.h b/include/model/hardware/core/IBoardFactory.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/PowerBoard.h b/include/model/hardware/core/PowerBoard.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/PowerBoardFactory.h b/include/model/hardware/core/PowerBoardFactory.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/PowerBoardStatus.h b/include/model/hardware/core/PowerBoardStatus.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/RelayBoard.h b/include/model/hardware/core/RelayBoard.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/RelayBoardFactory.h b/include/model/hardware/core/RelayBoardFactory.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/Status.h b/include/model/hardware/core/Status.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/Temperature.h b/include/model/hardware/core/Temperature.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/TrxBoardFactory.h b/include/model/hardware/core/TrxBoardFactory.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/Voltage.h b/include/model/hardware/core/Voltage.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/TrxBoard.h b/include/model/hardware/core/lowLevelApi/TrxBoard.h old mode 100644 new mode 100755 index dd900f2..4b86c73 --- a/include/model/hardware/core/lowLevelApi/TrxBoard.h +++ b/include/model/hardware/core/lowLevelApi/TrxBoard.h @@ -23,6 +23,8 @@ #include "model/hardware/core/lowLevelApi/register/sram/Sram.h" #include "model/hardware/core/lowLevelApi/register/dsp/Dsp.h" #include "model/hardware/core/lowLevelApi/register/afe/Afe.h" + +#include "model/hardware/core/lowLevelApi/TrxBoardUtils/PreProcessorDef.h" #include "model/hardware/device/SonoDevice.h" #include "TrxBoardUtils/TrxBoardStructures.h" #include "TrxBoardUtils/ScenParamsRanges.h" @@ -33,13 +35,11 @@ #include "model/hardware/service/HardwarePacketEngine.h" #define SLAVE_ELEMENT_SEGMENT 64U -#define TOTAL_SLAVE_FPGA_NUM 3U #define TOTAL_SCEN_LUT_SRAM 5U #define MOUNTED_SLAVE_FPGA 7U #define CLOCK_DIVISION 0x55 #define AFE_CHANNEL_NUM_PER_SLAVE 64U -#define TOTAL_AFE_CHANNEL_NUM 192U #define LOGGER_SAMPLE_CNT 2048U #define BITE_INTERVAL 0x0 @@ -52,17 +52,17 @@ #define EEPROM_IMPULSE_RESPONSE_BEGIN 428U #define EEPROM_IMPULSE_RESPONSE_NUMBER 1024U -#define EEPROM_NO_ERROR 0x0 -#define EEPROM_CRC_ERROR 0x1 +#define EEPROM_NO_ERROR 0x0 +#define EEPROM_CRC_ERROR 0x1 class TrxBoard : public QObject { Q_OBJECT private: - QVector _swapVec; + QVector _swapVec; QVector _unsignedQntzrVec; - QList _unsignedQntzrList; + QList _unsignedQntzrList; QList _afeModuleOffset; QList _fpgaOffset; QByteArray _eepromCrc; @@ -144,11 +144,14 @@ private: * _scenParams; - void fpgaProgram(const QString path) const; + void sendPacket(void); + + void delay(quint16 ms) const; + void fpgaProgram(const QString path, const quint8& slaveMounted) const; void mcsRead(const QString path) const; void setScenario(ScenGenHardwareParam* _scenParams); - void sramClear (eSramClear clearMode); + void sramClear(eSramClear clearMode); void setSwapVector(void); void setRomCrc(void); void setFpgaOffset(void); @@ -157,12 +160,13 @@ private: //QList signedVector2unsignedList(QVector& sgnVec); #ifndef DEVELOP_UI - void afeAdcsSync(void) const; + void afeAdcsSync(const quint8& slaveMounted); + void gtReadReset(void); #endif - void waitForCaptureDone(Debug* _dbg) const; - void adcCaptureStop(Debug *_dbg) const; - void adcCaptureStart(Debug *_dbg) const; - void adcLogTransferRoutine (Debug* _dbg, quint8 chNumPerFpga); + void waitForCaptureDone(Debug* _dbg); + void adcCaptureStop(Debug* _dbg) const; + void adcCaptureStart(Debug* _dbg) const; + void adcLogTransferRoutine(Debug* _dbg, quint8 chNumPerFpga); void debuggerMode(Debug* _dbg, DebugMode& debug, DebugMode& debugRb, QString slaveN) const; template @@ -171,19 +175,19 @@ private: template T byteArray2UintLittleEndian(QByteArray& byte) const; - signals: void sendFramePacket(QByteArray newPacket); + void sramBinaryCreateFlag(void); void registerCsvCompareFlag(void); void sramVerifyMessage(QString message); public: - #ifndef DEVELOP_UI HardwarePacketEngine packetEngine; #else - void afeAdcsSync(void) const; + void afeAdcsSync(const quint8& slaveMounted); + void gtReadReset(void); #endif TrxBoard(); @@ -193,8 +197,8 @@ public: void init(void); ////////////////////////////////// Scenario API /////////////////////////////// - void setProbeDependParams(ScenPrbDepHardwareParam &prbDepParams); - void setScenario(ScenGenHardwareOutput_t &scenGenHw); + void setProbeDependParams(ScenPrbDepHardwareParam& prbDepParams); + void setScenario(ScenGenHardwareOutput_t& scenGenHw); void setLineFilterCoefficient(QVector& lineFilterLut); void setStbCoefficient(QVector& stbLut); @@ -204,20 +208,22 @@ public: void scenPlayerStop(bool afeHvPwrOff = false); //void scenPlayerPause (bool pause) const; - void setFramesMetaData(const QByteArray &metaData) const; + void setFramesMetaData(const QByteArray& metaData) const; /////////////////////////////// Built-in Test API ///////////////////////////// - void setBiteDacData(const QByteArray& iData,const QByteArray& qData) const; + void setBiteDacData(const QByteArray& iData, const QByteArray& qData) const; void biteScenPlayerStart(void); void biteScenPlayerStop(void); ////////////////////////////////// UI Test API //////////////////////////////// - void setScenarioCompare (const QString scenPath); + void setScenarioCompare(const QString scenPath); void setAtgcMode(eAtgcMode mode, quint16 value) const; QList getAfeReg(eSlaveSelect sel, quint32 afeRegAddr); void setAdgCfg(eBiteDacOutput adg) const; void setTxDacEnable(quint8 biteInterval, bool cmd) const; + void powerAo(bool flag); + ////////////////////////////// Slave Programming API ////////////////////////// void slaveFpgaProgram(const QString path); @@ -234,10 +240,10 @@ public: quint32 deviceId(void) const; quint32 vendorId(void) const; - void trxState(EepromStatus &romStatus) const; - void mpsState(EepromStatus &romStatus) const; - void prbCtrlState(EepromStatus &romStatus) const; - void selectedPrbState(EepromStatus &romStatus, eSelectProbe prbSel) const; + void trxState(EepromStatus& romStatus) const; + void mpsState(EepromStatus& romStatus) const; + void prbCtrlState(EepromStatus& romStatus) const; + void selectedPrbState(EepromStatus& romStatus, eSelectProbe prbSel) const; void prbState(PrbCase* prb) const; QString trxInfo(void) const; @@ -267,9 +273,9 @@ public: quint32 getFrameLostCounter(void) const; ////////////////////////////////// Logger API ///////////////////////////////// - void adcCaptureConfig(captureConfig &capCfg) const; + void adcCaptureConfig(captureConfig& capCfg) const; void adcCaptureStart(void) const; - void adcCaptureDone(void) const; + void adcCaptureDone(void); void setCaptureManualSync(void) const; void adcLoggerStart(const QString path, const QString fileName); void setDebuggerMode(eDebugMode bfMode, bool enable); diff --git a/include/model/hardware/core/lowLevelApi/TrxBoardUtils/PreProcessorDef.h b/include/model/hardware/core/lowLevelApi/TrxBoardUtils/PreProcessorDef.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/TrxBoardUtils/ScenParamsRanges.h b/include/model/hardware/core/lowLevelApi/TrxBoardUtils/ScenParamsRanges.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/TrxBoardUtils/TrxBoardEnums.h b/include/model/hardware/core/lowLevelApi/TrxBoardUtils/TrxBoardEnums.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/TrxBoardUtils/TrxBoardStructures.h b/include/model/hardware/core/lowLevelApi/TrxBoardUtils/TrxBoardStructures.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/Field.h b/include/model/hardware/core/lowLevelApi/register/Field.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/RegUtils.h b/include/model/hardware/core/lowLevelApi/register/RegUtils.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/Register.h b/include/model/hardware/core/lowLevelApi/register/Register.h old mode 100644 new mode 100755 index ef784e0..a04ed59 --- a/include/model/hardware/core/lowLevelApi/register/Register.h +++ b/include/model/hardware/core/lowLevelApi/register/Register.h @@ -28,6 +28,8 @@ protected: bool _isUpdated; + SonoDevice* _device; + QList _fields; public: @@ -35,8 +37,6 @@ public: Register(quint8 bar, quint32 offset, SonoDevice* device, quint32 arrayLength = 0); virtual ~Register(); - SonoDevice* _device; - quint32 getValue(); void setValue(quint32 value); diff --git a/include/model/hardware/core/lowLevelApi/register/afe/Afe.h b/include/model/hardware/core/lowLevelApi/register/afe/Afe.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/afe/registerDefinition/ActiveTerm.h b/include/model/hardware/core/lowLevelApi/register/afe/registerDefinition/ActiveTerm.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/afe/registerDefinition/AdcLatency.h b/include/model/hardware/core/lowLevelApi/register/afe/registerDefinition/AdcLatency.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/afe/registerDefinition/AdcSyncStatus.h b/include/model/hardware/core/lowLevelApi/register/afe/registerDefinition/AdcSyncStatus.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/afe/registerDefinition/Global.h b/include/model/hardware/core/lowLevelApi/register/afe/registerDefinition/Global.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/afe/registerDefinition/LnaHpf.h b/include/model/hardware/core/lowLevelApi/register/afe/registerDefinition/LnaHpf.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/afe/registerDefinition/LowNf.h b/include/model/hardware/core/lowLevelApi/register/afe/registerDefinition/LowNf.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/afe/registerDefinition/Pga.h b/include/model/hardware/core/lowLevelApi/register/afe/registerDefinition/Pga.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/beamFormer/BeamFormer.h b/include/model/hardware/core/lowLevelApi/register/beamFormer/BeamFormer.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/beamFormer/registerDefinition/AfeLut.h b/include/model/hardware/core/lowLevelApi/register/beamFormer/registerDefinition/AfeLut.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/beamFormer/registerDefinition/ApodizationLut.h b/include/model/hardware/core/lowLevelApi/register/beamFormer/registerDefinition/ApodizationLut.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/beamFormer/registerDefinition/ElementPositionLut.h b/include/model/hardware/core/lowLevelApi/register/beamFormer/registerDefinition/ElementPositionLut.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/beamFormer/registerDefinition/PulseLut.h b/include/model/hardware/core/lowLevelApi/register/beamFormer/registerDefinition/PulseLut.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/beamFormer/registerDefinition/RegValid.h b/include/model/hardware/core/lowLevelApi/register/beamFormer/registerDefinition/RegValid.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/beamFormer/registerDefinition/RxBeamformerLut.h b/include/model/hardware/core/lowLevelApi/register/beamFormer/registerDefinition/RxBeamformerLut.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/BoardsCtrlMngt.h b/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/BoardsCtrlMngt.h old mode 100644 new mode 100755 index 0ebca0e..d034b23 --- a/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/BoardsCtrlMngt.h +++ b/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/BoardsCtrlMngt.h @@ -2,7 +2,6 @@ #define BOARDSCTRLMNGT_H #include -#include #include #include #include "registerDefinition/BoardsSpecs.h" @@ -16,7 +15,7 @@ #define SUPERVISOR_RB_RESOLUTION 65535 #define SUPERVISOR_RB_V_REF 2.048f -#define F_SYS_CLK 1E8f //FPGAclk = 100MHz +#define F_SYS_CLK 1E8f //FPGAclk = 100MHz #define CWD_Offset 1.53f #define CWD_GAIN 47.065f #define HVA_Offset 1.525f @@ -25,7 +24,7 @@ #define HVB_GAIN 2.635f #define HVA_MAX_VALUE 66.0f -#define HVB_MAX_VALUE 66.0f // must be check +#define HVB_MAX_VALUE 66.0f //must be check enum ePg : bool { @@ -225,11 +224,11 @@ private: float fanTacho(T7* tachoMean); float resDiv(float r1, float r2, quint32 adcValue); QVector voltPg(float adcVolt); - float fpgaVoltage (quint32 coreVolt) const; - float fpgaTemp(FpgaXadc1 *coreTemp) const; - float fpgaVccInt(FpgaXadc1 *coreVccInt) const; - float fpgaVccAux(FpgaXadc2 *coreVccAux) const; - float fpgaVccBram(FpgaXadc2 *coreVccBram) const; + float fpgaVoltage(quint32 coreVolt) const; + float fpgaTemp(FpgaXadc1* coreTemp) const; + float fpgaVccInt(FpgaXadc1* coreVccInt) const; + float fpgaVccAux(FpgaXadc2* coreVccAux) const; + float fpgaVccBram(FpgaXadc2* coreVccBram) const; float getCWdpValue(void) const; float getCurr24vValue(void) const; @@ -279,8 +278,8 @@ public: } void timerShot(quint16 ms) const; - void timerStop(void) const; bool checkTimeout(void) const; + void timerStop(void) const; quint32 getPid(void) const; quint32 getVid(void) const; @@ -301,10 +300,10 @@ public: void mpsDacsOff(void) const; void mpsDacsOn(void) const; void mpsHvSet(float& hva, float& hvb) const; - void getFpgaTemp(criticalComponentTemperature *coreTemp); - void getFpgaVccInt(FpgaVccInt &coreVcc); - void getFpgaVccAux(FpgaVccAux &coreAux); - void getFpgaVccBram(FpgaVccBram &coreBram); + void getFpgaTemp(criticalComponentTemperature* coreTemp); + void getFpgaVccInt(FpgaVccInt& coreVcc); + void getFpgaVccAux(FpgaVccAux& coreAux); + void getFpgaVccBram(FpgaVccBram& coreBram); void getFanRpm(FanRpm* _rpm); QByteArray trxEepromRead(quint32 address, quint32 length); diff --git a/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/BoardsSpecs.h b/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/BoardsSpecs.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/mps/FanStatus.h b/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/mps/FanStatus.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/mps/FanTacho1.h b/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/mps/FanTacho1.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/mps/FanTacho2.h b/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/mps/FanTacho2.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/mps/MpsEepromRwReq.h b/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/mps/MpsEepromRwReq.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/mps/MpsEepromRwStatus.h b/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/mps/MpsEepromRwStatus.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/mps/MpsHvRegulatorClk.h b/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/mps/MpsHvRegulatorClk.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/mps/MpsHvStopState.h b/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/mps/MpsHvStopState.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/mps/MpsPm5RegulatorClk.h b/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/mps/MpsPm5RegulatorClk.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/mps/SupervisorDacValue.h b/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/mps/SupervisorDacValue.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/mps/SupervisorFaultStatus.h b/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/mps/SupervisorFaultStatus.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/mps/SupervisorI2cStatus.h b/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/mps/SupervisorI2cStatus.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbCmd.h b/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbCmd.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbCurr24V.h b/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbCurr24V.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbCwdp.h b/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbCwdp.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbHvStop.h b/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbHvStop.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbHvap.h b/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbHvap.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbHvbp.h b/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbHvbp.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbM5V.h b/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbM5V.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbP12V.h b/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbP12V.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbP24V.h b/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbP24V.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbP4d.h b/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbP4d.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbP5V.h b/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbP5V.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRdData.h b/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRdData.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRwReq.h b/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRwReq.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/mps/SupervisorSetupCmd.h b/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/mps/SupervisorSetupCmd.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/probe/PrbCtrlCmd.h b/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/probe/PrbCtrlCmd.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/probe/PrbCtrlEepromRwReq.h b/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/probe/PrbCtrlEepromRwReq.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/probe/PrbCtrlEepromRwStatus.h b/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/probe/PrbCtrlEepromRwStatus.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/probe/PrbCtrlStatus.h b/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/probe/PrbCtrlStatus.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/probe/PrbEepromRwReq.h b/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/probe/PrbEepromRwReq.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/probe/PrbEepromRwStatus.h b/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/probe/PrbEepromRwStatus.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/trx/Adc12Vin.h b/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/trx/Adc12Vin.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/trx/Adc3P3V.h b/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/trx/Adc3P3V.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/trx/Adc5Vin.h b/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/trx/Adc5Vin.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/trx/AdcAfeA1P8V.h b/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/trx/AdcAfeA1P8V.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/trx/AdcAfeD1P8V.h b/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/trx/AdcAfeD1P8V.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/trx/AdcAfeVcntlp.h b/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/trx/AdcAfeVcntlp.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/trx/AdcPrbCtrl3P3V.h b/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/trx/AdcPrbCtrl3P3V.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/trx/AdcPrbZeroEncoder.h b/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/trx/AdcPrbZeroEncoder.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/trx/FpgaXadc1.h b/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/trx/FpgaXadc1.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/trx/FpgaXadc2.h b/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/trx/FpgaXadc2.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/trx/OnBoardTempSensor.h b/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/trx/OnBoardTempSensor.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/trx/PcieId.h b/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/trx/PcieId.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/trx/TrxEepromRwReq.h b/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/trx/TrxEepromRwReq.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/trx/TrxEepromRwStatus.h b/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/trx/TrxEepromRwStatus.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/trx/TrxRegulatorPg.h b/include/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/registerDefinition/trx/TrxRegulatorPg.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/bpiFlash/BpiFlash.h b/include/model/hardware/core/lowLevelApi/register/bpiFlash/BpiFlash.h old mode 100644 new mode 100755 index 27bc6bd..b9f64d6 --- a/include/model/hardware/core/lowLevelApi/register/bpiFlash/BpiFlash.h +++ b/include/model/hardware/core/lowLevelApi/register/bpiFlash/BpiFlash.h @@ -1,29 +1,50 @@ #ifndef BPIFLASH_H #define BPIFLASH_H -#include "registerDefinition/McsRdWr.h" -#include "model/hardware/core/lowLevelApi/register/fpgaProgram/FpgaProgram.h" +#include "model/hardware/core/lowLevelApi/TrxBoardUtils/PreProcessorDef.h" +#include "model/hardware/device/SonoDevice.h" +#include +#include -class BpiFlash +#define BPI_FLASH_SIZE 64 * 1024 * 1024 //Byte +#define UNLOCK_ERASE_BLOCK 256U +#define BPI_NO_ERR_STATUS 0x80 +#define MAXIMUM_WR_NUM 1024 +#define STEP_128KB 0x20000 + +class BpiFlash : public QObject { + Q_OBJECT + private: - McsRdWr* _mcsRdWr; + SonoDevice* _device; + QTimer* _timer; + + template + T byteArray2UintLittleEndian(QByteArray& byte) const; - void bpiInitialize(void) const; - void bpiReset(void) const; - void bpiErase(void) const; + void timerShot(quint16 ms) const; + bool checkTimeout(void) const; + void timerStop(void) const; + + void bpiClearStatus(void) const; + void bpiUnlock(quint16& blockOffset); + void bpiErase(quint16& blockOffset); + void bpiWrite(quint16& wrCount); //max = 511 word + void bpiWriteCmplt(quint16& num); void bpiRead(void) const; - void bpiWrite(void) const; + +signals: + void startTimerShot(quint16 ms); + void remainingTime(QString message); + void stopTimer(void); public: explicit BpiFlash(SonoDevice* device); ~BpiFlash(); - void writeMcs (QByteArray& mcs) const; - QList readMcs (void) const; - - void readCommand(void) const; - void writeCommand(void) const; + void writeMcs(QByteArray& mcs); + QList readMcs(void) const; }; -#endif // BPIFLASH_H +#endif //BPIFLASH_H diff --git a/include/model/hardware/core/lowLevelApi/register/bpiFlash/registerDefinition/McsRdWr.h b/include/model/hardware/core/lowLevelApi/register/bpiFlash/registerDefinition/McsRdWr.h deleted file mode 100644 index ff68489..0000000 --- a/include/model/hardware/core/lowLevelApi/register/bpiFlash/registerDefinition/McsRdWr.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef MCSRDWR_H -#define MCSRDWR_H - -#include "model/hardware/core/lowLevelApi/register/Register.h" -#include "model/hardware/core/lowLevelApi/register/RegUtils.h" - -#undef BAR - -#define MASTER_MCS_DATA_MASK 0xFFFFFFFF - -#define BAR 1U -#define OFFSET 0X4000000 -#define MCS_FILE_SIZE 32*1024*1024 - -class McsRdWr : public Register -{ -private: - QList _mcsListWr; - - void prepareData(quint32 index) override - { - masterMcsData->setValue(_mcsListWr[static_cast(index)]); - } - -public: - Field* masterMcsData; - QList mcsListRd; - - void mcsWrite (QList& mcsList) { - _mcsListWr = mcsList; - } - - void receiveData (void) override - { - mcsListRd.push_back(this->masterMcsData->getValue()); - } - - McsRdWr(SonoDevice* device) : Register(BAR, OFFSET, device, MCS_FILE_SIZE) - { - ADD_UNSIGNED_FIELD(masterMcsData, MASTER_MCS_DATA_MASK); - } -}; - -#undef MASTER_MCS_DATA_MASK - -#undef BAR -#undef OFFSET - -#endif // MCSRDWR_H diff --git a/include/model/hardware/core/lowLevelApi/register/builtInTest/BuiltInTest.h b/include/model/hardware/core/lowLevelApi/register/builtInTest/BuiltInTest.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/builtInTest/registerDefinition/BiteDacMemory.h b/include/model/hardware/core/lowLevelApi/register/builtInTest/registerDefinition/BiteDacMemory.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/builtInTest/registerDefinition/BiteDacMemoryCmd.h b/include/model/hardware/core/lowLevelApi/register/builtInTest/registerDefinition/BiteDacMemoryCmd.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/builtInTest/registerDefinition/BiteDacOutputSelect.h b/include/model/hardware/core/lowLevelApi/register/builtInTest/registerDefinition/BiteDacOutputSelect.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/clockDistributer/ClockDistributer.h b/include/model/hardware/core/lowLevelApi/register/clockDistributer/ClockDistributer.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/clockDistributer/registerDefinition/ClkDistributionId.h b/include/model/hardware/core/lowLevelApi/register/clockDistributer/registerDefinition/ClkDistributionId.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/clockDistributer/registerDefinition/CwModeEnable.h b/include/model/hardware/core/lowLevelApi/register/clockDistributer/registerDefinition/CwModeEnable.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/clockDistributer/registerDefinition/CwModeStatus.h b/include/model/hardware/core/lowLevelApi/register/clockDistributer/registerDefinition/CwModeStatus.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/debug/Debug.h b/include/model/hardware/core/lowLevelApi/register/debug/Debug.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/debug/registerDefinition/AdcLoggerCapCmd.h b/include/model/hardware/core/lowLevelApi/register/debug/registerDefinition/AdcLoggerCapCmd.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/debug/registerDefinition/AdcLoggerDataTransfer.h b/include/model/hardware/core/lowLevelApi/register/debug/registerDefinition/AdcLoggerDataTransfer.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/debug/registerDefinition/AdcLoggerStatus.h b/include/model/hardware/core/lowLevelApi/register/debug/registerDefinition/AdcLoggerStatus.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/debug/registerDefinition/DebuggerMode.h b/include/model/hardware/core/lowLevelApi/register/debug/registerDefinition/DebuggerMode.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/dsp/Dsp.h b/include/model/hardware/core/lowLevelApi/register/dsp/Dsp.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/dsp/registerDefinition/AtgcLut.h b/include/model/hardware/core/lowLevelApi/register/dsp/registerDefinition/AtgcLut.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/dsp/registerDefinition/BfScale.h b/include/model/hardware/core/lowLevelApi/register/dsp/registerDefinition/BfScale.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/dsp/registerDefinition/BlendWeight.h b/include/model/hardware/core/lowLevelApi/register/dsp/registerDefinition/BlendWeight.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/dsp/registerDefinition/DtgcLut.h b/include/model/hardware/core/lowLevelApi/register/dsp/registerDefinition/DtgcLut.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/dsp/registerDefinition/FrequencyLut.h b/include/model/hardware/core/lowLevelApi/register/dsp/registerDefinition/FrequencyLut.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/dsp/registerDefinition/LineFilterCoefficient.h b/include/model/hardware/core/lowLevelApi/register/dsp/registerDefinition/LineFilterCoefficient.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/dsp/registerDefinition/LpfLut.h b/include/model/hardware/core/lowLevelApi/register/dsp/registerDefinition/LpfLut.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/dsp/registerDefinition/ManualAtgc.h b/include/model/hardware/core/lowLevelApi/register/dsp/registerDefinition/ManualAtgc.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/dsp/registerDefinition/ReceiverConfigurationLut.h b/include/model/hardware/core/lowLevelApi/register/dsp/registerDefinition/ReceiverConfigurationLut.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/dsp/registerDefinition/StbCoefficient.h b/include/model/hardware/core/lowLevelApi/register/dsp/registerDefinition/StbCoefficient.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/emulator/Emulator.h b/include/model/hardware/core/lowLevelApi/register/emulator/Emulator.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/emulator/registerDefinition/EmulatorActivation.h b/include/model/hardware/core/lowLevelApi/register/emulator/registerDefinition/EmulatorActivation.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/emulator/registerDefinition/RamAddress.h b/include/model/hardware/core/lowLevelApi/register/emulator/registerDefinition/RamAddress.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/emulator/registerDefinition/TransferMode.h b/include/model/hardware/core/lowLevelApi/register/emulator/registerDefinition/TransferMode.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/emulator/registerDefinition/TransferRate.h b/include/model/hardware/core/lowLevelApi/register/emulator/registerDefinition/TransferRate.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/fpgaProgram/FpgaProgram.h b/include/model/hardware/core/lowLevelApi/register/fpgaProgram/FpgaProgram.h old mode 100644 new mode 100755 index c211c30..9aa821c --- a/include/model/hardware/core/lowLevelApi/register/fpgaProgram/FpgaProgram.h +++ b/include/model/hardware/core/lowLevelApi/register/fpgaProgram/FpgaProgram.h @@ -3,10 +3,8 @@ #include #include -#include #include -#include "model/hardware/core/lowLevelApi/TrxBoardUtils/PreProcessorDef.h" #include "registerDefinition/SlaveFpgaNumber.h" #include "registerDefinition/SerialProgramData.h" #include "registerDefinition/SerialProgramStatus.h" diff --git a/include/model/hardware/core/lowLevelApi/register/fpgaProgram/registerDefinition/SerialProgramData.h b/include/model/hardware/core/lowLevelApi/register/fpgaProgram/registerDefinition/SerialProgramData.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/fpgaProgram/registerDefinition/SerialProgramStatus.h b/include/model/hardware/core/lowLevelApi/register/fpgaProgram/registerDefinition/SerialProgramStatus.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/fpgaProgram/registerDefinition/SlaveFpgaNumber.h b/include/model/hardware/core/lowLevelApi/register/fpgaProgram/registerDefinition/SlaveFpgaNumber.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/misc/Misc.h b/include/model/hardware/core/lowLevelApi/register/misc/Misc.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/misc/registerDefinition/AdcDataBram.h b/include/model/hardware/core/lowLevelApi/register/misc/registerDefinition/AdcDataBram.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/misc/registerDefinition/AdcSamplerControl.h b/include/model/hardware/core/lowLevelApi/register/misc/registerDefinition/AdcSamplerControl.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/misc/registerDefinition/AdcSamplerStatus.h b/include/model/hardware/core/lowLevelApi/register/misc/registerDefinition/AdcSamplerStatus.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/misc/registerDefinition/FpgaVersion.h b/include/model/hardware/core/lowLevelApi/register/misc/registerDefinition/FpgaVersion.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/misc/registerDefinition/FrameLostCount.h b/include/model/hardware/core/lowLevelApi/register/misc/registerDefinition/FrameLostCount.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/misc/registerDefinition/GtSendMode.h b/include/model/hardware/core/lowLevelApi/register/misc/registerDefinition/GtSendMode.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/misc/registerDefinition/StatusVector.h b/include/model/hardware/core/lowLevelApi/register/misc/registerDefinition/StatusVector.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/misc/registerDefinition/SyncMode.h b/include/model/hardware/core/lowLevelApi/register/misc/registerDefinition/SyncMode.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/scenPlayer/ScenPlayer.h b/include/model/hardware/core/lowLevelApi/register/scenPlayer/ScenPlayer.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/scenPlayer/registerDefinition/ScenPlayerCtrl.h b/include/model/hardware/core/lowLevelApi/register/scenPlayer/registerDefinition/ScenPlayerCtrl.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/scenPlayer/registerDefinition/ScenPlayerEndIndex.h b/include/model/hardware/core/lowLevelApi/register/scenPlayer/registerDefinition/ScenPlayerEndIndex.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/scenPlayer/registerDefinition/ScenPlayerErrorCount.h b/include/model/hardware/core/lowLevelApi/register/scenPlayer/registerDefinition/ScenPlayerErrorCount.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/scenPlayer/registerDefinition/ScenPlayerStartIndex.h b/include/model/hardware/core/lowLevelApi/register/scenPlayer/registerDefinition/ScenPlayerStartIndex.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/sram/Sram.h b/include/model/hardware/core/lowLevelApi/register/sram/Sram.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/sram/registerDefinition/Index.h b/include/model/hardware/core/lowLevelApi/register/sram/registerDefinition/Index.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/sram/registerDefinition/RxParams.h b/include/model/hardware/core/lowLevelApi/register/sram/registerDefinition/RxParams.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/sram/registerDefinition/RxParamsDegree.h b/include/model/hardware/core/lowLevelApi/register/sram/registerDefinition/RxParamsDegree.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/sram/registerDefinition/RxParamsDelay.h b/include/model/hardware/core/lowLevelApi/register/sram/registerDefinition/RxParamsDelay.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/sram/registerDefinition/RxParamsPos.h b/include/model/hardware/core/lowLevelApi/register/sram/registerDefinition/RxParamsPos.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/sram/registerDefinition/SoftwareMetaData.h b/include/model/hardware/core/lowLevelApi/register/sram/registerDefinition/SoftwareMetaData.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/sram/registerDefinition/SramStructures.h b/include/model/hardware/core/lowLevelApi/register/sram/registerDefinition/SramStructures.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/sram/registerDefinition/TxParams.h b/include/model/hardware/core/lowLevelApi/register/sram/registerDefinition/TxParams.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/core/lowLevelApi/register/sram/registerDefinition/TxParamsFocus.h b/include/model/hardware/core/lowLevelApi/register/sram/registerDefinition/TxParamsFocus.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/device/SonoDevice.h b/include/model/hardware/device/SonoDevice.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/device/SonoDeviceConstant.h b/include/model/hardware/device/SonoDeviceConstant.h old mode 100644 new mode 100755 index 0ae2b83..7eba8d0 --- a/include/model/hardware/device/SonoDeviceConstant.h +++ b/include/model/hardware/device/SonoDeviceConstant.h @@ -5,11 +5,13 @@ #define BAR_SRAM 1 #define BAR_BRAM 2 -#define SW_BUFFER_NUM 100 +#define SW_BUFFER_NUM 16 #define HW_BUFFER_NUM 16 #define BUFFER_SIZE 4 * 1024 * 1024 #define SRAM_SIZE 16777216U +#define BPI_START_OFFSET 0x4000000 +#define UPDATE_MCS_OFFSET 0x2000000 #define COUNTER_REG 0x00002020 #define RAM_OFFSET_REG 0x00002024 #define XFER_OPT_REG 0x00002028 diff --git a/include/model/hardware/exception/HardwareException.h b/include/model/hardware/exception/HardwareException.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/exception/HwExceptionDef.h b/include/model/hardware/exception/HwExceptionDef.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/service/BHardwarePacket.h b/include/model/hardware/service/BHardwarePacket.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/service/HardwarePacket.h b/include/model/hardware/service/HardwarePacket.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/service/HardwarePacketEngine.h b/include/model/hardware/service/HardwarePacketEngine.h old mode 100644 new mode 100755 diff --git a/include/model/hardware/service/PacketFormat.h b/include/model/hardware/service/PacketFormat.h old mode 100644 new mode 100755 diff --git a/include/model/scenarioGenerator/ScenarioGenerator.h b/include/model/scenarioGenerator/ScenarioGenerator.h old mode 100644 new mode 100755 diff --git a/include/model/scenarioGenerator/core/ComputationalCore.h b/include/model/scenarioGenerator/core/ComputationalCore.h old mode 100644 new mode 100755 diff --git a/include/model/scenarioGenerator/core/ScenGenCore.h b/include/model/scenarioGenerator/core/ScenGenCore.h old mode 100644 new mode 100755 diff --git a/include/model/scenarioGenerator/core/general/AperturePosition.h b/include/model/scenarioGenerator/core/general/AperturePosition.h old mode 100644 new mode 100755 diff --git a/include/model/scenarioGenerator/core/general/BlendCoeff.h b/include/model/scenarioGenerator/core/general/BlendCoeff.h old mode 100644 new mode 100755 diff --git a/include/model/scenarioGenerator/core/general/Calculation.h b/include/model/scenarioGenerator/core/general/Calculation.h old mode 100644 new mode 100755 diff --git a/include/model/scenarioGenerator/core/general/InterceptFocus.h b/include/model/scenarioGenerator/core/general/InterceptFocus.h old mode 100644 new mode 100755 diff --git a/include/model/scenarioGenerator/core/general/MinMaxDelay.h b/include/model/scenarioGenerator/core/general/MinMaxDelay.h old mode 100644 new mode 100755 diff --git a/include/model/scenarioGenerator/core/general/ScenGenReceiverConfigurationProperties.h b/include/model/scenarioGenerator/core/general/ScenGenReceiverConfigurationProperties.h old mode 100644 new mode 100755 diff --git a/include/model/scenarioGenerator/core/scenario/B/BModeScenario.h b/include/model/scenarioGenerator/core/scenario/B/BModeScenario.h old mode 100644 new mode 100755 diff --git a/include/model/scenarioGenerator/core/scenario/BaseScenario.h b/include/model/scenarioGenerator/core/scenario/BaseScenario.h old mode 100644 new mode 100755 diff --git a/include/model/scenarioGenerator/core/scenario/Bm/BmModeScenario.h b/include/model/scenarioGenerator/core/scenario/Bm/BmModeScenario.h old mode 100644 new mode 100755 diff --git a/include/model/scenarioGenerator/core/scenario/type/frame/BFrame.h b/include/model/scenarioGenerator/core/scenario/type/frame/BFrame.h old mode 100644 new mode 100755 diff --git a/include/model/scenarioGenerator/core/scenario/type/frame/BaseFrame.h b/include/model/scenarioGenerator/core/scenario/type/frame/BaseFrame.h old mode 100644 new mode 100755 diff --git a/include/model/scenarioGenerator/core/scenario/type/frame/MFrame.h b/include/model/scenarioGenerator/core/scenario/type/frame/MFrame.h old mode 100644 new mode 100755 diff --git a/include/model/scenarioGenerator/core/scenario/type/misc/Aperture.h b/include/model/scenarioGenerator/core/scenario/type/misc/Aperture.h old mode 100644 new mode 100755 diff --git a/include/model/scenarioGenerator/core/scenario/type/misc/Delay.h b/include/model/scenarioGenerator/core/scenario/type/misc/Delay.h old mode 100644 new mode 100755 diff --git a/include/model/scenarioGenerator/core/scenario/type/misc/Point.h b/include/model/scenarioGenerator/core/scenario/type/misc/Point.h old mode 100644 new mode 100755 diff --git a/include/model/scenarioGenerator/core/scenario/type/misc/Pulse.h b/include/model/scenarioGenerator/core/scenario/type/misc/Pulse.h old mode 100644 new mode 100755 diff --git a/include/model/scenarioGenerator/core/scenario/type/misc/ReceiverConfig.h b/include/model/scenarioGenerator/core/scenario/type/misc/ReceiverConfig.h old mode 100644 new mode 100755 diff --git a/include/model/scenarioGenerator/core/scenario/type/misc/RxBeamFormer.h b/include/model/scenarioGenerator/core/scenario/type/misc/RxBeamFormer.h old mode 100644 new mode 100755 diff --git a/include/model/scenarioGenerator/dto/computational/ScenGenZoomGate.h b/include/model/scenarioGenerator/dto/computational/ScenGenZoomGate.h old mode 100644 new mode 100755 diff --git a/include/model/scenarioGenerator/dto/hardware/HardwareOutput.h b/include/model/scenarioGenerator/dto/hardware/HardwareOutput.h old mode 100644 new mode 100755 diff --git a/include/model/scenarioGenerator/dto/hardware/HwScenarioDependent.h b/include/model/scenarioGenerator/dto/hardware/HwScenarioDependent.h old mode 100644 new mode 100755 diff --git a/include/model/scenarioGenerator/dto/hardware/SramIndex.h b/include/model/scenarioGenerator/dto/hardware/SramIndex.h old mode 100644 new mode 100755 diff --git a/include/model/scenarioGenerator/dto/hardware/SramRx.h b/include/model/scenarioGenerator/dto/hardware/SramRx.h old mode 100644 new mode 100755 diff --git a/include/model/scenarioGenerator/dto/hardware/SramTx.h b/include/model/scenarioGenerator/dto/hardware/SramTx.h old mode 100644 new mode 100755 diff --git a/include/model/scenarioGenerator/dto/software/Pixel.h b/include/model/scenarioGenerator/dto/software/Pixel.h old mode 100644 new mode 100755 diff --git a/include/model/scenarioGenerator/dto/software/ScanConversionConfig.h b/include/model/scenarioGenerator/dto/software/ScanConversionConfig.h old mode 100644 new mode 100755 diff --git a/include/model/scenarioGenerator/dto/software/SoftwareOutput.h b/include/model/scenarioGenerator/dto/software/SoftwareOutput.h old mode 100644 new mode 100755 diff --git a/include/model/scenarioGenerator/dto/software/SwScenarioDependent.h b/include/model/scenarioGenerator/dto/software/SwScenarioDependent.h old mode 100644 new mode 100755 diff --git a/include/model/scenarioGenerator/dtoInternal/ProbeParameters.h b/include/model/scenarioGenerator/dtoInternal/ProbeParameters.h old mode 100644 new mode 100755 diff --git a/include/model/scenarioGenerator/dtoInternal/ScenGenDatabase.h b/include/model/scenarioGenerator/dtoInternal/ScenGenDatabase.h old mode 100644 new mode 100755 diff --git a/include/model/scenarioGenerator/dtoInternal/SystemParameters.h b/include/model/scenarioGenerator/dtoInternal/SystemParameters.h old mode 100644 new mode 100755 diff --git a/include/model/scenarioGenerator/dtoInternal/UserParameters.h b/include/model/scenarioGenerator/dtoInternal/UserParameters.h old mode 100644 new mode 100755 diff --git a/include/model/scenarioGenerator/dtoInternal/probe/ProbeProperties.h b/include/model/scenarioGenerator/dtoInternal/probe/ProbeProperties.h old mode 100644 new mode 100755 diff --git a/include/model/scenarioGenerator/dtoInternal/probe/SecondaryProbeProperties.h b/include/model/scenarioGenerator/dtoInternal/probe/SecondaryProbeProperties.h old mode 100644 new mode 100755 diff --git a/include/model/scenarioGenerator/utils/H5Macros.h b/include/model/scenarioGenerator/utils/H5Macros.h old mode 100644 new mode 100755 diff --git a/include/model/scenarioGenerator/utils/Macros.h b/include/model/scenarioGenerator/utils/Macros.h old mode 100644 new mode 100755 diff --git a/include/model/type/CommandValue.h b/include/model/type/CommandValue.h old mode 100644 new mode 100755 diff --git a/include/model/type/ImageModeCommandValue.h b/include/model/type/ImageModeCommandValue.h old mode 100644 new mode 100755 diff --git a/include/model/type/StringCommandType.h b/include/model/type/StringCommandType.h old mode 100644 new mode 100755 diff --git a/include/model/ultrasoundModule/UsData.h b/include/model/ultrasoundModule/UsData.h old mode 100644 new mode 100755 diff --git a/include/model/ultrasoundModule/UsEventReceiver.h b/include/model/ultrasoundModule/UsEventReceiver.h old mode 100644 new mode 100755 diff --git a/include/model/ultrasoundModule/UsEventSender.h b/include/model/ultrasoundModule/UsEventSender.h old mode 100644 new mode 100755 diff --git a/include/model/ultrasoundModule/UsHelper.h b/include/model/ultrasoundModule/UsHelper.h old mode 100644 new mode 100755 diff --git a/include/model/ultrasoundModule/UsModule.h b/include/model/ultrasoundModule/UsModule.h old mode 100644 new mode 100755 diff --git a/include/model/ultrasoundModule/UsPacket.h b/include/model/ultrasoundModule/UsPacket.h old mode 100644 new mode 100755 diff --git a/include/model/ultrasoundModule/metadata/BMetadata.h b/include/model/ultrasoundModule/metadata/BMetadata.h old mode 100644 new mode 100755 diff --git a/include/model/ultrasoundModule/metadata/BipMetadata.h b/include/model/ultrasoundModule/metadata/BipMetadata.h old mode 100644 new mode 100755 diff --git a/include/model/ultrasoundModule/metadata/HardwareMetadata.h b/include/model/ultrasoundModule/metadata/HardwareMetadata.h old mode 100644 new mode 100755 diff --git a/include/model/ultrasoundModule/metadata/UsBaseMetadata.h b/include/model/ultrasoundModule/metadata/UsBaseMetadata.h old mode 100644 new mode 100755 diff --git a/include/model/ultrasoundModule/metadata/UsMetadataBag.h b/include/model/ultrasoundModule/metadata/UsMetadataBag.h old mode 100644 new mode 100755 diff --git a/include/model/ultrasoundModule/type/CommandRequest.h b/include/model/ultrasoundModule/type/CommandRequest.h old mode 100644 new mode 100755 diff --git a/include/model/ultrasoundModule/type/CommandResponse.h b/include/model/ultrasoundModule/type/CommandResponse.h old mode 100644 new mode 100755 diff --git a/include/model/ultrasoundModule/type/CommandResult.h b/include/model/ultrasoundModule/type/CommandResult.h old mode 100644 new mode 100755 diff --git a/include/model/ultrasoundModule/type/ECommandResult.h b/include/model/ultrasoundModule/type/ECommandResult.h old mode 100644 new mode 100755 diff --git a/include/model/ultrasoundModule/type/ECommandType.h b/include/model/ultrasoundModule/type/ECommandType.h old mode 100644 new mode 100755 diff --git a/include/utils/ColorImageProvider.h b/include/utils/ColorImageProvider.h old mode 100644 new mode 100755 diff --git a/include/utils/PanelChecker.h b/include/utils/PanelChecker.h old mode 100644 new mode 100755 diff --git a/include/utils/ThreadBinder.h b/include/utils/ThreadBinder.h old mode 100644 new mode 100755 diff --git a/include/utils/Utils.h b/include/utils/Utils.h old mode 100644 new mode 100755 diff --git a/main.cpp b/main.cpp old mode 100644 new mode 100755 diff --git a/mainwindow.cpp b/mainwindow.cpp old mode 100644 new mode 100755 index 041df1c..1230511 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -20,6 +20,7 @@ MainWindow::MainWindow(QWidget* parent) _timeout = new QTimer; _bCtrl = new BoardsCtrlMngt(_usd->device); + _bpi = new BpiFlash(_usd->device); _healStatus = new HealthStatus; _supRbValue = new SupervisorRbValue; _faultStatus = new MpsFaultStatus; @@ -27,7 +28,7 @@ MainWindow::MainWindow(QWidget* parent) _vec = new StatusVec; _emul = new EmulatorProperties; _prb = new PrbCase; - _headerLogFile = new QFile (_headerLogPath); + _headerLogFile = new QFile(_headerLogPath); movie = new QMovie("/home/hasis/Desktop/hardware/Develop_HardwareTest/gifs/Glass lines.gif"); movie->stop(); @@ -60,6 +61,9 @@ MainWindow::MainWindow(QWidget* parent) ui->tb_prbRomImpulseRead->setPlaceholderText("impulse"); ui->tb_scenInfo->setPlaceholderText("Scenario Information"); + connect(this, &MainWindow::adcLog, this, &MainWindow::catchAdcLog); + connect(this, &MainWindow::statusLog, this, &MainWindow::catchStatusLog); + connect(this, &MainWindow::gtReset, this, &MainWindow::catchGtReset); connect(ui->action_Exit, &QAction::triggered, this, &MainWindow::exitApp); connect(this, &MainWindow::showMessage, this, &MainWindow::newMessage); connect(this, &MainWindow::connectedPrbChange, this, &MainWindow::getPrbChange); @@ -94,6 +98,11 @@ MainWindow::MainWindow(QWidget* parent) connect(&_trx, &TrxBoard::registerCsvCompareFlag, this, &MainWindow::getRegisterCsvCompareFlag); connect(&_trx, &TrxBoard::sramVerifyMessage, this, &MainWindow::getSramVerifyMessage); + ///////////////////////// BPI Timeout Connections ///////////////////////////// + connect(_bpi, &BpiFlash::startTimerShot, this, &MainWindow::bpiTimerShot); + connect(_bpi, &BpiFlash::remainingTime, this, &MainWindow::bpiTimeout); + connect(_bpi, &BpiFlash::stopTimer, this, &MainWindow::bpiStopTimer); + ui->btn_updateRdbackValue->setText(UPDATE); dmaLogLayoutVisible(false); ui->chk_continuousShowing->hide(); @@ -103,11 +112,17 @@ MainWindow::MainWindow(QWidget* parent) ui->chk_pulserTstModeEn->setChecked(false); ui->tb_afeRegAddr->setText("C5"); - QList mcsButton = {ui->btn_mcsRead, - ui->btn_mcsBrowse, - ui->btn_mcsProgram}; - foreach(auto& btn, mcsButton) - btn->setEnabled(false); + QColor discardColor = Qt::darkRed; + ui->btn_discard->button(QDialogButtonBox::Discard)->setStyleSheet(QString("background:%1").arg( + discardColor.name())); + ui->btn_discard->update(); + + QColor discardAdcLogColor = Qt::red; + ui->btn_discardAdcLog->button(QDialogButtonBox::Discard)->setStyleSheet(QString( + "background:%1").arg( + discardAdcLogColor. + name())); + ui->btn_discardAdcLog->update(); QFont fontTitle; fontTitle.setBold(true); @@ -125,6 +140,8 @@ MainWindow::MainWindow(QWidget* parent) _dmaShow = false; _headerLogEn = false; _firstFrameEn = false; + _discardTempTest = false; + _discardAdcLog = false; _programFlag = true; _frameCount = 0; @@ -163,6 +180,8 @@ MainWindow::~MainWindow() delete _bCtrl; + delete _bpi; + delete _supRbValue; delete _faultStatus; @@ -173,9 +192,13 @@ MainWindow::~MainWindow() delete _emul; + delete _prb; + delete movie; delete _headerLogFile; + + delete _colorMap; } /*************************************************************************************************/ @@ -220,56 +243,71 @@ void MainWindow::timeout() if(_programFlag) { - double slave0CoreTemp = static_cast(_healStatus->fpgaCoreTemperature->slave0); - ui->l_slave0CoreTemp->setText(QString::number(slave0CoreTemp, 'g', 4)); - delay(1); + if(MOUNTED_SLAVE_FPGA & 1) + { + double slave0CoreTemp = static_cast(_healStatus->fpgaCoreTemperature->slave0); + ui->l_slave0CoreTemp->setText(QString::number(slave0CoreTemp, 'g', 4)); + delay(1); - double slave1CoreTemp = static_cast(_healStatus->fpgaCoreTemperature->slave1); - ui->l_slave1CoreTemp->setText(QString::number(slave1CoreTemp, 'g', 4)); - delay(1); + double slave0CoreVccInt = + static_cast(_healStatus->fpgaCoreVoltages->vccInt.slave0); + ui->l_slave0CoreVccInt->setText(QString::number(slave0CoreVccInt, 'g', 3)); + delay(1); - double slave2CoreTemp = static_cast(_healStatus->fpgaCoreTemperature->slave2); - ui->l_slave2CoreTemp->setText(QString::number(slave2CoreTemp, 'g', 4)); - delay(1); + double slave0CoreVccAux = + static_cast(_healStatus->fpgaCoreVoltages->vccAux.slave0); + ui->l_slave0CoreVccAux->setText(QString::number(slave0CoreVccAux, 'g', 4)); + delay(1); - double slave0CoreVccInt = static_cast(_healStatus->fpgaCoreVoltages->vccInt.slave0); - ui->l_slave0CoreVccInt->setText(QString::number(slave0CoreVccInt, 'g', 3)); - delay(1); + double slave0CoreVccBram = + static_cast(_healStatus->fpgaCoreVoltages->vccBram.slave0); + ui->l_slave0CoreVccBram->setText(QString::number(slave0CoreVccBram, 'g', 3)); + delay(1); + } - double slave1CoreVccInt = static_cast(_healStatus->fpgaCoreVoltages->vccInt.slave1); - ui->l_slave1CoreVccInt->setText(QString::number(slave1CoreVccInt, 'g', 3)); - delay(1); + if(MOUNTED_SLAVE_FPGA & 2) + { + double slave1CoreTemp = static_cast(_healStatus->fpgaCoreTemperature->slave1); + ui->l_slave1CoreTemp->setText(QString::number(slave1CoreTemp, 'g', 4)); + delay(1); - double slave2CoreVccInt = static_cast(_healStatus->fpgaCoreVoltages->vccInt.slave2); - ui->l_slave2CoreVccInt->setText(QString::number(slave2CoreVccInt, 'g', 3)); - delay(1); + double slave1CoreVccInt = + static_cast(_healStatus->fpgaCoreVoltages->vccInt.slave1); + ui->l_slave1CoreVccInt->setText(QString::number(slave1CoreVccInt, 'g', 3)); + delay(1); - double slave0CoreVccAux = static_cast(_healStatus->fpgaCoreVoltages->vccAux.slave0); - ui->l_slave0CoreVccAux->setText(QString::number(slave0CoreVccAux, 'g', 4)); - delay(1); + double slave1CoreVccAux = + static_cast(_healStatus->fpgaCoreVoltages->vccAux.slave1); + ui->l_slave1CoreVccAux->setText(QString::number(slave1CoreVccAux, 'g', 4)); + delay(1); - double slave1CoreVccAux = static_cast(_healStatus->fpgaCoreVoltages->vccAux.slave1); - ui->l_slave1CoreVccAux->setText(QString::number(slave1CoreVccAux, 'g', 4)); - delay(1); + double slave1CoreVccBram = + static_cast(_healStatus->fpgaCoreVoltages->vccBram.slave1); + ui->l_slave1CoreVccBram->setText(QString::number(slave1CoreVccBram, 'g', 3)); + delay(1); + } - double slave2CoreVccAux = static_cast(_healStatus->fpgaCoreVoltages->vccAux.slave2); - ui->l_slave2CoreVccAux->setText(QString::number(slave2CoreVccAux, 'g', 4)); - delay(1); + if(MOUNTED_SLAVE_FPGA & 4) + { + double slave2CoreTemp = static_cast(_healStatus->fpgaCoreTemperature->slave2); + ui->l_slave2CoreTemp->setText(QString::number(slave2CoreTemp, 'g', 4)); + delay(1); - double slave0CoreVccBram = - static_cast(_healStatus->fpgaCoreVoltages->vccBram.slave0); - ui->l_slave0CoreVccBram->setText(QString::number(slave0CoreVccBram, 'g', 3)); - delay(1); + double slave2CoreVccInt = + static_cast(_healStatus->fpgaCoreVoltages->vccInt.slave2); + ui->l_slave2CoreVccInt->setText(QString::number(slave2CoreVccInt, 'g', 3)); + delay(1); - double slave1CoreVccBram = - static_cast(_healStatus->fpgaCoreVoltages->vccBram.slave1); - ui->l_slave1CoreVccBram->setText(QString::number(slave1CoreVccBram, 'g', 3)); - delay(1); + double slave2CoreVccAux = + static_cast(_healStatus->fpgaCoreVoltages->vccAux.slave2); + ui->l_slave2CoreVccAux->setText(QString::number(slave2CoreVccAux, 'g', 4)); + delay(1); - double slave2CoreVccBram = - static_cast(_healStatus->fpgaCoreVoltages->vccBram.slave2); - ui->l_slave2CoreVccBram->setText(QString::number(slave2CoreVccBram, 'g', 3)); - delay(1); + double slave2CoreVccBram = + static_cast(_healStatus->fpgaCoreVoltages->vccBram.slave2); + ui->l_slave2CoreVccBram->setText(QString::number(slave2CoreVccBram, 'g', 3)); + delay(1); + } } else { @@ -282,7 +320,7 @@ void MainWindow::timeout() ui->l_slave2CoreVccBram}; foreach(auto& l, label) { - l->setText("Ukn"); + l->setText("ukn"); delay(1); } } @@ -649,8 +687,8 @@ void MainWindow::getPrbChange() /*************************************************************************************************/ void MainWindow::getFrameLost() { - MESSAGE_BOX(QString::number(_trx.getFrameLostCounter(), 10)); - //qDebug() << _trx.getFrameLostCounter(); + //MESSAGE_BOX(QString::number(_trx.getFrameLostCounter(), 10)); + qDebug() << _trx.getFrameLostCounter(); } /*************************************************************************************************/ @@ -723,6 +761,15 @@ void MainWindow::on_btn_readReg_clicked() switch(width) { case 0: + if(ui->rbtn_reg->isChecked()) + { + offset *= 2; + } + value = _usd->readShort(offset, bar); + ui->lcd_regvalue->setDigitCount(8); + break; + + case 1: if(ui->rbtn_reg->isChecked()) { offset *= 4; @@ -731,7 +778,7 @@ void MainWindow::on_btn_readReg_clicked() ui->lcd_regvalue->setDigitCount(8); break; - case 1: + case 2: if(ui->rbtn_reg->isChecked()) { offset *= 8; @@ -769,6 +816,14 @@ void MainWindow::on_btn_writeReg_clicked() switch(width) { case 0: + if(ui->rbtn_reg->isChecked()) + { + offset *= 2; + } + _usd->writeShort(offset, bar, static_cast(value)); + break; + + case 1: if(ui->rbtn_reg->isChecked()) { offset *= 4; @@ -776,7 +831,7 @@ void MainWindow::on_btn_writeReg_clicked() _usd->writeWord(offset, bar, static_cast(value)); break; - case 1: + case 2: if(ui->rbtn_reg->isChecked()) { offset *= 8; @@ -835,7 +890,8 @@ void MainWindow::programThreadFinish() try { #ifdef DEVELOP_UI - _trx.afeAdcsSync(); + _trx.afeAdcsSync(MOUNTED_SLAVE_FPGA); + _trx.gtReadReset(); #endif QString str = "done"; @@ -889,7 +945,7 @@ void MainWindow::on_btn_fpgaProgram_clicked() /*************************************************************************************************/ /************************************* MCS Programming *******************************************/ /*************************************************************************************************/ -void MainWindow::mcsProgram(QString &path) +void MainWindow::mcsProgram(QString& path) { try { @@ -928,7 +984,7 @@ void MainWindow::mcsThreadFinish() } /*************************************************************************************************/ -void MainWindow::mcsRead(QString &path) +void MainWindow::mcsRead(QString& path) { try { @@ -954,6 +1010,9 @@ void MainWindow::mcsReadFinish() QColor color = Qt::green; emit labelState(ui->l_mcsReadDone, str, color); + movie->stop(); + ui->l_mcsProgramming->hide(); + mcsButtonsEnable(true); } catch(SonoException& e) @@ -970,9 +1029,9 @@ void MainWindow::on_btn_mcsBrowse_clicked() try { QString mcsProgramPath = QFileDialog::getOpenFileName(this, - tr("MCS File"), - _mcsProgramFolder, - "*.mcs"); + tr("BPI Bin File"), + _mcsProgramFolder, + "*.bin"); if(mcsProgramPath.isEmpty() || mcsProgramPath.isNull()) { throw SonoException("No file is selected."); @@ -1023,7 +1082,7 @@ void MainWindow::on_btn_mcsRead_clicked() { mcsButtonsEnable(false); QString mcsSavePath = QFileDialog::getExistingDirectory(this, - tr("MCS File Reading"), + tr("BPI Bin Reading"), _mcsVerifyFolder, QFileDialog::ShowDirsOnly); if(mcsSavePath.isEmpty()) @@ -1037,6 +1096,8 @@ void MainWindow::on_btn_mcsRead_clicked() QFuture mcsReadFuture = QtConcurrent::run(this, &MainWindow::mcsRead, mcsSavePath); mcsReadWatcher.setFuture(mcsReadFuture); + + emit programmingGif(ui->l_mcsProgramming); } catch(SonoException& e) { @@ -1045,13 +1106,37 @@ void MainWindow::on_btn_mcsRead_clicked() } } +/*************************************************************************************************/ +void MainWindow::bpiTimerShot(quint16 ms) +{ + _bpiTimer.setSingleShot(true); + _bpiTimer.setInterval(ms); + _bpiTimer.start(); +} + +/*************************************************************************************************/ +void MainWindow::bpiTimeout(QString message) +{ + if(_bpiTimer.remainingTime() == 0) + { + throw SonoException(message.toStdString()); + } +} + +/*************************************************************************************************/ +void MainWindow::bpiStopTimer() +{ + _bpiTimer.stop(); +} + /*************************************************************************************************/ /*************************************************************************************************/ void MainWindow::mcsButtonsEnable(bool Enable) { - QList button={ui->btn_mcsProgram, - ui->btn_mcsRead}; - foreach (auto& btn, button) + QList button = {ui->btn_fpgaProgram, + ui->btn_mcsProgram, + ui->btn_mcsRead}; + foreach(auto& btn, button) { btn->setEnabled(Enable); } @@ -1060,10 +1145,12 @@ void MainWindow::mcsButtonsEnable(bool Enable) /*************************************************************************************************/ void MainWindow::slaveProgButtonsEnable(bool Enable) { - QList button={ui->btn_getFpgaVersion, - ui->btn_fpgaProgram, - ui->btn_gtReg}; - foreach (auto& btn, button) + QList button = {ui->btn_getFpgaVersion, + ui->btn_fpgaProgram, + ui->btn_mcsProgram, + ui->btn_mcsRead, + ui->btn_gtReg, }; + foreach(auto& btn, button) { btn->setEnabled(Enable); } @@ -1072,10 +1159,10 @@ void MainWindow::slaveProgButtonsEnable(bool Enable) /*************************************************************************************************/ void MainWindow::logButtonsEnable(bool Enable) { - QList button={ui->btn_setBiteLog, - ui->btn_setAdcLog, - ui->btn_dmaLogLast}; - foreach (auto& btn, button) + QList button = {ui->btn_setBiteLog, + ui->btn_setAdcLog, + ui->btn_dmaLogLast}; + foreach(auto& btn, button) { btn->setEnabled(Enable); } @@ -1137,9 +1224,6 @@ void MainWindow::delay(quint16 ms) //uncrustify off while(!(this->_bCtrl->checkTimeout())); //uncrustify on - - //delayTimer.singleShot(ms, &loop, &QEventLoop::quit); - //loop.exec(); } /*************************************************************************************************/ @@ -1170,24 +1254,24 @@ void MainWindow::getFramePacket(QByteArray packet) quint16 mPoint = ((static_cast(packet[141])) & 0x00FF) | (((static_cast(packet[142])) << 8) & 0xFF00); - if (_headerLogEn) - { - QTextStream _headerLog (_headerLogFile); - _headerLog << batchId << "," ; - _headerLog << subBatchId << "," ; - _headerLog << bLine << "," ; - _headerLog << bPoint << "," ; - _headerLog << frmType << "," ; - _headerLog << cri << "," ; - _headerLog << mLine << "," ; - _headerLog << mPoint << "," ; + if(_headerLogEn) + { + QTextStream _headerLog(_headerLogFile); + _headerLog << batchId << ","; + _headerLog << subBatchId << ","; + _headerLog << bLine << ","; + _headerLog << bPoint << ","; + _headerLog << frmType << ","; + _headerLog << cri << ","; + _headerLog << mLine << ","; + _headerLog << mPoint << ","; _headerLog << endl; } _mutex.lock(); _dmaBuffer.push_back(packet); - if (_lastBuffer.size() != 0) + if(_lastBuffer.size() != 0) { quint16 batchIdBuffer = ((static_cast(_lastBuffer[128])) & 0x00FF) | (((static_cast(_lastBuffer[129])) << 8) & 0xFF00); @@ -1199,13 +1283,14 @@ void MainWindow::getFramePacket(QByteArray packet) on_btn_scenStart_clicked(); qDebug() << "The batch id error is happened."; _mutex.unlock(); + return; } } _frame.push_back(_lastBuffer); - if ((batchId != batchIdBuffer) && (subBatchId == 0)) + if((batchId != batchIdBuffer) && (subBatchId == 0)) { _bufferedFrame.clear(); _bufferedFrame = _frame; @@ -1216,7 +1301,6 @@ void MainWindow::getFramePacket(QByteArray packet) _lastBuffer = packet; _mutex.unlock(); - } /*************************************************************************************************/ @@ -1597,21 +1681,21 @@ void MainWindow::show3d() ui->plot_2->xAxis->setLabel("Line"); ui->plot_2->yAxis->setLabel("Point"); - if (plotFrame.size() != 0) + if(plotFrame.size() != 0) { - foreach (const QByteArray& framePacket, plotFrame) + foreach(const QByteArray& framePacket, plotFrame) { batchId.append(((static_cast(framePacket[128])) & 0x00FF) | - (((static_cast(framePacket[129])) << 8) & 0xFF00)); + (((static_cast(framePacket[129])) << 8) & 0xFF00)); bPoint.append(((static_cast(framePacket[138])) & 0x00FF) | - (((static_cast(framePacket[139])) << 8) & 0xFF00)); + (((static_cast(framePacket[139])) << 8) & 0xFF00)); mPoint.append(((static_cast(framePacket[141])) & 0x00FF) | - (((static_cast(framePacket[142])) << 8) & 0xFF00)); + (((static_cast(framePacket[142])) << 8) & 0xFF00)); bLine.append(((static_cast(framePacket[136])) & 0x00FF) | - (((static_cast(framePacket[137])) << 8) & 0xFF00)); + (((static_cast(framePacket[137])) << 8) & 0xFF00)); subBatchId.append(static_cast(framePacket[130])); frmType.append(static_cast(framePacket[131])); @@ -1620,29 +1704,33 @@ void MainWindow::show3d() } } else + { return; + } - foreach (auto& bL, bLine) + foreach(auto& bL, bLine) { if(bL > 256 * 8) { qDebug() << "ERROR :: (B Line)" << bLine; + return; } line += bL; } - foreach (auto& bP, bPoint) + foreach(auto& bP, bPoint) { if(bP > 8192) { qDebug() << "ERROR :: (B Point)" << bPoint; + return; } point = bP; } - foreach (auto& fType, frmType) + foreach(auto& fType, frmType) { if(fType != 0) { @@ -1652,71 +1740,69 @@ void MainWindow::show3d() } } - qDebug() << "batchId" << batchId; - qDebug() << "subBatchId" << subBatchId; - qDebug() << "bLine" << bLine; - qDebug() << "bPoint" << bPoint; - qDebug() << "frmType" << frmType; - qDebug() << "cri" << cri; - qDebug() << "mLine" << mLine; - qDebug() << "mPoint" << mPoint; + qDebug() << "batchId" << batchId; + qDebug() << "subBatchId" << subBatchId; + qDebug() << "bLine" << bLine; + qDebug() << "bPoint" << bPoint; + qDebug() << "frmType" << frmType; + qDebug() << "cri" << cri; + qDebug() << "mLine" << mLine; + qDebug() << "mPoint" << mPoint; - _colorMap->data()->clear(); - _colorMap->data()->setSize(line, point); - _colorMap->data()->setRange(QCPRange(1, line), QCPRange(1, point)); + _colorMap->data()->clear(); + _colorMap->data()->setSize(line, point); + _colorMap->data()->setRange(QCPRange(1, line), QCPRange(1, point)); - quint32 max = 0; - auto indx = 0; - auto lnSum = 0; - foreach (const QByteArray& plotPacket, plotFrame) - { - auto lnPacket = (((static_cast(plotPacket[136])) & 0x00FF) | - (((static_cast(plotPacket[137])) << 8) & 0xFF00)); + quint32 max = 0; + auto indx = 0; + auto lnSum = 0; + foreach(const QByteArray& plotPacket, plotFrame) + { + auto lnPacket = (((static_cast(plotPacket[136])) & 0x00FF) | + (((static_cast(plotPacket[137])) << 8) & 0xFF00)); - for(auto ln = 0; ln < lnPacket; ln += 1) + for(auto ln = 0; ln < lnPacket; ln += 1) + { + for(auto pnt = 0; pnt < point; pnt += 1) { - for(auto pnt = 0; pnt < point; pnt += 1) - { + indx = (ln * point + pnt) * 4 + 160; + auto val = ((static_cast(plotPacket[indx])) & 0x000000FF) | + (((static_cast(plotPacket[indx + 1])) << 8) & 0x0000FF00) | + (((static_cast(plotPacket[indx + 2])) << 16) & 0x00FF0000) | + (((static_cast(plotPacket[indx + 3])) << 24) & 0xFF000000); - indx = (ln * point + pnt) * 4 + 160; - auto val = ((static_cast(plotPacket[indx])) & 0x000000FF) | - (((static_cast(plotPacket[indx + 1])) << 8) & 0x0000FF00) | - (((static_cast(plotPacket[indx + 2])) << 16) & 0x00FF0000) | - (((static_cast(plotPacket[indx + 3])) << 24) & 0xFF000000); - - if(max < val) - { - max = val; - } - _colorMap->data()->setCell(lnSum + ln, pnt, double(val)); + if(max < val) + { + max = val; } + _colorMap->data()->setCell(lnSum + ln, pnt, double(val)); } - lnSum = lnSum + lnPacket; } + lnSum = lnSum + lnPacket; + } - if(!ui->plot_2->plotLayout()->hasElement(0, 1)) - { - QCPColorScale* colorScale = new QCPColorScale(ui->plot_2); - ui->plot_2->plotLayout()->addElement(0, 1, colorScale); - colorScale->setType(QCPAxis::atRight); - _colorMap->setColorScale(colorScale); - colorScale->axis()->setLabel("Number"); - _colorMap->setGradient((QCPColorGradient::gpJet)); - QCPMarginGroup* marginGroup = new QCPMarginGroup(ui->plot_2); - ui->plot_2->axisRect()->setMarginGroup(QCP::msBottom | QCP::msTop, marginGroup); - colorScale->setMarginGroup(QCP::msBottom | QCP::msTop, marginGroup); - } + if(!ui->plot_2->plotLayout()->hasElement(0, 1)) + { + QCPColorScale* colorScale = new QCPColorScale(ui->plot_2); + ui->plot_2->plotLayout()->addElement(0, 1, colorScale); + colorScale->setType(QCPAxis::atRight); + _colorMap->setColorScale(colorScale); + colorScale->axis()->setLabel("Number"); _colorMap->setGradient((QCPColorGradient::gpJet)); - _colorMap->rescaleDataRange(); + QCPMarginGroup* marginGroup = new QCPMarginGroup(ui->plot_2); + ui->plot_2->axisRect()->setMarginGroup(QCP::msBottom | QCP::msTop, marginGroup); + colorScale->setMarginGroup(QCP::msBottom | QCP::msTop, marginGroup); + } + _colorMap->setGradient((QCPColorGradient::gpJet)); + _colorMap->rescaleDataRange(); - ui->plot_2->rescaleAxes(true); - ui->plot_2->replot(); + ui->plot_2->rescaleAxes(true); + ui->plot_2->replot(); } - catch (...) + catch(...) { qDebug() << "Error"; } - } /*************************************************************************************************/ @@ -1766,12 +1852,12 @@ void MainWindow::show2d() /*************************************************************************************************/ //void MainWindow::catchLogCount(quint32 counter, quint32 logRange, QProgressDialog* _progress) //{ -// _progress->setMinimumSize(300, 100); -// _progress->setLabelText("Please wait..."); -// _progress->setWindowTitle("Logging"); -// _progress->setRange(0, static_cast(logRange)); -// _progress->setModal(true); -// _progress->setValue(static_cast(counter)); +//_progress->setMinimumSize(300, 100); +//_progress->setLabelText("Please wait..."); +//_progress->setWindowTitle("Logging"); +//_progress->setRange(0, static_cast(logRange)); +//_progress->setModal(true); +//_progress->setValue(static_cast(counter)); //} /*************************************************************************************************/ @@ -1779,7 +1865,7 @@ void MainWindow::on_chk_headerLogEn_clicked(bool checked) { try { - if (checked) + if(checked) { if(_headerLogFile->fileName().isEmpty()) { @@ -1791,9 +1877,9 @@ void MainWindow::on_chk_headerLogEn_clicked(bool checked) throw SonoException("Couldn't open file for logging"); } - QTextStream _headerLog (_headerLogFile); - _headerLog << "batchId, " << "subBatchId, " << "bLine, " << "bPoint, "; - _headerLog << "frmType, " << "cri, " << "mLine, " << "mPoint, "; + QTextStream _headerLog(_headerLogFile); + _headerLog << "batchId, " << "subBatchId, " << "bLine, " << "bPoint, "; + _headerLog << "frmType, " << "cri, " << "mLine, " << "mPoint, "; _headerLog << endl; _headerLogEn = true; @@ -2231,7 +2317,7 @@ QString MainWindow::releaseCodeVersion(quint32& value) } str.clear(); - if (strList.size() < 10) + if(strList.size() < 10) { return "0"; } @@ -2255,24 +2341,33 @@ void MainWindow::on_btn_getFpgaVersion_clicked() auto value = _version->masterCode; ui->l_masterVersion->setText(releaseCodeVersion(value)); - value = _version->slave0Code; - ui->l_slave0Version->setText(releaseCodeVersion(value)); + if(MOUNTED_SLAVE_FPGA & 1) + { + value = _version->slave0Code; + ui->l_slave0Version->setText(releaseCodeVersion(value)); + } - value = _version->slave1Code; - ui->l_slave1Version->setText(releaseCodeVersion(value)); + if(MOUNTED_SLAVE_FPGA & 2) + { + value = _version->slave1Code; + ui->l_slave1Version->setText(releaseCodeVersion(value)); + } - value = _version->slave2Code; - ui->l_slave2Version->setText(releaseCodeVersion(value)); + if(MOUNTED_SLAVE_FPGA & 4) + { + value = _version->slave2Code; + ui->l_slave2Version->setText(releaseCodeVersion(value)); + } } /*************************************************************************************************/ /************************************* Scenario Setting ******************************************/ /*************************************************************************************************/ -void MainWindow::setScenario(const string& h5Path) +void MainWindow::setScenario(const QString& h5Path) { try { - if (ui->tb_scenFilesPath->text().isEmpty()) + if(ui->tb_scenFilesPath->text().isEmpty()) { throw SonoException("No file is selected."); } @@ -2300,7 +2395,7 @@ void MainWindow::setScenario(const string& h5Path) QVector lineFilterLut; QVector stbLut; - hdf.hdf5Path(h5Path); + hdf.hdf5Path(h5Path.toStdString()); hdf.scenarioRead(scenParams); hdf.prbDependParamsRead(prbDepParams); @@ -2340,12 +2435,12 @@ void MainWindow::on_btn_setScenario_clicked() QString sramScenario = "/scenGenOutput/scenario.h5"; QString h5Path = ui->tb_scenFilesPath->text() + sramScenario; - if (ui->tb_scenFilesPath->text().isEmpty()) + if(ui->tb_scenFilesPath->text().isEmpty()) { throw SonoException("No file is selected."); } - emit scenarioReady(h5Path.toStdString()); + emit scenarioReady(h5Path); str = "done"; color = Qt::green; @@ -2385,7 +2480,7 @@ void MainWindow::setScenarioCompare(const QString& scenPath) { try { - if (scenPath.isEmpty()) + if(scenPath.isEmpty()) { throw SonoException("No file is selected."); } @@ -2438,7 +2533,7 @@ void MainWindow::on_btn_scenBrowse_clicked() tr("Scenario File"), _scenarioFolder, QFileDialog::ShowDirsOnly); - if (scenPath.isEmpty()) + if(scenPath.isEmpty()) { throw SonoException("No file is selected."); } @@ -2619,16 +2714,14 @@ void MainWindow::on_btn_trxRomInfoWrite_clicked() QByteArray sendingArray = infoStr.toLatin1(); trxEepromWrite(sendingArray, EEPROM_INFO_BEGIN, _bCtrl); -// QByteArray sendingArray; -// unsigned char crcArray[] = {0x4, 0x0, 0x13, 0x0, 0x27, 0x0, 0x28, 0x0, 0xEB, 0x1, -// 0xAC, 0x5, 0xAC, 0x6, 0x4C, 0x6, 0xB0, 0x6, 0xB2, -// 0, 0, 0, 0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -// 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; -// for(auto var : crcArray) -// sendingArray.push_back(static_cast(var)); -// trxEepromWrite(sendingArray, EEPROM_CRC_BEGIN, _bCtrl); // TRX - - +//QByteArray sendingArray; +//unsigned char crcArray[] = {0x4, 0x0, 0x13, 0x0, 0x27, 0x0, 0x28, 0x0, 0xEB, 0x1, +//0xAC, 0x5, 0xAC, 0x6, 0x4C, 0x6, 0xB0, 0x6, 0xB2, +//0, 0, 0, 0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +//0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; +//for(auto var : crcArray) +//sendingArray.push_back(static_cast(var)); +//trxEepromWrite(sendingArray, EEPROM_CRC_BEGIN, _bCtrl); // TRX } catch(SonoException& e) { @@ -3062,7 +3155,7 @@ void MainWindow::on_btn_biteSetScenario_clicked() QString sramScenario = "/scenGenOutput/scenario.h5"; QString h5Path = ui->tb_biteScenPath->text() + sramScenario; - if (ui->tb_biteScenPath->text().isEmpty()) + if(ui->tb_biteScenPath->text().isEmpty()) { throw SonoException("No file is selected."); } @@ -3071,7 +3164,7 @@ void MainWindow::on_btn_biteSetScenario_clicked() QColor color = Qt::red; emit labelState(ui->l_biteScenFillingDone, str, color); - emit scenarioReady(h5Path.toStdString()); + emit scenarioReady(h5Path); str = "done"; color = Qt::green; @@ -3311,7 +3404,7 @@ void MainWindow::on_btn_adcLogBrowse_clicked() } /*************************************************************************************************/ -void MainWindow::on_btn_setAdcLog_clicked() +void MainWindow::catchAdcLog() { try { @@ -3380,7 +3473,7 @@ void MainWindow::on_btn_setAdcLog_clicked() } } - if (ui->chk_txdacEn->isChecked()) + if(ui->chk_txdacEn->isChecked()) { _trx.setAdgCfg(adgIQ); _trx.setTxDacEnable(BITE_INTERVAL, true); @@ -3440,8 +3533,14 @@ void MainWindow::on_btn_setAdcLog_clicked() _trx.adcCaptureDone(); _trx.adcLoggerStart(adcLoggerPath, "logCnt(" + QString::number(var) + ")"); - ui->lcd_adcCounter->display(var+1); + ui->lcd_adcCounter->display(var + 1); qApp->processEvents(); + + if(_discardAdcLog) + { + _discardAdcLog = false; + break; + } } str = "done"; @@ -3471,6 +3570,12 @@ void MainWindow::on_btn_setAdcLog_clicked() ui->lcd_adcCounter->display((var - startIdx) + 1); qApp->processEvents(); + + if(_discardAdcLog) + { + _discardAdcLog = false; + break; + } } str = "done"; @@ -3483,7 +3588,25 @@ void MainWindow::on_btn_setAdcLog_clicked() _trx.setAdgCfg(adgGnd); logButtonsEnable(true); + } + catch(SonoException& e) + { + _trx.setAfePwr(afePwrdnEnable); + _trx.setDebuggerMode(pulserHz, true); + _trx.setDebuggerMode(pulserHz, false); + _trx.setTxDacEnable(BITE_INTERVAL, false); + _trx.setAdgCfg(adgGnd); + logButtonsEnable(true); + qDebug() << e.what(); + } +} +/*************************************************************************************************/ +void MainWindow::on_btn_setAdcLog_clicked() +{ + try + { + emit adcLog(); } catch(SonoException& e) { @@ -3523,13 +3646,13 @@ void MainWindow::on_chk_pulserTstModeEn_clicked(bool checked) /*************************************************************************************************/ void MainWindow::on_cb_pulserTstMode_currentIndexChanged(int index) { - if (ui->chk_pulserTstModeEn->isChecked()) + if(ui->chk_pulserTstModeEn->isChecked()) { - if (index == 0) + if(index == 0) { _trx.setDebuggerMode(pulserHz, true); } - if (index == 1) + if(index == 1) { _trx.setDebuggerMode(pulserTr, true); } @@ -3550,31 +3673,37 @@ void MainWindow::on_chk_afeConfig_clicked(bool checked) } } +/*************************************************************************************************/ +void MainWindow::on_btn_discardAdcLog_clicked(void) +{ + _discardAdcLog = true; +} + /*************************************************************************************************/ /***************************************** Misc Widget *******************************************/ /*************************************************************************************************/ void MainWindow::on_btn_gtReg_clicked() { - quint32 bar = 0; auto result = "OK"; - uint32_t offsetRd[24] = {0x14008 * 4, 0x114008 * 4, 0x214008 * 4, 0x314008 * 4, - 0x1400B * 4, 0x11400B * 4, 0x21400B * 4, 0x31400B * 4, - 0x1400C * 4, 0x11400C * 4, 0x21400C * 4, 0x31400C * 4, - 0x1400D * 4, 0x11400D * 4, 0x21400D * 4, 0x31400D * 4, - 0x14010 * 4, 0x114010 * 4, 0x214010 * 4, 0x314010 * 4, - 0x14011 * 4, 0x114011 * 4, 0x214011 * 4, 0x314011 * 4}; - uint32_t correctVal[24] = {0x0, 0xFF43, 0xFF43, 0xFF43, - 0x0, 0xFFFF, 0xFFFF, 0xFFFF, - 0x0, 0xF0F, 0xF0F, 0xF0F, - 0xFF43, 0xF04F, 0xFF43, 0xFF43, - 0xFFFF, 0xFF00, 0xFFFF, 0xFFFF, - 0xF0F, 0xF00, 0xF0F, 0xF0F}; + QList offsetRd = {0x14008 * 4, 0x114008 * 4, 0x214008 * 4, 0x314008 * 4, + 0x1400B * 4, 0x11400B * 4, 0x21400B * 4, 0x31400B * 4, + 0x1400C * 4, 0x11400C * 4, 0x21400C * 4, 0x31400C * 4, + 0x1400D * 4, 0x11400D * 4, 0x21400D * 4, 0x31400D * 4, + 0x14010 * 4, 0x114010 * 4, 0x214010 * 4, 0x314010 * 4, + 0x14011 * 4, 0x114011 * 4, 0x214011 * 4, 0x314011 * 4}; + QList correctVal = {0x0, 0xFF43, 0xFF43, 0xFF43, + 0x0, 0xFFFF, 0xFFFF, 0xFFFF, + 0x0, 0xF0F, 0xF0F, 0xF0F, + 0xFF43, 0xF04F, 0xFF43, 0xFF43, + 0xFFFF, 0xFF00, 0xFFFF, 0xFFFF, + 0xF0F, 0xF00, 0xF0F, 0xF0F}; + qDebug() << ""; qDebug() << "--- GT Status Registers Before Reset--- "; - for(auto i = 0; i < 20; i++) + for(auto i = 0; i < 24; i++) { - auto value = _usd->readWord(offsetRd[i], bar); - if(value == correctVal[i]) + auto value = _usd->readWord(offsetRd.at(i), BAR_REG); + if(value == correctVal.at(i)) { result = "OK"; } @@ -3582,20 +3711,21 @@ void MainWindow::on_btn_gtReg_clicked() { result = "NOK"; } - qDebug() << QString::number(offsetRd[i] / 4, 16) << QString::number(value, 16) << result; + qDebug() << QString::number(offsetRd.at(i) / 4, 16) << QString::number(value, 16) << result; } qDebug() << "--- ------------------- --- "; qDebug() << ""; qDebug() << "-------- Reset Start ---------"; QList resetAddr; - resetAddr << 0x14000 << 0x14003 << 0x114000 << 0x114003 - << 0x214000 << 0x214003 << 0x314000 << 0x314003; + resetAddr << 0x14000 << 0x14003 << 0x114000 << 0x114003 + << 0x214000 << 0x214003 << 0x314000 << 0x314003; + for(auto value = 2; value >= 0; value--) { foreach(auto& offset, resetAddr) { - _usd->writeWord(offset * 4, bar, static_cast(value)); + _usd->writeWord(offset * 4, BAR_REG, static_cast(value)); } } qDebug() << "-------- Reset Done ---------"; @@ -3604,10 +3734,10 @@ void MainWindow::on_btn_gtReg_clicked() delay(1000); qDebug() << "--- GT Status Registers After Reset--- "; - for(auto i = 0; i < 20; i++) + for(auto i = 0; i < 24; i++) { - auto value = _usd->readWord(offsetRd[i], bar); - if(value == correctVal[i]) + auto value = _usd->readWord(offsetRd.at(i), BAR_REG); + if(value == correctVal.at(i)) { result = "OK"; } @@ -3615,7 +3745,7 @@ void MainWindow::on_btn_gtReg_clicked() { result = "NOK"; } - qDebug() << QString::number(offsetRd[i] / 4, 16) << QString::number(value, 16) << result; + qDebug() << QString::number(offsetRd.at(i) / 4, 16) << QString::number(value, 16) << result; } qDebug() << "--- ------------------- --- "; qDebug() << ""; @@ -3625,24 +3755,22 @@ void MainWindow::on_btn_gtReg_clicked() /*************************************************************************************************/ void MainWindow::exitApp() { - QList > afePwrCheck {_trx.getAfeReg(slave0, 0xC5), + QList > afePwrCheck {_trx.getAfeReg(slave0, 0xC5), _trx.getAfeReg(slave1, 0xC5), _trx.getAfeReg(slave2, 0xC5)}; - - foreach (auto& afePwr, afePwrCheck) + foreach(auto& afePwr, afePwrCheck) { quint32 afe0 = afePwr.at(0) & 0x80000000; quint32 afe1 = afePwr.at(1) & 0x80000000; quint32 afe2 = afePwr.at(2) & 0x80000000; quint32 afe3 = afePwr.at(3) & 0x80000000; - if ((afe0 & afe1 & afe2 & afe3) == 0) + if((afe0 & afe1 & afe2 & afe3) == 0) { ui->btn_scenStart->setText("Scenario Stop"); on_btn_scenStart_clicked(); break; } - } _trx.emulatorStop(); @@ -3653,48 +3781,229 @@ void MainWindow::exitApp() this->QWidget::close(); } +/*************************************************************************************************/ +void MainWindow::on_chk_powerAo_clicked(bool checked) +{ + _trx.powerAo(checked); +} + +/*************************************************************************************************/ +void MainWindow::catchGtReset(quint32 progCnt, quint32 taskItr, quint16 delayPerTask) +{ + try + { + for(quint32 i = 0; i < progCnt; i++) + { + _programFlag = false; + delay(delayPerTask); + qApp->processEvents(); + + QList button = {ui->btn_getFpgaVersion, + ui->btn_fpgaProgram, + ui->btn_gtReg}; + foreach(auto& btn, button) + { + btn->setEnabled(false); + } + + QString str = "doing"; + QColor color = Qt::red; + emit labelState(ui->l_programDone, str, color); + + auto path = ui->tb_fpgaBit->text(); + + _trx.slaveFpgaProgram(path); +#ifdef DEVELOP_UI + _trx.afeAdcsSync(MOUNTED_SLAVE_FPGA); +#endif + + str = "done"; + color = Qt::green; + emit labelState(ui->l_programDone, str, color); + delay(delayPerTask); + _programFlag = true; + qApp->processEvents(); + + foreach(auto& btn, button) + { + btn->setEnabled(true); + qApp->processEvents(); + } + + for(quint32 j = 0; j < taskItr; j++) + { + delay(delayPerTask); + on_btn_gtReg_clicked(); + + if(_discardTempTest) + { + _discardTempTest = false; + + return; + } + } + } + } + catch(SonoException& e) + { + slaveProgButtonsEnable(true); + qDebug() << e.what(); + } +} + /*************************************************************************************************/ void MainWindow::on_btn_tempTest_clicked() { - for(auto i=0; i < 5; i++) + auto progCnt = ui->tb_progCnt->text().toUInt(); + auto taskItr = ui->tb_taskItr->text().toUInt(); + auto delayPerTask = ui->tb_taskDelay->text().toUShort(); + try { - _programFlag = false; - delay(1000); - qApp->processEvents(); + emit gtReset(progCnt, taskItr, delayPerTask); + } + catch(SonoException& e) + { + slaveProgButtonsEnable(true); + qDebug() << e.what(); + } +} + +/*************************************************************************************************/ +void MainWindow::catchStatusLog(quint32 progCnt, + quint32 taskItr, + quint16 delayPerTask, + quint16 scenStartDuration) +{ + try + { + QString sramScenario = "/scenGenOutput/scenario.h5"; + QString h5Path = ui->tb_scenFilesPath->text() + sramScenario; + if(ui->tb_scenFilesPath->text().isEmpty()) + { + throw SonoException("No file is selected."); + } - QList button={ui->btn_getFpgaVersion, - ui->btn_fpgaProgram, - ui->btn_gtReg}; - foreach (auto& btn, button) + QString path = "/home/hasis/Desktop/hardware/Log/statusVector/statusLog.txt"; + QFile file(path); + QTextStream statusLog(&file); + + if(!file.open(QIODevice::WriteOnly)) { - btn->setEnabled(false); + throw SonoException("Couldn't save status log file."); } - QString str = "doing"; - QColor color = Qt::red; - emit labelState(ui->l_programDone, str, color); + for(quint32 i = 0; i < progCnt; i++) + { + _programFlag = false; + delay(delayPerTask); + qApp->processEvents(); - auto path = ui->tb_fpgaBit->text(); + QList button = {ui->btn_getFpgaVersion, + ui->btn_fpgaProgram, + ui->btn_gtReg}; + foreach(auto& btn, button) + { + btn->setEnabled(false); + } - _trx.slaveFpgaProgram(path); + QString str = "doing"; + QColor color = Qt::red; + emit labelState(ui->l_programDone, str, color); + + auto path = ui->tb_fpgaBit->text(); + + _trx.slaveFpgaProgram(path); + qApp->processEvents(); #ifdef DEVELOP_UI - _trx.afeAdcsSync(); + _trx.afeAdcsSync(MOUNTED_SLAVE_FPGA); + _trx.gtReadReset(); #endif + str = "done"; + color = Qt::green; + emit labelState(ui->l_programDone, str, color); + delay(delayPerTask); + _programFlag = true; + qApp->processEvents(); - str = "done"; - color = Qt::green; - emit labelState(ui->l_programDone, str, color); - - _programFlag = true; - qApp->processEvents(); + foreach(auto& btn, button) + { + btn->setEnabled(true); + qApp->processEvents(); + } - foreach (auto& btn, button) - { - btn->setEnabled(true); + delay(delayPerTask); + str = "doing"; + color = Qt::red; + emit labelState(ui->l_scenFillingDone, str, color); + setScenario(h5Path); + str = "done"; + color = Qt::green; + emit labelState(ui->l_scenFillingDone, str, color); qApp->processEvents(); + + for(quint32 j = 0; j < taskItr; j++) + { + delay(delayPerTask); + on_btn_scenStart_clicked(); + qApp->processEvents(); + + delay(scenStartDuration); + + quint32 statusVec = _usd->readWord(0, 0); + statusLog << QString::number(statusVec, 16) << endl; + qApp->processEvents(); + + on_btn_scenStart_clicked(); + qApp->processEvents(); + + if(statusVec != 0x18000) + { + break; + } + + if(_discardTempTest) + { + break; + } + } + + if(_discardTempTest) + { + _discardTempTest = false; + break; + } } + file.flush(); + file.close(); + qApp->processEvents(); + } + catch(SonoException& e) + { + slaveProgButtonsEnable(true); + qDebug() << e.what(); + } +} - delay(100); - on_btn_gtReg_clicked(); +/*************************************************************************************************/ +void MainWindow::on_btn_tempStatusLog_clicked() +{ + auto progCnt = ui->tb_progCnt->text().toUInt(); + auto taskItr = ui->tb_taskItr->text().toUInt(); + auto delayPerTask = ui->tb_taskDelay->text().toUShort(); + quint16 scenStartDuration = ui->tb_scenStartDuration->text().toUShort() * 1000; + try + { + emit statusLog(progCnt, taskItr, delayPerTask, scenStartDuration); + } + catch(SonoException& e) + { + slaveProgButtonsEnable(true); + qDebug() << e.what(); } } + +/*************************************************************************************************/ +void MainWindow::on_btn_discard_clicked(void) +{ + _discardTempTest = true; +} diff --git a/mainwindow.h b/mainwindow.h old mode 100644 new mode 100755 index 1d4052a..9b8dc75 --- a/mainwindow.h +++ b/mainwindow.h @@ -115,12 +115,14 @@ private: QEventLoop loop; - QTimer delayTimer; + QTimer _bpiTimer; EmulatorProperties* _emul; BoardsCtrlMngt* _bCtrl; + BpiFlash* _bpi; + SupervisorRbValue* _supRbValue; MpsFaultStatus* _faultStatus; @@ -213,13 +215,15 @@ private: bool _fpsFlag; bool _firstFrameEn; bool _programFlag; + bool _discardTempTest; + bool _discardAdcLog; // uncrustify off private slots: void exitApp(); - void setScenario(const string& h5Path); + void setScenario(const QString& h5Path); void getFramePacket (QByteArray packet); @@ -237,6 +241,18 @@ private slots: void getProgrammingGif(QLabel* label); + void bpiTimerShot(quint16 ms); + + void bpiTimeout(QString message); + + void bpiStopTimer(); + + void catchGtReset(quint32 progCnt, quint32 taskItr, quint16 delayPerTask); + + void catchStatusLog(quint32 progCnt, quint32 taskItr, quint16 delayPerTask, quint16 scenStartDuration); + + void catchAdcLog(void); + void on_rbtn_reg_toggled(bool checked); void on_rbtn_offset_toggled(bool checked); @@ -361,6 +377,14 @@ private slots: void on_btn_tempTest_clicked(); + void on_chk_powerAo_clicked(bool checked); + + void on_btn_tempStatusLog_clicked(); + + void on_btn_discard_clicked(void); + + void on_btn_discardAdcLog_clicked(void); + signals: void showMessage(QString message); void threeDReady(); @@ -368,8 +392,14 @@ signals: void connectedPrbChange(); void frameLostCall(); void labelState(QLabel* label, QString str, QColor color); - void scenarioReady(const string& h5Path); + void scenarioReady(const QString& h5Path); void programmingGif(QLabel* label); + void adcLog(); + void statusLog(quint32 progCnt, + quint32 taskItr, + quint16 delayPerTask, + quint16 scenStartDuration); + void gtReset(quint32 progCnt, quint32 taskItr, quint16 delayPerTask); }; #endif // MAINWINDOW_H diff --git a/mainwindow.ui b/mainwindow.ui old mode 100644 new mode 100755 index 7b34e81..84a9a01 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -42,7 +42,7 @@ - 3 + 5 @@ -190,6 +190,11 @@ false + + + 16 + + 32 @@ -694,7 +699,7 @@ - MCS file: + Bin file: @@ -703,13 +708,12 @@ 50 - true false - false - false - false + + Qt::ClickFocus + @@ -736,7 +740,7 @@ 10 60 - 148 + 102 21 @@ -754,7 +758,7 @@ - Programming: + Writing: @@ -793,13 +797,13 @@ - Program MCS + BPI Bin Write - 260 + 240 60 221 21 @@ -815,14 +819,14 @@ 660 30 121 - 51 + 52 - MCS Read + BPI Bin Read @@ -876,25 +880,6 @@ 23 - - - 75 - true - - - - GT reset/read - - - - - - 670 - 320 - 121 - 23 - - 50 @@ -902,7 +887,7 @@ - Temp Test + GT reset/read @@ -1282,7 +1267,7 @@ 690 70 - 103 + 106 52 @@ -2840,8 +2825,8 @@ 660 30 - 133 - 81 + 141 + 82 @@ -2961,6 +2946,9 @@ false + + Qt::ClickFocus + 1 @@ -2991,6 +2979,9 @@ false + + Qt::ClickFocus + 0 @@ -3024,7 +3015,7 @@ 190 30 - 221 + 224 60 @@ -3144,7 +3135,7 @@ 190 120 - 601 + 501 41 @@ -3279,6 +3270,271 @@ TxDAC Enable + + + + 710 + 120 + 81 + 41 + + + + + 50 + false + + + + Qt::ClickFocus + + + QDialogButtonBox::Discard + + + + + + + Temp Test + + + + + 680 + 30 + 121 + 31 + + + + + 75 + true + + + + GT Reset + + + + + + 680 + 80 + 121 + 31 + + + + + 75 + true + + + + Status Log + + + + + + 10 + 30 + 171 + 27 + + + + + + + + 50 + false + + + + Prog Count: + + + + + + + Qt::Horizontal + + + + 85 + 20 + + + + + + + + + 50 + false + + + + 1 + + + + + + + + + 10 + 70 + 171 + 27 + + + + + + + + 50 + false + + + + Task Iteration: + + + + + + + + 50 + false + + + + 1 + + + + + + + + + 10 + 130 + 211 + 27 + + + + + + + + 50 + false + + + + Delay per Task(ms): + + + + + + + Qt::Horizontal + + + + 100 + 20 + + + + + + + + + 50 + false + + + + 100 + + + + + + + + + 10 + 170 + 211 + 27 + + + + + + + + 50 + false + + + + Scen Start Duration(s): + + + + + + + + 50 + false + + + + 2 + + + + + + + + + 720 + 310 + 81 + 41 + + + + + 50 + false + + + + Qt::ClickFocus + + + QDialogButtonBox::Discard + @@ -3494,8 +3750,8 @@ 470 30 - 58 - 122 + 63 + 134 @@ -3876,7 +4132,7 @@ 710 50 101 - 111 + 119 @@ -3935,7 +4191,7 @@ 10 170 191 - 41 + 42 @@ -4006,7 +4262,7 @@ 210 170 191 - 41 + 42 @@ -4077,7 +4333,7 @@ 410 170 191 - 41 + 42 @@ -4148,7 +4404,7 @@ 610 170 191 - 41 + 42 @@ -4273,7 +4529,7 @@ 540 30 - 179 + 193 19 @@ -4364,7 +4620,7 @@ 0 20 - 509 + 512 51 @@ -5602,8 +5858,8 @@ 710 120 - 104 - 62 + 114 + 63 @@ -5644,6 +5900,19 @@ + + + + 540 + 30 + 85 + 21 + + + + AO Power + + @@ -5653,7 +5922,7 @@ 0 0 841 - 20 + 22 diff --git a/qcustomplot.cpp b/qcustomplot.cpp old mode 100644 new mode 100755 diff --git a/qcustomplot.h b/qcustomplot.h old mode 100644 new mode 100755 diff --git a/sram_frame.bin b/sram_frame.bin old mode 100644 new mode 100755 diff --git a/src/model/hardware/Hardware.cpp b/src/model/hardware/Hardware.cpp old mode 100644 new mode 100755 diff --git a/src/model/hardware/core/Fan.cpp b/src/model/hardware/core/Fan.cpp old mode 100644 new mode 100755 diff --git a/src/model/hardware/core/HardwareCore.cpp b/src/model/hardware/core/HardwareCore.cpp old mode 100644 new mode 100755 diff --git a/src/model/hardware/core/HwBoard.cpp b/src/model/hardware/core/HwBoard.cpp old mode 100644 new mode 100755 diff --git a/src/model/hardware/core/IBoard.cpp b/src/model/hardware/core/IBoard.cpp old mode 100644 new mode 100755 diff --git a/src/model/hardware/core/PowerBoard.cpp b/src/model/hardware/core/PowerBoard.cpp old mode 100644 new mode 100755 diff --git a/src/model/hardware/core/PowerBoardFactory.cpp b/src/model/hardware/core/PowerBoardFactory.cpp old mode 100644 new mode 100755 diff --git a/src/model/hardware/core/PowerBoardStatus.cpp b/src/model/hardware/core/PowerBoardStatus.cpp old mode 100644 new mode 100755 diff --git a/src/model/hardware/core/RelayBoard.cpp b/src/model/hardware/core/RelayBoard.cpp old mode 100644 new mode 100755 diff --git a/src/model/hardware/core/RelayBoardFactory.cpp b/src/model/hardware/core/RelayBoardFactory.cpp old mode 100644 new mode 100755 diff --git a/src/model/hardware/core/Temperature.cpp b/src/model/hardware/core/Temperature.cpp old mode 100644 new mode 100755 diff --git a/src/model/hardware/core/TrxBoardFactory.cpp b/src/model/hardware/core/TrxBoardFactory.cpp old mode 100644 new mode 100755 diff --git a/src/model/hardware/core/Voltage.cpp b/src/model/hardware/core/Voltage.cpp old mode 100644 new mode 100755 diff --git a/src/model/hardware/core/lowLevelApi/TrxBoard.cpp b/src/model/hardware/core/lowLevelApi/TrxBoard.cpp old mode 100644 new mode 100755 index e440b2f..5d39bcd --- a/src/model/hardware/core/lowLevelApi/TrxBoard.cpp +++ b/src/model/hardware/core/lowLevelApi/TrxBoard.cpp @@ -22,45 +22,66 @@ T TrxBoard::byteArray2UintLittleEndian(QByteArray& byte) const return data; } +void TrxBoard::sendPacket() +{ + auto counter(0); + while(_run) + { + if(_swCounter == 0) + { + std::this_thread::sleep_for(std::chrono::milliseconds(3)); + continue; + } + else if(_swCounter != counter) + { + auto framePacket = QByteArray::fromRawData(_device.getBufferPtr(counter), BUFFER_SIZE); + + counter++; + if(counter >= SW_BUFFER_NUM) + { + counter = 0; + } + +#ifdef DEVELOP_UI + emit sendFramePacket(framePacket); +#else + packetEngine.newData(framePacket); +#endif + } + } +} + void TrxBoard::readData() { _swCounter = _device.getCounter(); - while(_run) - { - auto cnt = _device.getCounter(); + while(_run) + { + auto cnt = _device.getCounter(); - if(cnt == 0) - { + if(cnt == 0) + { _hwCounter = 0; std::this_thread::sleep_for(std::chrono::milliseconds(3)); - continue; - } - else if(cnt != _hwCounter) - { - _hwCounter++; + continue; + } + else if(cnt != _hwCounter) + { + _hwCounter++; if(_hwCounter > HW_BUFFER_NUM) { _hwCounter = 1; } - _device.copy(_hwCounter - 1, _swCounter); - - auto temp = QByteArray::fromRawData(_device.getBufferPtr(_swCounter), BUFFER_SIZE); + _device.copy(_hwCounter - 1, _swCounter); -#ifdef DEVELOP_UI - emit sendFramePacket(temp); -#else - packetEngine.newData(temp); -#endif - - _swCounter++; - if(_swCounter >= SW_BUFFER_NUM) - { - _swCounter = 0; - } - } - } + _swCounter++; + if(_swCounter >= SW_BUFFER_NUM) + { + _swCounter = 0; + } + } + } } void TrxBoard::sramClear(eSramClear clearMode) @@ -99,110 +120,138 @@ void TrxBoard::scenParamsFilling(TrxBoard::eScenParams cmd) } } -void TrxBoard::afeAdcsSync() const +void TrxBoard::afeAdcsSync(const quint8& slaveMounted) { - quint32 syncErr(0); + auto afeSyncStatus = [this](Afe* Slave) + { + this->_bCtrlMngt->timerShot(1); + while(!(Slave->getAfeSyncDone())) + { + if(this->_bCtrlMngt->checkTimeout()) + { + throw SonoException( + "The timeout of the afe adcs sync is happend without receiving of sync done."); + } + } + this->_bCtrlMngt->timerStop(); - this->_bCtrlMngt->timerShot(20); - while(!(this->_bCtrlMngt->checkTimeout())); + if(MOUNTED_SLAVE_FPGA == 7) + { + quint32 syncErr = Slave->getAfeSyncError(); + if(syncErr != 0) + { + throw SonoException( + "The error of the afe adcs sync is happend."); + } + } + }; + + this->delay(20); this->_misc->setSyncMode(adcSyncMode); this->_misc->setManualSync(true); this->_misc->setManualSync(false); this->_misc->setManualSync(bfSyncMode); - this->_bCtrlMngt->timerShot(1); - while(!((this->_afeSlave0->getAfeSyncDone()) && - (this->_afeSlave1->getAfeSyncDone()) && - (this->_afeSlave2->getAfeSyncDone()))) + if(slaveMounted & 1) { - if(this->_bCtrlMngt->checkTimeout()) - { - throw SonoException( - "The timeout of the afe adcs sync is happend without receiving of sync done."); - } + afeSyncStatus(_afeSlave0); } - this->_bCtrlMngt->timerStop(); - syncErr = this->_afeSlave0->getAfeSyncError(); - syncErr += this->_afeSlave1->getAfeSyncError(); - syncErr += this->_afeSlave2->getAfeSyncError(); + if(slaveMounted & 2) + { + afeSyncStatus(_afeSlave1); + } - if(syncErr != 0) + if(slaveMounted & 4) { - throw SonoException("The error of the afe adcs sync is happend."); + afeSyncStatus(_afeSlave2); } } -void TrxBoard::waitForCaptureDone(Debug *_dbg) const +void TrxBoard::waitForCaptureDone(Debug* _dbg) { - // Timeout to receive adc capture done. + //Timeout to receive adc capture done. this->_bCtrlMngt->timerShot(1000); - while (!(_dbg->getCapDone())) + + while(!(_dbg->getCapDone())) { if(this->_bCtrlMngt->checkTimeout()) + { throw SonoException("Failure to receive adc capture done."); - + } } + this->_bCtrlMngt->timerStop(); } -void TrxBoard::adcCaptureStop(Debug *_dbg) const +void TrxBoard::adcCaptureStop(Debug* _dbg) const { _dbg->adcCaptureCmd(captureStop); } -void TrxBoard::adcCaptureStart(Debug *_dbg) const +void TrxBoard::adcCaptureStart(Debug* _dbg) const { _dbg->adcCaptureCmd(captureStart); } -void TrxBoard::adcLogTransferRoutine(Debug *_dbg, quint8 chNumPerFpga) +void TrxBoard::adcLogTransferRoutine(Debug* _dbg, quint8 chNumPerFpga) { - bool adcSamplerReady (false); - bool adcSamplerError (false); + bool adcSamplerReady(false); + bool adcSamplerError(false); - // Adc logger start according to selected afe channel. + //Adc logger start according to selected afe channel. _dbg->adcLoggerTransferCmd(loggerStop); _dbg->adcLoggerChannelNum(chNumPerFpga); _dbg->adcLoggerTransferCmd(loggerStart); - // Timeout to receive adc log transfer done. + //Timeout to receive adc log transfer done. this->_bCtrlMngt->timerShot(20); - while (!(_dbg->getTransferDone())) + + while(!(_dbg->getTransferDone())) { if(this->_bCtrlMngt->checkTimeout()) + { throw SonoException("Failure to receive adc log transfer done."); - + } } + this->_bCtrlMngt->timerStop(); - // Timeout to receive adc sampler done. + //Timeout to receive adc sampler done. this->_bCtrlMngt->timerShot(20); - while (!adcSamplerReady && !adcSamplerError) + + while(!adcSamplerReady && !adcSamplerError) { adcSamplerReady = this->_misc->getAdcSamplerBramReady(); adcSamplerError = this->_misc->getAdcSamplerError(); + if(this->_bCtrlMngt->checkTimeout()) + { throw SonoException("Failure to receive adc sampler done."); - + } } + this->_bCtrlMngt->timerStop(); - if (adcSamplerError) + if(adcSamplerError) + { throw SonoException("The adc sampler error is occured."); + } - // Adc logger stop + //Adc logger stop _dbg->adcLoggerTransferCmd(loggerStop); - } void TrxBoard::debuggerMode(Debug* _dbg, DebugMode& debug, DebugMode& debugRb, QString slaveN) const { _dbg->setDebuggerMode(debug); _dbg->getDebuggerMode(debugRb); - if ((debugRb.txBfTestModeEn != debug.txBfTestModeEn ) || (debugRb.txBfTestModeCfg != debug.txBfTestModeCfg )) + if((debugRb.txBfTestModeEn != debug.txBfTestModeEn) || + (debugRb.txBfTestModeCfg != debug.txBfTestModeCfg)) + { throw ("The debugger mode register configuration of " + slaveN + " is corrupted."); + } } void TrxBoard::setSwapVector() @@ -364,13 +413,23 @@ void TrxBoard::init() { this->_device.init(); this->_bCtrlMngt->prbCtrlInit(); +#ifdef MPS_BOARD mpsReset(); +#endif sramClear(all); } -void TrxBoard::fpgaProgram(const QString path) const +void TrxBoard::delay(quint16 ms) const { - if(MOUNTED_SLAVE_FPGA <= 0 || MOUNTED_SLAVE_FPGA >= 8) + this->_bCtrlMngt->timerShot(ms); + //uncrustify off + while(!(this->_bCtrlMngt->checkTimeout())); + //uncrustify on +} + +void TrxBoard::fpgaProgram(const QString path, const quint8& slaveMounted) const +{ + if(slaveMounted <= 0 || slaveMounted >= 8) { throw SonoException("Wrong mounted slave fpga is selected"); } @@ -392,34 +451,116 @@ void TrxBoard::fpgaProgram(const QString path) const bitFileData = bitFile.readAll(); bitFile.close(); - this->_fpgaProgram->program(bitFileData, MOUNTED_SLAVE_FPGA); + this->_fpgaProgram->program(bitFileData, slaveMounted); +} + +void TrxBoard::gtReadReset() +{ + QList errorList; + bool error(false); + QList offsetRd = {0x14008 * 4, 0x114008 * 4, 0x214008 * 4, 0x314008 * 4, + 0x1400B * 4, 0x11400B * 4, 0x21400B * 4, 0x31400B * 4, + 0x1400C * 4, 0x11400C * 4, 0x21400C * 4, 0x31400C * 4, + 0x1400D * 4, 0x11400D * 4, 0x21400D * 4, 0x31400D * 4, + 0x14010 * 4, 0x114010 * 4, 0x214010 * 4, 0x314010 * 4, + 0x14011 * 4, 0x114011 * 4, 0x214011 * 4, 0x314011 * 4}; + QList correctVal = {0x0, 0xFF43, 0xFF43, 0xFF43, + 0x0, 0xFFFF, 0xFFFF, 0xFFFF, + 0x0, 0xF0F, 0xF0F, 0xF0F, + 0xFF43, 0xF04F, 0xFF43, 0xFF43, + 0xFFFF, 0xFF00, 0xFFFF, 0xFFFF, + 0xF0F, 0xF00, 0xF0F, 0xF0F}; + + /**************************** GT Read ****************************/ + for(auto i = 0; i < 24; i++) + { + quint32 value = this->_device.device.readWord(BAR_REG, offsetRd.at(i)); + if(value == correctVal.at(i)) + { + errorList.append(false); + } + else + { + errorList.append(true); + } + } + + foreach(auto& er, errorList) + { + error |= er; + } + + if(error && MOUNTED_SLAVE_FPGA == 7) + { + /*************************** GT Reset ***************************/ + QList resetAddr; + resetAddr << 0x14000 << 0x14003 << 0x114000 << 0x114003 + << 0x214000 << 0x214003 << 0x314000 << 0x314003; + for(auto value = 2; value >= 0; value--) + { + foreach(auto& offset, resetAddr) + { + this->_device.device.writeWord(BAR_REG, offset * 4, static_cast(value)); + } + } + + /*************************** Delay (1s) ***************************/ + this->delay(1000); + + /**************************** GT Read *****************************/ + for(auto i = 0; i < 24; i++) + { + quint32 value = this->_device.device.readWord(BAR_REG, offsetRd.at(i)); + if(value == correctVal.at(i)) + { + errorList.append(false); + } + else + { + errorList.append(true); + } + } + + foreach(auto& er, errorList) + { + error |= er; + } + + if(error) + { + throw SonoException("The GT error is happened and it's didn't solve by gt reset."); + } + } } void TrxBoard::mcsRead(const QString path) const { QList mcsList; + QByteArray byte; + quint32 value(0); qint32 num(0); - QFile mcsFile(path + "readback.mcs"); + QFile mcsFile(path + "/BPI_bin_rdback.bin"); - if(mcsFile.fileName().isEmpty()) + if(path.isEmpty()) { throw SonoException("No file is selected"); } if(!mcsFile.open(QIODevice::WriteOnly)) { - throw SonoException("Couldn't open mcs file programming"); + throw SonoException("Couldn't open BPI bin file programming"); } - QTextStream save(&mcsFile); - mcsList = this->_bpiFlash->readMcs(); - while (num < MCS_FILE_SIZE / 4) + while(num < BPI_FLASH_SIZE / 4) { - save << (mcsList).at(num); - num += sizeof (quint32); + value = mcsList[num]; + byte = uintLittleEndian2ByteArray(value); + mcsFile.write(byte); + byte.clear(); + num++; } mcsFile.flush(); mcsFile.close(); @@ -458,7 +599,7 @@ void TrxBoard::setProbeDependParams(ScenPrbDepHardwareParam& prbDepParams) this->_dsp->lpfScaleCoefficient(prbDepParams.prbDepParams.lpfScaleCoeff); /////////////////////////// AFE setting /////////////////////////// - setAfeConfig (prbDepParams.afeCfg); + setAfeConfig(prbDepParams.afeCfg); setAfePwr(afePwrdnEnable); } @@ -836,7 +977,7 @@ void TrxBoard::setFramesMetaData(const QByteArray& metaData) const this->_sram->setSramMetaData(data); } -void TrxBoard::setBiteDacData(const QByteArray &iData, const QByteArray &qData) const +void TrxBoard::setBiteDacData(const QByteArray& iData, const QByteArray& qData) const { this->_builtInTest->biteDacEnable(BITE_INTERVAL, false); this->_builtInTest->biteDacMemoryWrite(iData, qData); @@ -863,7 +1004,6 @@ void TrxBoard::biteScenPlayerStop() setDebuggerMode(pulserHz, true); setDebuggerMode(pulserHz, false); - } void TrxBoard::setScenarioCompare(const QString scenPath) @@ -1009,8 +1149,7 @@ QList TrxBoard::getAfeReg(eSlaveSelect sel, quint32 afeRegAddr) case slave0: this->_afeSlave0->setReadRegEnable(true); - this->_bCtrlMngt->timerShot(1); - while(!(this->_bCtrlMngt->checkTimeout())); + this->delay(1); for(quint8 i = 0; i < _afeModuleOffset.size(); i++) { @@ -1023,8 +1162,7 @@ QList TrxBoard::getAfeReg(eSlaveSelect sel, quint32 afeRegAddr) case slave1: this->_afeSlave1->setReadRegEnable(true); - this->_bCtrlMngt->timerShot(1); - while(!(this->_bCtrlMngt->checkTimeout())); + this->delay(1); for(quint8 i = 0; i < _afeModuleOffset.size(); i++) { @@ -1037,8 +1175,7 @@ QList TrxBoard::getAfeReg(eSlaveSelect sel, quint32 afeRegAddr) case slave2: this->_afeSlave2->setReadRegEnable(true); - this->_bCtrlMngt->timerShot(1); - while(!(this->_bCtrlMngt->checkTimeout())); + this->delay(1); for(quint8 i = 0; i < _afeModuleOffset.size(); i++) { @@ -1062,14 +1199,27 @@ void TrxBoard::setTxDacEnable(quint8 biteInterval, bool cmd) const this->_builtInTest->biteDacEnable(biteInterval, cmd); } +void TrxBoard::powerAo(bool flag) +{ + if(flag) + { + this->_bCtrlMngt->mpsDacsOn(); + } + else + { + this->_bCtrlMngt->mpsDacsOff(); + } +} + void TrxBoard::slaveFpgaProgram(const QString path) { scenParamsFilling(clear); - fpgaProgram (path); + fpgaProgram(path, MOUNTED_SLAVE_FPGA); #ifndef DEVELOP_UI - afeAdcsSync(); + afeAdcsSync(MOUNTED_SLAVE_FPGA); + gtReadReset(); #endif } @@ -1104,27 +1254,23 @@ void TrxBoard::scenPlayerStart(bool afeHvPwrOn) this->_afeSlave0->setAfeGblPwr(afePwrdnDisable); this->_afeSlave1->setAfeGblPwr(afePwrdnDisable); this->_afeSlave2->setAfeGblPwr(afePwrdnDisable); - #ifdef MPS_BOARD this->_bCtrlMngt->mpsDacsOn(); #endif - this->_bCtrlMngt->timerShot(170); - //uncrustify off - while(!(this->_bCtrlMngt->checkTimeout())); - //uncrustify on - + this->delay(170); } this->_scenPlayer->control.setCommand(true); #ifndef DEVELOP_UI - packetEngine.init(); + packetEngine.init(); #endif _run = true; QtConcurrent::run(this, &TrxBoard::readData); + QtConcurrent::run(this, &TrxBoard::sendPacket); } else { @@ -1155,10 +1301,7 @@ void TrxBoard::scenPlayerStop(bool afeHvPwrOff) this->_bCtrlMngt->mpsDacsOff(); #endif - this->_bCtrlMngt->timerShot(140); - //uncrustify off - while(!(this->_bCtrlMngt->checkTimeout())); - //uncrustify on + this->delay(140); } } @@ -1619,8 +1762,6 @@ void TrxBoard::getHealthStatus(HealthStatus* healStat) const void TrxBoard::mcsProgram(QString path) { - scenParamsFilling(clear); - QFile mcsFile(path); if(mcsFile.fileName().isEmpty()) @@ -1630,7 +1771,7 @@ void TrxBoard::mcsProgram(QString path) if(!mcsFile.open(QIODevice::ReadOnly)) { - throw SonoException("Couldn't open mcs file programming"); + throw SonoException("Couldn't open BPI bin file programming"); } QByteArray mcsFileData = mcsFile.readAll(); @@ -1641,7 +1782,6 @@ void TrxBoard::mcsProgram(QString path) void TrxBoard::mcsVerify(QString path) const { - this->_bpiFlash->readCommand(); mcsRead(path); } @@ -1667,9 +1807,9 @@ quint32 TrxBoard::getFrameLostCounter() const return (this->_misc->getFrameLostCount()); } -void TrxBoard::adcCaptureConfig(captureConfig &capCfg) const +void TrxBoard::adcCaptureConfig(captureConfig& capCfg) const { - // ADC capture config + //ADC capture config this->_debugSlave0->adcLoggerConfig(capCfg); this->_debugSlave1->adcLoggerConfig(capCfg); this->_debugSlave2->adcLoggerConfig(capCfg); @@ -1677,7 +1817,7 @@ void TrxBoard::adcCaptureConfig(captureConfig &capCfg) const void TrxBoard::adcCaptureStart(void) const { - // ADC capture reset + //ADC capture reset this->_debugSlave0->adcLoggerRst(true); this->_debugSlave1->adcLoggerRst(true); this->_debugSlave2->adcLoggerRst(true); @@ -1685,11 +1825,12 @@ void TrxBoard::adcCaptureStart(void) const this->_debugSlave1->adcLoggerRst(false); this->_debugSlave2->adcLoggerRst(false); - // ADC capture start + //ADC capture start adcCaptureStart(_debugSlave0); adcCaptureStart(_debugSlave1); adcCaptureStart(_debugSlave2); } + void TrxBoard::setCaptureManualSync(void) const { this->_misc->setSyncMode(otherAdcLogMode); @@ -1698,12 +1839,20 @@ void TrxBoard::setCaptureManualSync(void) const this->_misc->setSyncMode(bfSyncMode); } -void TrxBoard::adcCaptureDone(void) const +void TrxBoard::adcCaptureDone(void) { - waitForCaptureDone(_debugSlave0); - waitForCaptureDone(_debugSlave1); - waitForCaptureDone(_debugSlave2); - + if(MOUNTED_SLAVE_FPGA & 1) + { + waitForCaptureDone(_debugSlave0); + } + if(MOUNTED_SLAVE_FPGA & 2) + { + waitForCaptureDone(_debugSlave1); + } + if(MOUNTED_SLAVE_FPGA & 4) + { + waitForCaptureDone(_debugSlave2); + } adcCaptureStop(_debugSlave0); adcCaptureStop(_debugSlave1); adcCaptureStop(_debugSlave2); @@ -1715,13 +1864,13 @@ void TrxBoard::adcLoggerStart(const QString path, const QString fileName) quint8 chNumPerFpga(0); QTime t = QTime::currentTime(); QString logPath = path + "/" + fileName + "_adcLog" + QString("_%1_%2_%3.csv") - .arg(t.hour()) - .arg(t.minute()) - .arg(t.second()); + .arg(t.hour()) + .arg(t.minute()) + .arg(t.second()); QFile logFile(logPath); QTextStream log(&logFile); - if(logFile.fileName().isEmpty()) + if(logPath.isEmpty()) { throw SonoException("No file is selected"); } @@ -1732,69 +1881,104 @@ void TrxBoard::adcLoggerStart(const QString path, const QString fileName) } log << "SYNC Offset(ns): "; - log << this->_debugSlave0->getCapSyncOffset() * 5 << ", "; - log << this->_debugSlave1->getCapSyncOffset() * 5 << ", "; - log << this->_debugSlave2->getCapSyncOffset() * 5 << endl; + if(MOUNTED_SLAVE_FPGA & 1) + { + log << this->_debugSlave0->getCapSyncOffset() * 5 << ", "; + } + if(MOUNTED_SLAVE_FPGA & 2) + { + log << this->_debugSlave1->getCapSyncOffset() * 5 << ", "; + } + if(MOUNTED_SLAVE_FPGA & 4) + { + log << this->_debugSlave2->getCapSyncOffset() * 5; + } + log << endl; log << "ADC Sample Latancy(ns): "; - log << this->_afeSlave0->getAdcLatency() * 2.5f << ", "; - log << this->_afeSlave1->getAdcLatency() * 2.5f << ", "; - log << this->_afeSlave2->getAdcLatency() * 2.5f << endl; + if(MOUNTED_SLAVE_FPGA & 1) + { + log << this->_afeSlave0->getAdcLatency() * 2.5f << ", "; + } + if(MOUNTED_SLAVE_FPGA & 2) + { + log << this->_afeSlave1->getAdcLatency() * 2.5f << ", "; + } + if(MOUNTED_SLAVE_FPGA & 4) + { + log << this->_afeSlave2->getAdcLatency() * 2.5f; + } + log << endl; log << "ADC Sample Logger Offset(sample): "; - log << this->_debugSlave0->getCaptureSampleNo() << ", "; - log << this->_debugSlave1->getCaptureSampleNo() << ", "; - log << this->_debugSlave2->getCaptureSampleNo() << endl; + if(MOUNTED_SLAVE_FPGA & 1) + { + log << this->_debugSlave0->getCaptureSampleNo() << ", "; + } + if(MOUNTED_SLAVE_FPGA & 2) + { + log << this->_debugSlave1->getCaptureSampleNo() << ", "; + } + if(MOUNTED_SLAVE_FPGA & 4) + { + log << this->_debugSlave2->getCaptureSampleNo(); + } + log << endl; - // Set gt to adc mode. + //Set gt to adc mode. this->_misc->setGtSendMode(adcMode); - // Stop adc log transfer. + //Stop adc log transfer. this->_debugSlave0->adcLoggerTransferCmd(loggerStop); this->_debugSlave1->adcLoggerTransferCmd(loggerStop); this->_debugSlave2->adcLoggerTransferCmd(loggerStop); - for (quint8 chNum = 0; chNum < TOTAL_AFE_CHANNEL_NUM; chNum++) + quint8 afeChannelNum = AFE_CHANNEL_NUM_PER_SLAVE * ( + ((MOUNTED_SLAVE_FPGA & 4) >> 2) + + ((MOUNTED_SLAVE_FPGA & 2) >> 1) + + (MOUNTED_SLAVE_FPGA & 1)); + + for(quint8 chNum = 0; chNum < afeChannelNum; chNum++) { fpgaSel = chNum / AFE_CHANNEL_NUM_PER_SLAVE; chNumPerFpga = chNum % AFE_CHANNEL_NUM_PER_SLAVE; - // ADC sampler start according to selected fpga. + //ADC sampler start according to selected fpga. this->_misc->setAdcSamplerCmd(samplerStop); this->_misc->setAdcSamplerFpgaSel(fpgaSel); this->_misc->setAdcSamplerCmd(samplerStart); - switch (fpgaSel) + switch(fpgaSel) { case 0: - this->adcLogTransferRoutine (_debugSlave0, chNumPerFpga); + this->adcLogTransferRoutine(_debugSlave0, chNumPerFpga); break; case 1: - this->adcLogTransferRoutine (_debugSlave1, chNumPerFpga); + this->adcLogTransferRoutine(_debugSlave1, chNumPerFpga); break; case 2: - this->adcLogTransferRoutine (_debugSlave2, chNumPerFpga); + this->adcLogTransferRoutine(_debugSlave2, chNumPerFpga); break; } - // Read adc data bram. + //Read adc data bram. QList adcDataList = this->_misc->getAdcDataBram(); - foreach (auto data, adcDataList) + foreach(auto data, adcDataList) { log << data << ','; } log << endl; - // ADC sampler stop. + //ADC sampler stop. this->_misc->setAdcSamplerCmd(samplerStop); } logFile.flush(); logFile.close(); - // Set gt to beamformer mode. + //Set gt to beamformer mode. this->_misc->setGtSendMode(bfMode); } diff --git a/src/model/hardware/core/lowLevelApi/register/Field.cpp b/src/model/hardware/core/lowLevelApi/register/Field.cpp old mode 100644 new mode 100755 diff --git a/src/model/hardware/core/lowLevelApi/register/Register.cpp b/src/model/hardware/core/lowLevelApi/register/Register.cpp old mode 100644 new mode 100755 diff --git a/src/model/hardware/core/lowLevelApi/register/afe/Afe.cpp b/src/model/hardware/core/lowLevelApi/register/afe/Afe.cpp old mode 100644 new mode 100755 diff --git a/src/model/hardware/core/lowLevelApi/register/beamFormer/BeamFormer.cpp b/src/model/hardware/core/lowLevelApi/register/beamFormer/BeamFormer.cpp old mode 100644 new mode 100755 diff --git a/src/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/BoardsCtrlMngt.cpp b/src/model/hardware/core/lowLevelApi/register/boardsCtrlMngt/BoardsCtrlMngt.cpp old mode 100644 new mode 100755 diff --git a/src/model/hardware/core/lowLevelApi/register/bpiFlash/BpiFlash.cpp b/src/model/hardware/core/lowLevelApi/register/bpiFlash/BpiFlash.cpp old mode 100644 new mode 100755 index d529659..4d405f2 --- a/src/model/hardware/core/lowLevelApi/register/bpiFlash/BpiFlash.cpp +++ b/src/model/hardware/core/lowLevelApi/register/bpiFlash/BpiFlash.cpp @@ -1,102 +1,295 @@ #include "model/hardware/core/lowLevelApi/register/bpiFlash/BpiFlash.h" -void BpiFlash::bpiInitialize() const +template +T BpiFlash::byteArray2UintLittleEndian(QByteArray& byte) const { - quint32 baseAddr(0X4000000); - QList address; - QList data; - - address << 0x0 << 0xAA << 0xAA << 0x8 << 0x0 << 0x0 << 0x0 << 0x0 << 0x7FE0000 << 0x7FE0000 - << 0x7FE0000 << 0x7FE0000 << 0x0 << 0x0 << 0x0 << 0x0 << 0x7FE0000 << 0x7FE0000 - << 0x7FE0000 << 0x7FE0000; - data << 0xFF << 0x98 << 0xFF << 0x9090 << 0x5050 << 0x7070 << 0xF0F0 << 0xFFFF << 0x5050 - << 0x7070 << 0xF0F0 << 0xFFFF << 0x5050 << 0x7070 << 0xF0F0 << 0xFFFF << 0x5050 - << 0x7070 << 0xF0F0 << 0xFFFF; - - for (auto var = 0; var < address.size(); var++) + T data; + QDataStream in(byte); + in.setByteOrder(QDataStream::LittleEndian); + in >> data; + + return data; +} + +void BpiFlash::timerShot(quint16 ms) const +{ + _timer->setSingleShot(true); + _timer->setInterval(ms); + _timer->start(); +} + +bool BpiFlash::checkTimeout() const +{ + return (_timer->remainingTime() == 0) ? true : false; +} + +void BpiFlash::timerStop() const +{ + _timer->stop(); +} + +void BpiFlash::bpiClearStatus() const +{ + QList data; + data << 0x5050 << 0x7070; + + foreach (auto& cmd, data) + { + this->_device->device.writeShort(BAR_SRAM, BPI_START_OFFSET, cmd); + } + + quint16 statusReg = this->_device->device.readShort(BAR_SRAM, BPI_START_OFFSET); + statusReg &= 0xFF; + if (statusReg != BPI_NO_ERR_STATUS) + { + throw SonoException("The bpi clear status error is happened."); + } +} + +void BpiFlash::bpiUnlock(quint16& blockOffset) +{ + quint16 statusReg(0); + quint32 blockAddress = blockOffset * STEP_128KB; + QList data; + data << 0x5050 << 0x6060 << 0xD0D0 << 0x7070; + + bpiClearStatus(); + + foreach (auto& cmd, data) { - _mcsRdWr->_device->device.writeWord(1, baseAddr + address.at(var), data.at(var)); + this->_device->device.writeShort(BAR_SRAM, (BPI_START_OFFSET + + UPDATE_MCS_OFFSET + + blockAddress), cmd); } + +#ifdef DEVELOP_UI + emit startTimerShot(500); +#else + timerShot(500); +#endif + + do{ + statusReg = this->_device->device.readShort(BAR_SRAM, (BPI_START_OFFSET + + UPDATE_MCS_OFFSET + + blockAddress)); + statusReg &= 0xFF; + +#ifdef DEVELOP_UI + emit remainingTime("The bpi unlock error is happened."); +#else + if(checkTimeout()) + { + throw SonoException("The bpi unlock error is happened."); + } +#endif + + }while(statusReg != BPI_NO_ERR_STATUS); + +#ifdef DEVELOP_UI + emit stopTimer(); +#else + timerStop(); +#endif + +} + +void BpiFlash::bpiErase(quint16& blockOffset) +{ + quint16 statusReg(0); + quint32 blockAddress = blockOffset * STEP_128KB; + QList data; + data << 0x2020 << 0xD0D0; + + bpiClearStatus(); + + foreach (auto& cmd, data) + { + this->_device->device.writeShort(BAR_SRAM, (BPI_START_OFFSET + + UPDATE_MCS_OFFSET + + blockAddress), cmd); + } + +#ifdef DEVELOP_UI + emit startTimerShot(500); +#else + timerShot(500); +#endif + + do{ + statusReg = this->_device->device.readShort(BAR_SRAM, (BPI_START_OFFSET + + UPDATE_MCS_OFFSET + + blockAddress)); + statusReg &= 0xFF; + +#ifdef DEVELOP_UI + emit remainingTime("The bpi erase error is happened."); +#else + if(checkTimeout()) + { + throw SonoException("The bpi erase error is happened."); + } +#endif + + }while (statusReg != BPI_NO_ERR_STATUS); + +#ifdef DEVELOP_UI + emit stopTimer(); +#else + timerStop(); +#endif + } -void BpiFlash::bpiReset() const +void BpiFlash::bpiWrite(quint16& wrCount) { - quint32 baseAddr(0X4000000); - QList address; - QList data; + QList data = {0xE8E8}; - address << 0x0 << 0x0 << 0x0 << 0x0 << 0x7FE0000 << 0x7FE0000 << 0x7FE0000 << 0x7FE0000; - data << 0x5050 << 0x7070 << 0xF0F0 << 0xFFFF << 0x5050 << 0x7070 << 0xF0F0 << 0xFFFF; + bpiClearStatus(); - for (auto var = 0; var < address.size(); var++) + foreach (auto& cmd, data) { - _mcsRdWr->_device->device.writeWord(1, baseAddr + address.at(var), data.at(var)); + this->_device->device.writeShort(BAR_SRAM, BPI_START_OFFSET + + UPDATE_MCS_OFFSET, cmd); } + + quint16 statusReg = this->_device->device.readShort(BAR_SRAM, BPI_START_OFFSET + + UPDATE_MCS_OFFSET); + statusReg &= 0xFF; + if (statusReg != BPI_NO_ERR_STATUS) + { + throw SonoException("the bpi write command error is happened."); + } + + this->_device->device.writeShort(BAR_SRAM, BPI_START_OFFSET + + UPDATE_MCS_OFFSET, wrCount); +} + +void BpiFlash::bpiWriteCmplt(quint16& num) +{ + quint16 statusReg(0); + QList data = {0xD0D0}; + + foreach (auto& cmd, data) + { + this->_device->device.writeShort(BAR_SRAM, BPI_START_OFFSET + + UPDATE_MCS_OFFSET + + (num * MAXIMUM_WR_NUM), cmd); + } + +#ifdef DEVELOP_UI + emit startTimerShot(500); +#else + timerShot(500); +#endif + + do{ + statusReg = this->_device->device.readShort(BAR_SRAM, (BPI_START_OFFSET + + UPDATE_MCS_OFFSET+ + (num * MAXIMUM_WR_NUM))); + statusReg &= 0xFF; + +#ifdef DEVELOP_UI + emit remainingTime("The bpi write complete command error is happened."); +#else + if(checkTimeout()) + { + throw SonoException("The bpi write complete command error is happened."); + } +#endif + + }while (statusReg != BPI_NO_ERR_STATUS); + +#ifdef DEVELOP_UI + emit stopTimer(); +#else + timerStop(); +#endif + } void BpiFlash::bpiRead() const { - quint32 baseAddr(0X4000000); - QList address; - QList data; + QList data = {0xFFFF}; - address << 0x0 << 0x0 << 0x0 << 0x0; - data << 0x5050 << 0x7070 << 0xF0F0 << 0xFFFF; + bpiClearStatus(); - for (auto var = 0; var < address.size(); var++) + foreach (auto& cmd, data) { - _mcsRdWr->_device->device.writeWord(1, baseAddr + address.at(var), data.at(var)); + this->_device->device.writeShort(BAR_SRAM, BPI_START_OFFSET, cmd); } } BpiFlash::BpiFlash(SonoDevice* device) { - _mcsRdWr = new McsRdWr(device); + _device = device; + _timer = new QTimer(); } BpiFlash::~BpiFlash() { - delete _mcsRdWr; + delete _device; + delete _timer; } -void BpiFlash::writeMcs(QByteArray& mcs) const +void BpiFlash::writeMcs(QByteArray& mcs) { - QList mcsList; - qint32 progByte(0); - quint32 progData(0); - QByteArray mcsArray; - - mcsList.clear(); - mcsArray.clear(); - - while(progByte < mcs.size()) - { - for(quint8 i(0); i < sizeof(quint32); i++) - { - mcsArray.append(mcs.at(i + progByte)); - } - - progData = byteArray2UintBigEndian(mcsArray); - mcsList.append(progData); - - mcsArray.clear(); - progByte += sizeof(quint32); - } - - this->_mcsRdWr->mcsWrite(mcsList); - this->_mcsRdWr->updateArray(); + /*********** The lambda function for write sequence ***********/ + quint16 num(0); + quint16 offset(0); + QByteArray binArray; + + auto writeFlash = [this, &num, &offset, &binArray, &mcs](quint16 wrNum) + { + bpiWrite(wrNum); + + for (quint16 var(0); var <= wrNum; var++) + { + offset = var * 2; + + for (quint8 i(0); i < sizeof (quint16); i++) + { + binArray.push_back(mcs.at(i + offset + (num * MAXIMUM_WR_NUM))); + } + quint16 binaryValue = byteArray2UintLittleEndian(binArray); + this->_device->device.writeShort(BAR_SRAM, (BPI_START_OFFSET + + UPDATE_MCS_OFFSET + + (num * MAXIMUM_WR_NUM) + + offset), binaryValue); + binArray.clear(); + } + + bpiWriteCmplt(num); + }; + + /* The procedure of unlock & erase exactly 32MB of BPI flash */ + for (quint16 var=0; var < UNLOCK_ERASE_BLOCK; var++) + { + bpiUnlock(var); + bpiErase(var); + } + /*********** The procedure of write to BPI flash ***********/ + quint16 kBNum = static_cast(mcs.size() / MAXIMUM_WR_NUM); + quint16 modNum = static_cast(mcs.size() % MAXIMUM_WR_NUM); + + for (num = 0; num < kBNum; num++) + { + writeFlash ((MAXIMUM_WR_NUM / 2) - 1); + } + + writeFlash((modNum / 2) - 1); } QList BpiFlash::readMcs(void) const { - this->_mcsRdWr->mcsListRd.clear(); - this->_mcsRdWr->syncArray(); - return (this->_mcsRdWr->mcsListRd); -} + quint32 readBin(0); + QList mcsListRd; -void BpiFlash::readCommand() const -{ - bpiInitialize(); - bpiReset(); bpiRead(); + + for (quint32 num=0; num < BPI_FLASH_SIZE; num+=4) + { + readBin = this->_device->device.readWord(BAR_SRAM, (BPI_START_OFFSET + num)); + mcsListRd.push_back(readBin); + } + return mcsListRd; } diff --git a/src/model/hardware/core/lowLevelApi/register/builtInTest/BuiltInTest.cpp b/src/model/hardware/core/lowLevelApi/register/builtInTest/BuiltInTest.cpp old mode 100644 new mode 100755 diff --git a/src/model/hardware/core/lowLevelApi/register/clockDistributer/ClockDistributer.cpp b/src/model/hardware/core/lowLevelApi/register/clockDistributer/ClockDistributer.cpp old mode 100644 new mode 100755 diff --git a/src/model/hardware/core/lowLevelApi/register/debug/Debug.cpp b/src/model/hardware/core/lowLevelApi/register/debug/Debug.cpp old mode 100644 new mode 100755 diff --git a/src/model/hardware/core/lowLevelApi/register/dsp/Dsp.cpp b/src/model/hardware/core/lowLevelApi/register/dsp/Dsp.cpp old mode 100644 new mode 100755 diff --git a/src/model/hardware/core/lowLevelApi/register/emulator/Emulator.cpp b/src/model/hardware/core/lowLevelApi/register/emulator/Emulator.cpp old mode 100644 new mode 100755 diff --git a/src/model/hardware/core/lowLevelApi/register/fpgaProgram/FpgaProgram.cpp b/src/model/hardware/core/lowLevelApi/register/fpgaProgram/FpgaProgram.cpp old mode 100644 new mode 100755 diff --git a/src/model/hardware/core/lowLevelApi/register/misc/Misc.cpp b/src/model/hardware/core/lowLevelApi/register/misc/Misc.cpp old mode 100644 new mode 100755 diff --git a/src/model/hardware/core/lowLevelApi/register/scenPlayer/ScenPlayer.cpp b/src/model/hardware/core/lowLevelApi/register/scenPlayer/ScenPlayer.cpp old mode 100644 new mode 100755 diff --git a/src/model/hardware/core/lowLevelApi/register/sram/Sram.cpp b/src/model/hardware/core/lowLevelApi/register/sram/Sram.cpp old mode 100644 new mode 100755 diff --git a/src/model/hardware/device/SonoDevice.cpp b/src/model/hardware/device/SonoDevice.cpp old mode 100644 new mode 100755 index b9116b7..5833ae2 --- a/src/model/hardware/device/SonoDevice.cpp +++ b/src/model/hardware/device/SonoDevice.cpp @@ -1,6 +1,5 @@ #include "model/hardware/device/SonoDevice.h" -#include #include SonoDevice::SonoDevice() diff --git a/src/model/hardware/service/BHardwarePacket.cpp b/src/model/hardware/service/BHardwarePacket.cpp old mode 100644 new mode 100755 diff --git a/src/model/hardware/service/HardwarePacket.cpp b/src/model/hardware/service/HardwarePacket.cpp old mode 100644 new mode 100755 diff --git a/src/model/hardware/service/HardwarePacketEngine.cpp b/src/model/hardware/service/HardwarePacketEngine.cpp old mode 100644 new mode 100755 diff --git a/src/model/scenarioGenerator/ScenarioGenerator.cpp b/src/model/scenarioGenerator/ScenarioGenerator.cpp old mode 100644 new mode 100755 diff --git a/src/model/scenarioGenerator/core/ComputationalCore.cpp b/src/model/scenarioGenerator/core/ComputationalCore.cpp old mode 100644 new mode 100755 diff --git a/src/model/scenarioGenerator/core/ScenGenCore.cpp b/src/model/scenarioGenerator/core/ScenGenCore.cpp old mode 100644 new mode 100755 diff --git a/src/model/scenarioGenerator/core/general/Calculation.cpp b/src/model/scenarioGenerator/core/general/Calculation.cpp old mode 100644 new mode 100755 diff --git a/src/model/scenarioGenerator/core/scenario/B/BModeScenario.cpp b/src/model/scenarioGenerator/core/scenario/B/BModeScenario.cpp old mode 100644 new mode 100755 diff --git a/src/model/scenarioGenerator/core/scenario/BaseScenario.cpp b/src/model/scenarioGenerator/core/scenario/BaseScenario.cpp old mode 100644 new mode 100755 diff --git a/src/model/scenarioGenerator/core/scenario/Bm/BmModeScenario.cpp b/src/model/scenarioGenerator/core/scenario/Bm/BmModeScenario.cpp old mode 100644 new mode 100755 diff --git a/src/model/scenarioGenerator/core/scenario/type/frame/BFrame.cpp b/src/model/scenarioGenerator/core/scenario/type/frame/BFrame.cpp old mode 100644 new mode 100755 diff --git a/src/model/scenarioGenerator/core/scenario/type/frame/BaseFrame.cpp b/src/model/scenarioGenerator/core/scenario/type/frame/BaseFrame.cpp old mode 100644 new mode 100755 diff --git a/src/model/scenarioGenerator/core/scenario/type/frame/MFrame.cpp b/src/model/scenarioGenerator/core/scenario/type/frame/MFrame.cpp old mode 100644 new mode 100755 diff --git a/src/model/ultrasoundModule/UsCore.cpp.autosave b/src/model/ultrasoundModule/UsCore.cpp.autosave old mode 100644 new mode 100755 diff --git a/src/model/ultrasoundModule/UsData.cpp b/src/model/ultrasoundModule/UsData.cpp old mode 100644 new mode 100755 diff --git a/src/model/ultrasoundModule/UsEventReceiver.cpp b/src/model/ultrasoundModule/UsEventReceiver.cpp old mode 100644 new mode 100755 diff --git a/src/model/ultrasoundModule/UsEventSender.cpp b/src/model/ultrasoundModule/UsEventSender.cpp old mode 100644 new mode 100755 diff --git a/src/model/ultrasoundModule/UsModule.cpp b/src/model/ultrasoundModule/UsModule.cpp old mode 100644 new mode 100755 diff --git a/src/model/ultrasoundModule/UsPacket.cpp b/src/model/ultrasoundModule/UsPacket.cpp old mode 100644 new mode 100755 diff --git a/src/model/ultrasoundModule/metadata/UsBaseMetadata.cpp b/src/model/ultrasoundModule/metadata/UsBaseMetadata.cpp old mode 100644 new mode 100755 diff --git a/src/model/ultrasoundModule/metadata/UsMetadataBag.cpp b/src/model/ultrasoundModule/metadata/UsMetadataBag.cpp old mode 100644 new mode 100755 diff --git a/src/model/ultrasoundModule/type/CommandRequest.cpp b/src/model/ultrasoundModule/type/CommandRequest.cpp old mode 100644 new mode 100755 diff --git a/src/model/ultrasoundModule/type/CommandResponse.cpp b/src/model/ultrasoundModule/type/CommandResponse.cpp old mode 100644 new mode 100755 diff --git a/src/model/ultrasoundModule/type/CommandResult.cpp b/src/model/ultrasoundModule/type/CommandResult.cpp old mode 100644 new mode 100755