From a124add6835aaadec9f7abd90a1dfb4f9e6a44c7 Mon Sep 17 00:00:00 2001 From: Arash Aletayeb Date: Mon, 26 Apr 2021 18:37:41 +0200 Subject: [PATCH] init files --- api.cpp | 62 + api.h | 37 + developHw.pro | 39 + developHw.pro.user | 336 ++ include/model/hardware/core/TrxBoard.h | 180 + include/model/hardware/core/dmaCtrl/DmaCtrl.h | 30 + include/model/hardware/core/register/Field.h | 38 + .../model/hardware/core/register/RegUtils.h | 24 + .../model/hardware/core/register/Register.h | 49 + .../hardware/core/register/RegisterChain.h | 49 + .../core/register/beamFormer/BeamFormer.h | 36 + .../beamFormer/registerDefinition/AfeLut.h | 143 + .../registerDefinition/ApodizationLut.h | 46 + .../registerDefinition/ElementPositionLut.h | 46 + .../beamFormer/registerDefinition/PulseLut.h | 83 + .../beamFormer/registerDefinition/RegValid.h | 30 + .../registerDefinition/RxBeamformerLut.h | 65 + .../register/boardsCtrlMngt/BoardsCtrlMngt.h | 284 ++ .../registerDefinition/BoardsSpecs.h | 208 ++ .../registerDefinition/mps/FanStatus.h | 34 + .../registerDefinition/mps/MpsEepromRwReq.h | 46 + .../mps/MpsEepromRwStatus.h | 42 + .../mps/MpsHvRegulatorClk.h | 38 + .../registerDefinition/mps/MpsHvStopState.h | 42 + .../mps/MpsPm5RegulatorClk.h | 38 + .../mps/SupervisorDacValue.h | 42 + .../mps/SupervisorFaultStatus.h | 154 + .../mps/SupervisorI2cStatus.h | 38 + .../registerDefinition/mps/SupervisorRbCmd.h | 38 + .../mps/SupervisorRbCurr24V.h | 30 + .../registerDefinition/mps/SupervisorRbCwdp.h | 30 + .../mps/SupervisorRbHvStop.h | 30 + .../registerDefinition/mps/SupervisorRbHvap.h | 30 + .../registerDefinition/mps/SupervisorRbHvbp.h | 30 + .../registerDefinition/mps/SupervisorRbM5V.h | 30 + .../registerDefinition/mps/SupervisorRbP12V.h | 30 + .../registerDefinition/mps/SupervisorRbP24V.h | 30 + .../registerDefinition/mps/SupervisorRbP4d.h | 30 + .../registerDefinition/mps/SupervisorRbP5V.h | 30 + .../registerDefinition/mps/SupervisorRdData.h | 30 + .../registerDefinition/mps/SupervisorRwReq.h | 43 + .../mps/SupervisorSetupCmd.h | 47 + .../registerDefinition/probe/PrbCtrlCmd.h | 54 + .../probe/PrbCtrlEepromRwReq.h | 46 + .../probe/PrbCtrlEepromRwStatus.h | 42 + .../registerDefinition/probe/PrbCtrlStatus.h | 46 + .../registerDefinition/probe/PrbEepromRwReq.h | 46 + .../probe/PrbEepromRwStatus.h | 42 + .../registerDefinition/trx/Adc12Vin.h | 30 + .../registerDefinition/trx/Adc3P3V.h | 30 + .../registerDefinition/trx/Adc5Vin.h | 30 + .../registerDefinition/trx/AdcAfeA1P8V.h | 30 + .../registerDefinition/trx/AdcAfeD1P8V.h | 30 + .../registerDefinition/trx/AdcAfeVcntlp.h | 30 + .../registerDefinition/trx/AdcPrbCtrl3P3V.h | 30 + .../trx/AdcPrbZeroEncoder.h | 30 + .../trx/OnBoardTempSensor.h | 30 + .../registerDefinition/trx/PcieId.h | 34 + .../registerDefinition/trx/TrxEepromRwReq.h | 46 + .../trx/TrxEepromRwStatus.h | 42 + .../registerDefinition/trx/TrxRegulatorPg.h | 34 + .../core/register/bpiFlash/BpiFlash.h | 21 + .../bpiFlash/registerDefinition/McsRdWr.h | 50 + .../core/register/builtInTest/BuiltInTest.h | 41 + .../registerDefinition/BiteDacMemory.h | 57 + .../registerDefinition/BiteDacMemoryCmd.h | 35 + .../registerDefinition/BiteDacOutputSelect.h | 42 + .../clockDistributer/ClockDistributer.h | 50 + .../registerDefinition/ClkDistributionId.h | 30 + .../registerDefinition/CwModeEnable.h | 38 + .../registerDefinition/CwModeStatus.h | 38 + .../model/hardware/core/register/dsp/Dsp.h | 52 + .../register/dsp/registerDefinition/AtgcLut.h | 45 + .../dsp/registerDefinition/BlendWeight.h | 45 + .../register/dsp/registerDefinition/DtgcLut.h | 45 + .../dsp/registerDefinition/FrequencyLut.h | 45 + .../LineFilterCoefficient.h | 50 + .../register/dsp/registerDefinition/LpfLut.h | 45 + .../dsp/registerDefinition/ManualAtgc.h | 38 + .../ReceiverConfigurationLut.h | 159 + .../dsp/registerDefinition/StbCoefficient.h | 50 + .../core/register/fpgaProgram/FpgaProgram.h | 50 + .../registerDefinition/SerialProgramData.h | 30 + .../registerDefinition/SerialProgramStatus.h | 54 + .../registerDefinition/SlaveFpgaNumber.h | 30 + .../core/register/scenPlayer/ScenPlayer.h | 35 + .../registerDefinition/ScenPlayerCtrl.h | 34 + .../registerDefinition/ScenPlayerEndIndex.h | 30 + .../registerDefinition/ScenPlayerErrorCount.h | 30 + .../registerDefinition/ScenPlayerStartIndex.h | 30 + include/model/hardware/device/SonoConfig.h | 32 + include/model/hardware/device/SonoDevice.h | 36 + main.cpp | 20 + mainwindow.cpp | 2821 ++++++++++++++++ mainwindow.h | 327 ++ mainwindow.ui | 2988 +++++++++++++++++ src/model/hardware/core/TrxBoard.cpp | 666 ++++ src/model/hardware/core/register/Field.cpp | 106 + src/model/hardware/core/register/Register.cpp | 107 + .../hardware/core/register/RegisterChain.cpp | 104 + .../core/register/beamFormer/BeamFormer.cpp | 77 + .../boardsCtrlMngt/BoardsCtrlMngt.cpp | 948 ++++++ .../core/register/bpiFlash/BpiFlash.cpp | 45 + .../core/register/builtInTest/BuiltInTest.cpp | 81 + .../clockDistributer/ClockDistributer.cpp | 78 + src/model/hardware/core/register/dsp/Dsp.cpp | 128 + .../core/register/fpgaProgram/FpgaProgram.cpp | 162 + .../core/register/scenPlayer/ScenPlayer.cpp | 50 + src/model/hardware/device/SonoDevice.cpp | 163 + 109 files changed, 13657 insertions(+) create mode 100755 api.cpp create mode 100755 api.h create mode 100644 developHw.pro create mode 100644 developHw.pro.user create mode 100644 include/model/hardware/core/TrxBoard.h create mode 100644 include/model/hardware/core/dmaCtrl/DmaCtrl.h create mode 100644 include/model/hardware/core/register/Field.h create mode 100644 include/model/hardware/core/register/RegUtils.h create mode 100644 include/model/hardware/core/register/Register.h create mode 100644 include/model/hardware/core/register/RegisterChain.h create mode 100644 include/model/hardware/core/register/beamFormer/BeamFormer.h create mode 100644 include/model/hardware/core/register/beamFormer/registerDefinition/AfeLut.h create mode 100644 include/model/hardware/core/register/beamFormer/registerDefinition/ApodizationLut.h create mode 100644 include/model/hardware/core/register/beamFormer/registerDefinition/ElementPositionLut.h create mode 100644 include/model/hardware/core/register/beamFormer/registerDefinition/PulseLut.h create mode 100644 include/model/hardware/core/register/beamFormer/registerDefinition/RegValid.h create mode 100644 include/model/hardware/core/register/beamFormer/registerDefinition/RxBeamformerLut.h create mode 100644 include/model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.h create mode 100644 include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/BoardsSpecs.h create mode 100644 include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/FanStatus.h create mode 100644 include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/MpsEepromRwReq.h create mode 100644 include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/MpsEepromRwStatus.h create mode 100644 include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/MpsHvRegulatorClk.h create mode 100644 include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/MpsHvStopState.h create mode 100644 include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/MpsPm5RegulatorClk.h create mode 100644 include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorDacValue.h create mode 100644 include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorFaultStatus.h create mode 100644 include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorI2cStatus.h create mode 100644 include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbCmd.h create mode 100644 include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbCurr24V.h create mode 100644 include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbCwdp.h create mode 100644 include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbHvStop.h create mode 100644 include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbHvap.h create mode 100644 include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbHvbp.h create mode 100644 include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbM5V.h create mode 100644 include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbP12V.h create mode 100644 include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbP24V.h create mode 100644 include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbP4d.h create mode 100644 include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbP5V.h create mode 100644 include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRdData.h create mode 100644 include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRwReq.h create mode 100644 include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorSetupCmd.h create mode 100644 include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/probe/PrbCtrlCmd.h create mode 100644 include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/probe/PrbCtrlEepromRwReq.h create mode 100644 include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/probe/PrbCtrlEepromRwStatus.h create mode 100644 include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/probe/PrbCtrlStatus.h create mode 100644 include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/probe/PrbEepromRwReq.h create mode 100644 include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/probe/PrbEepromRwStatus.h create mode 100644 include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/Adc12Vin.h create mode 100644 include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/Adc3P3V.h create mode 100644 include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/Adc5Vin.h create mode 100644 include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/AdcAfeA1P8V.h create mode 100644 include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/AdcAfeD1P8V.h create mode 100644 include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/AdcAfeVcntlp.h create mode 100644 include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/AdcPrbCtrl3P3V.h create mode 100644 include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/AdcPrbZeroEncoder.h create mode 100644 include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/OnBoardTempSensor.h create mode 100644 include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/PcieId.h create mode 100644 include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/TrxEepromRwReq.h create mode 100644 include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/TrxEepromRwStatus.h create mode 100644 include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/TrxRegulatorPg.h create mode 100644 include/model/hardware/core/register/bpiFlash/BpiFlash.h create mode 100644 include/model/hardware/core/register/bpiFlash/registerDefinition/McsRdWr.h create mode 100644 include/model/hardware/core/register/builtInTest/BuiltInTest.h create mode 100644 include/model/hardware/core/register/builtInTest/registerDefinition/BiteDacMemory.h create mode 100644 include/model/hardware/core/register/builtInTest/registerDefinition/BiteDacMemoryCmd.h create mode 100644 include/model/hardware/core/register/builtInTest/registerDefinition/BiteDacOutputSelect.h create mode 100644 include/model/hardware/core/register/clockDistributer/ClockDistributer.h create mode 100644 include/model/hardware/core/register/clockDistributer/registerDefinition/ClkDistributionId.h create mode 100644 include/model/hardware/core/register/clockDistributer/registerDefinition/CwModeEnable.h create mode 100644 include/model/hardware/core/register/clockDistributer/registerDefinition/CwModeStatus.h create mode 100644 include/model/hardware/core/register/dsp/Dsp.h create mode 100644 include/model/hardware/core/register/dsp/registerDefinition/AtgcLut.h create mode 100644 include/model/hardware/core/register/dsp/registerDefinition/BlendWeight.h create mode 100644 include/model/hardware/core/register/dsp/registerDefinition/DtgcLut.h create mode 100644 include/model/hardware/core/register/dsp/registerDefinition/FrequencyLut.h create mode 100644 include/model/hardware/core/register/dsp/registerDefinition/LineFilterCoefficient.h create mode 100644 include/model/hardware/core/register/dsp/registerDefinition/LpfLut.h create mode 100644 include/model/hardware/core/register/dsp/registerDefinition/ManualAtgc.h create mode 100644 include/model/hardware/core/register/dsp/registerDefinition/ReceiverConfigurationLut.h create mode 100644 include/model/hardware/core/register/dsp/registerDefinition/StbCoefficient.h create mode 100644 include/model/hardware/core/register/fpgaProgram/FpgaProgram.h create mode 100644 include/model/hardware/core/register/fpgaProgram/registerDefinition/SerialProgramData.h create mode 100644 include/model/hardware/core/register/fpgaProgram/registerDefinition/SerialProgramStatus.h create mode 100644 include/model/hardware/core/register/fpgaProgram/registerDefinition/SlaveFpgaNumber.h create mode 100644 include/model/hardware/core/register/scenPlayer/ScenPlayer.h create mode 100644 include/model/hardware/core/register/scenPlayer/registerDefinition/ScenPlayerCtrl.h create mode 100644 include/model/hardware/core/register/scenPlayer/registerDefinition/ScenPlayerEndIndex.h create mode 100644 include/model/hardware/core/register/scenPlayer/registerDefinition/ScenPlayerErrorCount.h create mode 100644 include/model/hardware/core/register/scenPlayer/registerDefinition/ScenPlayerStartIndex.h create mode 100644 include/model/hardware/device/SonoConfig.h create mode 100644 include/model/hardware/device/SonoDevice.h create mode 100644 main.cpp create mode 100644 mainwindow.cpp create mode 100644 mainwindow.h create mode 100644 mainwindow.ui create mode 100644 src/model/hardware/core/TrxBoard.cpp create mode 100644 src/model/hardware/core/register/Field.cpp create mode 100644 src/model/hardware/core/register/Register.cpp create mode 100644 src/model/hardware/core/register/RegisterChain.cpp create mode 100644 src/model/hardware/core/register/beamFormer/BeamFormer.cpp create mode 100644 src/model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.cpp create mode 100644 src/model/hardware/core/register/bpiFlash/BpiFlash.cpp create mode 100644 src/model/hardware/core/register/builtInTest/BuiltInTest.cpp create mode 100644 src/model/hardware/core/register/clockDistributer/ClockDistributer.cpp create mode 100644 src/model/hardware/core/register/dsp/Dsp.cpp create mode 100644 src/model/hardware/core/register/fpgaProgram/FpgaProgram.cpp create mode 100644 src/model/hardware/core/register/scenPlayer/ScenPlayer.cpp create mode 100644 src/model/hardware/device/SonoDevice.cpp diff --git a/api.cpp b/api.cpp new file mode 100755 index 0000000..7506e29 --- /dev/null +++ b/api.cpp @@ -0,0 +1,62 @@ +#include "api.h" + +/*************************************************************************************************/ +UltraSoundDevice::UltraSoundDevice() +{ + device = new SonoDevice(); + device->init(); +} + +/*************************************************************************************************/ +UltraSoundDevice::~UltraSoundDevice() +{ + +} + +/*************************************************************************************************/ +uint8_t UltraSoundDevice::readByte(uint32_t address, uint32_t bar) +{ + return device->device.readByte(bar, address); +} + +/*************************************************************************************************/ +uint16_t UltraSoundDevice::readShort(uint32_t address, uint32_t bar) +{ + return device->device.readShort(bar, address); +} + +/*************************************************************************************************/ +uint32_t UltraSoundDevice::readWord(uint32_t address, uint32_t bar) +{ + return device->device.readWord(bar, address); +} + +/*************************************************************************************************/ +uint64_t UltraSoundDevice::readLong(uint32_t address, uint32_t bar) +{ + return device->device.readLong(bar, address); +} + +/*************************************************************************************************/ +void UltraSoundDevice::writeByte(uint32_t address, uint32_t bar, uint8_t data) +{ + device->device.writeByte(bar, address, data); +} + +/*************************************************************************************************/ +void UltraSoundDevice::writeShort(uint32_t address, uint32_t bar, uint16_t data) +{ + device->device.writeShort(bar, address, data); +} + +/*************************************************************************************************/ +void UltraSoundDevice::writeWord(uint32_t address, uint32_t bar, uint32_t data) +{ + device->device.writeWord(bar, address, data); +} + +/*************************************************************************************************/ +void UltraSoundDevice::writeLong(uint32_t address, uint32_t bar, uint64_t data) +{ + device->device.writeLong(bar, address, data); +} diff --git a/api.h b/api.h new file mode 100755 index 0000000..3481c5c --- /dev/null +++ b/api.h @@ -0,0 +1,37 @@ +#include "stdint.h" +#include + +#include "model/hardware/device/SonoDevice.h" + +class myexception: public std::exception +{ +private: + char* _message; +public: + myexception(char* message) { _message = message; } + virtual const char* what() const noexcept + { + return _message; + } +}; + +class UltraSoundDevice +{ +public: + UltraSoundDevice(); + ~UltraSoundDevice(); + + SonoDevice* device; + + uint8_t readByte(uint32_t address, uint32_t bar); + uint16_t readShort(uint32_t address, uint32_t bar); + uint32_t readWord(uint32_t address, uint32_t bar); + uint64_t readLong(uint32_t address, uint32_t bar); + + void writeByte(uint32_t address, uint32_t bar, uint8_t data); + void writeShort(uint32_t address, uint32_t bar, uint16_t data); + void writeWord(uint32_t address, uint32_t bar, uint32_t data); + void writeLong(uint32_t address, uint32_t bar, uint64_t data); +}; + + diff --git a/developHw.pro b/developHw.pro new file mode 100644 index 0000000..51061a0 --- /dev/null +++ b/developHw.pro @@ -0,0 +1,39 @@ +QT += core gui printsupport + +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets + +CONFIG += c++11 + +# The following define makes your compiler emit warnings if you use +# any Qt feature that has been marked deprecated (the exact warnings +# depend on your compiler). Please consult the documentation of the +# deprecated API in order to know how to port your code away from it. +DEFINES += QT_DEPRECATED_WARNINGS + +# You can also make your code fail to compile if it uses deprecated APIs. +# In order to do so, uncomment the following line. +# You can also select to disable deprecated APIs only up to a certain version of Qt. +#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 + +SOURCES += \ + main.cpp \ + mainwindow.cpp \ + api.cpp \ + $$files(src/*.cpp, true) \ + +HEADERS += \ + mainwindow.h \ + api.h \ + $$files(include/*.h, true) + +INCLUDEPATH += "$$PWD/include" + +FORMS += \ + mainwindow.ui + +# Default rules for deployment. +qnx: target.path = /tmp/$${TARGET}/bin +else: unix:!android: target.path = /opt/$${TARGET}/bin +!isEmpty(target.path): INSTALLS += target + +unix|win32: LIBS += -lSonoPcieDevice diff --git a/developHw.pro.user b/developHw.pro.user new file mode 100644 index 0000000..d65bc11 --- /dev/null +++ b/developHw.pro.user @@ -0,0 +1,336 @@ + + + + + + EnvironmentId + {78e1b4e9-45e9-48b6-8eb1-81a1a4312d47} + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + true + false + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + UTF-8 + false + 4 + false + 80 + true + true + 1 + true + false + 0 + true + true + 0 + 8 + true + 1 + true + true + true + false + + + + ProjectExplorer.Project.PluginSettings + + + true + + + + ProjectExplorer.Project.Target.0 + + Desktop Qt 5.13.1 GCC 64bit + Desktop Qt 5.13.1 GCC 64bit + qt.qt5.5131.gcc_64_kit + 0 + 0 + 0 + + /home/hasis/Desktop/Develop_HardwareTest/build-developHw-Desktop_Qt_5_13_1_GCC_64bit-Debug + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + Debug + Qt4ProjectManager.Qt4BuildConfiguration + 2 + true + + + /home/hasis/Desktop/Develop_HardwareTest/build-developHw-Desktop_Qt_5_13_1_GCC_64bit-Release + + + true + qmake + + QtProjectManager.QMakeBuildStep + false + + false + false + true + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + + /home/hasis/Desktop/Develop_HardwareTest/build-developHw-Desktop_Qt_5_13_1_GCC_64bit-Profile + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + true + true + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Profile + Profile + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + 3 + + + 0 + Deploy + + ProjectExplorer.BuildSteps.Deploy + + 1 + Deploy Configuration + + ProjectExplorer.DefaultDeployConfiguration + + 1 + + + dwarf + + cpu-cycles + + + 250 + -F + true + 4096 + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + kcachegrind + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + developHw + + Qt4ProjectManager.Qt4RunConfiguration:/home/hasis/Desktop/Develop_HardwareTest/developHw/developHw.pro + + 3768 + false + true + true + false + false + true + true + + /home/hasis/Desktop/Develop_HardwareTest/build-developHw-Desktop_Qt_5_13_1_GCC_64bit-Debug + + 1 + + + + ProjectExplorer.Project.TargetCount + 1 + + + ProjectExplorer.Project.Updater.FileVersion + 22 + + + Version + 22 + + diff --git a/include/model/hardware/core/TrxBoard.h b/include/model/hardware/core/TrxBoard.h new file mode 100644 index 0000000..7c5f562 --- /dev/null +++ b/include/model/hardware/core/TrxBoard.h @@ -0,0 +1,180 @@ +#ifndef TRXBOARD_H +#define TRXBOARD_H + +#include +#include + +#include "model/hardware/core/register/clockDistributer/ClockDistributer.h" +#include "model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.h" +#include "model/hardware/core/register/fpgaProgram/FpgaProgram.h" +#include "model/hardware/core/register/builtInTest/BuiltInTest.h" +#include "model/hardware/core/register/beamFormer/BeamFormer.h" +#include "model/hardware/core/register/scenPlayer/ScenPlayer.h" +#include "model/hardware/core/register/bpiFlash/BpiFlash.h" +#include "model/hardware/core/register/dsp/Dsp.h" +#include "model/hardware/core/dmaCtrl/DmaCtrl.h" +#include "model/hardware/device/SonoDevice.h" + +#define SLAVE_ELEMENT_SEGMENT 64U +#define TOTAL_SCEN_LUT_SRAM 5U //without sram +#define SLAVE_FPGA_NUMBER 3U +#define CLOCK_DIVISION 0x55 + +#define EEPROM_ID_BYTE_BEGIN 0U +#define EEPROM_ID_BYTE_NUMBER 4U +#define EEPROM_INFO_BYTE_BEGIN 100U +#define EEPROM_INFO_BYTE_NUMBER 5U + + +struct ProbeElementPosition +{ + QList xPosition; + QList yPosition; + QList zPosition; +}; + +struct HealthStatus +{ + float systemTemperature; + float criticalComponentTemperature; + AdcVoltages* adcMon; + VoltagesPg* voltsPg; +}; + +enum eSelectProbe : quint8 +{ + prbA = 1, + prbB, + prbC, + prbD, +}; + +class TrxBoard +{ +private: + QVector _swapVec; + const quint32 _offsetSlave0; + const quint32 _offsetSlave1; + const quint32 _offsetSlave2; + bool _allow; + + SonoDevice _device; + + ClockDistributer* _clkDistributer; + BoardsCtrlMngt* _bCtrlMngt; + FpgaProgram* _fpgaProgram; + BeamFormer* _beamFormerSlave0; + BeamFormer* _beamFormerSlave1; + BeamFormer* _beamFormerSlave2; + ScenPalyer* _scenPlayer; + BpiFlash* _bpiFlash; + DmaCtrl* _dmaCtrl; + Dsp* _dsp; + + enum eScenParams : quint8 + { + clear, + set + }; + + void scenParamsFilling(eScenParams cmd); + void setSwapVector (void); + + + + + + /////////////////////////// Old TRX /////////////////////////// + QString _name; + QString _version; + int _swCounter; + int _hwCounter; + bool _run; + +public: + TrxBoard(); + ~TrxBoard(); + + ///////////////////////////////// BeamFormer API /////////////////////////////// + void scenRxBeamformerProperties (RxBeamformerProperties* rxBeamformer); + void scenProbeElementPosition (ProbeElementPosition* element); + void scenApodizationLut (QList>& apodization); + void scenPulseProperties (PulseProperties* pulse); + void scenAfeLut (AfeProperties* afe); + + //////////////////////////////////// DSP API /////////////////////////////////// + void scenReceiverConfigurationLut (ReceiverConfiguration* configLut) const; + void scenLineFilterCoefficient (QList& lineFilterLut) const; + void scenBlendWeight (QList>& blendWeight) const; + void scenAtgcLut (QList>& atgcLut) const; + void scenStbCoefficient (QList& stbLut) const; + void setAtgcMode (eAtgcMode mode, quint16 value) const; + void scenFrequencyLut (QList& freqLut) const; + void scenLpfLut (QList>& lpfLut) const; + void scenDtgcLut (QList& dtgcLut) const; + + ////////////////////////////// Slave Programming API /////////////////////////// + void slaveFpgaProgram (QString path); + + /////////////////////////////// BeamFormer Mode API //////////////////////////// + void setBeamFormerMode (eClkMode mode) const; + + /////////////////////////////// Scenario Player API //////////////////////////// + void setScenPlayerIndex (quint32& startIdx, quint32& endIdx) const; + void scenPlayerStart (bool start) const; + void scenPlayerPause (bool pause) const; + void scenPlayerStop (bool stop) const; + + ///////////////////////////////// Sram Fill API //////////////////////////////// + void sramWrite(QList& data, quint32 offsetAddr); + + ///////////////////////////////// Emulator API ///////////////////////////////// + void emulatorInit(EmulatorProperties* config) const; + void emulatorStart(bool start) const; + void emulatorStop(bool stop) const; + + ////////////////////////////// BoardCtrlMngt API /////////////////////////////// + quint32 deviceId (void) const; + quint32 vendorId (void) const; + + quint32 trxId (void) const; + quint32 mpsId (void) const; + quint32 prbCtrlId (void) const; + quint32 prbId (quint8 prbSel) const; + QList getConnectedPrbId (void) const; + + QString trxInfo (void) const; + QString mpsInfo (void) const; + QString prbCtrlInfo (void) const; + QString prbInfo (quint8 prbSel) const; + QList getConnectedPrbInfo (void) const; + + void supervisorRbValue(SupervisorRbValue* sValue) const; + void mpsFaultStatus (MpsFaultStatus* faultStatus) const; + void mpsReset (void) const; + void mpsSetAo (float voltA, float voltB) const; + + void selectProbe (eSelectProbe prbSel) const; + void getHealthStatus (HealthStatus* healStat) const; + void init (void) const; + + //////////////////////////////// BPI Flash API ///////////////////////////////// + void mcsProgram (QString path); + void mcsVerify (QString path) const; + + + ///////////////////////////////// Old TRX ////////////////////////////////////// + //HardwarePacketEngine packetEngine; + QString getName(); + QString getVersion(); + bool selfTest(); + bool updateInfo(); + bool updateStatus(); + void readData(); + void start(); + void stop(); + +}; +//bool TrxBoard::_allow = false; + +#endif // TRXBOARD_H diff --git a/include/model/hardware/core/dmaCtrl/DmaCtrl.h b/include/model/hardware/core/dmaCtrl/DmaCtrl.h new file mode 100644 index 0000000..28db643 --- /dev/null +++ b/include/model/hardware/core/dmaCtrl/DmaCtrl.h @@ -0,0 +1,30 @@ +#ifndef DMACTRL_H +#define DMACTRL_H + +#include "model/hardware/device/SonoDevice.h" +//#include "model/hardware/service/HardwarePacketEngine.h" + +struct EmulatorProperties +{ + EmulatorProperties(); + +}; + +class DmaCtrl +{ +private: + SonoDevice* _device; + void startTransfer(bool emulatorEn); + void stopTransfer(); + void setRamOffsetAddress(qint32 offset); + void setTransferLength(qint32 length); + void setTransferRate(float rate); + void setOptions(bool performanceMode); + void setMode(bool dynamicMode); + +public: + DmaCtrl(); + void dmaTransactionMode(bool emulActive) const; +}; + +#endif // DMACTRL_H diff --git a/include/model/hardware/core/register/Field.h b/include/model/hardware/core/register/Field.h new file mode 100644 index 0000000..8d94966 --- /dev/null +++ b/include/model/hardware/core/register/Field.h @@ -0,0 +1,38 @@ +#ifndef FIELD_H +#define FIELD_H + +#include + +class Field +{ +private: + quint32 _value; + quint32 _mask; + quint8 _length; + quint8 _position; + quint32 _zeroBasedMask; + + bool _isSigned; + bool _isUpdated; + + Field(quint32 mask, bool isSigned); + + void findLength(); + void findPosition(); + void findZeroBasedMask(); + +public: + static Field* fromBitPosition(quint32 bitPosition); + static Field* fromMaskSigned(quint32 mask); + static Field* fromMaskUnsigned(quint32 mask); + + quint32 getValue(); + void setValue(quint32 value); + + bool isUpdated(); + + void updateValue(quint32 value); + quint32 getRegisterWriteValue(); +}; + +#endif //FIELD_H diff --git a/include/model/hardware/core/register/RegUtils.h b/include/model/hardware/core/register/RegUtils.h new file mode 100644 index 0000000..dd6c353 --- /dev/null +++ b/include/model/hardware/core/register/RegUtils.h @@ -0,0 +1,24 @@ +#ifndef REGUTILS_H +#define REGUTILS_H + +#include "Register.h" + +#define ADD_UNSIGNED_FIELD(NAME, MASK) \ + do { \ + NAME = Field::fromMaskUnsigned(MASK); \ + _fields.append(NAME); \ + } while(0) + +#define ADD_SIGNED_FIELD(NAME, MASK) \ + do { \ + NAME = Field::fromMaskSigned(MASK); \ + _fields.append(NAME); \ + } while(0) + +#define ADD_BIT_FIELD(NAME, MASK) \ + do { \ + NAME = Field::fromBitPosition(MASK); \ + _fields.append(NAME); \ + } while(0) + +#endif //REGUTILS_H diff --git a/include/model/hardware/core/register/Register.h b/include/model/hardware/core/register/Register.h new file mode 100644 index 0000000..bb197e1 --- /dev/null +++ b/include/model/hardware/core/register/Register.h @@ -0,0 +1,49 @@ +#ifndef REGISTER_H +#define REGISTER_H + +#include "model/hardware/core/register/Field.h" +#include "model/hardware/device/SonoDevice.h" + +class Register +{ +//private: +// virtual void prepareData(quint32 index); +// virtual void receiveData(void); + +protected: + quint32 _bar; + quint32 _offset; + quint32 _baseOffset; + + quint32 _arrayLength; + quint8 _arrayDepth; + + quint32 _value; + + bool _isUpdated; + + QList _fields; + + SonoDevice* _device; + +public: + //Register(quint8 bar, quint32 offset, SonoDevice* device, quint32 arrayLength=0); // Constructor for general Registers: single and array + Register(quint8 bar, quint32 offset, SonoDevice* device); + virtual ~Register(); + + quint32 getValue(); + void setValue(quint32 value); + + void changeOffset(quint32 offset); + quint32 getCurrentOffset (void) const; + + bool isUpdated(); + + void update(); + void upadteArray(); + + void sync(); + void syncArray(); +}; + +#endif //rEGISTER_H diff --git a/include/model/hardware/core/register/RegisterChain.h b/include/model/hardware/core/register/RegisterChain.h new file mode 100644 index 0000000..5618719 --- /dev/null +++ b/include/model/hardware/core/register/RegisterChain.h @@ -0,0 +1,49 @@ +#ifndef REGISTERCHAIN_H +#define REGISTERCHAIN_H + +#include "model/hardware/core/register/Field.h" +#include "model/hardware/device/SonoDevice.h" + +class RegisterChain +{ +private: + virtual void prepareData(quint32 index)=0; + //virtual void receiveData(void); + +protected: + quint32 _bar; + quint32 _offset; + quint32 _baseOffset; + + quint32 _arrayLength; + quint8 _arrayDepth; + + quint32 _value; + + bool _isUpdated; + + QList _fields; + + SonoDevice* _device; + +public: + RegisterChain(quint8 bar, quint32 offset, SonoDevice* device, quint32 arrayLength); // Constructor for general Registers: single and array + virtual ~RegisterChain(); + + quint32 getValue(); + void setValue(quint32 value); + + void changeOffset(quint32 offset); + quint32 getCurrentOffset (void) const; + + bool isUpdated(); + + void update(); + void upadteArray(); + + void sync(); + void syncArray(); +}; + + +#endif // REGISTERCHAIN_H diff --git a/include/model/hardware/core/register/beamFormer/BeamFormer.h b/include/model/hardware/core/register/beamFormer/BeamFormer.h new file mode 100644 index 0000000..de48675 --- /dev/null +++ b/include/model/hardware/core/register/beamFormer/BeamFormer.h @@ -0,0 +1,36 @@ +#ifndef BEAMFORMER_H +#define BEAMFORMER_H + +#include "registerDefinition/ElementPositionLut.h" +#include "registerDefinition/RxBeamformerLut.h" +#include "registerDefinition/ApodizationLut.h" +#include "registerDefinition/RegValid.h" +#include "registerDefinition/PulseLut.h" +#include "registerDefinition/AfeLut.h" + +#define APODIZATION_OFFSET 0x4000 +#define ELEMENT_POSITION_OFFSET 0x400 + +class BeamFormer +{ +private: + ElementPositionLut* _elementPosition; + RxBeamformerLut* _rxBeamformer; + ApodizationLut* _apodization; + RegValid* _regValid; + PulseLut* _pulse; + AfeLut* _afe; + +public: + explicit BeamFormer(SonoDevice* device, quint32 offset); + ~BeamFormer(); + + void probeElementPosition (QList>& elementPosition) const; + void rxBeamformerProperties (RxBeamformerProperties* rxBeamformer) const; + void apodizationLut (QList>& apodization) const; + void pulseProperties (PulseProperties* pulse) const; + void afeLut (AfeProperties* afe) const; + void regValid (bool valid) const; +}; + +#endif // BEAMFORMER_H diff --git a/include/model/hardware/core/register/beamFormer/registerDefinition/AfeLut.h b/include/model/hardware/core/register/beamFormer/registerDefinition/AfeLut.h new file mode 100644 index 0000000..3ab938b --- /dev/null +++ b/include/model/hardware/core/register/beamFormer/registerDefinition/AfeLut.h @@ -0,0 +1,143 @@ +#ifndef AFELUT_H +#define AFELUT_H + +#include "model/hardware/core/register/RegisterChain.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define LPF_PROG_PRP_MASK 0x0000000F +#define PGA_HPF_DIS_PRP_MASK 0x00000010 +#define PGA_CLAMP_DIS_PRP_MASK 0x00000020 +#define PGA_GAIN_PRP_MASK 0x00000040 +#define GBL_ACTIVE_TERM_PRP_MASK 0x00000180 +#define ACT_TERM_EN_PRP_MASK 0x00000200 +#define INPUT_CLAMP_LVL_PRP_MASK 0x00000C00 +#define LNA_HPF_DIS_PRP_MASK 0x00001000 +#define LNA_GAIN_GBL_PRP_MASK 0x00006000 +#define LOW_NF_PRP_MASK 0x00008000 +#define POW_MODES_PRP_MASK 0x00030000 +#define GBL_PDWN_PRP_MASK 0x00040000 +#define LNA_HPF_PROG_PRP_MASK 0x00180000 + +#define BAR 0U +#define OFFSET 0x480800 +#define LENGTH 8U + +struct AfeProperties +{ + QList lpfProg; + QList pgaHpfDis; + QList pgaClampDis; + QList pgaGain; + QList gblActiveTerm; + QList actTermEn; + QList inputClampLvl; + QList lnaHpfDis; + QList lnaGainGbl; + QList lowNf; + QList powModes; + QList gblPdwn; + QList lnaHpfProg; +}; + +class AfeLut : public RegisterChain +{ +private: + AfeProperties* _AfeLut; + + void prepareData(quint32 index) override + { + quint32 value=0; + + lpfProgPrp->setValue(_AfeLut->lpfProg.at(static_cast(index))); + + value = _AfeLut->pgaHpfDis.at(static_cast(index)) ? 1 : 0; + pgaHpfDisPrp->setValue(value); + + value = _AfeLut->pgaClampDis.at(static_cast(index)) ? 1 : 0; + pgaClampDisPrp->setValue(value); + + value = _AfeLut->pgaGain.at(static_cast(index)) ? 1 : 0; + pgaGainPrp->setValue(value); + + gblActiveTermPrp->setValue(_AfeLut->gblActiveTerm.at(static_cast(index))); + + value = _AfeLut->actTermEn.at(static_cast(index)) ? 1 : 0; + actTermEnPrp->setValue(value); + + inputClampLvlPrp->setValue(_AfeLut->inputClampLvl.at(static_cast(index))); + + value = _AfeLut->lnaHpfDis.at(static_cast(index)) ? 1 : 0; + lnaHpfDisPrp->setValue(value); + + lnaGainGblPrp->setValue(_AfeLut->lnaGainGbl.at(static_cast(index))); + + value = _AfeLut->lowNf.at(static_cast(index)) ? 1 : 0; + lowNfPrp->setValue(value); + + powModesPrp->setValue(_AfeLut->powModes.at(static_cast(index))); + + value = _AfeLut->gblPdwn.at(static_cast(index)) ? 1 : 0; + gblPdwnPrp->setValue(value); + + lnaHpfProgPrp->setValue(_AfeLut->lnaHpfProg.at(static_cast(index))); + } + +public: + Field* lpfProgPrp; + Field* pgaHpfDisPrp; + Field* pgaClampDisPrp; + Field* pgaGainPrp; + Field* gblActiveTermPrp; + Field* actTermEnPrp; + Field* inputClampLvlPrp; + Field* lnaHpfDisPrp; + Field* lnaGainGblPrp; + Field* lowNfPrp; + Field* powModesPrp; + Field* gblPdwnPrp; + Field* lnaHpfProgPrp; + + void setAfeLut (AfeProperties* AfeLut) + { + _AfeLut = AfeLut; + } + + AfeLut(SonoDevice* device, quint32 offset) : RegisterChain(BAR, OFFSET+offset, device, LENGTH) + { + ADD_UNSIGNED_FIELD(lpfProgPrp, LPF_PROG_PRP_MASK); + ADD_UNSIGNED_FIELD(pgaHpfDisPrp, PGA_HPF_DIS_PRP_MASK); + ADD_BIT_FIELD(pgaClampDisPrp, PGA_CLAMP_DIS_PRP_MASK); + ADD_BIT_FIELD(pgaGainPrp, PGA_GAIN_PRP_MASK); + ADD_UNSIGNED_FIELD(gblActiveTermPrp, GBL_ACTIVE_TERM_PRP_MASK); + ADD_UNSIGNED_FIELD(actTermEnPrp, ACT_TERM_EN_PRP_MASK); + ADD_UNSIGNED_FIELD(inputClampLvlPrp, INPUT_CLAMP_LVL_PRP_MASK); + ADD_UNSIGNED_FIELD(lnaHpfDisPrp, LNA_HPF_DIS_PRP_MASK); + ADD_UNSIGNED_FIELD(lnaGainGblPrp, LNA_GAIN_GBL_PRP_MASK); + ADD_UNSIGNED_FIELD(lowNfPrp, LOW_NF_PRP_MASK); + ADD_UNSIGNED_FIELD(powModesPrp, POW_MODES_PRP_MASK); + ADD_UNSIGNED_FIELD(gblPdwnPrp, GBL_PDWN_PRP_MASK); + ADD_UNSIGNED_FIELD(lnaHpfProgPrp, LNA_HPF_PROG_PRP_MASK); + } +}; + +#undef LPF_PROG_PRP_MASK +#undef PGA_HPF_DIS_PRP_MASK +#undef PGA_CLAMP_DIS_PRP_MASK +#undef PGA_GAIN_PRP_MASK +#undef GBL_ACTIVE_TERM_PRP_MASK +#undef ACT_TERM_EN_PRP_MASK +#undef INPUT_CLAMP_LVL_PRP_MASK +#undef LNA_HPF_DIS_PRP_MASK +#undef LNA_GAIN_GBL_PRP_MASK +#undef LOW_NF_PRP_MASK +#undef POW_MODES_PRP_MASK +#undef GBL_PDWN_PRP_MASK +#undef LNA_HPF_PROG_PRP_MASK + +#undef BAR +#undef OFFSET +#undef LENGTH + +#endif // AFELUT_H diff --git a/include/model/hardware/core/register/beamFormer/registerDefinition/ApodizationLut.h b/include/model/hardware/core/register/beamFormer/registerDefinition/ApodizationLut.h new file mode 100644 index 0000000..1b69b94 --- /dev/null +++ b/include/model/hardware/core/register/beamFormer/registerDefinition/ApodizationLut.h @@ -0,0 +1,46 @@ +#ifndef APODIZATIONLUT_H +#define APODIZATIONLUT_H + +//#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegisterChain.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define APODIZATION_PRP_MASK 0x0003FFFF + +#define BAR 0 +#define OFFSET 0x4C0000 +#define LENGTH 3057U + +class ApodizationLut : public RegisterChain +{ +private: + QList _apodization; + + void prepareData(quint32 index) override + { + apodizationPrp->setValue(_apodization.at(static_cast(index))); + } + +public: + Field* apodizationPrp; + + void setApodizationLut (QList& apodization) + { + _apodization = apodization; + } + + ApodizationLut(SonoDevice* device, quint32 offset) : RegisterChain(BAR, OFFSET+offset, device, LENGTH) + { + ADD_UNSIGNED_FIELD(apodizationPrp, APODIZATION_PRP_MASK); + } +}; + +#undef APODIZATION_PRP_MASK + +#undef BAR +#undef OFFSET +#undef LENGTH + +#endif // APODIZATIONLUT_H diff --git a/include/model/hardware/core/register/beamFormer/registerDefinition/ElementPositionLut.h b/include/model/hardware/core/register/beamFormer/registerDefinition/ElementPositionLut.h new file mode 100644 index 0000000..78cdd51 --- /dev/null +++ b/include/model/hardware/core/register/beamFormer/registerDefinition/ElementPositionLut.h @@ -0,0 +1,46 @@ +#ifndef ELEMENTPOSITIONLUT_H +#define ELEMENTPOSITIONLUT_H + +//#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegisterChain.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define ELEMENT_POSITION_PRP_MASK 0x0003FFFF + +#define BAR 0 +#define OFFSET 0X484000 +#define LENGTH 64U + +class ElementPositionLut : public RegisterChain +{ +private: + QList _elementPosition; + + void prepareData(quint32 index) override + { + elementPositionPrp->setValue(_elementPosition.at(static_cast(index))); + } + +public: + Field* elementPositionPrp; + + void setElementPositionLut (QList& elementPosition) + { + _elementPosition = elementPosition; + } + + ElementPositionLut(SonoDevice* device, quint32 offset) : RegisterChain(BAR, OFFSET+offset, device, LENGTH) + { + ADD_UNSIGNED_FIELD(elementPositionPrp, ELEMENT_POSITION_PRP_MASK); + } +}; + +#undef ELEMENT_POSITION_PRP_MASK + +#undef BAR +#undef OFFSET +#undef LENGTH + +#endif // ELEMENTPOSITIONLUT_H diff --git a/include/model/hardware/core/register/beamFormer/registerDefinition/PulseLut.h b/include/model/hardware/core/register/beamFormer/registerDefinition/PulseLut.h new file mode 100644 index 0000000..eb6dcf3 --- /dev/null +++ b/include/model/hardware/core/register/beamFormer/registerDefinition/PulseLut.h @@ -0,0 +1,83 @@ +#ifndef PULSELUT_H +#define PULSELUT_H + +#include "model/hardware/core/register/RegisterChain.h" +//#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define HALF_PERIOD_PRP_MASK 0x0000007F +#define HALF_CYCLE_NO_PRP_MASK 0x00000F80 +#define START_PHASE_PRP_MASK 0x00001000 +#define PULSE_VOLT_SEL_PRP_MASK 0x00002000 +#define DAMPING_PULSE_WIDTH_PRP_MASK 0x00FFC000 + +#define BAR 0U +#define OFFSET 0x480000 +#define LENGTH 8U + +struct PulseProperties +{ + QList halfPeriod; + QList halfCycleNo; + QList startPhase; + QList pulseVoltSel; + QList dampingPulseWidth; +}; + +class PulseLut : public RegisterChain +{ +private: + PulseProperties* _pulseLut; + + void prepareData(quint32 index) override + { + quint32 value=0; + + halfPeriodPrp->setValue(_pulseLut->halfPeriod.at(static_cast(index))); + + halfCycleNoPrp->setValue(_pulseLut->halfCycleNo.at(static_cast(index))); + + value = _pulseLut->startPhase.at(static_cast(index)) ? 1 : 0; + startPhasePrp->setValue(value); + + value = _pulseLut->pulseVoltSel.at(static_cast(index)) ? 1 : 0; + pulseVoltSelPrp->setValue(value); + + dampingPulseWidthPrp->setValue(_pulseLut->dampingPulseWidth.at(static_cast(index))); + } + +public: + Field* halfPeriodPrp; + Field* halfCycleNoPrp; + Field* startPhasePrp; + Field* pulseVoltSelPrp; + Field* dampingPulseWidthPrp; + + void setPulseLut (PulseProperties* pulseLut) + { + _pulseLut = pulseLut; + } + + PulseLut(SonoDevice* device, quint32 offset) : RegisterChain(BAR, OFFSET+offset, device, LENGTH) + { + ADD_UNSIGNED_FIELD(halfPeriodPrp, HALF_PERIOD_PRP_MASK); + ADD_UNSIGNED_FIELD(halfCycleNoPrp, HALF_CYCLE_NO_PRP_MASK); + ADD_BIT_FIELD(startPhasePrp, START_PHASE_PRP_MASK); + ADD_BIT_FIELD(pulseVoltSelPrp, PULSE_VOLT_SEL_PRP_MASK); + ADD_UNSIGNED_FIELD(dampingPulseWidthPrp, DAMPING_PULSE_WIDTH_PRP_MASK); + } +}; + +#undef HALF_PERIOD_MASK +#undef HALF_CYCLE_NO_MASK +#undef START_PHASE_MASK +#undef PULSE_VOLT_SEL_MASK +#undef DAMPING_PULSE_WIDTH_MASK + +#undef BAR +#undef OFFSET +#undef LENGTH + +#endif // PULSELUT_H diff --git a/include/model/hardware/core/register/beamFormer/registerDefinition/RegValid.h b/include/model/hardware/core/register/beamFormer/registerDefinition/RegValid.h new file mode 100644 index 0000000..d5ccae9 --- /dev/null +++ b/include/model/hardware/core/register/beamFormer/registerDefinition/RegValid.h @@ -0,0 +1,30 @@ +#ifndef REGVALID_H +#define REGVALID_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define REG_VALID_MASK 0x00000001 + +#define BAR 0U +#define OFFSET 0x4D0000 + +class RegValid : public Register +{ +public: + Field* regValid; + + RegValid(SonoDevice* device, quint32 offset) : Register(BAR, OFFSET+offset, device) + { + ADD_UNSIGNED_FIELD(regValid, REG_VALID_MASK); + } +}; + +#undef REG_VALID_MASK + +#undef BAR +#undef OFFSET + +#endif // REGVALID_H diff --git a/include/model/hardware/core/register/beamFormer/registerDefinition/RxBeamformerLut.h b/include/model/hardware/core/register/beamFormer/registerDefinition/RxBeamformerLut.h new file mode 100644 index 0000000..3827669 --- /dev/null +++ b/include/model/hardware/core/register/beamFormer/registerDefinition/RxBeamformerLut.h @@ -0,0 +1,65 @@ +#ifndef RXBEAMFORMERLUT_H +#define RXBEAMFORMERLUT_H + +#include "model/hardware/core/register/RegisterChain.h" +//#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define LAG_PRP_MASK 0x000007FF +#define APODIZATION_SEL_PRP_MASK 0x00001800 +#define MLA_PRP_MASK 0x0000E000 + +#define BAR 0U +#define OFFSET 0x480400 +#define LENGTH 8U + +struct RxBeamformerProperties +{ + QList lag; + QList apodization; + QList mla; +}; + +class RxBeamformerLut : public RegisterChain +{ +private: + RxBeamformerProperties* _rxBfLut; + + void prepareData(quint32 index) override + { + lagPrp->setValue(_rxBfLut->lag.at(static_cast(index))); + + apodizationSelPrp->setValue(_rxBfLut->apodization.at(static_cast(index))); + + mlaPrp->setValue(_rxBfLut->mla.at(static_cast(index))); + } + +public: + Field* lagPrp; + Field* apodizationSelPrp; + Field* mlaPrp; + + void setRxBfLut (RxBeamformerProperties* rxBfLut) + { + _rxBfLut = rxBfLut; + } + + RxBeamformerLut(SonoDevice* device, quint32 offset) : RegisterChain(BAR, OFFSET+offset, device, LENGTH) + { + ADD_UNSIGNED_FIELD(lagPrp, LAG_PRP_MASK); + ADD_UNSIGNED_FIELD(apodizationSelPrp, APODIZATION_SEL_PRP_MASK); + ADD_UNSIGNED_FIELD(mlaPrp, MLA_PRP_MASK); + } +}; + +#undef LAG_PRP_MASK +#undef APODIZATION_SEL_PRP_MASK +#undef MLA_PRP_MASK + +#undef BAR +#undef OFFSET +#undef LENGTH + +#endif // RXBEAMFORMERLUT_H diff --git a/include/model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.h b/include/model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.h new file mode 100644 index 0000000..9f668c7 --- /dev/null +++ b/include/model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.h @@ -0,0 +1,284 @@ +#ifndef BOARDSCTRLMNGT_H +#define BOARDSCTRLMNGT_H + +#include +#include +#include "registerDefinition/BoardsSpecs.h" + +#define TRX_ROM_MAX_LEN 131072U +#define MPS_ROM_MAX_LEN 512U +#define PRB_ROM_MAX_LEN 4096U +#define PRB_CTRL_ROM_MAX_LEN 131072U + +#define TEMP_SENSOR_RESOLUTION 0.125f + +#define SUPERVISOR_RB_RESOLUTION 65535 +#define SUPERVISOR_RB_V_REF 2.048f +#define F_SYS_CLK 100000 // Dimension: KHz or 200MHz +#define CWD_Offset 1.53f +#define CWD_GAIN 47.065f +#define HVA_Offset 1.525f +#define HVA_GAIN 2.635f +#define HVB_Offset 1.525f +#define HVB_GAIN 2.635f + +#define HVA_MAX_VALUE 66U + + +enum ePg : bool +{ + bad = false, + good = true +}; + +struct VoltagesPg +{ + ePg mon12Vin; + ePg mon5Vin; + ePg mon3P3V; + ePg monAfeA1P8V; + ePg monAfeD1P8V; + ePg prbCtrl3P3V; + ePg regulatorA; + ePg regulatorB; +}; + +struct AdcVoltages +{ + float mon12Vin; + float mon5Vin; + float mon3P3V; + float monAfeA1P8V; + float monAfeD1P8V; + float afeVcntlp; + float prbZeroEncoder; + float prbCtrl3P3V; +}; + +struct SupervisorRbValue +{ + float hvap; + float hvbp; + float cwdp; + float curr24V; + float p24V; + float p12V; + float p5V; + float m5V; + float p4D; + float hvStop; +}; + +struct MpsFaultStatus +{ + bool hvError; + bool m5v; + bool sup4d; + bool p5v; + bool p12v; + bool hvap; + bool cwdp; + bool hvbp; + bool curr24V; + bool p24v; + + bool overHvError; + bool overM5v; + bool overSup4d; + bool overP5v; + bool overP12v; + bool overHvap; + bool overCwdp; + bool overHvbp; + bool overCurr24V; + bool overP24v; + + bool underHvError; + bool underM5v; + bool underSup4d; + bool underP5v; + bool underP12v; + bool underHvap; + bool underCwdp; + bool underHvbp; + bool underCurr24V; + bool underP24v; + +}; + +class BoardsCtrlMngt : private BoardsSpecs, public QObject +{ +private: + + struct EepromReq + { + qint8 dataIn; + quint32 address; + quint8 probeSelect; + }*_rom; + + struct AttenuationFactor + { + float hva; + float hvb; + float p24v; + float m5v; + float cwd; + float hvStop; + float p12v; + float p5v; + float p4d; + float curP24v; + AttenuationFactor(); + }_af; + + struct Gain + { + float hva; + float hvb; + float p24v; + float m5v; + float cwd; + float hvStop; + float p12v; + float p5v; + float p4d; + float curP24v; + Gain(); + }_gn; + + struct MpsDacs + { + float hvaValue; + float hvbValue; + float cwdValue; + }*_mpsDacs; + + QTimer* _timer; + + VoltagesPg* _pg; + + template + void eepromWrite (QByteArray& arr, quint32 addr, quint8 prbSel, T1* request, T2* status); + + template + void setEepromWrite (EepromReq* _rom, T3* request); + + template + QByteArray eepromRead (quint32 addr, quint32 length, quint8 prbSel, T4* request, T5* status); + + template + void setEepromRead (EepromReq* _rom, T6* request); + + + float resDiv (float r1, float r2, quint32 adcValue); + QVector voltPg (float adcVolt); + + float getCWdpValue(void) const; + float getCurr24vValue(void) const; + float getHVapValue(void) const; + float getHVbpValue(void) const; + float getHvStopValue(void) const; + float getM5vValue(void) const; + float getP12vValue(void) const; + float getP24vValue(void) const; + float getP4dValue(void) const; + float getP5vValue(void) const; + + bool getHvErrFault(void) const; + bool getM5vFault(void) const; + bool getSup4dFault(void) const; + bool getP5vFault(void) const; + bool getP12vFault(void) const; + bool getHvapFault(void) const; + bool getCwdpFault(void) const; + bool getHvbpFault(void) const; + bool getCur24vFault(void) const; + bool getP24vFault(void) const; + + bool getOverHvErrFault(void) const; + bool getOverM5vFault(void) const; + bool getOverSup4dFault(void) const; + bool getOverP5vFault(void) const; + bool getOverP12vFault(void) const; + bool getOverHvapFault(void) const; + bool getOverCwdpFault(void) const; + bool getOverHvbpFault(void) const; + bool getOverCur24vFault(void) const; + bool getOverP24vFault(void) const; + + bool getUnderHvErrFault(void) const; + bool getUnderM5vFault(void) const; + bool getUnderSup4dFault(void) const; + bool getUnderP5vFault(void) const; + bool getUnderP12vFault(void) const; + bool getUnderHvapFault(void) const; + bool getUnderCwdpFault(void) const; + bool getUnderHvbpFault(void) const; + bool getUnderCur24vFault(void) const; + bool getUnderP24vFault(void) const; + + void setReadbackCmd(bool stopWr, bool avgValue, bool roundRobinConfig) const; + bool getI2cCmdErr(void) const; + bool getI2cCmdDone(void) const; + bool getI2cBusy(void) const; + void getSupervisorI2cTimeout (void) const; + void getSupervisorI2cDone (void) const; + void setSetupCmdP24vOnOff(bool p24vOnOff) const; + void setSetupCmdJmp(bool jmpDacCmd) const; + void setSetupCmdDacsOnOff(bool cwd, bool hvb, bool hva) const; + void setMpsDacsValue (MpsDacs* _mpsDacs) const; + + friend void trxEepromWrite(QByteArray& array, quint32 address, BoardsCtrlMngt* boards); + friend void mpsEepromWrite(QByteArray& array, quint32 address, BoardsCtrlMngt* boards); + friend void prbCtrlEepromWrite (QByteArray& array, quint32 address, BoardsCtrlMngt* boards); + friend void prbEepromWrite (QByteArray& array, quint32 address, quint8 prbSel, BoardsCtrlMngt* boards); + + void timerShot (quint16 ms) const; + void timerStop (void) const; + +private slots: + bool checkTimerShot (void) const; + +public: + explicit BoardsCtrlMngt(SonoDevice* device) : BoardsSpecs(device) + { + _timer = new QTimer(this); + } + ~BoardsCtrlMngt() + { + delete _timer; + } + + quint32 getPid (void) const; + quint32 getVid (void) const; + + QVector getConnectedPrb (void) const; + void setProbeSelect (quint8 prbSel) const; + void prbCtrlInit (void) const; + + float getTrxTempSensor (void) const; + float getTrxFpgaTemp (void) const; + AdcVoltages* getTrxBoardVoltages (void); + VoltagesPg* getTrxVoltagesPg (void); + + void getSupervisorValue (SupervisorRbValue* sValue) const; + void getMpsFault (MpsFaultStatus* faultStatus) const; + void mpsInit (void) const; + void setMpsReset(void) const; /*** checking ***/ + void mpsHvSet(float &hva, float &hvb) const; + + + QByteArray trxEepromRead (quint32 address, quint32 length); + QByteArray mpsEepromRead (quint32 address, quint32 length); + QByteArray prbCtrlEepromRead (quint32 address, quint32 length); + QByteArray prbEepromRead (quint32 address, quint32 length, quint8 prbSel); + +}; + +void trxEepromWrite (QByteArray& array, quint32 address, BoardsCtrlMngt* boards); +void mpsEepromWrite (QByteArray& array, quint32 address, BoardsCtrlMngt* boards); +void prbCtrlEepromWrite (QByteArray& array, quint32 address, BoardsCtrlMngt* boards); +void prbEepromWrite (QByteArray& array, quint32 address, quint8 prbSel, BoardsCtrlMngt* boards); + +#endif // BOARDSCTRLMNGT_H diff --git a/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/BoardsSpecs.h b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/BoardsSpecs.h new file mode 100644 index 0000000..a63e4fa --- /dev/null +++ b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/BoardsSpecs.h @@ -0,0 +1,208 @@ +#ifndef BOARDSSPECS_H +#define BOARDSSPECS_H + +//////////////// MPS Headers //////////////// +#include "mps/SupervisorFaultStatus.h" +#include "mps/SupervisorI2cStatus.h" +#include "mps/SupervisorRbCurr24V.h" +#include "mps/MpsPm5RegulatorClk.h" +#include "mps/SupervisorDacValue.h" +#include "mps/SupervisorRbHvStop.h" +#include "mps/SupervisorSetupCmd.h" +#include "mps/MpsEepromRwStatus.h" +#include "mps/MpsHvRegulatorClk.h" +#include "mps/SupervisorRbCwdp.h" +#include "mps/SupervisorRbHvap.h" +#include "mps/SupervisorRbHvbp.h" +#include "mps/SupervisorRbP12V.h" +#include "mps/SupervisorRbP24V.h" +#include "mps/SupervisorRdData.h" +#include "mps/SupervisorRbCmd.h" +#include "mps/SupervisorRbM5V.h" +#include "mps/SupervisorRbP4d.h" +#include "mps/SupervisorRbP5V.h" +#include "mps/SupervisorRwReq.h" +#include "mps/MpsEepromRwReq.h" +#include "mps/MpsHvStopState.h" +#include "mps/FanStatus.h" + +//////////////// Prb Headers //////////////// +#include "probe/PrbCtrlEepromRwStatus.h" +#include "probe/PrbCtrlEepromRwReq.h" +#include "probe/PrbEepromRwStatus.h" +#include "probe/PrbEepromRwReq.h" +#include "probe/PrbCtrlStatus.h" +#include "probe/PrbCtrlCmd.h" + +//////////////// TRX Headers //////////////// +#include "trx/AdcPrbZeroEncoder.h" +#include "trx/OnBoardTempSensor.h" +#include "trx/TrxEepromRwStatus.h" +#include "trx/TrxEepromRwReq.h" +#include "trx/TrxRegulatorPg.h" +#include "trx/AdcPrbCtrl3P3V.h" +#include "trx/AdcAfeVcntlp.h" +#include "trx/AdcAfeA1P8V.h" +#include "trx/AdcAfeD1P8V.h" +#include "trx/Adc12Vin.h" +#include "trx/Adc3P3V.h" +#include "trx/Adc5Vin.h" +#include "trx/PcieId.h" + + +class BoardsSpecs +{ +protected: + //////////////// MPS classes //////////////// + SupervisorFaultStatus* _sFaultStatus; + SupervisorI2cStatus* _sI2cStatus; + SupervisorRbCurr24V* _sRbCurr24V; + MpsPm5RegulatorClk* _mPm5Rgltor; + SupervisorDacValue* _sDacValue; + SupervisorRbHvStop* _sRbHvStop; + SupervisorSetupCmd* _sSetupCmd; + MpsEepromRwStatus* _mRomStatus; + MpsHvRegulatorClk* _mHvRgltor; + SupervisorRbCwdp* _sRbCwdp; + SupervisorRbHvap* _sRbHvap; + SupervisorRbHvbp* _sRbHvbp; + SupervisorRbP12V* _sRbP12V; + SupervisorRbP24V* _sRbP24V; + SupervisorRdData* _sRbData; + SupervisorRbCmd* _sRbCmd; + SupervisorRbM5V* _sRbM5V; + SupervisorRbP4d* _sRbP4D; + SupervisorRbP5V* _sRbP5V; + SupervisorRwReq* _sRwReq; + MpsEepromRwReq* _mRomReq; + MpsHvStopState* _mHvStop; + FanStatus* _fan; + + //////////////// Prb classes //////////////// + PrbCtrlEepromRwStatus* _pCtrlRomStatus; + PrbCtrlEepromRwReq* _pCtrlRomReq; + PrbEepromRwStatus* _pRomStatus; + PrbEepromRwReq* _pRomReq; + PrbCtrlStatus* _pStatus; + PrbCtrlCmd* _pCmd; + + //////////////// TRX classes //////////////// + AdcPrbZeroEncoder* _adcPrbEncoder; + OnBoardTempSensor* _tempSensor; + TrxEepromRwStatus* _tRomStatus; + TrxEepromRwReq* _tRomReq; + TrxRegulatorPg* _tRgltorPg; + AdcPrbCtrl3P3V* _adcPrb3P3V; + AdcAfeVcntlp* _adcVcntlp; + AdcAfeA1P8V* _adcA1P8V; + AdcAfeD1P8V* _adcD1P8V; + Adc12Vin* _adc12Vin; + Adc3P3V* _adc3P3V; + Adc5Vin* _adc5Vin; + PcieId* _pcie; + + explicit BoardsSpecs(SonoDevice* device) + { + ///////////////////// MPS Mem Alloc ///////////////////// + _sFaultStatus = new SupervisorFaultStatus (device); + _sI2cStatus = new SupervisorI2cStatus (device); + _sRbCurr24V = new SupervisorRbCurr24V (device); + _mPm5Rgltor = new MpsPm5RegulatorClk (device); + _sDacValue = new SupervisorDacValue (device); + _sRbHvStop = new SupervisorRbHvStop (device); + _sSetupCmd = new SupervisorSetupCmd (device); + _mRomStatus = new MpsEepromRwStatus (device); + _mHvRgltor = new MpsHvRegulatorClk (device); + _sRbCwdp = new SupervisorRbCwdp (device); + _sRbHvap = new SupervisorRbHvap (device); + _sRbHvbp = new SupervisorRbHvbp (device); + _sRbP12V = new SupervisorRbP12V (device); + _sRbP24V = new SupervisorRbP24V (device); + _sRbData = new SupervisorRdData (device); + _sRbCmd = new SupervisorRbCmd (device); + _sRbM5V = new SupervisorRbM5V (device); + _sRbP4D = new SupervisorRbP4d (device); + _sRbP5V = new SupervisorRbP5V (device); + _sRwReq = new SupervisorRwReq (device); + _mRomReq = new MpsEepromRwReq (device); + _mHvStop = new MpsHvStopState (device); + _fan = new FanStatus (device); + + ///////////////////// Prb Mem Alloc ///////////////////// + _pCtrlRomStatus = new PrbCtrlEepromRwStatus (device); + _pCtrlRomReq = new PrbCtrlEepromRwReq (device); + _pRomStatus = new PrbEepromRwStatus (device); + _pRomReq = new PrbEepromRwReq (device); + _pStatus = new PrbCtrlStatus (device); + _pCmd = new PrbCtrlCmd (device); + + ///////////////////// TRX Mem Alloc ///////////////////// + _adcPrbEncoder = new AdcPrbZeroEncoder (device); + _tempSensor = new OnBoardTempSensor (device); + _tRomStatus = new TrxEepromRwStatus (device); + _tRomReq = new TrxEepromRwReq (device); + _tRgltorPg = new TrxRegulatorPg (device); + _adcPrb3P3V = new AdcPrbCtrl3P3V (device); + _adcVcntlp = new AdcAfeVcntlp (device); + _adcA1P8V = new AdcAfeA1P8V (device); + _adcD1P8V = new AdcAfeD1P8V (device); + _adc12Vin = new Adc12Vin (device); + _adc3P3V = new Adc3P3V (device); + _adc5Vin = new Adc5Vin (device); + _pcie = new PcieId (device); + + } + ~BoardsSpecs() + { + //// MPS Mem delete //// + delete _sFaultStatus; + delete _sI2cStatus; + delete _sRbCurr24V; + delete _mPm5Rgltor; + delete _sDacValue; + delete _sRbHvStop; + delete _sSetupCmd; + delete _mRomStatus; + delete _mHvRgltor; + delete _sRbCwdp; + delete _sRbHvap; + delete _sRbHvbp; + delete _sRbP12V; + delete _sRbP24V; + delete _sRbData; + delete _sRbCmd; + delete _sRbM5V; + delete _sRbP4D; + delete _sRbP5V; + delete _sRwReq; + delete _mRomReq; + delete _mHvStop; + delete _fan; + + //// Prb Mem delete //// + delete _pCtrlRomStatus; + delete _pCtrlRomReq; + delete _pRomStatus; + delete _pRomReq; + delete _pStatus; + delete _pCmd; + + //// TRX Mem delete //// + delete _adcPrbEncoder; + delete _tempSensor; + delete _tRomStatus; + delete _tRomReq; + delete _tRgltorPg; + delete _adcPrb3P3V; + delete _adcVcntlp; + delete _adcA1P8V; + delete _adcD1P8V; + delete _adc12Vin; + delete _adc3P3V; + delete _adc5Vin; + delete _pcie; + + } +}; + +#endif // BOARDSSPECS diff --git a/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/FanStatus.h b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/FanStatus.h new file mode 100644 index 0000000..30dca80 --- /dev/null +++ b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/FanStatus.h @@ -0,0 +1,34 @@ +#ifndef FANSTATUS_H +#define FANSTATUS_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define FAN1_FAULT_MASK 0x00000001 +#define FAN2_FAULT_MASK 0x00000002 + +#define BAR 0 +#define OFFSET 0X260C0 + +class FanStatus : public Register +{ +public: + Field* fan1Fault; + Field* fan2Fault; + + FanStatus(SonoDevice* device) : Register(BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(fan1Fault, FAN1_FAULT_MASK); + ADD_UNSIGNED_FIELD(fan2Fault, FAN2_FAULT_MASK); + } +}; + +#undef FAN1_FAULT_MASK +#undef FAN2_FAULT_MASK + +#undef BAR +#undef OFFSET + +#endif diff --git a/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/MpsEepromRwReq.h b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/MpsEepromRwReq.h new file mode 100644 index 0000000..a008029 --- /dev/null +++ b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/MpsEepromRwReq.h @@ -0,0 +1,46 @@ +#ifndef MPSEEPROMRWREQ_H +#define MPSEEPROMRWREQ_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define MPS_EEPROM_DATA_IN_MASK 0x000000FF +#define MPS_EEPROM_ADDRESS_MASK 0x01FFFF00 +#define PRB_EEPROM_PROBE_SEL_MASK 0x06000000 // actually reserved +#define MPS_EEPROM_RD_REQ_MASK 0x40000000 +#define MPS_EEPROM_WR_REQ_MASK 0x80000000 + +#define BAR 0 +#define OFFSET 0X26004 + +class MpsEepromRwReq : public Register +{ +public: + Field* dataIn; + Field* address; + Field* prbSel; + Field* rdReq; + Field* wrReq; + + MpsEepromRwReq(SonoDevice* device) : Register(BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(dataIn, MPS_EEPROM_DATA_IN_MASK); + ADD_UNSIGNED_FIELD(address, MPS_EEPROM_ADDRESS_MASK); + ADD_UNSIGNED_FIELD(prbSel, PRB_EEPROM_PROBE_SEL_MASK); + ADD_UNSIGNED_FIELD(rdReq, MPS_EEPROM_RD_REQ_MASK); + ADD_UNSIGNED_FIELD(wrReq, MPS_EEPROM_WR_REQ_MASK); + } +}; + +#undef MPS_EEPROM_DATA_IN_MASK +#undef MPS_EEPROM_ADDRESS_MASK +#undef PRB_EEPROM_PROBE_SEL_MASK +#undef MPS_EEPROM_RD_REQ_MASK +#undef MPS_EEPROM_WR_REQ_MASK + +#undef BAR +#undef OFFSET + +#endif // MPSEEPROMRWREQ_H diff --git a/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/MpsEepromRwStatus.h b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/MpsEepromRwStatus.h new file mode 100644 index 0000000..2cb090c --- /dev/null +++ b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/MpsEepromRwStatus.h @@ -0,0 +1,42 @@ +#ifndef MPSEEPROMRWSTATUS_H +#define MPSEEPROMRWSTATUS_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define MPS_EEPROM_REQ_DONE_MASK 0x00000001 +#define MPS_EEPROM_REQ_ERROR_MASK 0x00000002 +#define MPS_EEPROM_BUSY_MASK 0x00000004 +#define MPS_EEPROM_DATA_OUT_MASK 0x0000FF00 + +#define BAR 0 +#define OFFSET 0X26040 + +class MpsEepromRwStatus : public Register +{ +public: + Field* reqDone; + Field* reqError; + Field* busy; + Field* dataOut; + + MpsEepromRwStatus(SonoDevice* device) : Register(BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(reqDone, MPS_EEPROM_REQ_DONE_MASK); + ADD_UNSIGNED_FIELD(reqError, MPS_EEPROM_REQ_ERROR_MASK); + ADD_UNSIGNED_FIELD(busy, MPS_EEPROM_BUSY_MASK); + ADD_UNSIGNED_FIELD(dataOut, MPS_EEPROM_DATA_OUT_MASK); + } +}; + +#undef MPS_EEPROM_REQ_DONE_MASK +#undef MPS_EEPROM_REQ_ERROR_MASK +#undef MPS_EEPROM_BUSY_MASK +#undef MPS_EEPROM_DATA_OUT_MASK + +#undef BAR +#undef OFFSET + +#endif // MPSEEPROMRWSTATUS_H diff --git a/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/MpsHvRegulatorClk.h b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/MpsHvRegulatorClk.h new file mode 100644 index 0000000..929c71e --- /dev/null +++ b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/MpsHvRegulatorClk.h @@ -0,0 +1,38 @@ +#ifndef MPSHVREGULATORCLK_H +#define MPSHVREGULATORCLK_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define SYNC_HVS_HALF_PERIOD_MASK 0x00003FFF +#define SYNC_HVS_VALID_MASK 0x00004000 +#define SYNC_HVS_ENABLE_MASK 0x00008000 + +#define BAR 0 +#define OFFSET 0X26020 + +class MpsHvRegulatorClk : public Register +{ +public: + Field* syncHVsHalfPeriod; + Field* syncHVsValid; + Field* syncHVsEnable; + + MpsHvRegulatorClk(SonoDevice* device) : Register(BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(syncHVsHalfPeriod, SYNC_HVS_HALF_PERIOD_MASK); + ADD_UNSIGNED_FIELD(syncHVsValid, SYNC_HVS_VALID_MASK); + ADD_UNSIGNED_FIELD(syncHVsEnable, SYNC_HVS_ENABLE_MASK); + } +}; + +#undef SYNC_HVS_HALF_PERIOD_MASK +#undef SYNC_HVS_VALID_MASK +#undef SYNC_HVS_ENABLE_MASK + +#undef BAR +#undef OFFSET + +#endif diff --git a/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/MpsHvStopState.h b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/MpsHvStopState.h new file mode 100644 index 0000000..068dd1e --- /dev/null +++ b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/MpsHvStopState.h @@ -0,0 +1,42 @@ +#ifndef MPSHVSTOPSTATE_H +#define MPSHVSTOPSTATE_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define THSD_HV_STOP_MASK 0x00000001 +#define PG_HV_STOP_MASK 0x00000002 +#define TEMP_HV_STOP_MASK 0x00000004 +#define PROBE_HV_STOP_MASK 0x00000008 + +#define BAR 0 +#define OFFSET 0X260C4 + +class MpsHvStopState : public Register +{ +public: + Field* thsdHvStop; + Field* pgHvStop; + Field* tempHvStop; + Field* probeHvStop; + + MpsHvStopState(SonoDevice* device) : Register(BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(thsdHvStop, THSD_HV_STOP_MASK); + ADD_UNSIGNED_FIELD(pgHvStop, PG_HV_STOP_MASK); + ADD_UNSIGNED_FIELD(tempHvStop, TEMP_HV_STOP_MASK); + ADD_UNSIGNED_FIELD(probeHvStop, PROBE_HV_STOP_MASK); + } +}; + +#undef THSD_HV_STOP_MASK +#undef PG_HV_STOP_MASK +#undef TEMP_HV_STOP_MASK +#undef PROBE_HV_STOP_MASK + +#undef BAR +#undef OFFSET + +#endif diff --git a/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/MpsPm5RegulatorClk.h b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/MpsPm5RegulatorClk.h new file mode 100644 index 0000000..3be731f --- /dev/null +++ b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/MpsPm5RegulatorClk.h @@ -0,0 +1,38 @@ +#ifndef MPSPM5REGULATORCLK_H +#define MPSPM5REGULATORCLK_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define SYNC_PM5_HALF_PERIOD_MASK 0x00003FFF +#define SYNC_PM5_VALID_MASK 0x00004000 +#define SYNC_PM5_ENABLE_MASK 0x00008000 + +#define BAR 0 +#define OFFSET 0X26024 + +class MpsPm5RegulatorClk : public Register +{ +public: + Field* syncPM5HalfPeriod; + Field* syncPM5Valid; + Field* syncPM5Enable; + + MpsPm5RegulatorClk(SonoDevice* device) : Register(BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(syncPM5HalfPeriod, SYNC_PM5_HALF_PERIOD_MASK); + ADD_UNSIGNED_FIELD(syncPM5Valid, SYNC_PM5_VALID_MASK); + ADD_UNSIGNED_FIELD(syncPM5Enable, SYNC_PM5_ENABLE_MASK); + } +}; + +#undef SYNC_PM5_HALF_PERIOD_MASK +#undef SYNC_PM5_VALID_MASK +#undef SYNC_PM5_ENABLE_MASK + +#undef BAR +#undef OFFSET + +#endif diff --git a/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorDacValue.h b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorDacValue.h new file mode 100644 index 0000000..f37f585 --- /dev/null +++ b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorDacValue.h @@ -0,0 +1,42 @@ +#ifndef SUPERVISORDACVALUE_H +#define SUPERVISORDACVALUE_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define HVA_VALUE_MASK 0x000000FF +#define HVB_VALUE_MASK 0x0000FF00 +#define CWD_VALUE_MASK 0x00FF0000 +#define DACS_VALUE_VALID_MASK 0x01000000 + +#define BAR 0 +#define OFFSET 0X2602C + +class SupervisorDacValue : public Register +{ +public: + Field* hvaValue; + Field* hvbValue; + Field* cwdValue; + Field* dacsValueValid; + + SupervisorDacValue(SonoDevice* device) : Register(BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(hvaValue, HVA_VALUE_MASK); + ADD_UNSIGNED_FIELD(hvbValue, HVB_VALUE_MASK); + ADD_UNSIGNED_FIELD(cwdValue, CWD_VALUE_MASK); + ADD_UNSIGNED_FIELD(dacsValueValid, DACS_VALUE_VALID_MASK); + } +}; + +#undef HVA_VALUE_MASK +#undef HVB_VALUE_MASK +#undef CWD_VALUE_MASK +#undef DACS_VALUE_VALID_MASK + +#undef BAR +#undef OFFSET + +#endif diff --git a/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorFaultStatus.h b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorFaultStatus.h new file mode 100644 index 0000000..292730b --- /dev/null +++ b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorFaultStatus.h @@ -0,0 +1,154 @@ +#ifndef SUPERVISORFAULTSTATUS_H +#define SUPERVISORFAULTSTATUS_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define HV_ERROR_MASK 0x00000001 +#define M5V_MASK 0x00000002 +#define SUP_4D_MASK 0x00000004 +#define P5V_MASK 0x00000008 +#define P12V_MASK 0x00000010 +#define HVA_MASK 0x00000020 +#define CWD_MASK 0x00000040 +#define HVB_MASK 0x00000080 +#define CUR_24V_OR_HV_MUX_MASK 0x00000100 +#define P24V_MASK 0x00000200 + +#define OVER_HV_ERROR_MASK 0x00000400 +#define OVER_M5V_MASK 0x00000800 +#define OVER_SUP_4D_MASK 0x00001000 +#define OVER_P5V_MASK 0x00002000 +#define OVER_P12V_MASK 0x00004000 +#define OVER_HVA_MASK 0x00008000 +#define OVER_CWD_MASK 0x00010000 +#define OVER_HVB_MASK 0x00020000 +#define OVER_CUR_24V_OR_HV_MUX_MASK 0x00040000 +#define OVER_P24V_MASK 0x00080000 + +#define UNDER_HV_ERROR_MASK 0x00100000 +#define UNDER_M5V_MASK 0x00200000 +#define UNDER_SUP_4D_MASK 0x00400000 +#define UNDER_P5V_MASK 0x00800000 +#define UNDER_P12V_MASK 0x01000000 +#define UNDER_HVA_MASK 0x02000000 +#define UNDER_CWD_MASK 0x04000000 +#define UNDER_HVB_MASK 0x08000000 +#define UNDER_CUR_24V_OR_HV_MUX_MASK 0x10000000 +#define UNDER_P24V_MASK 0x20000000 + +#define BAR 0 +#define OFFSET 0X26094 + +class SupervisorFaultStatus : public Register +{ +public: + Field* hvError; + Field* m5v; + Field* sup4d; + Field* p5v; + Field* p12v; + Field* hva; + Field* cwd; + Field* hvb; + Field* cur24vOrHvMux; + Field* p24v; + + Field* overHvError; + Field* overM5v; + Field* overSup4d; + Field* overP5v; + Field* overP12v; + Field* overHva; + Field* overCwd; + Field* overHvb; + Field* overCur24vOrHvMux; + Field* overP24v; + + Field* underHvError; + Field* underM5v; + Field* underSup4d; + Field* underP5v; + Field* underP12v; + Field* underHva; + Field* underCwd; + Field* underHvb; + Field* underCur24vOrHvMux; + Field* underP24v; + + SupervisorFaultStatus(SonoDevice* device) : Register(BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(hvError, HV_ERROR_MASK); + ADD_UNSIGNED_FIELD(m5v, M5V_MASK); + ADD_UNSIGNED_FIELD(sup4d, SUP_4D_MASK); + ADD_UNSIGNED_FIELD(p5v, P5V_MASK); + ADD_UNSIGNED_FIELD(p12v, P12V_MASK); + ADD_UNSIGNED_FIELD(hva, HVA_MASK); + ADD_UNSIGNED_FIELD(cwd, CWD_MASK); + ADD_UNSIGNED_FIELD(hvb, HVB_MASK); + ADD_UNSIGNED_FIELD(cur24vOrHvMux, CUR_24V_OR_HV_MUX_MASK); + ADD_UNSIGNED_FIELD(p24v, P24V_MASK); + + ADD_UNSIGNED_FIELD(overHvError, OVER_HV_ERROR_MASK); + ADD_UNSIGNED_FIELD(overM5v, OVER_M5V_MASK); + ADD_UNSIGNED_FIELD(overSup4d, OVER_SUP_4D_MASK); + ADD_UNSIGNED_FIELD(overP5v, OVER_P5V_MASK); + ADD_UNSIGNED_FIELD(overP12v, OVER_P12V_MASK); + ADD_UNSIGNED_FIELD(overHva, OVER_HVA_MASK); + ADD_UNSIGNED_FIELD(overCwd, OVER_CWD_MASK); + ADD_UNSIGNED_FIELD(overHvb, OVER_HVB_MASK); + ADD_UNSIGNED_FIELD(overCur24vOrHvMux, OVER_CUR_24V_OR_HV_MUX_MASK); + ADD_UNSIGNED_FIELD(overP24v, OVER_P24V_MASK); + + ADD_UNSIGNED_FIELD(underHvError, UNDER_HV_ERROR_MASK); + ADD_UNSIGNED_FIELD(underM5v, UNDER_M5V_MASK); + ADD_UNSIGNED_FIELD(underSup4d, UNDER_SUP_4D_MASK); + ADD_UNSIGNED_FIELD(underP5v, UNDER_P5V_MASK); + ADD_UNSIGNED_FIELD(underP12v, UNDER_P12V_MASK); + ADD_UNSIGNED_FIELD(underHva, UNDER_HVA_MASK); + ADD_UNSIGNED_FIELD(underCwd, UNDER_CWD_MASK); + ADD_UNSIGNED_FIELD(underHvb, UNDER_HVB_MASK); + ADD_UNSIGNED_FIELD(underCur24vOrHvMux, UNDER_CUR_24V_OR_HV_MUX_MASK); + ADD_UNSIGNED_FIELD(underP24v, UNDER_P24V_MASK); + } +}; + +#undef HV_ERROR_MASK +#undef M5V_MASK +#undef SUP_4D_MASK +#undef P5V_MASK +#undef P12V_MASK +#undef HVA_MASK +#undef CWD_MASK +#undef HVB_MASK +#undef CUR_24V_OR_HV_MUX_MASK +#undef P24V_MASK + +#undef OVER_HV_ERROR_MASK +#undef OVER_M5V_MASK +#undef OVER_SUP_4D_MASK +#undef OVER_P5V_MASK +#undef OVER_P12V_MASK +#undef OVER_HVA_MASK +#undef OVER_CWD_MASK +#undef OVER_HVB_MASK +#undef OVER_CUR_24V_OR_HV_MUX_MASK +#undef OVER_P24V_MASK + +#undef UNDER_HV_ERROR_MASK +#undef UNDER_M5V_MASK +#undef UNDER_SUP_4D_MASK +#undef UNDER_P5V_MASK +#undef UNDER_P12V_MASK +#undef UNDER_HVA_MASK +#undef UNDER_CWD_MASK +#undef UNDER_HVB_MASK +#undef UNDER_CUR_24V_OR_HV_MUX_MASK +#undef UNDER_P24V_MASK + +#undef BAR +#undef OFFSET + +#endif diff --git a/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorI2cStatus.h b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorI2cStatus.h new file mode 100644 index 0000000..accbf75 --- /dev/null +++ b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorI2cStatus.h @@ -0,0 +1,38 @@ +#ifndef SUPERVISORI2CSTATUS_H +#define SUPERVISORI2CSTATUS_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define CMD_ERROR_MASK 0x00000001 +#define CMD_DONE_MASK 0x00000002 +#define BUSY_MASK 0x00000004 + +#define BAR 0 +#define OFFSET 0X26 + +class SupervisorI2cStatus : public Register +{ +public: + Field* cmdError; + Field* cmdDone; + Field* busy; + + SupervisorI2cStatus(SonoDevice* device) : Register(BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(cmdError, CMD_ERROR_MASK); + ADD_UNSIGNED_FIELD(cmdDone, CMD_DONE_MASK); + ADD_UNSIGNED_FIELD(busy, BUSY_MASK); + } +}; + +#undef CMD_ERROR_MASK +#undef CMD_DONE_MASK +#undef BUSY_MASK + +#undef BAR +#undef OFFSET + +#endif diff --git a/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbCmd.h b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbCmd.h new file mode 100644 index 0000000..1c85adb --- /dev/null +++ b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbCmd.h @@ -0,0 +1,38 @@ +#ifndef SUPERVISORRBCMD_H +#define SUPERVISORRBCMD_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define ROUND_ROBIN_CONFIG_MASK 0x00000001 +#define AVERAGE_VALUE_RD_REQ_MASK 0x00000002 +#define RESET_STOP_WR_MASK 0x00000004 + +#define BAR 0 +#define OFFSET 0X26034 + +class SupervisorRbCmd : public Register +{ +public: + Field* roundRobinConfig; + Field* averageValueRdReq; + Field* resetStopWr; + + SupervisorRbCmd(SonoDevice* device) : Register(BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(roundRobinConfig, ROUND_ROBIN_CONFIG_MASK); + ADD_UNSIGNED_FIELD(averageValueRdReq, AVERAGE_VALUE_RD_REQ_MASK); + ADD_UNSIGNED_FIELD(resetStopWr, RESET_STOP_WR_MASK); + } +}; + +#undef ROUND_ROBIN_CONFIG_MASK +#undef AVERAGE_VALUE_RD_REQ_MASK +#undef RESET_STOP_WR_MASK + +#undef BAR +#undef OFFSET + +#endif diff --git a/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbCurr24V.h b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbCurr24V.h new file mode 100644 index 0000000..cb3556f --- /dev/null +++ b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbCurr24V.h @@ -0,0 +1,30 @@ +#ifndef SUPERVISORRBCURR24V_H +#define SUPERVISORRBCURR24V_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define CURRENT_P24V_AVG_VALUE_MASK 0x0000FFFF + +#define BAR 0 +#define OFFSET 0X260A4 + +class SupervisorRbCurr24V : public Register +{ +public: + Field* currentP24vAvgValue; + + SupervisorRbCurr24V(SonoDevice* device) : Register(BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(currentP24vAvgValue, CURRENT_P24V_AVG_VALUE_MASK); + } +}; + +#undef CURRENT_P24V_AVG_VALUE_MASK + +#undef BAR +#undef OFFSETs + +#endif diff --git a/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbCwdp.h b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbCwdp.h new file mode 100644 index 0000000..bb7c503 --- /dev/null +++ b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbCwdp.h @@ -0,0 +1,30 @@ +#ifndef SUPERVISORRBCWDP_H +#define SUPERVISORRBCWDP_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define CWDP_AVG_VALUE_MASK 0x0000FFFF + +#define BAR 0 +#define OFFSET 0X2609C + +class SupervisorRbCwdp : public Register +{ +public: + Field* cwdpAvgValue; + + SupervisorRbCwdp(SonoDevice* device) : Register(BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(cwdpAvgValue, CWDP_AVG_VALUE_MASK); + } +}; + +#undef CWDP_AVG_VALUE_MASK + +#undef BAR +#undef OFFSET + +#endif diff --git a/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbHvStop.h b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbHvStop.h new file mode 100644 index 0000000..f06d821 --- /dev/null +++ b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbHvStop.h @@ -0,0 +1,30 @@ +#ifndef SUPERVISORRBHVSTOP_H +#define SUPERVISORRBHVSTOP_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define HV_STOP_AVG_VALUE_MASK 0x0000FFFF + +#define BAR 0 +#define OFFSET 0X260AC + +class SupervisorRbHvStop : public Register +{ +public: + Field* hvStopAvgValue; + + SupervisorRbHvStop(SonoDevice* device) : Register(BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(hvStopAvgValue, HV_STOP_AVG_VALUE_MASK); + } +}; + +#undef HV_STOP_AVG_VALUE_MASK + +#undef BAR +#undef OFFSET + +#endif diff --git a/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbHvap.h b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbHvap.h new file mode 100644 index 0000000..66faf78 --- /dev/null +++ b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbHvap.h @@ -0,0 +1,30 @@ +#ifndef SUPERVISORRBHVAP_H +#define SUPERVISORRBHVAP_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define HVAP_AVG_VALUE_MASK 0x0000FFFF + +#define BAR 0 +#define OFFSET 0X26098 + +class SupervisorRbHvap : public Register +{ +public: + Field* hvapAvgValue; + + SupervisorRbHvap(SonoDevice* device) : Register(BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(hvapAvgValue, HVAP_AVG_VALUE_MASK); + } +}; + +#undef HVAP_AVG_VALUE_MASK + +#undef BAR +#undef OFFSET + +#endif diff --git a/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbHvbp.h b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbHvbp.h new file mode 100644 index 0000000..3e80d8e --- /dev/null +++ b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbHvbp.h @@ -0,0 +1,30 @@ +#ifndef SUPERVISORRBHVBP_H +#define SUPERVISORRBHVBP_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define HVBP_AVG_VALUE_MASK 0x0000FFFF + +#define BAR 0 +#define OFFSET 0X260A0 + +class SupervisorRbHvbp : public Register +{ +public: + Field* hvbpAvgValue; + + SupervisorRbHvbp(SonoDevice* device) : Register(BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(hvbpAvgValue, HVBP_AVG_VALUE_MASK); + } +}; + +#undef HVBP_AVG_VALUE_MASK + +#undef BAR +#undef OFFSET + +#endif diff --git a/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbM5V.h b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbM5V.h new file mode 100644 index 0000000..2c998f8 --- /dev/null +++ b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbM5V.h @@ -0,0 +1,30 @@ +#ifndef SUPERVISORRBM5V_H +#define SUPERVISORRBM5V_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define M5V_AVG_VALUE_MASK 0x0000FFFF + +#define BAR 0 +#define OFFSET 0X260B0 + +class SupervisorRbM5V : public Register +{ +public: + Field* m5vAvgValue; + + SupervisorRbM5V(SonoDevice* device) : Register(BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(m5vAvgValue, M5V_AVG_VALUE_MASK); + } +}; + +#undef M5V_AVG_VALUE_MASK + +#undef BAR +#undef OFFSET + +#endif diff --git a/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbP12V.h b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbP12V.h new file mode 100644 index 0000000..b009393 --- /dev/null +++ b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbP12V.h @@ -0,0 +1,30 @@ +#ifndef SUPERVISORRBP12V_H +#define SUPERVISORRBP12V_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define P12V_AVG_VALUE_MASK 0x0000FFFF + +#define BAR 0 +#define OFFSET 0X260BC + +class SupervisorRbP12V : public Register +{ +public: + Field* p12vAvgValue; + + SupervisorRbP12V(SonoDevice* device) : Register(BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(p12vAvgValue, P12V_AVG_VALUE_MASK); + } +}; + +#undef P12V_AVG_VALUE_MASK + +#undef BAR +#undef OFFSET + +#endif diff --git a/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbP24V.h b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbP24V.h new file mode 100644 index 0000000..7e5f6e8 --- /dev/null +++ b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbP24V.h @@ -0,0 +1,30 @@ +#ifndef SUPERVISORRBP24V_H +#define SUPERVISORRBP24V_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define P24V_AVG_VALUE_MASK 0x0000FFFF + +#define BAR 0 +#define OFFSET 0X260A8 + +class SupervisorRbP24V : public Register +{ +public: + Field* p24vAvgValue; + + SupervisorRbP24V(SonoDevice* device) : Register(BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(p24vAvgValue, P24V_AVG_VALUE_MASK); + } +}; + +#undef P24V_AVG_VALUE_MASK + +#undef BAR +#undef OFFSET + +#endif diff --git a/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbP4d.h b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbP4d.h new file mode 100644 index 0000000..5c87959 --- /dev/null +++ b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbP4d.h @@ -0,0 +1,30 @@ +#ifndef SUPERVISORRBP4D_H +#define SUPERVISORRBP4D_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define P4D_AVG_VALUE_MASK 0x0000FFFF + +#define BAR 0 +#define OFFSET 0X260B4 + +class SupervisorRbP4d : public Register +{ +public: + Field* p4dAvgValue; + + SupervisorRbP4d(SonoDevice* device) : Register(BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(p4dAvgValue, P4D_AVG_VALUE_MASK); + } +}; + +#undef P4D_AVG_VALUE_MASK + +#undef BAR +#undef OFFSET + +#endif diff --git a/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbP5V.h b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbP5V.h new file mode 100644 index 0000000..c733700 --- /dev/null +++ b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRbP5V.h @@ -0,0 +1,30 @@ +#ifndef SUPERVISORRBP5V_H +#define SUPERVISORRBP5V_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define P5V_AVG_VALUE_MASK 0x0000FFFF + +#define BAR 0 +#define OFFSET 0X260B8 + +class SupervisorRbP5V : public Register +{ +public: + Field* p5vAvgValue; + + SupervisorRbP5V(SonoDevice* device) : Register(BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(p5vAvgValue, P5V_AVG_VALUE_MASK); + } +}; + +#undef P5V_AVG_VALUE_MASK + +#undef BAR +#undef OFFSET + +#endif diff --git a/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRdData.h b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRdData.h new file mode 100644 index 0000000..25ccab9 --- /dev/null +++ b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRdData.h @@ -0,0 +1,30 @@ +#ifndef SUPERVISORRDDATA_H +#define SUPERVISORRDDATA_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define DATA_OUT_MASK 0x000000FF + +#define BAR 0 +#define OFFSET 0X26090 + +class SupervisorRdData : public Register +{ +public: + Field* dataOut; + + SupervisorRdData(SonoDevice* device) : Register(BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(dataOut, DATA_OUT_MASK); + } +}; + +#undef DATA_OUT_MASK + +#undef BAR +#undef OFFSET + +#endif diff --git a/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRwReq.h b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRwReq.h new file mode 100644 index 0000000..afbfcaa --- /dev/null +++ b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorRwReq.h @@ -0,0 +1,43 @@ +#ifndef SUPERVISORRWREQ_H +#define SUPERVISORRWREQ_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define DATA_IN_MASK 0x000000FF +#define ADDRESS_MASK 0x0000FF00 +#define RD_REQ_MASK 0x00010000 +#define WR_REQ_MASK 0x00020000 + + +#define BAR 0 +#define OFFSET 0X26028 + +class SupervisorRwReq : public Register +{ +public: + Field* dataIn; + Field* address; + Field* rdReq; + Field* wrReq; + + SupervisorRwReq(SonoDevice* device) : Register(BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(dataIn, DATA_IN_MASK); + ADD_UNSIGNED_FIELD(address, ADDRESS_MASK); + ADD_UNSIGNED_FIELD(rdReq, RD_REQ_MASK); + ADD_UNSIGNED_FIELD(wrReq, WR_REQ_MASK); + } +}; + +#undef DATA_IN_MASK +#undef ADDRESS_MASK +#undef RD_REQ_MASK +#undef WR_REQ_MASK + +#undef BAR +#undef OFFSET + +#endif diff --git a/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorSetupCmd.h b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorSetupCmd.h new file mode 100644 index 0000000..cfef204 --- /dev/null +++ b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/SupervisorSetupCmd.h @@ -0,0 +1,47 @@ +#ifndef SUPERVISORSETUPCMD_H +#define SUPERVISORSETUPCMD_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define P24V_ON_OFF_MASK 0x00000001 +#define JMP_CMD_MASK 0x00000002 +#define CWD_ON_OFF_MASK 0x00000004 +#define HVB_ON_OFF_MASK 0x00000008 +#define HVA_ON_OFF_MASK 0x00000010 + +#define BAR 0 +#define OFFSET 0X26030 + +class SupervisorSetupCmd : public Register +{ +public: + Field* p24vOnOff; + Field* jmpCmd; + Field* cwdOnOff; + Field* hvbOnOff; + Field* hvaOnOff; + + + SupervisorSetupCmd(SonoDevice* device) : Register(BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(p24vOnOff, P24V_ON_OFF_MASK); + ADD_UNSIGNED_FIELD(jmpCmd, JMP_CMD_MASK); + ADD_UNSIGNED_FIELD(cwdOnOff, CWD_ON_OFF_MASK); + ADD_UNSIGNED_FIELD(hvbOnOff, HVB_ON_OFF_MASK); + ADD_UNSIGNED_FIELD(hvaOnOff, HVA_ON_OFF_MASK); + } +}; + +#undef P24V_ON_OFF_MASK +#undef JMP_CMD_MASK +#undef CWD_ON_OFF_MASK +#undef HVB_ON_OFF_MASK +#undef HVA_ON_OFF_MASK + +#undef BAR +#undef OFFSET + +#endif diff --git a/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/probe/PrbCtrlCmd.h b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/probe/PrbCtrlCmd.h new file mode 100644 index 0000000..7df5cdd --- /dev/null +++ b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/probe/PrbCtrlCmd.h @@ -0,0 +1,54 @@ +#ifndef PRBCTRLCMD_H +#define PRBCTRLCMD_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define PROBE_CONNECTOR_SELECT_MASK 0x00000007 +#define PROBE_A_LOW_PWR_EN_MASK 0x00000010 +#define PROBE_B_LOW_PWR_EN_MASK 0x00000020 +#define PROBE_C_LOW_PWR_EN_MASK 0x00000040 +#define PROBE_D_LOW_PWR_EN_MASK 0x00000080 +#define HV_MUX_PWR_EN_MASK 0x00000100 +#define MOTOR_MUX_PWR_EN_MASK 0x00000200 + +#define BAR 0 +#define OFFSET 0X26018 + +class PrbCtrlCmd : public Register +{ +public: + Field* probeConnectorSelect; + Field* probeALowPwrEn; + Field* probeBLowPwrEn; + Field* probeCLowPwrEn; + Field* probeDLowPwrEn; + Field* HvMuxPwrEn; + Field* MotorMuxPwrEn; + + PrbCtrlCmd(SonoDevice* device) : Register(BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(probeConnectorSelect, PROBE_CONNECTOR_SELECT_MASK); + ADD_UNSIGNED_FIELD(probeALowPwrEn, PROBE_A_LOW_PWR_EN_MASK); + ADD_UNSIGNED_FIELD(probeBLowPwrEn, PROBE_B_LOW_PWR_EN_MASK); + ADD_UNSIGNED_FIELD(probeCLowPwrEn, PROBE_C_LOW_PWR_EN_MASK); + ADD_UNSIGNED_FIELD(probeDLowPwrEn, PROBE_D_LOW_PWR_EN_MASK); + ADD_UNSIGNED_FIELD(HvMuxPwrEn, HV_MUX_PWR_EN_MASK); + ADD_UNSIGNED_FIELD(MotorMuxPwrEn, MOTOR_MUX_PWR_EN_MASK); + } +}; + +#undef PROBE_CONNECTOR_SELECT_MASK +#undef PROBE_A_LOW_PWR_EN_MASK +#undef PROBE_B_LOW_PWR_EN_MASK +#undef PROBE_C_LOW_PWR_EN_MASK +#undef PROBE_D_LOW_PWR_EN_MASK +#undef HV_MUX_PWR_EN_MASK +#undef MOTOR_MUX_PWR_EN_MASK + +#undef BAR +#undef OFFSET + +#endif diff --git a/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/probe/PrbCtrlEepromRwReq.h b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/probe/PrbCtrlEepromRwReq.h new file mode 100644 index 0000000..b55f12d --- /dev/null +++ b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/probe/PrbCtrlEepromRwReq.h @@ -0,0 +1,46 @@ +#ifndef PRBCTRLEEPROMRWREQ_H +#define PRBCTRLEEPROMRWREQ_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define RB_EEPROM_DATA_IN_MASK 0x000000FF +#define RB_EEPROM_ADDRESS_MASK 0x01FFFF00 +#define PRB_EEPROM_PROBE_SEL_MASK 0x06000000 // actually reserved +#define RB_EEPROM_RD_REQ_MASK 0x40000000 +#define RB_EEPROM_WR_REQ_MASK 0x80000000 + +#define BAR 0 +#define OFFSET 0X26008 + +class PrbCtrlEepromRwReq : public Register +{ +public: + Field* dataIn; + Field* address; + Field* prbSel; + Field* rdReq; + Field* wrReq; + + PrbCtrlEepromRwReq(SonoDevice* device) : Register(BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(dataIn, RB_EEPROM_DATA_IN_MASK); + ADD_UNSIGNED_FIELD(address, RB_EEPROM_ADDRESS_MASK); + ADD_UNSIGNED_FIELD(prbSel, PRB_EEPROM_PROBE_SEL_MASK); + ADD_UNSIGNED_FIELD(rdReq, RB_EEPROM_RD_REQ_MASK); + ADD_UNSIGNED_FIELD(wrReq, RB_EEPROM_WR_REQ_MASK); + } +}; + +#undef RB_EEPROM_DATA_IN_MASK +#undef RB_EEPROM_ADDRESS_MASK +#undef PRB_EEPROM_PROBE_SEL_MASK +#undef RB_EEPROM_RD_REQ_MASK +#undef RB_EEPROM_WR_REQ_MASK + +#undef BAR +#undef OFFSET + +#endif // RELAYBOARDEEPROMRWREQ_H diff --git a/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/probe/PrbCtrlEepromRwStatus.h b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/probe/PrbCtrlEepromRwStatus.h new file mode 100644 index 0000000..d19b174 --- /dev/null +++ b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/probe/PrbCtrlEepromRwStatus.h @@ -0,0 +1,42 @@ +#ifndef PRBCTRLEEPROMRWSTATUS_H +#define PRBCTRLEEPROMRWSTATUS_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define RB_EEPROM_REQ_DONE_MASK 0x00000001 +#define RB_EEPROM_REQ_ERROR_MASK 0x00000002 +#define RB_EEPROM_BUSY_MASK 0x00000004 +#define RB_EEPROM_DATA_OUT_MASK 0x0000FF00 + +#define BAR 0 +#define OFFSET 0X26048 + +class PrbCtrlEepromRwStatus : public Register +{ +public: + Field* reqDone; + Field* reqError; + Field* busy; + Field* dataOut; + + PrbCtrlEepromRwStatus(SonoDevice* device) : Register(BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(reqDone, RB_EEPROM_REQ_DONE_MASK); + ADD_UNSIGNED_FIELD(reqError,RB_EEPROM_REQ_ERROR_MASK); + ADD_UNSIGNED_FIELD(busy, RB_EEPROM_BUSY_MASK); + ADD_UNSIGNED_FIELD(dataOut, RB_EEPROM_DATA_OUT_MASK); + } +}; + +#undef RB_EEPROM_REQ_DONE_MASK +#undef RB_EEPROM_REQ_ERROR_MASK +#undef RB_EEPROM_BUSY_MASK +#undef RB_EEPROM_DATA_OUT_MASK + +#undef BAR +#undef OFFSET + +#endif // RELAYBOARDEEPROMSTATUS_H diff --git a/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/probe/PrbCtrlStatus.h b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/probe/PrbCtrlStatus.h new file mode 100644 index 0000000..5bd4422 --- /dev/null +++ b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/probe/PrbCtrlStatus.h @@ -0,0 +1,46 @@ +#ifndef PRBCTRLSTATUS_H +#define PRBCTRLSTATUS_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define PROBE_A_DETECTION_MASK 0x00000001 +#define PROBE_B_DETECTION_MASK 0x00000002 +#define PROBE_C_DETECTION_MASK 0x00000004 +#define PROBE_D_DETECTION_MASK 0x00000008 +#define PROBE_DIP_SWITCH_ID_MASK 0x000000F0 + +#define BAR 0 +#define OFFSET 0X26088 + +class PrbCtrlStatus : public Register +{ +public: + Field* probeADetection; + Field* probeBDetection; + Field* probeCDetection; + Field* probeDDetection; + Field* probeDipSwitchId; + + PrbCtrlStatus(SonoDevice* device) : Register(BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(probeADetection, PROBE_A_DETECTION_MASK); + ADD_UNSIGNED_FIELD(probeBDetection, PROBE_B_DETECTION_MASK); + ADD_UNSIGNED_FIELD(probeCDetection, PROBE_C_DETECTION_MASK); + ADD_UNSIGNED_FIELD(probeDDetection, PROBE_D_DETECTION_MASK); + ADD_UNSIGNED_FIELD(probeDipSwitchId, PROBE_DIP_SWITCH_ID_MASK); + } +}; + +#undef PROBE_A_DETECTION_MASK +#undef PROBE_B_DETECTION_MASK +#undef PROBE_C_DETECTION_MASK +#undef PROBE_D_DETECTION_MASK +#undef PROBE_DIP_SWITCH_ID_MASK + +#undef BAR +#undef OFFSET + +#endif diff --git a/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/probe/PrbEepromRwReq.h b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/probe/PrbEepromRwReq.h new file mode 100644 index 0000000..e474925 --- /dev/null +++ b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/probe/PrbEepromRwReq.h @@ -0,0 +1,46 @@ +#ifndef PRBEEPROMRWREQ_H +#define PRBEEPROMRWREQ_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define PRB_EEPROM_DATA_IN_MASK 0x000000FF +#define PRB_EEPROM_ADDRESS_MASK 0x01FFFF00 +#define PRB_EEPROM_PROBE_SEL_MASK 0x06000000 +#define PRB_EEPROM_RD_REQ_MASK 0x40000000 +#define PRB_EEPROM_WR_REQ_MASK 0x80000000 + +#define BAR 0 +#define OFFSET 0X2600C + +class PrbEepromRwReq : public Register +{ +public: + Field* dataIn; + Field* address; + Field* prbSel; + Field* rdReq; + Field* wrReq; + + PrbEepromRwReq(SonoDevice* device) : Register(BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(dataIn, PRB_EEPROM_DATA_IN_MASK); + ADD_UNSIGNED_FIELD(address, PRB_EEPROM_ADDRESS_MASK); + ADD_UNSIGNED_FIELD(prbSel, PRB_EEPROM_PROBE_SEL_MASK); + ADD_UNSIGNED_FIELD(rdReq, PRB_EEPROM_RD_REQ_MASK); + ADD_UNSIGNED_FIELD(wrReq, PRB_EEPROM_WR_REQ_MASK); + } +}; + +#undef PRB_EEPROM_DATA_IN_MASK +#undef PRB_EEPROM_ADDRESS_MASK +#undef PRB_EEPROM_PROBE_SEL_MASK +#undef PRB_EEPROM_RD_REQ_MASK +#undef PRB_EEPROM_WR_REQ_MASK + +#undef BAR +#undef OFFSET + +#endif // PROBEEEPROMRWREQ_H diff --git a/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/probe/PrbEepromRwStatus.h b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/probe/PrbEepromRwStatus.h new file mode 100644 index 0000000..02ea4ba --- /dev/null +++ b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/probe/PrbEepromRwStatus.h @@ -0,0 +1,42 @@ +#ifndef PRBEEPROMRWSTATUS_H +#define PRBEEPROMRWSTATUS_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define PRB_EEPROM_REQ_DONE_MASK 0x00000001 +#define PRB_EEPROM_REQ_ERROR_MASK 0x00000002 +#define PRB_EEPROM_BUSY_MASK 0x00000004 +#define PRB_EEPROM_DATA_OUT_MASK 0x0000FF00 + +#define BAR 0 +#define OFFSET 0X2604C + +class PrbEepromRwStatus : public Register +{ +public: + Field* reqDone; + Field* reqError; + Field* busy; + Field* dataOut; + + PrbEepromRwStatus(SonoDevice* device) : Register(BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(reqDone, PRB_EEPROM_REQ_DONE_MASK); + ADD_UNSIGNED_FIELD(reqError,PRB_EEPROM_REQ_ERROR_MASK); + ADD_UNSIGNED_FIELD(busy, PRB_EEPROM_BUSY_MASK); + ADD_UNSIGNED_FIELD(dataOut, PRB_EEPROM_DATA_OUT_MASK); + } +}; + +#undef PRB_EEPROM_REQ_DONE_MASK +#undef PRB_EEPROM_REQ_ERROR_MASK +#undef PRB_EEPROM_BUSY_MASK +#undef PRB_EEPROM_DATA_OUT_MASK + +#undef BAR +#undef OFFSET + +#endif // PROBEEEPROMRWSTATUS_H diff --git a/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/Adc12Vin.h b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/Adc12Vin.h new file mode 100644 index 0000000..73d7d37 --- /dev/null +++ b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/Adc12Vin.h @@ -0,0 +1,30 @@ +#ifndef ADC12VIN_H +#define ADC12VIN_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define CHANNEL0_MON_MASK 0x00000FFF + +#define BAR 0 +#define OFFSET 0X26068 + +class Adc12Vin : public Register +{ +public: + Field* channel0Mon; + + Adc12Vin(SonoDevice* device) : Register(BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(channel0Mon, CHANNEL0_MON_MASK); + } +}; + +#undef CHANNEL0_MON_MASK + +#undef BAR +#undef OFFSET + +#endif diff --git a/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/Adc3P3V.h b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/Adc3P3V.h new file mode 100644 index 0000000..0e9b75f --- /dev/null +++ b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/Adc3P3V.h @@ -0,0 +1,30 @@ +#ifndef ADC3P3V_H +#define ADC3P3V_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define CHANNEL5_MON_MASK 0x00000FFF + +#define BAR 0 +#define OFFSET 0X26070 + +class Adc3P3V : public Register +{ +public: + Field* channel5Mon; + + Adc3P3V(SonoDevice* device) : Register(BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(channel5Mon, CHANNEL5_MON_MASK); + } +}; + +#undef CHANNEL5_MON_MASK + +#undef BAR +#undef OFFSET + +#endif diff --git a/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/Adc5Vin.h b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/Adc5Vin.h new file mode 100644 index 0000000..ed1b99e --- /dev/null +++ b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/Adc5Vin.h @@ -0,0 +1,30 @@ +#ifndef ADC5VIN_H +#define ADC5VIN_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define CHANNEL1_MON_MASK 0x00000FFF + +#define BAR 0 +#define OFFSET 0X2606C + +class Adc5Vin : public Register +{ +public: + Field* channel1Mon; + + Adc5Vin(SonoDevice* device) : Register(BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(channel1Mon, CHANNEL1_MON_MASK); + } +}; + +#undef CHANNEL1_MON_MASK + +#undef BAR +#undef OFFSET + +#endif diff --git a/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/AdcAfeA1P8V.h b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/AdcAfeA1P8V.h new file mode 100644 index 0000000..85172df --- /dev/null +++ b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/AdcAfeA1P8V.h @@ -0,0 +1,30 @@ +#ifndef ADCAFEA1P8V_H +#define ADCAFEA1P8V_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define CHANNEL6_MON_MASK 0x00000FFF + +#define BAR 0 +#define OFFSET 0X26074 + +class AdcAfeA1P8V : public Register +{ +public: + Field* channel6Mon; + + AdcAfeA1P8V(SonoDevice* device) : Register(BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(channel6Mon, CHANNEL6_MON_MASK); + } +}; + +#undef CHANNEL6_MON_MASK + +#undef BAR +#undef OFFSET + +#endif diff --git a/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/AdcAfeD1P8V.h b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/AdcAfeD1P8V.h new file mode 100644 index 0000000..60796bf --- /dev/null +++ b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/AdcAfeD1P8V.h @@ -0,0 +1,30 @@ +#ifndef ADCAFED1P8V_H +#define ADCAFED1P8V_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define CHANNEL7_MON_MASK 0x00000FFF + +#define BAR 0 +#define OFFSET 0X26078 + +class AdcAfeD1P8V : public Register +{ +public: + Field* channel7Mon; + + AdcAfeD1P8V(SonoDevice* device) : Register(BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(channel7Mon, CHANNEL7_MON_MASK); + } +}; + +#undef CHANNEL7_MON_MASK + +#undef BAR +#undef OFFSET + +#endif diff --git a/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/AdcAfeVcntlp.h b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/AdcAfeVcntlp.h new file mode 100644 index 0000000..826f268 --- /dev/null +++ b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/AdcAfeVcntlp.h @@ -0,0 +1,30 @@ +#ifndef ADCAFEVCNTLP_H +#define ADCAFEVCNTLP_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define CHANNEL4_MON_MASK 0x00000FFF + +#define BAR 0 +#define OFFSET 0X2607C + +class AdcAfeVcntlp : public Register +{ +public: + Field* channel4Mon; + + AdcAfeVcntlp(SonoDevice* device) : Register(BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(channel4Mon, CHANNEL4_MON_MASK); + } +}; + +#undef CHANNEL4_MON_MASK + +#undef BAR +#undef OFFSET + +#endif diff --git a/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/AdcPrbCtrl3P3V.h b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/AdcPrbCtrl3P3V.h new file mode 100644 index 0000000..ff3713d --- /dev/null +++ b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/AdcPrbCtrl3P3V.h @@ -0,0 +1,30 @@ +#ifndef ADCPRBCTRL3P3V_H +#define ADCPRBCTRL3P3V_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define CHANNEL3_MON_MASK 0x00000FFF + +#define BAR 0 +#define OFFSET 0X26084 + +class AdcPrbCtrl3P3V : public Register +{ +public: + Field* channel3Mon; + + AdcPrbCtrl3P3V(SonoDevice* device) : Register(BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(channel3Mon, CHANNEL3_MON_MASK); + } +}; + +#undef CHANNEL3_MON_MASK + +#undef BAR +#undef OFFSET + +#endif diff --git a/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/AdcPrbZeroEncoder.h b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/AdcPrbZeroEncoder.h new file mode 100644 index 0000000..f3d2dd3 --- /dev/null +++ b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/AdcPrbZeroEncoder.h @@ -0,0 +1,30 @@ +#ifndef ADCPRBZEROENCODER_H +#define ADCPRBZEROENCODER_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define CHANNEL2_MON_MASK 0x00000FFF + +#define BAR 0 +#define OFFSET 0X26080 + +class AdcPrbZeroEncoder : public Register +{ +public: + Field* channel2Mon; + + AdcPrbZeroEncoder(SonoDevice* device) : Register(BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(channel2Mon, CHANNEL2_MON_MASK); + } +}; + +#undef CHANNEL2_MON_MASK + +#undef BAR +#undef OFFSET + +#endif diff --git a/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/OnBoardTempSensor.h b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/OnBoardTempSensor.h new file mode 100644 index 0000000..fa2dcde --- /dev/null +++ b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/OnBoardTempSensor.h @@ -0,0 +1,30 @@ +#ifndef ONBOARDTEMPSENSOR_H +#define ONBOARDTEMPSENSOR_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define TEMPERATURE_MASK 0x000007FF + +#define BAR 0 +#define OFFSET 0X26064 + +class OnBoardTempSensor : public Register +{ +public: + Field* temperature; + + OnBoardTempSensor(SonoDevice* device) : Register(BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(temperature, TEMPERATURE_MASK); + } +}; + +#undef TEMPERATURE_MASK + +#undef BAR +#undef OFFSET + +#endif diff --git a/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/PcieId.h b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/PcieId.h new file mode 100644 index 0000000..2a03fff --- /dev/null +++ b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/PcieId.h @@ -0,0 +1,34 @@ +#ifndef PCIEID_H +#define PCIEID_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define PID_MASK 0xFFFF0000 +#define VID_MASK 0x0000FFFF + +#define BAR 2 +#define OFFSET 0 + +class PcieId : public Register +{ +public: + Field* pid; + Field* vid; + + PcieId(SonoDevice* device) : Register(BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(pid, PID_MASK); + ADD_UNSIGNED_FIELD(vid, VID_MASK); + } +}; + +#undef PID_MASK +#undef VID_MASK + +#undef BAR +#undef OFFSET + +#endif diff --git a/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/TrxEepromRwReq.h b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/TrxEepromRwReq.h new file mode 100644 index 0000000..199bf26 --- /dev/null +++ b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/TrxEepromRwReq.h @@ -0,0 +1,46 @@ +#ifndef TRXEEPROMRWREQ_H +#define TRXEEPROMRWREQ_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define TRX_EEPROM_DATA_IN_MASK 0x000000FF +#define TRX_EEPROM_ADDRESS_MASK 0x01FFFF00 +#define PRB_EEPROM_PROBE_SEL_MASK 0x06000000 // actually reserved +#define TRX_EEPROM_RD_REQ_MASK 0x40000000 +#define TRX_EEPROM_WR_REQ_MASK 0x80000000 + +#define BAR 0 +#define OFFSET 0X26000 + +class TrxEepromRwReq : public Register +{ +public: + Field* dataIn; + Field* address; + Field* prbSel; + Field* rdReq; + Field* wrReq; + + TrxEepromRwReq(SonoDevice* device) : Register(BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(dataIn, TRX_EEPROM_DATA_IN_MASK); + ADD_UNSIGNED_FIELD(address, TRX_EEPROM_ADDRESS_MASK); + ADD_UNSIGNED_FIELD(prbSel, PRB_EEPROM_PROBE_SEL_MASK); + ADD_UNSIGNED_FIELD(rdReq, TRX_EEPROM_RD_REQ_MASK); + ADD_UNSIGNED_FIELD(wrReq, TRX_EEPROM_WR_REQ_MASK); + } +}; + +#undef TRX_EEPROM_DATA_IN_MASK +#undef TRX_EEPROM_ADDRESS_MASK +#undef PRB_EEPROM_PROBE_SEL_MASK +#undef TRX_EEPROM_RD_REQ_MASK +#undef TRX_EEPROM_WR_REQ_MASK + +#undef BAR +#undef OFFSET + +#endif // TRXEEPROMRWREQ_H diff --git a/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/TrxEepromRwStatus.h b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/TrxEepromRwStatus.h new file mode 100644 index 0000000..59e0639 --- /dev/null +++ b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/TrxEepromRwStatus.h @@ -0,0 +1,42 @@ +#ifndef TRXEEPROMRWSTATUS_H +#define TRXEEPROMRWSTATUS_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define TRX_EEPROM_REQ_DONE_MASK 0x00000001 +#define TRX_EEPROM_REQ_ERROR_MASK 0x00000002 +#define TRX_EEPROM_BUSY_MASK 0x00000004 +#define TRX_EEPROM_DATA_OUT_MASK 0x0000FF00 + +#define BAR 0 +#define OFFSET 0X26044 + +class TrxEepromRwStatus : public Register +{ +public: + Field* reqDone; + Field* reqError; + Field* busy; + Field* dataOut; + + TrxEepromRwStatus(SonoDevice* device) : Register(BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(reqDone, TRX_EEPROM_REQ_DONE_MASK); + ADD_UNSIGNED_FIELD(reqError,TRX_EEPROM_REQ_ERROR_MASK); + ADD_UNSIGNED_FIELD(busy, TRX_EEPROM_BUSY_MASK); + ADD_UNSIGNED_FIELD(dataOut, TRX_EEPROM_DATA_OUT_MASK); + } +}; + +#undef TRX_EEPROM_REQ_DONE_MASK +#undef TRX_EEPROM_REQ_ERROR_MASK +#undef TRX_EEPROM_BUSY_MASK +#undef TRX_EEPROM_DATA_OUT_MASK + +#undef BAR +#undef OFFSET + +#endif // TRXEEPROMRWSTATUS_H diff --git a/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/TrxRegulatorPg.h b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/TrxRegulatorPg.h new file mode 100644 index 0000000..8e2dc23 --- /dev/null +++ b/include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/TrxRegulatorPg.h @@ -0,0 +1,34 @@ +#ifndef TRXREGULATORPG_H +#define TRXREGULATORPG_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define REG_A_MASK 0x00000001 +#define REG_B_MASK 0x00000002 + +#define BAR 0 +#define OFFSET 0X26060 + +class TrxRegulatorPg : public Register +{ +public: + Field* regA; + Field* regB; + + TrxRegulatorPg(SonoDevice* device) : Register(BAR, OFFSET, device) + { + ADD_BIT_FIELD(regA, REG_A_MASK); + ADD_BIT_FIELD(regB, REG_B_MASK); + } +}; + +#undef REG_A_MASK +#undef REG_B_MASK + +#undef BAR +#undef OFFSET + +#endif diff --git a/include/model/hardware/core/register/bpiFlash/BpiFlash.h b/include/model/hardware/core/register/bpiFlash/BpiFlash.h new file mode 100644 index 0000000..359eb3d --- /dev/null +++ b/include/model/hardware/core/register/bpiFlash/BpiFlash.h @@ -0,0 +1,21 @@ +#ifndef BPIFLASH_H +#define BPIFLASH_H + +#include "registerDefinition/McsRdWr.h" + +class BpiFlash +{ +private: + McsRdWr* _mcsRdWr; + +public: + explicit BpiFlash(SonoDevice* device); + ~BpiFlash(); + + void writeMcs (QByteArray& mcs) const; + void readMcs (QList* mcs) const; + + +}; + +#endif // BPIFLASH_H diff --git a/include/model/hardware/core/register/bpiFlash/registerDefinition/McsRdWr.h b/include/model/hardware/core/register/bpiFlash/registerDefinition/McsRdWr.h new file mode 100644 index 0000000..95ee81c --- /dev/null +++ b/include/model/hardware/core/register/bpiFlash/registerDefinition/McsRdWr.h @@ -0,0 +1,50 @@ +#ifndef MCSRDWR_H +#define MCSRDWR_H + +#include "model/hardware/core/register/RegisterChain.h" +//#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define MASTER_MCS_DATA_MASK 0xFFFFFFFF + +#define BAR 1U +#define OFFSET 0X8000000 +#define MCS_FILE_SIZE 27*1024*1024 // now and must be modified + +class McsRdWr : public RegisterChain +{ +private: + QList _mcsListWr; + + void prepareData(quint32 index) override + { + masterMcsData->setValue(_mcsListWr.at(static_cast(index))); + } + +public: + Field* masterMcsData; + QList mcsListRd; + + void mcsWrite (QList& mcsList) { + _mcsListWr = mcsList; + } + + //void receiveData (void) override +// { +// mcsListRd.append(masterMcsData->getValue()); +// } + + McsRdWr(SonoDevice* device) : RegisterChain(BAR, OFFSET, device, MCS_FILE_SIZE) + { + ADD_UNSIGNED_FIELD(masterMcsData, MASTER_MCS_DATA_MASK); + } +}; + +#undef MASTER_MCS_DATA_MASK + +#undef BAR +#undef OFFSET + +#endif // MCSRDWR_H diff --git a/include/model/hardware/core/register/builtInTest/BuiltInTest.h b/include/model/hardware/core/register/builtInTest/BuiltInTest.h new file mode 100644 index 0000000..5db46f3 --- /dev/null +++ b/include/model/hardware/core/register/builtInTest/BuiltInTest.h @@ -0,0 +1,41 @@ +#ifndef BUILTINTEST_H +#define BUILTINTEST_H + +#include "registerDefinition/BiteDacMemory.h" +#include "registerDefinition/BiteDacMemoryCmd.h" +#include "registerDefinition/BiteDacOutputSelect.h" + +class BuiltInTest +{ +private: + BiteDacMemory* _dacMemory; + BiteDacMemoryCmd* _dacCmd; + BiteDacOutputSelect* _dacOutput; + + struct BiteOutputSelect + { + bool dacIN; + bool dacIP; + bool dacQN; + bool dacQP; + }*_dacOutputSelect; + + struct BiteMemoryCmd + { + bool command; + quint8 interval; + }*_dacMemoryCmd; + + void setDacOutputSelect (BiteOutputSelect* _outputSelect) const; + void setDacMemoryCmd (BiteMemoryCmd* _memoryCmd) const; + +public: + explicit BuiltInTest(SonoDevice* device); + ~BuiltInTest(); + + void biteDacMemoryWrite (TxDacMemory* txDacMem) const; + void biteDacEnable(quint8 biteInterval, bool cmd) const; + +}; + +#endif // BUILTINTEST_H diff --git a/include/model/hardware/core/register/builtInTest/registerDefinition/BiteDacMemory.h b/include/model/hardware/core/register/builtInTest/registerDefinition/BiteDacMemory.h new file mode 100644 index 0000000..bc7733c --- /dev/null +++ b/include/model/hardware/core/register/builtInTest/registerDefinition/BiteDacMemory.h @@ -0,0 +1,57 @@ +#ifndef BITEDACMEMORY_H +#define BITEDACMEMORY_H + +#include "model/hardware/core/register/RegisterChain.h" +//#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define TxDAC_I_DATA_MASK 0x000000FF +#define TxDAC_Q_DATA_MASK 0x0000FF00 + +#define BAR 0U +#define OFFSET 0XE000 +#define LENGTH 2048U + +struct TxDacMemory +{ + QList _iData; + QList _qData; +}; + + +class BiteDacMemory : public RegisterChain +{ +private: + TxDacMemory* _txDacMem; + void prepareData(quint32 index) override + { + txDacIData->setValue(_txDacMem->_iData.at(static_cast(index))); + txDacQData->setValue(_txDacMem->_qData.at(static_cast(index))); + } + +public: + Field* txDacIData; + Field* txDacQData; + + void setTxDacMemory(TxDacMemory* txDacMem) + { + _txDacMem = txDacMem; + } + + BiteDacMemory(SonoDevice* device) : RegisterChain(BAR, OFFSET, device, LENGTH) + { + ADD_UNSIGNED_FIELD(txDacIData, TxDAC_I_DATA_MASK); + ADD_UNSIGNED_FIELD(txDacQData, TxDAC_Q_DATA_MASK); + } +}; + +#undef TxDAC_I_DATA_MASK +#undef TxDAC_Q_DATA_MASK + +#undef BAR +#undef OFFSET +#undef LENGTH + +#endif // BITEDACMEMORY_H diff --git a/include/model/hardware/core/register/builtInTest/registerDefinition/BiteDacMemoryCmd.h b/include/model/hardware/core/register/builtInTest/registerDefinition/BiteDacMemoryCmd.h new file mode 100644 index 0000000..450ec1d --- /dev/null +++ b/include/model/hardware/core/register/builtInTest/registerDefinition/BiteDacMemoryCmd.h @@ -0,0 +1,35 @@ +#ifndef BITEDACMEMORYCMD_H +#define BITEDACMEMORYCMD_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define START_STOP_MASK 0x00000001 +#define BITE_INTERVAL_MASK 0x0000FF00 + +#define BAR 0U +#define OFFSET 0X10000 + +class BiteDacMemoryCmd : public Register +{ +public: + Field* startStop; + Field* biteInterval; + + BiteDacMemoryCmd(SonoDevice* device) : Register(BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(biteInterval, BITE_INTERVAL_MASK); + ADD_UNSIGNED_FIELD(startStop, START_STOP_MASK); + } +}; + + +#undef START_STOP_MASK +#undef BITE_INTERVAL_MASK + +#undef BAR +#undef OFFSET + +#endif diff --git a/include/model/hardware/core/register/builtInTest/registerDefinition/BiteDacOutputSelect.h b/include/model/hardware/core/register/builtInTest/registerDefinition/BiteDacOutputSelect.h new file mode 100644 index 0000000..01e1303 --- /dev/null +++ b/include/model/hardware/core/register/builtInTest/registerDefinition/BiteDacOutputSelect.h @@ -0,0 +1,42 @@ +#ifndef BITEDACOUTPUTSELECT_H +#define BITEDACOUTPUTSELECT_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define DAC_I_N_MASK 0x00000001 +#define DAC_I_P_MASK 0x00000002 +#define DAC_Q_N_MASK 0x00000004 +#define DAC_Q_P_MASK 0x00000008 + +#define BAR 0U +#define OFFSET 0X10004 + +class BiteDacOutputSelect : public Register +{ +public: + Field* dacIN; + Field* dacIP; + Field* dacQN; + Field* dacQP; + + BiteDacOutputSelect(SonoDevice* device) : Register(BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(dacIN, DAC_I_N_MASK); + ADD_UNSIGNED_FIELD(dacIP, DAC_I_P_MASK); + ADD_UNSIGNED_FIELD(dacQN, DAC_Q_N_MASK); + ADD_UNSIGNED_FIELD(dacQP, DAC_Q_P_MASK); + } +}; + +#undef DAC_I_N_MASK +#undef DAC_I_P_MASK +#undef DAC_Q_N_MASK +#undef DAC_Q_P_MASK + +#undef BAR +#undef OFFSET + +#endif diff --git a/include/model/hardware/core/register/clockDistributer/ClockDistributer.h b/include/model/hardware/core/register/clockDistributer/ClockDistributer.h new file mode 100644 index 0000000..f8410b9 --- /dev/null +++ b/include/model/hardware/core/register/clockDistributer/ClockDistributer.h @@ -0,0 +1,50 @@ +#ifndef CLOCKDISTRIBUTER_H +#define CLOCKDISTRIBUTER_H + +#include "registerDefinition/CwModeEnable.h" +#include "registerDefinition/CwModeStatus.h" +#include "registerDefinition/ClkDistributionId.h" + + +enum eClkMode : bool +{ + Normal=false, + Cw=true, +}; + +class ClockDistributer +{ +private: + + const quint8 _clockDistrId; + + CwModeEnable* _cwEnable; + ClkDistributionId* _clkDistrId; + + struct ModeEnable + { + quint32 cwClkDivision; + bool cwClkEnable; + bool spiClkDistStart; + }*_cwModeEnable; + + struct ModeStatus + { + CwModeStatus* _cwStatus; + bool getSpiClkDistDone(void) const; + bool getSpiClkDistBusy(void) const; + bool getEepromClkDistDone(void) const; + }_cwModeStatus; + + void setCwModeEnable(ModeEnable*); + bool connectionCheck(void) const; + +public: + explicit ClockDistributer(SonoDevice* device); + ~ClockDistributer(); + + void clockMode (quint32 clkDiv, eClkMode mode); + +}; + +#endif // CLOCKDISTRIBUTER_H diff --git a/include/model/hardware/core/register/clockDistributer/registerDefinition/ClkDistributionId.h b/include/model/hardware/core/register/clockDistributer/registerDefinition/ClkDistributionId.h new file mode 100644 index 0000000..344546d --- /dev/null +++ b/include/model/hardware/core/register/clockDistributer/registerDefinition/ClkDistributionId.h @@ -0,0 +1,30 @@ +#ifndef CLKDISTRIBUTIONID_H +#define CLKDISTRIBUTIONID_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define PART_ID_MASK 0x000000FF + +#define BAR 0U +#define OFFSET 0X800C + +class ClkDistributionId : public Register +{ +public: + Field* partId; + + ClkDistributionId(SonoDevice* device) : Register (BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(partId, PART_ID_MASK); + } +}; + +#undef PART_ID_MASK + +#undef BAR +#undef OFFSET + +#endif // CLKDISTRIBUTIONID_H diff --git a/include/model/hardware/core/register/clockDistributer/registerDefinition/CwModeEnable.h b/include/model/hardware/core/register/clockDistributer/registerDefinition/CwModeEnable.h new file mode 100644 index 0000000..c5ec3c9 --- /dev/null +++ b/include/model/hardware/core/register/clockDistributer/registerDefinition/CwModeEnable.h @@ -0,0 +1,38 @@ +#ifndef CWMODEENABLE_H +#define CWMODEENABLE_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define SPI_CLK_DIST_START_MASK 0x00000001 +#define CW_CLK_EN_MASK 0x00000002 +#define CW_CLK_DIVISION_MASK 0x0000003C + +#define BAR 0U +#define OFFSET 0XAC10 + +class CwModeEnable : public Register +{ +public: + Field* spiClkDistStart; + Field* cwClkEn; + Field* cwClkdivision; + + CwModeEnable(SonoDevice* device) : Register(BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(spiClkDistStart, SPI_CLK_DIST_START_MASK); + ADD_UNSIGNED_FIELD(cwClkEn, CW_CLK_EN_MASK); + ADD_UNSIGNED_FIELD(cwClkdivision, CW_CLK_DIVISION_MASK); + } +}; + +#undef SPI_CLK_DIST_START_MASK +#undef CW_CLK_EN_MASK +#undef CW_CLK_DIVISION_MASK + +#undef BAR +#undef OFFSET + +#endif // CWMODEENABLE_H diff --git a/include/model/hardware/core/register/clockDistributer/registerDefinition/CwModeStatus.h b/include/model/hardware/core/register/clockDistributer/registerDefinition/CwModeStatus.h new file mode 100644 index 0000000..59303c6 --- /dev/null +++ b/include/model/hardware/core/register/clockDistributer/registerDefinition/CwModeStatus.h @@ -0,0 +1,38 @@ +#ifndef CWMODESTATUS_H +#define CWMODESTATUS_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define SPI_CLK_DIST_DONE_MASK 0x00000001 +#define SPI_CLK_DIST_BUSY_MASK 0x00000002 +#define EEPROM_CLK_DIST_DONE_MASK 0x00000004 + +#define BAR 0U +#define OFFSET 0XAC1C + +class CwModeStatus : public Register +{ +public: + Field* spiClkDistDone; + Field* spiClkDistBusy; + Field* eepromClkDistDone; + + CwModeStatus(SonoDevice* device) : Register(BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(spiClkDistDone, SPI_CLK_DIST_DONE_MASK); + ADD_UNSIGNED_FIELD(spiClkDistBusy, SPI_CLK_DIST_BUSY_MASK); + ADD_UNSIGNED_FIELD(eepromClkDistDone, EEPROM_CLK_DIST_DONE_MASK); + } +}; + +#undef SPI_CLK_DIST_DONE_MASK +#undef SPI_CLK_DIST_BUSY_MASK +#undef EEPROM_CLK_DIST_DONE_MASK + +#undef BAR +#undef OFFSET + +#endif // CWMODESTATUS_H diff --git a/include/model/hardware/core/register/dsp/Dsp.h b/include/model/hardware/core/register/dsp/Dsp.h new file mode 100644 index 0000000..6a5a6a7 --- /dev/null +++ b/include/model/hardware/core/register/dsp/Dsp.h @@ -0,0 +1,52 @@ +#ifndef DSP_H +#define DSP_H + +#include "registerDefinition/ReceiverConfigurationLut.h" +#include "registerDefinition/LineFilterCoefficient.h" +#include "registerDefinition/StbCoefficient.h" +#include "registerDefinition/FrequencyLut.h" +#include "registerDefinition/BlendWeight.h" +#include "registerDefinition/ManualAtgc.h" +#include "registerDefinition/DtgcLut.h" +#include "registerDefinition/AtgcLut.h" +#include "registerDefinition/LpfLut.h" + +#define BLEND_WEIGHT_OFFSET 0x800 +#define ATGC_OFFSET 0x400 +#define LPF_OFFSET 0x400 + +enum eAtgcMode : bool +{ + Auto=false, + Manual=true, +}; + +class Dsp +{ +private: + ReceiverConfigurationLut* _configLut; + LineFilterCoefficient* _lineFilterLut; + StbCoefficient* _stbLut; + FrequencyLut* _freqLut; + BlendWeight* _blendWeight; + ManualAtgc* _manualAtgc; + DtgcLut* _dtgcLut; + AtgcLut* _atgcLut; + LpfLut* _lpfLut; + +public: + explicit Dsp(SonoDevice* device); + ~Dsp(); + + void receiverConfigurationLut (ReceiverConfiguration* configLut) const; + void lineFilterCoefficient (QList& lineFilterLut) const; + void stbCoefficient (QList& stbLut) const; + void frequencyLut (QList& freqLut) const; + void blendWeight (QList>& blendWeight) const; + void atgcMode (eAtgcMode mode, quint16 value) const; + void dtgcLut (QList& dtgcLut) const; + void atgcLut (QList>& atgcLut) const; + void lpfLut (QList>& lpfLut) const; + +}; +#endif // DSP_H diff --git a/include/model/hardware/core/register/dsp/registerDefinition/AtgcLut.h b/include/model/hardware/core/register/dsp/registerDefinition/AtgcLut.h new file mode 100644 index 0000000..8494867 --- /dev/null +++ b/include/model/hardware/core/register/dsp/registerDefinition/AtgcLut.h @@ -0,0 +1,45 @@ +#ifndef ATGCLUT_H +#define ATGCLUT_H + +#include "model/hardware/core/register/RegisterChain.h" +//#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define ATGC_LUT_MASK 0x00000FFF + +#define BAR 0 +#define OFFSET 0x85000 +#define LENGTH 256U + +class AtgcLut : public RegisterChain +{ +private: + QList _atgcLut; + + void prepareData(quint32 index) override + { + atgcLut->setValue(_atgcLut.at(static_cast(index))); + } + +public: + Field* atgcLut; + + void setAtgcLut (QList& atgcLut) { + _atgcLut = atgcLut; + } + + AtgcLut(SonoDevice* device) : RegisterChain(BAR, OFFSET, device, LENGTH) + { + ADD_UNSIGNED_FIELD(atgcLut, ATGC_LUT_MASK); + } +}; + +#undef ATGC_LUT_MASK + +#undef BAR +#undef OFFSET +#undef LENGTH + +#endif // ATGCLUT_H diff --git a/include/model/hardware/core/register/dsp/registerDefinition/BlendWeight.h b/include/model/hardware/core/register/dsp/registerDefinition/BlendWeight.h new file mode 100644 index 0000000..66058b8 --- /dev/null +++ b/include/model/hardware/core/register/dsp/registerDefinition/BlendWeight.h @@ -0,0 +1,45 @@ +#ifndef BLENDWEIGHT_H +#define BLENDWEIGHT_H + +#include "model/hardware/core/register/RegisterChain.h" +//#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define BLEND_WEIGHT_MASK 0x000001FF + +#define BAR 0 +#define OFFSET 0x82000 +#define LENGTH 512U + +class BlendWeight : public RegisterChain +{ +private: + QList _blendWeight; + + void prepareData(quint32 index) override + { + blendWeight->setValue(_blendWeight.at(static_cast(index))); + } + +public: + Field* blendWeight; + + void setBlendWeight (QList& blendWeight) { + _blendWeight = blendWeight; + } + + BlendWeight(SonoDevice* device) : RegisterChain(BAR, OFFSET, device, LENGTH) + { + ADD_UNSIGNED_FIELD(blendWeight, BLEND_WEIGHT_MASK); + } +}; + +#undef BLEND_WEIGHT_MASK + +#undef BAR +#undef OFFSET +#undef LENGTH + +#endif // BLENDWEIGHT_H diff --git a/include/model/hardware/core/register/dsp/registerDefinition/DtgcLut.h b/include/model/hardware/core/register/dsp/registerDefinition/DtgcLut.h new file mode 100644 index 0000000..5dadf29 --- /dev/null +++ b/include/model/hardware/core/register/dsp/registerDefinition/DtgcLut.h @@ -0,0 +1,45 @@ +#ifndef DTGCLUT_H +#define DTGCLUT_H + +#include "model/hardware/core/register/RegisterChain.h" +//#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define DTGC_LUT_MASK 0x00000FFF + +#define BAR 0 +#define OFFSET 0X84000 +#define LENGTH 1024U + +class DtgcLut : public RegisterChain +{ +private: + QList _dtLut; + + void prepareData(quint32 index) override + { + dtgcLut->setValue(_dtLut.at(static_cast(index))); + } + +public: + Field* dtgcLut; + + void setDtgcLut (QList& dtLut) { + _dtLut = dtLut; + } + + DtgcLut(SonoDevice* device) : RegisterChain(BAR, OFFSET, device, LENGTH) + { + ADD_UNSIGNED_FIELD(dtgcLut, DTGC_LUT_MASK); + } +}; + +#undef DTGC_LUT_MASK + +#undef BAR +#undef OFFSET +#undef LENGTH + +#endif // DTGCLUT_H diff --git a/include/model/hardware/core/register/dsp/registerDefinition/FrequencyLut.h b/include/model/hardware/core/register/dsp/registerDefinition/FrequencyLut.h new file mode 100644 index 0000000..be5c66a --- /dev/null +++ b/include/model/hardware/core/register/dsp/registerDefinition/FrequencyLut.h @@ -0,0 +1,45 @@ +#ifndef FREQUENCYLUT_H +#define FREQUENCYLUT_H + +#include "model/hardware/core/register/RegisterChain.h" +//#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define FREQ_LUT_MASK 0x00FFFFFF + +#define BAR 0 +#define OFFSET 0X80800 +#define LENGTH 8U + +class FrequencyLut : public RegisterChain +{ +private: + QList _fLut; + + void prepareData(quint32 index) override + { + freqLut->setValue(_fLut.at(static_cast(index))); + } + +public: + Field* freqLut; + + void setFreqLut (QList& fLut) { + _fLut = fLut; + } + + FrequencyLut(SonoDevice* device) : RegisterChain(BAR, OFFSET, device, LENGTH) + { + ADD_UNSIGNED_FIELD(freqLut, FREQ_LUT_MASK); + } +}; + +#undef FREQ_LUT_MASK + +#undef BAR +#undef OFFSET +#undef LENGTH + +#endif // FREQUENCYLUT_H diff --git a/include/model/hardware/core/register/dsp/registerDefinition/LineFilterCoefficient.h b/include/model/hardware/core/register/dsp/registerDefinition/LineFilterCoefficient.h new file mode 100644 index 0000000..5b91fac --- /dev/null +++ b/include/model/hardware/core/register/dsp/registerDefinition/LineFilterCoefficient.h @@ -0,0 +1,50 @@ +#ifndef LINEFILTERCOEFFICIENT_H +#define LINEFILTERCOEFFICIENT_H + +#include "model/hardware/core/register/RegisterChain.h" +//#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define LINE_FILTER_LUT_EVEN_MASK 0x000001FF +#define LINE_FILTER_LUT_ODD_MASK 0x01FF0000 + +#define BAR 0 +#define OFFSET 0x86010 +#define LENGTH 2U // 4/2 + +class LineFilterCoefficient : public RegisterChain +{ +private: + QList _lineFilterLut; + + void prepareData(quint32 index) override + { + lineFilterLutEven->setValue(_lineFilterLut.at(static_cast(index*2))); + lineFilterLutOdd ->setValue(_lineFilterLut.at(static_cast(index*2 + 1))); + } + +public: + Field* lineFilterLutEven; + Field* lineFilterLutOdd; + + void setLineFilterLut (QList& lineFilterLut) { + _lineFilterLut = lineFilterLut; + } + + LineFilterCoefficient(SonoDevice* device) : RegisterChain(BAR, OFFSET, device, LENGTH) + { + ADD_UNSIGNED_FIELD(lineFilterLutEven, LINE_FILTER_LUT_EVEN_MASK); + ADD_UNSIGNED_FIELD(lineFilterLutOdd , LINE_FILTER_LUT_ODD_MASK ); + } +}; + +#undef LINE_FILTER_LUT_EVEN_MASK +#undef LINE_FILTER_LUT_ODD_MASK + +#undef BAR +#undef OFFSET +#undef LENGTH + +#endif // LINEFILTERCOEFFICIENT_H diff --git a/include/model/hardware/core/register/dsp/registerDefinition/LpfLut.h b/include/model/hardware/core/register/dsp/registerDefinition/LpfLut.h new file mode 100644 index 0000000..d68ec52 --- /dev/null +++ b/include/model/hardware/core/register/dsp/registerDefinition/LpfLut.h @@ -0,0 +1,45 @@ +#ifndef LPFLUT_H +#define LPFLUT_H + +#include "model/hardware/core/register/RegisterChain.h" +//#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define LPF_LUT_MASK 0x0000FFFF + +#define BAR 0 +#define OFFSET 0x81000 +#define LENGTH 48U + +class LpfLut : public RegisterChain +{ +private: + QList _lpfLut; + + void prepareData(quint32 index) override + { + lpfLut->setValue(_lpfLut.at(static_cast(index))); + } + +public: + Field* lpfLut; + + void setLpfLut (QList& lpfLut) { + _lpfLut = lpfLut; + } + + LpfLut(SonoDevice* device) : RegisterChain(BAR, OFFSET, device, LENGTH) + { + ADD_UNSIGNED_FIELD(lpfLut, LPF_LUT_MASK); + } +}; + +#undef LPF_LUT_MASK + +#undef BAR +#undef OFFSET +#undef LENGTH + +#endif // LPFLUT_H diff --git a/include/model/hardware/core/register/dsp/registerDefinition/ManualAtgc.h b/include/model/hardware/core/register/dsp/registerDefinition/ManualAtgc.h new file mode 100644 index 0000000..e90c28f --- /dev/null +++ b/include/model/hardware/core/register/dsp/registerDefinition/ManualAtgc.h @@ -0,0 +1,38 @@ +#ifndef MANUALATGC_H +#define MANUALATGC_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define USER_DAC_VALUE_MASK 0x00000FFF +#define USER_VALID_MASK 0x00001000 +#define USER_MODE_ENABLE_MASK 0x00002000 + +#define BAR 0U +#define OFFSET 0X86018 + +class ManualAtgc : public Register +{ +public: + Field* userDacValue; + Field* userValid; + Field* userModeEnable; + + ManualAtgc(SonoDevice* device) : Register (BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(userDacValue, USER_DAC_VALUE_MASK); + ADD_UNSIGNED_FIELD(userValid, USER_VALID_MASK); + ADD_UNSIGNED_FIELD(userModeEnable, USER_MODE_ENABLE_MASK); + } +}; + +#undef USER_DAC_VALUE_MASK +#undef USER_VALID_MASK +#undef USER_MODE_ENABLE_MASK + +#undef BAR +#undef OFFSET + +#endif // MANUALATGC_H diff --git a/include/model/hardware/core/register/dsp/registerDefinition/ReceiverConfigurationLut.h b/include/model/hardware/core/register/dsp/registerDefinition/ReceiverConfigurationLut.h new file mode 100644 index 0000000..b37d60e --- /dev/null +++ b/include/model/hardware/core/register/dsp/registerDefinition/ReceiverConfigurationLut.h @@ -0,0 +1,159 @@ +#ifndef RECEIVERCONFIGURATIONLUT_H +#define RECEIVERCONFIGURATIONLUT_H + +#include "model/hardware/core/register/RegisterChain.h" +//#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define MLA_PRP_MASK 0x00000007 +#define LINE_MODE_PRP_MASK 0x00000078 +#define ATGC_SEL_PRP_MASK 0x00000180 +#define STB_EN_PRP_MASK 0x00000200 +#define STB_PRP_MASK 0x00000C00 +#define SUBTRACT_FILTER_EN_PRP_MASK 0x00001000 +#define DC_CANCEL_EN_PRP_MASK 0x00002000 +#define NCO_FREQ_SEL_PRP_MASK 0x0001C000 +#define LPF_SEL_PRP_MASK 0x00060000 +#define ABS_EN_PRP_MASK 0x00080000 +#define FOCUS_NO_PRP_MASK 0x00300000 +#define LINE_FILTER_EN_PRP_MASK 0x00400000 +#define DDC_EN_PRP_MASK 0x00800000 +#define WMF_EN_PRP_MASK 0x01000000 +#define DPE_EN_PRP_MASK 0x02000000 + +#define BAR 0U +#define OFFSET 0X80000 +#define LENGTH 8U + +struct ReceiverConfiguration +{ + QList mla; + QList lineMode; + QList aTgcSel; + QList stbEn; + QList stb; + QList subtractFilterEn; + QList dcCancelerEn; + QList ncoFreqSel; + QList lpfSel; + QList absEn; + QList focusNo; + QList lineFilterEn; + QList ddcEn; + QList wmfEn; + QList dpeEn; +}; + +class ReceiverConfigurationLut : public RegisterChain +{ +private: + ReceiverConfiguration* _configLut; + + void prepareData(quint32 index) override + { + quint32 value=0; + + mlaPrp->setValue(_configLut->mla.at(static_cast(index))); + + lineModePrp->setValue(_configLut->lineMode.at(static_cast(index))); + + atgcSelPrp->setValue(_configLut->aTgcSel.at(static_cast(index))); + + value = _configLut->stbEn.at(static_cast(index)) ? 1 : 0; + stbEnPrp->setValue(value); + + stbPrp->setValue(_configLut->stb.at(static_cast(index))); + + value = _configLut->subtractFilterEn.at(static_cast(index)) ? 1 : 0; + subtractFilterEnPrp->setValue(value); + + value = _configLut->dcCancelerEn.at(static_cast(index)) ? 1 : 0; + dcCancelEnPrp->setValue(value); + + ncoFreqSelPrp->setValue(_configLut->ncoFreqSel.at(static_cast(index))); + + lpfSelPrp->setValue(_configLut->lpfSel.at(static_cast(index))); + + value = _configLut->absEn.at(static_cast(index)) ? 1 : 0; + absEnPrp->setValue(value); + + focusNoPrp->setValue(_configLut->focusNo.at(static_cast(index))); + + value = _configLut->lineFilterEn.at(static_cast(index)) ? 1 : 0; + lineFilterEnPrp->setValue(value); + + value = _configLut->ddcEn.at(static_cast(index)) ? 1 : 0; + ddcEnPrp->setValue(value); + + value = _configLut->wmfEn.at(static_cast(index)) ? 1 : 0; + wmfEnPrp->setValue(value); + + value = _configLut->dpeEn.at(static_cast(index)) ? 1 : 0; + dpeEnPrp->setValue(value); + } + +public: + Field* mlaPrp; + Field* lineModePrp; + Field* atgcSelPrp; + Field* stbEnPrp; + Field* stbPrp; + Field* subtractFilterEnPrp; + Field* dcCancelEnPrp; + Field* ncoFreqSelPrp; + Field* lpfSelPrp; + Field* absEnPrp; + Field* focusNoPrp; + Field* lineFilterEnPrp; + Field* ddcEnPrp; + Field* wmfEnPrp; + Field* dpeEnPrp; + + void setReceiverConfigurationLut (ReceiverConfiguration* configLut) + { + _configLut = configLut; + } + + ReceiverConfigurationLut(SonoDevice* device) : RegisterChain(BAR, OFFSET, device, LENGTH) + { + ADD_UNSIGNED_FIELD(mlaPrp, MLA_PRP_MASK); + ADD_UNSIGNED_FIELD(lineModePrp, LINE_MODE_PRP_MASK); + ADD_UNSIGNED_FIELD(atgcSelPrp, ATGC_SEL_PRP_MASK); + ADD_UNSIGNED_FIELD(stbEnPrp, STB_EN_PRP_MASK); + ADD_UNSIGNED_FIELD(stbPrp, STB_PRP_MASK); + ADD_UNSIGNED_FIELD(subtractFilterEnPrp, SUBTRACT_FILTER_EN_PRP_MASK); + ADD_UNSIGNED_FIELD(dcCancelEnPrp, DC_CANCEL_EN_PRP_MASK); + ADD_UNSIGNED_FIELD(ncoFreqSelPrp, NCO_FREQ_SEL_PRP_MASK); + ADD_UNSIGNED_FIELD(lpfSelPrp, LPF_SEL_PRP_MASK); + ADD_UNSIGNED_FIELD(absEnPrp, ABS_EN_PRP_MASK); + ADD_UNSIGNED_FIELD(focusNoPrp, FOCUS_NO_PRP_MASK); + ADD_UNSIGNED_FIELD(lineFilterEnPrp, LINE_FILTER_EN_PRP_MASK); + ADD_UNSIGNED_FIELD(ddcEnPrp, DDC_EN_PRP_MASK); + ADD_UNSIGNED_FIELD(wmfEnPrp, WMF_EN_PRP_MASK); + ADD_UNSIGNED_FIELD(dpeEnPrp, DPE_EN_PRP_MASK); + } +}; + +#undef MLA_PRP_MASK +#undef LINE_MODE_PRP_MASK +#undef ATGC_SEL_PRP_MASK +#undef STB_EN_PRP_MASK +#undef STB_PRP_MASK +#undef SUBTRACT_FILTER_EN_PRP_MASK +#undef DC_CANCEL_EN_PRP_MASK +#undef NCO_FREQ_SEL_PRP_MASK +#undef LPF_SEL_PRP_MASK +#undef ABS_EN_PRP_MASK +#undef FOCUS_NO_PRP_MASK +#undef LINE_FILTER_EN_PRP_MASK +#undef DDC_EN_PRP_MASK +#undef WMF_EN_PRP_MASK +#undef DPE_EN_PRP_MASK + +#undef BAR +#undef OFFSET +#undef LENGTH + +#endif diff --git a/include/model/hardware/core/register/dsp/registerDefinition/StbCoefficient.h b/include/model/hardware/core/register/dsp/registerDefinition/StbCoefficient.h new file mode 100644 index 0000000..d9891ae --- /dev/null +++ b/include/model/hardware/core/register/dsp/registerDefinition/StbCoefficient.h @@ -0,0 +1,50 @@ +#ifndef STBCOEFFICIENT_H +#define STBCOEFFICIENT_H + +#include "model/hardware/core/register/RegisterChain.h" +//#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define STB_LUT_EVEN_MASK 0x0000FFFF +#define STB_LUT_ODD_MASK 0xFFFF0000 + +#define BAR 0 +#define OFFSET 0x86000 +#define LENGTH 4U // 8/2 + +class StbCoefficient : public RegisterChain +{ +private: + QList _stbLut; + + void prepareData(quint32 index) override + { + stbLutEven->setValue(_stbLut.at(static_cast(index*2))); + stbLutOdd ->setValue(_stbLut.at(static_cast(index*2 + 1))); + } + +public: + Field* stbLutEven; + Field* stbLutOdd; + + void setStbLut (QList& stbLut) { + _stbLut = stbLut; + } + + StbCoefficient(SonoDevice* device) : RegisterChain(BAR, OFFSET, device, LENGTH) + { + ADD_UNSIGNED_FIELD(stbLutEven, STB_LUT_EVEN_MASK); + ADD_UNSIGNED_FIELD(stbLutOdd , STB_LUT_ODD_MASK ); + } +}; + +#undef STB_LUT_EVEN_MASK +#undef STB_LUT_ODD_MASK + +#undef BAR +#undef OFFSET +#undef LENGTH + +#endif // STBCOEFFICIENT_H diff --git a/include/model/hardware/core/register/fpgaProgram/FpgaProgram.h b/include/model/hardware/core/register/fpgaProgram/FpgaProgram.h new file mode 100644 index 0000000..ada8b1f --- /dev/null +++ b/include/model/hardware/core/register/fpgaProgram/FpgaProgram.h @@ -0,0 +1,50 @@ +#ifndef FPGAPROGRAM_H +#define FPGAPROGRAM_H + +#include +#include "registerDefinition/SlaveFpgaNumber.h" +#include "registerDefinition/SerialProgramData.h" +#include "registerDefinition/SerialProgramStatus.h" + +//#define FPGA_S0_DONE 1 +//#define FPGA_S1_DONE 2 +//#define FPGA_S2_DONE 4 + +#define FPGA_S0_INIT_B 1 +#define FPGA_S1_INIT_B 2 +#define FPGA_S2_INIT_B 4 + +class FpgaProgram +{ +private: + SerialProgramData* _progData; + SlaveFpgaNumber* _fpgaNumber; + + struct ProgramStatus { + SerialProgramStatus* _progStatus; + bool getProgramBusy() const; + bool getProgramDone() const; + bool getProgramFail() const; + bool getInitFail() const; + bool getProgramTimeout() const; + bool getFpgaS0InitB() const; + bool getFpgaS1InitB() const; + bool getFpgaS2InitB() const; +// bool getFpgaS0Done(); +// bool getFpgaS1Done(); +// bool getFpgaS2Done(); + }_status; + + void setSlaveFpgaNumber (quint8& number) const; + +public: + explicit FpgaProgram(SonoDevice* device); + ~FpgaProgram(); + + void program(QByteArray& bitFileData, quint8 number); + +}; + +quint32 byteArray2Uint32BigEndian(QByteArray& data); + +#endif // PROGRAM_H diff --git a/include/model/hardware/core/register/fpgaProgram/registerDefinition/SerialProgramData.h b/include/model/hardware/core/register/fpgaProgram/registerDefinition/SerialProgramData.h new file mode 100644 index 0000000..1c09709 --- /dev/null +++ b/include/model/hardware/core/register/fpgaProgram/registerDefinition/SerialProgramData.h @@ -0,0 +1,30 @@ +#ifndef SERIALPROGRAMDATA_H +#define SERIALPROGRAMDATA_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define SLAVE_CONFIG_DATA_MASK 0xFFFFFFFF + +#define BAR 0U +#define OFFSET 0X400 + +class SerialProgramData : public Register +{ +public: + Field* slaveConfigData; + + SerialProgramData(SonoDevice* device) : Register(BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(slaveConfigData, SLAVE_CONFIG_DATA_MASK); + } +}; + +#undef SLAVE_CONFIG_DATA_MASK + +#undef BAR +#undef OFFSET + +#endif diff --git a/include/model/hardware/core/register/fpgaProgram/registerDefinition/SerialProgramStatus.h b/include/model/hardware/core/register/fpgaProgram/registerDefinition/SerialProgramStatus.h new file mode 100644 index 0000000..141a162 --- /dev/null +++ b/include/model/hardware/core/register/fpgaProgram/registerDefinition/SerialProgramStatus.h @@ -0,0 +1,54 @@ +#ifndef SERIALPROGRAMSTATUS_H +#define SERIALPROGRAMSTATUS_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define BUSY_MASK 0x00000001 +#define PROG_DONE_MASK 0x00000002 +#define PROG_FAIL_MASK 0x00000004 +#define INIT_FAIL_MASK 0x00000008 +#define TIMEOUT_MASK 0x00000010 +#define SLAVE_FPGA_DONE_MASK 0x00000F00 +#define SLAVE_FPGA_INIT_B_MASK 0x0000F000 + +#define BAR 0U +#define OFFSET 0x404 + +class SerialProgramStatus : public Register +{ +public: + Field* busy; + Field* progDone; + Field* progFail; + Field* initFail; + Field* timeout; + Field* slaveFpgaDone; + Field* slaveFpgaInitB; + + SerialProgramStatus(SonoDevice* device) : Register(BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(busy, BUSY_MASK); + ADD_UNSIGNED_FIELD(progDone, PROG_DONE_MASK); + ADD_UNSIGNED_FIELD(progFail, PROG_FAIL_MASK); + ADD_UNSIGNED_FIELD(initFail, INIT_FAIL_MASK); + ADD_UNSIGNED_FIELD(timeout, TIMEOUT_MASK); + ADD_UNSIGNED_FIELD(slaveFpgaDone, SLAVE_FPGA_DONE_MASK); + ADD_UNSIGNED_FIELD(slaveFpgaInitB, SLAVE_FPGA_INIT_B_MASK); + } +}; + +#undef BUSY_MASK +#undef PROG_DONE_MASK +#undef PROG_FAIL_MASK +#undef INIT_FAIL_MASK +#undef TIMEOUT_MASK +#undef SLAVE_FPGA_DONE_MASK +#undef SLAVE_FPGA_INIT_B_MASK + +#undef BAR +#undef OFFSET + +#endif diff --git a/include/model/hardware/core/register/fpgaProgram/registerDefinition/SlaveFpgaNumber.h b/include/model/hardware/core/register/fpgaProgram/registerDefinition/SlaveFpgaNumber.h new file mode 100644 index 0000000..fe2ab22 --- /dev/null +++ b/include/model/hardware/core/register/fpgaProgram/registerDefinition/SlaveFpgaNumber.h @@ -0,0 +1,30 @@ +#ifndef SLAVEFPGANUMBER_H +#define SLAVEFPGANUMBER_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define NUMBER_MASK 0x00000003 + +#define BAR 0U +#define OFFSET 0x408 + +class SlaveFpgaNumber : public Register +{ +public: + Field* number; + + SlaveFpgaNumber(SonoDevice* device) : Register(BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(number, NUMBER_MASK); + } +}; + +#undef NUMBER_MASK + +#undef BAR +#undef OFFSET + +#endif // SLAVEFPGANUMBER_H diff --git a/include/model/hardware/core/register/scenPlayer/ScenPlayer.h b/include/model/hardware/core/register/scenPlayer/ScenPlayer.h new file mode 100644 index 0000000..0da6ad9 --- /dev/null +++ b/include/model/hardware/core/register/scenPlayer/ScenPlayer.h @@ -0,0 +1,35 @@ +#ifndef SCENPLAYER_H +#define SCENPLAYER_H + +#include "registerDefinition/ScenPlayerCtrl.h" +#include "registerDefinition/ScenPlayerEndIndex.h" +#include "registerDefinition/ScenPlayerErrorCount.h" +#include "registerDefinition/ScenPlayerStartIndex.h" + +class ScenPalyer +{ +private: + ScenPlayerEndIndex* _playerEndIdx; + ScenPlayerStartIndex* _playerStartIdx; + ScenPlayerErrorCount* _playerErrorCnt; + struct PlayerControl + { + ScenPlayerCtrl* _playerctrl; + void command(bool start) const; + void pause (bool pause) const; + }; + +public: + + explicit ScenPalyer(SonoDevice* device); + ~ScenPalyer(); + + PlayerControl control; + + void setStartIndex (quint32 strIdx); + void setEndIndex (quint32 endIdx); + quint32 getErrorCount(void) const; + +}; + +#endif // SCENPLAYER_H diff --git a/include/model/hardware/core/register/scenPlayer/registerDefinition/ScenPlayerCtrl.h b/include/model/hardware/core/register/scenPlayer/registerDefinition/ScenPlayerCtrl.h new file mode 100644 index 0000000..80711ec --- /dev/null +++ b/include/model/hardware/core/register/scenPlayer/registerDefinition/ScenPlayerCtrl.h @@ -0,0 +1,34 @@ +#ifndef SCENPLAYERCTRL_H +#define SCENPLAYERCTRL_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define START_MASK 0x00000001 +#define PAUSE_MASK 0x00000004 + +#define BAR 0U +#define OFFSET 0 + +class ScenPlayerCtrl : public Register +{ +public: + Field* start; + Field* pause; + + ScenPlayerCtrl(SonoDevice* device) : Register(BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(start, START_MASK); + ADD_UNSIGNED_FIELD(pause, PAUSE_MASK); + } +}; + +#undef START_MASK +#undef PAUSE_MASK + +#undef BAR +#undef OFFSET + +#endif diff --git a/include/model/hardware/core/register/scenPlayer/registerDefinition/ScenPlayerEndIndex.h b/include/model/hardware/core/register/scenPlayer/registerDefinition/ScenPlayerEndIndex.h new file mode 100644 index 0000000..d92c513 --- /dev/null +++ b/include/model/hardware/core/register/scenPlayer/registerDefinition/ScenPlayerEndIndex.h @@ -0,0 +1,30 @@ +#ifndef SCENPLAYERENDINDEX_H +#define SCENPLAYERENDINDEX_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define END_INDEX_MASK 0x0001FFFF + +#define BAR 0U +#define OFFSET 0X808 + +class ScenPlayerEndIndex : public Register +{ +public: + Field* endIndex; + + ScenPlayerEndIndex(SonoDevice* device) : Register(BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(endIndex, END_INDEX_MASK); + } +}; + +#undef END_INDEX_MASK + +#undef BAR +#undef OFFSET + +#endif diff --git a/include/model/hardware/core/register/scenPlayer/registerDefinition/ScenPlayerErrorCount.h b/include/model/hardware/core/register/scenPlayer/registerDefinition/ScenPlayerErrorCount.h new file mode 100644 index 0000000..1ef275f --- /dev/null +++ b/include/model/hardware/core/register/scenPlayer/registerDefinition/ScenPlayerErrorCount.h @@ -0,0 +1,30 @@ +#ifndef SCENPLAYERERRORCOUNT_H +#define SCENPLAYERERRORCOUNT_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define ERROR_COUNT_MASK 0x0000FFFF + +#define BAR 0U +#define OFFSET 0X80C + +class ScenPlayerErrorCount : public Register +{ +public: + Field* errorCount; + + ScenPlayerErrorCount(SonoDevice* device) : Register(BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(errorCount, ERROR_COUNT_MASK); + } +}; + +#undef ERROR_COUNT_MASK + +#undef BAR +#undef OFFSET + +#endif diff --git a/include/model/hardware/core/register/scenPlayer/registerDefinition/ScenPlayerStartIndex.h b/include/model/hardware/core/register/scenPlayer/registerDefinition/ScenPlayerStartIndex.h new file mode 100644 index 0000000..5844d7d --- /dev/null +++ b/include/model/hardware/core/register/scenPlayer/registerDefinition/ScenPlayerStartIndex.h @@ -0,0 +1,30 @@ +#ifndef SCENPLAYERSTARTINDEX_H +#define SCENPLAYERSTARTINDEX_H + +#include "model/hardware/core/register/Register.h" +#include "model/hardware/core/register/RegUtils.h" + +#undef BAR + +#define START_INDEX_MASK 0x0001FFFF + +#define BAR 0U +#define OFFSET 0X804 + +class ScenPlayerStartIndex : public Register +{ +public: + Field* startIndex; + + ScenPlayerStartIndex(SonoDevice* device) : Register(BAR, OFFSET, device) + { + ADD_UNSIGNED_FIELD(startIndex, START_INDEX_MASK); + } +}; + +#undef START_INDEX_MASK + +#undef BAR +#undef OFFSET + +#endif diff --git a/include/model/hardware/device/SonoConfig.h b/include/model/hardware/device/SonoConfig.h new file mode 100644 index 0000000..0600807 --- /dev/null +++ b/include/model/hardware/device/SonoConfig.h @@ -0,0 +1,32 @@ +#ifndef SONOADDRESS_H +#define SONOADDRESS_H + +#define BAR 2 + + +#define SW_BUFFER_NUM 100 +#define HW_BUFFER_NUM 16 +#define BUFFER_SIZE 4 * 1024 * 1024 + +#define COUNTER_REG 0x00002020 +#define RAM_OFFSET_REG 0x00002024 +#define XFER_OPT_REG 0x00002028 +#define XFER_RATE_REG 0x0000202C +#define CONTROL_REG 0x00000800 + +#define START_COMMAND 0x00000001 +#define STOP_COMMAND 0x00000000 + +#define COUNTER_MASK 0x0000001F + +#define RAM_OFFSET_MASK 0x00FFFFFF + +#define XFER_LEN_MASK 0x007FFFFF + +#define AUTO_INC_COMMAND 0x40000000 + +#define PERF_MODE_COMMAND 0x80000000 + +#define XFER_RATE_MASK 0x003FFFFF + +#endif //SONOADDRESS_H diff --git a/include/model/hardware/device/SonoDevice.h b/include/model/hardware/device/SonoDevice.h new file mode 100644 index 0000000..0becea3 --- /dev/null +++ b/include/model/hardware/device/SonoDevice.h @@ -0,0 +1,36 @@ +#ifndef SONODEVICE_H +#define SONODEVICE_H + +#include + +#include "SonoPcieDevice.h" +#include "SonoConfig.h" + +class SonoDevice +{ +private: + char* _buffers[SW_BUFFER_NUM]; + +public: + SonoPcieDevice device; + + SonoDevice(); + ~SonoDevice(); + + void init(); + void startTransfer(bool emulatorEn); + void stopTransfer(); + int getCounter(); + void setRamOffsetAddress(qint32 offset); + void setTransferLength(qint32 length); + void setTransferRate(float rate); + void setOptions(bool performanceMode); + void setMode(bool dynamicMode); + void copy(int srcIndex, int dstIndex); + void show(int i); + void log(int i); + void fillRam(); + const char* getBufferPtr(int index); +}; + +#endif //SONODEVICE_H diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..555b9dc --- /dev/null +++ b/main.cpp @@ -0,0 +1,20 @@ +#include "mainwindow.h" +#include +#include +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + MainWindow w; + w.setGeometry( + QStyle::alignedRect( + Qt::LeftToRight, + Qt::AlignCenter, + w.size(), + qApp->desktop()->availableGeometry() + ) + ); + w.show(); + return a.exec(); +} diff --git a/mainwindow.cpp b/mainwindow.cpp new file mode 100644 index 0000000..b62541f --- /dev/null +++ b/mainwindow.cpp @@ -0,0 +1,2821 @@ +#include "mainwindow.h" +#include "ui_mainwindow.h" + +MainWindow::MainWindow(QWidget *parent) + : QMainWindow(parent) + , ui(new Ui::MainWindow) +{ + ui->setupUi(this); + _settings = new QSettings("Hasis", "HwTester"); + + _usd = new UltraSoundDevice(); + _usd->device->init(); + + _timer = new QTimer(); +// _dial = new WaitDialog(); +// _dial->setModal(true); + + +// ui->plot_2->setInteractions(QCP::iRangeZoom|QCP::iRangeDrag); +// ui->plot_2->axisRect()->setupFullAxesBox(true); +// ui->plot_2->xAxis->setLabel("Line"); +// ui->plot_2->yAxis->setLabel("Point"); +// _colorMap = new QCPColorMap(ui->plot_2->xAxis,ui->plot_2->yAxis); +// if(!ui->plot_2->plotLayout()->hasElement(0,1)) +// { +// QCPColorScale *colorScale = new QCPColorScale(ui->plot_2); +// ui->plot_2->plotLayout()->addElement(0,1,colorScale); +// colorScale->setType(QCPAxis::atRight); +// _colorMap->setColorScale(colorScale); +// colorScale->axis()->setLabel("Number"); +// _colorMap->setGradient((QCPColorGradient::gpJet)); +// //colorMap->rescaleDataRange(); +// QCPMarginGroup *marginGroup = new QCPMarginGroup(ui->plot_2); +// ui->plot_2->axisRect()->setMarginGroup(QCP::msBottom|QCP::msTop,marginGroup); +// colorScale->setMarginGroup(QCP::msBottom|QCP::msTop,marginGroup); +// } + + this->setFixedSize(this->width(),this->height()); + +// ui->prg_adcSim->setVisible(false); +// ui->prg_scenarioUpload->setVisible(false); +// ui->prg_txDacUpload->setVisible(false); +// ui->prg_fpgaProgram->setVisible(false); +// ui->prg_adcLoggerFileWr->setVisible(false); + +// ui->tb_scenarioFile->setReadOnly(true); +// ui->tb_paramFile->setReadOnly(true); +// ui->tb_txDacFile->setReadOnly(true); + ui->tb_fpgaBit->setReadOnly(true); + +// ui->tb_scenarioFile->setText(_settings->value(SCENARIO_FILE_PATH).value()); +// ui->tb_paramFile->setText(_settings->value(PARAM_FILE_PATH).value()); +// ui->tb_txDacFile->setText(_settings->value(TX_DAC_FILE_PATH).value()); + ui->rbtn_reg->setChecked(_settings->value(REG_ACCESS_SEL).value()); + ui->rbtn_offset->setChecked(!_settings->value(REG_ACCESS_SEL).value()); + ui->tb_fpgaBit->setText(_settings->value(FPGA_FILE_PATH).value()); + +// connect(this, &MainWindow::updateBlockProgressValue, this, &MainWindow::newBlockProgressValue); +// connect(this, &MainWindow::updateFpgaProgressValue, this, &MainWindow::newFpgaProgressValue); +// connect(this, &MainWindow::updateBlockProgressVisibility, this, &MainWindow::newBlockProgressVisibility); +// connect(this, &MainWindow::updateFpgaProgressVisibility, this, &MainWindow::newFpgaProgressVisibility); + + //connect(this, &MainWindow::updateAdcLoggerProgressValue, this, &MainWindow::newAdcLoggerProgressValue); + //connect(this, &MainWindow::updateAdcLoggerProgressVisibility, this, &MainWindow::newAdcLoggerProgressVisibility); + + connect(this, &MainWindow::showMessage, this, &MainWindow::newMessage); + connect(_timer, &QTimer::timeout, this, &MainWindow::timeout); + +// ui->btn_scenarioStartStop->setText(START); +// ui->btn_scenarioPauseResume->setText(PAUSE); +// ui->btn_txDacStartStop->setText(START); +// ui->btn_txDacOnOff->setText(ON); +// ui->btn_HVOnOff->setText(HV_ON); + ui->btn_motorOnOff->setText(MOTOR_ON); + ui->btn_pwr1OnOff->setText(PWR1_ON); + ui->btn_pwr2OnOff->setText(PWR2_ON); + ui->btn_pwr3OnOff->setText(PWR3_ON); + ui->btn_pwr4OnOff->setText(PWR4_ON); + ui->btn_pllClkSt->setText(ON); + ui->btn_pllClkTps->setText(ON); + ui->btn_mulDacTrig->setText(TRIG_ON); + ui->btn_thsdStateUpdate->setText(THSD_State_Update); + ui->btn_pwrDacsEnable->setText(VALID); + ui->btn_hvRegulatorConfig->setText(ENABLE); + ui->btn_pm5RegulatorConfig->setText(ENABLE); + ui->btn_DacsOnOff->setText(DACS_ENABLE); + ui->btn_updateRdbackValue->setText(UPDATE); +// ui->btn_dmaStart_2->setText(START); +// ui->btn_dmaStop_2->setVisible(false); +// ui->btn_dmaLogLast->setVisible(false); +// ui->btn_adcLoggerStrt->setText(START); +// ui->btn_dbgTransferStrt->setText(START); +// ui->tb_adcLoggerPath->setText(_adcloggerFolder); +// ui->l_hvap->setText("0"); +// ui->l_hvbp->setText("0"); +// ui->l_cwdp->setText("0"); +// ui->l_p24v->setText("0"); +// ui->l_p12v->setText("0"); +// ui->l_p5v->setText("0"); +// ui->l_m5v->setText("0"); +// ui->l_hvStop->setText("0"); +// ui->l_curr24v->setText("0"); +// ui->l_p4d->setText("0"); + ui->l_detectedProbe->setText("None"); + +// if (pwr.getSetupCmdP24vOnOff()) +// ui->chk_sup24v->setCheckState(Qt::CheckState::Checked); + +// 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); + + //_timer->start(5000); + + setReceiverConfiguration(); + setBlendWeight(); + setLineFilter(); + setStbCoeff(); + setFreqLut(); + setDTgc(); + setATgc(); + setLpf(); +} + +MainWindow::~MainWindow() +{ + delete ui; + + delete _settings; + + delete _usd; + + //delete _dial; + + delete _timer; + +} + +/*************************************************************************************************/ +//void MainWindow::binFileUploader(quint32 bar, quint32 offset, 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(); +// auto readSize = 0; +// while(readSize < actualSize) +// { +// QByteArray chunk = file.read(8); +// auto value = byteArrayTo64LittleEndian(chunk); +// try +// { +// _usd->writeLong(offset + readSize, bar, value); +// auto rdValue = _usd->readLong(offset + readSize, bar); +// if (value != rdValue) +// { +// MESSAGE_BOX("Binary File Write Error"); +// file.close(); + +// return; +// } + +// } 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(); +//} + +///*************************************************************************************************/ +//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(); +//} +///*************************************************************************************************/ +//void MainWindow::CsvFileUploader(quint32 bar, QString path, QProgressBar* prg) +//{ +// QFile file(path); + +// if(!file.open(QFile::ReadOnly)) +// { +// MESSAGE_BOX("Could not open param file, aborting operation"); +// return; +// } + +// emit updateBlockProgressVisibility(true, prg); +// emit updateBlockProgressValue(0, prg); + +// QString line; +// auto size = file.size(); +// qint64 readSize = 0; +// while((readSize < size) & !_csvReadStopFlag) +// { +// line = file.readLine(); +// auto sl = line.split(','); +// auto address = sl[0].toUInt(Q_NULLPTR, 16); +// auto value = sl[1].toUInt(Q_NULLPTR, 16); +// _usd->writeWord(address, bar, value); +// //qDebug() << _usd->readWord(address, bar); +// readSize += static_cast(line.length()); +// emit updateBlockProgressValue((readSize * 100 / size), prg); +// //delay(1); +// } + +// emit updateBlockProgressVisibility(false, prg); + +// file.close(); +//} +///*************************************************************************************************/ +//void MainWindow::CsvFileChecker(quint32 bar, QString pathBase, QString pathTarget, QProgressBar* prg) +//{ +// QFile baseFile(pathBase); +// QFile tragetFile(pathTarget); + +// if(!baseFile.open(QFile::ReadOnly)) +// { +// MESSAGE_BOX("Could not open param file, aborting operation"); +// return; +// } +// tragetFile.open(QFile::WriteOnly); + +// emit updateBlockProgressVisibility(true, prg); +// emit updateBlockProgressValue(0, prg); + +// QString line; +// auto size = baseFile.size(); +// qint64 readSize = 0; +// while(readSize < size) +// { +// line = baseFile.readLine(); +// auto sl = line.split(','); +// auto address = sl[0].toUInt(Q_NULLPTR, 16); +// auto baseValue = sl[1].toUInt(Q_NULLPTR, 16); +// auto boardValue = _usd->readWord(address, bar); +// auto res = "NOK"; +// if (boardValue == baseValue) +// { +// res = "OK"; +// } +// auto str = QStringLiteral("%1,%2,%3,%4").arg(address, 8, 16, QLatin1Char('0')).arg(baseValue, 8, 16, QLatin1Char('0')) +// .arg(boardValue, 8, 16, QLatin1Char('0')).arg(res); +// tragetFile.write(str.toStdString().c_str(), str.length()); +// tragetFile.write("\r\n", 2); + +// readSize += static_cast(line.length()); +// emit updateBlockProgressValue((readSize * 100 / size), prg); +// //delay(1); +// } + +// emit updateBlockProgressVisibility(false, prg); + +// baseFile.close(); + +// tragetFile.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::scenarioFileVerifier(quint32 bar, quint32 offset, QString path) +//{ +// QFile file(path); + +// if (!file.open(QFile::ReadOnly)) +// { +// MESSAGE_BOX("Could not open binary file, aborting operation"); +// return; +// } + +// emit updateBlockProgressVisibility(true, ui->prg_scenarioUpload); +// emit updateBlockProgressValue(0, ui->prg_scenarioUpload); + +// const auto actualSize = file.size(); +// auto readSize = 0; +// while(readSize < actualSize) +// { +// QByteArray chunk = file.read(8); +// auto value = byteArrayTo64LittleEndian(chunk); +// try +// { +// auto data = _usd->readLong(offset + readSize, bar); +// if(data != value) +// { +// auto message = QString("Error in data @ offset 0x%1, expected 0x%2 saw 0x%3") +// .arg(QString::number(offset + readSize)) +// .arg(QString::number(value, 16)) +// .arg(QString::number(data, 16)); +// MESSAGE_BOX(message); + +// emit updateBlockProgressVisibility(false, ui->prg_scenarioUpload); + +// file.close(); + +// return; +// } +// } +// catch (myexception e) +// { +// MESSAGE_BOX(e.what()); + +// emit updateBlockProgressVisibility(false, ui->prg_scenarioUpload); + +// file.close(); + +// return; +// } +// readSize += 8; + +// auto percentage = (readSize * 100 / actualSize); +// emit updateBlockProgressValue(percentage, ui->prg_scenarioUpload); +// } + +// MESSAGE_BOX("Binary verified with success"); + +// emit updateBlockProgressVisibility(false, ui->prg_scenarioUpload); + +// file.close(); +//} + +/*************************************************************************************************/ +//void MainWindow::fpgaProgrammer(QString path) +//{ +// trx.slaveFpgaProgram(path); +//} + +/*************************************************************************************************/ +//quint64 MainWindow::byteArrayTo64LittleEndian(QByteArray data) +//{ +// quint64 temp = 0; + +// temp = ((static_cast(data[0])) & 0x00000000000000FF) | +// (((static_cast(data[1])) << 8) & 0x000000000000FF00) | +// (((static_cast(data[2])) << 16) & 0x0000000000FF0000) | +// (((static_cast(data[3])) << 24) & 0x00000000FF000000) | +// (((static_cast(data[4])) << 32) & 0x000000FF00000000) | +// (((static_cast(data[5])) << 40) & 0x0000FF0000000000) | +// (((static_cast(data[6])) << 48) & 0x00FF000000000000) | +// (((static_cast(data[7])) << 56) & 0xFF00000000000000); + +// return temp; +//} +/*************************************************************************************************/ +//quint32 MainWindow::byteArrayTo32LittleEndian(QByteArray data) +//{ +// quint32 temp = 0; + +// temp = ((static_cast(data[0])) & 0x000000FF) | +// (((static_cast(data[1])) << 8) & 0x0000FF00) | +// (((static_cast(data[2])) << 16) & 0x00FF0000) | +// (((static_cast(data[3])) << 24) & 0xFF000000) ; + +// return temp; +//} +///*************************************************************************************************/ +//quint32 MainWindow::byteArrayTo32BigEndian(QByteArray data) +//{ +// quint32 temp = 0; + +// temp = (data[3] & 0x000000FF) | +// ((data[2] << 8) & 0x0000FF00) | +// ((data[1] << 16) & 0x00FF0000) | +// ((data[0] << 24) & 0xFF000000); + +// return temp; +//} + +/*************************************************************************************************/ +void MainWindow::timeout() +{ +// auto pcie_id = _usd->readWord(0, 2); + + auto pcie_pid = trx.deviceId(); + auto pcie_vid = trx.vendorId(); + auto pcie_id = (pcie_pid << 16)|pcie_vid; + ui->l_PCIeID->setText(QString::number(pcie_id, 16)); + delay(1); + +// bool probeADetected=_bCtrl->getConnectedPrb().at(0); +// bool probeBDetected=_bCtrl->getConnectedPrb().at(1); +// bool probeCDetected=_bCtrl->getConnectedPrb().at(2); +// bool probeDDetected=_bCtrl->getConnectedPrb().at(3); + +// if(probeDDetected == true){ +// ui->l_detectedProbe->setText("D"); +// } +// else if (probeCDetected == true) { +// ui->l_detectedProbe->setText("C"); +// } +// else if (probeBDetected == true) { +// ui->l_detectedProbe->setText("B"); +// } +// else if (probeADetected == true) { +// ui->l_detectedProbe->setText("A"); +// } +// else{ +// ui->l_detectedProbe->setText("None"); +// } + +//auto detectedPrb = _usd->readWord(0x26078, 0); +// detectedPrb = detectedPrb & (0xF); +// if(detectedPrb == 0x7){ +// ui->l_detectedProbe->setText("D"); +// } +// else if (detectedPrb == 0xB) { +// ui->l_detectedProbe->setText("C"); +// } +// else if (detectedPrb == 0xD) { +// ui->l_detectedProbe->setText("B"); +// } +// else if (detectedPrb == 0xE) { +// ui->l_detectedProbe->setText("A"); +// } +// else{ +// ui->l_detectedProbe->setText("None"); +// } + + delay(10); +// auto tempSensor = _usd->readWord(0x26078, 0); +// float temp = tempSensor; +// if (((tempSensor >> 10) & 0x01) == 0x01) +// { +// temp *= -1; +// } +// temp *= 0.125f; + // auto detected_probe = _usd->readWord(0, 0); + // ui->l_detectedProbe->setText(QString::number(detected_probe, 16)); + // delay(100); + + //auto interruptVec = _usd->readWord(0x0, 0); + //ui->l_intrVector->setText(QString::number(interruptVec, 16)); + + HealthStatus* healStatus; + trx.getHealthStatus(healStatus); + + float tempSensor = healStatus->systemTemperature; + ui->l_Temp->setText(QString("%1").arg(tempSensor)); + delay(10); + + auto adcCh1 = healStatus->adcMon->mon12Vin; + ui->l_adcCh1->setText(QString("%1").arg(adcCh1)); + delay(10); + + auto adcCh2 = healStatus->adcMon->mon5Vin; + ui->l_adcCh2->setText(QString("%1").arg(adcCh2)); + delay(10); + + auto adcCh3 = healStatus->adcMon->prbZeroEncoder; + ui->l_adcCh3->setText(QString("%1").arg(adcCh3)); + delay(10); + + auto adcCh4 = healStatus->adcMon->prbCtrl3P3V; + ui->l_adcCh4->setText(QString("%1").arg(adcCh4)); + delay(10); + + auto adcCh5 = healStatus->adcMon->afeVcntlp; + ui->l_adcCh5->setText(QString("%1").arg(adcCh5)); + delay(10); + + auto adcCh6 = healStatus->adcMon->mon3P3V; + ui->l_adcCh6->setText(QString("%1").arg(adcCh6)); + delay(10); + + auto adcCh7 = healStatus->adcMon->monAfeA1P8V; + ui->l_adcCh7->setText(QString("%1").arg(adcCh7)); + delay(10); + + auto adcCh8 = healStatus->adcMon->monAfeD1P8V; + ui->l_adcCh8->setText(QString("%1").arg(adcCh8)); + delay(10); + +// bool fan1=pwr.getFan1Fault(); +// ui->l_fan1Flt->setText(QVariant(fan1).toString()); +// auto colorFan1 = fan1 ? Qt::red : Qt::green; +// changeLabelTextColor(ui->l_fan1Flt, colorFan1); +// delay(10); + +// bool fan2=pwr.getFan2Fault(); +// ui->l_fan2Flt->setText(QVariant(fan2).toString()); +// auto colorFan2 = fan2 ? Qt::red : Qt::green; +// changeLabelTextColor(ui->l_fan2Flt, colorFan2); +// delay(10); + +// bool cmdDoneI2c=pwr.getI2cCmdDone(); +// ui->l_cmdDone->setText(QVariant(cmdDoneI2c).toString()); +// auto colorCmdDone = cmdDoneI2c ? Qt::green : Qt::red; +// changeLabelTextColor(ui->l_cmdDone, colorCmdDone); +// delay(10); + +// bool cmdErrorI2c=pwr.getI2cCmdErr(); +// ui->l_cmdError->setText(QVariant(cmdErrorI2c).toString()); +// auto colorCmdError = cmdErrorI2c ? Qt::red : Qt::green; +// changeLabelTextColor(ui->l_cmdError, colorCmdError); +// delay(10); + +} + +/*************************************************************************************************/ +//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::scenarioStop() +//{ +// auto value = 0x0; +// _usd->writeWord(0x800, 0, value); + +// auto bar = 0; +// uint32_t offsetSlvScenCmd[3] = {0x134000*4,0x234000*4,0x334000*4}; +// delay(10); +// for (auto i=0 ; i<3;i++) +// { +// value = _usd->readWord(offsetSlvScenCmd[i], bar); +// _usd->writeWord(offsetSlvScenCmd[i], bar, value & 0x1); +// } +//} + +//bool MainWindow::checkTermalShutdown(quint8 value) +//{ +// return value == 0x0F; +//} + +void MainWindow::changeLabelTextColor(QLabel *label, QColor color) +{ + auto palette = label->palette(); + palette.setColor(QPalette::Foreground, color); + label->setAutoFillBackground(true); + label->setPalette(palette); + label->update(); +} + +/*************************************************************************************************/ +void MainWindow::on_rbtn_reg_toggled(bool checked) +{ + if(checked) + { + _settings->setValue(REG_ACCESS_SEL, true); + + + + ui->l_regIndicator->setText("Register number: (Hex)"); + } +} + +/*************************************************************************************************/ +void MainWindow::on_rbtn_offset_toggled(bool checked) +{ + if(checked) + { + _settings->setValue(REG_ACCESS_SEL, false); + ui->l_regIndicator->setText("Register offset: (Hex)"); + } +} + +/*************************************************************************************************/ +void MainWindow::on_btn_readReg_clicked() +{ + auto bar = ui->cb_regBarNum->currentText().toUInt(); + + auto offset = ui->tb_regIndicator->text().toUInt(Q_NULLPTR, 16); + if(offset == 0 && ui->tb_regIndicator->text() != "0") + { + MESSAGE_BOX("Invalid input format for offset"); + return; + } + + quint64 value = 0; + auto width = ui->cb_regWidth->currentIndex(); + switch(width) + { + case 0: + if(ui->rbtn_reg->isChecked()) + offset *= 4; + value = _usd->readWord(offset, bar); + ui->lcd_regvalue->setDigitCount(8); + break; + case 1: + if(ui->rbtn_reg->isChecked()) + offset *= 8; + value = _usd->readLong(offset, bar); + ui->lcd_regvalue->setDigitCount(16); + break; + } + + ui->lcd_regvalue->display(QString::number(value, 16)); +} + +/*************************************************************************************************/ +void MainWindow::on_btn_writeReg_clicked() +{ + auto bar = ui->cb_regBarNum->currentText().toUInt(); + + auto offset = ui->tb_regIndicator->text().toUInt(Q_NULLPTR, 16); + if(offset == 0 && ui->tb_regIndicator->text() != "0") + { + MESSAGE_BOX("Invalid input format for offset"); + return; + } + + auto value = ui->tb_regValue->text().toULong(Q_NULLPTR, 16); + if(value == 0 && ui->tb_regValue->text() != "0") + { + MESSAGE_BOX("Invalid input format for write value"); + return; + } + + auto width = ui->cb_regWidth->currentIndex(); + switch(width) + { + case 0: + if(ui->rbtn_reg->isChecked()) + offset *= 4; + _usd->writeWord(offset, bar, value); + break; + case 1: + if(ui->rbtn_reg->isChecked()) + offset *= 8; + _usd->writeLong(offset, bar, value); + break; + } +} + +/*************************************************************************************************/ +//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::newFpgaProgressVisibility(bool show) +//{ +// ui->prg_fpgaProgram->setVisible(show); +//} + +/*************************************************************************************************/ +void MainWindow::on_btn_fpgaBrowse_clicked() +{ + QFileDialog fileDialog; + fileDialog.setNameFilters({"FPGA program file (*.bit)"}); + auto result = fileDialog.exec(); + + if(result) + { + auto selectedPath = fileDialog.selectedFiles()[0]; + ui->tb_fpgaBit->setText(selectedPath); + _settings->setValue(FPGA_FILE_PATH, selectedPath); + } +} + +/*************************************************************************************************/ +void MainWindow::on_btn_fpgaProgram_clicked() +{ +// auto bar = 0; +// auto offset = 0x400; + + auto path = ui->tb_fpgaBit->text(); + try { + trx.slaveFpgaProgram(path); + return; + } + catch (SonoException& e) { + qDebug() << e.what(); + + } + +// QFutureWatcher watcher; +// connect(&watcher, &QFutureWatcher::finished, this, &MainWindow::threadFinished); +// auto future = QtConcurrent::run(this, &MainWindow::fpgaProgrammer, bar, offset, path); +// watcher.setFuture(future); +// _dial->exec(); +// disconnect(&watcher, &QFutureWatcher::finished, this, &MainWindow::threadFinished); +} + +/*************************************************************************************************/ +void MainWindow::newMessage(QString message) +{ + QMessageBox msgBox; + msgBox.setText(message); + msgBox.exec(); +} + +/*************************************************************************************************/ +//void MainWindow::threadFinished() +//{ +// _dial->close(); +//} + +///*************************************************************************************************/ +//QString MainWindow::WhichFpgaFailed(quint32 status) +//{ +// status = (status >> 12) & 0x07; +// QString failedFpga = ""; + +// if((status & 0x01) == 0) +// { +// failedFpga += "FPGA0 "; +// } +// if((status & 0x02) == 0) +// { +// failedFpga += "FPGA1 "; +// } +// if((status & 0x04) == 0) +// { +// failedFpga += "FPGA2"; +// } + +// return failedFpga; +//} + +///*************************************************************************************************/ +//void MainWindow::on_btn_scenarioBrowse_clicked() +//{ +// QFileDialog fileDialog; +// fileDialog.setNameFilters({"SRAM binary file (*.bin)"}); +// auto result = fileDialog.exec(); + +// if(result) +// { +// auto selectedPath = fileDialog.selectedFiles()[0]; +// ui->tb_scenarioFile->setText(selectedPath); +// _settings->setValue(SCENARIO_FILE_PATH, selectedPath); +// } +//} + +///*************************************************************************************************/ +//void MainWindow::on_btn_scenarioVerify_clicked() +//{ +// auto bar = 1; + +// auto offset = 0; + +// auto path = ui->tb_scenarioFile->text(); + +// QFutureWatcher watcher; +// connect(&watcher, &QFutureWatcher::finished, this, &MainWindow::threadFinished); +// auto future = QtConcurrent::run(this, &MainWindow::scenarioFileVerifier, bar, offset, path); +// watcher.setFuture(future); +// _dial->exec(); +// disconnect(&watcher, &QFutureWatcher::finished, this, &MainWindow::threadFinished); +//} + +///*************************************************************************************************/ +//void MainWindow::on_btn_ParamBrowse_clicked() +//{ +// QFileDialog fileDialog; +// fileDialog.setNameFilters({"Scenario param file (*.csv)"}); +// auto result = fileDialog.exec(); + +// if(result) +// { +// auto selectedPath = fileDialog.selectedFiles()[0]; +// ui->tb_paramFile->setText(selectedPath); +// _settings->setValue(PARAM_FILE_PATH, selectedPath); +// } +//} + +///*************************************************************************************************/ +//void MainWindow::on_btn_scenarioUpload_clicked() +//{ +// uint32_t offsetSlvScenCmd[3] = {0x134000*4,0x234000*4,0x334000*4}; +// auto bar = 0; + +// auto scenarioBar = 1; +// auto paramBar = 0; + +// auto scenarioOffset = 0; + +// auto scenarioPath = ui->tb_scenarioFile->text(); +// auto paramPath = ui->tb_paramFile->text(); + +// scenarioStop(); + +// qDebug() << "--- Clear Scen Register Valid Register --- "; +// for (auto i=0 ; i<3;i++) +// { +// _usd->writeWord(offsetSlvScenCmd[i], bar, 0X0); +// } + +// QFutureWatcher watcher; +// connect(&watcher, &QFutureWatcher::finished, this, &MainWindow::threadFinished); +// auto future = QtConcurrent::run(this, &MainWindow::binFileUploader, scenarioBar, scenarioOffset, scenarioPath, ui->prg_scenarioUpload); +// watcher.setFuture(future); +// _dial->exec(); +// disconnect(&watcher, &QFutureWatcher::finished, this, &MainWindow::threadFinished); + +// _csvReadStopFlag = false; +// connect(&watcher, &QFutureWatcher::finished, this, &MainWindow::threadFinished); +// future = QtConcurrent::run(this, &MainWindow::CsvFileUploader, paramBar, paramPath, ui->prg_scenarioUpload); +// watcher.setFuture(future); +// _dial->exec(); +// disconnect(&watcher, &QFutureWatcher::finished, this, &MainWindow::threadFinished); + + + +// qDebug() << "--- SET Scen Register Valid Register --- "; +// for (auto i=0 ; i<3;i++) +// { +// _usd->writeWord(offsetSlvScenCmd[i], bar, 0X1); +// } + +// qDebug() << "--- SET GT Send Mode :: BF --- "; +// _usd->writeWord(0x4*4, bar, 0X1); +// delay(20); + + + +//} + +///*************************************************************************************************/ +//void MainWindow::on_btn_scenarioStartStop_clicked() +//{ +// auto bar = 0; +// //auto offset = 0; + +// auto startIndex = ui->tb_startIndex->text().toUInt(Q_NULLPTR, 16); +// if(startIndex == 0 && ui->tb_startIndex->text() != "0") +// { +// MESSAGE_BOX("Invalid input format for start index"); +// return; +// } + +// auto stopIndex = ui->tb_stopIndex->text().toUInt(Q_NULLPTR, 16); +// if(stopIndex == 0 && ui->tb_stopIndex->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 str = ui->btn_scenarioStartStop->text(); +// if(str == START) +// { +// ui->btn_scenarioStartStop->setText(STOP); +// scenarioStart(); +// } +// else +// { +// ui->btn_scenarioStartStop->setText(START); +// scenarioStop(); +// } +//} + +///*************************************************************************************************/ +//void MainWindow::on_btn_scenarioPauseResume_clicked() +//{ +// auto bar = 0; +// auto offset = 0x800; +// auto scenCtrlReg = _usd->readWord(offset, bar); +// if (~(scenCtrlReg & 0x01)) +// { +// return; +// } + +// auto str = ui->btn_scenarioPauseResume->text(); +// if(str == PAUSE) +// { +// auto value = 0; +// _usd->writeWord(offset, bar, scenCtrlReg | 0x4); +// ui->btn_scenarioPauseResume->setText(RESUME); +// } +// else +// { +// auto value = 0; +// _usd->writeWord(offset, bar, scenCtrlReg & 0xf3); +// ui->btn_scenarioPauseResume->setText(PAUSE); +// } +//} + +///*************************************************************************************************/ +//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) +{ +// auto bar = 0; +// auto offset = 0x26008; + + //on probe change + auto indx = ui->cb_selectedProbe->currentIndex(); +// auto value = 0; +// value = _usd->readWord(offset, bar); +// value = value & 0xFFFFFFF0; +// if(indx == 0){ +// _usd->writeWord(offset, bar, value | 0x1); +// }else if(indx == 1){ +// _usd->writeWord(offset, bar, value | 0x2); +// }else if(indx == 2){ +// _usd->writeWord(offset, bar, value | 0x3); +// }else { +// _usd->writeWord(offset, bar, value | 0x4); +// } + + if(indx == 0){ + trx.selectProbe(prbA); + }else if(indx == 1){ + trx.selectProbe(prbB); + }else if(indx == 2){ + trx.selectProbe(prbC); + }else { + trx.selectProbe(prbD); + } + +} + +/*************************************************************************************************/ +/*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::on_btn_HVOnOff_clicked() +//{ +//// auto bar = 0; +//// auto offset = 0x26008; + +// auto name = ui->btn_HVOnOff->text(); + +// if (name==HV_ON){ +//// auto value = 0; +//// value = _usd->readWord(offset, bar); +//// _usd->writeWord(offset, bar, value | 0x100); +// trx.init(); +// ui->btn_HVOnOff->setText("Probe ctrl init"); +// } +// else{ +//// auto value = 0; +//// value = _usd->readWord(offset, bar); +//// _usd->writeWord(offset, bar, value & (0xFFFFFEFF)); +//// relay.setHvMuxPwrEn(false); +//// ui->btn_HVOnOff->setText(HV_OFF); +// } + +//} + +///*************************************************************************************************/ +//void MainWindow::on_btn_motorOnOff_clicked() +//{ +//// auto bar = 0; +//// auto offset = 0x26008; + +// auto name = ui->btn_motorOnOff->text(); + +// if (name==MOTOR_ON){ +//// auto value = 0; +//// value = _usd->readWord(offset, bar); +//// _usd->writeWord(offset, bar, value | 0x200); +//// relay.setMotorMuxPwrEn(true); +//// ui->btn_motorOnOff->setText(MOTOR_OFF); +// trx.init(); +// ui->btn_motorOnOff->setText("Probe ctrl init"); +// } +// else{ +//// auto value = 0; +//// value = _usd->readWord(offset, bar); +//// _usd->writeWord(offset, bar, value & (0xFFFFFDFF)); +//// relay.setMotorMuxPwrEn(false); +//// ui->btn_motorOnOff->setText(MOTOR_ON); +// } +//} + +///*************************************************************************************************/ +//void MainWindow::on_btn_pwr1OnOff_clicked() +//{ +//// auto bar = 0; +//// auto offset = 0x26008; + +// auto name = ui->btn_pwr1OnOff->text(); + +// if (name==PWR1_ON){ +//// auto value = 0; +//// value = _usd->readWord(offset, bar); +//// _usd->writeWord(offset, bar, value | (0x10)); +//// relay.setProbeALowPwrEn(true); +//// ui->btn_pwr1OnOff->setText(PWR1_OFF); +// trx.init(); +// ui->btn_pwr1OnOff->setText("Probe ctrl init"); +// } +// else{ +//// auto value = 0; +//// value = _usd->readWord(offset, bar); +//// _usd->writeWord(offset, bar, value & (0xFFFFFFEF)); +//// relay.setProbeALowPwrEn(false); +//// ui->btn_pwr1OnOff->setText(PWR1_ON); +// } +//} + +///*************************************************************************************************/ +//void MainWindow::on_btn_pwr2OnOff_clicked() +//{ +//// auto bar = 0; +//// auto offset = 0x26008; + +// auto name = ui->btn_pwr2OnOff->text(); + +// if (name==PWR2_ON){ +//// auto value = 0; +//// value = _usd->readWord(offset, bar); +//// _usd->writeWord(offset, bar, value | (0x20)); +//// relay.setProbeBLowPwrEn(true); +//// ui->btn_pwr2OnOff->setText(PWR2_OFF); +// trx.init(); +// ui->btn_pwr2OnOff->setText("Probe ctrl init"); +// } +// else{ +//// auto value = 0; +//// value = _usd->readWord(offset, bar); +//// _usd->writeWord(offset, bar, value & (0xFFFFFFDF)); +//// relay.setProbeBLowPwrEn(false); +//// ui->btn_pwr2OnOff->setText(PWR2_ON); +// } +//} + +///*************************************************************************************************/ +//void MainWindow::on_btn_pwr3OnOff_clicked() +//{ +//// auto bar = 0; +//// auto offset = 0x26008; + +// auto name = ui->btn_pwr3OnOff->text(); + +// if (name==PWR3_ON){ +//// auto value = 0; +//// value = _usd->readWord(offset, bar); +//// _usd->writeWord(offset, bar, value | (0x40)); +//// relay.setProbeCLowPwrEn(true); +//// ui->btn_pwr3OnOff->setText(PWR3_OFF); +// trx.init(); +// ui->btn_pwr3OnOff->setText("Probe ctrl init"); +// } +// else{ +//// auto value = 0; +//// value = _usd->readWord(offset, bar); +//// _usd->writeWord(offset, bar, value & (0xFFFFFFBF)); +//// relay.setProbeCLowPwrEn(false); +//// ui->btn_pwr3OnOff->setText(PWR3_ON); +// } +//} + +///*************************************************************************************************/ +//void MainWindow::on_btn_pwr4OnOff_clicked() +//{ +//// auto bar = 0; +//// auto offset = 0x26008; + +// auto name = ui->btn_pwr4OnOff->text(); + +// if (name==PWR4_ON){ +//// auto value = 0; +//// value = _usd->readWord(offset, bar); +//// _usd->writeWord(offset, bar, value | (0x80)); +//// relay.setProbeDLowPwrEn(true); +//// ui->btn_pwr4OnOff->setText(PWR4_OFF); +// trx.init(); +// ui->btn_pwr4OnOff->setText("Probe ctrl init"); +// } +// else{ +//// auto value = 0; +//// value = _usd->readWord(offset, bar); +//// _usd->writeWord(offset, bar, value & (0xFFFFFF7F)); +//// relay.setProbeDLowPwrEn(false); +//// ui->btn_pwr4OnOff->setText(PWR4_ON); +// } +//} + +/*************************************************************************************************/ +//void MainWindow::on_btn_thsdStateUpdate_clicked() +//{ +// auto bar = 0; +// auto offset = 0x43C37C; + +// auto thsd_f1_temp = _usd->readWord(offset, bar); +// auto thsd_f1 = thsd_f1_temp & 0x0000000F; +// auto color = checkTermalShutdown(thsd_f1) ? Qt::green : Qt::red; +// changeLabelTextColor(ui->l_thermalShutdownFpga1, color); +// ui->l_thermalShutdownFpga1->setText(QString::number(thsd_f1, 16)); +// delay (100); + +// auto thsd_f2_temp = _usd->readWord(offset+0x400000, bar); +// auto thsd_f2 = thsd_f2_temp&0x0000000F; +// color = checkTermalShutdown(thsd_f2) ? Qt::green : Qt::red; +// changeLabelTextColor(ui->l_thermalShutdownFpga2, color); +// ui->l_thermalShutdownFpga2->setText(QString::number(thsd_f2, 16)); +// delay (100); + +// auto thsd_f3_temp = _usd->readWord(offset+0x800000, bar); +// auto thsd_f3 = thsd_f3_temp&0x0000000F; +// color = checkTermalShutdown(thsd_f3) ? Qt::green : Qt::red; +// changeLabelTextColor(ui->l_thermalShutdownFpga3, color); +// ui->l_thermalShutdownFpga3->setText(QString::number(thsd_f3, 16)); +//}*/ + +/********************************************************************/ +void MainWindow::delay(int ms) +{ + QEventLoop* loop; + QTimer* timer; + timer->singleShot(ms, loop, SLOT(QEventLoop::quit)); +// connect(&timer, &QTimer::timeout, &loop, &QEventLoop::quit); +// timer.start(msec); + loop->exec(); +// timer.stop(); +} + +/*************************************************************************************************/ +/*********************************************DMA*************************************************/ +/*************************************************************************************************/ +//void MainWindow::on_pushButton_3_clicked() +//{ +// _usd->device->fillRam(); +//} + + +///*************************************************************************************************/ +//#define TRANSFER_LENGTH 4 * 1024 * 1024 +//void MainWindow::on_btn_dmaStart_2_clicked() +//{ +// auto name = ui->btn_dmaStart_2->text(); + +// if (name==START) +// { +// ui->btn_dmaStart_2->setText(STOP); +// _usd->device->stopTransfer(); + +// _swCounter = 0; +// _hwCounter = _usd->device->getCounter(); + +// _usd->device->setRamOffsetAddress(0); +// _usd->device->setTransferLength(TRANSFER_LENGTH); +// _usd->device->setOptions(false); +// _usd->device->setMode(true); +// _usd->device->setTransferRate(30.0f); + +// _usd->device->startTransfer(ui->chk_emulatorEn->isChecked()); + +// _dmaBuffer.clear(); +// _dmaRun = true; +// _dmaLog = true; +// _dmaLogCount = 0; +// QtConcurrent::run(this, &MainWindow::readPcie); +// QtConcurrent::run(this, &MainWindow::logPcie); +// } +// else +// { +// ui->btn_dmaStart_2->setText(START); +// _dmaRun = false; +// _dmaLog = false; +// _usd->device->stopTransfer(); +// } +//} + +//void MainWindow::on_btn_dmaStop_2_clicked() +//{ +// //_dmaRun = false; +// //12_usd->device->stopTransfer(); +//} + +//void MainWindow::on_btn_dmaBrowse_2_clicked() +//{ +// QFileDialog dialog; +// dialog.setFileMode(QFileDialog::Directory); +// dialog.setOption(QFileDialog::ShowDirsOnly); +// auto result = dialog.exec(); + +// if(result) +// { +// _logFolder = dialog.selectedFiles()[0]; +// } +//} + +//void MainWindow::on_btn_dmaShow_2_clicked() +//{ +// QByteArray temp = _lastBuffer; + +// QVector x, y; + +// int i = 0; +// for(auto j = 0; j < TRANSFER_LENGTH; j += 8) +// { +// x.push_back(i++); +// auto val = ((static_cast(temp[j])) & 0x00000000000000FF) | +// (((static_cast(temp[j + 1])) << 8) & 0x000000000000FF00) | +// (((static_cast(temp[j + 2])) << 16) & 0x0000000000FF0000) | +// (((static_cast(temp[j + 3])) << 24) & 0x00000000FF000000) | +// (((static_cast(temp[j + 4])) << 32) & 0x000000FF00000000) | +// (((static_cast(temp[j + 5])) << 40) & 0x0000FF0000000000) | +// (((static_cast(temp[j + 6])) << 48) & 0x00FF000000000000) | +// (((static_cast(temp[j + 7])) << 56) & 0xFF00000000000000); + +// y.push_back(val); +// } +// ui->plot_2->addGraph(); +// ui->plot_2->graph(0)->setData(x, y); +// //give the axes some labels: +// ui->plot_2->xAxis->setLabel("sample no"); +// ui->plot_2->yAxis->setLabel("sample value"); +// //set axes ranges, so we see all data: +// ui->plot_2->rescaleAxes(); +// ui->plot_2->replot(); +//} + +//void MainWindow::readPcie() +//{ +// while(_dmaRun) +// { +// auto cnt = _usd->device->getCounter(); + +// if(cnt == 0) +// { +// std::this_thread::delay_for(std::chrono::milliseconds(3)); +// continue; +// } +// if(cnt != _hwCounter) +// { +// _hwCounter++; +// if(_hwCounter > HW_BUFFER_NUM) +// { +// _hwCounter = 1; +// } + +// _usd->device->copy(_hwCounter - 1, _swCounter); + +// auto temp = QByteArray::fromRawData(_usd->device->getBufferPtr(_swCounter), TRANSFER_LENGTH); + +// _mutex.lock(); +// _dmaBuffer.push_back(temp); +// _mutex.unlock(); + +// _lastBuffer = temp; + +// _swCounter++; +// if(_swCounter >= SW_BUFFER_NUM) +// { +// _swCounter = 0; +// } +// } +// } +//} + +//void MainWindow::logPcie() +//{ +// int i = 0; +// while(_dmaLog) +// { +// if(_dmaBuffer.size() == 0) +// { +// std::this_thread::delay_for(std::chrono::milliseconds(3)); +// continue; +// } +// QByteArray temp; + +// _mutex.lock(); +// temp = _dmaBuffer.front(); +// _dmaBuffer.pop_front(); +// _mutex.unlock(); + +// _dmaLogCount +=1; +// if (_dmaLogCount == 50) +// _dmaLog = false; + +// QString path = _logFolder + QString("/%1.bin").arg(i++); +// QFile file(path); + +// file.open(QIODevice::WriteOnly); +// file.write(temp); + + +//// for(auto j = 0; j < TRANSFER_LENGTH; j += 8) +//// { +//// auto val = ((static_cast(temp[j])) & 0x00000000000000FF) | +//// (((static_cast(temp[j + 1])) << 8) & 0x000000000000FF00) | +//// (((static_cast(temp[j + 2])) << 16) & 0x0000000000FF0000) | +//// (((static_cast(temp[j + 3])) << 24) & 0x00000000FF000000) | +//// (((static_cast(temp[j + 4])) << 32) & 0x000000FF00000000) | +//// (((static_cast(temp[j + 5])) << 40) & 0x0000FF0000000000) | +//// (((static_cast(temp[j + 6])) << 48) & 0x00FF000000000000) | +//// (((static_cast(temp[j + 7])) << 56) & 0xFF00000000000000); +//// auto str = QStringLiteral("%1").arg(val, 16, 16, QLatin1Char('0')); +//// file.write(str.toStdString().c_str(), str.length()); +//// file.write("\r\n", 2); +//// } + +// file.close(); +// } +//} + +///*************************************************************************************************/ +///********************************************Power************************************************/ +///*************************************************************************************************/ + +//void MainWindow::on_btn_hvRegulatorConfig_clicked() +//{ +// auto name=ui->btn_hvRegulatorConfig->text(); +// auto freq=ui->tb_hvFreq->text().toFloat(Q_NULLPTR); + +// if(name==ENABLE) +// { +//// freq<65.00f ? freq=65.00f : freq=freq; +//// freq>130.00f ? freq=130.00f : freq=freq; +//// pwr.setHVsRegulator(true, true, freq); +//// pwr.setHVsRegulator(true, false, freq); +//// auto real_freq=pwr.getHVsRegulatorFreq(); +//// ui->tb_hvFreq->setText(QString("%1").arg(real_freq)); +//// ui->btn_hvRegulatorConfig->setText(DISABLE); +// } +// else +// { +//// pwr.setHVsRegulator(false, false, freq); +//// ui->btn_hvRegulatorConfig->setText(ENABLE); +// } + +//} + +///*************************************************************************************************/ +//void MainWindow::on_btn_pm5RegulatorConfig_clicked() +//{ +// auto name=ui->btn_pm5RegulatorConfig->text(); +// auto freq=ui->tb_pm5Freq->text().toFloat(Q_NULLPTR); + +// if(name==ENABLE) +// { +//// freq<280.00f ? freq=280.00f : freq=freq; +//// freq>400.00f ? freq=400.00f : freq=freq; +//// pwr.setPM5vRegulator(true, true, freq); +//// pwr.setPM5vRegulator(true, false, freq); +//// auto real_freq=pwr.getPM5vRegulatorFreq(); +//// ui->tb_pm5Freq->setText(QString("%1").arg(real_freq)); +//// ui->btn_pm5RegulatorConfig->setText(DISABLE); +// } +// else +// { +//// pwr.setPM5vRegulator(false, false, freq); +//// ui->btn_pm5RegulatorConfig->setText(ENABLE); +// } +//} +///*************************************************************************************************/ +//void MainWindow::on_btn_pwrDacsEnable_clicked() +//{ +// // bool i2cBusy, i2cDone; +// auto hvaValue=ui->tb_hvaDacValue->text().toFloat(Q_NULLPTR); +// auto hvbValue=ui->tb_hvbDacValue->text().toFloat(Q_NULLPTR); +// auto cwdValue=ui->tb_cwdDacValue->text().toFloat(Q_NULLPTR); + +//// if (hvaValue>85) { +//// MESSAGE_BOX("HVA value is greater than determined limits"); +//// hvaValue=85.00f; +//// } +//// else if (hvaValue<1.53f){ +//// MESSAGE_BOX("HVA value is less than determined limits"); +//// hvaValue=1.53f; +//// } + +//// if (hvaValue6.90f) { +//// MESSAGE_BOX("CWD value is greater than determined limits"); +//// cwdValue=6.90f; +//// } +//// else if (cwdValue<1.54f){ +//// MESSAGE_BOX("CWD value is less than determined limits"); +//// cwdValue=1.54f; +//// } + +//// auto cwdDacsEnable=pwr.getSetupCmdCwdOnOff(); +//// if (cwdDacsEnable){ +//// hvbValue=1.53f; +//// hvaValue<10.00f ? hvaValue=10.00f : hvaValue=hvaValue; +//// } + +//// i2cBusy=pwr.getI2cBusy(); +//// while (i2cBusy==true) { +//// i2cBusy=pwr.getI2cBusy(); +//// } +////// delay(100); + + +//// pwr.setDAcs(true, cwdValue, hvbValue, hvaValue); +//// pwr.setDAcs(false, cwdValue, hvbValue, hvaValue); + +// trx.mpsSetAo(hvaValue, hvbValue); + +//// i2cDone=pwr.getI2cCmdDone(); +//// while (i2cDone==false){ +//// i2cDone=pwr.getI2cCmdDone(); +//// } +//// auto real_HVaValue=pwr.getHVaDAcs(); +//// auto real_HVbValue=pwr.getHVbDAcs(); +//// auto real_CWdValue=pwr.getCWdDAcs(); +//// ui->tb_hvaDacValue->setText(QString::number(real_HVaValue, 'f', 2)); +//// ui->tb_hvbDacValue->setText(QString::number(real_HVbValue, 'f', 2)); +//// ui->tb_cwdDacValue->setText(QString::number(real_CWdValue, 'f', 2)); +//} + +///*************************************************************************************************/ +//void MainWindow::on_btn_DacsOnOff_clicked() +//{ +// bool i2cBusy, i2cDone; + +// auto dacsEnableValue=ui->tb_DacsOnOff->text().toUInt(Q_NULLPTR, 10); +// auto hvaValue=ui->tb_hvaDacValue->text().toFloat(Q_NULLPTR); +// auto cwdValue=ui->tb_cwdDacValue->text().toFloat(Q_NULLPTR); + +//// i2cBusy=pwr.getI2cBusy(); +//// while (i2cBusy==true) { +//// i2cBusy=pwr.getI2cBusy(); +//// } +//// // delay(100); + +//// switch (dacsEnableValue) { +//// case 1 : pwr.setSetupCmdDacsOnOff(false, false, true); break; +//// case 3 : pwr.setSetupCmdDacsOnOff(false, true, true); break; +//// case 5 : hvaValue<10.00f ? hvaValue=10.00f : hvaValue=hvaValue; +//// pwr.setDAcs(true, cwdValue, 1.53f, hvaValue); +//// pwr.setDAcs(false, cwdValue, 1.53f, hvaValue); +//// i2cDone=pwr.getI2cCmdDone(); +//// while (i2cDone==false){ +//// i2cDone=pwr.getI2cCmdDone(); +//// } +//// pwr.setSetupCmdDacsOnOff(true, false, true); +//// break; +//// default: pwr.setSetupCmdDacsOnOff(false, false, false); break; +//// } + +//// i2cDone=pwr.getI2cCmdDone(); +//// while (i2cDone==false){ +//// i2cDone=pwr.getI2cCmdDone(); +//// } + +//// auto real_HVaValue=pwr.getHVaDAcs(); +//// auto real_HVbValue=pwr.getHVbDAcs(); +//// auto real_CWdValue=pwr.getCWdDAcs(); +//// ui->tb_hvaDacValue->setText(QString::number(real_HVaValue, 'f', 2)); +//// ui->tb_hvbDacValue->setText(QString::number(real_HVbValue, 'f', 2)); +//// ui->tb_cwdDacValue->setText(QString::number(real_CWdValue, 'f', 2)); +//} + +///*************************************************************************************************/ +//void MainWindow::on_chk_sup24v_stateChanged(int arg1) +//{ +// bool i2cBusy, i2cDone; + +//// i2cBusy=pwr.getI2cBusy(); +//// while (i2cBusy==true) { +//// i2cBusy=pwr.getI2cBusy(); +//// } + +// if (ui->chk_sup24v->isChecked()) +// { +//// i2cBusy=pwr.getI2cBusy(); +//// while (i2cBusy==true) { +//// i2cBusy=pwr.getI2cBusy(); +//// } +//// // delay (100); + +// trx.init(); // p24_On +//// i2cDone=pwr.getI2cCmdDone(); +//// while (i2cDone==false){ +//// i2cDone=pwr.getI2cCmdDone(); +//// } +// } + +// else +// { +//// i2cBusy=pwr.getI2cBusy(); +//// while (i2cBusy==true) { +//// i2cBusy=pwr.getI2cBusy(); +//// } +//// // delay (100); + +//// pwr.setSetupCmdP24vOnOff(false); // p24_Off +//// i2cDone=pwr.getI2cCmdDone(); +//// while (i2cDone==false){ +//// i2cDone=pwr.getI2cCmdDone(); +//// } +// } + + +//} + +///*************************************************************************************************/ + +//void MainWindow::on_btn_supJump_clicked() +//{ +//// bool i2cBusy, i2cDone; + +//// i2cBusy=pwr.getI2cBusy(); +//// while (i2cBusy==true) { +//// i2cBusy=pwr.getI2cBusy(); +//// } + +//// pwr.setSetupCmdJmp(true); // jump +//// pwr.setSetupCmdJmp(false); + +//// i2cDone=pwr.getI2cCmdDone(); +//// while (i2cDone==false){ +//// i2cDone=pwr.getI2cCmdDone(); +//// } +// trx.mpsReset(); +//} + +/*************************************************************************************************/ +void MainWindow::on_btn_updateRdbackValue_clicked() +{ + + SupervisorRbValue* supRbValue; + trx.supervisorRbValue(supRbValue); + + + auto hvapValue=supRbValue->hvap; + ui->l_hvap->setText(QString::number(hvapValue, 'f', 3)); + delay(10); + + auto hvbpValue=supRbValue->hvbp; + ui->l_hvbp->setText(QString::number(hvbpValue, 'f', 3)); + delay(10); + + auto cwdpValue=supRbValue->cwdp; + ui->l_cwdp->setText(QString::number(cwdpValue, 'f', 3)); + delay(10); + + auto curr24vValue=supRbValue->curr24V; + ui->l_curr24v->setText(QString::number(curr24vValue, 'f', 3)); + delay(10); + + auto p24vValue=supRbValue->p24V; + ui->l_p24v->setText(QString::number(p24vValue, 'f', 3)); + delay(10); + + auto p12vValue=supRbValue->p12V; + ui->l_p12v->setText(QString::number(p12vValue, 'f', 3)); + delay(10); + + auto p5vValue=supRbValue->p5V; + ui->l_p5v->setText(QString::number(p5vValue, 'f', 3)); + delay(10); + + auto m5vValue=supRbValue->m5V; + ui->l_m5v->setText(QString::number(m5vValue, 'f', 3)); + delay(10); + + auto hvStopValue=supRbValue->hvStop; + ui->l_hvStop->setText(QString::number(hvStopValue, 'f', 3)); + delay(10); + + auto p4dValue=supRbValue->p4D; + ui->l_p4d->setText(QString::number(p4dValue, 'f', 3)); + delay(10); + + /********************Faults***********************/ + MpsFaultStatus* faultStatus; + trx.mpsFaultStatus(faultStatus); + + bool hvapFlt=faultStatus->hvap; + ui->l_hvapFlt->setText(QVariant(hvapFlt).toString()); + auto colorHvapFlt = hvapFlt ? Qt::red : Qt::green; + changeLabelTextColor(ui->l_hvapFlt, colorHvapFlt); + delay(10); + + bool hvbpFlt=faultStatus->hvbp; + ui->l_hvbpFlt->setText(QVariant(hvbpFlt).toString()); + auto colorHvbpFlt = hvbpFlt ? Qt::red : Qt::green; + changeLabelTextColor(ui->l_hvbpFlt, colorHvbpFlt); + delay(10); + + bool cwdpFlt=faultStatus->cwdp; + ui->l_cwdFlt->setText(QVariant(cwdpFlt).toString()); + auto colorCwdpFlt = cwdpFlt ? Qt::red : Qt::green; + changeLabelTextColor(ui->l_cwdFlt, colorCwdpFlt); + delay(10); + + bool cur24vFlt=faultStatus->curr24V; + ui->l_curr24vFlt->setText(QVariant(cur24vFlt).toString()); + auto colorCur24vFlt = cur24vFlt ? Qt::red : Qt::green; + changeLabelTextColor(ui->l_curr24vFlt, colorCur24vFlt); + delay(10); + + bool p24vFlt=faultStatus->p24v; + ui->l_p24vFlt->setText(QVariant(p24vFlt).toString()); + auto colorP24vFlt = p24vFlt ? Qt::red : Qt::green; + changeLabelTextColor(ui->l_p24vFlt, colorP24vFlt); + delay(10); + + bool p12vFlt=faultStatus->p12v; + ui->l_p12vFlt->setText(QVariant(p12vFlt).toString()); + auto colorP12vFlt = p12vFlt ? Qt::red : Qt::green; + changeLabelTextColor(ui->l_p12vFlt, colorP12vFlt); + delay(10); + + bool p5vFlt=faultStatus->p5v; + ui->l_p5vFlt->setText(QVariant(p5vFlt).toString()); + auto colorP5vFlt = p5vFlt ? Qt::red : Qt::green; + changeLabelTextColor(ui->l_p5vFlt, colorP5vFlt); + delay(10); + + bool m5vFlt=faultStatus->m5v; + ui->l_m5vFlt->setText(QVariant(m5vFlt).toString()); + auto colorM5vFlt = m5vFlt ? Qt::red : Qt::green; + changeLabelTextColor(ui->l_m5vFlt, colorM5vFlt); + delay(10); + + bool hvFlt=faultStatus->hvError; + ui->l_hvFlt->setText(QVariant(hvFlt).toString()); + auto colorHvFlt = hvFlt ? Qt::red : Qt::green; + changeLabelTextColor(ui->l_hvFlt, colorHvFlt); + delay(10); + + bool sup4dFlt=faultStatus->sup4d; + ui->l_p4dFlt->setText(QVariant(sup4dFlt).toString()); + auto colorP4dFlt = sup4dFlt ? Qt::red : Qt::green; + changeLabelTextColor(ui->l_p4dFlt, colorP4dFlt); + delay(10); + + /******************Faults_Over*********************/ + bool ovrHvapFlt=faultStatus->overHvap; + ui->l_ovrHVapFlt->setText(QVariant(ovrHvapFlt).toString()); + auto colorOvrHvapFlt = ovrHvapFlt ? Qt::red : Qt::green; + changeLabelTextColor(ui->l_ovrHVapFlt, colorOvrHvapFlt); + delay(10); + + bool ovrHvbpFlt=faultStatus->overHvbp; + ui->l_ovrHVbpFlt->setText(QVariant(ovrHvbpFlt).toString()); + auto colorOvrHvbpFlt = ovrHvbpFlt ? Qt::red : Qt::green; + changeLabelTextColor(ui->l_ovrHVbpFlt, colorOvrHvbpFlt); + delay(10); + + bool ovrCwdpFlt=faultStatus->overCwdp; + ui->l_ovrCWdpFlt->setText(QVariant(ovrCwdpFlt).toString()); + auto colorOvrCwdpFlt = ovrCwdpFlt ? Qt::red : Qt::green; + changeLabelTextColor(ui->l_ovrCWdpFlt, colorOvrCwdpFlt); + delay(10); + + bool ovrCur24vFlt=faultStatus->overCurr24V; + ui->l_ovrCur24vFlt->setText(QVariant(ovrCur24vFlt).toString()); + auto colorOvrCur24vFlt = ovrCur24vFlt ? Qt::red : Qt::green; + changeLabelTextColor(ui->l_ovrCur24vFlt, colorOvrCur24vFlt); + delay(10); + + bool ovrP24vFlt=faultStatus->overP24v; + ui->l_ovrP24vFlt->setText(QVariant(ovrP24vFlt).toString()); + auto colorOvrP24vFlt = ovrP24vFlt ? Qt::red : Qt::green; + changeLabelTextColor(ui->l_ovrP24vFlt, colorOvrP24vFlt); + delay(10); + + bool ovrP12vFlt=faultStatus->overP12v; + ui->l_ovrP12vFlt->setText(QVariant(ovrP12vFlt).toString()); + auto colorOvrP12vFlt = ovrP12vFlt ? Qt::red : Qt::green; + changeLabelTextColor(ui->l_ovrP12vFlt, colorOvrP12vFlt); + delay(10); + + bool ovrP5vFlt=faultStatus->overP5v; + ui->l_ovrP5vFlt->setText(QVariant(ovrP5vFlt).toString()); + auto colorOvrP5vFlt = ovrP5vFlt ? Qt::red : Qt::green; + changeLabelTextColor(ui->l_ovrP5vFlt, colorOvrP5vFlt); + delay(10); + + bool ovrM5vFlt=faultStatus->overM5v; + ui->l_ovrM5vFlt->setText(QVariant(ovrM5vFlt).toString()); + auto colorOvrM5vFlt = ovrM5vFlt ? Qt::red : Qt::green; + changeLabelTextColor(ui->l_ovrM5vFlt, colorOvrM5vFlt); + delay(10); + + bool ovrHvFlt=faultStatus->overHvError; + ui->l_ovrHvFlt->setText(QVariant(ovrHvFlt).toString()); + auto colorOvrHvFlt = ovrHvFlt ? Qt::red : Qt::green; + changeLabelTextColor(ui->l_ovrHvFlt, colorOvrHvFlt); + delay(10); + + bool ovrSup4dFlt=faultStatus->overSup4d; + ui->l_ovr4dFlt->setText(QVariant(ovrSup4dFlt).toString()); + auto colorOvrP4dFlt = ovrSup4dFlt ? Qt::red : Qt::green; + changeLabelTextColor(ui->l_ovr4dFlt, colorOvrP4dFlt); + delay(10); + + /******************Faults_Under*********************/ + bool udrHvapFlt=faultStatus->underHvap; + ui->l_udrHVapFlt->setText(QVariant(udrHvapFlt).toString()); + auto colorUdrHvapFlt = udrHvapFlt ? Qt::red : Qt::green; + changeLabelTextColor(ui->l_udrHVapFlt, colorUdrHvapFlt); + delay(10); + + bool udrHvbpFlt=faultStatus->underHvbp; + ui->l_udrHVbpFlt->setText(QVariant(udrHvbpFlt).toString()); + auto colorUdrHvbpFlt = udrHvbpFlt ? Qt::red : Qt::green; + changeLabelTextColor(ui->l_udrHVbpFlt, colorUdrHvbpFlt); + delay(10); + + bool udrCwdpFlt=faultStatus->underCwdp; + ui->l_udrCWdpFlt->setText(QVariant(udrCwdpFlt).toString()); + auto colorUdrCwdpFlt = udrCwdpFlt ? Qt::red : Qt::green; + changeLabelTextColor(ui->l_udrCWdpFlt, colorUdrCwdpFlt); + delay(10); + + bool udrCur24vFlt=faultStatus->underCurr24V; + ui->l_udrCurr24vFlt->setText(QVariant(udrCur24vFlt).toString()); + auto colorUdrCur24vFlt = udrCur24vFlt ? Qt::red : Qt::green; + changeLabelTextColor(ui->l_udrCurr24vFlt, colorUdrCur24vFlt); + delay(10); + + bool udrP24vFlt=faultStatus->underP24v; + ui->l_udrP24vFlt->setText(QVariant(udrP24vFlt).toString()); + auto colorUdrP24vFlt = udrP24vFlt ? Qt::red : Qt::green; + changeLabelTextColor(ui->l_udrP24vFlt, colorUdrP24vFlt); + delay(10); + + bool udrP12vFlt=faultStatus->underP12v; + ui->l_udrP12vFlt->setText(QVariant(udrP12vFlt).toString()); + auto colorUdrP12vFlt = udrP12vFlt ? Qt::red : Qt::green; + changeLabelTextColor(ui->l_udrP12vFlt, colorUdrP12vFlt); + delay(10); + + bool udrP5vFlt=faultStatus->underP5v; + ui->l_udrP5vFlt->setText(QVariant(udrP5vFlt).toString()); + auto colorUdrP5vFlt = udrP5vFlt ? Qt::red : Qt::green; + changeLabelTextColor(ui->l_udrP5vFlt, colorUdrP5vFlt); + delay(10); + + bool udrM5vFlt=faultStatus->underM5v; + ui->l_udrM5vFlt->setText(QVariant(udrM5vFlt).toString()); + auto colorUdrM5vFlt = udrM5vFlt ? Qt::red : Qt::green; + changeLabelTextColor(ui->l_udrM5vFlt, colorUdrM5vFlt); + delay(10); + + bool udrHvFlt=faultStatus->underHvError; + ui->l_udrHvFlt->setText(QVariant(udrHvFlt).toString()); + auto colorUdrHvFlt = udrHvFlt ? Qt::red : Qt::green; + changeLabelTextColor(ui->l_udrHvFlt, colorUdrHvFlt); + delay(10); + + bool udrSup4dFlt=faultStatus->underSup4d; + ui->l_udr4dFlt->setText(QVariant(udrSup4dFlt).toString()); + auto colorUdrP4dFlt = udrSup4dFlt ? Qt::red : Qt::green; + changeLabelTextColor(ui->l_udr4dFlt, colorUdrP4dFlt); + 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_eepromTest_clicked() +//{ +// auto addr = 100; +// QByteArray eepromData("allli"); + +// try { +// auto len = eepromData.length(); +//// ptmMngt.trxEepromWrite(eepromData,addr,len); +//// eepromData = ptmMngt.trxEepromRead(addr, len); +// trxEepromWrite(eepromData, addr, _bCtrl); +// trx.trxInfo(); + +// qDebug() << "EEPROM Data : "<< eepromData; +// } +// catch (SonoException exp) { +// qDebug() << exp.what(); +// } +// catch (...) +// { +// qDebug() << "Others"; +// } + + +//} + +//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); + +//} + +//void MainWindow::on_btn_getFpgaVersion_clicked() +//{ +// uint32_t offsetVersion[4] = {0x4,0x14000C*4,0x24000C*4,0x34000C*4}; +// auto value = _usd->readWord(offsetVersion[0], 0); +// ui->l_masterVersion->setText(QStringLiteral("%1").arg(value, 8, 10)); +// value = _usd->readWord(offsetVersion[1], 0); +// ui->l_slave0Version->setText(QStringLiteral("%1").arg(value, 8, 10)); +// value = _usd->readWord(offsetVersion[2], 0); +// ui->l_slave1Version->setText(QStringLiteral("%1").arg(value, 8, 10)); +// value = _usd->readWord(offsetVersion[3], 0); +// ui->l_slave2Version->setText(QStringLiteral("%1").arg(value, 8, 10)); + + +//} + +//void MainWindow::on_btn_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); + +//} + +void MainWindow::setReceiverConfiguration() +{ + _receiveConfig->mla.clear(); + _receiveConfig->stb.clear(); + _receiveConfig->lpfSel.clear(); + _receiveConfig->aTgcSel.clear(); + _receiveConfig->focusNo.clear(); + _receiveConfig->lineMode.clear(); + _receiveConfig->ncoFreqSel.clear(); + _receiveConfig->absEn.clear(); + _receiveConfig->ddcEn.clear(); + _receiveConfig->dpeEn.clear(); + _receiveConfig->stbEn.clear(); + _receiveConfig->wmfEn.clear(); + _receiveConfig->dcCancelerEn.clear(); + _receiveConfig->lineFilterEn.clear(); + _receiveConfig->subtractFilterEn.clear(); + + for (quint8 i = 0; i < 8; i++){ + _receiveConfig->mla.append(i); + _receiveConfig->stb.append(i*2); + _receiveConfig->lpfSel.append(i*3); + _receiveConfig->aTgcSel.append(i*4); + _receiveConfig->focusNo.append(i*5); + _receiveConfig->lineMode.append(i*6); + _receiveConfig->ncoFreqSel.append(i*7); + _receiveConfig->absEn.append((i % 2)!=0); + _receiveConfig->ddcEn.append((i % 2)!=0); + _receiveConfig->dpeEn.append((i % 2)!=0); + _receiveConfig->stbEn.append((i % 2)!=0); + _receiveConfig->wmfEn.append((i % 2)!=0); + _receiveConfig->dcCancelerEn.append((i % 2)!=0); + _receiveConfig->lineFilterEn.append((i % 2)!=0); + _receiveConfig->subtractFilterEn.append((i % 2)!=0); + } +} + +void MainWindow::on_btn_receiveConfig_clicked() +{ + + ui->l_receiveConfigState->setText("false"); + changeLabelTextColor(ui->l_receiveConfigState, Qt::red); + + trx.scenReceiverConfigurationLut(_receiveConfig); + + ui->l_receiveConfigState->setText("true"); + changeLabelTextColor(ui->l_receiveConfigState, Qt::green); + +} + + +void MainWindow::setLineFilter() +{ + _lineFilter.clear(); + for (quint8 i = 0; i < 4; i++) + { + _lineFilter.append(i*10); + } +} + +void MainWindow::on_btn_lineFilter_clicked() +{ + + ui->l_lineFilter->setText("false"); + changeLabelTextColor(ui->l_lineFilter, Qt::red); + + trx.scenLineFilterCoefficient(_lineFilter); + + ui->l_lineFilter->setText("true"); + changeLabelTextColor(ui->l_lineFilter, Qt::green); + +} + + +void MainWindow::setFreqLut() +{ + _freq.clear(); + for (quint8 i = 0; i < 8; i++) + { + _freq.append(i*10); + } +} + +void MainWindow::on_btn_freqLut_clicked() +{ + + ui->l_freq->setText("false"); + changeLabelTextColor(ui->l_freq, Qt::red); + + trx.scenFrequencyLut(_freq); + + ui->l_freq->setText("true"); + changeLabelTextColor(ui->l_freq, Qt::green); + +} + + +void MainWindow::setStbCoeff() +{ + _stb.clear(); + for (quint8 i = 0; i < 8; i++) + { + _stb.append(i*10); + } +} + +void MainWindow::on_btn_stbCoeff_clicked() +{ + + ui->l_stbCoeff->setText("false"); + changeLabelTextColor(ui->l_stbCoeff, Qt::red); + + trx.scenStbCoefficient(_stb); + + ui->l_stbCoeff->setText("true"); + changeLabelTextColor(ui->l_stbCoeff, Qt::green); + +} + + +void MainWindow::setATgc() +{ + QList temp; + _aTgc.clear(); + + for (quint8 i = 0; i < 4; i++) + { + temp.clear(); + for (quint16 j = 0; j < 256; j++) + { + temp.append(j); + } + _aTgc.append(temp); + } +} + +void MainWindow::on_btn_atgc_clicked() +{ + + ui->l_atgc->setText("false"); + changeLabelTextColor(ui->l_atgc, Qt::red); + + trx.scenAtgcLut(_aTgc); + + ui->l_atgc->setText("true"); + changeLabelTextColor(ui->l_atgc, Qt::green); + +} + + +void MainWindow::setDTgc() +{ + _dTgc.clear(); + for (quint16 i = 0; i < 1024; i++) + { + _dTgc.append(i*10); + } +} + +void MainWindow::on_btn_dtgc_clicked() +{ + + ui->l_dtgc->setText("false"); + changeLabelTextColor(ui->l_dtgc, Qt::red); + + trx.scenDtgcLut(_dTgc); + + ui->l_dtgc->setText("true"); + changeLabelTextColor(ui->l_dtgc, Qt::green); + +} + + +void MainWindow::setBlendWeight() +{ + QList temp; + _blendWeight.clear(); + + for (quint8 i = 0; i < 4; i++) + { + temp.clear(); + for (quint16 j = 0; j < 512; j++) + { + temp.append(j); + } + _blendWeight.append(temp); + } +} + +void MainWindow::on_btn_blendWeight_clicked() +{ + + ui->l_blendWeight->setText("false"); + changeLabelTextColor(ui->l_blendWeight, Qt::red); + + trx.scenBlendWeight(_blendWeight); + + ui->l_blendWeight->setText("true"); + changeLabelTextColor(ui->l_blendWeight, Qt::green); + +} + + +void MainWindow::setLpf() +{ + QList temp; + _lpf.clear(); + + for (quint8 i = 0; i < 4; i++) + { + temp.clear(); + for (quint8 j = 0; j < 48; j++) + { + temp.append(j); + } + _lpf.append(temp); + } +} + +void MainWindow::on_btn_lpf_clicked() +{ + + ui->l_lpf->setText("false"); + changeLabelTextColor(ui->l_lpf, Qt::red); + + trx.scenLpfLut(_lpf); + + ui->l_lpf->setText("true"); + changeLabelTextColor(ui->l_lpf, Qt::green); + +} + + +void MainWindow::on_btn_setAtgcMode_clicked() +{ + auto aTgcMode = ui->cb_aTgcMode->currentIndex(); + auto aTgcValue = ui->tb_aTgcValue->text().toUInt(); + + if (aTgcMode == 0) + trx.setAtgcMode(Auto, 0); + + else + trx.setAtgcMode(Manual, static_cast(aTgcValue)); +} diff --git a/mainwindow.h b/mainwindow.h new file mode 100644 index 0000000..c2af9bb --- /dev/null +++ b/mainwindow.h @@ -0,0 +1,327 @@ +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "include/model/hardware/core/TrxBoard.h" +#include "api.h" + +#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 START "Start" +#define STOP "Stop" + +#define PAUSE "Pause" +#define RESUME "Resume" + +#define ON "On" +#define OFF "Off" + +#define HV_ON "HV_On" +#define HV_OFF "HV_Off" + +#define MOTOR_ON "Motor_On" +#define MOTOR_OFF "Motor_Off" + +#define PWR1_ON "Pwr1_On" +#define PWR1_OFF "Pwr1_Off" + +#define PWR2_ON "Pwr2_On" +#define PWR2_OFF "Pwr2_Off" + +#define PWR3_ON "Pwr3_On" +#define PWR3_OFF "Pwr3_Off" + +#define PWR4_ON "Pwr4_On" +#define PWR4_OFF "Pwr4_Off" + +#define TRIG_ON "Trig_On" +#define TRIG_OFF "Trig_Off" + +#define THSD_State_Update "THSD State Update" + +#define DACS_ENABLE "DACs_Enable" + +#define UPDATE "Update" + +#define VALID "Valid" + +#define ENABLE "Enable" +#define DISABLE "Disable" + + +QT_BEGIN_NAMESPACE +namespace Ui { class MainWindow; } +QT_END_NAMESPACE + +class MainWindow : public QMainWindow +{ + Q_OBJECT + +public: + MainWindow(QWidget *parent = nullptr); + ~MainWindow(); + +private: + Ui::MainWindow *ui; + + TrxBoard trx; + + //WaitDialog* _dial; + + QSettings* _settings; + + UltraSoundDevice* _usd; + + QTimer* _timer; + + int _counter = 0; + + bool _run; + + BoardsCtrlMngt* _bCtrl; + + ReceiverConfiguration* _receiveConfig; + void setReceiverConfiguration (void); + + QList _lineFilter; + void setLineFilter (void); + + QList _freq; + void setFreqLut (void); + + QList _stb; + void setStbCoeff (void); + + QList _dTgc; + void setDTgc (void); + + QList> _aTgc; + void setATgc (void); + + QList> _blendWeight; + void setBlendWeight (void); + + QList> _lpf; + void setLpf (void); + + //void fpgaProgrammer(QString path); + + void timeout(); + + void changeLabelTextColor(QLabel* label, QColor color); + +private slots: + + void on_rbtn_reg_toggled(bool checked); + + void on_rbtn_offset_toggled(bool checked); + + void on_btn_readReg_clicked(); + + 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 threadFinished(); + +// 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_HVOnOff_clicked(); + +// void on_btn_motorOnOff_clicked(); + +// void on_btn_pwr1OnOff_clicked(); + +// void on_btn_pwr2OnOff_clicked(); + +// void on_btn_pwr3OnOff_clicked(); + +// void on_btn_pwr4OnOff_clicked(); + + void delay(int ms); + +// float resDiv(uint32_t r1, uint32_t r2, uint adcValue); + +// void on_btn_mulDacTrig_clicked(); + +// void on_btn_thsdStateUpdate_clicked(); + +// void on_pushButton_3_clicked(); + +// void on_btn_hvRegulatorConfig_clicked(); + +// void on_btn_pm5RegulatorConfig_clicked(); + +// void on_btn_pwrDacsEnable_clicked(); + +// void on_btn_DacsOnOff_clicked(); + + void on_btn_updateRdbackValue_clicked(); + +// void on_btn_supJump_clicked(); + +// void on_chk_sup24v_stateChanged(int arg1); + + +// void on_btn_dmaStart_2_clicked(); + +// void on_btn_dmaStop_2_clicked(); + +// void on_btn_dmaBrowse_2_clicked(); + +// void on_btn_dmaShow_2_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_eepromTest_clicked(); + +// void on_btn_scenRead_clicked(); + +// void on_btn_getFpgaVersion_clicked(); + +// void on_btn_txTrig_clicked(); + +//private: + + + +// QString _logFolder = "/home/hasis/Desktop/TrxBoardFile/_log/dma/"; +// QString _adcloggerFolder = "/home/hasis/Desktop/TrxBoardFile/_log/adc/"; +// QVector _dmaBuffer; +// QByteArray _lastBuffer; +// QMutex _mutex; +// int _dmaLogCount = 0; +// bool _dmaRun; +// bool _dmaLog = false; +// bool _csvReadStopFlag = false; +// bool _adcLoggerDone = false; +// bool _adcLoggerTrnsDone = false; +// int _swCounter; +// int _hwCounter; + +// void readPcie(); +// void logPcie(); + +// void adcLoggerStatusCheck(); + +// QString WhichFpgaFailed(quint32 status); +// 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_receiveConfig_clicked(); + + void on_btn_lineFilter_clicked(); + + void on_btn_freqLut_clicked(); + + void on_btn_blendWeight_clicked(); + + void on_btn_atgc_clicked(); + + void on_btn_dtgc_clicked(); + + void on_btn_lpf_clicked(); + + void on_btn_stbCoeff_clicked(); + + void on_btn_setAtgcMode_clicked(); + +signals: +// void updateBlockProgressValue(int percentage, QProgressBar* prg); +// void updateFpgaProgressValue(int percentage); + +// void updateBlockProgressVisibility(bool show, QProgressBar* prg); +// void updateFpgaProgressVisibility(bool show); + + void showMessage(QString message); + +}; +#endif // MAINWINDOW_H + diff --git a/mainwindow.ui b/mainwindow.ui new file mode 100644 index 0000000..84c5e90 --- /dev/null +++ b/mainwindow.ui @@ -0,0 +1,2988 @@ + + + MainWindow + + + + 0 + 0 + 854 + 947 + + + + MainWindow + + + + + + 10 + 9 + 751 + 271 + + + + 1 + + + + Manual Operation + + + + + 0 + 0 + 741 + 135 + + + + + 0 + 0 + + + + + 0 + 135 + + + + + 16777215 + 135 + + + + Register Rd/Wr + + + + + 360 + 40 + 171 + 80 + + + + Access registers by: + + + + + 10 + 50 + 131 + 23 + + + + Register offset + + + + + + 10 + 30 + 141 + 23 + + + + Register number + + + + + + + 550 + 70 + 175 + 27 + + + + + + + Transaction width: + + + + + + + + 32 + + + + + 64 + + + + + + + + + + 20 + 30 + 311 + 101 + + + + + 0 + + + + + + + : + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Bar: + + + + + + + + 0 + + + + + 1 + + + + + 2 + + + + + + + + + + + + + + Value: (Hex) + + + + + + + + + true + + + + 16777215 + 16777215 + + + + + + + + Write + + + + + + + + + + + + + + 0 + 0 + + + + result: (Hex) + + + + + + + + + QFrame::Box + + + QFrame::Sunken + + + QLCDNumber::Hex + + + + + + + + 0 + 0 + + + + Read + + + + + + + + + + + + + + 0 + 140 + 741 + 105 + + + + + 0 + 0 + + + + + 0 + 105 + + + + + 16777215 + 105 + + + + + 50 + false + false + + + + Slave Programming: + + + + + 10 + 30 + 721 + 27 + + + + + + + Bit file: + + + + + + + + + + Browse... + + + + + + + + + 650 + 70 + 80 + 23 + + + + Program + + + + + + + DSP Setting + + + + + 30 + 20 + 148 + 48 + + + + + + + + + done: + + + + + + + false + + + + + + + + + Receiver Configuration + + + + + + + + + 220 + 20 + 106 + 48 + + + + + + + + + done: + + + + + + + false + + + + + + + + + Line Filter Coeff + + + + + + + + + 360 + 20 + 91 + 48 + + + + + + + + + done: + + + + + + + false + + + + + + + + + Blend Weight + + + + + + + + + 490 + 20 + 96 + 48 + + + + + + + + + done: + + + + + + + false + + + + + + + + + Frequency Lut + + + + + + + + + 30 + 100 + 82 + 48 + + + + + + + + + done: + + + + + + + false + + + + + + + + + ATgc + + + + + + + + + 220 + 100 + 82 + 48 + + + + + + + + + done: + + + + + + + false + + + + + + + + + DTgc + + + + + + + + + 360 + 100 + 82 + 48 + + + + + + + + + done: + + + + + + + false + + + + + + + + + LPF + + + + + + + + + 490 + 100 + 82 + 48 + + + + + + + + + done: + + + + + + + false + + + + + + + + + Stb Coeff + + + + + + + + + 20 + 160 + 551 + 80 + + + + Manual ATgc + + + + + 10 + 40 + 37 + 15 + + + + Mode: + + + + + + 50 + 40 + 79 + 23 + + + + + Auto + + + + + Manual + + + + + + + 200 + 40 + 38 + 15 + + + + Value: + + + + + + 240 + 40 + 71 + 23 + + + + + + + 340 + 40 + 80 + 23 + + + + Set ATgc + + + + + + + + + 0 + 280 + 821 + 231 + + + + TRX Board + + + + + 0 + 30 + 299 + 27 + + + + + + + Mul DAC: + + + + + + + + + + PushButton + + + + + + + + + 0 + 60 + 751 + 16 + + + + Qt::Horizontal + + + + + + 380 + 70 + 371 + 27 + + + + + + + PLLCLK TPS Regulator(KHz): + + + + + + + + + + PushButton + + + + + + + + + 0 + 70 + 371 + 27 + + + + + + + PLLCLK ST Regulator(KHz): + + + + + + + + + + PushButton + + + + + + + + + 0 + 100 + 751 + 20 + + + + Qt::Horizontal + + + + + + 300 + 120 + 16 + 111 + + + + Qt::Vertical + + + + + + 580 + 30 + 234 + 27 + + + + + + + TRX Board Temperature: + + + + + + + TextLabel + + + + + + + + + 0 + 120 + 126 + 19 + + + + + + + PCIe_ID: + + + + + + + TextLabel + + + + + + + + + 0 + 150 + 139 + 19 + + + + + + + THSD_F1: + + + + + + + TextLabel + + + + + + + + + 0 + 180 + 139 + 19 + + + + + + + THSD_F2: + + + + + + + TextLabel + + + + + + + + + 0 + 210 + 139 + 19 + + + + + + + THSD_F3: + + + + + + + TextLabel + + + + + + + + + 160 + 180 + 141 + 25 + + + + + 0 + 0 + + + + PushButton + + + + + + 320 + 120 + 191 + 19 + + + + + + + 12vin (V): + + + + + + + TextLabel + + + + + + + + + 320 + 140 + 191 + 19 + + + + + + + 5vin (V): + + + + + + + TextLabel + + + + + + + + + 320 + 160 + 191 + 19 + + + + + + + D3.3 (V): + + + + + + + TextLabel + + + + + + + + + 320 + 180 + 191 + 19 + + + + + + + AVDD,1.8 (V): + + + + + + + TextLabel + + + + + + + + + 320 + 200 + 191 + 21 + + + + + + + DVDD,1.8 (V): + + + + + + + TextLabel + + + + + + + + + 540 + 120 + 171 + 19 + + + + + + + RTF::Hall (V): + + + + + + + TextLabel + + + + + + + + + 540 + 140 + 171 + 19 + + + + + + + RTF::3.3 (V): + + + + + + + TextLabel + + + + + + + + + 540 + 160 + 172 + 19 + + + + + + + AFE Vcntlp (V): + + + + + + + TextLabel + + + + + + + + + 160 + 120 + 134 + 19 + + + + + + + Interrupt: + + + + + + + TextLabel + + + + + + + + + 310 + 30 + 90 + 23 + + + + usrMode + + + + + + 390 + 30 + 83 + 25 + + + + AFEs Prog + + + + + + 480 + 30 + 83 + 25 + + + + GT Reg + + + + + + 720 + 120 + 91 + 23 + + + + FPGA Version + + + + + + 720 + 140 + 81 + 17 + + + + TextLabel + + + + + + 720 + 160 + 81 + 17 + + + + TextLabel + + + + + + 720 + 180 + 81 + 17 + + + + TextLabel + + + + + + 720 + 200 + 81 + 17 + + + + TextLabel + + + + + + 540 + 180 + 171 + 27 + + + + + + + prbNo: + + + + + + + 0 + + + + + + + eeprom + + + + + + + + + 630 + 210 + 80 + 16 + + + + ManualSync + + + + + + 540 + 210 + 90 + 23 + + + + TXTrig + + + + + + + 0 + 510 + 821 + 101 + + + + + 50 + false + + + + Relay Board + + + false + + + + + 0 + 60 + 111 + 17 + + + + Selected probe: + + + + + + 510 + 60 + 83 + 25 + + + + PushButton + + + + + + 670 + 60 + 83 + 25 + + + + PushButton + + + + + + 220 + 60 + 83 + 25 + + + + PushButton + + + + + + 590 + 60 + 83 + 25 + + + + PushButton + + + + + + 110 + 60 + 101 + 25 + + + + + A + + + + + B + + + + + C + + + + + D + + + + + + + 430 + 60 + 83 + 25 + + + + PushButton + + + + + + 310 + 60 + 83 + 25 + + + + PushButton + + + + + + 0 + 30 + 202 + 19 + + + + + + + Detected_probe: + + + + + + + TextLabel + + + + + + + + + + 0 + 610 + 821 + 321 + + + + Power Board + + + + + 0 + 30 + 281 + 31 + + + + + + + HV_Freq(KHz): + + + + + + + + + + PushButton + + + + + + + + + 340 + 30 + 291 + 31 + + + + + + + PM5_Freq(KHz): + + + + + + + + + + PushButton + + + + + + + + + 0 + 70 + 131 + 31 + + + + + + + HVA_DAC: + + + + + + + + + + + + 140 + 70 + 131 + 31 + + + + + + + HVB_DAC: + + + + + + + + + + + + 280 + 70 + 141 + 31 + + + + + + + CWD_DAC: + + + + + + + + + + + + 430 + 70 + 91 + 31 + + + + + + + Valid + + + + + + + + + 0 + 150 + 141 + 21 + + + + + + + CWDP: + + + + + + + Unknown + + + + + + + + + 0 + 170 + 141 + 21 + + + + + + + Curr_24v: + + + + + + + Unknown + + + + + + + + + 0 + 190 + 141 + 21 + + + + + + + +24v: + + + + + + + Unknown + + + + + + + + + 0 + 210 + 141 + 21 + + + + + + + +12v: + + + + + + + Unknown + + + + + + + + + 0 + 230 + 141 + 21 + + + + + + + +5v: + + + + + + + Unknown + + + + + + + + + 0 + 250 + 141 + 21 + + + + + + + -5v: + + + + + + + Unknown + + + + + + + + + 0 + 270 + 141 + 21 + + + + + + + HV_Stop: + + + + + + + Unknown + + + + + + + + + 0 + 290 + 141 + 21 + + + + + + + 4D: + + + + + + + Unknown + + + + + + + + + 0 + 130 + 141 + 21 + + + + + + + HVBP: + + + + + + + Unknown + + + + + + + + + 0 + 110 + 141 + 21 + + + + + + + HVAP: + + + + + + + Unknown + + + + + + + + + 170 + 110 + 161 + 21 + + + + + + + HVAP_flt: + + + + + + + Unknown + + + + + + + + + 170 + 130 + 161 + 21 + + + + + + + HVBP_flt: + + + + + + + Unknown + + + + + + + + + 170 + 150 + 161 + 21 + + + + + + + CWDP_flt: + + + + + + + Unknown + + + + + + + + + 170 + 190 + 161 + 21 + + + + + + + +24v_flt: + + + + + + + Unknown + + + + + + + + + 170 + 210 + 161 + 21 + + + + + + + +12v_flt: + + + + + + + Unknown + + + + + + + + + 170 + 230 + 161 + 21 + + + + + + + +5v_flt: + + + + + + + Unknown + + + + + + + + + 170 + 250 + 161 + 21 + + + + + + + -5v_flt: + + + + + + + Unknown + + + + + + + + + 340 + 210 + 171 + 21 + + + + + + + ovr_+12v_flt: + + + + + + + Unknown + + + + + + + + + 340 + 130 + 171 + 21 + + + + + + + ovr_HVBP_flt: + + + + + + + Unknown + + + + + + + + + 340 + 250 + 171 + 21 + + + + + + + ovr_-5v_flt: + + + + + + + Unknown + + + + + + + + + 340 + 190 + 171 + 21 + + + + + + + ovr_+24v_flt: + + + + + + + Unknown + + + + + + + + + 340 + 230 + 171 + 21 + + + + + + + ovr_+5v_flt: + + + + + + + Unknown + + + + + + + + + 340 + 110 + 171 + 21 + + + + + + + ovr_HVAP_flt: + + + + + + + Unknown + + + + + + + + + 340 + 170 + 173 + 21 + + + + + + + ovr_Curr24v_flt: + + + + + + + Unknown + + + + + + + + + 520 + 210 + 181 + 21 + + + + + + + udr_+12v_flt: + + + + + + + Unknown + + + + + + + + + 520 + 150 + 181 + 21 + + + + + + + udr_CWDP_flt: + + + + + + + Unknown + + + + + + + + + 520 + 130 + 181 + 21 + + + + + + + udr_HVBP_flt: + + + + + + + Unknown + + + + + + + + + 520 + 250 + 181 + 21 + + + + + + + udr_-5v_flt: + + + + + + + Unknown + + + + + + + + + 520 + 190 + 181 + 21 + + + + + + + udr_+24v_flt: + + + + + + + Unknown + + + + + + + + + 520 + 230 + 181 + 21 + + + + + + + udr_+5v_flt: + + + + + + + Unknown + + + + + + + + + 520 + 110 + 181 + 21 + + + + + + + udr_HVAP_flt: + + + + + + + Unknown + + + + + + + + + 520 + 170 + 181 + 21 + + + + + + + udr_Curr24v_flt: + + + + + + + Unknown + + + + + + + + + 170 + 290 + 161 + 21 + + + + + + + 4D_flt: + + + + + + + Unknown + + + + + + + + + 170 + 270 + 161 + 21 + + + + + + + HV_flt: + + + + + + + Unknown + + + + + + + + + 340 + 270 + 171 + 21 + + + + + + + ovr_HV_flt: + + + + + + + Unknown + + + + + + + + + 340 + 290 + 171 + 21 + + + + + 6 + + + + + ovr_4D_flt: + + + + + + + Unknown + + + + + + + + + 520 + 290 + 181 + 21 + + + + + + + udr_4D_flt: + + + + + + + Unknown + + + + + + + + + 520 + 270 + 181 + 21 + + + + + + + udr_HV_flt: + + + + + + + Unknown + + + + + + + + + 710 + 280 + 101 + 25 + + + + Update + + + + + + 710 + 150 + 126 + 21 + + + + + + + fan1_flt: + + + + + + + Unknown + + + + + + + + + 710 + 180 + 126 + 21 + + + + + + + fan2_flt: + + + + + + + Unknown + + + + + + + + + 710 + 210 + 143 + 21 + + + + + + + cmd_error: + + + + + + + Unknown + + + + + + + + + 710 + 240 + 144 + 21 + + + + + + + cmd_done: + + + + + + + Unknown + + + + + + + + + 170 + 170 + 161 + 21 + + + + + + + Curr24v_flt: + + + + + + + Unknown + + + + + + + + + 340 + 150 + 171 + 21 + + + + + 0 + + + + + ovr_CWDP_flt: + + + + + + + Unknown + + + + + + + + + 550 + 70 + 261 + 31 + + + + + + + DACs_OnOff: + + + + + + + + + + Dacs_Enable + + + + + + + + + 710 + 120 + 41 + 25 + + + + JMP + + + + + + 760 + 120 + 51 + 23 + + + + 24V + + + + + + + + + diff --git a/src/model/hardware/core/TrxBoard.cpp b/src/model/hardware/core/TrxBoard.cpp new file mode 100644 index 0000000..775c086 --- /dev/null +++ b/src/model/hardware/core/TrxBoard.cpp @@ -0,0 +1,666 @@ +#include "model/hardware/core/TrxBoard.h" + +#include +#include +#include + +/*************************************************************************************************/ +/** + * @brief Return board name + * @details The function will return the name of hardware based on hardware + * provided data + * @attention This value is a shadow value, to update it call @updateInfo() + * @return The name of board + */ +QString TrxBoard::getName() +{ + return _name; +} + +/*************************************************************************************************/ +/** + * @brief Return board version + * @details The function will return the version of hardware based on hardware + * provided data + * @attention This value is a shadow value, to update it call @updateInfo() + * @return The version of board + */ +QString TrxBoard::getVersion() +{ + return _version; +} + +/*************************************************************************************************/ +/** + * @brief PowerBoard::selfTest + * @return + */ +bool TrxBoard::selfTest() +{ + return true; +} + +/*************************************************************************************************/ +/** + * @brief TrxBoard::updateInfo + * @return + */ +/*************************************************************************************************/ +bool TrxBoard::updateInfo() +{ + return true; +} + +/*************************************************************************************************/ +/** + * @brief TrxBoard::updateStatus + * @return + */ +/*************************************************************************************************/ +bool TrxBoard::updateStatus() +{ + return true; +} + +///*************************************************************************************************/ +///** +// * @brief TrxBoard::slaveProgramming +// */ +///*************************************************************************************************/ +//void fpgaProgrammer (QString path) +//{ +// QFile file(path); + +// if (!file.open(QFile::ReadOnly)) +// { +// MESSAGE_BOX("Could not open bit file, aborting operation"); +// return; +// } +// const auto actualSize = file.size(); +// auto readSize = 0; +// while(readSize < actualSize) +// { +// QByteArray chunk = file.read(4); +// _slaveProgRegs.setSlaveProg(chunk); +// try +// { +// auto temp = _slaveProgRegs.getSlaveProgStatus(); +// while ((temp & 0x01) == 0x01) +// { +// temp = _slaveProgRegs.getSlaveProgStatus(); +// } + +// if((temp & 0x08) == 0x08) +// { +// QString failedFpga = _slaveProgRegs.WhichFpgaFailed(temp); +// QString a = "init_fail flag raised, Failed FPGAs: " + failedFpga; +// throw(myexception(a.toUtf8().data())); +// } + +// if((temp & 0x10) == 0x10) +// { +// throw(myexception("time_out flag raised")); +// } +// } +// catch (myexception e) +// { +// MESSAGE_BOX(e.what()); + +// emit updateFpgaProgressVisibility(false); + +// file.close(); + +// return; +// } +// readSize += 4; + +// auto percentage = (readSize * 100 / actualSize); +// emit updateFpgaProgressValue(percentage); +// } + +// auto temp = _slaveProgRegs.getSlaveProgStatus(); +// while(((temp >> 1) & 0x03) == 0) +// { +// temp = _slaveProgRegs.getSlaveProgStatus(); +// } + +// if((temp & 0x02) == 0x02) +// { +// MESSAGE_BOX("FPGA programming finished with success"); +// } +// else if((temp & 0x04) == 0x04) +// { +// QString failedFpga = _slaveProgRegs.WhichFpgaFailed(temp); + +// MESSAGE_BOX("FPGA programming failed, Failed FPGAs: " + failedFpga); +// } + +// emit updateFpgaProgressVisibility(false); + +// file.close(); +//} + +/*************************************************************************************************/ +/** + * @brief TrxBoard::start + */ +/*************************************************************************************************/ +void TrxBoard::start() +{ + _device.stopTransfer(); + + _swCounter = 0; + _hwCounter = _device.getCounter(); + + _device.setRamOffsetAddress(0); + _device.setTransferLength(128 * 1024); + _device.setOptions(false); + _device.setMode(true); + _device.setTransferRate(25.0f); + + _device.startTransfer(true); + _run = true; + //QtConcurrent::run(this, &TrxBoard::readData); +} + +/*************************************************************************************************/ +/** + * @brief TrxBoard::stop + */ +/*************************************************************************************************/ +void TrxBoard::stop() +{ + _device.stopTransfer(); + _run = false; +} + +/*************************************************************************************************/ +/** + * @brief TrxBoard::readData + */ +/*************************************************************************************************/ +//void TrxBoard::readData() +//{ +// while(_run) +// { +// auto cnt = _device.getCounter(); + +// if(cnt == 0) +// { +// std::this_thread::sleep_for(std::chrono::milliseconds(3)); +// _hwCounter = 0; +// continue; +// } +// else +// if(cnt != _hwCounter) +// { +// _hwCounter++; + +// _device.copy(_hwCounter - 1, _swCounter); + +// auto temp = QByteArray::fromRawData(_device.getBufferPtr(_swCounter), BUFFER_SIZE); +// packetEngine.newData(temp); + +// _swCounter++; +// if(_swCounter >= SW_BUFFER_NUM) +// { +// _swCounter = 0; +// } +// } +// } +//} +/*************************************************************************************************/ +/*************************************************************************************************/ + + + + + +void TrxBoard::scenParamsFilling(TrxBoard::eScenParams cmd) +{ + static quint8 scenParams = 0; + scenParams = cmd ? (scenParams+cmd) : (cmd); + if (scenParams >= TOTAL_SCEN_LUT_SRAM) + { + scenParams = TOTAL_SCEN_LUT_SRAM; + _allow = true; + } + else + _allow = false; +} + +void TrxBoard::setSwapVector() +{ + _swapVec.clear(); + _swapVec << 0 << 113 << 98 << 19 << 4 << 117 << 102 << 23 << 8 << 121 << 106 << 27 << 12 << 125 << 110 << 31 << 16 << 1 << 114 << 99 + << 20 << 5 << 118 << 103 << 24 << 9 << 122 << 107 << 28 << 13 << 126 << 111 << 96 << 17 << 2 << 115 << 100 << 21 << 6 << 119 + << 104 << 25 << 10 << 123 << 108 << 29 << 14 << 127 << 112 << 97 << 18 << 3 << 116 << 101 << 22 << 7 << 120 << 105 << 26 << 11 + << 124 << 109 << 30 << 15 << 32 << 145 << 130 << 51 << 36 << 149 << 134 << 55 << 40 << 153 << 138 << 59 << 44 << 157 << 142 << 63 + << 48 << 33 << 146 << 131 << 52 << 37 << 150 << 135 << 56 << 41 << 154 << 139 << 60 << 45 << 158 << 143 << 128 << 49 << 34 << 147 + << 132 << 53 << 38 << 151 << 136 << 57 << 42 << 155 << 140 << 61 << 46 << 159 << 144 << 129 << 50 << 35 << 148 << 133 << 54 << 39 + << 152 << 137 << 58 << 43 << 156 << 141 << 62 << 47 << 64 << 177 << 162 << 83 << 68 << 181 << 166 << 87 << 72 << 185 << 170 << 91 + << 76 << 189 << 174 << 95 << 80 << 65 << 178 << 163 << 84 << 69 << 182 << 167 << 88 << 73 << 186 << 171 << 92 << 77 << 190 << 175 + << 160 << 81 << 66 << 179 << 164 << 85 << 70 << 183 << 168 << 89 << 74 << 187 << 172 << 93 << 78 << 191 << 176 << 161 << 82 << 67 + << 180 << 165 << 86 << 71 << 184 << 169 << 90 << 75 << 188 << 173 << 94 << 79; +} + +TrxBoard::TrxBoard() : _offsetSlave0(0), _offsetSlave1(0x4000000), _offsetSlave2(0x8000000) +{ + _beamFormerSlave0 = new BeamFormer (&_device, _offsetSlave0); + _beamFormerSlave1 = new BeamFormer (&_device, _offsetSlave1); + _beamFormerSlave2 = new BeamFormer (&_device, _offsetSlave2); + _clkDistributer = new ClockDistributer(&_device); + _fpgaProgram = new FpgaProgram (&_device); + _scenPlayer = new ScenPalyer (&_device); + _bCtrlMngt = new BoardsCtrlMngt (&_device); + _bpiFlash = new BpiFlash (&_device); + //_dmaCtrl = new DmaCtrl (_device); + _dsp = new Dsp (&_device); + + setSwapVector(); + + ///////////////////////////////// Old TRX ////////////////////////////////// + _run = true; + //_device.init(); + /*************************************************************************************************/ + /*************************************************************************************************/ +} + +TrxBoard::~TrxBoard() +{ + delete _beamFormerSlave0; + delete _beamFormerSlave1; + delete _beamFormerSlave2; + delete _clkDistributer; + delete _fpgaProgram; + delete _scenPlayer; + delete _bCtrlMngt; + delete _bpiFlash; + //delete _dmaCtrl; + delete _dsp; +} + +void TrxBoard::scenProbeElementPosition(ProbeElementPosition *element) +{ + QList> elementPosition; + QList x; + QList y; + QList z; + + for (quint8 i=0; i<3; i++) + { + for (quint8 j=0; jxPosition.at(_swapVec.at(j + i * SLAVE_ELEMENT_SEGMENT))); + y.append(element->yPosition.at(_swapVec.at(j + i * SLAVE_ELEMENT_SEGMENT))); + z.append(element->zPosition.at(_swapVec.at(j + i * SLAVE_ELEMENT_SEGMENT))); + } + + elementPosition.append(x); + elementPosition.append(y); + elementPosition.append(z); + + switch (i) + { + case 0 : this->_beamFormerSlave0->probeElementPosition(elementPosition); break; + case 1 : this->_beamFormerSlave1->probeElementPosition(elementPosition); break; + case 2 : this->_beamFormerSlave2->probeElementPosition(elementPosition); break; + } + + x.clear(); + y.clear(); + z.clear(); + elementPosition.clear(); + } + scenParamsFilling(set); +} + +void TrxBoard::scenRxBeamformerProperties(RxBeamformerProperties *rxBeamformer) +{ + this->_beamFormerSlave0->rxBeamformerProperties(rxBeamformer); + this->_beamFormerSlave1->rxBeamformerProperties(rxBeamformer); + this->_beamFormerSlave2->rxBeamformerProperties(rxBeamformer); + scenParamsFilling(set); +} + +void TrxBoard::scenApodizationLut(QList > &apodization) +{ + this->_beamFormerSlave0->apodizationLut(apodization); + this->_beamFormerSlave1->apodizationLut(apodization); + this->_beamFormerSlave2->apodizationLut(apodization); + scenParamsFilling(set); +} + +void TrxBoard::scenPulseProperties(PulseProperties *pulse) +{ + this->_beamFormerSlave0->pulseProperties(pulse); + this->_beamFormerSlave1->pulseProperties(pulse); + this->_beamFormerSlave2->pulseProperties(pulse); + scenParamsFilling(set); +} + +void TrxBoard::scenAfeLut(AfeProperties *afe) +{ + this->_beamFormerSlave0->afeLut(afe); + this->_beamFormerSlave1->afeLut(afe); + this->_beamFormerSlave2->afeLut(afe); + scenParamsFilling(set); +} + + +void TrxBoard::scenReceiverConfigurationLut(ReceiverConfiguration *configLut) const +{ + this->_dsp->receiverConfigurationLut(configLut); +} + +void TrxBoard::scenLineFilterCoefficient(QList &lineFilterLut) const +{ + this->_dsp->lineFilterCoefficient(lineFilterLut); +} + +void TrxBoard::scenStbCoefficient(QList &stbLut) const +{ + this->_dsp->stbCoefficient(stbLut); +} + +void TrxBoard::scenFrequencyLut(QList &freqLut) const +{ + this->_dsp->frequencyLut(freqLut); +} + +void TrxBoard::scenBlendWeight(QList > &blendWeight) const +{ + this->_dsp->blendWeight(blendWeight); +} + +void TrxBoard::setAtgcMode(eAtgcMode mode, quint16 value) const +{ + this->_dsp->atgcMode(mode, value); +} + +void TrxBoard::scenDtgcLut(QList &dtgcLut) const +{ + this->_dsp->dtgcLut(dtgcLut); +} + +void TrxBoard::scenAtgcLut(QList > &atgcLut) const +{ + this->_dsp->atgcLut(atgcLut); +} + +void TrxBoard::scenLpfLut(QList > &lpfLut) const +{ + this->_dsp->lpfLut(lpfLut); +} + +void TrxBoard::slaveFpgaProgram(QString path) +{ + QFile bitFile(path); + + if (bitFile.fileName().isEmpty()) + { + throw SonoException("No file is selected"); + } + + if (!bitFile.open(QIODevice::ReadOnly)) + { + throw SonoException("Couldn't open bit file programming"); + } + + QByteArray bitFileData = bitFile.readAll(); + this->_fpgaProgram->program(bitFileData, SLAVE_FPGA_NUMBER); + + bitFileData.clear(); + bitFile.close(); + + scenParamsFilling(clear); +} + +void TrxBoard::setBeamFormerMode(eClkMode mode) const +{ + this->_clkDistributer->clockMode(CLOCK_DIVISION, mode); +} + +void TrxBoard::setScenPlayerIndex(quint32 &startIdx, quint32 &endIdx) const +{ + this->_scenPlayer->setStartIndex(startIdx); + this->_scenPlayer->setEndIndex(endIdx); +} + +void TrxBoard::scenPlayerStart(bool start) const +{ + if (_allow) + { + this->_beamFormerSlave0->regValid(true); + this->_beamFormerSlave1->regValid(true); + this->_beamFormerSlave2->regValid(true); + } + else + { + throw SonoException("Total scenario luts and sram parameters are not written compeletely"); + } + + + this->_scenPlayer->control.command(start); +} + +void TrxBoard::scenPlayerPause(bool pause) const +{ + this->_scenPlayer->control.pause(pause); +} + +void TrxBoard::scenPlayerStop(bool stop) const +{ + this->_scenPlayer->control.command(!stop); +} + + +quint32 TrxBoard::deviceId() const +{ + auto pid = this->_bCtrlMngt->getPid(); + return pid; +} + +quint32 TrxBoard::vendorId() const +{ + auto vid = this->_bCtrlMngt->getVid(); + return vid; +} + +quint32 TrxBoard::trxId() const +{ + QByteArray id = this->_bCtrlMngt->trxEepromRead(EEPROM_ID_BYTE_BEGIN, EEPROM_ID_BYTE_NUMBER); + return byteArray2Uint32BigEndian(id); +} + +quint32 TrxBoard::mpsId() const +{ + QByteArray id = this->_bCtrlMngt->mpsEepromRead(EEPROM_ID_BYTE_BEGIN, EEPROM_ID_BYTE_NUMBER); + return byteArray2Uint32BigEndian(id); +} + +quint32 TrxBoard::prbCtrlId() const +{ + QByteArray id = this->_bCtrlMngt->prbCtrlEepromRead(EEPROM_ID_BYTE_BEGIN, EEPROM_ID_BYTE_NUMBER); + return byteArray2Uint32BigEndian(id); +} + +quint32 TrxBoard::prbId(quint8 prbSel) const +{ + QByteArray id = this->_bCtrlMngt->prbEepromRead(EEPROM_ID_BYTE_BEGIN, EEPROM_ID_BYTE_NUMBER, prbSel); + return byteArray2Uint32BigEndian(id); +} + +QList TrxBoard::getConnectedPrbId() const +{ + QList list; + QVector vec; + QByteArray id; + list.clear(); + vec.clear(); + id.clear(); + vec = this->_bCtrlMngt->getConnectedPrb(); + + for (quint8 i=0; i < vec.size(); i++) + { + if (vec.at(i)) + { + id = this->_bCtrlMngt->prbEepromRead(EEPROM_ID_BYTE_BEGIN, EEPROM_ID_BYTE_NUMBER, i); + list.append(byteArray2Uint32BigEndian(id)); + } + else + list.append(0); + } + + return list; +} + +QString TrxBoard::trxInfo() const +{ + QString str = QString(this->_bCtrlMngt->trxEepromRead(EEPROM_INFO_BYTE_BEGIN, EEPROM_INFO_BYTE_NUMBER)); + return str; +} + +QString TrxBoard::mpsInfo() const +{ + QString str = QString(this->_bCtrlMngt->mpsEepromRead(EEPROM_INFO_BYTE_BEGIN, EEPROM_INFO_BYTE_NUMBER)); + return str; +} + +QString TrxBoard::prbCtrlInfo() const +{ + QString str = QString(this->_bCtrlMngt->prbCtrlEepromRead(EEPROM_INFO_BYTE_BEGIN, EEPROM_INFO_BYTE_NUMBER)); + return str; +} + +QString TrxBoard::prbInfo(quint8 prbSel) const +{ + QString str = QString(this->_bCtrlMngt->prbEepromRead(EEPROM_INFO_BYTE_BEGIN, EEPROM_INFO_BYTE_NUMBER, prbSel)); + return str; +} + +QList TrxBoard::getConnectedPrbInfo() const +{ + QList list; + QVector vec; + QString str; + list.clear(); + vec.clear(); + str.clear(); + + vec = this->_bCtrlMngt->getConnectedPrb(); + + for (quint8 i=0; i < vec.size(); i++) + { + if (vec.at(i)) + { + str = QString(this->_bCtrlMngt->prbEepromRead(EEPROM_INFO_BYTE_BEGIN, EEPROM_INFO_BYTE_NUMBER, i)); + list.append(str); + } + else + list.append("NULL"); + } + + return list; +} + + +void TrxBoard::supervisorRbValue(SupervisorRbValue *sValue) const +{ + this->_bCtrlMngt->getSupervisorValue(sValue); +} + +void TrxBoard::mpsFaultStatus(MpsFaultStatus *faultStatus) const +{ + this->_bCtrlMngt->getMpsFault(faultStatus); +} + +void TrxBoard::mpsReset() const +{ + this->_bCtrlMngt->setMpsReset(); +} + +void TrxBoard::mpsSetAo(float voltA, float voltB) const +{ + this->_bCtrlMngt->mpsHvSet(voltA, voltB); +} + + +void TrxBoard::selectProbe(eSelectProbe prbSel) const +{ + this->_bCtrlMngt->setProbeSelect(prbSel); +} + +void TrxBoard::getHealthStatus(HealthStatus* healStat) const +{ +// healStat->criticalComponentTemperature = this->_bCtrlMngt->getTrxFpgaTemp(); + healStat->systemTemperature = this->_bCtrlMngt->getTrxTempSensor(); + healStat->adcMon = this->_bCtrlMngt->getTrxBoardVoltages(); + healStat->voltsPg = this->_bCtrlMngt->getTrxVoltagesPg(); +} + +void TrxBoard::init() const +{ + this->_bCtrlMngt->mpsInit(); + this->_bCtrlMngt->prbCtrlInit(); +} + + + +void TrxBoard::mcsProgram(QString path) +{ + QFile mcsFile(path); + + if (mcsFile.fileName().isEmpty()) + { + //throw exception("No file is selected: " + mcsFile.errorString()); + return; + } + + if (!mcsFile.open(QIODevice::ReadOnly)) + { + //throw exception("Couldn't open mcs file programming: " + mcsFile.errorString()); + return; + } + + QByteArray mcsFileData = mcsFile.readAll(); + this->_bpiFlash->writeMcs(mcsFileData); + + mcsFileData.clear(); + mcsFile.close(); + + scenParamsFilling(clear); +} + +void TrxBoard::mcsVerify(QString path) const +{ + QFile mcsFile(path); + + if (mcsFile.fileName().isEmpty()) + { + //throw exception("No file is selected: " + mcsFile.errorString()); + return; + } + + if (!mcsFile.open(QIODevice::WriteOnly)) + { + //throw exception("Couldn't open mcs file to verify: " + mcsFile.errorString()); + return; + } + + QList* mcsList; + QTextStream save(&mcsFile); + + (*mcsList).clear(); + this->_bpiFlash->readMcs(mcsList); + + for (auto i=0; i < MCS_FILE_SIZE; i++) + { + save << (*mcsList).at(i); + } + mcsFile.flush(); + mcsFile.close(); +} + + + diff --git a/src/model/hardware/core/register/Field.cpp b/src/model/hardware/core/register/Field.cpp new file mode 100644 index 0000000..66bc01e --- /dev/null +++ b/src/model/hardware/core/register/Field.cpp @@ -0,0 +1,106 @@ +#include "model/hardware/core/register/Field.h" + +Field::Field(quint32 mask, bool isSigned) +{ + _mask = mask; + _isSigned = isSigned; + + findPosition(); + findLength(); + findZeroBasedMask(); +} + +void Field::findLength() +{ + auto temp = _mask >> _position; + + _length = 0; + while((temp & 0x01) == 0x01) + { + temp = temp >> 1; + _length++; + } +} + +void Field::findPosition() +{ + auto temp = _mask; + _position = 0; + while((temp & 0x01) != 0x01) + { + temp = temp >> 1; + _position++; + } +} + +void Field::findZeroBasedMask() +{ + _zeroBasedMask = 0; + for(auto i = 0; i < _length; i++) + { + _zeroBasedMask |= (1 << i); + } +} + +Field* Field::fromBitPosition(quint32 bitPosition) +{ + auto mask = 1U << bitPosition; + + return new Field(mask, false); +} + +Field* Field::fromMaskSigned(quint32 mask) +{ + return new Field(mask, true); +} + +Field* Field::fromMaskUnsigned(quint32 mask) +{ + return new Field(mask, false); +} + +quint32 Field::getValue() +{ + return _value; +} + +bool Field::isUpdated() +{ + auto temp = _isUpdated; + _isUpdated = false; + + return temp; +} + +void Field::setValue(quint32 value) +{ + if(_value == value) + { + return; + } + + _value = value; + _isUpdated = true; +} + +void Field::updateValue(quint32 value) +{ + value = value >> _position; + value &= _zeroBasedMask; + auto signBit = ((value >> (_length - 1)) & 0x01) == 0x01; + if(_isSigned && signBit) + { + value |= ~_zeroBasedMask; + } + + _value = value; +} + +quint32 Field::getRegisterWriteValue() +{ + auto value = _value & _zeroBasedMask; + value = value << _position; + value &= _mask; + + return value; +} diff --git a/src/model/hardware/core/register/Register.cpp b/src/model/hardware/core/register/Register.cpp new file mode 100644 index 0000000..dc9cf1e --- /dev/null +++ b/src/model/hardware/core/register/Register.cpp @@ -0,0 +1,107 @@ +#include "model/hardware/core/register/Register.h" + +#include + +//Register::Register(quint8 bar, quint32 offset, SonoDevice *device, quint32 arrayLength) +Register::Register(quint8 bar, quint32 offset, SonoDevice *device) +{ + _bar = bar; + _offset = offset; + // _arrayLength = arrayLength; + _device = device; +} + +Register::~Register() +{ + for(auto i = 0; i < _fields.length(); i++) + { + delete _fields[i]; + } + _fields.clear(); +} + +quint32 Register::getValue() +{ + return _value; +} + +void Register::setValue(quint32 value) +{ + if(_value == value) + { + return; + } + + _value = value; + _isUpdated = true; +} + +void Register::changeOffset(quint32 offset) +{ + _offset = offset; +} + +quint32 Register::getCurrentOffset() const +{ + return _offset; +} + +bool Register::isUpdated() +{ + auto temp = _isUpdated; + _isUpdated = false; + + return temp; +} + +void Register::update() //update single register +{ + auto value = 0; + for(auto i = 0; i < _fields.length(); i++) + { + value |= _fields[i]->getRegisterWriteValue(); + } + + _device->device.writeWord(_bar, _offset, value); +} + +void Register::upadteArray() //update array register +{ + for(quint32 i = 0; i < _arrayLength; i++) + { +// prepareData(i); + + auto value = 0; + for(auto j = 0; j < _fields.length(); j++) + { + value |= _fields[j]->getRegisterWriteValue(); + } + + _device->device.writeWord(_bar, _offset + i*4, value); + } +} + +void Register::sync() +{ + auto value = _device->device.readWord(_bar, _offset); + for(auto i = 0; i < _fields.length(); i++) + { + _fields[i]->updateValue(value); + } +} + + +void Register::syncArray() +{ + for(quint32 i = 0; i < _arrayLength; i++) + { + auto value = _device->device.readWord(_bar, _offset + i*4); + for(auto i = 0; i < _fields.length(); i++) + { + _fields[i]->updateValue(value); + } + + // receiveData(); + } + +} diff --git a/src/model/hardware/core/register/RegisterChain.cpp b/src/model/hardware/core/register/RegisterChain.cpp new file mode 100644 index 0000000..cc8b539 --- /dev/null +++ b/src/model/hardware/core/register/RegisterChain.cpp @@ -0,0 +1,104 @@ +#include "model/hardware/core/register/RegisterChain.h" + +RegisterChain::RegisterChain(quint8 bar, quint32 offset, SonoDevice *device, quint32 arrayLength) +{ + _bar = bar; + _offset = offset; + _arrayLength = arrayLength; + _device = device; +} + +RegisterChain::~RegisterChain() +{ + for(auto i = 0; i < _fields.length(); i++) + { + delete _fields[i]; + } + _fields.clear(); +} + +quint32 RegisterChain::getValue() +{ + return _value; +} + +void RegisterChain::setValue(quint32 value) +{ + if(_value == value) + { + return; + } + + _value = value; + _isUpdated = true; +} + +void RegisterChain::changeOffset(quint32 offset) +{ + _offset = offset; +} + +quint32 RegisterChain::getCurrentOffset() const +{ + return _offset; +} + +bool RegisterChain::isUpdated() +{ + auto temp = _isUpdated; + _isUpdated = false; + + return temp; +} + +void RegisterChain::update() //update single RegisterChain +{ + auto value = 0; + for(auto i = 0; i < _fields.length(); i++) + { + value |= _fields[i]->getRegisterWriteValue(); + } + + _device->device.writeWord(_bar, _offset, value); +} + +void RegisterChain::upadteArray() //update array RegisterChain +{ + for(quint32 i = 0; i < _arrayLength; i++) + { + prepareData(i); + + auto value = 0; + for(auto j = 0; j < _fields.length(); j++) + { + value |= _fields[j]->getRegisterWriteValue(); + } + + _device->device.writeWord(_bar, _offset + i*4, value); + } +} + +void RegisterChain::sync() +{ + auto value = _device->device.readWord(_bar, _offset); + for(auto i = 0; i < _fields.length(); i++) + { + _fields[i]->updateValue(value); + } +} + + +void RegisterChain::syncArray() +{ + for(quint32 i = 0; i < _arrayLength; i++) + { + auto value = _device->device.readWord(_bar, _offset + i*4); + for(auto i = 0; i < _fields.length(); i++) + { + _fields[i]->updateValue(value); + } + + //receiveData(); + } + +} diff --git a/src/model/hardware/core/register/beamFormer/BeamFormer.cpp b/src/model/hardware/core/register/beamFormer/BeamFormer.cpp new file mode 100644 index 0000000..4e18a8c --- /dev/null +++ b/src/model/hardware/core/register/beamFormer/BeamFormer.cpp @@ -0,0 +1,77 @@ +#include "model/hardware/core/register/beamFormer/BeamFormer.h" + +BeamFormer::BeamFormer(SonoDevice *device, quint32 offset) +{ + _elementPosition = new ElementPositionLut (device, offset); + _rxBeamformer = new RxBeamformerLut (device, offset); + _apodization = new ApodizationLut (device, offset); + _pulse = new PulseLut (device, offset); + _afe = new AfeLut (device, offset); + _regValid = new RegValid (device, offset); +} + +BeamFormer::~BeamFormer() +{ + delete _elementPosition; + delete _rxBeamformer; + delete _apodization; + delete _pulse; + delete _afe; + delete _regValid; +} + +void BeamFormer::probeElementPosition(QList> &elementPosition) const +{ + quint32 baseOffset = this->_elementPosition->getCurrentOffset(); + + foreach (QList temp, elementPosition) + { + this->_elementPosition->setElementPositionLut(temp); + this->_elementPosition->upadteArray(); + quint32 curOffset = this->_elementPosition->getCurrentOffset(); + this->_elementPosition->changeOffset(curOffset + ELEMENT_POSITION_OFFSET); + } + + this->_elementPosition->changeOffset(baseOffset); // return to base offset address +} + +void BeamFormer::rxBeamformerProperties(RxBeamformerProperties *rxBeamformer) const +{ + this->_rxBeamformer->setRxBfLut(rxBeamformer); + this->_rxBeamformer->upadteArray(); +} + +void BeamFormer::apodizationLut(QList> &apodization) const +{ + quint32 baseOffset = this->_apodization->getCurrentOffset(); + + foreach (QList temp, apodization) + { + this->_apodization->setApodizationLut(temp); + this->_apodization->upadteArray(); + quint32 curOffset = this->_apodization->getCurrentOffset(); + this->_apodization->changeOffset(curOffset + APODIZATION_OFFSET); + } + + this->_apodization->changeOffset(baseOffset); // return to base offset address +} + +void BeamFormer::pulseProperties(PulseProperties *pulse) const +{ + this->_pulse->setPulseLut(pulse); + this->_pulse->upadteArray(); +} + +void BeamFormer::afeLut(AfeProperties *afe) const +{ + this->_afe->setAfeLut(afe); + this->_afe->upadteArray(); +} + +void BeamFormer::regValid(bool valid) const +{ + quint32 value = valid ? 1 : 0; + this->_regValid->regValid->setValue(value); + this->_regValid->update(); +} + diff --git a/src/model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.cpp b/src/model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.cpp new file mode 100644 index 0000000..704641c --- /dev/null +++ b/src/model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.cpp @@ -0,0 +1,948 @@ +#include "model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.h" + +BoardsCtrlMngt::AttenuationFactor::AttenuationFactor() +{ + p12v=10.4727f; + p5v=4.3636f; + p4d=4.3636f; + m5v=2.1818f; + curP24v=1; + hvStop=1; + p24v=1; + hva=1; + hvb=1; + cwd=1; +} + +BoardsCtrlMngt::Gain::Gain() +{ + curP24v=2.778f; + cwd=6.555f; + m5v=-3.3f; + hvStop=1; + p24v=23; + hva=66; + hvb=66; + p12v=1; + p5v=1; + p4d=1; +} +/***************************************************************************************************/ +/************************************* Write Functions Template ************************************/ +/***************************************************************************************************/ +template +void BoardsCtrlMngt::eepromWrite(QByteArray &arr, quint32 addr, quint8 prbSel, T1* request, T2* status) +{ + quint32 j(0); + bool busy=true, error=false, done=false; + + foreach (auto i, arr) + { + + timerShot(500); + while (busy) + { + status->sync(); + busy = ((status->busy->getValue())!=0); + if (checkTimerShot()) + { + // throw exception("Eeprom writing timeout is happened due to the I2C busy"); + timerStop(); + return; + } + } + + timerStop(); + + _rom->dataIn = i; + _rom->address = addr+j; + _rom->probeSelect = prbSel; + setEepromWrite(_rom, request); + j++; + + timerShot(100); + while (!error && !done) + { + status->sync(); + done = ((status->reqDone->getValue())!=0); + error = ((status->reqError->getValue())!=0); + if (checkTimerShot()) + { + // throw exception("Eeprom finish writing is corrupted due to the failure to receive done"); + timerStop(); + return; + } + } + + timerStop(); + + if (error) + { + // throw exception("Eeprom finish writing is corrupted due to the error occurrence"); + return; + } + + } + +} + +template +void BoardsCtrlMngt::setEepromWrite(EepromReq* _rom, T3* request) +{ + request->dataIn->setValue(static_cast(_rom->dataIn)); + request->address->setValue(static_cast(_rom->address)); + request->prbSel->setValue(static_cast(_rom->probeSelect)); + request->rdReq->setValue(0); + request->wrReq->setValue(1); + request->update(); + request->wrReq->setValue(0); + request->update(); +} + +/***************************************************************************************************/ +/************************************* Read Functions Template *************************************/ +/***************************************************************************************************/ + +template +QByteArray BoardsCtrlMngt::eepromRead(quint32 addr, quint32 length, quint8 prbSel, T4 *request, T5 *status) +{ + bool busy=true, error=false, done=false; + QByteArray rdArray; + + rdArray.clear(); + + for (quint32 i(0); isync(); + busy = ((status->busy->getValue())!=0); + if (checkTimerShot()) + { + // throw exception("Eeprom reading timeout is happened due to the I2C busy"); + timerStop(); + return nullptr; + } + } + + timerStop(); + + _rom->dataIn = 0; + _rom->address = addr+i; + _rom->probeSelect = prbSel; + setEepromRead(_rom, request); + + timerShot(100); + while (!error && !done) + { + status->sync(); + done = ((status->reqDone->getValue())!=0); + error = ((status->reqError->getValue())!=0); + if (checkTimerShot()) + { + // throw exception("Eeprom finish reading is corrupted due to the failure to receive done"); + timerStop(); + return nullptr; + } + } + + timerStop(); + + if (error) + { + // throw exception("Eeprom finish reading is corrupted due to the error occurrence"); + return nullptr; + } + + rdArray.append(static_cast(status->dataOut->getValue())); + + } + + return rdArray; +} + +template +void BoardsCtrlMngt::setEepromRead(BoardsCtrlMngt::EepromReq *_rom, T6 *request) +{ + request->dataIn->setValue(static_cast(_rom->dataIn)); + request->address->setValue(static_cast(_rom->address)); + request->prbSel->setValue(static_cast(_rom->probeSelect)); + request->rdReq->setValue(1); + request->wrReq->setValue(0); + request->update(); + request->rdReq->setValue(0); + request->update(); +} + +/***************************************************************************************************/ +/***************************************************************************************************/ +float BoardsCtrlMngt::resDiv(float r1, float r2, quint32 adcValue) +{ + float result = (static_cast(adcValue)) * (r1+r2)/(r2*1000); + return result; +} + +QVector BoardsCtrlMngt::voltPg(float adcVolt) +{ + QVector pgVec; + pgVec.clear(); + pgVec.append(adcVolt * (95/100)); + pgVec.append(adcVolt * (105/100)); + return pgVec; +} + +float BoardsCtrlMngt::getCWdpValue() const +{ + _sRbCwdp->sync(); + auto adcValue=_sRbCwdp->cwdpAvgValue->getValue(); + auto cwdpValue= ((static_cast(adcValue))/SUPERVISOR_RB_RESOLUTION)*SUPERVISOR_RB_V_REF*_af.cwd*_gn.cwd; + return cwdpValue; +} + +float BoardsCtrlMngt::getCurr24vValue() const +{ + _sRbCurr24V->sync(); + auto adcValue=_sRbCurr24V->currentP24vAvgValue->getValue(); + auto curr24vValue= ((static_cast(adcValue))/SUPERVISOR_RB_RESOLUTION)*SUPERVISOR_RB_V_REF*_af.curP24v*_gn.curP24v; + return curr24vValue; +} + +float BoardsCtrlMngt::getHVapValue() const +{ + _sRbHvap->sync(); + auto adcValue=_sRbHvap->hvapAvgValue->getValue(); + auto hvapValue= ((static_cast(adcValue))/SUPERVISOR_RB_RESOLUTION)*SUPERVISOR_RB_V_REF*_af.hva*_gn.hva; + return hvapValue; +} + +float BoardsCtrlMngt::getHVbpValue() const +{ + _sRbHvbp->sync(); + auto adcValue=_sRbHvbp->hvbpAvgValue->getValue(); + auto hvbpValue= ((static_cast(adcValue))/SUPERVISOR_RB_RESOLUTION)*SUPERVISOR_RB_V_REF*_af.hvb*_gn.hvb; + return hvbpValue; +} + +float BoardsCtrlMngt::getHvStopValue() const +{ + _sRbHvStop->sync(); + auto adcValue=_sRbHvStop->hvStopAvgValue->getValue(); + auto hvStopValue= ((static_cast(adcValue))/SUPERVISOR_RB_RESOLUTION)*SUPERVISOR_RB_V_REF*_af.hvStop*_gn.hvStop; + return hvStopValue; +} + +float BoardsCtrlMngt::getM5vValue() const +{ + _sRbM5V->sync(); + auto adcValue=_sRbM5V->m5vAvgValue->getValue(); + auto m5vValue= ((static_cast(adcValue))/SUPERVISOR_RB_RESOLUTION)*SUPERVISOR_RB_V_REF*_af.m5v*_gn.m5v; + return m5vValue; +} + +float BoardsCtrlMngt::getP12vValue() const +{ + _sRbP12V->sync(); + auto adcValue=_sRbP12V->p12vAvgValue->getValue(); + auto p12vValue= ((static_cast(adcValue))/SUPERVISOR_RB_RESOLUTION)*SUPERVISOR_RB_V_REF*_af.p12v*_gn.p12v; + return p12vValue; +} + +float BoardsCtrlMngt::getP24vValue() const +{ + _sRbP24V->sync(); + auto adcValue=_sRbP24V->p24vAvgValue->getValue(); + auto p24vValue= ((static_cast(adcValue))/SUPERVISOR_RB_RESOLUTION)*SUPERVISOR_RB_V_REF*_af.p24v*_gn.p24v; + return p24vValue; +} + +float BoardsCtrlMngt::getP4dValue() const +{ + _sRbP4D->sync(); + auto adcValue=_sRbP4D->p4dAvgValue->getValue(); + auto p4dValue= ((static_cast(adcValue))/SUPERVISOR_RB_RESOLUTION)*SUPERVISOR_RB_V_REF*_af.p4d*_gn.p4d; + return p4dValue; +} + +float BoardsCtrlMngt::getP5vValue() const +{ + _sRbP5V->sync(); + auto adcValue=_sRbP5V->p5vAvgValue->getValue(); + auto p5vValue= ((static_cast(adcValue))/SUPERVISOR_RB_RESOLUTION)*SUPERVISOR_RB_V_REF*_af.p5v*_gn.p5v; + return p5vValue; +} + +bool BoardsCtrlMngt::getHvErrFault() const +{ + _sFaultStatus->sync(); + auto fault=_sFaultStatus->hvError->getValue(); + return (fault!=0); +} + +bool BoardsCtrlMngt::getM5vFault() const +{ + _sFaultStatus->sync(); + auto fault=_sFaultStatus->m5v->getValue(); + return (fault!=0); +} + +bool BoardsCtrlMngt::getSup4dFault() const +{ + _sFaultStatus->sync(); + auto fault=_sFaultStatus->sup4d->getValue(); + return (fault!=0); +} + +bool BoardsCtrlMngt::getP5vFault() const +{ + _sFaultStatus->sync(); + auto fault=_sFaultStatus->p5v->getValue(); + return (fault!=0); +} + +bool BoardsCtrlMngt::getP12vFault() const +{ + _sFaultStatus->sync(); + auto fault=_sFaultStatus->p12v->getValue(); + return (fault!=0); +} + +bool BoardsCtrlMngt::getHvapFault() const +{ + _sFaultStatus->sync(); + auto fault=_sFaultStatus->hva->getValue(); + return (fault!=0); +} + +bool BoardsCtrlMngt::getCwdpFault() const +{ + _sFaultStatus->sync(); + auto fault=_sFaultStatus->cwd->getValue(); + return (fault!=0); +} + +bool BoardsCtrlMngt::getHvbpFault() const +{ + _sFaultStatus->sync(); + auto fault=_sFaultStatus->hvb->getValue(); + return (fault!=0); +} + +bool BoardsCtrlMngt::getCur24vFault() const +{ + _sFaultStatus->sync(); + auto fault=_sFaultStatus->cur24vOrHvMux->getValue(); + return (fault!=0); +} + +bool BoardsCtrlMngt::getP24vFault() const +{ + _sFaultStatus->sync(); + auto fault=_sFaultStatus->p24v->getValue(); + return (fault!=0); +} + +bool BoardsCtrlMngt::getOverHvErrFault() const +{ + _sFaultStatus->sync(); + auto fault=_sFaultStatus->overHvError->getValue(); + return (fault!=0); +} + +bool BoardsCtrlMngt::getOverM5vFault() const +{ + _sFaultStatus->sync(); + auto fault=_sFaultStatus->overM5v->getValue(); + return (fault!=0); +} + +bool BoardsCtrlMngt::getOverSup4dFault() const +{ + _sFaultStatus->sync(); + auto fault=_sFaultStatus->overSup4d->getValue(); + return (fault!=0); +} + +bool BoardsCtrlMngt::getOverP5vFault() const +{ + _sFaultStatus->sync(); + auto fault=_sFaultStatus->overP5v->getValue(); + return (fault!=0); +} + +bool BoardsCtrlMngt::getOverP12vFault() const +{ + _sFaultStatus->sync(); + auto fault=_sFaultStatus->overP12v->getValue(); + return (fault!=0); +} + +bool BoardsCtrlMngt::getOverHvapFault() const +{ + _sFaultStatus->sync(); + auto fault=_sFaultStatus->overHva->getValue(); + return (fault!=0); +} + +bool BoardsCtrlMngt::getOverCwdpFault() const +{ + _sFaultStatus->sync(); + auto fault=_sFaultStatus->overCwd->getValue(); + return (fault!=0); +} + +bool BoardsCtrlMngt::getOverHvbpFault() const +{ + _sFaultStatus->sync(); + auto fault=_sFaultStatus->overHvb->getValue(); + return (fault!=0); +} + +bool BoardsCtrlMngt::getOverCur24vFault() const +{ + _sFaultStatus->sync(); + auto fault=_sFaultStatus->overCur24vOrHvMux->getValue(); + return (fault!=0); +} + +bool BoardsCtrlMngt::getOverP24vFault() const +{ + _sFaultStatus->sync(); + auto fault=_sFaultStatus->overP24v->getValue(); + return (fault!=0); +} + +bool BoardsCtrlMngt::getUnderHvErrFault() const +{ + _sFaultStatus->sync(); + auto fault=_sFaultStatus->underHvError->getValue(); + return (fault!=0); +} + +bool BoardsCtrlMngt::getUnderM5vFault() const +{ + _sFaultStatus->sync(); + auto fault=_sFaultStatus->underM5v->getValue(); + return (fault!=0); +} + +bool BoardsCtrlMngt::getUnderSup4dFault() const +{ + _sFaultStatus->sync(); + auto fault=_sFaultStatus->underSup4d->getValue(); + return (fault!=0); +} + +bool BoardsCtrlMngt::getUnderP5vFault() const +{ + _sFaultStatus->sync(); + auto fault=_sFaultStatus->underP5v->getValue(); + return (fault!=0); +} + +bool BoardsCtrlMngt::getUnderP12vFault() const +{ + _sFaultStatus->sync(); + auto fault=_sFaultStatus->underP12v->getValue(); + return (fault!=0); +} + +bool BoardsCtrlMngt::getUnderHvapFault() const +{ + _sFaultStatus->sync(); + auto fault=_sFaultStatus->underHva->getValue(); + return (fault!=0); +} + +bool BoardsCtrlMngt::getUnderCwdpFault() const +{ + _sFaultStatus->sync(); + auto fault=_sFaultStatus->underCwd->getValue(); + return (fault!=0); +} + +bool BoardsCtrlMngt::getUnderHvbpFault() const +{ + _sFaultStatus->sync(); + auto fault=_sFaultStatus->underHvb->getValue(); + return (fault!=0); +} + +bool BoardsCtrlMngt::getUnderCur24vFault() const +{ + _sFaultStatus->sync(); + auto fault=_sFaultStatus->underCur24vOrHvMux->getValue(); + return (fault!=0); +} + +bool BoardsCtrlMngt::getUnderP24vFault() const +{ + _sFaultStatus->sync(); + auto fault=_sFaultStatus->underP24v->getValue(); + return (fault!=0); +} + + +void BoardsCtrlMngt::setReadbackCmd(bool stopWr, bool avgValue, bool roundRobinConfig) const +{ + quint32 stopWrValue=0, avgValueValue=0, roundRobinConfigValue=0; + if (avgValue) + avgValueValue=1; + if (roundRobinConfig) + roundRobinConfigValue=1; + if (stopWr) + stopWrValue=1; + _sRbCmd->roundRobinConfig->setValue(roundRobinConfigValue); + _sRbCmd->averageValueRdReq->setValue(avgValueValue); + _sRbCmd->resetStopWr->setValue(stopWrValue); + _sRbCmd->update(); +} + +bool BoardsCtrlMngt::getI2cCmdErr() const +{ + _sI2cStatus->sync(); + auto status =_sI2cStatus->cmdError->getValue(); + return (status!=0); +} + +bool BoardsCtrlMngt::getI2cCmdDone() const +{ + _sI2cStatus->sync(); + auto status =_sI2cStatus->cmdDone->getValue(); + return (status!=0); +} + +bool BoardsCtrlMngt::getI2cBusy() const +{ + _sI2cStatus->sync(); + auto status =_sI2cStatus->busy->getValue(); + return (status!=0); +} + +void BoardsCtrlMngt::getSupervisorI2cTimeout() const +{ + + while (getI2cBusy()) { + if (checkTimerShot()) + { + // throw exception("Supervisor request timeout is happened due to the MPS I2C busy"); + timerStop(); + return; + } + } + timerStop(); +} + +void BoardsCtrlMngt::getSupervisorI2cDone() const +{ + timerShot(10); + while (!getI2cCmdDone() && !getI2cCmdErr()){ + if (checkTimerShot()) + { + // throw exception("Supervisor request is corrupted due to the failure to receive MPS I2C done"); + timerStop(); + return; + } + } + timerStop(); + + if (getI2cCmdErr()) + { + // throw exception("Supervisor request is corrupted due to the MPS I2C error occurrence"); + return; + } +} + +void BoardsCtrlMngt::setSetupCmdP24vOnOff(bool p24vOnOff) const +{ + quint32 p24vOnOffValue=0; + if (p24vOnOff) + p24vOnOffValue=1; + _sSetupCmd->p24vOnOff->setValue(p24vOnOffValue); + _sSetupCmd->update(); +} + +void BoardsCtrlMngt::setSetupCmdJmp(bool jmpDacCmd) const +{ + quint32 jmpDacCmdValue=0; + if (jmpDacCmd) + jmpDacCmdValue=1; + _sSetupCmd->jmpCmd->setValue(jmpDacCmdValue); + _sSetupCmd->update(); +} + +void BoardsCtrlMngt::setSetupCmdDacsOnOff(bool cwd, bool hvb, bool hva) const +{ + quint32 cwdValue(0), hvbValue(0), hvaValue(0); + if (cwd) + cwdValue=1; + _sSetupCmd->cwdOnOff->setValue(cwdValue); + + if (hvb) + hvbValue=1; + _sSetupCmd->hvbOnOff->setValue(hvbValue); + + if (hva) + hvaValue=1; + _sSetupCmd->hvaOnOff->setValue(hvaValue); + _sSetupCmd->update(); +} + +void BoardsCtrlMngt::setMpsDacsValue(BoardsCtrlMngt::MpsDacs *_mpsDacs) const +{ + quint32 value(0); + _sDacValue->dacsValueValid->setValue(1); + value=static_cast(((_mpsDacs->cwdValue)-CWD_Offset)*CWD_GAIN); + _sDacValue->cwdValue->setValue(value); + value=static_cast(((_mpsDacs->hvbValue)-HVB_Offset)*HVB_GAIN); + _sDacValue->hvbValue->setValue(value); + value=static_cast(((_mpsDacs->hvaValue)-HVA_Offset)*HVA_GAIN); + _sDacValue->hvaValue->setValue(value); + _sDacValue->update(); + _sDacValue->dacsValueValid->setValue(0); + _sDacValue->update(); +} + + +void BoardsCtrlMngt::timerShot(quint16 ms) const +{ + _timer->singleShot(ms, this, SLOT(checkTimerShot)); +} + +bool BoardsCtrlMngt::checkTimerShot() const +{ + return _timer->isSingleShot(); +} + +void BoardsCtrlMngt::timerStop() const +{ + _timer->stop(); +} + + +quint32 BoardsCtrlMngt::getPid() const +{ + this->_pcie->sync(); + auto pid = this->_pcie->pid->getValue(); + return pid; +} + +quint32 BoardsCtrlMngt::getVid() const +{ + this->_pcie->sync(); + auto vid = this->_pcie->vid->getValue(); + return vid; +} + +QVector BoardsCtrlMngt::getConnectedPrb() const +{ + QVector vec; + vec.clear(); + this->_pStatus->sync(); + vec.append((this->_pStatus->probeADetection->getValue())==0); // active low + vec.append((this->_pStatus->probeBDetection->getValue())==0); // active low + vec.append((this->_pStatus->probeCDetection->getValue())==0); // active low + vec.append((this->_pStatus->probeDDetection->getValue())==0); // active low + return vec; +} + +void BoardsCtrlMngt::setProbeSelect(quint8 prbSel) const +{ + this->_pCmd->probeConnectorSelect->setValue(prbSel); + this->_pCmd->update(); +} + +void BoardsCtrlMngt::prbCtrlInit() const +{ + this->_pCmd->HvMuxPwrEn->setValue(0); + this->_pCmd->MotorMuxPwrEn->setValue(0); + this->_pCmd->probeALowPwrEn->setValue(0); + this->_pCmd->probeBLowPwrEn->setValue(0); + this->_pCmd->probeCLowPwrEn->setValue(0); + this->_pCmd->probeDLowPwrEn->setValue(0); + this->_pCmd->probeConnectorSelect->setValue(0); + this->_pCmd->update(); +} + + +float BoardsCtrlMngt::getTrxTempSensor() const +{ + this->_tempSensor->sync(); + qint32 temp = static_cast(this->_tempSensor->temperature->getValue()); + return (temp * TEMP_SENSOR_RESOLUTION); +} + +AdcVoltages *BoardsCtrlMngt::getTrxBoardVoltages() +{ + quint32 value(0); + float voltValue(0); + QVector pgVec; + AdcVoltages* adc; + + this->_adc3P3V->sync(); + value = this->_adc3P3V->channel5Mon->getValue(); + voltValue = resDiv(51,100000,value); + adc->mon3P3V = voltValue; + pgVec= voltPg(3.3f); + _pg->mon3P3V = (voltValue >= pgVec.at(0) && voltValue <= pgVec.at(1)) ? good : bad; + + this->_adc5Vin->sync(); + value = this->_adc5Vin->channel1Mon->getValue(); + voltValue = resDiv(1.2f,2,value); + adc->mon5Vin = voltValue; + pgVec= voltPg(5.0f); + _pg->mon5Vin = (voltValue >= pgVec.at(0) && voltValue <= pgVec.at(1)) ? good : bad; + + this->_adc12Vin->sync(); + value = this->_adc12Vin->channel0Mon->getValue(); + voltValue = resDiv(30, 10, value); + adc->mon12Vin = voltValue; + pgVec= voltPg(12.0f); + _pg->mon12Vin = (voltValue >= pgVec.at(0) && voltValue <= pgVec.at(1)) ? good : bad; + + this->_adcA1P8V->sync(); + value = this->_adcA1P8V->channel6Mon->getValue(); + voltValue = resDiv(51,100000,value); + adc->monAfeA1P8V = voltValue; + pgVec= voltPg(1.8f); + _pg->monAfeA1P8V = (voltValue >= pgVec.at(0) && voltValue <= pgVec.at(1)) ? good : bad; + + this->_adcD1P8V->sync(); + value = this->_adcD1P8V->channel7Mon->getValue(); + voltValue = resDiv(51,100000,value); + adc->monAfeD1P8V = voltValue; + pgVec= voltPg(1.8f); + _pg->monAfeD1P8V = (voltValue >= pgVec.at(0) && voltValue <= pgVec.at(1)) ? good : bad; + + this->_adcVcntlp->sync(); + value = this->_adcVcntlp->channel4Mon->getValue(); + adc->afeVcntlp = resDiv(0,100,value); + + this->_adcPrb3P3V->sync(); + value = this->_adcPrb3P3V->channel3Mon->getValue(); + voltValue = resDiv(47,47,value); + adc->prbCtrl3P3V = voltValue; + pgVec= voltPg(3.3f); + _pg->prbCtrl3P3V = (voltValue >= pgVec.at(0) && voltValue <= pgVec.at(1)) ? good : bad; + + this->_adcPrbEncoder->sync(); + value = this->_adcPrbEncoder->channel2Mon->getValue(); + adc->prbZeroEncoder = resDiv(47,47,value); + + return adc; +} + +VoltagesPg *BoardsCtrlMngt::getTrxVoltagesPg() +{ + this->_tRgltorPg->sync(); + _pg->regulatorA = ((this->_tRgltorPg->regA->getValue())!=0) ? good : bad; + _pg->regulatorB = ((this->_tRgltorPg->regB->getValue())!=0) ? good : bad; + + return _pg; +} + + +void BoardsCtrlMngt::getSupervisorValue(SupervisorRbValue *sValue) const +{ + + getSupervisorI2cTimeout(); + setReadbackCmd(false, false, true); // roundRobin_pulse + setReadbackCmd(false, false, false); + getSupervisorI2cDone(); + + getSupervisorI2cTimeout(); + setReadbackCmd(false, true, false); // avgValueCommand_pulse + setReadbackCmd(false, false, false); + getSupervisorI2cDone(); + + getSupervisorI2cTimeout(); + setReadbackCmd(true, false, false); // resetStopWrite + setReadbackCmd(false, false, false); + getSupervisorI2cDone(); + + sValue->m5V = getM5vValue(); + sValue->p4D = getP4dValue(); + sValue->p5V = getP5vValue(); + sValue->cwdp = getCWdpValue(); + sValue->hvap = getHVapValue(); + sValue->hvbp = getHVbpValue(); + sValue->p12V = getP12vValue(); + sValue->p24V = getP24vValue(); + sValue->hvStop = getHvStopValue(); + sValue->curr24V = getCurr24vValue(); + +} + +void BoardsCtrlMngt::getMpsFault(MpsFaultStatus* faultStatus) const +{ + faultStatus->m5v = getM5vFault(); + faultStatus->p5v = getP5vFault(); + faultStatus->cwdp = getCwdpFault(); + faultStatus->hvap = getHvapFault(); + faultStatus->hvbp = getHvbpFault(); + faultStatus->p12v = getP12vFault(); + faultStatus->p24v = getP24vFault(); + faultStatus->sup4d = getSup4dFault(); + faultStatus->curr24V = getCur24vFault(); + faultStatus->hvError = getHvErrFault(); + + faultStatus->overM5v = getOverM5vFault(); + faultStatus->overP5v = getOverP5vFault(); + faultStatus->overCwdp = getOverCwdpFault(); + faultStatus->overHvap = getOverHvapFault(); + faultStatus->overHvbp = getOverHvbpFault(); + faultStatus->overP12v = getOverP12vFault(); + faultStatus->overP24v = getOverP24vFault(); + faultStatus->overSup4d = getOverSup4dFault(); + faultStatus->overCurr24V = getOverCur24vFault(); + faultStatus->overHvError = getOverHvErrFault(); + + faultStatus->underM5v = getUnderM5vFault(); + faultStatus->underP5v = getUnderP5vFault(); + faultStatus->underCwdp = getUnderCwdpFault(); + faultStatus->underHvap = getUnderHvapFault(); + faultStatus->underHvbp = getUnderHvbpFault(); + faultStatus->underP12v = getUnderP12vFault(); + faultStatus->underP24v = getUnderP24vFault(); + faultStatus->underSup4d = getUnderSup4dFault(); + faultStatus->underCurr24V = getUnderCur24vFault(); + faultStatus->underHvError = getUnderHvErrFault(); +} + +void BoardsCtrlMngt::mpsInit() const +{ + getSupervisorI2cTimeout(); + setSetupCmdP24vOnOff(true); + getSupervisorI2cDone(); +} + +void BoardsCtrlMngt::setMpsReset() const +{ + getSupervisorI2cTimeout(); + setSetupCmdP24vOnOff(false); + getSupervisorI2cDone(); + + getSupervisorI2cTimeout(); + setSetupCmdJmp(true); + setSetupCmdJmp(false); + getSupervisorI2cDone(); + + getSupervisorI2cTimeout(); + setSetupCmdP24vOnOff(true); + getSupervisorI2cDone(); +} + +void BoardsCtrlMngt::mpsHvSet(float &hva, float &hvb) const +{ + if (hva > hvb && hva <= HVA_MAX_VALUE) + { + _mpsDacs->cwdValue = 0.0f; + _mpsDacs->hvaValue = hva; + _mpsDacs->hvbValue = hvb; + + getSupervisorI2cTimeout(); + setMpsDacsValue (_mpsDacs); + getSupervisorI2cDone(); + + getSupervisorI2cTimeout(); + setSetupCmdDacsOnOff(false, true, true); + getSupervisorI2cDone(); + } + else + { + // throw exception("A and B voltage are out of range"); + return; + } +} + + + +QByteArray BoardsCtrlMngt::trxEepromRead(quint32 address, quint32 length) +{ + if (address + length >= TRX_ROM_MAX_LEN) + { + // throw exception("Out of range reading from TRX eeprom "); + return nullptr; + } + quint8 prbSel = 0; + eepromRead(address, length, prbSel, _tRomReq, _tRomStatus); +} + +QByteArray BoardsCtrlMngt::mpsEepromRead(quint32 address, quint32 length) +{ + if (address + length >= MPS_ROM_MAX_LEN) + { + // throw exception("Out of range reading from MPS eeprom "); + return nullptr; + } + quint8 prbSel = 0; + eepromRead(address, length, prbSel, _mRomReq, _mRomStatus); +} + +QByteArray BoardsCtrlMngt::prbCtrlEepromRead(quint32 address, quint32 length) +{ + if (address + length >= PRB_CTRL_ROM_MAX_LEN) + { + // throw exception("Out of range reading from Probe Control eeprom "); + return nullptr; + } + quint8 prbSel = 0; + eepromRead(address, length, prbSel, _pCtrlRomReq, _pCtrlRomStatus); +} + +QByteArray BoardsCtrlMngt::prbEepromRead(quint32 address, quint32 length, quint8 prbSel) +{ + if (address + length >= PRB_ROM_MAX_LEN) + { + // throw exception("Out of range reading from Probe eeprom "); + return nullptr; + } + eepromRead(address, length, prbSel, _pRomReq, _pRomStatus); +} + + +void trxEepromWrite(QByteArray &array, quint32 address, BoardsCtrlMngt* boards) +{ + if (array.size() >= static_cast(TRX_ROM_MAX_LEN)) + { + // throw exception("Out of range writing into TRX eeprom "); + return; + } + quint8 prbSel = 0; + boards->eepromWrite(array, address, prbSel, boards->_tRomReq, boards->_tRomStatus); +} + +void mpsEepromWrite(QByteArray &array, quint32 address, BoardsCtrlMngt *boards) +{ + if (array.size() >= static_cast(MPS_ROM_MAX_LEN)) + { + // throw exception("Out of range writing into MPS eeprom "); + return; + } + quint8 prbSel = 0; + boards->eepromWrite(array, address, prbSel, boards->_mRomReq, boards->_mRomStatus); +} + +void prbCtrlEepromWrite(QByteArray &array, quint32 address, BoardsCtrlMngt *boards) +{ + if (array.size() >= static_cast(PRB_CTRL_ROM_MAX_LEN)) + { + // throw exception("Out of range writing into Probe Control eeprom "); + return; + } + quint8 prbSel = 0; + boards->eepromWrite(array, address, prbSel, boards->_pCtrlRomReq, boards->_pCtrlRomStatus); +} + +void prbEepromWrite(QByteArray &array, quint32 address, quint8 prbSel, BoardsCtrlMngt *boards) +{ + if (array.size() >= static_cast(PRB_ROM_MAX_LEN)) + { + // throw exception("Out of range writing into Probe eeprom "); + return; + } + boards->eepromWrite(array, address, prbSel, boards->_pRomReq, boards->_pRomStatus); +} + + diff --git a/src/model/hardware/core/register/bpiFlash/BpiFlash.cpp b/src/model/hardware/core/register/bpiFlash/BpiFlash.cpp new file mode 100644 index 0000000..4b17baf --- /dev/null +++ b/src/model/hardware/core/register/bpiFlash/BpiFlash.cpp @@ -0,0 +1,45 @@ +#include "model/hardware/core/register/bpiFlash/BpiFlash.h" +#include "model/hardware/core/register/fpgaProgram/FpgaProgram.h" + +BpiFlash::BpiFlash(SonoDevice *device) +{ + _mcsRdWr = new McsRdWr(device); +} + +BpiFlash::~BpiFlash() +{ + delete _mcsRdWr; +} + +void BpiFlash::writeMcs(QByteArray &mcs) const +{ + QList mcsList; + qint32 progByte(0); + quint32 progData(0); + QByteArray mcsArray; + + mcsList.clear(); + mcsArray.clear(); + + while (progByte_mcsRdWr->mcsWrite(mcsList); + this->_mcsRdWr->upadteArray(); +} + +void BpiFlash::readMcs(QList* mcs) const +{ + this->_mcsRdWr->mcsListRd.clear(); + this->_mcsRdWr->syncArray(); + mcs = &(this->_mcsRdWr->mcsListRd); +} diff --git a/src/model/hardware/core/register/builtInTest/BuiltInTest.cpp b/src/model/hardware/core/register/builtInTest/BuiltInTest.cpp new file mode 100644 index 0000000..b2a88e3 --- /dev/null +++ b/src/model/hardware/core/register/builtInTest/BuiltInTest.cpp @@ -0,0 +1,81 @@ +#include "model/hardware/core/register/builtInTest/BuiltInTest.h" + +void BuiltInTest::setDacOutputSelect(BuiltInTest::BiteOutputSelect* _outputSelect) const +{ + quint32 value; + value = (_outputSelect->dacIN) ? 1 : 0; + _dacOutput->dacIN->setValue(value); + + value = (_outputSelect->dacIP) ? 1 : 0; + _dacOutput->dacIP->setValue(value); + + value = (_outputSelect->dacQN) ? 1 : 0; + _dacOutput->dacQN->setValue(value); + + value = (_outputSelect->dacQP) ? 1 : 0; + _dacOutput->dacQP->setValue(value); + + _dacOutput->update(); +} + +void BuiltInTest::setDacMemoryCmd(BuiltInTest::BiteMemoryCmd *_memoryCmd) const +{ + quint32 cmdValue = (_memoryCmd->command) ? 1 : 0; + _dacCmd->startStop->setValue(cmdValue); + + _dacCmd->biteInterval->setValue(_memoryCmd->interval); + + _dacCmd->update(); +} + +BuiltInTest::BuiltInTest(SonoDevice *device) +{ + _dacMemory = new BiteDacMemory (device); + _dacCmd = new BiteDacMemoryCmd (device); + _dacOutput = new BiteDacOutputSelect (device); +} + +BuiltInTest::~BuiltInTest() +{ + delete _dacMemory; + delete _dacCmd; + delete _dacOutput; +} + +void BuiltInTest::biteDacMemoryWrite(TxDacMemory* txDacMem) const +{ + this->_dacMemory->setTxDacMemory(txDacMem); + this->_dacMemory->upadteArray(); +} + +void BuiltInTest::biteDacEnable(quint8 biteInterval, bool cmd) const +{ + this->_dacMemoryCmd->interval = biteInterval; + + auto outputSelect = [this](BiteOutputSelect*, bool active) + { + this->_dacOutputSelect->dacIN = active; + this->_dacOutputSelect->dacIP = active; + this->_dacOutputSelect->dacQN = active; + this->_dacOutputSelect->dacQP = active; + }; + + auto memoryCommand = [this](BiteMemoryCmd*, bool active) + { + this->_dacMemoryCmd->command = active; + }; + + if (cmd) + { + outputSelect(_dacOutputSelect, true); + memoryCommand(_dacMemoryCmd, true); + } + else + { + memoryCommand(_dacMemoryCmd, false); + outputSelect(_dacOutputSelect, false); + } + + this->setDacOutputSelect(_dacOutputSelect); + this->setDacMemoryCmd(_dacMemoryCmd); +} diff --git a/src/model/hardware/core/register/clockDistributer/ClockDistributer.cpp b/src/model/hardware/core/register/clockDistributer/ClockDistributer.cpp new file mode 100644 index 0000000..b23f553 --- /dev/null +++ b/src/model/hardware/core/register/clockDistributer/ClockDistributer.cpp @@ -0,0 +1,78 @@ +#include "model/hardware/core/register/clockDistributer/ClockDistributer.h" + +void ClockDistributer::setCwModeEnable(ClockDistributer::ModeEnable* _enable) +{ + _cwEnable->cwClkdivision->setValue(_enable->cwClkDivision); + + quint32 enVal = _enable->cwClkEnable ? 1 : 0; + _cwEnable->cwClkEn->setValue(enVal); + + quint32 strVal = _enable->spiClkDistStart ? 1 : 0; + _cwEnable->spiClkDistStart->setValue(strVal); + + _cwEnable->update(); +} + +bool ClockDistributer::connectionCheck(void) const +{ + _clkDistrId->sync(); + auto id = _clkDistrId->partId->getValue(); + return (id==_clockDistrId); +} + +ClockDistributer::ClockDistributer(SonoDevice *device) : _clockDistrId(0xE1) +{ + _cwEnable = new CwModeEnable(device); + _cwModeStatus._cwStatus = new CwModeStatus(device); + _clkDistrId = new ClkDistributionId(device); +} + +ClockDistributer::~ClockDistributer() +{ + delete _cwEnable; + delete _cwModeStatus._cwStatus; + delete _clkDistrId; +} + +void ClockDistributer::clockMode(quint32 clkDiv, eClkMode mode) +{ + if (!connectionCheck()){ + //throw exception("Clock modifing is failed due to the disconnect of the clock distributer"); + return; + } + + while (!_cwModeStatus.getEepromClkDistDone()); + while (_cwModeStatus.getSpiClkDistBusy()); + + this->_cwModeEnable->cwClkDivision=clkDiv; + this->_cwModeEnable->cwClkEnable=mode; + this->_cwModeEnable->spiClkDistStart=true; + + this->setCwModeEnable(_cwModeEnable); + + this->_cwModeEnable->spiClkDistStart=false; + + this->setCwModeEnable(_cwModeEnable); +} + + +bool ClockDistributer::ModeStatus::getSpiClkDistDone() const +{ + _cwStatus->sync(); + auto spiDone = _cwStatus->spiClkDistDone->getValue(); + return (spiDone!=0); +} + +bool ClockDistributer::ModeStatus::getSpiClkDistBusy() const +{ + _cwStatus->sync(); + auto spiBusy = _cwStatus->spiClkDistBusy->getValue(); + return (spiBusy!=0); +} + +bool ClockDistributer::ModeStatus::getEepromClkDistDone() const +{ + _cwStatus->sync(); + auto eepromDone = _cwStatus->eepromClkDistDone->getValue(); + return ( eepromDone!=0); +} diff --git a/src/model/hardware/core/register/dsp/Dsp.cpp b/src/model/hardware/core/register/dsp/Dsp.cpp new file mode 100644 index 0000000..9bdc99f --- /dev/null +++ b/src/model/hardware/core/register/dsp/Dsp.cpp @@ -0,0 +1,128 @@ +#include "model/hardware/core/register/dsp/Dsp.h" + +Dsp::Dsp(SonoDevice *device) +{ + _configLut = new ReceiverConfigurationLut (device); + _lineFilterLut = new LineFilterCoefficient (device); + _stbLut = new StbCoefficient (device); + _freqLut = new FrequencyLut (device); + _blendWeight = new BlendWeight (device); + _manualAtgc = new ManualAtgc (device); + _dtgcLut = new DtgcLut (device); + _atgcLut = new AtgcLut (device); + _lpfLut = new LpfLut (device); + +} + +Dsp::~Dsp() +{ + delete _lineFilterLut; + delete _blendWeight; + delete _manualAtgc; + delete _configLut; + delete _freqLut; + delete _dtgcLut; + delete _atgcLut; + delete _stbLut; + delete _lpfLut; +} + + +void Dsp::receiverConfigurationLut(ReceiverConfiguration* configLut) const +{ + this->_configLut->setReceiverConfigurationLut(configLut); + this->_configLut->upadteArray(); +} + +void Dsp::lineFilterCoefficient(QList &lineFilterLut) const +{ + this->_lineFilterLut->setLineFilterLut(lineFilterLut); + this->_lineFilterLut->upadteArray(); +} + +void Dsp::stbCoefficient(QList &stbLut) const +{ + this->_stbLut->setStbLut(stbLut); + this->_stbLut->upadteArray(); +} + +void Dsp::frequencyLut(QList &fLut) const +{ + this->_freqLut->setFreqLut(fLut); + this->_freqLut->upadteArray(); +} + +void Dsp::blendWeight(QList > &blendWeight) const +{ + quint32 baseOffset = this->_blendWeight->getCurrentOffset(); + + foreach (QList temp, blendWeight) + { + this->_blendWeight->setBlendWeight(temp); + this->_blendWeight->upadteArray(); + quint32 curOffset = this->_blendWeight->getCurrentOffset(); + this->_blendWeight->changeOffset(curOffset + BLEND_WEIGHT_OFFSET); + } + + this->_blendWeight->changeOffset(baseOffset); // return to base offset address +} + +void Dsp::atgcMode(eAtgcMode mode, quint16 value) const +{ + auto setManualAtgc = [this](bool valid, quint16& value) + { + quint32 validValue = valid ? 1 : 0; + this->_manualAtgc->userValid->setValue(validValue); + this->_manualAtgc->userDacValue->setValue(value); + }; + + if (mode) + { + this->_manualAtgc->userModeEnable->setValue(1); + setManualAtgc(true, value); + this->_manualAtgc->update(); + setManualAtgc(false, value); + this->_manualAtgc->update(); + } + else + { + this->_manualAtgc->userModeEnable->setValue(0); + this->_manualAtgc->update(); + } +} + +void Dsp::dtgcLut(QList &dtgcLut) const +{ + this->_dtgcLut->setDtgcLut(dtgcLut); + this->_dtgcLut->upadteArray(); +} + +void Dsp::atgcLut(QList > &atgcLut) const +{ + quint32 baseOffset = this->_atgcLut->getCurrentOffset(); + + foreach (QList temp, atgcLut) + { + this->_atgcLut->setAtgcLut(temp); + this->_atgcLut->upadteArray(); + quint32 curOffset = this->_atgcLut->getCurrentOffset(); + this->_atgcLut->changeOffset(curOffset + ATGC_OFFSET); + } + + this->_atgcLut->changeOffset(baseOffset); // return to base offset address +} + +void Dsp::lpfLut(QList> &lpfLut) const +{ + quint32 baseOffset = this->_lpfLut->getCurrentOffset(); + + foreach (QList temp, lpfLut) + { + this->_lpfLut->setLpfLut(temp); + this->_lpfLut->upadteArray(); + quint32 curOffset = this->_lpfLut->getCurrentOffset(); + this->_lpfLut->changeOffset(curOffset + LPF_OFFSET); // return to base offset address + } + + this->_lpfLut->changeOffset(baseOffset); +} diff --git a/src/model/hardware/core/register/fpgaProgram/FpgaProgram.cpp b/src/model/hardware/core/register/fpgaProgram/FpgaProgram.cpp new file mode 100644 index 0000000..2c8053a --- /dev/null +++ b/src/model/hardware/core/register/fpgaProgram/FpgaProgram.cpp @@ -0,0 +1,162 @@ +#include "model/hardware/core/register/fpgaProgram/FpgaProgram.h" + +quint32 byteArray2Uint32BigEndian(QByteArray& byte) +{ + quint32 data; + QDataStream in(byte); + in.setByteOrder(QDataStream::BigEndian); + in >> data; + return data; +} + +void FpgaProgram::setSlaveFpgaNumber(quint8 &number) const +{ + _fpgaNumber->number->setValue(number); + _fpgaNumber->update(); +} + +FpgaProgram::FpgaProgram(SonoDevice* device) +{ + _progData = new SerialProgramData(device); + _status._progStatus = new SerialProgramStatus(device); +} + +FpgaProgram::~FpgaProgram() +{ + delete _progData; + delete _status._progStatus; +} + +void FpgaProgram::program(QByteArray& bitFileData, quint8 number) +{ + qint32 progByte(0); + quint32 progData(0); + QByteArray temp; + + setSlaveFpgaNumber(number); + + while (progByteslaveConfigData->setValue(progData); + _progData->update(); + + while (_status.getProgramBusy()); + + if (_status.getInitFail()) + { +// QString fail=""; +// if (_status.getFpgaS0InitB()) +// fail += "Slave0 FPGA "; + +// if (_status.getFpgaS1InitB()) +// fail += "Slave1 FPGA "; + +// if (_status.getFpgaS2InitB()) +// fail += "Slave2 FPGA "; + throw SonoException("init fail happened"); + } + if (_status.getProgramTimeout()) + { + throw SonoException("Timeout is happened and the programming of the slave FPGAs is failed"); + } + + temp.clear(); + progByte += sizeof (quint32); + + } + while (!(_status.getProgramFail()||_status.getProgramDone())); + + if (_status.getProgramFail()){ + throw SonoException("programming was not successful"); + } +} + + +bool FpgaProgram::ProgramStatus::getProgramBusy() const +{ + _progStatus->sync(); + auto busyStatus=_progStatus->busy->getValue(); + return (busyStatus!=0); +} + +bool FpgaProgram::ProgramStatus::getProgramDone() const +{ + _progStatus->sync(); + auto doneStatus=_progStatus->progDone->getValue(); + return (doneStatus!=0); +} + +bool FpgaProgram::ProgramStatus::getProgramFail() const +{ + _progStatus->sync(); + auto progFailStatus=_progStatus->progFail->getValue(); + return (progFailStatus!=0); +} + +bool FpgaProgram::ProgramStatus::getInitFail() const +{ + _progStatus->sync(); + auto initFailStatus=_progStatus->initFail->getValue(); + return (initFailStatus!=0); +} + +bool FpgaProgram::ProgramStatus::getProgramTimeout() const +{ + _progStatus->sync(); + auto timeoutStatus=_progStatus->timeout->getValue(); + return (timeoutStatus!=0); +} + +bool FpgaProgram::ProgramStatus::getFpgaS0InitB() const +{ + _progStatus->sync(); + auto fpgaInitStatus=_progStatus->slaveFpgaInitB->getValue(); + fpgaInitStatus&=FPGA_S0_INIT_B; + return (fpgaInitStatus!=0); +} + +bool FpgaProgram::ProgramStatus::getFpgaS1InitB() const +{ + _progStatus->sync(); + auto fpgaInitStatus=_progStatus->slaveFpgaInitB->getValue(); + fpgaInitStatus&=FPGA_S1_INIT_B; + return (fpgaInitStatus!=0); +} + +bool FpgaProgram::ProgramStatus::getFpgaS2InitB() const +{ + _progStatus->sync(); + auto fpgaInitStatus=_progStatus->slaveFpgaInitB->getValue(); + fpgaInitStatus &= FPGA_S2_INIT_B; + return (fpgaInitStatus!=0); +} + +//bool FpgaProgram::ProgramStatus::getFpgaS0Done() +//{ +// _progStatus->sync(); +// auto fpgaDoneStatus=_progStatus->slaveFpgaDone->getValue(); +// fpgaDoneStatus&=FPGA_S0_DONE; +// return (fpgaDoneStatus!=0); +//} + +//bool FpgaProgram::ProgramStatus::getFpgaS1Done() +//{ +// _progStatus->sync(); +// auto fpgaDoneStatus=_progStatus->slaveFpgaDone->getValue(); +// fpgaDoneStatus&=FPGA_S1_DONE; +// return (fpgaDoneStatus!=0); +//} + +//bool FpgaProgram::ProgramStatus::getFpgaS2Done() +//{ +// _progStatus->sync(); +// auto fpgaDoneStatus=_progStatus->slaveFpgaDone->getValue(); +// fpgaDoneStatus&=FPGA_S2_DONE; +// return (fpgaDoneStatus!=0); +//} + + diff --git a/src/model/hardware/core/register/scenPlayer/ScenPlayer.cpp b/src/model/hardware/core/register/scenPlayer/ScenPlayer.cpp new file mode 100644 index 0000000..351306f --- /dev/null +++ b/src/model/hardware/core/register/scenPlayer/ScenPlayer.cpp @@ -0,0 +1,50 @@ +#include "model/hardware/core/register/scenPlayer/ScenPlayer.h" + +ScenPalyer::ScenPalyer(SonoDevice *device) +{ + control._playerctrl = new ScenPlayerCtrl(device); + _playerEndIdx = new ScenPlayerEndIndex(device); + _playerStartIdx = new ScenPlayerStartIndex(device); + _playerErrorCnt = new ScenPlayerErrorCount(device); +} + +ScenPalyer::~ScenPalyer() +{ + delete control._playerctrl; + delete _playerEndIdx; + delete _playerStartIdx; + delete _playerErrorCnt; +} + +void ScenPalyer::setStartIndex(quint32 strIdx) +{ + _playerStartIdx->startIndex->setValue(strIdx); + _playerStartIdx->update(); +} + +void ScenPalyer::setEndIndex(quint32 endIdx) +{ + _playerEndIdx->endIndex->setValue(endIdx); + _playerEndIdx->update(); +} + +quint32 ScenPalyer::getErrorCount(void) const +{ + _playerErrorCnt->sync(); + quint32 errCnt = _playerErrorCnt->errorCount->getValue(); + return errCnt; +} + +void ScenPalyer::PlayerControl::command(bool start) const +{ + quint32 strCmd = start ? 1 : 0; + _playerctrl->start->setValue(strCmd); + _playerctrl->update(); +} + +void ScenPalyer::PlayerControl::pause(bool pause) const +{ + quint32 pusCmd = pause ? 1 : 0; + _playerctrl->pause->setValue(pusCmd); + _playerctrl->update(); +} diff --git a/src/model/hardware/device/SonoDevice.cpp b/src/model/hardware/device/SonoDevice.cpp new file mode 100644 index 0000000..000fc0f --- /dev/null +++ b/src/model/hardware/device/SonoDevice.cpp @@ -0,0 +1,163 @@ +#include "model/hardware/device/SonoDevice.h" + +#include +#include + +SonoDevice::SonoDevice() +{ +} + +SonoDevice::~SonoDevice() +{ + for(auto i = 0; i < SW_BUFFER_NUM; i++) + { + delete[] _buffers[i]; + } +} + +void SonoDevice::init() +{ + device.init(); + + for(auto i = 0; i < SW_BUFFER_NUM; i++) + { + _buffers[i] = new char[BUFFER_SIZE]; + memset(_buffers[i], 0, BUFFER_SIZE); + } +} + +void SonoDevice::startTransfer(bool emulatorEn) +{ + if (emulatorEn) + device.writeWord(0, 0x8,3);//800, START_COMMAND); + else + device.writeWord(0, 0x8,1);//800, START_COMMAND); +} + +void SonoDevice::stopTransfer() +{ + device.writeWord(0, 0x8,0);//00, STOP_COMMAND); +} + +int SonoDevice::getCounter() +{ + auto temp = device.readWord(BAR, COUNTER_REG); + + return temp & COUNTER_MASK; +} + +void SonoDevice::setRamOffsetAddress(qint32 offset) +{ + auto value = offset & RAM_OFFSET_MASK; + device.writeWord(BAR, RAM_OFFSET_REG, value); +} + +void SonoDevice::setTransferLength(qint32 length) +{ + auto temp = device.readWord(BAR, XFER_OPT_REG); + + temp &= ~XFER_LEN_MASK; + + temp |= (length & XFER_LEN_MASK); + + device.writeWord(BAR, XFER_OPT_REG, temp); +} + +void SonoDevice::setTransferRate(float rate) +{ + auto value = static_cast(rate * 1E5f) & XFER_RATE_MASK; + device.writeWord(BAR, XFER_RATE_REG, value); +} + +void SonoDevice::setOptions(bool performanceMode) +{ + auto temp = device.readWord(BAR, XFER_OPT_REG); + + if(performanceMode) + { + temp &= ~PERF_MODE_COMMAND; + } + else + { + temp |= PERF_MODE_COMMAND; + } + device.writeWord(BAR, XFER_OPT_REG, temp); +} + +void SonoDevice::setMode(bool dynamicMode) +{ + auto temp = device.readWord(BAR, XFER_OPT_REG); + + if(dynamicMode) + { + temp |= AUTO_INC_COMMAND; + } + else + { + temp &= ~AUTO_INC_COMMAND; + } + device.writeWord(BAR, XFER_OPT_REG, temp); +} + +void SonoDevice::copy(int srcIndex, int dstIndex) +{ + auto src = device.getBufferPtr(srcIndex); + auto dst = _buffers[dstIndex]; + memcpy(dst, src, BUFFER_SIZE); +} + +void SonoDevice::show(int i) +{ + auto tmp = _buffers[i]; + for(auto j = 0; j < 80; j += 8) + { +//quint32 res = 0; +//res = tmp[j] | (tmp[j + 1] << 8) | (tmp[j + 2] << 16) | (tmp[j + 3] << 24); +//qDebug() << QString::number(res, 16); + + quint32 res = 0; + quint32 res2 = 0; + res = tmp[j] | (tmp[j + 1] << 8) | (tmp[j + 2] << 16) | (tmp[j + 3] << 24); + res2 = (tmp[j + 4] << 32) | (tmp[j + 5] << 40) | (tmp[j + 6] << 48) | (tmp[j + 7] << 56); + qDebug() << QString("%1 %2").arg(QString::number(res2, + 10).rightJustified( + 6, + '0')).arg(QString::number(res, 10)); + } +} + +void SonoDevice::fillRam() +{ +// QFile file( +// "/home/hasis/Desktop/PCIE/pcie/PCIe_SGdma_Emulator/PCIe_SGdma_Emulator/_sram_frame_test_data/sram_frame_128x128K/sram_frame.bin"); + +// file.open(QIODevice::ReadOnly); + +// auto temp = file.readAll(); + +// qDebug() << temp.length() << file.errorString(); + + auto temp=16777216; + auto din = 0; + qDebug() << "fillRam :: Start"; + for(auto i = 0; i < temp; i += 8) // SRAM_DDR3_Counter + //for(auto i = 0; i < temp.length(); i++) // DDR3_Frame + { + device.writeLong(1, i, i / 8); // SRAM_DDR3_Counter + //device.writeByte(1, i, temp[i]); // DDR3_Frame + } + for(auto i = 0; i < temp; i += 8) // SRAM_DDR3_Counter + //for(auto i = 0; i < temp.length(); i++) // DDR3_Frame + { + din = device.readLong(1, i); // SRAM_DDR3_Counter + if (din != i / 8) + qDebug() << i; + //device.writeByte(1, i, temp[i]); // DDR3_Frame + } + qDebug() << "fillRam :: Done"; +} + +const char* SonoDevice::getBufferPtr(int index) +{ + return _buffers[index]; +}