Browse Source

The built-in test functions are added.

The lpf scale coefficients are added to scenario.
master v2.2
Arash Aletayeb 3 years ago
parent
commit
da43daa1c8
  1. 2
      developHw.pro
  2. 2
      developHw.pro.user
  3. 7
      hdf5Scenario/hdf5Scenario.cpp
  4. 46
      include/model/hardware/core/TrxBoard.h
  5. 2
      include/model/hardware/core/TrxBoardUtils/PreProcessorDef.h
  6. 1
      include/model/hardware/core/TrxBoardUtils/ScenParamsRanges.h
  7. 24
      include/model/hardware/core/TrxBoardUtils/TrxBoardEnums.h
  8. 1
      include/model/hardware/core/TrxBoardUtils/TrxBoardStructures.h
  9. 2
      include/model/hardware/core/register/Register.h
  10. 3
      include/model/hardware/core/register/afe/Afe.h
  11. 43
      include/model/hardware/core/register/afe/registerDefinition/AdcLatency.h
  12. 1
      include/model/hardware/core/register/beamFormer/registerDefinition/ApodizationLut.h
  13. 2
      include/model/hardware/core/register/bpiFlash/registerDefinition/McsRdWr.h
  14. 9
      include/model/hardware/core/register/builtInTest/BuiltInTest.h
  15. 19
      include/model/hardware/core/register/builtInTest/registerDefinition/BiteDacMemory.h
  16. 66
      include/model/hardware/core/register/debug/Debug.h
  17. 51
      include/model/hardware/core/register/debug/registerDefinition/AdcLoggerCapCmd.h
  18. 38
      include/model/hardware/core/register/debug/registerDefinition/AdcLoggerDataTransfer.h
  19. 43
      include/model/hardware/core/register/debug/registerDefinition/AdcLoggerStatus.h
  20. 42
      include/model/hardware/core/register/debug/registerDefinition/DebuggerMode.h
  21. 3
      include/model/hardware/core/register/dsp/Dsp.h
  22. 43
      include/model/hardware/core/register/dsp/registerDefinition/BfScale.h
  23. 2
      include/model/hardware/core/register/dsp/registerDefinition/ManualAtgc.h
  24. 25
      include/model/hardware/core/register/misc/Misc.h
  25. 38
      include/model/hardware/core/register/misc/registerDefinition/AdcDataBram.h
  26. 34
      include/model/hardware/core/register/misc/registerDefinition/AdcSamplerControl.h
  27. 35
      include/model/hardware/core/register/misc/registerDefinition/AdcSamplerStatus.h
  28. 2
      include/model/hardware/core/register/misc/registerDefinition/FrameLostCount.h
  29. 8
      include/model/hardware/core/register/sram/registerDefinition/RxParams.h
  30. 1082
      mainwindow.cpp
  31. 145
      mainwindow.h
  32. 1520
      mainwindow.ui
  33. 265
      src/model/hardware/core/TrxBoard.cpp
  34. 23
      src/model/hardware/core/register/Field.cpp
  35. 2
      src/model/hardware/core/register/Register.cpp
  36. 8
      src/model/hardware/core/register/afe/Afe.cpp
  37. 48
      src/model/hardware/core/register/builtInTest/BuiltInTest.cpp
  38. 121
      src/model/hardware/core/register/debug/Debug.cpp
  39. 11
      src/model/hardware/core/register/dsp/Dsp.cpp
  40. 40
      src/model/hardware/core/register/misc/Misc.cpp

2
developHw.pro

@ -22,7 +22,7 @@ SOURCES += \
qcustomplot.cpp \
api.cpp \
$$files(src/*.cpp, true) \
$$files(hdf5Scenario/*.cpp, true) \
$$files(hdf5Scenario/*.cpp, true)
HEADERS += \
mainwindow.h \

2
developHw.pro.user

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.10.0, 2021-07-05T13:05:02. -->
<!-- Written by QtCreator 4.10.0, 2021-07-12T11:26:49. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>

7
hdf5Scenario/hdf5Scenario.cpp

@ -652,6 +652,13 @@ void Hdf5::prbDependParamsRead(ScenPrbDepHardwareParam &prbDepParams)
}
prbDepParams.prbDepParams.lpfLut.push_back(tempLpf);
}
/**************** /registerParameters/lpfScale ********************/
datasetBranch <float_t>("/registerParameters/lpfScale", floatArray);
prbDepParams.prbDepParams.lpfScaleCoeff.clear();
for (quint8 i = 0; i < 4; i++)
prbDepParams.prbDepParams.lpfScaleCoeff.push_back(static_cast<quint8>(floatArray[i]));
}

46
include/model/hardware/core/TrxBoard.h

@ -7,6 +7,7 @@
#include <QVector>
#include <QString>
#include <QByteArray>
#include <QTime>
#include <QDebug>
#include "model/hardware/core/register/clockDistributer/ClockDistributer.h"
@ -17,6 +18,7 @@
#include "model/hardware/core/register/scenPlayer/ScenPlayer.h"
#include "model/hardware/core/register/bpiFlash/BpiFlash.h"
#include "model/hardware/core/register/emulator/Emulator.h"
#include "model/hardware/core/register/debug/Debug.h"
#include "model/hardware/core/register/misc/Misc.h"
#include "model/hardware/core/register/sram/Sram.h"
#include "model/hardware/core/register/dsp/Dsp.h"
@ -31,10 +33,16 @@
#include "model/hardware/service/HardwarePacketEngine.h"
#define SLAVE_ELEMENT_SEGMENT 64U
#define TOTAL_SLAVE_FPGA_NUM 3U
#define TOTAL_SCEN_LUT_SRAM 5U
#define MOUNTED_SLAVE_FPGA 7U
#define CLOCK_DIVISION 0x55
#define AFE_CHANNEL_NUM_PER_SLAVE 64U
#define TOTAL_AFE_CHANNEL_NUM 192U
#define LOGGER_SAMPLE_CNT 2048U
#define BITE_INTERVAL 0x0
#define EEPROM_CRC_BEGIN 0U
#define EEPROM_CRC_NUMBER 19U
#define EEPROM_ID_BEGIN 19U
@ -55,7 +63,6 @@ private:
QVector<quint8> _swapVec;
QVector<quint32> _unsignedQntzrVec;
QList<quint32> _unsignedQntzrList;
QList<quint32>* _mcsList;
QList<quint32> _afeModuleOffset;
QList<quint32> _fpgaOffset;
QByteArray _eepromCrc;
@ -76,9 +83,13 @@ private:
BeamFormer* _beamFormerSlave0;
BeamFormer* _beamFormerSlave1;
BeamFormer* _beamFormerSlave2;
BoardsCtrlMngt* _bCtrlMngt;
BoardsCtrlMngt* _bCtrlMngt;
BuiltInTest* _builtInTest;
FpgaProgram* _fpgaProgram;
ScenPalyer* _scenPlayer;
ScenPalyer* _scenPlayer;
Debug* _debugSlave0;
Debug* _debugSlave1;
Debug* _debugSlave2;
BpiFlash* _bpiFlash;
Afe* _afeSlave0;
Afe* _afeSlave1;
@ -143,12 +154,16 @@ private:
void afeAdcsSync(void) const;
void adcLogTransferRoutine (Debug* _dbg, quint8 chNumPerFpga);
void debuggerMode(Debug* _dbg, DebugMode& debug, DebugMode& debugRb, QString slaveN) const;
template<class T>
QByteArray uintLittleEndian2ByteArray(T& data) const;
template<class T>
T byteArray2UintLittleEndian(QByteArray& byte) const;
signals:
void sendFramePacket(QByteArray newPacket);
void sramBinaryCreateFlag(void);
@ -181,24 +196,29 @@ public:
void setFramesMetaData(const QByteArray &metaData) const;
////////////////////////////////// UI Test API ///////////////////////////////
/////////////////////////////// Built-in Test API /////////////////////////////
void setBiteDacData(const QByteArray& iData,const QByteArray& qData) const;
void biteScenPlayerStart(void);
void biteScenPlayerStop(void);
////////////////////////////////// UI Test API ////////////////////////////////
void setScenarioCompare (const QString scenPath);
void setAtgcMode(eAtgcMode mode, quint16 value) const;
QList<quint32> getAfeReg(eSlaveSelect sel, quint32 afeRegAddr);
////////////////////////////// Slave Programming API ///////////////////////////
////////////////////////////// Slave Programming API //////////////////////////
void slaveFpgaProgram(const QString path);
/////////////////////////////// BeamFormer Mode API ////////////////////////////
/////////////////////////////// BeamFormer Mode API ///////////////////////////
void setBeamFormerMode(eClkMode mode) const;
///////////////////////////////// Emulator API /////////////////////////////////
///////////////////////////////// Emulator API ////////////////////////////////
void emulatorInit(EmulatorProperties* config) const;
void fillRam(QString path);
void emulatorStart(void);
void emulatorStop(void);
////////////////////////////// BoardCtrlMngt API ///////////////////////////////
////////////////////////////// BoardCtrlMngt API //////////////////////////////
quint32 deviceId(void) const;
quint32 vendorId(void) const;
@ -224,17 +244,21 @@ public:
void selectProbe(eSelectProbe prbSel);
void getHealthStatus(HealthStatus* healStat) const;
//////////////////////////////// BPI Flash API /////////////////////////////////
//////////////////////////////// BPI Flash API ////////////////////////////////
void mcsProgram(QString path);
void mcsVerify(QString path) const;
//////////////////////////////// Miscellaneous API /////////////////////////////////
//////////////////////////////// Miscellaneous API ////////////////////////////
void getTrxStatus(StatusVec* status) const;
void getFpgasCodeVersion(FpgaCodeVersion* version) const;
void sramParityClear();
quint32 getFrameLostCounter(void) const;
/////////////////////////////// DMA Data Packet ////////////////////////////////////
////////////////////////////////// Logger API /////////////////////////////////
void adcCaptureStart(captureConfig &capCfg, eSyncMode syncMode);
void adcLoggerStart(const QString path);
/////////////////////////////// DMA Data Packet ///////////////////////////////
void readData();
};

2
include/model/hardware/core/TrxBoardUtils/PreProcessorDef.h

@ -2,6 +2,6 @@
#define PREPROCESSORDEF_H
#define MPS_BOARD
//#define DEVELOP_UI
#define DEVELOP_UI
#endif //PREPROCESSORDEF_H

1
include/model/hardware/core/TrxBoardUtils/ScenParamsRanges.h

@ -7,6 +7,7 @@
#define LINE_FILTER_LUT_MAX 3
#define BLENDWEIGHT_LUT_MAX 4
#define FREQUENCY_LUT_MAX 8
#define LPF_SCALE_MAX 4
#define DTGC_LUT_MAX 1024
#define ATGC_LUT_MAX 4
#define LPF_LUT_MAX 4

24
include/model/hardware/core/TrxBoardUtils/TrxBoardEnums.h

@ -48,4 +48,28 @@ enum eConnectionMode : bool
connected = true
};
enum eSyncMode : bool
{
autoSync = false,
manualSync = true
};
enum eAdcCapture : bool
{
captureStop = false,
captureStart = true
};
enum eAdcLogger : bool
{
loggerStop = false,
loggerStart = true
};
enum eAdcSampler : bool
{
samplerStop = false,
samplerStart = true
};
#endif // TRXBOARDENUMS_H

1
include/model/hardware/core/TrxBoardUtils/TrxBoardStructures.h

@ -53,6 +53,7 @@ struct ConnectedPrbInfo
struct ScenPrbDepHwRegister
{
QList<quint8> lpfScaleCoeff;
QList<QVector<quint32>> lpfLut;
QList<QVector<quint32>> atgcLut;
QList<QVector<quint32>> apodizationLut;

2
include/model/hardware/core/register/Register.h

@ -50,7 +50,7 @@ public:
void update();
void updateLong();
void updateArray(bool isVariable = false, quint8 arrayLength = 0);
void updateArray(bool isVariable = false, quint16 arrayLength = 0);
void updateArrayLong(quint8 interval, quint32 arrayLength, bool _isCumulative=false);
void sync();

3
include/model/hardware/core/register/afe/Afe.h

@ -2,6 +2,7 @@
#define AFE_H
#include "registerDefinition/AdcSyncStatus.h"
#include "registerDefinition/AdcLatency.h"
#include "registerDefinition/ActiveTerm.h"
#include "registerDefinition/LnaHpf.h"
#include "registerDefinition/Global.h"
@ -135,6 +136,7 @@ class Afe
{
private:
AdcSyncStatus* _adcSync;
AdcLatency* _adcLatency;
ActiveTerm* _actTerm;
LnaHpf* _lnaHpf;
Global* _global;
@ -154,6 +156,7 @@ public:
void setAfeGblPwr(const bool pwrdn) const;
void setReadRegEnable(const bool rdEn) const;
quint32 getAdcLatency(void) const;
bool getAfeSyncDone(void) const;
quint32 getAfeSyncError(void) const;
quint32 getAfeSyncAddress(void) const;

43
include/model/hardware/core/register/afe/registerDefinition/AdcLatency.h

@ -0,0 +1,43 @@
#ifndef ADCLATENCY_H
#define ADCLATENCY_H
#include "model/hardware/core/register/Register.h"
#include "model/hardware/core/register/RegUtils.h"
#undef BAR
#define GEN_SYNC_CHECKER_MASK 0x00000001
#define SYNC_CHECK_DONE_MASK 0x00000002
#define SYNC_CHECK_ERROR_MASK 0x00000004
#define SAMPLE_LATENCY_MASK 0x00003F00
#define BAR 0U
#define OFFSET 0x43C380
class AdcLatency : public Register
{
public:
Field* genSyncChecker;
Field* syncCheckDone;
Field* syncCheckError;
Field* sampleLatency;
AdcLatency(SonoDevice* device, quint32 offset) : Register(BAR, OFFSET + offset, device)
{
ADD_UNSIGNED_FIELD(genSyncChecker, GEN_SYNC_CHECKER_MASK);
ADD_UNSIGNED_FIELD(syncCheckDone, SYNC_CHECK_DONE_MASK );
ADD_UNSIGNED_FIELD(syncCheckError, SYNC_CHECK_ERROR_MASK);
ADD_UNSIGNED_FIELD(sampleLatency, SAMPLE_LATENCY_MASK );
}
};
#undef GEN_SYNC_CHECKER_MASK
#undef SYNC_CHECK_DONE_MASK
#undef SYNC_CHECK_ERROR_MASK
#undef SAMPLE_LATENCY_MASK
#undef BAR
#undef OFFSET
#endif // ADCLATENCY_H

1
include/model/hardware/core/register/beamFormer/registerDefinition/ApodizationLut.h

@ -19,7 +19,6 @@ private:
void prepareData(quint32 index) override
{
//apodizationPrp->setValue(_apodization.at(static_cast<qint32>(index)));
apodizationPrp->setValue(_apodization[static_cast<qint32>(index)]);
}

2
include/model/hardware/core/register/bpiFlash/registerDefinition/McsRdWr.h

@ -32,7 +32,7 @@ public:
void receiveData (void) override
{
mcsListRd.append(masterMcsData->getValue());
mcsListRd.push_back(this->masterMcsData->getValue());
}
McsRdWr(SonoDevice* device) : Register(BAR, OFFSET, device, MCS_FILE_SIZE)

9
include/model/hardware/core/register/builtInTest/BuiltInTest.h

@ -5,6 +5,12 @@
#include "registerDefinition/BiteDacMemoryCmd.h"
#include "registerDefinition/BiteDacOutputSelect.h"
enum eBiteDacOutput : bool
{
adgGnd = false,
adgIQ = true
};
class BuiltInTest
{
private:
@ -33,8 +39,9 @@ public:
explicit BuiltInTest(SonoDevice* device);
~BuiltInTest();
void biteDacMemoryWrite (TxDacMemory* txDacMem) const;
void biteDacMemoryWrite (const QByteArray& iData, const QByteArray& qData) const;
void biteDacEnable(quint8 biteInterval, bool cmd) const;
void biteAdgCfg(eBiteDacOutput adg) const;
};

19
include/model/hardware/core/register/builtInTest/registerDefinition/BiteDacMemory.h

@ -13,30 +13,25 @@
#define OFFSET 0XE000
#define LENGTH 2048U
struct TxDacMemory
{
QList<quint32> _iData;
QList<quint32> _qData;
};
class BiteDacMemory : public Register
{
private:
TxDacMemory* _txDacMem;
QByteArray _iData;
QByteArray _qData;
void prepareData(quint32 index) override
{
txDacIData->setValue(_txDacMem->_iData.at(static_cast<qint32>(index)));
txDacQData->setValue(_txDacMem->_qData.at(static_cast<qint32>(index)));
txDacIData->setValue(static_cast<quint32>(_iData.at(static_cast<qint32>(index))));
txDacQData->setValue(static_cast<quint32>(_qData.at(static_cast<qint32>(index))));
}
public:
Field* txDacIData;
Field* txDacQData;
void setTxDacMemory(TxDacMemory* txDacMem)
void setTxDacMemory(const QByteArray& iData, const QByteArray& qData)
{
_txDacMem = txDacMem;
_iData = iData;
_qData = qData;
}
BiteDacMemory(SonoDevice* device) : Register(BAR, OFFSET, device, LENGTH)

66
include/model/hardware/core/register/debug/Debug.h

@ -0,0 +1,66 @@
#ifndef DEBUG_H
#define DEBUG_H
#include "registerDefinition/AdcLoggerDataTransfer.h"
#include "registerDefinition/AdcLoggerCapCmd.h"
#include "registerDefinition/AdcLoggerStatus.h"
#include "registerDefinition/DebuggerMode.h"
enum eDebugMode : bool
{
pulserHz = false,
pulserTr = true
};
enum eCaptureMode : bool
{
allChannel = false,
singleChannel = true
};
struct DebugMode
{
bool rxBfDbgModeEn;
bool rxBfSimDataGenModeEn;
bool txBfTestModeEn;
eDebugMode txBfTestModeCfg;
};
struct captureConfig
{
eCaptureMode capMode = allChannel;
bool manualTrig = false;
quint32 sampleCount;
quint32 syncCount;
};
class Debug
{
private:
AdcLoggerDataTransfer* _adcLoggerDataTransfer;
AdcLoggerCapCmd* _adcLoggerCapCmd;
AdcLoggerStatus* _adcLoggerStatus;
DebuggerMode* _debuggerMode;
public:
explicit Debug(SonoDevice* device, quint32 offset);
~Debug();
void setDebuggerMode (const DebugMode dbgMode) const;
void getDebuggerMode (DebugMode& dbgModeRb);
void adcLoggerConfig (const captureConfig &capCfg) const;
void adcLoggerRst (bool capRst) const;
void adcCaptureCmd (bool capEn) const;
quint32 getCaptureSampleNo (void) const;
void adcLoggerChannelNum (quint16 chNum) const;
void adcLoggerTransferCmd (bool start) const;
bool getCapDone (void) const;
bool getTransferDone (void) const;
quint32 getCapSyncOffset (void) const;
};
#endif // DEBUG_H

51
include/model/hardware/core/register/debug/registerDefinition/AdcLoggerCapCmd.h

@ -0,0 +1,51 @@
#ifndef ADCLOGGERCAPCMD_H
#define ADCLOGGERCAPCMD_H
#include "model/hardware/core/register/Register.h"
#include "model/hardware/core/register/RegUtils.h"
#undef BAR
#define LOGGER_RST_MASK 0x00000001
#define CAP_MODE_MASK 0x00000002
#define CAP_EN_MASK 0x00000004
#define CAP_MNL_TRIG_MASK 0x00000008
#define CAP_SYNC_NO_MASK 0x00003FF0
#define CAP_SAMPLE_NO_MASK 0xFFFFC000
#define BAR 0U
#define OFFSET 0x500004
class AdcLoggerCapCmd : public Register
{
public:
Field* loggerRst;
Field* capMode;
Field* capEn;
Field* capMnlTrig;
Field* capSyncNo;
Field* capSampleNo;
AdcLoggerCapCmd(SonoDevice* device, quint32 offset) : Register(BAR, OFFSET + offset, device)
{
ADD_UNSIGNED_FIELD(loggerRst, LOGGER_RST_MASK );
ADD_UNSIGNED_FIELD(capMode, CAP_MODE_MASK );
ADD_UNSIGNED_FIELD(capEn, CAP_EN_MASK );
ADD_UNSIGNED_FIELD(capMnlTrig, CAP_MNL_TRIG_MASK );
ADD_UNSIGNED_FIELD(capSyncNo, CAP_SYNC_NO_MASK );
ADD_UNSIGNED_FIELD(capSampleNo, CAP_SAMPLE_NO_MASK);
}
};
#undef LOGGER_RST_MASK
#undef CAP_MODE_MASK
#undef CAP_EN_MASK
#undef CAP_MNL_TRIG_MASK
#undef CAP_SYNC_NO_MASK
#undef CAP_SAMPLE_NO_MASK
#undef BAR
#undef OFFSET
#endif // ADCLOGGERCAPCMD_H

38
include/model/hardware/core/register/debug/registerDefinition/AdcLoggerDataTransfer.h

@ -0,0 +1,38 @@
#ifndef ADCLOGGERDATATRANSFER_H
#define ADCLOGGERDATATRANSFER_H
#include "model/hardware/core/register/Register.h"
#include "model/hardware/core/register/RegUtils.h"
#undef BAR
#define TRANSFER_START_MASK 0x00000001
#define TRANSFER_STOP_MASK 0x00000002
#define ADC_CHANNEL_NO 0x00003F00
#define BAR 0U
#define OFFSET 0x500008
class AdcLoggerDataTransfer : public Register
{
public:
Field* transferStart;
Field* transferStop;
Field* adcChannelNo;
AdcLoggerDataTransfer(SonoDevice* device, quint32 offset) : Register(BAR, OFFSET + offset, device)
{
ADD_UNSIGNED_FIELD(transferStart, TRANSFER_START_MASK);
ADD_UNSIGNED_FIELD(transferStop, TRANSFER_STOP_MASK );
ADD_UNSIGNED_FIELD(adcChannelNo, ADC_CHANNEL_NO );
}
};
#undef TRANSFER_START_MASK
#undef TRANSFER_STOP_MASK
#undef ADC_CHANNEL_NO
#undef BAR
#undef OFFSET
#endif // ADCLOGGERDATATRANSFER_H

43
include/model/hardware/core/register/debug/registerDefinition/AdcLoggerStatus.h

@ -0,0 +1,43 @@
#ifndef ADCLOGGERSTATUS_H
#define ADCLOGGERSTATUS_H
#include "model/hardware/core/register/Register.h"
#include "model/hardware/core/register/RegUtils.h"
#undef BAR
#define CAP_DONE 0x00000001
#define CAP_SYNC_OFFSET_MASK 0x00000070
#define TRANSFER_DONE_MASK 0x00000100
#define FPGA_NO_MASK 0xC0000000
#define BAR 0U
#define OFFSET 0x500028
class AdcLoggerStatus : public Register
{
public:
Field* capDone;
Field* capSyncOffset;
Field* transferDone;
Field* fpgaNo;
AdcLoggerStatus(SonoDevice* device, quint32 offset) : Register(BAR, OFFSET + offset, device)
{
ADD_UNSIGNED_FIELD(capDone, CAP_DONE );
ADD_UNSIGNED_FIELD(capSyncOffset, CAP_SYNC_OFFSET_MASK);
ADD_UNSIGNED_FIELD(transferDone, TRANSFER_DONE_MASK );
ADD_UNSIGNED_FIELD(fpgaNo, FPGA_NO_MASK );
}
};
#undef CAP_DONE
#undef CAP_SYNC_OFFSET_MASK
#undef TRANSFER_DONE_MASK
#undef FPGA_NO_MASK
#undef BAR
#undef OFFSET
#endif // ADCLOGGERSTATUS_H

42
include/model/hardware/core/register/debug/registerDefinition/DebuggerMode.h

@ -0,0 +1,42 @@
#ifndef DEBUGGERMODE_H
#define DEBUGGERMODE_H
#include "model/hardware/core/register/Register.h"
#include "model/hardware/core/register/RegUtils.h"
#undef BAR
#define RX_BF_DBG_MODE_EN_MASK 0x00000001
#define RX_BF_SIM_DATA_GEN_MODE_EN_MASK 0x00000002
#define TX_BF_TEST_MODE_EN_MASK 0x00000004
#define TX_BF_TEST_MODE_CFG_MASK 0x00000008
#define BAR 0U
#define OFFSET 0x500000
class DebuggerMode : public Register
{
public:
Field* rxBfDbgModeEn;
Field* rxBfSimDataGenModeEn;
Field* txBfTestModeEn;
Field* txBfTestModeCfg;
DebuggerMode(SonoDevice* device, quint32 offset) : Register(BAR, OFFSET + offset, device)
{
ADD_UNSIGNED_FIELD(rxBfDbgModeEn, RX_BF_DBG_MODE_EN_MASK );
ADD_UNSIGNED_FIELD(rxBfSimDataGenModeEn, RX_BF_SIM_DATA_GEN_MODE_EN_MASK);
ADD_UNSIGNED_FIELD(txBfTestModeEn, TX_BF_TEST_MODE_EN_MASK );
ADD_UNSIGNED_FIELD(txBfTestModeCfg, TX_BF_TEST_MODE_CFG_MASK );
}
};
#undef RX_BF_DBG_MODE_EN_MASK
#undef RX_BF_SIM_DATA_GEN_MODE_EN_MASK
#undef TX_BF_TEST_MODE_EN_MASK
#undef TX_BF_TEST_MODE_CFG_MASK
#undef BAR
#undef OFFSET
#endif // DEBUGGERMODE_H

3
include/model/hardware/core/register/dsp/Dsp.h

@ -9,6 +9,7 @@
#include "registerDefinition/ManualAtgc.h"
#include "registerDefinition/DtgcLut.h"
#include "registerDefinition/AtgcLut.h"
#include "registerDefinition/BfScale.h"
#include "registerDefinition/LpfLut.h"
#define BLEND_WEIGHT_OFFSET 0x800
@ -32,6 +33,7 @@ private:
ManualAtgc* _manualAtgc;
DtgcLut* _dtgcLut;
AtgcLut* _atgcLut;
BfScale* _bfScale;
LpfLut* _lpfLut;
public:
@ -40,6 +42,7 @@ public:
void receiverConfigurationLut (quint8& receiverConfigTypeNumber, ReceiverConfiguration* configLut) const;
void lineFilterCoefficient (QList<quint32>& lineFilterLut) const;
void lpfScaleCoefficient (QList<quint8>& lpfScaleCoeff) const;
void stbCoefficient (QList<quint32>& stbLut) const;
void frequencyLut (QList<quint32>& freqLut) const;
void blendWeight (QList<QList<quint32>>& blendWeight) const;

43
include/model/hardware/core/register/dsp/registerDefinition/BfScale.h

@ -0,0 +1,43 @@
#ifndef BFSCALE_H
#define BFSCALE_H
#include "model/hardware/core/register/Register.h"
#include "model/hardware/core/register/RegUtils.h"
#undef BAR
#define BF_COEFF1_MASK 0x000000FF
#define BF_COEFF2_MASK 0x0000FF00
#define BF_COEFF3_MASK 0x00FF0000
#define BF_COEFF4_MASK 0xFF000000
#define BAR 0
#define OFFSET 0x86018
class BfScale : public Register
{
public:
Field* bfCoeff1;
Field* bfCoeff2;
Field* bfCoeff3;
Field* bfCoeff4;
BfScale(SonoDevice* device) : Register(BAR, OFFSET, device)
{
ADD_UNSIGNED_FIELD(bfCoeff1, BF_COEFF1_MASK);
ADD_UNSIGNED_FIELD(bfCoeff2, BF_COEFF2_MASK);
ADD_UNSIGNED_FIELD(bfCoeff3, BF_COEFF3_MASK);
ADD_UNSIGNED_FIELD(bfCoeff4, BF_COEFF4_MASK);
}
};
#undef BF_COEFF1_MASK
#undef BF_COEFF2_MASK
#undef BF_COEFF3_MASK
#undef BF_COEFF4_MASK
#undef BAR
#undef OFFSET
#undef LENGTH
#endif // BFSCALE_H

2
include/model/hardware/core/register/dsp/registerDefinition/ManualAtgc.h

@ -11,7 +11,7 @@
#define USER_MODE_ENABLE_MASK 0x00002000
#define BAR 0U
#define OFFSET 0X86018
#define OFFSET 0X8601C
class ManualAtgc : public Register
{

25
include/model/hardware/core/register/misc/Misc.h

@ -1,9 +1,12 @@
#ifndef MISC_H
#define MISC_H
#include "registerDefinition/AdcSamplerControl.h"
#include "registerDefinition/AdcSamplerStatus.h"
#include "registerDefinition/FrameLostCount.h"
#include "registerDefinition/StatusVector.h"
#include "registerDefinition/FpgaVersion.h"
#include "registerDefinition/AdcDataBram.h"
#include "registerDefinition/GtSendMode.h"
#include "registerDefinition/SyncMode.h"
@ -40,16 +43,16 @@ struct FpgaCodeVersion
enum eGtSendCtrl : quint8
{
BfMode = 1,
AdcMode,
DbgMode,
bfMode = 1,
adcMode,
dbgMode
};
enum eSyncCtrl : quint8
{
BfSyncMode,
AdcSyncMode,
BfAdcLogMode,
bfSyncMode,
adcSyncMode,
bfAdcLogMode
};
class Misc
@ -69,6 +72,10 @@ private:
SyncMode* _sync;
FrameLostCount* _lostCount;
AdcSamplerControl* _adcSamplerControl;
AdcSamplerStatus* _adcSamplerStatus;
AdcDataBram* _adcDataBram;
template<class T>
quint32 getVersion (T* version) const;
@ -83,6 +90,12 @@ public:
void setManualSync (bool sync) const;
quint32 getFrameLostCount(void) const;
void setAdcSamplerCmd (bool start) const;
void setAdcSamplerFpgaSel (quint8 fpgaSel) const;
bool getAdcSamplerBramReady (void) const;
bool getAdcSamplerError (void) const;
void getAdcDataBram (QList<qint16>* adcData) const;
};

38
include/model/hardware/core/register/misc/registerDefinition/AdcDataBram.h

@ -0,0 +1,38 @@
#ifndef ADCDATABRAM_H
#define ADCDATABRAM_H
#include "model/hardware/core/register/Register.h"
#include "model/hardware/core/register/RegUtils.h"
#undef BAR
#define ADC_DATA_MASK 0x00003FFF
#define BAR 0
#define OFFSET 0x2000
#define LENGTH 2048U
class AdcDataBram : public Register
{
public:
Field* adcData;
QList<qint16> adcDataList;
void receiveData() override
{
adcDataList.push_back(static_cast<qint16>(this->adcData->getValue()));
}
AdcDataBram(SonoDevice* device) : Register(BAR, OFFSET, device, LENGTH)
{
ADD_SIGNED_FIELD(adcData, ADC_DATA_MASK);
}
};
#undef ADC_DATA_MASK
#undef BAR
#undef OFFSET
#undef LENGTH
#endif // ADCDATABRAM_H

34
include/model/hardware/core/register/misc/registerDefinition/AdcSamplerControl.h

@ -0,0 +1,34 @@
#ifndef ADCSAMPLERCONTROL_H
#define ADCSAMPLERCONTROL_H
#include "model/hardware/core/register/Register.h"
#include "model/hardware/core/register/RegUtils.h"
#undef BAR
#define START_MASK 0x00000001
#define FPGA_SLAVE_SEL_MASK 0x00000006
#define BAR 0U
#define OFFSET 0x1000
class AdcSamplerControl : public Register
{
public:
Field* start;
Field* fpgaSlaveSel;
AdcSamplerControl(SonoDevice* device) : Register(BAR, OFFSET, device)
{
ADD_UNSIGNED_FIELD(start, START_MASK );
ADD_UNSIGNED_FIELD(fpgaSlaveSel, FPGA_SLAVE_SEL_MASK);
}
};
#undef START_MASK
#undef FPGA_SLAVE_SEL_MASK
#undef BAR
#undef OFFSET
#endif // ADCSAMPLERCONTROL_H

35
include/model/hardware/core/register/misc/registerDefinition/AdcSamplerStatus.h

@ -0,0 +1,35 @@
#ifndef ADCSAMPLERSTATUS_H
#define ADCSAMPLERSTATUS_H
#include "model/hardware/core/register/Register.h"
#include "model/hardware/core/register/RegUtils.h"
#undef BAR
#define BRAM_READY_MASK 0x00000001
#define ERROR_MASK 0x00000002
#define BAR 0U
#define OFFSET 0x1004
class AdcSamplerStatus : public Register
{
public:
Field* bramReady;
Field* error;
AdcSamplerStatus(SonoDevice* device) : Register(BAR, OFFSET, device)
{
ADD_UNSIGNED_FIELD(bramReady, BRAM_READY_MASK);
ADD_UNSIGNED_FIELD(error, ERROR_MASK);
}
};
#undef BRAM_READY_MASK
#undef ERROR_MASK
#undef BAR
#undef OFFSET
#endif // ADCSAMPLERSTATUS_H

2
include/model/hardware/core/register/misc/registerDefinition/FrameLostCount.h

@ -9,7 +9,7 @@
#define LOST_COUNT 0x000000FF
#define BAR 0U
#define OFFSET 0x86024
#define OFFSET 0x86028
class FrameLostCount : public Register
{

8
include/model/hardware/core/register/sram/registerDefinition/RxParams.h

@ -8,10 +8,10 @@
#undef BAR
#define RX_ACTIVE_ELEMENT_STEP_MASK 0x00000000000000FF
#define INTERCEPT_POINT_FIRING_TIME_MASK 0x00000000000FFF00
#define RX_FOCUS_POINT_NUMBER_MASK 0x00000001FFF00000
#define R0_POSITION_MASK 0x0003FFFE00000000
#define RX_ACTIVE_ELEMENT_STEP_MASK 0x00000000000000FF
#define INTERCEPT_POINT_FIRING_TIME_MASK 0x00000000001FFF00
#define RX_FOCUS_POINT_NUMBER_MASK 0x00000003FFE00000
#define R0_POSITION_MASK 0x0007FFFC00000000
#define BAR 1U
#define OFFSET 0x100010

1082
mainwindow.cpp

File diff suppressed because it is too large

145
mainwindow.h

@ -30,12 +30,13 @@
#define MESSAGE_BOX(M) \
emit showMessage(M)
#define SCENARIO_FILE_PATH "scenarioFilePath"
#define ADC_SIM_FILE_PATH "adcSimFilePath"
#define PARAM_FILE_PATH "paramFilePath"
#define TX_DAC_FILE_PATH "txDacFilePath"
#define FPGA_FILE_PATH "fpgaFilePath"
#define REG_ACCESS_SEL "regAccessType"
#define SCENARIO_FILE_PATH "scenarioFilePath"
#define BITE_FILE_PATH "biteFilePath"
#define ADC_SIM_FILE_PATH "adcSimFilePath"
#define PARAM_FILE_PATH "paramFilePath"
#define TX_DAC_FILE_PATH "txDacFilePath"
#define FPGA_FILE_PATH "fpgaFilePath"
#define REG_ACCESS_SEL "regAccessType"
#define START "Start"
@ -62,8 +63,6 @@
#define TRANSFER_RATE 30.0f
#define RAM_BUFFER_OFFSET 0U
#define ULTIMATE_LOG_COUNT 50
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE
@ -94,6 +93,10 @@ private:
QCPColorMap *_colorMap;
QFutureWatcher<void> biteLogWatcher;
QFutureWatcher<void> dmaLogWatcher;
static QThread* _uiThread;
QTimer* _timeout;
@ -132,9 +135,7 @@ private:
void setAfeConfig (void);
void fillRam(QString path);
void logPcie();
void logPcie(QString logPath, quint32 logCount);
void continuousFrameRepresent(void);
@ -150,12 +151,19 @@ private:
void gifActive(void);
QString _logFolder = "/home/hasis/Desktop/TrxBoardFile/_log/dma/";
QString _emulFolder = "/home/hasis/Desktop/Develop_HardwareTest/developHw/sram_frame.bin";
void biteLogThreadFinished();
void dmaLogThreadFinished();
void dmaLogLayoutVisible(bool show);
QString _biteLogFolder = "/home/hasis/Desktop/TrxBoardFile/_log/BITe/";
QString _dmaLogFolder = "/home/hasis/Desktop/TrxBoardFile/_log/dma/";
QString _emulFolder = "/home/hasis/Desktop/TrxBoardFile/emulator/";
QVector<QByteArray> _dmaBuffer;
QByteArray _lastBuffer;
qint32 _dmaLogCount;
quint32 _dmaLogCount;
quint16 _frameCount;
quint16 _batchIdBuff;
double_t fps;
@ -166,10 +174,6 @@ private:
bool _getPacket;
bool _fpsFlag;
// QString _adcloggerFolder = "/home/hasis/Desktop/TrxBoardFile/_log/adc/";
// bool _csvReadStopFlag = false;
// bool _adcLoggerDone = false;
// bool _adcLoggerTrnsDone = false;
// uncrustify off
private slots:
@ -203,109 +207,22 @@ private slots:
void on_btn_writeReg_clicked();
// void newBlockProgressValue(int percentage, QProgressBar* prg);
// void newFpgaProgressValue(int percentage);
// void newBlockProgressVisibility(bool show, QProgressBar* prg);
// void newFpgaProgressVisibility(bool show);
void on_btn_fpgaBrowse_clicked();
void on_btn_fpgaProgram_clicked();
void newMessage(QString message);
// void on_btn_scenarioBrowse_clicked();
// void on_btn_scenarioVerify_clicked();
// void on_btn_ParamBrowse_clicked();
// void on_btn_scenarioUpload_clicked();
// void on_btn_scenarioStartStop_clicked();
// void on_btn_scenarioPauseResume_clicked();
// void on_btn_txDacBrowse_clicked();
// void on_btn_txDacUpload_clicked();
// void on_btn_txDacStartStop_clicked();
// void on_btn_txDacOnOff_clicked();
void on_cb_selectedProbe_currentIndexChanged(int index);
// void on_btn_pllClkSt_clicked();
// void on_btn_pllClkTps_clicked();
// void on_btn_mulDacTrig_clicked();
// void on_pushButton_3_clicked();
// void on_btn_hvRegulatorConfig_clicked();
// void on_btn_pm5RegulatorConfig_clicked();
// void on_btn_DacsOnOff_clicked();
void on_btn_updateRdbackValue_clicked();
void on_btn_supJump_clicked();
void on_btn_setAo_clicked();
// void on_chk_usrMulDac_stateChanged(int arg1);
// void on_btn_afeProg_clicked();
// void on_btn_gtReg_clicked();
// void on_btn_browse_clicked();
// void on_btn_dbgTransferStrt_clicked();
// void on_btn_adcLoggerStrt_clicked();
// void on_prg_adcLoggerFileWr_valueChanged(int value);
// void on_btn_adcSimBrowse_clicked();
// void on_btn_adcSimStart_clicked();
// void on_btn_adcLoggerAutoCount_clicked();
// void on_btn_scenRead_clicked();
void on_btn_getFpgaVersion_clicked();
// void on_btn_txTrig_clicked();
// void adcLoggerStatusCheck();
// void binFileUploader(quint32 bar, quint32 offset, QString path, QProgressBar* prg);
// void binAdcFileUploader(quint32 bar, QString path, QProgressBar* prg);
// void CsvFileUploader(quint32 bar, QString path, QProgressBar *prg);
// void CsvFileChecker(quint32 bar, QString pathBase, QString pathTarget, QProgressBar* prg);
// void AdcLogCsvFileWriter(QString folderPath, QProgressBar* prg);
// void scenarioFileVerifier(quint32 bar, quint32 offset, QString path);
//
// quint64 byteArrayTo64LittleEndian(QByteArray data);
// quint32 byteArrayTo32LittleEndian(QByteArray data);
// quint32 byteArrayTo32BigEndian(QByteArray data);
//
// void scenarioStart();
// void scenarioStop();
// bool checkTermalShutdown(quint8 value);
void on_btn_setAtgcMode_clicked();
void on_btn_scenStart_clicked();
@ -314,10 +231,6 @@ private slots:
void on_btn_dmaShow_clicked();
void on_btn_emulBrowse_clicked();
void on_btn_logBrowse_clicked();
void on_btn_dmaLogLast_clicked();
void on_btn_afeRead_clicked();
@ -328,7 +241,7 @@ private slots:
void show2d();
void catchLogCount(qint32 counter, QProgressDialog* _progress);
void catchLogCount(quint32 counter, quint32 logRange, QProgressDialog* _progress);
void on_chk_mpsInit_clicked();
@ -370,17 +283,17 @@ private slots:
void on_btn_scenInfo_clicked();
signals:
// void updateBlockProgressValue(int percentage, QProgressBar* prg);
// void updateFpgaProgressValue(int percentage);
void on_btn_setBiteLog_clicked();
void on_btn_biteBrowse_clicked();
// void updateBlockProgressVisibility(bool show, QProgressBar* prg);
// void updateFpgaProgressVisibility(bool show);
void on_btn_setAdcLog_clicked();
signals:
void showMessage(QString message);
void threeDReady();
void twoDReady();
void sendLogCount(qint32 counter, QProgressDialog* _progress);
void sendLogCount(quint32 counter, quint32 logRange, QProgressDialog* _progress);
void connectedPrbChange();
void frameLostCall();
void labelState(QLabel* label, QString str, QColor color);

1520
mainwindow.ui

File diff suppressed because it is too large

265
src/model/hardware/core/TrxBoard.cpp

@ -106,10 +106,10 @@ void TrxBoard::afeAdcsSync() const
this->_bCtrlMngt->timerShot(20);
while(!(this->_bCtrlMngt->checkTimeout()));
this->_misc->setSyncMode(AdcSyncMode);
this->_misc->setSyncMode(adcSyncMode);
this->_misc->setManualSync(true);
this->_misc->setManualSync(false);
this->_misc->setManualSync(BfSyncMode);
this->_misc->setManualSync(bfSyncMode);
this->_bCtrlMngt->timerShot(1);
while(!((this->_afeSlave0->getAfeSyncDone()) &&
@ -134,6 +134,54 @@ void TrxBoard::afeAdcsSync() const
}
}
void TrxBoard::adcLogTransferRoutine(Debug *_dbg, quint8 chNumPerFpga)
{
bool adcSamplerReady (false);
bool adcSamplerError (false);
// Adc logger start according to selected afe channel
_dbg->adcLoggerTransferCmd(loggerStop);
_dbg->adcLoggerChannelNum(chNumPerFpga);
_dbg->adcLoggerTransferCmd(loggerStart);
// Timeout to receive adc log transfer done.
this->_bCtrlMngt->timerShot(20);
while (!(_dbg->getTransferDone()))
{
if(this->_bCtrlMngt->checkTimeout())
throw SonoException("Failure to receive adc log transfer done.");
}
this->_bCtrlMngt->timerStop();
// Timeout to receive adc sampler done.
this->_bCtrlMngt->timerShot(20);
while (!adcSamplerReady && !adcSamplerError)
{
adcSamplerReady = this->_misc->getAdcSamplerBramReady();
adcSamplerError = this->_misc->getAdcSamplerError();
if(this->_bCtrlMngt->checkTimeout())
throw SonoException("Failure to receive adc sampler done.");
}
this->_bCtrlMngt->timerStop();
if (adcSamplerError)
throw SonoException("The adc sampler error is occured.");
// Adc logger stop
_dbg->adcLoggerTransferCmd(loggerStop);
}
void TrxBoard::debuggerMode(Debug* _dbg, DebugMode& debug, DebugMode& debugRb, QString slaveN) const
{
_dbg->setDebuggerMode(debug);
_dbg->getDebuggerMode(debugRb);
if ((debugRb.txBfTestModeEn != debug.txBfTestModeEn ) || (debugRb.txBfTestModeCfg != debug.txBfTestModeCfg ))
throw ("The debugger mode register configuration of " + slaveN + " is corrupted.");
}
void TrxBoard::setSwapVector()
{
_swapVec.clear();
@ -195,13 +243,17 @@ TrxBoard::TrxBoard() : _offsetSlave0(0), _offsetSlave1(0x400000), _offsetSlave2(
_beamFormerSlave0 = new BeamFormer(&_device, _offsetSlave0);
_beamFormerSlave1 = new BeamFormer(&_device, _offsetSlave1);
_beamFormerSlave2 = new BeamFormer(&_device, _offsetSlave2);
_clkDistributer = new ClockDistributer(&_device);
_debugSlave0 = new Debug(&_device, _offsetSlave0);
_debugSlave1 = new Debug(&_device, _offsetSlave1);
_debugSlave2 = new Debug(&_device, _offsetSlave2);
_clkDistributer = new ClockDistributer(&_device);
_afeSlave0 = new Afe(&_device, _offsetSlave0);
_afeSlave1 = new Afe(&_device, _offsetSlave1);
_afeSlave2 = new Afe(&_device, _offsetSlave2);
_bCtrlMngt = new BoardsCtrlMngt(&_device);
_builtInTest = new BuiltInTest(&_device);
_fpgaProgram = new FpgaProgram(&_device);
_scenPlayer = new ScenPalyer(&_device);
_bCtrlMngt = new BoardsCtrlMngt(&_device);
_bpiFlash = new BpiFlash(&_device);
_emul = new Emulator(&_device);
_misc = new Misc(&_device);
@ -241,9 +293,16 @@ TrxBoard::~TrxBoard()
delete _beamFormerSlave0;
delete _beamFormerSlave1;
delete _beamFormerSlave2;
delete _clkDistributer;
delete _fpgaProgram;
delete _scenPlayer;
delete _clkDistributer;
delete _debugSlave0;
delete _debugSlave1;
delete _debugSlave2;
delete _fpgaProgram;
delete _builtInTest;
delete _scenPlayer;
delete _afeSlave0;
delete _afeSlave1;
delete _afeSlave2;
delete _bCtrlMngt;
delete _bpiFlash;
delete _emul;
@ -345,6 +404,12 @@ void TrxBoard::setProbeDependParams(ScenPrbDepHardwareParam& prbDepParams)
}
this->_dsp->lpfLut(lpfLutQ);
if(prbDepParams.prbDepParams.lpfScaleCoeff.size() != LPF_SCALE_MAX)
{
throw SonoException("Lpf scale coefficient is out of range");
}
this->_dsp->lpfScaleCoefficient(prbDepParams.prbDepParams.lpfScaleCoeff);
/////////////////////////// AFE setting ///////////////////////////
this->_afeSlave0->setAfeParams(prbDepParams.afeCfg);
this->_afeSlave1->setAfeParams(prbDepParams.afeCfg);
@ -728,6 +793,47 @@ void TrxBoard::setFramesMetaData(const QByteArray& metaData) const
this->_sram->setSramMetaData(data);
}
void TrxBoard::setBiteDacData(const QByteArray &iData, const QByteArray &qData) const
{
this->_builtInTest->biteDacMemoryWrite(iData, qData);
}
void TrxBoard::biteScenPlayerStart()
{
DebugMode debug;
DebugMode debugRb;
debug.rxBfDbgModeEn = false;
debug.rxBfSimDataGenModeEn = false;
debug.txBfTestModeEn = true;
debug.txBfTestModeCfg = pulserTr;
this->debuggerMode(_debugSlave0, debug, debugRb, "slave0");
this->debuggerMode(_debugSlave1, debug, debugRb, "slave1");
this->debuggerMode(_debugSlave2, debug, debugRb, "slave2");
this->_builtInTest->biteAdgCfg(adgIQ);
this->_builtInTest->biteDacEnable(BITE_INTERVAL, true);
this->scenPlayerStart(true);
}
void TrxBoard::biteScenPlayerStop()
{
DebugMode debug;
DebugMode debugRb;
debug.rxBfDbgModeEn = false;
debug.rxBfSimDataGenModeEn = false;
debug.txBfTestModeEn = false;
debug.txBfTestModeCfg = pulserHz;
this->scenPlayerStop(true);
this->_builtInTest->biteDacEnable(BITE_INTERVAL, false);
this->_builtInTest->biteAdgCfg(adgGnd);
this->debuggerMode(_debugSlave0, debug, debugRb, "slave0");
this->debuggerMode(_debugSlave1, debug, debugRb, "slave1");
this->debuggerMode(_debugSlave2, debug, debugRb, "slave2");
}
void TrxBoard::setScenarioCompare(const QString scenPath)
{
/******************* Create SRAM Binary File *******************/
@ -939,9 +1045,9 @@ void TrxBoard::scenPlayerStart(bool afeHvPwrOn)
this->_beamFormerSlave1->regValid(true);
this->_beamFormerSlave2->regValid(true);
this->_misc->setGtSendMode(BfMode);
this->_misc->setGtSendMode(bfMode);
this->_misc->setSyncMode(BfSyncMode);
this->_misc->setSyncMode(bfSyncMode);
this->_emul->setEmulatorDis();
@ -1471,7 +1577,8 @@ void TrxBoard::mcsProgram(QString path)
void TrxBoard::mcsVerify(QString path) const
{
QFile mcsFile(path);
QList<quint32> mcsList;
QFile mcsFile(path + ".bin");
if(mcsFile.fileName().isEmpty())
{
@ -1485,12 +1592,11 @@ void TrxBoard::mcsVerify(QString path) const
QTextStream save(&mcsFile);
(*_mcsList).clear();
this->_bpiFlash->readMcs(_mcsList);
this->_bpiFlash->readMcs(&mcsList);
for(auto i = 0; i < MCS_FILE_SIZE; i++)
{
save << (*_mcsList).at(i);
save << (mcsList).at(i);
}
mcsFile.flush();
mcsFile.close();
@ -1517,3 +1623,136 @@ quint32 TrxBoard::getFrameLostCounter() const
{
return (this->_misc->getFrameLostCount());
}
void TrxBoard::adcCaptureStart(captureConfig &capCfg, eSyncMode syncMode)
{
// ADC capture reset
this->_debugSlave0->adcLoggerRst(true);
this->_debugSlave1->adcLoggerRst(true);
this->_debugSlave2->adcLoggerRst(true);
this->_debugSlave0->adcLoggerRst(false);
this->_debugSlave1->adcLoggerRst(false);
this->_debugSlave2->adcLoggerRst(false);
// ADC capture config
this->_debugSlave0->adcLoggerConfig(capCfg);
this->_debugSlave1->adcLoggerConfig(capCfg);
this->_debugSlave2->adcLoggerConfig(capCfg);
// Sync mode config in case of the manual sync is selected
if (syncMode == manualSync)
{
this->_misc->setSyncMode(bfAdcLogMode);
this->_misc->setManualSync(true);
this->_misc->setManualSync(false);
this->_misc->setSyncMode(bfSyncMode);
}
// ADC capture enable
this->_debugSlave0->adcCaptureCmd(captureStart);
}
void TrxBoard::adcLoggerStart(const QString path)
{
// // Timeout to receive adc capture done.
// this->_bCtrlMngt->timerShot(100);
// while (!(_dbg->getCapDone()))
// {
// if(this->_bCtrlMngt->checkTimeout())
// throw SonoException("Failure to receive adc capture done.");
// }
// this->_bCtrlMngt->timerStop();
//this->_debugSlave0->adcCaptureCmd(captureStop);
quint8 fpgaSel(0);
quint8 chNumPerFpga(0);
QList<qint16> adcDataList;
QTime t = QTime::currentTime();
QString logPath = path + "/adcLog_" + QString("%1_%2_%3.csv")
.arg(t.hour())
.arg(t.minute())
.arg(t.second());
QFile logFile(logPath);
QTextStream log(&logFile);
if(logFile.fileName().isEmpty())
{
throw SonoException("No file is selected");
}
if(!logFile.open(QIODevice::WriteOnly))
{
throw SonoException("Couldn't open file for logging");
}
log << "SYNC Offset(ns): ";
log << this->_debugSlave0->getCapSyncOffset() * 5 << ',';
log << this->_debugSlave1->getCapSyncOffset() * 5 << ',';
log << this->_debugSlave2->getCapSyncOffset() * 5 << ',';
log << endl;
log << "ADC Sample Latancy(ns): ";
log << this->_afeSlave0->getAdcLatency() * 2.5f << ',';
log << this->_afeSlave1->getAdcLatency() * 2.5f << ',';
log << this->_afeSlave2->getAdcLatency() * 2.5f << ',';
log << endl;
log << "ADC Sample Logger Offset(sample): ";
log << this->_debugSlave0->getCaptureSampleNo() << ',';
log << this->_debugSlave1->getCaptureSampleNo() << ',';
log << this->_debugSlave2->getCaptureSampleNo() << ',';
log << endl;
// Set gt to adc mode
this->_misc->setGtSendMode(adcMode);
// Stop adc log transfer
this->_debugSlave0->adcLoggerTransferCmd(loggerStop);
this->_debugSlave1->adcLoggerTransferCmd(loggerStop);
this->_debugSlave2->adcLoggerTransferCmd(loggerStop);
for (quint8 chNum = 0; chNum < TOTAL_AFE_CHANNEL_NUM; chNum++)
{
fpgaSel = chNum / AFE_CHANNEL_NUM_PER_SLAVE;
chNumPerFpga = chNum % AFE_CHANNEL_NUM_PER_SLAVE;
// ADC sampler start according to selected fpga
this->_misc->setAdcSamplerCmd(samplerStop);
this->_misc->setAdcSamplerFpgaSel(fpgaSel);
this->_misc->setAdcSamplerCmd(samplerStart);
switch (fpgaSel)
{
case 0:
this->adcLogTransferRoutine (_debugSlave0, chNumPerFpga);
break;
case 1:
this->adcLogTransferRoutine (_debugSlave1, chNumPerFpga);
break;
case 2:
this->adcLogTransferRoutine (_debugSlave2, chNumPerFpga);
break;
}
// Read adc data bram
this->_misc->getAdcDataBram(&adcDataList);
foreach (auto data, adcDataList)
{
log << data << ',';
}
log << endl;
// ADC sampler stop
this->_misc->setAdcSamplerCmd(samplerStop);
}
logFile.flush();
logFile.close();
// Set gt to beamformer mode
this->_misc->setGtSendMode(bfMode);
}

23
src/model/hardware/core/register/Field.cpp

@ -161,13 +161,22 @@ void Field::updateValue(quint32 value)
{
value = value >> _position;
value &= _zeroBasedMask;
auto signBit = ((value >> (_length - 1)) & 0x01) == 0x01;
if(_isSigned && signBit)
{
value |= ~_zeroBasedMask;
}
_value = value;
// auto signBit = ((value >> (_length - 1)) & 0x01) == 0x01;
// if(_isSigned && signBit)
// {
// value |= ~_zeroBasedMask;
// }
// _value = value;
/*** signed extension ***/
if (_isSigned)
{
quint32 temp(1U);
temp <<= (_length - 1);
_value = (value ^ temp) - temp;
}
else
_value = value;
}
/*************************************************************************************************/

2
src/model/hardware/core/register/Register.cpp

@ -88,7 +88,7 @@ void Register::updateLong()
}
/*************************************************************************************************/
void Register::updateArray(bool isVariable, quint8 arrayLength) //update array register
void Register::updateArray(bool isVariable, quint16 arrayLength) //update array register
{
quint32 value;

8
src/model/hardware/core/register/afe/Afe.cpp

@ -52,6 +52,7 @@ void Afe::setPga(const AfeConfig afe) const
Afe::Afe(SonoDevice *device, quint32 offset)
{
_adcSync = new AdcSyncStatus (device, offset);
_adcLatency = new AdcLatency (device, offset);
_actTerm = new ActiveTerm (device, offset);
_lnaHpf = new LnaHpf (device, offset);
_global = new Global (device, offset);
@ -61,6 +62,7 @@ Afe::Afe(SonoDevice *device, quint32 offset)
Afe::~Afe()
{
delete _adcLatency;
delete _adcSync;
delete _actTerm;
delete _lnaHpf;
@ -91,6 +93,12 @@ void Afe::setReadRegEnable(const bool rdEn) const
this->_global->update();
}
quint32 Afe::getAdcLatency() const
{
this->_adcLatency->sync();
return (this->_adcLatency->sampleLatency->getValue());
}
bool Afe::getAfeSyncDone() const
{
this->_adcSync->sync();

48
src/model/hardware/core/register/builtInTest/BuiltInTest.cpp

@ -1,6 +1,6 @@
#include "model/hardware/core/register/builtInTest/BuiltInTest.h"
void BuiltInTest::setDacOutputSelect(BuiltInTest::BiteOutputSelect* _outputSelect) const
void BuiltInTest::setDacOutputSelect(BiteOutputSelect* _outputSelect) const
{
quint32 value;
value = (_outputSelect->dacIN) ? 1 : 0;
@ -18,7 +18,7 @@ void BuiltInTest::setDacOutputSelect(BuiltInTest::BiteOutputSelect* _outputSelec
_dacOutput->update();
}
void BuiltInTest::setDacMemoryCmd(BuiltInTest::BiteMemoryCmd *_memoryCmd) const
void BuiltInTest::setDacMemoryCmd(BiteMemoryCmd *_memoryCmd) const
{
quint32 cmdValue = (_memoryCmd->command) ? 1 : 0;
_dacCmd->startStop->setValue(cmdValue);
@ -33,8 +33,8 @@ BuiltInTest::BuiltInTest(SonoDevice *device)
_dacMemory = new BiteDacMemory (device);
_dacCmd = new BiteDacMemoryCmd (device);
_dacOutput = new BiteDacOutputSelect (device);
_dacOutputSelect = new BiteOutputSelect();
_dacMemoryCmd = new BiteMemoryCmd();
_dacOutputSelect = new BiteOutputSelect;
_dacMemoryCmd = new BiteMemoryCmd;
}
BuiltInTest::~BuiltInTest()
@ -46,16 +46,33 @@ BuiltInTest::~BuiltInTest()
delete _dacMemoryCmd;
}
void BuiltInTest::biteDacMemoryWrite(TxDacMemory* txDacMem) const
void BuiltInTest::biteDacMemoryWrite(const QByteArray& iData, const QByteArray& qData) const
{
this->_dacMemory->setTxDacMemory(txDacMem);
this->_dacMemory->updateArray();
this->_dacMemory->setTxDacMemory(iData, qData);
if (iData.size() != qData.size())
throw SonoException ("Unmatching The size of txDacI & txDacQ is happened.");
this->_dacMemory->updateArray(true, static_cast<quint16>(iData.size()));
}
void BuiltInTest::biteDacEnable(quint8 biteInterval, bool cmd) const
{
this->_dacMemoryCmd->interval = biteInterval;
auto memoryCommand = [this](BiteMemoryCmd*, bool active)
{
this->_dacMemoryCmd->command = active;
};
if (cmd)
memoryCommand(_dacMemoryCmd, true);
else
memoryCommand(_dacMemoryCmd, false);
this->setDacMemoryCmd(_dacMemoryCmd);
}
void BuiltInTest::biteAdgCfg(eBiteDacOutput adg) const
{
auto outputSelect = [this](BiteOutputSelect*, bool active)
{
this->_dacOutputSelect->dacIN = active;
@ -64,22 +81,11 @@ void BuiltInTest::biteDacEnable(quint8 biteInterval, bool cmd) const
this->_dacOutputSelect->dacQP = active;
};
auto memoryCommand = [this](BiteMemoryCmd*, bool active)
{
this->_dacMemoryCmd->command = active;
};
if (cmd)
{
if (adg == adgIQ)
outputSelect(_dacOutputSelect, true);
memoryCommand(_dacMemoryCmd, true);
}
else
{
memoryCommand(_dacMemoryCmd, false);
if (adg == adgGnd)
outputSelect(_dacOutputSelect, false);
}
this->setDacOutputSelect(_dacOutputSelect);
this->setDacMemoryCmd(_dacMemoryCmd);
}

121
src/model/hardware/core/register/debug/Debug.cpp

@ -0,0 +1,121 @@
#include "model/hardware/core/register/debug/Debug.h"
Debug::Debug(SonoDevice *device, quint32 offset)
{
_adcLoggerDataTransfer = new AdcLoggerDataTransfer (device, offset);
_adcLoggerCapCmd = new AdcLoggerCapCmd (device, offset);
_adcLoggerStatus = new AdcLoggerStatus (device, offset);
_debuggerMode = new DebuggerMode (device, offset);
}
Debug::~Debug()
{
delete _adcLoggerDataTransfer;
delete _adcLoggerCapCmd;
delete _adcLoggerStatus;
delete _debuggerMode;
}
void Debug::setDebuggerMode(const DebugMode dbgMode) const
{
quint32 value(0);
value = (dbgMode.rxBfDbgModeEn) ? 1 : 0;
this->_debuggerMode->rxBfDbgModeEn->setValue(value);
value = (dbgMode.txBfTestModeEn) ? 1 : 0;
this->_debuggerMode->txBfTestModeEn->setValue(value);
value = (dbgMode.rxBfSimDataGenModeEn) ? 1 : 0;
this->_debuggerMode->rxBfSimDataGenModeEn->setValue(value);
value = (dbgMode.txBfTestModeCfg) ? 1 : 0;
this->_debuggerMode->txBfTestModeCfg->setValue(value);
this->_debuggerMode->update();
}
void Debug::getDebuggerMode(DebugMode& dbgModeRb)
{
this->_debuggerMode->sync();
dbgModeRb.txBfTestModeEn = this->_debuggerMode->txBfTestModeEn->getValue();
quint32 val = this->_debuggerMode->txBfTestModeCfg->getValue();
dbgModeRb.txBfTestModeCfg = val ? pulserTr : pulserHz;
}
void Debug::adcLoggerConfig(const captureConfig &capCfg) const
{
quint32 value(0);
value = (capCfg.capMode) ? 1 : 0;
this->_adcLoggerCapCmd->capMode->setValue(value);
value = (capCfg.manualTrig) ? 1 : 0;
this->_adcLoggerCapCmd->capMnlTrig->setValue(value);
this->_adcLoggerCapCmd->capSyncNo->setValue(capCfg.syncCount);
this->_adcLoggerCapCmd->capSampleNo->setValue(capCfg.sampleCount);
this->_adcLoggerCapCmd->update();
}
void Debug::adcLoggerRst(bool logRst) const
{
quint32 value = (logRst) ? 1 : 0;
this->_adcLoggerCapCmd->loggerRst->setValue(value);
this->_adcLoggerCapCmd->update();
}
void Debug::adcCaptureCmd(bool capEn) const
{
quint32 value = (capEn) ? 1 : 0;
this->_adcLoggerCapCmd->capEn->setValue(value);
this->_adcLoggerCapCmd->update();
}
quint32 Debug::getCaptureSampleNo() const
{
this->_adcLoggerCapCmd->sync();
return (this->_adcLoggerCapCmd->capSampleNo->getValue());
}
void Debug::adcLoggerChannelNum(quint16 chNum) const
{
this->_adcLoggerDataTransfer->adcChannelNo->setValue(chNum);
this->_adcLoggerDataTransfer->update();
}
void Debug::adcLoggerTransferCmd(bool start) const
{
if (start)
{
this->_adcLoggerDataTransfer->transferStart->setValue(1);
this->_adcLoggerDataTransfer->transferStop->setValue(0);
}
else
{
this->_adcLoggerDataTransfer->transferStart->setValue(0);
this->_adcLoggerDataTransfer->transferStop->setValue(1);
}
this->_adcLoggerDataTransfer->update();
}
bool Debug::getCapDone() const
{
this->_adcLoggerStatus->sync();
return (this->_adcLoggerStatus->capDone->getValue() != 0);
}
bool Debug::getTransferDone() const
{
this->_adcLoggerStatus->sync();
return (this->_adcLoggerStatus->transferDone->getValue() != 0);
}
quint32 Debug::getCapSyncOffset() const
{
this->_adcLoggerStatus->sync();
return this->_adcLoggerStatus->capSyncOffset->getValue();
}

11
src/model/hardware/core/register/dsp/Dsp.cpp

@ -10,6 +10,7 @@ Dsp::Dsp(SonoDevice *device)
_manualAtgc = new ManualAtgc (device);
_dtgcLut = new DtgcLut (device);
_atgcLut = new AtgcLut (device);
_bfScale = new BfScale (device);
_lpfLut = new LpfLut (device);
}
@ -23,6 +24,7 @@ Dsp::~Dsp()
delete _freqLut;
delete _dtgcLut;
delete _atgcLut;
delete _bfScale;
delete _stbLut;
delete _lpfLut;
}
@ -40,6 +42,15 @@ void Dsp::lineFilterCoefficient(QList<quint32> &lineFilterLut) const
this->_lineFilterLut->updateArray();
}
void Dsp::lpfScaleCoefficient(QList<quint8> &lpfScaleCoeff) const
{
this->_bfScale->bfCoeff1->setValue(lpfScaleCoeff.at(0));
this->_bfScale->bfCoeff2->setValue(lpfScaleCoeff.at(1));
this->_bfScale->bfCoeff3->setValue(lpfScaleCoeff.at(2));
this->_bfScale->bfCoeff4->setValue(lpfScaleCoeff.at(3));
this->_bfScale->update();
}
void Dsp::stbCoefficient(QList<quint32> &stbLut) const
{
this->_stbLut->setStbLut(stbLut);

40
src/model/hardware/core/register/misc/Misc.cpp

@ -10,6 +10,10 @@ Misc::Misc(SonoDevice *device) : _offsetMaster(0), _offsetSlave0(0x50002C), _off
_status = new StatusVector (device);
_sync = new SyncMode (device);
_gt = new GtSendMode (device);
_adcSamplerControl = new AdcSamplerControl(device);
_adcSamplerStatus = new AdcSamplerStatus (device);
_adcDataBram = new AdcDataBram (device);
}
Misc::~Misc()
@ -22,6 +26,10 @@ Misc::~Misc()
delete _status;
delete _sync;
delete _gt;
delete _adcSamplerControl;
delete _adcSamplerStatus;
delete _adcDataBram;
}
template<class T>
@ -81,6 +89,38 @@ quint32 Misc::getFrameLostCount() const
return (this->_lostCount->lostCount->getValue());
}
void Misc::setAdcSamplerCmd(bool start) const
{
quint32 value = (start) ? 1 : 0;
this->_adcSamplerControl->start->setValue(value);
this->_adcSamplerControl->update();
}
void Misc::setAdcSamplerFpgaSel(quint8 fpgaSel) const
{
this->_adcSamplerControl->fpgaSlaveSel->setValue(fpgaSel);
this->_adcSamplerControl->update();
}
bool Misc::getAdcSamplerBramReady() const
{
this->_adcSamplerStatus->sync();
return (this->_adcSamplerStatus->bramReady->getValue() != 0);
}
bool Misc::getAdcSamplerError() const
{
this->_adcSamplerStatus->sync();
return (this->_adcSamplerStatus->error->getValue() != 0);
}
void Misc::getAdcDataBram(QList<qint16> *adcDataList) const
{
this->_adcDataBram->adcDataList.clear();
this->_adcDataBram->syncArray();
adcDataList = &(this->_adcDataBram->adcDataList);
}
void Misc::getFpgaVersion(FpgaCodeVersion *version) const
{
version->masterCode = this->getVersion<FpgaVersion>(_mVersion);

Loading…
Cancel
Save