#ifndef TRXBOARD_H #define TRXBOARD_H #include #include #include #include #include #include #include #include #include #include "register/clockDistributer/ClockDistributer.h" #include "register/boardsCtrlMngt/BoardsCtrlMngt.h" #include "register/fpgaProgram/FpgaProgram.h" #include "register/builtInTest/BuiltInTest.h" #include "register/beamFormer/BeamFormer.h" #include "register/scenPlayer/ScenPlayer.h" #include "register/spiFlash/SpiFlash.h" #include "register/bpiFlash/BpiFlash.h" #include "register/emulator/Emulator.h" #include "register/debug/Debug.h" #include "register/misc/Misc.h" #include "register/sram/Sram.h" #include "register/dsp/Dsp.h" #include "register/afe/Afe.h" #include "model/hardware/device/SonoDevice.h" #include "TrxBoardUtils/TrxBoardStructures.h" #include "TrxBoardUtils/ScenParamsRanges.h" #include "TrxBoardUtils/PreProcessorDef.h" #include "TrxBoardUtils/TrxBoardEnums.h" #include "TrxBoardUtils/e2promFormat.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 MOUNTED_SLAVE_FPGA 7U #define CLOCK_DIVISION 0x55 #define AFE_CHANNEL_NUM_PER_SLAVE 64U #define LOGGER_SAMPLE_CNT 2048U #define BITE_INTERVAL 0x0 class TrxBoard : public QObject { Q_OBJECT private: QTimer* _sonoLiveTimer; QByteArray bin; QVector _swapVec; QVector _unsignedQntzrVec; QList _unsignedQntzrList; QList _afeModuleOffset; QList _fpgaOffset; QByteArray _eepromCrc; QList> _systemLut; const quint32 _offsetSlave0; const quint32 _offsetSlave1; const quint32 _offsetSlave2; bool _sonoHeartBeats; bool _allow; bool _run; qint32 _swCounter; qint32 _hwCounter; SonoDevice _device; AdcVoltages* _adc; VoltagesPg* _pg; FanRpm* _tachoRpm; criticalComponentVoltages* _coreVolt; criticalComponentTemperature* _coreTemp; ClockDistributer* _clkDistributer; BeamFormer* _beamFormerSlave0; BeamFormer* _beamFormerSlave1; BeamFormer* _beamFormerSlave2; BoardsCtrlMngt* _bCtrlMngt; BuiltInTest* _builtInTest; FpgaProgram* _fpgaProgram; ScenPalyer* _scenPlayer; Debug* _debugSlave0; Debug* _debugSlave1; Debug* _debugSlave2; BpiFlash* _bpiFlash; SpiFlash* _spiFlash; Afe* _afeSlave0; Afe* _afeSlave1; Afe* _afeSlave2; Emulator* _emul; Misc* _misc; Sram* _sram; Dsp* _dsp; enum eScenParams : quint8 { clear, set }; enum eActiveElements : quint8 { slave0Elements, slave1Elements, slave2Elements }; struct ScenHwRegister { ///////////// BeamFormer ///////////// QList apodizationParams; ProbeElementPosition* elementPosition; RxBeamformerProperties* rxBeamformer; PulseProperties* pulse; quint8 pulseTypeNumber; quint8 rxBeamFormerTypeNumber; //////////////// DSP //////////////// QVector freqStepLut; QVector lpfWeightStepLut; QVector startLpfWeightLut; QVector freqLut; QVector dtgcLut; QList dualPathWeight; ReceiverConfiguration* configLut; FreqPoint* freqPoint; QVector > blendWeight; quint8 receiverConfigTypeNumber; QList mlaOffsetAddr; QList startFreqLut; QList endFreqLut; quint32 noiseReject; quint32 frameLoggerControl; QList lpfScaleCoeff; QList lpfLut; ScenHwRegister(); ~ScenHwRegister(); }; struct ScenGenHardwareParam { quint32 focusTypeNumber; quint32 totalTxShotNumber; QVector rxBeamFormerNumber; quint32 scenarioStartIndex; quint32 scenarioEndIndex; ScenHwRegister* hwRegister; SramIndex* indexParams; SramRx* rxParams; SramTx* txParams; ScenGenHardwareParam(); ~ScenGenHardwareParam(); } * _scenParams; void sonoLiveTimeout(); void sendPacket(void); void delay(quint16 ms) const; void fpgaProgram(const QString path, const quint8& slaveMounted) const; void mcsRead(const QString path) const; void setScenario(ScenGenHardwareParam* _scenParams); void sramClear(eSramClear clearMode); void setSwapVector(void); void setRomCrc(void); void setFpgaOffset(void); void setAfeModuleOffset(void); void scenParamsFilling(eScenParams cmd); //QList signedVector2unsignedList(QVector& sgnVec); QList systemStructure2List(systemE2proms &systemRoms); void systemLutCompletion(void); void systemCompare(QList &system) const; void crcCheck (const QByteArray array, quint8 crcRom) const; void trxCrcCheck(const QByteArray array, quint32 offset) const; void prbCtrlCrcCheck(const QByteArray array, quint32 offset) const; void mpsCrcCheck(const QByteArray array, quint32 offset) const; #ifndef DEVELOP_UI void afeAdcsSync(const quint8& slaveMounted); void gtReadReset(void); #endif void waitForCaptureDone(Debug* _dbg); void adcCaptureStop(Debug* _dbg) const; void adcCaptureStart(Debug* _dbg) const; void adcLogTransferRoutine(Debug* _dbg, quint8 chNumPerFpga); void debuggerMode(Debug* _dbg, DebugMode& debug, DebugMode& debugRb, QString slaveN) const; template QByteArray uintLittleEndian2ByteArray(T& data) const; template T byteArray2UintLittleEndian(QByteArray& byte) const; signals: void sendFramePacket(QByteArray newPacket); void sramBinaryCreateFlag(void); void registerCsvCompareFlag(void); void sramVerifyMessage(QString message); public: #ifndef DEVELOP_UI HardwarePacketEngine packetEngine; #else void afeAdcsSync(const quint8& slaveMounted); void gtReadReset(void); #endif qint32 preSubBatch; qint32 preBatch; TrxBoard(); ~TrxBoard(); ///////////////////////////////// Initialize API ////////////////////////////// void init(void); ////////////////////////////////// Scenario API /////////////////////////////// void setProbeDependParams(ScenPrbDepHardwareParam& prbDepParams); void setScenario(ScenHardware& scenGenHw); void setLineFilterCoefficient(QVector& lineFilterLut); void setStbCoefficient(QVector& stbLut); void setDtgcLut(QVector& dtgcLut); void scenPlayerStart(bool afeHvPwrOn = false); void scenPlayerStop(bool afeHvPwrOff = false); //void scenPlayerPause (bool pause) const; bool isScenarioStart() const; void setFramesMetaData(const QByteArray& metaData); void setMChangeParams(SramTx* tx, SramRx* rx) const; /////////////////////////////// Built-in Test API ///////////////////////////// void setBiteDacData(const QByteArray& iData, const QByteArray& qData) const; void biteScenPlayerStart(void); void biteScenPlayerStop(void); ////////////////////////////////// UI Test API //////////////////////////////// void setScenarioCompare(const QString scenPath); void setAtgcMode(eAtgcMode mode, quint16 value) const; QList getAfeReg(eSlaveSelect sel, quint32 afeRegAddr); void setAdgCfg(eBiteDacOutput adg) const; void setTxDacEnable(quint8 biteInterval, bool cmd) const; void powerAo(bool flag); ////////////////////////////// Slave Programming API ////////////////////////// void slaveFpgaProgram(const QString path); /////////////////////////////// BeamFormer Mode API /////////////////////////// void setBeamFormerMode(eClkMode mode) const; ///////////////////////////////// Emulator API //////////////////////////////// void emulatorInit(EmulatorProperties* config) const; void fillRam(QString path); void emulatorStart(void); void emulatorStop(void); ////////////////////////////// BoardCtrlMngt API ////////////////////////////// quint32 deviceId(void) const; quint32 vendorId(void) const; void checkSystemCompatibility(void); quint8 crcGenerator(QByteArray inputByteArray) const; QByteArray trxRomHeader(void) const; QByteArray trxRomId(void) const; QByteArray trxRomPid(void) const; QByteArray trxRomPcbVersion(void) const; QByteArray trxRomSerialNo(void) const; QByteArray trxRomFirstMbedCode(void) const; QByteArray trxRomSecondMbedCode(void) const; void trxState(EepromStatus& romStatus) const; QByteArray mpsRomHeader(void) const; QByteArray mpsRomId(void) const; QByteArray mpsRomPid(void) const; QByteArray mpsRomPcbVersion(void) const; QByteArray mpsRomSerialNo(void) const; QByteArray mpsRomFirstMbedCode(void) const; QByteArray mpsRomSecondMbedCode(void) const; void mpsState(EepromStatus& romStatus) const; QByteArray prbCtrlRomHeader(void) const; QByteArray prbCtrlRomId(void) const; QByteArray prbCtrlRomPid(void) const; QByteArray prbCtrlRomPcbVersion(void) const; QByteArray prbCtrlRomSerialNo(void) const; void prbCtrlState(EepromStatus& romStatus) const; void selectedPrbState(EepromStatus& romStatus, eSelectProbe prbSel) const; void prbState(PrbCase* prb) const; QByteArray selectedPrbImpulseResponse(quint8 prbSel) const; void prbImpulseResponse(ConnectedPrbInfo* prbInfo) const; // QString trxInfo(void) const; // QString mpsInfo(void) const; // QString prbCtrlInfo(void) const; void supervisorRbValue(SupervisorRbValue* sValue) const; void mpsFaultStatus(MpsFaultStatus* faultStatus) const; void mpsPwrOn() const; void mpsPwrOff() const; void mpsReset(void) const; void mpsSetAo(float voltA, float voltB) const; void selectProbe(eSelectProbe prbSel); void getHealthStatus(HealthStatus* healStat) const; void setTrxFanRpm(const eFanPwm& fan, const quint8& dutyCyclePercent) const; //////////////////////////////// BPI Flash API //////////////////////////////// void mcsProgram(QString path); void mcsVerify(QString path) const; //////////////////////////////// SPI Flash API //////////////////////////////// void spiFlashProgram(QString path); void spiFlashRead(QString path); void spiFlashVerify(); //////////////////////////////// Miscellaneous API //////////////////////////// void getTrxStatus(StatusVec* status) const; void getFpgasCodeVersion(FpgaCodeVersion* version) const; void sramParityClear(); quint32 getFrameLostCounter(void) const; void elementActiveEnable(eActiveElements& slaveElements, quint64& elements) const; ////////////////////////////////// Logger API ///////////////////////////////// void adcCaptureConfig(captureConfig& capCfg) const; void adcCaptureStart(void) const; void adcCaptureDone(void); void setCaptureManualSync(void) const; void adcLoggerStart(const QString path, const QString fileName); void setDebuggerMode(eDebugMode bfMode, bool enable); void setAfeConfig(AfeConfig& afeCfg) const; void setAfePwr(eAfePwrdnMode pwrMode) const; /////////////////////////////// DMA Data Packet /////////////////////////////// void readData(); }; #endif //TRXBOARD_H