#ifndef TRXBOARD_H #define TRXBOARD_H #include #include #include #include #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/emulator/Emulator.h" #include "model/hardware/core/register/misc/Misc.h" #include "model/hardware/core/register/sram/Sram.h" #include "model/hardware/core/register/dsp/Dsp.h" #include "model/hardware/core/register/afe/Afe.h" #include "model/hardware/device/SonoDevice.h" #include "model/scenarioGenerator/dto/hardware/HardwareOutput.h" #include "model/scenarioGenerator/core/general/Calculation.h" #include "model/hardware/service/HardwarePacketEngine.h" #define SLAVE_ELEMENT_SEGMENT 64U #define TOTAL_SCEN_LUT_SRAM 6U #define SLAVE_FPGA_NUMBER 3U #define CLOCK_DIVISION 0x55 #define EEPROM_ID_BYTE_BEGIN 19U #define EEPROM_ID_BYTE_NUMBER 2U #define EEPROM_INFO_BYTE_BEGIN 0U #define EEPROM_INFO_BYTE_NUMBER 19U enum eEmulatorOption : bool { performance = false, functionality = true }; enum eEmulatorMode : bool { dynamically = false, statically = true }; enum eAfePwrdnMode : bool { disable = false, enable = true }; enum eSelectProbe : quint8 { prbA = 1, prbB, prbC, prbD }; enum eSlaveSelect : quint8 { slave0, slave1, slave2 }; struct EmulatorProperties { quint32 ramBufAddress; quint32 transferLength; float transferRate; eEmulatorMode emulMode; eEmulatorOption emulOption; }; struct ProbeElementPosition { QVector xPosition; QVector yPosition; QVector zPosition; }; struct HealthStatus { float systemTemperature; float criticalComponentTemperature; AdcVoltages* adcMon; VoltagesPg* voltsPg; }; struct ConnectedPrbId { quint32 prbA; quint32 prbB; quint32 prbC; quint32 prbD; }; struct ConnectedPrbInfo { QByteArray prbA; QByteArray prbB; QByteArray prbC; QByteArray prbD; }; class TrxBoard { private: QVector _swapVec; QVector _floatQntzrVec; QList _unsignedQntzrList; QList* _mcsList; QList _afeModuleOffset; QList _fpgaOffset; const quint32 _offsetSlave0; const quint32 _offsetSlave1; const quint32 _offsetSlave2; bool _allow; bool _run; int _swCounter; int _hwCounter; SonoDevice _device; AdcVoltages* _adc; VoltagesPg* _pg; ClockDistributer* _clkDistributer; BeamFormer* _beamFormerSlave0; BeamFormer* _beamFormerSlave1; BeamFormer* _beamFormerSlave2; BoardsCtrlMngt* _bCtrlMngt; FpgaProgram* _fpgaProgram; ScenPalyer* _scenPlayer; BpiFlash* _bpiFlash; Afe* _afeSlave0; Afe* _afeSlave1; Afe* _afeSlave2; Emulator* _emul; Misc* _misc; Sram* _sram; Dsp* _dsp; enum eScenParams : quint8 { clear, set }; struct HwRegister { ///////////// BeamFormer ///////////// RxBeamformerProperties* rxBeamformer; QList > apodization; ProbeElementPosition* elementPosition; PulseProperties* pulse; quint8 pulseTypeNumber; quint8 rxBeamFormerTypeNumber; //////////////// DSP //////////////// QVector freqLut; QVector dtgcLut; QList > lpfLut; QList > atgcLut; ReceiverConfiguration* configLut; QVector > blendWeight; quint8 receiverConfigTypeNumber; HwRegister(); ~HwRegister(); }; struct ScenGenHardwareOutput { quint32 focusTypeNumber; quint32 totalTxShotNumber; QVector rxBeamFormerNumber; quint32 scenarioStartIndex; quint32 scenarioEndIndex; HwRegister* hwRegister; SramIndex* indexParams; SramRx* rxParams; SramTx* txParams; ScenGenHardwareOutput(); ~ScenGenHardwareOutput(); } * scenParams; HardwarePacketEngine packetEngine; void setScenario(ScenGenHardwareOutput* scenParams); void setSwapVector(void); void setFpgaOffset (void); void setAfeModuleOffset (void); void scenParamsFilling(eScenParams cmd); QList floatVector2unsignedList (QVector& fVec); signals: void sendFramePacket (const QByteArray newPacket) const; public: TrxBoard(); ~TrxBoard(); ///////////////////////////////// Initialize API ////////////////////////////// void init(void); ////////////////////////////////// Scenario API /////////////////////////////// void setLineFilterCoefficient(QVector& lineFilterLut); void setStbCoefficient(QVector& stbLut); void setDtgcLut(QVector& dtgcLut); void setAtgcMode(eAtgcMode mode, quint16 value) const; void setMetaData(const QByteArray metaData) const; void setScenario(ScenGenHardwareOutput_t scenGenHw); void setAfeConfig(AfeConfig afe); void setAfePwrdnMode(eAfePwrdnMode cmd) const; QList getAfeReg(eSlaveSelect sel, quint32 afeRegAddr); void scenPlayerStart(void); void scenPlayerStop(void); //void scenPlayerPause (bool pause) const; ////////////////////////////// Slave Programming API /////////////////////////// void slaveFpgaProgram(QString path); /////////////////////////////// BeamFormer Mode API //////////////////////////// void setBeamFormerMode(eClkMode mode) const; ///////////////////////////////// Emulator API ///////////////////////////////// void emulatorInit(EmulatorProperties* config) const; void emulatorStart(QString path); void emulatorStop(void); ////////////////////////////// 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; void getConnectedPrbId(ConnectedPrbId* prbId) const; QString trxInfo(void) const; QString mpsInfo(void) const; QString prbCtrlInfo(void) const; QByteArray prbInfo(quint8 prbSel) const; void getConnectedPrbInfo(ConnectedPrbInfo* prbInfo) 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; //////////////////////////////// BPI Flash API ///////////////////////////////// void mcsProgram(QString path); void mcsVerify(QString path) const; //////////////////////////////// Miscellaneous API ///////////////////////////////// void getTrxStatus(StatusVec* status) const; void getFpgasCodeVersion(FpgaCodeVersion* version) const; /////////////////////////////// DMA Data Packet //////////////////////////////////// void readData(); }; #endif //TRXBOARD_H