diff --git a/developHw.pro b/developHw.pro index 8aebdbe..06fa1ff 100644 --- a/developHw.pro +++ b/developHw.pro @@ -22,7 +22,7 @@ SOURCES += \ qcustomplot.cpp \ api.cpp \ $$files(src/*.cpp, true) \ - $$files(hdf5Scenario/*.cpp, true) \ + $$files(hdf5Scenario/*.cpp, true) HEADERS += \ mainwindow.h \ diff --git a/developHw.pro.user b/developHw.pro.user index 0825035..1c2f4d3 100644 --- a/developHw.pro.user +++ b/developHw.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId diff --git a/hdf5Scenario/hdf5Scenario.cpp b/hdf5Scenario/hdf5Scenario.cpp index 8620711..efb649b 100644 --- a/hdf5Scenario/hdf5Scenario.cpp +++ b/hdf5Scenario/hdf5Scenario.cpp @@ -652,6 +652,13 @@ void Hdf5::prbDependParamsRead(ScenPrbDepHardwareParam &prbDepParams) } prbDepParams.prbDepParams.lpfLut.push_back(tempLpf); } + + /**************** /registerParameters/lpfScale ********************/ + datasetBranch ("/registerParameters/lpfScale", floatArray); + prbDepParams.prbDepParams.lpfScaleCoeff.clear(); + for (quint8 i = 0; i < 4; i++) + prbDepParams.prbDepParams.lpfScaleCoeff.push_back(static_cast(floatArray[i])); + } diff --git a/include/model/hardware/core/TrxBoard.h b/include/model/hardware/core/TrxBoard.h index be59ae7..a7ec2ac 100644 --- a/include/model/hardware/core/TrxBoard.h +++ b/include/model/hardware/core/TrxBoard.h @@ -7,6 +7,7 @@ #include #include #include +#include #include #include "model/hardware/core/register/clockDistributer/ClockDistributer.h" @@ -17,6 +18,7 @@ #include "model/hardware/core/register/scenPlayer/ScenPlayer.h" #include "model/hardware/core/register/bpiFlash/BpiFlash.h" #include "model/hardware/core/register/emulator/Emulator.h" +#include "model/hardware/core/register/debug/Debug.h" #include "model/hardware/core/register/misc/Misc.h" #include "model/hardware/core/register/sram/Sram.h" #include "model/hardware/core/register/dsp/Dsp.h" @@ -31,10 +33,16 @@ #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 + #define EEPROM_CRC_BEGIN 0U #define EEPROM_CRC_NUMBER 19U #define EEPROM_ID_BEGIN 19U @@ -55,7 +63,6 @@ private: QVector _swapVec; QVector _unsignedQntzrVec; QList _unsignedQntzrList; - QList* _mcsList; QList _afeModuleOffset; QList _fpgaOffset; QByteArray _eepromCrc; @@ -76,9 +83,13 @@ private: BeamFormer* _beamFormerSlave0; BeamFormer* _beamFormerSlave1; BeamFormer* _beamFormerSlave2; - BoardsCtrlMngt* _bCtrlMngt; + BoardsCtrlMngt* _bCtrlMngt; + BuiltInTest* _builtInTest; FpgaProgram* _fpgaProgram; - ScenPalyer* _scenPlayer; + ScenPalyer* _scenPlayer; + Debug* _debugSlave0; + Debug* _debugSlave1; + Debug* _debugSlave2; BpiFlash* _bpiFlash; Afe* _afeSlave0; Afe* _afeSlave1; @@ -143,12 +154,16 @@ private: void afeAdcsSync(void) const; + void adcLogTransferRoutine (Debug* _dbg, quint8 chNumPerFpga); + void debuggerMode(Debug* _dbg, DebugMode& debug, DebugMode& debugRb, QString slaveN) const; + template QByteArray uintLittleEndian2ByteArray(T& data) const; template T byteArray2UintLittleEndian(QByteArray& byte) const; + signals: void sendFramePacket(QByteArray newPacket); void sramBinaryCreateFlag(void); @@ -181,24 +196,29 @@ public: void setFramesMetaData(const QByteArray &metaData) const; - ////////////////////////////////// UI Test API /////////////////////////////// + /////////////////////////////// Built-in Test API ///////////////////////////// + void setBiteDacData(const QByteArray& iData,const QByteArray& qData) const; + void biteScenPlayerStart(void); + void biteScenPlayerStop(void); + + ////////////////////////////////// UI Test API //////////////////////////////// void setScenarioCompare (const QString scenPath); void setAtgcMode(eAtgcMode mode, quint16 value) const; QList getAfeReg(eSlaveSelect sel, quint32 afeRegAddr); - ////////////////////////////// Slave Programming API /////////////////////////// + ////////////////////////////// Slave Programming API ////////////////////////// void slaveFpgaProgram(const QString path); - /////////////////////////////// BeamFormer Mode API //////////////////////////// + /////////////////////////////// BeamFormer Mode API /////////////////////////// void setBeamFormerMode(eClkMode mode) const; - ///////////////////////////////// Emulator API ///////////////////////////////// + ///////////////////////////////// Emulator API //////////////////////////////// void emulatorInit(EmulatorProperties* config) const; void fillRam(QString path); void emulatorStart(void); void emulatorStop(void); - ////////////////////////////// BoardCtrlMngt API /////////////////////////////// + ////////////////////////////// BoardCtrlMngt API ////////////////////////////// quint32 deviceId(void) const; quint32 vendorId(void) const; @@ -224,17 +244,21 @@ public: void selectProbe(eSelectProbe prbSel); void getHealthStatus(HealthStatus* healStat) const; - //////////////////////////////// BPI Flash API ///////////////////////////////// + //////////////////////////////// BPI Flash API //////////////////////////////// void mcsProgram(QString path); void mcsVerify(QString path) const; - //////////////////////////////// Miscellaneous API ///////////////////////////////// + //////////////////////////////// Miscellaneous API //////////////////////////// void getTrxStatus(StatusVec* status) const; void getFpgasCodeVersion(FpgaCodeVersion* version) const; void sramParityClear(); quint32 getFrameLostCounter(void) const; - /////////////////////////////// DMA Data Packet //////////////////////////////////// + ////////////////////////////////// Logger API ///////////////////////////////// + void adcCaptureStart(captureConfig &capCfg, eSyncMode syncMode); + void adcLoggerStart(const QString path); + + /////////////////////////////// DMA Data Packet /////////////////////////////// void readData(); }; diff --git a/include/model/hardware/core/TrxBoardUtils/PreProcessorDef.h b/include/model/hardware/core/TrxBoardUtils/PreProcessorDef.h index 2063672..ed2d061 100644 --- a/include/model/hardware/core/TrxBoardUtils/PreProcessorDef.h +++ b/include/model/hardware/core/TrxBoardUtils/PreProcessorDef.h @@ -2,6 +2,6 @@ #define PREPROCESSORDEF_H #define MPS_BOARD -//#define DEVELOP_UI +#define DEVELOP_UI #endif //PREPROCESSORDEF_H diff --git a/include/model/hardware/core/TrxBoardUtils/ScenParamsRanges.h b/include/model/hardware/core/TrxBoardUtils/ScenParamsRanges.h index ef32695..5f7ff39 100644 --- a/include/model/hardware/core/TrxBoardUtils/ScenParamsRanges.h +++ b/include/model/hardware/core/TrxBoardUtils/ScenParamsRanges.h @@ -7,6 +7,7 @@ #define LINE_FILTER_LUT_MAX 3 #define BLENDWEIGHT_LUT_MAX 4 #define FREQUENCY_LUT_MAX 8 +#define LPF_SCALE_MAX 4 #define DTGC_LUT_MAX 1024 #define ATGC_LUT_MAX 4 #define LPF_LUT_MAX 4 diff --git a/include/model/hardware/core/TrxBoardUtils/TrxBoardEnums.h b/include/model/hardware/core/TrxBoardUtils/TrxBoardEnums.h index 829c4a3..5f79a81 100644 --- a/include/model/hardware/core/TrxBoardUtils/TrxBoardEnums.h +++ b/include/model/hardware/core/TrxBoardUtils/TrxBoardEnums.h @@ -48,4 +48,28 @@ enum eConnectionMode : bool connected = true }; +enum eSyncMode : bool +{ + autoSync = false, + manualSync = true +}; + +enum eAdcCapture : bool +{ + captureStop = false, + captureStart = true +}; + +enum eAdcLogger : bool +{ + loggerStop = false, + loggerStart = true +}; + +enum eAdcSampler : bool +{ + samplerStop = false, + samplerStart = true +}; + #endif // TRXBOARDENUMS_H diff --git a/include/model/hardware/core/TrxBoardUtils/TrxBoardStructures.h b/include/model/hardware/core/TrxBoardUtils/TrxBoardStructures.h index 87ac980..7ad2b43 100644 --- a/include/model/hardware/core/TrxBoardUtils/TrxBoardStructures.h +++ b/include/model/hardware/core/TrxBoardUtils/TrxBoardStructures.h @@ -53,6 +53,7 @@ struct ConnectedPrbInfo struct ScenPrbDepHwRegister { + QList lpfScaleCoeff; QList> lpfLut; QList> atgcLut; QList> apodizationLut; diff --git a/include/model/hardware/core/register/Register.h b/include/model/hardware/core/register/Register.h index 55d3190..00da3b3 100644 --- a/include/model/hardware/core/register/Register.h +++ b/include/model/hardware/core/register/Register.h @@ -50,7 +50,7 @@ public: void update(); void updateLong(); - void updateArray(bool isVariable = false, quint8 arrayLength = 0); + void updateArray(bool isVariable = false, quint16 arrayLength = 0); void updateArrayLong(quint8 interval, quint32 arrayLength, bool _isCumulative=false); void sync(); diff --git a/include/model/hardware/core/register/afe/Afe.h b/include/model/hardware/core/register/afe/Afe.h index 28a1f50..351d1f0 100644 --- a/include/model/hardware/core/register/afe/Afe.h +++ b/include/model/hardware/core/register/afe/Afe.h @@ -2,6 +2,7 @@ #define AFE_H #include "registerDefinition/AdcSyncStatus.h" +#include "registerDefinition/AdcLatency.h" #include "registerDefinition/ActiveTerm.h" #include "registerDefinition/LnaHpf.h" #include "registerDefinition/Global.h" @@ -135,6 +136,7 @@ class Afe { private: AdcSyncStatus* _adcSync; + AdcLatency* _adcLatency; ActiveTerm* _actTerm; LnaHpf* _lnaHpf; Global* _global; @@ -154,6 +156,7 @@ public: void setAfeGblPwr(const bool pwrdn) const; void setReadRegEnable(const bool rdEn) const; + quint32 getAdcLatency(void) const; bool getAfeSyncDone(void) const; quint32 getAfeSyncError(void) const; quint32 getAfeSyncAddress(void) const; diff --git a/include/model/hardware/core/register/afe/registerDefinition/AdcLatency.h b/include/model/hardware/core/register/afe/registerDefinition/AdcLatency.h new file mode 100644 index 0000000..9c40cc0 --- /dev/null +++ b/include/model/hardware/core/register/afe/registerDefinition/AdcLatency.h @@ -0,0 +1,43 @@ +#ifndef ADCLATENCY_H +#define ADCLATENCY_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define GEN_SYNC_CHECKER_MASK 0x00000001 +#define SYNC_CHECK_DONE_MASK 0x00000002 +#define SYNC_CHECK_ERROR_MASK 0x00000004 +#define SAMPLE_LATENCY_MASK 0x00003F00 + +#define BAR 0U +#define OFFSET 0x43C380 + +class AdcLatency : public Register +{ + +public: + Field* genSyncChecker; + Field* syncCheckDone; + Field* syncCheckError; + Field* sampleLatency; + + AdcLatency(SonoDevice* device, quint32 offset) : Register(BAR, OFFSET + offset, device) + { + ADD_UNSIGNED_FIELD(genSyncChecker, GEN_SYNC_CHECKER_MASK); + ADD_UNSIGNED_FIELD(syncCheckDone, SYNC_CHECK_DONE_MASK ); + ADD_UNSIGNED_FIELD(syncCheckError, SYNC_CHECK_ERROR_MASK); + ADD_UNSIGNED_FIELD(sampleLatency, SAMPLE_LATENCY_MASK ); + } +}; + +#undef GEN_SYNC_CHECKER_MASK +#undef SYNC_CHECK_DONE_MASK +#undef SYNC_CHECK_ERROR_MASK +#undef SAMPLE_LATENCY_MASK + +#undef BAR +#undef OFFSET + +#endif // ADCLATENCY_H diff --git a/include/model/hardware/core/register/beamFormer/registerDefinition/ApodizationLut.h b/include/model/hardware/core/register/beamFormer/registerDefinition/ApodizationLut.h index b335487..8c2ef1a 100644 --- a/include/model/hardware/core/register/beamFormer/registerDefinition/ApodizationLut.h +++ b/include/model/hardware/core/register/beamFormer/registerDefinition/ApodizationLut.h @@ -19,7 +19,6 @@ private: void prepareData(quint32 index) override { - //apodizationPrp->setValue(_apodization.at(static_cast(index))); apodizationPrp->setValue(_apodization[static_cast(index)]); } diff --git a/include/model/hardware/core/register/bpiFlash/registerDefinition/McsRdWr.h b/include/model/hardware/core/register/bpiFlash/registerDefinition/McsRdWr.h index 484ef51..bb87e89 100644 --- a/include/model/hardware/core/register/bpiFlash/registerDefinition/McsRdWr.h +++ b/include/model/hardware/core/register/bpiFlash/registerDefinition/McsRdWr.h @@ -32,7 +32,7 @@ public: void receiveData (void) override { - mcsListRd.append(masterMcsData->getValue()); + mcsListRd.push_back(this->masterMcsData->getValue()); } McsRdWr(SonoDevice* device) : Register(BAR, OFFSET, device, MCS_FILE_SIZE) diff --git a/include/model/hardware/core/register/builtInTest/BuiltInTest.h b/include/model/hardware/core/register/builtInTest/BuiltInTest.h index 5db46f3..e57bcb9 100644 --- a/include/model/hardware/core/register/builtInTest/BuiltInTest.h +++ b/include/model/hardware/core/register/builtInTest/BuiltInTest.h @@ -5,6 +5,12 @@ #include "registerDefinition/BiteDacMemoryCmd.h" #include "registerDefinition/BiteDacOutputSelect.h" +enum eBiteDacOutput : bool +{ + adgGnd = false, + adgIQ = true +}; + class BuiltInTest { private: @@ -33,8 +39,9 @@ public: explicit BuiltInTest(SonoDevice* device); ~BuiltInTest(); - void biteDacMemoryWrite (TxDacMemory* txDacMem) const; + void biteDacMemoryWrite (const QByteArray& iData, const QByteArray& qData) const; void biteDacEnable(quint8 biteInterval, bool cmd) const; + void biteAdgCfg(eBiteDacOutput adg) const; }; diff --git a/include/model/hardware/core/register/builtInTest/registerDefinition/BiteDacMemory.h b/include/model/hardware/core/register/builtInTest/registerDefinition/BiteDacMemory.h index 62c019e..75796a5 100644 --- a/include/model/hardware/core/register/builtInTest/registerDefinition/BiteDacMemory.h +++ b/include/model/hardware/core/register/builtInTest/registerDefinition/BiteDacMemory.h @@ -13,30 +13,25 @@ #define OFFSET 0XE000 #define LENGTH 2048U -struct TxDacMemory -{ - QList _iData; - QList _qData; -}; - - class BiteDacMemory : public Register { private: - TxDacMemory* _txDacMem; + QByteArray _iData; + QByteArray _qData; void prepareData(quint32 index) override { - txDacIData->setValue(_txDacMem->_iData.at(static_cast(index))); - txDacQData->setValue(_txDacMem->_qData.at(static_cast(index))); + txDacIData->setValue(static_cast(_iData.at(static_cast(index)))); + txDacQData->setValue(static_cast(_qData.at(static_cast(index)))); } public: Field* txDacIData; Field* txDacQData; - void setTxDacMemory(TxDacMemory* txDacMem) + void setTxDacMemory(const QByteArray& iData, const QByteArray& qData) { - _txDacMem = txDacMem; + _iData = iData; + _qData = qData; } BiteDacMemory(SonoDevice* device) : Register(BAR, OFFSET, device, LENGTH) diff --git a/include/model/hardware/core/register/debug/Debug.h b/include/model/hardware/core/register/debug/Debug.h new file mode 100644 index 0000000..e80d0ea --- /dev/null +++ b/include/model/hardware/core/register/debug/Debug.h @@ -0,0 +1,66 @@ +#ifndef DEBUG_H +#define DEBUG_H + +#include "registerDefinition/AdcLoggerDataTransfer.h" +#include "registerDefinition/AdcLoggerCapCmd.h" +#include "registerDefinition/AdcLoggerStatus.h" +#include "registerDefinition/DebuggerMode.h" + +enum eDebugMode : bool +{ + pulserHz = false, + pulserTr = true +}; + +enum eCaptureMode : bool +{ + allChannel = false, + singleChannel = true +}; + +struct DebugMode +{ + bool rxBfDbgModeEn; + bool rxBfSimDataGenModeEn; + bool txBfTestModeEn; + eDebugMode txBfTestModeCfg; +}; + +struct captureConfig +{ + eCaptureMode capMode = allChannel; + bool manualTrig = false; + quint32 sampleCount; + quint32 syncCount; +}; + +class Debug +{ +private: + AdcLoggerDataTransfer* _adcLoggerDataTransfer; + AdcLoggerCapCmd* _adcLoggerCapCmd; + AdcLoggerStatus* _adcLoggerStatus; + DebuggerMode* _debuggerMode; + +public: + explicit Debug(SonoDevice* device, quint32 offset); + ~Debug(); + + void setDebuggerMode (const DebugMode dbgMode) const; + void getDebuggerMode (DebugMode& dbgModeRb); + + void adcLoggerConfig (const captureConfig &capCfg) const; + void adcLoggerRst (bool capRst) const; + void adcCaptureCmd (bool capEn) const; + quint32 getCaptureSampleNo (void) const; + + void adcLoggerChannelNum (quint16 chNum) const; + void adcLoggerTransferCmd (bool start) const; + + bool getCapDone (void) const; + bool getTransferDone (void) const; + quint32 getCapSyncOffset (void) const; + +}; + +#endif // DEBUG_H diff --git a/include/model/hardware/core/register/debug/registerDefinition/AdcLoggerCapCmd.h b/include/model/hardware/core/register/debug/registerDefinition/AdcLoggerCapCmd.h new file mode 100644 index 0000000..2172dd0 --- /dev/null +++ b/include/model/hardware/core/register/debug/registerDefinition/AdcLoggerCapCmd.h @@ -0,0 +1,51 @@ +#ifndef ADCLOGGERCAPCMD_H +#define ADCLOGGERCAPCMD_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define LOGGER_RST_MASK 0x00000001 +#define CAP_MODE_MASK 0x00000002 +#define CAP_EN_MASK 0x00000004 +#define CAP_MNL_TRIG_MASK 0x00000008 +#define CAP_SYNC_NO_MASK 0x00003FF0 +#define CAP_SAMPLE_NO_MASK 0xFFFFC000 + +#define BAR 0U +#define OFFSET 0x500004 + +class AdcLoggerCapCmd : public Register +{ +public: + Field* loggerRst; + Field* capMode; + Field* capEn; + Field* capMnlTrig; + Field* capSyncNo; + Field* capSampleNo; + + AdcLoggerCapCmd(SonoDevice* device, quint32 offset) : Register(BAR, OFFSET + offset, device) + { + ADD_UNSIGNED_FIELD(loggerRst, LOGGER_RST_MASK ); + ADD_UNSIGNED_FIELD(capMode, CAP_MODE_MASK ); + ADD_UNSIGNED_FIELD(capEn, CAP_EN_MASK ); + ADD_UNSIGNED_FIELD(capMnlTrig, CAP_MNL_TRIG_MASK ); + ADD_UNSIGNED_FIELD(capSyncNo, CAP_SYNC_NO_MASK ); + ADD_UNSIGNED_FIELD(capSampleNo, CAP_SAMPLE_NO_MASK); + } +}; + +#undef LOGGER_RST_MASK +#undef CAP_MODE_MASK +#undef CAP_EN_MASK +#undef CAP_MNL_TRIG_MASK +#undef CAP_SYNC_NO_MASK +#undef CAP_SAMPLE_NO_MASK + +#undef BAR +#undef OFFSET + + +#endif // ADCLOGGERCAPCMD_H diff --git a/include/model/hardware/core/register/debug/registerDefinition/AdcLoggerDataTransfer.h b/include/model/hardware/core/register/debug/registerDefinition/AdcLoggerDataTransfer.h new file mode 100644 index 0000000..55e5920 --- /dev/null +++ b/include/model/hardware/core/register/debug/registerDefinition/AdcLoggerDataTransfer.h @@ -0,0 +1,38 @@ +#ifndef ADCLOGGERDATATRANSFER_H +#define ADCLOGGERDATATRANSFER_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define TRANSFER_START_MASK 0x00000001 +#define TRANSFER_STOP_MASK 0x00000002 +#define ADC_CHANNEL_NO 0x00003F00 + +#define BAR 0U +#define OFFSET 0x500008 + +class AdcLoggerDataTransfer : public Register +{ +public: + Field* transferStart; + Field* transferStop; + Field* adcChannelNo; + + AdcLoggerDataTransfer(SonoDevice* device, quint32 offset) : Register(BAR, OFFSET + offset, device) + { + ADD_UNSIGNED_FIELD(transferStart, TRANSFER_START_MASK); + ADD_UNSIGNED_FIELD(transferStop, TRANSFER_STOP_MASK ); + ADD_UNSIGNED_FIELD(adcChannelNo, ADC_CHANNEL_NO ); + } +}; + +#undef TRANSFER_START_MASK +#undef TRANSFER_STOP_MASK +#undef ADC_CHANNEL_NO + +#undef BAR +#undef OFFSET + +#endif // ADCLOGGERDATATRANSFER_H diff --git a/include/model/hardware/core/register/debug/registerDefinition/AdcLoggerStatus.h b/include/model/hardware/core/register/debug/registerDefinition/AdcLoggerStatus.h new file mode 100644 index 0000000..6044951 --- /dev/null +++ b/include/model/hardware/core/register/debug/registerDefinition/AdcLoggerStatus.h @@ -0,0 +1,43 @@ +#ifndef ADCLOGGERSTATUS_H +#define ADCLOGGERSTATUS_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define CAP_DONE 0x00000001 +#define CAP_SYNC_OFFSET_MASK 0x00000070 +#define TRANSFER_DONE_MASK 0x00000100 +#define FPGA_NO_MASK 0xC0000000 + +#define BAR 0U +#define OFFSET 0x500028 + +class AdcLoggerStatus : public Register +{ +public: + Field* capDone; + Field* capSyncOffset; + Field* transferDone; + Field* fpgaNo; + + AdcLoggerStatus(SonoDevice* device, quint32 offset) : Register(BAR, OFFSET + offset, device) + { + ADD_UNSIGNED_FIELD(capDone, CAP_DONE ); + ADD_UNSIGNED_FIELD(capSyncOffset, CAP_SYNC_OFFSET_MASK); + ADD_UNSIGNED_FIELD(transferDone, TRANSFER_DONE_MASK ); + ADD_UNSIGNED_FIELD(fpgaNo, FPGA_NO_MASK ); + } +}; + +#undef CAP_DONE +#undef CAP_SYNC_OFFSET_MASK +#undef TRANSFER_DONE_MASK +#undef FPGA_NO_MASK + +#undef BAR +#undef OFFSET + + +#endif // ADCLOGGERSTATUS_H diff --git a/include/model/hardware/core/register/debug/registerDefinition/DebuggerMode.h b/include/model/hardware/core/register/debug/registerDefinition/DebuggerMode.h new file mode 100644 index 0000000..2bcc166 --- /dev/null +++ b/include/model/hardware/core/register/debug/registerDefinition/DebuggerMode.h @@ -0,0 +1,42 @@ +#ifndef DEBUGGERMODE_H +#define DEBUGGERMODE_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define RX_BF_DBG_MODE_EN_MASK 0x00000001 +#define RX_BF_SIM_DATA_GEN_MODE_EN_MASK 0x00000002 +#define TX_BF_TEST_MODE_EN_MASK 0x00000004 +#define TX_BF_TEST_MODE_CFG_MASK 0x00000008 + +#define BAR 0U +#define OFFSET 0x500000 + +class DebuggerMode : public Register +{ +public: + Field* rxBfDbgModeEn; + Field* rxBfSimDataGenModeEn; + Field* txBfTestModeEn; + Field* txBfTestModeCfg; + + DebuggerMode(SonoDevice* device, quint32 offset) : Register(BAR, OFFSET + offset, device) + { + ADD_UNSIGNED_FIELD(rxBfDbgModeEn, RX_BF_DBG_MODE_EN_MASK ); + ADD_UNSIGNED_FIELD(rxBfSimDataGenModeEn, RX_BF_SIM_DATA_GEN_MODE_EN_MASK); + ADD_UNSIGNED_FIELD(txBfTestModeEn, TX_BF_TEST_MODE_EN_MASK ); + ADD_UNSIGNED_FIELD(txBfTestModeCfg, TX_BF_TEST_MODE_CFG_MASK ); + } +}; + +#undef RX_BF_DBG_MODE_EN_MASK +#undef RX_BF_SIM_DATA_GEN_MODE_EN_MASK +#undef TX_BF_TEST_MODE_EN_MASK +#undef TX_BF_TEST_MODE_CFG_MASK + +#undef BAR +#undef OFFSET + +#endif // DEBUGGERMODE_H diff --git a/include/model/hardware/core/register/dsp/Dsp.h b/include/model/hardware/core/register/dsp/Dsp.h index a18a06c..757c209 100644 --- a/include/model/hardware/core/register/dsp/Dsp.h +++ b/include/model/hardware/core/register/dsp/Dsp.h @@ -9,6 +9,7 @@ #include "registerDefinition/ManualAtgc.h" #include "registerDefinition/DtgcLut.h" #include "registerDefinition/AtgcLut.h" +#include "registerDefinition/BfScale.h" #include "registerDefinition/LpfLut.h" #define BLEND_WEIGHT_OFFSET 0x800 @@ -32,6 +33,7 @@ private: ManualAtgc* _manualAtgc; DtgcLut* _dtgcLut; AtgcLut* _atgcLut; + BfScale* _bfScale; LpfLut* _lpfLut; public: @@ -40,6 +42,7 @@ public: void receiverConfigurationLut (quint8& receiverConfigTypeNumber, ReceiverConfiguration* configLut) const; void lineFilterCoefficient (QList& lineFilterLut) const; + void lpfScaleCoefficient (QList& lpfScaleCoeff) const; void stbCoefficient (QList& stbLut) const; void frequencyLut (QList& freqLut) const; void blendWeight (QList>& blendWeight) const; diff --git a/include/model/hardware/core/register/dsp/registerDefinition/BfScale.h b/include/model/hardware/core/register/dsp/registerDefinition/BfScale.h new file mode 100644 index 0000000..bd8e565 --- /dev/null +++ b/include/model/hardware/core/register/dsp/registerDefinition/BfScale.h @@ -0,0 +1,43 @@ +#ifndef BFSCALE_H +#define BFSCALE_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define BF_COEFF1_MASK 0x000000FF +#define BF_COEFF2_MASK 0x0000FF00 +#define BF_COEFF3_MASK 0x00FF0000 +#define BF_COEFF4_MASK 0xFF000000 + +#define BAR 0 +#define OFFSET 0x86018 + +class BfScale : public Register +{ +public: + Field* bfCoeff1; + Field* bfCoeff2; + Field* bfCoeff3; + Field* bfCoeff4; + + BfScale(SonoDevice* device) : Register(BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(bfCoeff1, BF_COEFF1_MASK); + ADD_UNSIGNED_FIELD(bfCoeff2, BF_COEFF2_MASK); + ADD_UNSIGNED_FIELD(bfCoeff3, BF_COEFF3_MASK); + ADD_UNSIGNED_FIELD(bfCoeff4, BF_COEFF4_MASK); + } +}; + +#undef BF_COEFF1_MASK +#undef BF_COEFF2_MASK +#undef BF_COEFF3_MASK +#undef BF_COEFF4_MASK + +#undef BAR +#undef OFFSET +#undef LENGTH + +#endif // BFSCALE_H diff --git a/include/model/hardware/core/register/dsp/registerDefinition/ManualAtgc.h b/include/model/hardware/core/register/dsp/registerDefinition/ManualAtgc.h index e90c28f..ff05d78 100644 --- a/include/model/hardware/core/register/dsp/registerDefinition/ManualAtgc.h +++ b/include/model/hardware/core/register/dsp/registerDefinition/ManualAtgc.h @@ -11,7 +11,7 @@ #define USER_MODE_ENABLE_MASK 0x00002000 #define BAR 0U -#define OFFSET 0X86018 +#define OFFSET 0X8601C class ManualAtgc : public Register { diff --git a/include/model/hardware/core/register/misc/Misc.h b/include/model/hardware/core/register/misc/Misc.h index a86e838..7361262 100644 --- a/include/model/hardware/core/register/misc/Misc.h +++ b/include/model/hardware/core/register/misc/Misc.h @@ -1,9 +1,12 @@ #ifndef MISC_H #define MISC_H +#include "registerDefinition/AdcSamplerControl.h" +#include "registerDefinition/AdcSamplerStatus.h" #include "registerDefinition/FrameLostCount.h" #include "registerDefinition/StatusVector.h" #include "registerDefinition/FpgaVersion.h" +#include "registerDefinition/AdcDataBram.h" #include "registerDefinition/GtSendMode.h" #include "registerDefinition/SyncMode.h" @@ -40,16 +43,16 @@ struct FpgaCodeVersion enum eGtSendCtrl : quint8 { - BfMode = 1, - AdcMode, - DbgMode, + bfMode = 1, + adcMode, + dbgMode }; enum eSyncCtrl : quint8 { - BfSyncMode, - AdcSyncMode, - BfAdcLogMode, + bfSyncMode, + adcSyncMode, + bfAdcLogMode }; class Misc @@ -69,6 +72,10 @@ private: SyncMode* _sync; FrameLostCount* _lostCount; + AdcSamplerControl* _adcSamplerControl; + AdcSamplerStatus* _adcSamplerStatus; + AdcDataBram* _adcDataBram; + template quint32 getVersion (T* version) const; @@ -83,6 +90,12 @@ public: void setManualSync (bool sync) const; quint32 getFrameLostCount(void) const; + void setAdcSamplerCmd (bool start) const; + void setAdcSamplerFpgaSel (quint8 fpgaSel) const; + bool getAdcSamplerBramReady (void) const; + bool getAdcSamplerError (void) const; + void getAdcDataBram (QList* adcData) const; + }; diff --git a/include/model/hardware/core/register/misc/registerDefinition/AdcDataBram.h b/include/model/hardware/core/register/misc/registerDefinition/AdcDataBram.h new file mode 100644 index 0000000..ec8bda2 --- /dev/null +++ b/include/model/hardware/core/register/misc/registerDefinition/AdcDataBram.h @@ -0,0 +1,38 @@ +#ifndef ADCDATABRAM_H +#define ADCDATABRAM_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define ADC_DATA_MASK 0x00003FFF + +#define BAR 0 +#define OFFSET 0x2000 +#define LENGTH 2048U + +class AdcDataBram : public Register +{ +public: + Field* adcData; + QList adcDataList; + + void receiveData() override + { + adcDataList.push_back(static_cast(this->adcData->getValue())); + } + + AdcDataBram(SonoDevice* device) : Register(BAR, OFFSET, device, LENGTH) + { + ADD_SIGNED_FIELD(adcData, ADC_DATA_MASK); + } +}; + +#undef ADC_DATA_MASK + +#undef BAR +#undef OFFSET +#undef LENGTH + +#endif // ADCDATABRAM_H diff --git a/include/model/hardware/core/register/misc/registerDefinition/AdcSamplerControl.h b/include/model/hardware/core/register/misc/registerDefinition/AdcSamplerControl.h new file mode 100644 index 0000000..85e7b75 --- /dev/null +++ b/include/model/hardware/core/register/misc/registerDefinition/AdcSamplerControl.h @@ -0,0 +1,34 @@ +#ifndef ADCSAMPLERCONTROL_H +#define ADCSAMPLERCONTROL_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define START_MASK 0x00000001 +#define FPGA_SLAVE_SEL_MASK 0x00000006 + +#define BAR 0U +#define OFFSET 0x1000 + +class AdcSamplerControl : public Register +{ +public: + Field* start; + Field* fpgaSlaveSel; + + AdcSamplerControl(SonoDevice* device) : Register(BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(start, START_MASK ); + ADD_UNSIGNED_FIELD(fpgaSlaveSel, FPGA_SLAVE_SEL_MASK); + } +}; + +#undef START_MASK +#undef FPGA_SLAVE_SEL_MASK + +#undef BAR +#undef OFFSET + +#endif // ADCSAMPLERCONTROL_H diff --git a/include/model/hardware/core/register/misc/registerDefinition/AdcSamplerStatus.h b/include/model/hardware/core/register/misc/registerDefinition/AdcSamplerStatus.h new file mode 100644 index 0000000..21116df --- /dev/null +++ b/include/model/hardware/core/register/misc/registerDefinition/AdcSamplerStatus.h @@ -0,0 +1,35 @@ +#ifndef ADCSAMPLERSTATUS_H +#define ADCSAMPLERSTATUS_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define BRAM_READY_MASK 0x00000001 +#define ERROR_MASK 0x00000002 + +#define BAR 0U +#define OFFSET 0x1004 + +class AdcSamplerStatus : public Register +{ +public: + Field* bramReady; + Field* error; + + AdcSamplerStatus(SonoDevice* device) : Register(BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(bramReady, BRAM_READY_MASK); + ADD_UNSIGNED_FIELD(error, ERROR_MASK); + } +}; + +#undef BRAM_READY_MASK +#undef ERROR_MASK + +#undef BAR +#undef OFFSET + + +#endif // ADCSAMPLERSTATUS_H diff --git a/include/model/hardware/core/register/misc/registerDefinition/FrameLostCount.h b/include/model/hardware/core/register/misc/registerDefinition/FrameLostCount.h index b17bfca..db0a606 100644 --- a/include/model/hardware/core/register/misc/registerDefinition/FrameLostCount.h +++ b/include/model/hardware/core/register/misc/registerDefinition/FrameLostCount.h @@ -9,7 +9,7 @@ #define LOST_COUNT 0x000000FF #define BAR 0U -#define OFFSET 0x86024 +#define OFFSET 0x86028 class FrameLostCount : public Register { diff --git a/include/model/hardware/core/register/sram/registerDefinition/RxParams.h b/include/model/hardware/core/register/sram/registerDefinition/RxParams.h index b1f9a15..eb0d252 100644 --- a/include/model/hardware/core/register/sram/registerDefinition/RxParams.h +++ b/include/model/hardware/core/register/sram/registerDefinition/RxParams.h @@ -8,10 +8,10 @@ #undef BAR -#define RX_ACTIVE_ELEMENT_STEP_MASK 0x00000000000000FF -#define INTERCEPT_POINT_FIRING_TIME_MASK 0x00000000000FFF00 -#define RX_FOCUS_POINT_NUMBER_MASK 0x00000001FFF00000 -#define R0_POSITION_MASK 0x0003FFFE00000000 +#define RX_ACTIVE_ELEMENT_STEP_MASK 0x00000000000000FF +#define INTERCEPT_POINT_FIRING_TIME_MASK 0x00000000001FFF00 +#define RX_FOCUS_POINT_NUMBER_MASK 0x00000003FFE00000 +#define R0_POSITION_MASK 0x0007FFFC00000000 #define BAR 1U #define OFFSET 0x100010 diff --git a/mainwindow.cpp b/mainwindow.cpp index 039b2d5..9ead7ee 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -43,6 +43,7 @@ MainWindow::MainWindow(QWidget* parent) ui->rbtn_offset->setChecked(!_settings->value(REG_ACCESS_SEL).value()); ui->tb_fpgaBit->setText(_settings->value(FPGA_FILE_PATH).value()); ui->tb_scenFilesPath->setText(_settings->value(SCENARIO_FILE_PATH).value()); + ui->tb_biteFilesPath->setText(_settings->value(BITE_FILE_PATH).value()); ui->tb_trxRomId->setPlaceholderText("id(hex)"); ui->tb_trxRomInfo->setPlaceholderText("info"); @@ -62,6 +63,8 @@ MainWindow::MainWindow(QWidget* parent) connect(this, &MainWindow::scenarioReady, this, &MainWindow::setScenario); connect(this, &MainWindow::labelState, this, &MainWindow::getLabelState); connect(this, &MainWindow::fpgaProgrammer, this, &MainWindow::getFpgaProgrammer); + connect(&biteLogWatcher, &QFutureWatcher::finished, this, &MainWindow::biteLogThreadFinished); + connect(&dmaLogWatcher, &QFutureWatcher::finished, this, &MainWindow::dmaLogThreadFinished); connect(this, &MainWindow::programmingGif, this, &MainWindow::getProgrammingGif); //////////////////////// DMA Packet Connections ////////////////////////////// @@ -77,18 +80,7 @@ MainWindow::MainWindow(QWidget* parent) connect(&_trx, &TrxBoard::sramVerifyMessage, this, &MainWindow::getSramVerifyMessage); ui->btn_updateRdbackValue->setText(UPDATE); - ui->btn_dmaLogLast->setHidden(true); - - //uint32_t offsetdbgCmd[3] = {0x140000*4,0x240000*4,0x340000*4}; - //auto value = 0; - //for (auto i=0 ; i<3;i++) - //{ - //value = (_usd->readWord(offsetdbgCmd[i], 0)) & 0xC; - //if(value != 0) - //break; - //} - //if(value != 0) - //ui->ch_testMode->setCheckState(Qt::CheckState::Checked); + dmaLogLayoutVisible(false); _dmaLog = false; _dmaRun = false; @@ -153,182 +145,6 @@ MainWindow::~MainWindow() delete movie; } -///*************************************************************************************************/ -//void MainWindow::binAdcFileUploader(quint32 bar, QString path, QProgressBar* prg) -//{ -//QFile file(path); - -//if (!file.open(QFile::ReadOnly)) -//{ -//MESSAGE_BOX("Could not open binary file, aborting operation"); -//return; -//} - -//emit updateBlockProgressVisibility(true, prg); -//emit updateBlockProgressValue(0, prg); - -//const auto actualSize = file.size(); -//qint64 readSize = 0; -//quint32 addr = 0; -//quint32 data = 0; -//auto syncNum = 0; -//while((readSize < actualSize) & !_csvReadStopFlag) -//{ -//QByteArray chunk = file.read(8); -//auto value = byteArrayTo64LittleEndian(chunk); -//try -//{ -//addr = static_cast(value >> 32); -//data = static_cast(value & 0xFFFFFFFF); - -//_usd->writeWord(addr, bar, data); -//if (addr != 3076) -//{ -//qDebug() << syncNum << "==> " << addr << "::" << data; -//syncNum +=1; - -//} - -//} catch (myexception e) -//{ -//MESSAGE_BOX(e.what()); - -//emit updateBlockProgressVisibility(false, prg); - -//file.close(); - -//return; -//} -//readSize += 8; -//auto percentage = (readSize * 100 / actualSize); -//emit updateBlockProgressValue(percentage, prg); -//} - -////MESSAGE_BOX("Binary file upload finished with success"); - -//emit updateBlockProgressVisibility(false, prg); - -//file.close(); -//} -///*************************************************************************************************/ -//#define NO_AFE_CHANNEL 192 -//#define NO_LOGGER_SMPL_COUNT 2048 -//void MainWindow::AdcLogCsvFileWriter(QString folderPath, QProgressBar* prg) -//{ -//quint32 bar = 0; -//quint32 offset = 0x2000; -//uint32_t offsetDbgTrsfr[3] = {0x140002*4,0x240002*4,0x340002*4}; -//uint32_t offsetDbgTrsfrDone[3] = {0x14000A*4,0x24000A*4,0x34000A*4}; -//_adcLoggerTrnsDone = false; - -//QTime t = QTime::currentTime(); -//QString path = folderPath + "/adcLog_" + -//QString("%1_%2_%3.csv").arg(t.hour()).arg(t.minute()).arg(t.second()); -//QFile file(path); -//file.open(QIODevice::WriteOnly); - -//emit updateBlockProgressVisibility(true, prg); -//emit updateBlockProgressValue(0, prg); - -//auto timeOut = 0; -//quint32 doneFlag = 0; -//quint32 value = 0; -//quint32 fpgaNum = 0; - -//offset = 0x4 * 4; -//auto gtSndMd = _usd->readWord(offset, bar); -//qDebug() << "--- SET GT Send Mode :: ADC Raw Logger --- "; -//_usd->writeWord(offset, bar, 0x2); // set GT Send mode (ADC Raw Logger) - -//for (auto j = 0; j < 3; j+=1) -//_usd->writeWord(offsetDbgTrsfr[j], bar,0x0); - -//for (quint16 i = 0; i < NO_AFE_CHANNEL; i += 1) -//{ -//fpgaNum = (i / 64); - -//offset = 0x400*4;// set adc logger stop -//value = (fpgaNum << 1); -//_usd->writeWord(offset, bar,value); - -//value = value | 0x01;// set adc logger fpgaSel and start -//_usd->writeWord(offset, bar,value); - -//_usd->writeWord(offsetDbgTrsfr[fpgaNum], bar,0x0); -//value = i % 64; -//value = static_cast(((static_cast(0X01))) | ((static_cast(value & -//0xFF)) << 8)); -//_usd->writeWord(offsetDbgTrsfr[fpgaNum], bar,value); - -//timeOut = 0; -//doneFlag = 0; -//while (timeOut < 10 && doneFlag == 0 ) -//{ -//doneFlag = ((_usd->readWord(offsetDbgTrsfrDone[fpgaNum], bar)) & 0x100) >> 8; // wait Until -//transfer done -//timeOut += 1; -//delay(2); -//} -//if(timeOut == 10) -//{ -//qDebug() << "Unable to transfer done"; -////MESSAGE_BOX("Unable to transfer done"); -////return; -//} - -//doneFlag = 0; -//timeOut = 0; -//offset = 0x401*4; -//while (timeOut < 10 && doneFlag == 0 ) -//{ -//doneFlag = (_usd->readWord(offset, bar) & 0x1); // wait until adc logger MemDone Flag true -//timeOut += 1; -//delay(2); -//} -//if(timeOut == 10) -//{ -////MESSAGE_BOX("Unable to reach adc logger memory done"); -//qDebug() << "Unable to reach adc logger memory done :: 0x" << _usd->readWord(offset, bar); -////return; -//} - -//_usd->writeWord(offsetDbgTrsfr[fpgaNum], bar,0); // Stop Debug transfer - -//offset = 0x2000; -//qint16 val = 0; -//for(auto j = 0; j < NO_LOGGER_SMPL_COUNT; j += 1) -//{ -//value = _usd->readWord(offset, bar); // Read Adc logger Bram - -//val = static_cast(value & 0x3FFF) << 2; -//val = val >> 2; -//auto str = QStringLiteral("%1,").arg(val); -//file.write(str.toStdString().c_str(), str.length()); - -//offset += 4; -//} -//file.write("\r\n", 2); - -//value = (fpgaNum << 1) | 0x00;// set adc logger fpgaSel and Stop -//offset = 0x400*4; -//_usd->writeWord(offset, bar,value); - -//emit updateBlockProgressValue(i * 100 / NO_AFE_CHANNEL, prg); -//delay(10); - -//} -//offset = 0x400*4; -//_usd->writeWord(offset, bar,0x0); - -//qDebug() << "--- SET GT Send Mode :: Previous Mode --- "; -//offset = 0x4 * 4; -//_usd->writeWord(offset, bar, gtSndMd); // set GT Send mode -//emit updateBlockProgressVisibility(false, prg); - -//file.close(); -//_adcLoggerTrnsDone = true; -//} - /*************************************************************************************************/ void MainWindow::timeout() { @@ -717,32 +533,6 @@ void MainWindow::getProbeColor(const QBrush brush, const int item) } /*************************************************************************************************/ -//void MainWindow::scenarioStart() -//{ -//auto value = 0x1; -//_usd->writeWord(0x800, 0, value); - -//qDebug() << "--- SET GT Send Mode :: BF --- "; -//_usd->writeWord(0x10, 0, 0x1); - -//auto bar = 0; -//uint32_t offsetSlvScenCmd[3] = {0x134000*4,0x234000*4,0x334000*4}; -//uint32_t offsetDbgCmd[3] = {0x140000*4,0x240000*4,0x340000*4}; - -//for (auto i=0 ; i<3;i++) -//{ -//value = _usd->readWord(offsetSlvScenCmd[i], bar); -//_usd->writeWord(offsetSlvScenCmd[i], bar, value | 0x2); -//} -//for (auto i=0 ; i<3;i++) -//{ -//auto value = _usd->readWord(offsetDbgCmd[i], 0); -//value &= 0xFFFFFFF0; -//_usd->writeWord(offsetDbgCmd[i], 0, value); -//} - -//} - void MainWindow::changeLabelTextColor(QLabel* label, QColor color) { auto palette = label->palette(); @@ -854,24 +644,6 @@ void MainWindow::on_btn_writeReg_clicked() } } -/*************************************************************************************************/ -//void MainWindow::newBlockProgressValue(int percentage, QProgressBar* prg) -//{ -//prg->setValue(percentage); -//} - -///*************************************************************************************************/ -//void MainWindow::newFpgaProgressValue(int percentage) -//{ -//ui->prg_fpgaProgram->setValue(percentage); -//} - -///*************************************************************************************************/ -//void MainWindow::newBlockProgressVisibility(bool show, QProgressBar* prg) -//{ -//prg->setVisible(show); -//} - /*************************************************************************************************/ void MainWindow::on_btn_fpgaBrowse_clicked() { @@ -944,6 +716,7 @@ void MainWindow::gifActive() { //emit programmingGif(); } + /*************************************************************************************************/ void MainWindow::newMessage(QString message) { @@ -952,87 +725,6 @@ void MainWindow::newMessage(QString message) msgBox.exec(); } -///*************************************************************************************************/ -//void MainWindow::on_btn_txDacBrowse_clicked() -//{ -//QFileDialog fileDialog; -//fileDialog.setNameFilters({"TxDAC file (*.csv)"}); -//auto result = fileDialog.exec(); - -//if(result) -//{ -//auto selectedPath = fileDialog.selectedFiles()[0]; -//ui->tb_txDacFile->setText(selectedPath); -//_settings->setValue(TX_DAC_FILE_PATH, selectedPath); -//} -//} - -///*************************************************************************************************/ -//void MainWindow::on_btn_txDacUpload_clicked() -//{ -//auto bar = 0; - -//auto offset = 0xE000; - -//auto path = ui->tb_txDacFile->text(); -//_csvReadStopFlag = false; -//QFutureWatcher watcher; -//connect(&watcher, &QFutureWatcher::finished, this, &MainWindow::threadFinished); -//auto future = QtConcurrent::run(this, &MainWindow::CsvFileUploader, bar, path, -//ui->prg_txDacUpload); -//watcher.setFuture(future); -//_dial->exec(); -//disconnect(&watcher, &QFutureWatcher::finished, this, &MainWindow::threadFinished); -//} - -///*************************************************************************************************/ -//void MainWindow::on_btn_txDacStartStop_clicked() -//{ -//auto bar = 0; -//auto offset = 0x10000; - -//auto interval = ui->tb_txDacInterval->text().toUInt(Q_NULLPTR, 16); -//if(interval == 0 && ui->tb_txDacInterval->text() != "0") -//{ -//MESSAGE_BOX("Invalid input format for interval"); -//return; -//} -//uint32_t value = 0; -//value = ((interval & 0x000000FF) << 8) ; -//auto str = ui->btn_txDacStartStop->text(); -//if(str == START) -//{ -//_usd->writeWord(offset, bar, value | 0x1); -//ui->btn_txDacStartStop->setText(STOP); -//} -//else -//{ -//_usd->writeWord(offset, bar, value); -//ui->btn_txDacStartStop->setText(START); -//} -//} - -///*************************************************************************************************/ -//void MainWindow::on_btn_txDacOnOff_clicked() -//{ -//auto bar = 0; -//auto offset = 0x10004; - -//auto str = ui->btn_txDacOnOff->text(); -//if(str == ON) -//{ -//auto value = 0xf; -//_usd->writeWord(offset, bar, value); -//ui->btn_txDacOnOff->setText(OFF); -//} -//else -//{ -//auto value = 0x0; -//_usd->writeWord(offset, bar, value); -//ui->btn_txDacOnOff->setText(ON); -//} -//} - /*************************************************************************************************/ void MainWindow::on_cb_selectedProbe_currentIndexChanged(int index) { @@ -1057,111 +749,6 @@ void MainWindow::on_cb_selectedProbe_currentIndexChanged(int index) } /*************************************************************************************************/ -/*void MainWindow::on_btn_pllClkSt_clicked() - { - - auto bar = 0; - auto offset = 0x26000; - - auto str = ui->btn_pllClkSt->text(); - if(str == ON) - { - auto temp = ui->tb_pllClkSt->text().toUInt(Q_NULLPTR, 10); - if(temp == 0 && ui->tb_pllClkSt->text() != "0" || temp < 400 || temp > 2000) - { - MESSAGE_BOX("Invalid input format for PLL CLK ST"); - return; - } - - float halfPeriod = 50000.0f / temp; - uint roundHalfPeriod = uint(roundf(halfPeriod)) & 0xFF; - float t = roundf(50000.0f / roundHalfPeriod); - ui->tb_pllClkSt->setText(QString::number(t, 'f', 0)); - - - auto value = 0; - value = roundHalfPeriod | 0x00000300; - _usd->writeWord(offset, bar, value ); - value = value & 0x000002FF; - _usd->writeWord(offset, bar, value ); - - ui->btn_pllClkSt->setText(OFF); - } - else - { - auto value = 0; - _usd->writeWord(offset, bar, value); - ui->btn_pllClkSt->setText(ON); - } - - } - - - //void MainWindow::on_btn_pllClkTps_clicked() - //{ - // auto bar = 0; - // auto offset = 0x26004; - - // auto str = ui->btn_pllClkTps->text(); - // if(str == ON) - // { - // auto temp = ui->tb_pllClkTps->text().toUInt(Q_NULLPTR, 10); - // if(temp == 0 && ui->tb_pllClkTps->text() != "0" || temp < 400 || temp > 2000) - // { - // MESSAGE_BOX("Invalid input format for PLL CLK TPS"); - // return; - // } - - // float halfPeriod = 50000.0f / temp; - // uint roundHalfPeriod = uint(roundf(halfPeriod)) & 0xFF; - // float t = roundf(50000.0f / roundHalfPeriod); - // ui->tb_pllClkTps->setText(QString::number(t, 'f', 0)); - - // auto value =0; - // value = roundHalfPeriod | 0x00000300; - // _usd->writeWord(offset, bar, value ); - // value = value & 0x000002FF; - // _usd->writeWord(offset, bar, value ); - - // ui->btn_pllClkTps->setText(OFF); - // } - // else - // { - // auto value = 0; - // _usd->writeWord(offset, bar, value); - // ui->btn_pllClkTps->setText(ON); - // } - - //} - - //&************************************************************************************************* - //void MainWindow::on_btn_mulDacTrig_clicked() - //{ - // auto bar = 0; - // auto offset = 0x86018; - - // // auto str = ui->btn_mulDacTrig->text(); - // //if(str == TRIG_ON) - // //{ - // auto temp = ui->tb_mlDac->text().toUInt(Q_NULLPTR, 16); - // _usd->writeWord(offset, bar, temp ); - // if (ui->chk_usrMulDac->isChecked()) - // { - // _usd->writeWord(offset, bar, temp|0x3000 ); - // _usd->writeWord(offset, bar, temp|0x2000 ); - // } - - //// ui->btn_mulDacTrig->setText(TRIG_OFF); - // //} - // //else - // //{ - // // auto value = 0; - // //_usd->writeWord(offset, bar, value); - // // ui->btn_mulDacTrig->setText(TRIG_ON); - // //} - //}*/ - -/********************************************************************/ void MainWindow::delay(int ms) { delayTimer.singleShot(ms, &loop, &QEventLoop::quit); @@ -1243,14 +830,6 @@ void MainWindow::on_chk_continuousShowing_clicked() } } -/*************************************************************************************************/ -void MainWindow::fillRam(QString path) -{ - ui->btn_emulBrowse->setText("Filling RAM..."); - _trx.fillRam(path); - ui->btn_emulBrowse->setText("Emulator Browse"); -} - /*************************************************************************************************/ void MainWindow::on_btn_scenStart_clicked() { @@ -1262,19 +841,18 @@ void MainWindow::on_btn_scenStart_clicked() { ui->btn_scenStart->setText("Scenario Stop"); ui->btn_emulator->setText("Emulator Start"); - ui->btn_dmaLogLast->setVisible(true); + dmaLogLayoutVisible(true); _trx.scenPlayerStart(true); _dmaLog = true; _dmaRun = true; //flag _dmaBuffer.clear(); - //QtConcurrent::run(this, &MainWindow::logPcie); } else { ui->btn_scenStart->setText("Scenario Start"); ui->chk_continuousShowing->setChecked(false); on_chk_continuousShowing_clicked(); - ui->btn_dmaLogLast->setHidden(true); + dmaLogLayoutVisible(false); _dmaLog = false; _dmaRun = false; _trx.scenPlayerStop(true); @@ -1286,26 +864,6 @@ void MainWindow::on_btn_scenStart_clicked() } } -/*************************************************************************************************/ -void MainWindow::on_btn_emulBrowse_clicked() -{ - auto name = ui->btn_emulBrowse->text(); - - QFileDialog fileDialog; - fileDialog.setNameFilters({"*.bin"}); - auto result = fileDialog.exec(); - - if(result) - { - _emulFolder = fileDialog.selectedFiles()[0]; - } - - if(name == "Emulator Browse") - { - QtConcurrent::run(this, &MainWindow::fillRam, _emulFolder); - } -} - /*************************************************************************************************/ void MainWindow::on_btn_emulator_clicked() { @@ -1315,15 +873,24 @@ void MainWindow::on_btn_emulator_clicked() { if(name == "Emulator Start") { + QString emulPath = QFileDialog::getOpenFileName(this, tr("emulator"), _emulFolder, "*.bin"); + if (emulPath.isEmpty() || emulPath.isNull()) + { + throw SonoException("No file is selected."); + } + ui->btn_emulator->setText("Filling RAM..."); + ui->btn_emulator->repaint(); + _trx.fillRam(emulPath); + ui->btn_emulator->setText("Emulator Stop"); + _emul->transferLength = TRANSFER_LENGTH; _emul->ramBufAddress = RAM_BUFFER_OFFSET; _emul->transferRate = TRANSFER_RATE; _emul->emulOption = performance; _emul->emulMode = dynamically; _trx.emulatorInit(_emul); - ui->btn_emulator->setText("Emulator Stop"); ui->btn_scenStart->setText("Scenario Start"); - ui->btn_dmaLogLast->setVisible(true); + dmaLogLayoutVisible(true); _trx.emulatorStart(); _dmaLog = true; _dmaRun = true; @@ -1332,7 +899,7 @@ void MainWindow::on_btn_emulator_clicked() else { ui->btn_emulator->setText("Emulator Start"); - ui->btn_dmaLogLast->setHidden(true); + dmaLogLayoutVisible(false); _dmaLog = false; _dmaRun = false; _trx.emulatorStop(); @@ -1345,26 +912,10 @@ void MainWindow::on_btn_emulator_clicked() } /*************************************************************************************************/ -void MainWindow::on_btn_logBrowse_clicked() -{ - QFileDialog dialog; - dialog.setFileMode(QFileDialog::Directory); - dialog.setOption(QFileDialog::ShowDirsOnly); - auto result = dialog.exec(); - - if(result) - { - _logFolder = dialog.selectedFiles()[0]; - } -} - -/*************************************************************************************************/ -void MainWindow::logPcie() +void MainWindow::logPcie(QString logPath, quint32 logCount) { try { - ui->btn_dmaLogLast->setText("Logging..."); - _dmaLogCount = 0; quint32 i(0); @@ -1387,7 +938,7 @@ void MainWindow::logPcie() _mutex.unlock(); _dmaLogCount += 1; - if(_dmaLogCount == ULTIMATE_LOG_COUNT) + if(_dmaLogCount == logCount) { _dmaLog = false; } @@ -1396,18 +947,20 @@ void MainWindow::logPcie() (((static_cast(temp[129])) << 8) & 0xFF00); quint8 subBatchId = (static_cast(temp[130])); - QString path = _logFolder + + QString path = logPath + QString("/batch(%2)_sbatch(%3)_%1.bin").arg(i++).arg(batchId).arg( subBatchId); QFile file(path); - file.open(QIODevice::WriteOnly); + if(!file.open(QIODevice::WriteOnly)) + { + throw SonoException("Couldn't save DMA log file for frame logging"); + } file.write(temp); file.close(); - emit sendLogCount(_dmaLogCount, progress); + emit sendLogCount(_dmaLogCount, logCount, progress); } - ui->btn_dmaLogLast->setText("InstantLog"); delete progress; } @@ -1419,12 +972,71 @@ void MainWindow::logPcie() /*************************************************************************************************/ void MainWindow::on_btn_dmaLogLast_clicked() +{ + if(_dmaRun) + { try + { + auto dmaLogCnt = ui->tb_dmaLogCount->text().toUInt(Q_NULLPTR, 10); + if(dmaLogCnt == 0 && ui->tb_biteLogCount->text() != "0") + { + MESSAGE_BOX("Invalid input format for DMA log count"); + return; + } + QString dmaLogPath = QFileDialog::getExistingDirectory(this, tr("Dma Log"), _dmaLogFolder, QFileDialog::ShowDirsOnly); + QFile dmaLogFile(dmaLogPath); + if(dmaLogFile.fileName().isEmpty()) + { + throw SonoException("No file is selected"); + } + + QString str = "doing"; + QColor color = Qt::red; + emit labelState(ui->l_dmaLogDone, str, color); + + _dmaBuffer.clear(); + _dmaLog = true; + QFuture dmaLogFuture = QtConcurrent::run(this, &MainWindow::logPcie, dmaLogPath, dmaLogCnt); + dmaLogWatcher.setFuture(dmaLogFuture); + } + catch(SonoException& e) + { + qDebug() << e.what(); + } + } +} + +/*************************************************************************************************/ +void MainWindow::dmaLogThreadFinished() { - if(_dmaRun && (ui->btn_dmaLogLast->text() == "InstantLog")) + QString str = "done"; + QColor color = Qt::green; + emit labelState(ui->l_dmaLogDone, str, color); +} + +/*************************************************************************************************/ +void MainWindow::dmaLogLayoutVisible(bool show) +{ + QList widgets {ui->btn_dmaLogLast, + ui->tb_dmaLogCount, + ui->l_dmaLogDone, + ui->l_logCount, + ui->l_logging + }; + if (show) { - _dmaBuffer.clear(); - _dmaLog = true; - QtConcurrent::run(this, &MainWindow::logPcie); + foreach (auto& w, widgets) + { + w->setVisible(true); + w->repaint(); + } + } + else + { + foreach (auto& w, widgets) + { + w->setHidden(true); + w->repaint(); + } } } @@ -1614,17 +1226,17 @@ void MainWindow::show2d() } /*************************************************************************************************/ -void MainWindow::catchLogCount(qint32 counter, QProgressDialog* _progress) +void MainWindow::catchLogCount(quint32 counter, quint32 logRange, QProgressDialog* _progress) { _progress->setMinimumSize(300, 100); _progress->setLabelText("Please wait..."); _progress->setWindowTitle("Frame Packets Logging"); - _progress->setRange(0, ULTIMATE_LOG_COUNT); + _progress->setRange(0, static_cast(logRange)); _progress->setModal(true); try { - _progress->setValue(counter); + _progress->setValue(static_cast(counter)); if(_progress->wasCanceled()) { throw SonoException("Frame Packets Logging is canceled"); @@ -2042,325 +1654,6 @@ void MainWindow::on_btn_updateRdbackValue_clicked() delay(10); } -//void MainWindow::on_chk_usrMulDac_stateChanged(int arg1) -//{ -//auto bar = 0; -//auto offset = 0x86018; -//auto value = _usd->readWord(offset, bar); -//if (!ui->chk_usrMulDac->isChecked()) -//_usd->writeWord(offset, bar, value&0xFFF); -//} - -//void MainWindow::on_btn_afeProg_clicked() -//{ -//auto bar = 0; -//uint32_t offsetWr[3] = {0x10F0DA*4,0x20F0DA*4,0x30F0DA*4}; -//uint32_t offsetRd[3] = {0x10F0DE*4,0x20F0DE*4,0x30F0DE*4}; - -//for (auto i=0 ; i<3;i++) -//{ -//_usd->writeWord(offsetWr[i], bar, 0xF0); -//_usd->writeWord(offsetWr[i], bar, 0x0F); -//} -//qDebug() << "--- AFE Registers --- "; -//for (int i=0 ; i<3;i++) -//{ -//auto value = _usd->readWord(offsetRd[i], bar); -//qDebug() << QString::number(offsetRd[i], 16) << QString::number(value, 16); -//} -//qDebug() << "--- ------------- --- "; -//} - -//void MainWindow::on_btn_gtReg_clicked() -//{ -//auto result = "OK"; -//auto bar = 0; -//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}; -//qDebug() << "--- GT Status Registers --- "; -//for (auto i=0 ; i<20;i++) -//{ -//auto value = _usd->readWord(offsetRd[i], bar); -//if (value == correctVal[i]) -//result = "OK"; -//else -//result = "NOK"; -//qDebug() << QString::number(offsetRd[i]/4, 16) << QString::number(value, 16) << result; -//} -//qDebug() << "--- ------------------- --- "; -//} - -//void MainWindow::on_btn_browse_clicked() -//{ -//QFileDialog dialog; -//dialog.setFileMode(QFileDialog::Directory); -//dialog.setOption(QFileDialog::ShowDirsOnly); -//auto result = dialog.exec(); - -//if(result) -//{ -////_adcloggerFolder = dialog.selectedFiles()[0]; - -//ui->tb_adcLoggerPath->setText(dialog.selectedFiles()[0]); -//} -//} - -//void MainWindow::on_btn_dbgTransferStrt_clicked() -//{ -//ui->btn_dbgTransferStrt->setText("Trans..."); -//auto path = ui->tb_adcLoggerPath->text(); - -//QFutureWatcher watcher; -//connect(&watcher, &QFutureWatcher::finished, this, &MainWindow::threadFinished); -//auto future = QtConcurrent::run(this, &MainWindow::AdcLogCsvFileWriter, path, -//ui->prg_adcLoggerFileWr); -//watcher.setFuture(future); -//_dial->exec(); -//disconnect(&watcher, &QFutureWatcher::finished, this, &MainWindow::threadFinished); -//ui->btn_dbgTransferStrt->setText(START); -//} - -//void MainWindow::on_btn_adcLoggerStrt_clicked() -//{ -//ui->btn_adcLoggerStrt->setText("Log..."); -//uint32_t bar = 0; -//uint32_t offsetTrnsfrCmdLen[3] = {0x140001*4,0x240001*4,0x340001*4}; - -//qDebug() << "--- ADC Logger Start --- "; - -//auto temp = ui->tb_dbgSmplCnt->text().toUInt(Q_NULLPTR, 16); -//for (auto i=0 ; i<3;i++) -//{ -//_usd->writeWord(offsetTrnsfrCmdLen[i], bar, 0x1); //reset Logger -//_usd->writeWord(offsetTrnsfrCmdLen[i], bar, 0x0); //reset done - -//auto value = temp<<8; -//value |= 0x4; -//_usd->writeWord(offsetTrnsfrCmdLen[i], bar, value); // Start ADC Logger and set Counter -//} -//QtConcurrent::run(this, &MainWindow::adcLoggerStatusCheck); -//} - -//void MainWindow::on_prg_adcLoggerFileWr_valueChanged(int value) -//{ - -//} - -//void MainWindow::adcLoggerStatusCheck() -//{ -//uint32_t offsetTrnsStatus[3] = {0x14000A*4,0x24000A*4,0x34000A*4}; -//uint32_t offsetTrnsfrCmdLen[3] = {0x140001*4,0x240001*4,0x340001*4}; -//_adcLoggerDone = false; -//auto timeOut = 0; -//auto doneFlag = 0; -//while (timeOut < 1000 && doneFlag < 3 ) -//{ -//for (auto i=0 ; i<3;i++) -//{ -//doneFlag += (_usd->readWord(offsetTrnsStatus[i], 0) & 0X1); -//} -//timeOut += 1; -//delay(10); -//} -//for (auto i=0 ; i<3;i++) -//{ -//auto value = _usd->readWord(offsetTrnsfrCmdLen[i], 0); -//value &= 0xFFFFFFF0; -//_usd->writeWord(offsetTrnsfrCmdLen[i], 0, value); -//} - -//ui->btn_adcLoggerStrt->setText(START); -//_adcLoggerDone = true; -//if(timeOut == 1000) -//{ -//MESSAGE_BOX("Logger incomplete"); -//return; -//} -//else -//qDebug() << "--- ADC Logger done --- "; -//} - -//void MainWindow::on_btn_adcSimBrowse_clicked() -//{ -//QFileDialog fileDialog; -//fileDialog.setNameFilters({"ADC Sim Scenario file (*.bin)"}); -//auto result = fileDialog.exec(); - -//if(result) -//{ -//auto selectedPath = fileDialog.selectedFiles()[0]; -//ui->tb_adcSimPath->setText(selectedPath); -//_settings->setValue(ADC_SIM_FILE_PATH, selectedPath); -//} -//} - -//void MainWindow::on_btn_adcSimStart_clicked() -//{ -//auto bar = 0; -////auto offset = 0; -//uint32_t offsetDbgCmd[3] = {0x140000*4,0x240000*4,0x340000*4}; -//uint32_t offsetSlvScenCmd[3] = {0x134000*4,0x234000*4,0x334000*4}; -//auto startIndex = ui->tb_adcSimStartIndex->text().toUInt(Q_NULLPTR, 16); -//if(startIndex == 0 && ui->tb_adcSimStartIndex->text() != "0") -//{ -//MESSAGE_BOX("Invalid input format for start index"); -//return; -//} - -//auto stopIndex = ui->tb_adcSimStopIndex->text().toUInt(Q_NULLPTR, 16); -//if(stopIndex == 0 && ui->tb_adcSimStopIndex->text() != "0") -//{ -//MESSAGE_BOX("Invalid input format for stop index"); -//return; -//} - -//if((stopIndex < startIndex) || (stopIndex>131071) || (startIndex>131071)) -//{ -//MESSAGE_BOX("Stop index should be greater than or equal to start index"); -//return; -//} - -//_usd->writeWord(0x804, bar, startIndex); -//_usd->writeWord(0x808, bar, stopIndex); -//auto value = 0; -//auto str = ui->btn_adcSimStart->text(); -//if(str == START) -//{ -//qDebug() << "--- SET GT Send Mode :: BF --- "; -//_usd->writeWord(0x10, 0, 0x1); -//_csvReadStopFlag = false; -//ui->btn_adcSimStart->setText(STOP); -//for (auto i=0 ; i<3;i++) -//{ -//value = _usd->readWord(offsetDbgCmd[i], 0); -//value |= 0x1; -//_usd->writeWord(offsetDbgCmd[i], 0, value); -//} - -//delay(100); -//for (auto i=0 ; i<3;i++) -//{ -//value = _usd->readWord(offsetSlvScenCmd[i], bar); -//_usd->writeWord(offsetSlvScenCmd[i], bar, value | 0x2); -//} -//auto path = ui->tb_adcSimPath->text(); -//auto future = QtConcurrent::run(this, &MainWindow::binAdcFileUploader, 0, path , ui->prg_adcSim); -//} -//else -//{ -//_csvReadStopFlag = true; -//ui->btn_adcSimStart->setText(START); -//_usd->writeWord(0x800, bar, 0); - -//for (auto i=0 ; i<3;i++) -//{ -//auto value = _usd->readWord(offsetDbgCmd[i], 0); -//value &= 0xFFFFFFF0; -//_usd->writeWord(offsetDbgCmd[i], 0, value); -//} -//delay(100); -//for (auto i=0 ; i<3;i++) -//{ -//value = _usd->readWord(offsetSlvScenCmd[i], bar); -//_usd->writeWord(offsetSlvScenCmd[i], bar, value & 0x1); -//} - -////scenarioStop(); -//} - -//} - -//void MainWindow::on_btn_adcLoggerAutoCount_clicked() -//{ -//uint32_t bar = 0; -//uint32_t offsetTrnsfrCmdLen[3] = {0x140001*4,0x240001*4,0x340001*4}; - -//auto logCount = ui->tb_dbgAutoLogCount->text().toUInt(); -//if(logCount == 0 && ui->tb_dbgAutoLogCount->text() != "0") -//{ -//MESSAGE_BOX("Invalid input format for logCount"); -//return; -//} - -//ui->btn_adcLoggerAutoCount->setText("Log..."); -//uint32_t offsetAfePwrDn[3] = {0x10F0C5*4,0x20F0C5*4,0x30F0C5*4}; -//uint32_t offsetAfeLpf[3] = {0x10F0C4*4,0x20F0C4*4,0x30F0C4*4}; - -//for (auto i=0 ; i<3;i++) -//{ -//_usd->writeWord(offsetAfePwrDn[i], bar, 0x0); -//_usd->writeWord(offsetAfeLpf[i], bar, 0x0100); -//} -//qDebug() << "--- AFE Registers --- "; -//delay(1); - -//for (auto j = 0 ; j < logCount ; j++) -//{ - -//qDebug() << "--- ADC Auto Logger Start --- "; -//for (auto i=0 ; i<3;i++) -//{ -//_usd->writeWord(offsetTrnsfrCmdLen[i], bar, 0x1); //reset Logger -//_usd->writeWord(offsetTrnsfrCmdLen[i], bar, 0x0); //reset done - -//auto value = 1<<8; -//value |= 0x4; -//_usd->writeWord(offsetTrnsfrCmdLen[i], bar, value); // Start ADC Logger and set Counter - -//value |= 0x8; -//_usd->writeWord(offsetTrnsfrCmdLen[i], bar, value); // Set Manual Trig - -//value &= 0xF7; -//_usd->writeWord(offsetTrnsfrCmdLen[i], bar, value); // Set Manual Trig - -//} -//QtConcurrent::run(this, &MainWindow::adcLoggerStatusCheck); -//delay(10); -//while (!_adcLoggerDone); - -//auto path = ui->tb_adcLoggerPath->text(); - -//QFutureWatcher watcher; -//connect(&watcher, &QFutureWatcher::finished, this, &MainWindow::threadFinished); -//auto future = QtConcurrent::run(this, &MainWindow::AdcLogCsvFileWriter, path, -//ui->prg_adcLoggerFileWr); -//watcher.setFuture(future); -//_dial->exec(); -//disconnect(&watcher, &QFutureWatcher::finished, this, &MainWindow::threadFinished); -//ui->btn_dbgTransferStrt->setText(START); - -//delay(10); -//while (!_adcLoggerTrnsDone); -//} -//ui->btn_adcLoggerAutoCount->setText(START); - -//for (auto i=0 ; i<3;i++) -//{ -//_usd->writeWord(offsetAfePwrDn[i], bar, 0x8000); -//} -//qDebug() << "--- AFE Registers Power Down --- "; -//} - -//void MainWindow::on_btn_scenRead_clicked() -//{ -//auto paramPath = ui->tb_paramFile->text(); -//auto paramBar = 0; -//auto boardParamPath = "/home/hasis/Desktop/TrxBoardFile/_log/readBack.csv"; -//QtConcurrent::run(this, &MainWindow::CsvFileChecker,paramBar, paramPath , boardParamPath , -//ui->prg_scenarioUpload); - -//} - /*************************************************************************************************/ QString MainWindow::releaseCodeVersion(quint32& value) { @@ -2398,61 +1691,6 @@ void MainWindow::on_btn_getFpgaVersion_clicked() ui->l_slave2Version->setText(releaseCodeVersion(value)); } -/*************************************************************************************************/ -//void MainWindow::on_btn_txTrig_clicked() -//{ - -//auto bar = 0; -//uint32_t offsetAfeAdc2[3] = {0x10F002*4,0x20F002*4,0x30F002*4}; - -//// qDebug() << "--- SET AFE Ramp Count Mode --- "; -//// for (auto i=0 ; i<3;i++) -//// { -//// _usd->writeWord(offsetAfeAdc2[i], bar, 0x1380); -//// } -//delay(20); - -//uint32_t offsetAfePwrDn[3] = {0x10F0C5*4,0x20F0C5*4,0x30F0C5*4}; -////uint32_t offsetAfeLpf[3] = {0x10F0C4*4,0x20F0C4*4,0x30F0C4*4}; - -//qDebug() << "--- SET AFE Power On Mode --- "; -//for (auto i=0 ; i<3;i++) -//{ -//_usd->writeWord(offsetAfePwrDn[i], bar, 0x0); -////_usd->writeWord(offsetAfeLpf[i], bar, 0x0100); -//} -//delay(100); - -//qDebug() << "--- Set TX Trig --- "; - -//auto offset = 0x5*4; -//auto value = 0x1; -//_usd->writeWord(offset,bar,value); -//value = 0x5; -//_usd->writeWord(offset,bar,value); -//value = 0x1; -//_usd->writeWord(offset,bar,value); -//delay(100); -//value = 0x0; -//_usd->writeWord(offset,bar,value); -//qDebug() << "--- TX Trig Done--- "; - -//delay(10); -//// qDebug() << "--- SET AFE Normal Mode --- "; -//// for (auto i=0 ; i<3;i++) -//// { -//// _usd->writeWord(offsetAfeAdc2[i], bar, 0x1000); -//// } -//qDebug() << "--- SET AFE Power On Mode --- "; -//for (auto i=0 ; i<3;i++) -//{ -//_usd->writeWord(offsetAfePwrDn[i], bar, 0x8000); -////_usd->writeWord(offsetAfeLpf[i], bar, 0x0100); -//} -//delay(1); -//delay(20); - -//} /*************************************************************************************************/ /************************************* Scenario Setting ******************************************/ /*************************************************************************************************/ @@ -2616,6 +1854,7 @@ void MainWindow::on_btn_scenInfo_clicked() QTextStream checkParam(&sysFile); QString systemStr = checkParam.readAll(); ui->tb_scenInfo->setPlainText(systemStr); + sysFile.close(); } /*************************************************************************************************/ @@ -3161,6 +2400,101 @@ void MainWindow::setAfeConfig() _afeConfig.inputClampLevel = inputClampLvlAuto; } +/*************************************************************************************************/ +/*************************************** Built-in Test *******************************************/ +/*************************************************************************************************/ +void MainWindow::on_btn_biteBrowse_clicked() +{ + QFileDialog fileDialog; + fileDialog.setNameFilter("*.csv"); + auto result = fileDialog.exec(); + + if(result) + { + auto selectedPath = fileDialog.selectedFiles()[0]; + ui->tb_biteFilesPath->setText(selectedPath); + _settings->setValue(BITE_FILE_PATH, selectedPath); + } +} + +/*************************************************************************************************/ +void MainWindow::on_btn_setBiteLog_clicked() +{ + try + { + auto scenStr = ui->btn_scenStart->text(); + if(scenStr == "Scenario Stop") + on_btn_scenStart_clicked(); + + // BITe log count registering + auto biteLogCnt = ui->tb_biteLogCount->text().toUInt(Q_NULLPTR, 10); + if(biteLogCnt == 0 && ui->tb_biteLogCount->text() != "0") + { + MESSAGE_BOX("Invalid input format for BITe log count"); + return; + } + + // BITe file reading to determine the I & Q of txDAC + QString bitePath = ui->tb_biteFilesPath->text(); + QFile biteFile(bitePath); + QTextStream biteLog(&biteFile); + if(biteFile.fileName().isEmpty()) + { + throw SonoException("No file is selected"); + } + + if(!biteFile.open(QIODevice::ReadOnly)) + { + throw SonoException("Couldn't open built-in test file for frame logging"); + } + + QStringList txDac; + QByteArray I; + QByteArray Q; + while (!biteLog.atEnd()) + { + txDac.clear(); + txDac = biteLog.readLine().split(","); + I.append(static_cast(txDac.at(0).toInt())); + Q.append(static_cast(txDac.at(1).toInt())); + } + _trx.setBiteDacData(I , Q); + biteFile.close(); + + // BITe log file writing after scen player start and getting the frame packet + QString biteLogPath = QFileDialog::getExistingDirectory(this, tr("BITe Log"), _biteLogFolder, QFileDialog::ShowDirsOnly); + QFile biteLogFile(biteLogPath); + if(biteLogFile.fileName().isEmpty()) + { + throw SonoException("No file is selected"); + } + + QString str = "doing"; + QColor color = Qt::red; + emit labelState(ui->l_biteLogDone, str, color); + + _dmaBuffer.clear(); + _dmaLog = true; + _trx.biteScenPlayerStart(); + QFuture biteLogFuture = QtConcurrent::run(this, &MainWindow::logPcie, biteLogPath, biteLogCnt); + biteLogWatcher.setFuture(biteLogFuture); + } + catch(SonoException& e) + { + qDebug() << e.what(); + } + +} + +/*************************************************************************************************/ +void MainWindow::biteLogThreadFinished() +{ + _trx.biteScenPlayerStop(); + QString str = "done"; + QColor color = Qt::green; + emit labelState(ui->l_biteLogDone, str, color); +} + /*************************************************************************************************/ void MainWindow::exitApp() { @@ -3169,3 +2503,41 @@ void MainWindow::exitApp() on_btn_scenStart_clicked(); this->QWidget::close(); } + +/*************************************************************************************************/ +/*************************************** Capture_Logger ******************************************/ +/*************************************************************************************************/ +void MainWindow::on_btn_setAdcLog_clicked() +{ + // ADC log count registering + auto adcLogCnt = ui->tb_adcLogCount->text().toUInt(); + if(adcLogCnt == 0 && ui->tb_adcLogCount->text() != "0") + { + MESSAGE_BOX("Invalid input format for ADC logger count"); + return; + } + + // Sample count registering + auto sampleCnt = ui->tb_sampleCount->text().toUInt(); + if(sampleCnt == 0 && ui->tb_sampleCount->text() != "0") + sampleCnt = 0; + + // sync count registering + auto syncCnt = ui->tb_syncCount->text().toUInt(); + if(syncCnt == 0 && ui->tb_syncCount->text() != "0") + syncCnt = 0; + + // ADC capture start configuration + eSyncMode syncMode; + + captureConfig capConfig; + capConfig.capMode = allChannel; + capConfig.manualTrig = false; + capConfig.syncCount = syncCnt; + capConfig.sampleCount = sampleCnt; + + _trx.adcCaptureStart(capConfig, syncMode); + + + +} diff --git a/mainwindow.h b/mainwindow.h index 1a02a04..0815a01 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -30,12 +30,13 @@ #define MESSAGE_BOX(M) \ emit showMessage(M) -#define SCENARIO_FILE_PATH "scenarioFilePath" -#define ADC_SIM_FILE_PATH "adcSimFilePath" -#define PARAM_FILE_PATH "paramFilePath" -#define TX_DAC_FILE_PATH "txDacFilePath" -#define FPGA_FILE_PATH "fpgaFilePath" -#define REG_ACCESS_SEL "regAccessType" +#define SCENARIO_FILE_PATH "scenarioFilePath" +#define BITE_FILE_PATH "biteFilePath" +#define ADC_SIM_FILE_PATH "adcSimFilePath" +#define PARAM_FILE_PATH "paramFilePath" +#define TX_DAC_FILE_PATH "txDacFilePath" +#define FPGA_FILE_PATH "fpgaFilePath" +#define REG_ACCESS_SEL "regAccessType" #define START "Start" @@ -62,8 +63,6 @@ #define TRANSFER_RATE 30.0f #define RAM_BUFFER_OFFSET 0U -#define ULTIMATE_LOG_COUNT 50 - QT_BEGIN_NAMESPACE namespace Ui { class MainWindow; } QT_END_NAMESPACE @@ -94,6 +93,10 @@ private: QCPColorMap *_colorMap; + QFutureWatcher biteLogWatcher; + + QFutureWatcher dmaLogWatcher; + static QThread* _uiThread; QTimer* _timeout; @@ -132,9 +135,7 @@ private: void setAfeConfig (void); - void fillRam(QString path); - - void logPcie(); + void logPcie(QString logPath, quint32 logCount); void continuousFrameRepresent(void); @@ -150,12 +151,19 @@ private: void gifActive(void); - QString _logFolder = "/home/hasis/Desktop/TrxBoardFile/_log/dma/"; - QString _emulFolder = "/home/hasis/Desktop/Develop_HardwareTest/developHw/sram_frame.bin"; + void biteLogThreadFinished(); + + void dmaLogThreadFinished(); + + void dmaLogLayoutVisible(bool show); + + QString _biteLogFolder = "/home/hasis/Desktop/TrxBoardFile/_log/BITe/"; + QString _dmaLogFolder = "/home/hasis/Desktop/TrxBoardFile/_log/dma/"; + QString _emulFolder = "/home/hasis/Desktop/TrxBoardFile/emulator/"; QVector _dmaBuffer; QByteArray _lastBuffer; - qint32 _dmaLogCount; + quint32 _dmaLogCount; quint16 _frameCount; quint16 _batchIdBuff; double_t fps; @@ -166,10 +174,6 @@ private: bool _getPacket; bool _fpsFlag; - // QString _adcloggerFolder = "/home/hasis/Desktop/TrxBoardFile/_log/adc/"; - // bool _csvReadStopFlag = false; - // bool _adcLoggerDone = false; - // bool _adcLoggerTrnsDone = false; // uncrustify off private slots: @@ -203,109 +207,22 @@ private slots: void on_btn_writeReg_clicked(); - // void newBlockProgressValue(int percentage, QProgressBar* prg); - // void newFpgaProgressValue(int percentage); - - // void newBlockProgressVisibility(bool show, QProgressBar* prg); - - // void newFpgaProgressVisibility(bool show); - - void on_btn_fpgaBrowse_clicked(); void on_btn_fpgaProgram_clicked(); void newMessage(QString message); -// void on_btn_scenarioBrowse_clicked(); - -// void on_btn_scenarioVerify_clicked(); - -// void on_btn_ParamBrowse_clicked(); - -// void on_btn_scenarioUpload_clicked(); - -// void on_btn_scenarioStartStop_clicked(); - -// void on_btn_scenarioPauseResume_clicked(); - -// void on_btn_txDacBrowse_clicked(); - -// void on_btn_txDacUpload_clicked(); - -// void on_btn_txDacStartStop_clicked(); - -// void on_btn_txDacOnOff_clicked(); - void on_cb_selectedProbe_currentIndexChanged(int index); -// void on_btn_pllClkSt_clicked(); - -// void on_btn_pllClkTps_clicked(); - -// void on_btn_mulDacTrig_clicked(); - -// void on_pushButton_3_clicked(); - -// void on_btn_hvRegulatorConfig_clicked(); - -// void on_btn_pm5RegulatorConfig_clicked(); - -// void on_btn_DacsOnOff_clicked(); - void on_btn_updateRdbackValue_clicked(); void on_btn_supJump_clicked(); void on_btn_setAo_clicked(); -// void on_chk_usrMulDac_stateChanged(int arg1); - -// void on_btn_afeProg_clicked(); - -// void on_btn_gtReg_clicked(); - -// void on_btn_browse_clicked(); - -// void on_btn_dbgTransferStrt_clicked(); - -// void on_btn_adcLoggerStrt_clicked(); - -// void on_prg_adcLoggerFileWr_valueChanged(int value); - -// void on_btn_adcSimBrowse_clicked(); - -// void on_btn_adcSimStart_clicked(); - -// void on_btn_adcLoggerAutoCount_clicked(); - -// void on_btn_scenRead_clicked(); - void on_btn_getFpgaVersion_clicked(); -// void on_btn_txTrig_clicked(); - -// void adcLoggerStatusCheck(); - -// void binFileUploader(quint32 bar, quint32 offset, QString path, QProgressBar* prg); -// void binAdcFileUploader(quint32 bar, QString path, QProgressBar* prg); -// void CsvFileUploader(quint32 bar, QString path, QProgressBar *prg); -// void CsvFileChecker(quint32 bar, QString pathBase, QString pathTarget, QProgressBar* prg); -// void AdcLogCsvFileWriter(QString folderPath, QProgressBar* prg); -// void scenarioFileVerifier(quint32 bar, quint32 offset, QString path); -// -// quint64 byteArrayTo64LittleEndian(QByteArray data); -// quint32 byteArrayTo32LittleEndian(QByteArray data); -// quint32 byteArrayTo32BigEndian(QByteArray data); - -// - -// void scenarioStart(); -// void scenarioStop(); - -// bool checkTermalShutdown(quint8 value); - - void on_btn_setAtgcMode_clicked(); void on_btn_scenStart_clicked(); @@ -314,10 +231,6 @@ private slots: void on_btn_dmaShow_clicked(); - void on_btn_emulBrowse_clicked(); - - void on_btn_logBrowse_clicked(); - void on_btn_dmaLogLast_clicked(); void on_btn_afeRead_clicked(); @@ -328,7 +241,7 @@ private slots: void show2d(); - void catchLogCount(qint32 counter, QProgressDialog* _progress); + void catchLogCount(quint32 counter, quint32 logRange, QProgressDialog* _progress); void on_chk_mpsInit_clicked(); @@ -370,17 +283,17 @@ private slots: void on_btn_scenInfo_clicked(); -signals: -// void updateBlockProgressValue(int percentage, QProgressBar* prg); -// void updateFpgaProgressValue(int percentage); + void on_btn_setBiteLog_clicked(); + + void on_btn_biteBrowse_clicked(); -// void updateBlockProgressVisibility(bool show, QProgressBar* prg); -// void updateFpgaProgressVisibility(bool show); + void on_btn_setAdcLog_clicked(); +signals: void showMessage(QString message); void threeDReady(); void twoDReady(); - void sendLogCount(qint32 counter, QProgressDialog* _progress); + void sendLogCount(quint32 counter, quint32 logRange, QProgressDialog* _progress); void connectedPrbChange(); void frameLostCall(); void labelState(QLabel* label, QString str, QColor color); diff --git a/mainwindow.ui b/mainwindow.ui index b1d371f..f38d12b 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -39,7 +39,7 @@ - 4 + 5 @@ -74,9 +74,9 @@ - 50 + 75 true - false + true false false @@ -93,6 +93,15 @@ 80 + + + 50 + true + false + false + false + + Access registers by: @@ -105,6 +114,15 @@ 23 + + + 50 + true + false + false + false + + Register offset @@ -118,6 +136,15 @@ 23 + + + 50 + true + false + false + false + + Register number @@ -135,6 +162,15 @@ + + + 50 + true + false + false + false + + Transaction width: @@ -142,6 +178,15 @@ + + + 50 + true + false + false + false + + 32 @@ -173,6 +218,15 @@ + + + 50 + true + false + false + false + + : @@ -194,10 +248,29 @@ - + + + + 50 + true + false + false + false + + + + + + 50 + true + false + false + false + + Bar: @@ -205,6 +278,15 @@ + + + 50 + true + false + false + false + + 0 @@ -230,6 +312,15 @@ + + + 50 + true + false + false + false + + Value: (Hex) @@ -248,10 +339,28 @@ 16777215 + + + 50 + true + false + false + false + + + + + 50 + true + false + false + false + + Write @@ -271,6 +380,15 @@ 0 + + + 50 + true + false + false + false + + result: (Hex) @@ -280,6 +398,15 @@ + + + 50 + true + false + false + false + + QFrame::Box @@ -299,6 +426,15 @@ 0 + + + 50 + true + false + false + false + + Read @@ -340,9 +476,9 @@ - 50 + 75 true - false + true false false false @@ -363,16 +499,47 @@ + + + 50 + true + false + false + false + false + + Bit file: - + + + + 50 + true + false + false + false + false + + + + + + 50 + true + false + false + false + false + + Browse... @@ -385,13 +552,23 @@ 10 70 - 138 + 148 19 + + + 50 + true + false + false + false + false + + Programming: @@ -399,6 +576,16 @@ + + + 50 + true + false + false + false + false + + doing @@ -449,15 +636,15 @@ 440 200 - 351 + 361 101 - 50 + 75 true - false + true false false @@ -474,6 +661,15 @@ 15 + + + 50 + true + false + false + false + + Mode: @@ -487,6 +683,15 @@ 23 + + + 50 + true + false + false + false + + Auto @@ -507,6 +712,15 @@ 15 + + + 50 + true + false + false + false + + Value: @@ -520,6 +734,15 @@ 23 + + + 50 + true + false + false + false + + @@ -530,6 +753,15 @@ 23 + + + 50 + true + false + false + false + + Set ATgc @@ -546,9 +778,9 @@ - 50 + 75 true - false + true false false @@ -565,6 +797,15 @@ 23 + + + 50 + true + false + false + false + + <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">Slave FPGA Select</span></p></body></html> @@ -593,6 +834,15 @@ 23 + + + 50 + true + false + false + false + + <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">AFE Register Address (hex)</span></p></body></html> @@ -606,6 +856,15 @@ 23 + + + 50 + true + false + false + false + + Read @@ -619,6 +878,15 @@ 81 + + + 50 + true + false + false + false + + <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">AFE0</span></p><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">AFE1</span></p><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">AFE2</span></p><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">AFE3</span></p></body></html> @@ -635,7 +903,7 @@ 0 10 - 791 + 801 181 @@ -659,9 +927,9 @@ - 50 + 75 true - false + true false false false @@ -675,23 +943,54 @@ 10 30 - 771 + 781 27 + + + 50 + true + false + false + false + false + + Scenario Files Path: - + + + + 50 + true + false + false + false + false + + + + + + 50 + true + false + false + false + false + + Browse... @@ -702,7 +1001,7 @@ - 680 + 690 70 100 52 @@ -730,6 +1029,16 @@ + + + 50 + true + false + false + false + false + + Filling: @@ -737,6 +1046,16 @@ + + + 50 + true + false + false + false + false + + doing @@ -783,6 +1102,16 @@ 15 + + + 50 + true + false + false + false + false + + Sram Bin Creating: @@ -790,6 +1119,16 @@ + + + 50 + true + false + false + false + false + + doing @@ -801,6 +1140,16 @@ + + + 50 + true + false + false + false + false + + Register CSV Comparision: @@ -808,6 +1157,16 @@ + + + 50 + true + false + false + false + false + + doing @@ -819,6 +1178,16 @@ + + + 50 + true + false + false + false + false + + Sram Params Verification: @@ -826,6 +1195,16 @@ + + + 50 + true + false + false + false + false + + doing @@ -851,6 +1230,16 @@ + + + 50 + true + false + false + false + false + + Start Index: (hex) @@ -870,6 +1259,16 @@ 0 + + + 50 + true + false + false + false + false + + @@ -878,13 +1277,34 @@ + + + 50 + true + false + false + false + false + + End Index: (hex) - + + + + 50 + true + false + false + false + false + + + @@ -898,6 +1318,16 @@ 0 + + + 50 + true + false + false + false + false + + Set Index @@ -942,58 +1372,11 @@ Frame - - - - 670 - 90 - 101 - 25 - - - - - 50 - true - false - false - false - - - - InstantLog - - - - - - 670 - 190 - 96 - 21 - - - - - 50 - true - false - false - false - - - - <html><head/><body><p><span style=" font-size:8pt; font-weight:600; font-style:italic;">3D as default</span></p></body></html> - - - 2D Activate - - 670 - 220 + 270 112 23 @@ -1011,12 +1394,18 @@ 281 + + + 50 + false + + 670 - 10 + 30 110 23 @@ -1029,8 +1418,8 @@ 670 - 50 - 101 + 60 + 111 25 @@ -1047,73 +1436,188 @@ Show - - - - 670 - 130 - 101 - 25 - - - - - 50 - true - false - false - false - - - - Log Browse - - - + - 670 - 250 - 114 - 23 + 660 + 90 + 131 + 81 - - + + + + + + + + 50 + false + + + + Log Count: + + + + + + + + 50 + false + + + + + + + + + + + 50 + true + false + false + false + + + + Frame Log + + + + + + + + + + 50 + true + false + false + false + false + + + + Logging: + + + + + + + + 50 + true + false + false + false + false + + + + doing + + + + + + + + + + + 670 + 210 + 109 + 50 + + + + + + + + 50 + true + false + false + false + + + + <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">Continuous Frame Represent</span></p></body></html> + + + Continuously + + + + + + + + 50 + true + false + false + false + + + + <html><head/><body><p><span style=" font-size:8pt; font-weight:600; font-style:italic;">3D as default</span></p></body></html> + + + 2D Activate + + + + + + + + + 690 + 180 + 61 + 16 + + + + 50 - true false - false - false + + <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">Frame per second</span></p></body></html> + - Emulator Browse + FPS - + 670 - 170 - 104 + 0 + 128 21 50 - true false - false - false - - <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">Continuous Frame Represent</span></p></body></html> - - Continuously + Header Log En @@ -1346,44 +1850,438 @@ - MPS + MPS + + + + + 0 + 20 + 151 + 61 + + + + + + + + + + false + + + + + + + + + + + + Read ID + + + + + + + Write ID + + + + + + + + + + + 160 + 20 + 221 + 61 + + + + + + + + + Read Info + + + + + + + Write Info + + + + + + + + + + 0 + 0 + + + + + 100 + 49 + + + + false + + + + + + + + + + 10 + 90 + 381 + 81 + + + + Probe Control + + + + + 0 + 20 + 151 + 61 + + + + + + + + + + false + + + + + + + + + + + + Read ID + + + + + + + Write ID + + + + + + + + + + + 160 + 20 + 221 + 61 + + + + + + + + + Read Info + + + + + + + Write Info + + + + + + + + + + 0 + 0 + + + + + 100 + 49 + + + + false + + + + + + + + + + Debug + + + + + 0 + 9 + 801 + 131 + + + + Built-in Test + + + + + 10 + 30 + 781 + 27 + + + + + + + + 50 + true + false + false + false + false + + + + BITe File Path: + + + + + + + + 50 + true + false + false + false + false + + + + + + + + + 50 + true + false + false + false + false + + + + Browse... + + + + + + + + + 10 + 70 + 171 + 31 + + + + + + + + 50 + false + + + + BITe Log Count: + + + + + + + + 50 + false + + + + + + + + + + 660 + 70 + 131 + 51 + + + + + + + BITe Log + + + + + + + + + + 50 + true + false + false + false + false + + + + BITe Logging: + + + + + + + + 50 + true + false + false + false + false + + + + doing + + + + + + + + + + + + -1 + 140 + 801 + 91 + + + + ADC Logger - + - 0 - 20 - 151 - 61 + 660 + 30 + 130 + 51 - + - + - - - - false - - - + ADC Log - + - + + + + 50 + true + false + false + false + false + + - Read ID + ADC Logging: - + + + + 50 + true + false + false + false + false + + - Write ID + doing @@ -1391,104 +2289,65 @@ - + - 160 - 20 - 221 - 61 + 10 + 30 + 171 + 58 - + - + - + + + + 50 + false + + - Read Info + Sample Count: - - - Write Info + + + + 50 + false + - - - - 0 - 0 - - - - - 100 - 49 - - - - false - - - - - - - - - - 10 - 90 - 381 - 81 - - - - Probe Control - - - - - 0 - 20 - 151 - 61 - - - - - - - - - - false - - - - - - - - + - + + + + 50 + false + + - Read ID + Sync Count: - - - Write ID + + + + 50 + false + @@ -1496,55 +2355,162 @@ - + - 160 - 20 - 221 - 61 + 480 + 30 + 112 + 21 - + + + 50 + false + + + + Scen ADC Log + + + + + + 190 + 30 + 211 + 56 + + + - + - + + + + 50 + false + + - Read Info + Log Count En - + + + + 50 + false + + - Write Info + AFE Config - - - - 0 - 0 - - - - - 100 - 49 - - - - false - - + + + + + + 50 + false + + + + ADC Log Count: + + + + + + + + 50 + false + + + + + + + + + 480 + 60 + 168 + 21 + + + + + 50 + false + + + + Scen Frame ADC Log + + + + + + + -2 + 240 + 181 + 61 + + + + Pulser Test Mode + + + + + 10 + 30 + 85 + 21 + + + + Enable + + + + + + 90 + 30 + 79 + 23 + + + + <html><head/><body><p><span style=" font-size:7pt;">Pulser Mode</span></p></body></html> + + + + Hz + + + + + T/R + + + @@ -2191,9 +3157,9 @@ - 720 + 710 50 - 91 + 101 109 @@ -2247,22 +3213,6 @@ - - - - 740 - 30 - 61 - 16 - - - - <html><head/><body><p><span style=" font-size:7pt; font-weight:600; font-style:italic;">Frame per second</span></p></body></html> - - - FPS - - @@ -2333,10 +3283,16 @@ 0 20 - 486 + 489 51 + + + 16777215 + 16777215 + + Probe Type @@ -3466,58 +4422,6 @@ Update - - - - 710 - 140 - 88 - 19 - - - - - - - fan1_flt: - - - - - - - Ukn - - - - - - - - - 710 - 170 - 88 - 19 - - - - - - - fan2_flt: - - - - - - - Ukn - - - - - diff --git a/src/model/hardware/core/TrxBoard.cpp b/src/model/hardware/core/TrxBoard.cpp index a3a9bdf..13b5cc1 100644 --- a/src/model/hardware/core/TrxBoard.cpp +++ b/src/model/hardware/core/TrxBoard.cpp @@ -106,10 +106,10 @@ void TrxBoard::afeAdcsSync() const this->_bCtrlMngt->timerShot(20); while(!(this->_bCtrlMngt->checkTimeout())); - this->_misc->setSyncMode(AdcSyncMode); + this->_misc->setSyncMode(adcSyncMode); this->_misc->setManualSync(true); this->_misc->setManualSync(false); - this->_misc->setManualSync(BfSyncMode); + this->_misc->setManualSync(bfSyncMode); this->_bCtrlMngt->timerShot(1); while(!((this->_afeSlave0->getAfeSyncDone()) && @@ -134,6 +134,54 @@ void TrxBoard::afeAdcsSync() const } } +void TrxBoard::adcLogTransferRoutine(Debug *_dbg, quint8 chNumPerFpga) +{ + bool adcSamplerReady (false); + bool adcSamplerError (false); + + // Adc logger start according to selected afe channel + _dbg->adcLoggerTransferCmd(loggerStop); + _dbg->adcLoggerChannelNum(chNumPerFpga); + _dbg->adcLoggerTransferCmd(loggerStart); + + // Timeout to receive adc log transfer done. + this->_bCtrlMngt->timerShot(20); + 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. + this->_bCtrlMngt->timerShot(20); + 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) + throw SonoException("The adc sampler error is occured."); + + // 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 )) + throw ("The debugger mode register configuration of " + slaveN + " is corrupted."); +} + void TrxBoard::setSwapVector() { _swapVec.clear(); @@ -195,13 +243,17 @@ TrxBoard::TrxBoard() : _offsetSlave0(0), _offsetSlave1(0x400000), _offsetSlave2( _beamFormerSlave0 = new BeamFormer(&_device, _offsetSlave0); _beamFormerSlave1 = new BeamFormer(&_device, _offsetSlave1); _beamFormerSlave2 = new BeamFormer(&_device, _offsetSlave2); - _clkDistributer = new ClockDistributer(&_device); + _debugSlave0 = new Debug(&_device, _offsetSlave0); + _debugSlave1 = new Debug(&_device, _offsetSlave1); + _debugSlave2 = new Debug(&_device, _offsetSlave2); + _clkDistributer = new ClockDistributer(&_device); _afeSlave0 = new Afe(&_device, _offsetSlave0); _afeSlave1 = new Afe(&_device, _offsetSlave1); _afeSlave2 = new Afe(&_device, _offsetSlave2); + _bCtrlMngt = new BoardsCtrlMngt(&_device); + _builtInTest = new BuiltInTest(&_device); _fpgaProgram = new FpgaProgram(&_device); _scenPlayer = new ScenPalyer(&_device); - _bCtrlMngt = new BoardsCtrlMngt(&_device); _bpiFlash = new BpiFlash(&_device); _emul = new Emulator(&_device); _misc = new Misc(&_device); @@ -241,9 +293,16 @@ TrxBoard::~TrxBoard() delete _beamFormerSlave0; delete _beamFormerSlave1; delete _beamFormerSlave2; - delete _clkDistributer; - delete _fpgaProgram; - delete _scenPlayer; + delete _clkDistributer; + delete _debugSlave0; + delete _debugSlave1; + delete _debugSlave2; + delete _fpgaProgram; + delete _builtInTest; + delete _scenPlayer; + delete _afeSlave0; + delete _afeSlave1; + delete _afeSlave2; delete _bCtrlMngt; delete _bpiFlash; delete _emul; @@ -345,6 +404,12 @@ void TrxBoard::setProbeDependParams(ScenPrbDepHardwareParam& prbDepParams) } this->_dsp->lpfLut(lpfLutQ); + if(prbDepParams.prbDepParams.lpfScaleCoeff.size() != LPF_SCALE_MAX) + { + throw SonoException("Lpf scale coefficient is out of range"); + } + this->_dsp->lpfScaleCoefficient(prbDepParams.prbDepParams.lpfScaleCoeff); + /////////////////////////// AFE setting /////////////////////////// this->_afeSlave0->setAfeParams(prbDepParams.afeCfg); this->_afeSlave1->setAfeParams(prbDepParams.afeCfg); @@ -728,6 +793,47 @@ void TrxBoard::setFramesMetaData(const QByteArray& metaData) const this->_sram->setSramMetaData(data); } +void TrxBoard::setBiteDacData(const QByteArray &iData, const QByteArray &qData) const +{ + this->_builtInTest->biteDacMemoryWrite(iData, qData); +} + +void TrxBoard::biteScenPlayerStart() +{ + DebugMode debug; + DebugMode debugRb; + debug.rxBfDbgModeEn = false; + debug.rxBfSimDataGenModeEn = false; + debug.txBfTestModeEn = true; + debug.txBfTestModeCfg = pulserTr; + + this->debuggerMode(_debugSlave0, debug, debugRb, "slave0"); + this->debuggerMode(_debugSlave1, debug, debugRb, "slave1"); + this->debuggerMode(_debugSlave2, debug, debugRb, "slave2"); + + this->_builtInTest->biteAdgCfg(adgIQ); + this->_builtInTest->biteDacEnable(BITE_INTERVAL, true); + this->scenPlayerStart(true); +} + +void TrxBoard::biteScenPlayerStop() +{ + DebugMode debug; + DebugMode debugRb; + debug.rxBfDbgModeEn = false; + debug.rxBfSimDataGenModeEn = false; + debug.txBfTestModeEn = false; + debug.txBfTestModeCfg = pulserHz; + + this->scenPlayerStop(true); + this->_builtInTest->biteDacEnable(BITE_INTERVAL, false); + this->_builtInTest->biteAdgCfg(adgGnd); + + this->debuggerMode(_debugSlave0, debug, debugRb, "slave0"); + this->debuggerMode(_debugSlave1, debug, debugRb, "slave1"); + this->debuggerMode(_debugSlave2, debug, debugRb, "slave2"); +} + void TrxBoard::setScenarioCompare(const QString scenPath) { /******************* Create SRAM Binary File *******************/ @@ -939,9 +1045,9 @@ void TrxBoard::scenPlayerStart(bool afeHvPwrOn) this->_beamFormerSlave1->regValid(true); this->_beamFormerSlave2->regValid(true); - this->_misc->setGtSendMode(BfMode); + this->_misc->setGtSendMode(bfMode); - this->_misc->setSyncMode(BfSyncMode); + this->_misc->setSyncMode(bfSyncMode); this->_emul->setEmulatorDis(); @@ -1471,7 +1577,8 @@ void TrxBoard::mcsProgram(QString path) void TrxBoard::mcsVerify(QString path) const { - QFile mcsFile(path); + QList mcsList; + QFile mcsFile(path + ".bin"); if(mcsFile.fileName().isEmpty()) { @@ -1485,12 +1592,11 @@ void TrxBoard::mcsVerify(QString path) const QTextStream save(&mcsFile); - (*_mcsList).clear(); - this->_bpiFlash->readMcs(_mcsList); + this->_bpiFlash->readMcs(&mcsList); for(auto i = 0; i < MCS_FILE_SIZE; i++) { - save << (*_mcsList).at(i); + save << (mcsList).at(i); } mcsFile.flush(); mcsFile.close(); @@ -1517,3 +1623,136 @@ quint32 TrxBoard::getFrameLostCounter() const { return (this->_misc->getFrameLostCount()); } + +void TrxBoard::adcCaptureStart(captureConfig &capCfg, eSyncMode syncMode) +{ + // ADC capture reset + this->_debugSlave0->adcLoggerRst(true); + this->_debugSlave1->adcLoggerRst(true); + this->_debugSlave2->adcLoggerRst(true); + this->_debugSlave0->adcLoggerRst(false); + this->_debugSlave1->adcLoggerRst(false); + this->_debugSlave2->adcLoggerRst(false); + + // ADC capture config + this->_debugSlave0->adcLoggerConfig(capCfg); + this->_debugSlave1->adcLoggerConfig(capCfg); + this->_debugSlave2->adcLoggerConfig(capCfg); + + // Sync mode config in case of the manual sync is selected + if (syncMode == manualSync) + { + this->_misc->setSyncMode(bfAdcLogMode); + this->_misc->setManualSync(true); + this->_misc->setManualSync(false); + this->_misc->setSyncMode(bfSyncMode); + } + + // ADC capture enable + this->_debugSlave0->adcCaptureCmd(captureStart); + +} + +void TrxBoard::adcLoggerStart(const QString path) +{ +// // Timeout to receive adc capture done. +// this->_bCtrlMngt->timerShot(100); +// while (!(_dbg->getCapDone())) +// { +// if(this->_bCtrlMngt->checkTimeout()) +// throw SonoException("Failure to receive adc capture done."); + +// } +// this->_bCtrlMngt->timerStop(); + //this->_debugSlave0->adcCaptureCmd(captureStop); + + quint8 fpgaSel(0); + quint8 chNumPerFpga(0); + QList adcDataList; + QTime t = QTime::currentTime(); + QString logPath = path + "/adcLog_" + QString("%1_%2_%3.csv") + .arg(t.hour()) + .arg(t.minute()) + .arg(t.second()); + QFile logFile(logPath); + QTextStream log(&logFile); + + if(logFile.fileName().isEmpty()) + { + throw SonoException("No file is selected"); + } + + if(!logFile.open(QIODevice::WriteOnly)) + { + throw SonoException("Couldn't open file for logging"); + } + + log << "SYNC Offset(ns): "; + log << this->_debugSlave0->getCapSyncOffset() * 5 << ','; + log << this->_debugSlave1->getCapSyncOffset() * 5 << ','; + 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 << ','; + log << endl; + + log << "ADC Sample Logger Offset(sample): "; + log << this->_debugSlave0->getCaptureSampleNo() << ','; + log << this->_debugSlave1->getCaptureSampleNo() << ','; + log << this->_debugSlave2->getCaptureSampleNo() << ','; + log << endl; + + // Set gt to adc mode + this->_misc->setGtSendMode(adcMode); + + // 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++) + { + fpgaSel = chNum / AFE_CHANNEL_NUM_PER_SLAVE; + chNumPerFpga = chNum % AFE_CHANNEL_NUM_PER_SLAVE; + + // ADC sampler start according to selected fpga + this->_misc->setAdcSamplerCmd(samplerStop); + this->_misc->setAdcSamplerFpgaSel(fpgaSel); + this->_misc->setAdcSamplerCmd(samplerStart); + + switch (fpgaSel) + { + case 0: + this->adcLogTransferRoutine (_debugSlave0, chNumPerFpga); + break; + + case 1: + this->adcLogTransferRoutine (_debugSlave1, chNumPerFpga); + break; + + case 2: + this->adcLogTransferRoutine (_debugSlave2, chNumPerFpga); + break; + } + + // Read adc data bram + this->_misc->getAdcDataBram(&adcDataList); + foreach (auto data, adcDataList) + { + log << data << ','; + } + log << endl; + + // ADC sampler stop + this->_misc->setAdcSamplerCmd(samplerStop); + } + + logFile.flush(); + logFile.close(); + + // Set gt to beamformer mode + this->_misc->setGtSendMode(bfMode); +} diff --git a/src/model/hardware/core/register/Field.cpp b/src/model/hardware/core/register/Field.cpp index 068958f..2fb13d3 100644 --- a/src/model/hardware/core/register/Field.cpp +++ b/src/model/hardware/core/register/Field.cpp @@ -161,13 +161,22 @@ void Field::updateValue(quint32 value) { value = value >> _position; value &= _zeroBasedMask; - auto signBit = ((value >> (_length - 1)) & 0x01) == 0x01; - if(_isSigned && signBit) - { - value |= ~_zeroBasedMask; - } - - _value = value; +// auto signBit = ((value >> (_length - 1)) & 0x01) == 0x01; +// if(_isSigned && signBit) +// { +// value |= ~_zeroBasedMask; +// } +// _value = value; + + /*** signed extension ***/ + if (_isSigned) + { + quint32 temp(1U); + temp <<= (_length - 1); + _value = (value ^ temp) - temp; + } + else + _value = value; } /*************************************************************************************************/ diff --git a/src/model/hardware/core/register/Register.cpp b/src/model/hardware/core/register/Register.cpp index 626eb5e..f215def 100644 --- a/src/model/hardware/core/register/Register.cpp +++ b/src/model/hardware/core/register/Register.cpp @@ -88,7 +88,7 @@ void Register::updateLong() } /*************************************************************************************************/ -void Register::updateArray(bool isVariable, quint8 arrayLength) //update array register +void Register::updateArray(bool isVariable, quint16 arrayLength) //update array register { quint32 value; diff --git a/src/model/hardware/core/register/afe/Afe.cpp b/src/model/hardware/core/register/afe/Afe.cpp index 07f234f..67ef468 100644 --- a/src/model/hardware/core/register/afe/Afe.cpp +++ b/src/model/hardware/core/register/afe/Afe.cpp @@ -52,6 +52,7 @@ void Afe::setPga(const AfeConfig afe) const Afe::Afe(SonoDevice *device, quint32 offset) { _adcSync = new AdcSyncStatus (device, offset); + _adcLatency = new AdcLatency (device, offset); _actTerm = new ActiveTerm (device, offset); _lnaHpf = new LnaHpf (device, offset); _global = new Global (device, offset); @@ -61,6 +62,7 @@ Afe::Afe(SonoDevice *device, quint32 offset) Afe::~Afe() { + delete _adcLatency; delete _adcSync; delete _actTerm; delete _lnaHpf; @@ -91,6 +93,12 @@ void Afe::setReadRegEnable(const bool rdEn) const this->_global->update(); } +quint32 Afe::getAdcLatency() const +{ + this->_adcLatency->sync(); + return (this->_adcLatency->sampleLatency->getValue()); +} + bool Afe::getAfeSyncDone() const { this->_adcSync->sync(); diff --git a/src/model/hardware/core/register/builtInTest/BuiltInTest.cpp b/src/model/hardware/core/register/builtInTest/BuiltInTest.cpp index 70d2646..54b3ef6 100644 --- a/src/model/hardware/core/register/builtInTest/BuiltInTest.cpp +++ b/src/model/hardware/core/register/builtInTest/BuiltInTest.cpp @@ -1,6 +1,6 @@ #include "model/hardware/core/register/builtInTest/BuiltInTest.h" -void BuiltInTest::setDacOutputSelect(BuiltInTest::BiteOutputSelect* _outputSelect) const +void BuiltInTest::setDacOutputSelect(BiteOutputSelect* _outputSelect) const { quint32 value; value = (_outputSelect->dacIN) ? 1 : 0; @@ -18,7 +18,7 @@ void BuiltInTest::setDacOutputSelect(BuiltInTest::BiteOutputSelect* _outputSelec _dacOutput->update(); } -void BuiltInTest::setDacMemoryCmd(BuiltInTest::BiteMemoryCmd *_memoryCmd) const +void BuiltInTest::setDacMemoryCmd(BiteMemoryCmd *_memoryCmd) const { quint32 cmdValue = (_memoryCmd->command) ? 1 : 0; _dacCmd->startStop->setValue(cmdValue); @@ -33,8 +33,8 @@ BuiltInTest::BuiltInTest(SonoDevice *device) _dacMemory = new BiteDacMemory (device); _dacCmd = new BiteDacMemoryCmd (device); _dacOutput = new BiteDacOutputSelect (device); - _dacOutputSelect = new BiteOutputSelect(); - _dacMemoryCmd = new BiteMemoryCmd(); + _dacOutputSelect = new BiteOutputSelect; + _dacMemoryCmd = new BiteMemoryCmd; } BuiltInTest::~BuiltInTest() @@ -46,16 +46,33 @@ BuiltInTest::~BuiltInTest() delete _dacMemoryCmd; } -void BuiltInTest::biteDacMemoryWrite(TxDacMemory* txDacMem) const +void BuiltInTest::biteDacMemoryWrite(const QByteArray& iData, const QByteArray& qData) const { - this->_dacMemory->setTxDacMemory(txDacMem); - this->_dacMemory->updateArray(); + this->_dacMemory->setTxDacMemory(iData, qData); + if (iData.size() != qData.size()) + throw SonoException ("Unmatching The size of txDacI & txDacQ is happened."); + this->_dacMemory->updateArray(true, static_cast(iData.size())); } void BuiltInTest::biteDacEnable(quint8 biteInterval, bool cmd) const { this->_dacMemoryCmd->interval = biteInterval; + auto memoryCommand = [this](BiteMemoryCmd*, bool active) + { + this->_dacMemoryCmd->command = active; + }; + + if (cmd) + memoryCommand(_dacMemoryCmd, true); + else + memoryCommand(_dacMemoryCmd, false); + + this->setDacMemoryCmd(_dacMemoryCmd); +} + +void BuiltInTest::biteAdgCfg(eBiteDacOutput adg) const +{ auto outputSelect = [this](BiteOutputSelect*, bool active) { this->_dacOutputSelect->dacIN = active; @@ -64,22 +81,11 @@ void BuiltInTest::biteDacEnable(quint8 biteInterval, bool cmd) const this->_dacOutputSelect->dacQP = active; }; - auto memoryCommand = [this](BiteMemoryCmd*, bool active) - { - this->_dacMemoryCmd->command = active; - }; - - if (cmd) - { + if (adg == adgIQ) outputSelect(_dacOutputSelect, true); - memoryCommand(_dacMemoryCmd, true); - } - else - { - memoryCommand(_dacMemoryCmd, false); + + if (adg == adgGnd) outputSelect(_dacOutputSelect, false); - } this->setDacOutputSelect(_dacOutputSelect); - this->setDacMemoryCmd(_dacMemoryCmd); } diff --git a/src/model/hardware/core/register/debug/Debug.cpp b/src/model/hardware/core/register/debug/Debug.cpp new file mode 100644 index 0000000..4054e9f --- /dev/null +++ b/src/model/hardware/core/register/debug/Debug.cpp @@ -0,0 +1,121 @@ +#include "model/hardware/core/register/debug/Debug.h" + +Debug::Debug(SonoDevice *device, quint32 offset) +{ + _adcLoggerDataTransfer = new AdcLoggerDataTransfer (device, offset); + _adcLoggerCapCmd = new AdcLoggerCapCmd (device, offset); + _adcLoggerStatus = new AdcLoggerStatus (device, offset); + _debuggerMode = new DebuggerMode (device, offset); +} + +Debug::~Debug() +{ + delete _adcLoggerDataTransfer; + delete _adcLoggerCapCmd; + delete _adcLoggerStatus; + delete _debuggerMode; +} + +void Debug::setDebuggerMode(const DebugMode dbgMode) const +{ + quint32 value(0); + value = (dbgMode.rxBfDbgModeEn) ? 1 : 0; + this->_debuggerMode->rxBfDbgModeEn->setValue(value); + + value = (dbgMode.txBfTestModeEn) ? 1 : 0; + this->_debuggerMode->txBfTestModeEn->setValue(value); + + value = (dbgMode.rxBfSimDataGenModeEn) ? 1 : 0; + this->_debuggerMode->rxBfSimDataGenModeEn->setValue(value); + + value = (dbgMode.txBfTestModeCfg) ? 1 : 0; + this->_debuggerMode->txBfTestModeCfg->setValue(value); + + this->_debuggerMode->update(); +} + +void Debug::getDebuggerMode(DebugMode& dbgModeRb) +{ + this->_debuggerMode->sync(); + dbgModeRb.txBfTestModeEn = this->_debuggerMode->txBfTestModeEn->getValue(); + quint32 val = this->_debuggerMode->txBfTestModeCfg->getValue(); + dbgModeRb.txBfTestModeCfg = val ? pulserTr : pulserHz; +} + +void Debug::adcLoggerConfig(const captureConfig &capCfg) const +{ + quint32 value(0); + value = (capCfg.capMode) ? 1 : 0; + this->_adcLoggerCapCmd->capMode->setValue(value); + + value = (capCfg.manualTrig) ? 1 : 0; + this->_adcLoggerCapCmd->capMnlTrig->setValue(value); + + this->_adcLoggerCapCmd->capSyncNo->setValue(capCfg.syncCount); + + this->_adcLoggerCapCmd->capSampleNo->setValue(capCfg.sampleCount); + + this->_adcLoggerCapCmd->update(); +} + +void Debug::adcLoggerRst(bool logRst) const +{ + quint32 value = (logRst) ? 1 : 0; + this->_adcLoggerCapCmd->loggerRst->setValue(value); + this->_adcLoggerCapCmd->update(); +} + +void Debug::adcCaptureCmd(bool capEn) const +{ + quint32 value = (capEn) ? 1 : 0; + this->_adcLoggerCapCmd->capEn->setValue(value); + this->_adcLoggerCapCmd->update(); +} + +quint32 Debug::getCaptureSampleNo() const +{ + this->_adcLoggerCapCmd->sync(); + return (this->_adcLoggerCapCmd->capSampleNo->getValue()); +} + +void Debug::adcLoggerChannelNum(quint16 chNum) const +{ + this->_adcLoggerDataTransfer->adcChannelNo->setValue(chNum); + this->_adcLoggerDataTransfer->update(); +} + +void Debug::adcLoggerTransferCmd(bool start) const +{ + if (start) + { + this->_adcLoggerDataTransfer->transferStart->setValue(1); + this->_adcLoggerDataTransfer->transferStop->setValue(0); + } + else + { + this->_adcLoggerDataTransfer->transferStart->setValue(0); + this->_adcLoggerDataTransfer->transferStop->setValue(1); + } + this->_adcLoggerDataTransfer->update(); +} + +bool Debug::getCapDone() const +{ + this->_adcLoggerStatus->sync(); + return (this->_adcLoggerStatus->capDone->getValue() != 0); +} + +bool Debug::getTransferDone() const +{ + this->_adcLoggerStatus->sync(); + return (this->_adcLoggerStatus->transferDone->getValue() != 0); +} + +quint32 Debug::getCapSyncOffset() const +{ + this->_adcLoggerStatus->sync(); + return this->_adcLoggerStatus->capSyncOffset->getValue(); +} + + + diff --git a/src/model/hardware/core/register/dsp/Dsp.cpp b/src/model/hardware/core/register/dsp/Dsp.cpp index ac97e06..c40beb4 100644 --- a/src/model/hardware/core/register/dsp/Dsp.cpp +++ b/src/model/hardware/core/register/dsp/Dsp.cpp @@ -10,6 +10,7 @@ Dsp::Dsp(SonoDevice *device) _manualAtgc = new ManualAtgc (device); _dtgcLut = new DtgcLut (device); _atgcLut = new AtgcLut (device); + _bfScale = new BfScale (device); _lpfLut = new LpfLut (device); } @@ -23,6 +24,7 @@ Dsp::~Dsp() delete _freqLut; delete _dtgcLut; delete _atgcLut; + delete _bfScale; delete _stbLut; delete _lpfLut; } @@ -40,6 +42,15 @@ void Dsp::lineFilterCoefficient(QList &lineFilterLut) const this->_lineFilterLut->updateArray(); } +void Dsp::lpfScaleCoefficient(QList &lpfScaleCoeff) const +{ + this->_bfScale->bfCoeff1->setValue(lpfScaleCoeff.at(0)); + this->_bfScale->bfCoeff2->setValue(lpfScaleCoeff.at(1)); + this->_bfScale->bfCoeff3->setValue(lpfScaleCoeff.at(2)); + this->_bfScale->bfCoeff4->setValue(lpfScaleCoeff.at(3)); + this->_bfScale->update(); +} + void Dsp::stbCoefficient(QList &stbLut) const { this->_stbLut->setStbLut(stbLut); diff --git a/src/model/hardware/core/register/misc/Misc.cpp b/src/model/hardware/core/register/misc/Misc.cpp index 376ae4a..207730d 100644 --- a/src/model/hardware/core/register/misc/Misc.cpp +++ b/src/model/hardware/core/register/misc/Misc.cpp @@ -10,6 +10,10 @@ Misc::Misc(SonoDevice *device) : _offsetMaster(0), _offsetSlave0(0x50002C), _off _status = new StatusVector (device); _sync = new SyncMode (device); _gt = new GtSendMode (device); + + _adcSamplerControl = new AdcSamplerControl(device); + _adcSamplerStatus = new AdcSamplerStatus (device); + _adcDataBram = new AdcDataBram (device); } Misc::~Misc() @@ -22,6 +26,10 @@ Misc::~Misc() delete _status; delete _sync; delete _gt; + + delete _adcSamplerControl; + delete _adcSamplerStatus; + delete _adcDataBram; } template @@ -81,6 +89,38 @@ quint32 Misc::getFrameLostCount() const return (this->_lostCount->lostCount->getValue()); } +void Misc::setAdcSamplerCmd(bool start) const +{ + quint32 value = (start) ? 1 : 0; + this->_adcSamplerControl->start->setValue(value); + this->_adcSamplerControl->update(); +} + +void Misc::setAdcSamplerFpgaSel(quint8 fpgaSel) const +{ + this->_adcSamplerControl->fpgaSlaveSel->setValue(fpgaSel); + this->_adcSamplerControl->update(); +} + +bool Misc::getAdcSamplerBramReady() const +{ + this->_adcSamplerStatus->sync(); + return (this->_adcSamplerStatus->bramReady->getValue() != 0); +} + +bool Misc::getAdcSamplerError() const +{ + this->_adcSamplerStatus->sync(); + return (this->_adcSamplerStatus->error->getValue() != 0); +} + +void Misc::getAdcDataBram(QList *adcDataList) const +{ + this->_adcDataBram->adcDataList.clear(); + this->_adcDataBram->syncArray(); + adcDataList = &(this->_adcDataBram->adcDataList); +} + void Misc::getFpgaVersion(FpgaCodeVersion *version) const { version->masterCode = this->getVersion(_mVersion);