Browse Source

The XADC parameters such as FPGAs core temperature and volatages are added in health status structure.

The rpm of tacho fans are added in health status too.
The debug API is added in trxBoard and also added as debug folder which contain of .ccp & .h seperately.
The built-in test api is modified.
master v2.3
Arash Aletayeb 3 years ago
parent
commit
44275a6476
  1. 10
      developHw.pro.user
  2. 3
      hdf5Scenario/hdf5Scenario.cpp
  3. 27
      include/model/hardware/core/TrxBoard.h
  4. 2
      include/model/hardware/core/TrxBoardUtils/PreProcessorDef.h
  5. 4
      include/model/hardware/core/TrxBoardUtils/TrxBoardStructures.h
  6. 60
      include/model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.h
  7. 47
      include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/BoardsSpecs.h
  8. 30
      include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/FanTacho1.h
  9. 30
      include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/FanTacho2.h
  10. 34
      include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/FpgaXadc1.h
  11. 34
      include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/FpgaXadc2.h
  12. 2
      include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/OnBoardTempSensor.h
  13. 2
      include/model/hardware/core/register/bpiFlash/BpiFlash.h
  14. 5
      include/model/hardware/core/register/misc/Misc.h
  15. 1124
      mainwindow.cpp
  16. 62
      mainwindow.h
  17. 1305
      mainwindow.ui
  18. 476
      src/model/hardware/core/TrxBoard.cpp
  19. 101
      src/model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.cpp
  20. 4
      src/model/hardware/core/register/bpiFlash/BpiFlash.cpp
  21. 4
      src/model/hardware/core/register/misc/Misc.cpp

10
developHw.pro.user

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.10.0, 2021-07-12T11:26:49. -->
<!-- Written by QtCreator 4.10.0, 2021-07-25T09:28:30. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
@ -69,7 +69,7 @@
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/hasis/Desktop/Develop_HardwareTest/build-developHw-Desktop_Qt_5_13_1_GCC_64bit-Debug</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/hasis/Desktop/hardware/Develop_HardwareTest/build-developHw-Desktop_Qt_5_13_1_GCC_64bit-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
@ -304,8 +304,8 @@
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">developHw</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/hasis/Desktop/Develop_HardwareTest/developHw/developHw.pro</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">developHw2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/hasis/Desktop/hardware/Develop_HardwareTest/developHw/developHw.pro</value>
<value type="QString" key="RunConfiguration.Arguments"></value>
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
@ -315,7 +315,7 @@
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
<value type="QString" key="RunConfiguration.WorkingDirectory"></value>
<value type="QString" key="RunConfiguration.WorkingDirectory.default">/home/hasis/Desktop/Develop_HardwareTest/build-developHw-Desktop_Qt_5_13_1_GCC_64bit-Debug</value>
<value type="QString" key="RunConfiguration.WorkingDirectory.default">/home/hasis/Desktop/hardware/Develop_HardwareTest/build-developHw-Desktop_Qt_5_13_1_GCC_64bit-Debug</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap>

3
hdf5Scenario/hdf5Scenario.cpp

@ -4,9 +4,10 @@ template<class T>
void Hdf5::datasetBranch(const string &branchPath, T datasetValue[MAX_ARRAY_DEPTH])
{
const H5std_string datasetPath(branchPath);
DataSet datasetType = _file.openDataSet(datasetPath);
DataSet datasetType = _file.openDataSet(datasetPath);
datasetType.read(datasetValue, PredType::NATIVE_FLOAT, H5S_ALL, H5S_ALL);
datasetType.close();
}
void Hdf5::hdf5Path(const string &h5Path)

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

@ -78,6 +78,9 @@ private:
SonoDevice _device;
AdcVoltages* _adc;
VoltagesPg* _pg;
FanRpm* _tachoRpm;
criticalComponentVoltages* _coreVolt;
criticalComponentTemperature* _coreTemp;
ClockDistributer* _clkDistributer;
BeamFormer* _beamFormerSlave0;
@ -139,10 +142,10 @@ private:
~ScenGenHardwareParam();
}
* scenParams;
* _scenParams;
void fpgaProgram(const QString path) const;
void setScenario(ScenGenHardwareParam* scenParams);
void setScenario(ScenGenHardwareParam* _scenParams);
void sramClear (eSramClear clearMode);
void setSwapVector(void);
@ -152,8 +155,12 @@ private:
void scenParamsFilling(eScenParams cmd);
//QList<quint32> signedVector2unsignedList(QVector<qint32>& sgnVec);
#ifndef DEVELOP_UI
void afeAdcsSync(void) const;
#endif
void waitForCaptureDone(Debug* _dbg) const;
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;
@ -174,6 +181,8 @@ public:
#ifndef DEVELOP_UI
HardwarePacketEngine packetEngine;
#else
void afeAdcsSync(void) const;
#endif
TrxBoard();
@ -205,6 +214,8 @@ public:
void setScenarioCompare (const QString scenPath);
void setAtgcMode(eAtgcMode mode, quint16 value) const;
QList<quint32> getAfeReg(eSlaveSelect sel, quint32 afeRegAddr);
void setAdgCfg(eBiteDacOutput adg) const;
void setTxDacEnable(quint8 biteInterval, bool cmd) const;
////////////////////////////// Slave Programming API //////////////////////////
void slaveFpgaProgram(const QString path);
@ -255,8 +266,14 @@ public:
quint32 getFrameLostCounter(void) const;
////////////////////////////////// Logger API /////////////////////////////////
void adcCaptureStart(captureConfig &capCfg, eSyncMode syncMode);
void adcLoggerStart(const QString path);
void adcCaptureConfig(captureConfig &capCfg) const;
void adcCaptureStart(void) const;
void adcCaptureDone(void) const;
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();

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

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

@ -23,9 +23,11 @@ struct ProbeElementPosition
struct HealthStatus
{
float systemTemperature;
float criticalComponentTemperature;
AdcVoltages* adcMon;
VoltagesPg* voltsPg;
FanRpm* fanRpm;
criticalComponentTemperature* fpgaCoreTemperature;
criticalComponentVoltages* fpgaCoreVoltages;
};
struct EepromStatus

60
include/model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.h

@ -16,7 +16,7 @@
#define SUPERVISOR_RB_RESOLUTION 65535
#define SUPERVISOR_RB_V_REF 2.048f
#define F_SYS_CLK 100000 //Dimension: KHz or 200MHz
#define F_SYS_CLK 1E8f //FPGAclk = 100MHz
#define CWD_Offset 1.53f
#define CWD_GAIN 47.065f
#define HVA_Offset 1.525f
@ -106,6 +106,51 @@ struct MpsFaultStatus
bool underP24v;
};
struct FpgaVccInt
{
float master;
float slave0;
float slave1;
float slave2;
};
struct FpgaVccAux
{
float master;
float slave0;
float slave1;
float slave2;
};
struct FpgaVccBram
{
float master;
float slave0;
float slave1;
float slave2;
};
struct FanRpm
{
float fan1;
float fan2;
};
struct criticalComponentVoltages
{
FpgaVccInt vccInt;
FpgaVccAux vccAux;
FpgaVccBram vccBram;
};
struct criticalComponentTemperature
{
float master;
float slave0;
float slave1;
float slave2;
};
class BoardsCtrlMngt : private BoardsSpecs
{
private:
@ -175,8 +220,15 @@ private:
template<class T6>
void setEepromRead(EepromReq* _rom, T6* request);
template<class T7>
float fanTacho(T7* tachoMean);
float resDiv(float r1, float r2, quint32 adcValue);
QVector<float> voltPg(float adcVolt);
float fpgaVoltage (quint32 coreVolt) const;
float fpgaTemp(FpgaXadc1 *coreTemp) const;
float fpgaVccInt(FpgaXadc1 *coreVccInt) const;
float fpgaVccAux(FpgaXadc2 *coreVccAux) const;
float fpgaVccBram(FpgaXadc2 *coreVccBram) const;
float getCWdpValue(void) const;
float getCurr24vValue(void) const;
@ -237,7 +289,6 @@ public:
void prbCtrlInit(void) const;
float getTrxTempSensor(void) const;
float getTrxFpgaTemp(void) const;
void getTrxBoardVoltages(AdcVoltages* adc, VoltagesPg* pg);
void getTrxVoltagesPg(VoltagesPg* pg);
@ -249,6 +300,11 @@ public:
void mpsDacsOff(void) const;
void mpsDacsOn(void) const;
void mpsHvSet(float& hva, float& hvb) const;
void getFpgaTemp(criticalComponentTemperature *coreTemp);
void getFpgaVccInt(FpgaVccInt &coreVcc);
void getFpgaVccAux(FpgaVccAux &coreAux);
void getFpgaVccBram(FpgaVccBram &coreBram);
void getFanRpm(FanRpm* _rpm);
QByteArray trxEepromRead(quint32 address, quint32 length);
QByteArray mpsEepromRead(quint32 address, quint32 length);

47
include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/BoardsSpecs.h

@ -25,6 +25,8 @@
#include "mps/MpsEepromRwReq.h"
#include "mps/MpsHvStopState.h"
#include "mps/FanStatus.h"
#include "mps/FanTacho1.h"
#include "mps/FanTacho2.h"
//////////////// Prb Headers ////////////////
#include "probe/PrbCtrlEepromRwStatus.h"
@ -44,6 +46,8 @@
#include "trx/AdcAfeVcntlp.h"
#include "trx/AdcAfeA1P8V.h"
#include "trx/AdcAfeD1P8V.h"
#include "trx/FpgaXadc1.h"
#include "trx/FpgaXadc2.h"
#include "trx/Adc12Vin.h"
#include "trx/Adc3P3V.h"
#include "trx/Adc5Vin.h"
@ -51,6 +55,12 @@
class BoardsSpecs
{
private:
const quint32 _offsetMXadc;
const quint32 _offsetS0Xadc;
const quint32 _offsetS1Xadc;
const quint32 _offsetS2Xadc;
protected:
//////////////// MPS classes ////////////////
SupervisorFaultStatus* _sFaultStatus;
@ -75,6 +85,8 @@ protected:
SupervisorRwReq* _sRwReq;
MpsEepromRwReq* _mRomReq;
MpsHvStopState* _mHvStop;
FanTacho1* _fanTacho1;
FanTacho2* _fanTacho2;
FanStatus* _fan;
//////////////// Prb classes ////////////////
@ -96,11 +108,22 @@ protected:
AdcAfeA1P8V* _adcA1P8V;
AdcAfeD1P8V* _adcD1P8V;
Adc12Vin* _adc12Vin;
FpgaXadc1* _s0Xadc1;
FpgaXadc1* _s1Xadc1;
FpgaXadc1* _s2Xadc1;
FpgaXadc1* _mXadc1;
FpgaXadc2* _s0Xadc2;
FpgaXadc2* _s1Xadc2;
FpgaXadc2* _s2Xadc2;
FpgaXadc2* _mXadc2;
Adc3P3V* _adc3P3V;
Adc5Vin* _adc5Vin;
PcieId* _pcie;
explicit BoardsSpecs(SonoDevice* device)
explicit BoardsSpecs(SonoDevice* device) : _offsetMXadc (0),
_offsetS0Xadc(0x500034 - 0x260D4),
_offsetS1Xadc(0x900034 - 0x260D4),
_offsetS2Xadc(0xD00034 - 0x260D4)
{
///////////////////// MPS Mem Alloc /////////////////////
_sFaultStatus = new SupervisorFaultStatus(device);
@ -125,6 +148,8 @@ protected:
_sRwReq = new SupervisorRwReq(device);
_mRomReq = new MpsEepromRwReq(device);
_mHvStop = new MpsHvStopState(device);
_fanTacho1 = new FanTacho1(device);
_fanTacho2 = new FanTacho2(device);
_fan = new FanStatus(device);
///////////////////// Prb Mem Alloc /////////////////////
@ -136,6 +161,14 @@ protected:
_pCmd = new PrbCtrlCmd(device);
///////////////////// TRX Mem Alloc /////////////////////
_s0Xadc1 = new FpgaXadc1(device, _offsetS0Xadc);
_s1Xadc1 = new FpgaXadc1(device, _offsetS1Xadc);
_s2Xadc1 = new FpgaXadc1(device, _offsetS2Xadc);
_mXadc1 = new FpgaXadc1(device, _offsetMXadc);
_s0Xadc2 = new FpgaXadc2(device, _offsetS0Xadc);
_s1Xadc2 = new FpgaXadc2(device, _offsetS1Xadc);
_s2Xadc2 = new FpgaXadc2(device, _offsetS2Xadc);
_mXadc2 = new FpgaXadc2(device, _offsetMXadc);
_adcPrbEncoder = new AdcPrbZeroEncoder(device);
_tempSensor = new OnBoardTempSensor(device);
_tRomStatus = new TrxEepromRwStatus(device);
@ -176,6 +209,8 @@ protected:
delete _sRwReq;
delete _mRomReq;
delete _mHvStop;
delete _fanTacho1;
delete _fanTacho2;
delete _fan;
//// Prb Mem delete ////
@ -199,7 +234,15 @@ protected:
delete _adc12Vin;
delete _adc3P3V;
delete _adc5Vin;
delete _pcie;
delete _s0Xadc1;
delete _s1Xadc1;
delete _s2Xadc1;
delete _mXadc1;
delete _s0Xadc2;
delete _s1Xadc2;
delete _s2Xadc2;
delete _mXadc2;
delete _pcie;
}
};

30
include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/FanTacho1.h

@ -0,0 +1,30 @@
#ifndef FANTACHO1_H
#define FANTACHO1_H
#include "model/hardware/core/register/Register.h"
#include "model/hardware/core/register/RegUtils.h"
#undef BAR
#define FAN_TACHO_MEAN_MASK 0x00FFFFFF
#define BAR 0
#define OFFSET 0x260CC
class FanTacho1 : public Register
{
public:
Field* fanTachoMean;
FanTacho1(SonoDevice* device) : Register(BAR, OFFSET, device)
{
ADD_UNSIGNED_FIELD(fanTachoMean, FAN_TACHO_MEAN_MASK);
}
};
#undef FAN_TACHO_MEAN_MASK
#undef BAR
#undef OFFSET
#endif // FANTACHO1_H

30
include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/mps/FanTacho2.h

@ -0,0 +1,30 @@
#ifndef FANTACHO2_H
#define FANTACHO2_H
#include "model/hardware/core/register/Register.h"
#include "model/hardware/core/register/RegUtils.h"
#undef BAR
#define FAN_TACHO_MEAN_MASK 0x00FFFFFF
#define BAR 0
#define OFFSET 0x260D0
class FanTacho2 : public Register
{
public:
Field* fanTachoMean;
FanTacho2(SonoDevice* device) : Register(BAR, OFFSET, device)
{
ADD_UNSIGNED_FIELD(fanTachoMean, FAN_TACHO_MEAN_MASK);
}
};
#undef FAN_TACHO_MEAN_MASK
#undef BAR
#undef OFFSET
#endif // FANTACHO2_H

34
include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/FpgaXadc1.h

@ -0,0 +1,34 @@
#ifndef FPGAXADC1_H
#define FPGAXADC1_H
#include "model/hardware/core/register/Register.h"
#include "model/hardware/core/register/RegUtils.h"
#undef BAR
#define FPGA_CORE_TEMP_MASK 0x00000FFF
#define FPGA_VCC_INT_MASK 0x0FFF0000
#define BAR 0U
#define OFFSET 0x260D4
class FpgaXadc1 : public Register
{
public:
Field* fpgaCoreTemp;
Field* fpgaVccInt;
FpgaXadc1(SonoDevice* device, quint32 offset) : Register(BAR, OFFSET+offset, device)
{
ADD_UNSIGNED_FIELD(fpgaCoreTemp, FPGA_CORE_TEMP_MASK);
ADD_UNSIGNED_FIELD(fpgaVccInt , FPGA_VCC_INT_MASK );
}
};
#undef FPGA_CORE_TEMP_MASK
#undef FPGA_VCC_INT_MASK
#undef BAR
#undef OFFSET
#endif // FPGAXADC1_H

34
include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/FpgaXadc2.h

@ -0,0 +1,34 @@
#ifndef FPGAXADC2_H
#define FPGAXADC2_H
#include "model/hardware/core/register/Register.h"
#include "model/hardware/core/register/RegUtils.h"
#undef BAR
#define FPGA_VCC_AUX_MASK 0x00000FFF
#define FPGA_VCC_BRAM_MASK 0x0FFF0000
#define BAR 0U
#define OFFSET 0x260D8
class FpgaXadc2 : public Register
{
public:
Field* fpgaVccAux;
Field* fpgaVccBram;
FpgaXadc2(SonoDevice* device, quint32 offset) : Register(BAR, OFFSET+offset, device)
{
ADD_UNSIGNED_FIELD(fpgaVccAux, FPGA_VCC_AUX_MASK );
ADD_UNSIGNED_FIELD(fpgaVccBram, FPGA_VCC_BRAM_MASK);
}
};
#undef FPGA_VCC_AUX_MASK
#undef FPGA_VCC_BRAM_MASK
#undef BAR
#undef OFFSET
#endif // FPGAXADC2_H

2
include/model/hardware/core/register/boardsCtrlMngt/registerDefinition/trx/OnBoardTempSensor.h

@ -18,7 +18,7 @@ public:
OnBoardTempSensor(SonoDevice* device) : Register(BAR, OFFSET, device)
{
ADD_UNSIGNED_FIELD(temperature, TEMPERATURE_MASK);
ADD_SIGNED_FIELD(temperature, TEMPERATURE_MASK);
}
};

2
include/model/hardware/core/register/bpiFlash/BpiFlash.h

@ -14,7 +14,7 @@ public:
~BpiFlash();
void writeMcs (QByteArray& mcs) const;
void readMcs (QList<quint32>* mcs) const;
QList<quint32> readMcs (void) const;
};
#endif // BPIFLASH_H

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

@ -52,7 +52,8 @@ enum eSyncCtrl : quint8
{
bfSyncMode,
adcSyncMode,
bfAdcLogMode
bfAdcLogMode,
otherAdcLogMode
};
class Misc
@ -94,7 +95,7 @@ public:
void setAdcSamplerFpgaSel (quint8 fpgaSel) const;
bool getAdcSamplerBramReady (void) const;
bool getAdcSamplerError (void) const;
void getAdcDataBram (QList<qint16>* adcData) const;
QList<qint16> getAdcDataBram (void) const;
};

1124
mainwindow.cpp

File diff suppressed because it is too large

62
mainwindow.h

@ -31,10 +31,10 @@
emit showMessage(M)
#define SCENARIO_FILE_PATH "scenarioFilePath"
#define BITE_SCEN_FILE_PATH "biteScenarioFilePath"
#define FRAME_LOG_PATH "frameLogPath"
#define ADC_LOG_PATH "adcLogPath"
#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"
@ -59,6 +59,8 @@
#define ENABLE "Enable"
#define DISABLE "Disable"
#define LOG_COUNT_FROM_FIRST 50U
#define TRANSFER_LENGTH 128 * 1024
#define TRANSFER_RATE 30.0f
#define RAM_BUFFER_OFFSET 0U
@ -97,6 +99,8 @@ private:
QFutureWatcher<void> dmaLogWatcher;
QFutureWatcher<void> programWatcher;
static QThread* _uiThread;
QTimer* _timeout;
@ -121,13 +125,11 @@ private:
PrbCase* _prb;
AfeConfig _afeConfig;
void setScenarioCompare(const QString& scenPath);
void timeout();
void delay(int ms);
void delay(quint16 ms);
const QString enum2String (ePg state) const;
@ -149,17 +151,24 @@ private:
void getProbeColor (const QBrush brush, const int item);
void gifActive(void);
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/";
void fpgaProgram(QString &path);
void programThreadFinish();
QString _fpgaProgramFolder = "/home/hasis/Desktop/hardware/hwCode";
QString _scenarioFolder = "/home/hasis/Desktop/hardware/Scenarios";
QString _emulFolder = "/home/hasis/Desktop/hardware/emulator";
QString _BITeScenFolder = "/home/hasis/Desktop/hardware";
QString _BITeIqFolder = "/home/hasis/Desktop/hardware/BITe_IQ";
QString _frameLogFolder = "/home/hasis/Desktop/hardware/Log/DMA";
QString _biteLogFolder = "/home/hasis/Desktop/hardware/Log/BITe";
QString _adcLoggerFolder = "/home/hasis/Desktop/hardware/Log/ADC";
QVector<QByteArray> _dmaBuffer;
QByteArray _lastBuffer;
@ -173,6 +182,8 @@ private:
bool _dmaShow;
bool _getPacket;
bool _fpsFlag;
bool _firstFrameEn;
bool _programFlag;
// uncrustify off
private slots:
@ -195,8 +206,6 @@ private slots:
void getLabelState(QLabel* label, QString str, QColor color);
void getFpgaProgrammer (QString path);
void getProgrammingGif(void);
void on_rbtn_reg_toggled(bool checked);
@ -289,6 +298,32 @@ private slots:
void on_btn_setAdcLog_clicked();
void on_btn_gtReg_clicked();
void on_btn_frameLogBrowse_clicked();
void on_btn_biteScenBrowse_clicked();
void on_chk_logCountEn_clicked(bool checked);
void on_chk_syncAdcLog_clicked(bool checked);
void on_chk_scenFrameAdcLog_clicked(bool checked);
void on_chk_pulserTstModeEn_clicked(bool checked);
void on_chk_afeConfig_clicked(bool checked);
void on_cb_syncMode_currentIndexChanged(int index);
void on_btn_adcLogBrowse_clicked();
void on_btn_biteSetScenario_clicked();
void on_btn_biteIQ_clicked();
void on_cb_pulserTstMode_currentIndexChanged(int index);
signals:
void showMessage(QString message);
void threeDReady();
@ -297,7 +332,6 @@ signals:
void connectedPrbChange();
void frameLostCall();
void labelState(QLabel* label, QString str, QColor color);
void fpgaProgrammer(QString path);
void scenarioReady(const string& h5Path);
void programmingGif();

1305
mainwindow.ui

File diff suppressed because it is too large

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

@ -134,12 +134,35 @@ void TrxBoard::afeAdcsSync() const
}
}
void TrxBoard::waitForCaptureDone(Debug *_dbg) const
{
// Timeout to receive adc capture done.
this->_bCtrlMngt->timerShot(1000);
while (!(_dbg->getCapDone()))
{
if(this->_bCtrlMngt->checkTimeout())
throw SonoException("Failure to receive adc capture done.");
}
this->_bCtrlMngt->timerStop();
}
void TrxBoard::adcCaptureStop(Debug *_dbg) const
{
_dbg->adcCaptureCmd(captureStop);
}
void TrxBoard::adcCaptureStart(Debug *_dbg) const
{
_dbg->adcCaptureCmd(captureStart);
}
void TrxBoard::adcLogTransferRoutine(Debug *_dbg, quint8 chNumPerFpga)
{
bool adcSamplerReady (false);
bool adcSamplerError (false);
// Adc logger start according to selected afe channel
// Adc logger start according to selected afe channel.
_dbg->adcLoggerTransferCmd(loggerStop);
_dbg->adcLoggerChannelNum(chNumPerFpga);
_dbg->adcLoggerTransferCmd(loggerStart);
@ -262,7 +285,10 @@ TrxBoard::TrxBoard() : _offsetSlave0(0), _offsetSlave1(0x400000), _offsetSlave2(
_adc = new AdcVoltages;
_pg = new VoltagesPg;
scenParams = new ScenGenHardwareParam;
_tachoRpm = new FanRpm;
_coreVolt = new criticalComponentVoltages;
_coreTemp = new criticalComponentTemperature;
_scenParams = new ScenGenHardwareParam;
_allow = false;
_run = false;
@ -312,7 +338,10 @@ TrxBoard::~TrxBoard()
delete _adc;
delete _pg;
delete scenParams;
delete _tachoRpm;
delete _coreVolt;
delete _coreTemp;
delete _scenParams;
}
TrxBoard::ScenHwRegister::~ScenHwRegister()
@ -411,12 +440,8 @@ void TrxBoard::setProbeDependParams(ScenPrbDepHardwareParam& prbDepParams)
this->_dsp->lpfScaleCoefficient(prbDepParams.prbDepParams.lpfScaleCoeff);
/////////////////////////// AFE setting ///////////////////////////
this->_afeSlave0->setAfeParams(prbDepParams.afeCfg);
this->_afeSlave1->setAfeParams(prbDepParams.afeCfg);
this->_afeSlave2->setAfeParams(prbDepParams.afeCfg);
this->_afeSlave0->setAfeGblPwr(afePwrdnEnable);
this->_afeSlave1->setAfeGblPwr(afePwrdnEnable);
this->_afeSlave2->setAfeGblPwr(afePwrdnEnable);
setAfeConfig (prbDepParams.afeCfg);
setAfePwr(afePwrdnEnable);
}
void TrxBoard::setScenario(ScenGenHardwareOutput_t& scenGenHw)
@ -428,178 +453,178 @@ void TrxBoard::setScenario(ScenGenHardwareOutput_t& scenGenHw)
emulatorStop();
sramClear(first4M);
scenParams->focusTypeNumber = scenGenHw.focusTypeNumber;
if(scenParams->focusTypeNumber > FOCUS_TYPE_NUMBER_MAX)
_scenParams->focusTypeNumber = scenGenHw.focusTypeNumber;
if(_scenParams->focusTypeNumber > FOCUS_TYPE_NUMBER_MAX)
{
throw SonoException("Focus type number is out of range");
}
scenParams->totalTxShotNumber = scenGenHw.totalTxShotNumber;
if(scenParams->totalTxShotNumber > TOTAL_TX_SHOT_NUMBER_MAX)
_scenParams->totalTxShotNumber = scenGenHw.totalTxShotNumber;
if(_scenParams->totalTxShotNumber > TOTAL_TX_SHOT_NUMBER_MAX)
{
throw SonoException("Total tx shot number is out of range");
}
scenParams->rxBeamFormerNumber = scenGenHw.rxBeamFormerNumber.toVector();
if(scenParams->rxBeamFormerNumber.size() > RX_BEAMFORMER_NUMBER_MAX)
_scenParams->rxBeamFormerNumber = scenGenHw.rxBeamFormerNumber.toVector();
if(_scenParams->rxBeamFormerNumber.size() > RX_BEAMFORMER_NUMBER_MAX)
{
throw SonoException("Rx beam former number is out of range");
}
scenParams->scenarioStartIndex = scenGenHw.hwRegister.scenarioStartIndex;
scenParams->scenarioEndIndex = scenGenHw.hwRegister.scenarioEndIndex;
_scenParams->scenarioStartIndex = scenGenHw.hwRegister.scenarioStartIndex;
_scenParams->scenarioEndIndex = scenGenHw.hwRegister.scenarioEndIndex;
if(scenParams->scenarioEndIndex > SCENARIO_INDEX_MAX)
if(_scenParams->scenarioEndIndex > SCENARIO_INDEX_MAX)
{
throw SonoException("Scenario end index is out of range");
}
if(scenParams->scenarioEndIndex < scenParams->scenarioStartIndex)
if(_scenParams->scenarioEndIndex < _scenParams->scenarioStartIndex)
{
throw SonoException(
"The scenario end index must be greater than or equal to the scenario start index");
}
if(scenParams->scenarioEndIndex != (scenParams->totalTxShotNumber - 1))
if(_scenParams->scenarioEndIndex != (_scenParams->totalTxShotNumber - 1))
{
throw SonoException(
"The scenario end index must be equal to the total tx shot number minus one");
}
scenParams->hwRegister->blendWeight = scenGenHw.hwRegister.blendWeight;
if(scenParams->hwRegister->blendWeight.size() != BLENDWEIGHT_LUT_MAX)
_scenParams->hwRegister->blendWeight = scenGenHw.hwRegister.blendWeight;
if(_scenParams->hwRegister->blendWeight.size() != BLENDWEIGHT_LUT_MAX)
{
throw SonoException("Blend weight lut is out of range");
}
scenParams->hwRegister->elementPosition->xPosition = scenGenHw.hwRegister.elementXPosition;
if(scenParams->hwRegister->elementPosition->xPosition.size() != ELEMENT_POSITION_LUT_MAX)
_scenParams->hwRegister->elementPosition->xPosition = scenGenHw.hwRegister.elementXPosition;
if(_scenParams->hwRegister->elementPosition->xPosition.size() != ELEMENT_POSITION_LUT_MAX)
{
throw SonoException("Element position x is out of range");
}
scenParams->hwRegister->elementPosition->yPosition = scenGenHw.hwRegister.elementYPosition;
if(scenParams->hwRegister->elementPosition->yPosition.size() != ELEMENT_POSITION_LUT_MAX)
_scenParams->hwRegister->elementPosition->yPosition = scenGenHw.hwRegister.elementYPosition;
if(_scenParams->hwRegister->elementPosition->yPosition.size() != ELEMENT_POSITION_LUT_MAX)
{
throw SonoException("Element position y is out of range");
}
scenParams->hwRegister->elementPosition->zPosition = scenGenHw.hwRegister.elementZPosition;
if(scenParams->hwRegister->elementPosition->zPosition.size() != ELEMENT_POSITION_LUT_MAX)
_scenParams->hwRegister->elementPosition->zPosition = scenGenHw.hwRegister.elementZPosition;
if(_scenParams->hwRegister->elementPosition->zPosition.size() != ELEMENT_POSITION_LUT_MAX)
{
throw SonoException("Element position z is out of range");
}
scenParams->hwRegister->freqLut = scenGenHw.hwRegister.freqLut;
if(scenParams->hwRegister->freqLut.size() != FREQUENCY_LUT_MAX)
_scenParams->hwRegister->freqLut = scenGenHw.hwRegister.freqLut;
if(_scenParams->hwRegister->freqLut.size() != FREQUENCY_LUT_MAX)
{
throw SonoException("Frequency lut is out of range");
}
scenParams->hwRegister->dtgcLut = scenGenHw.hwRegister.dtgcLut;
if(scenParams->hwRegister->dtgcLut.size() != DTGC_LUT_MAX)
_scenParams->hwRegister->dtgcLut = scenGenHw.hwRegister.dtgcLut;
if(_scenParams->hwRegister->dtgcLut.size() != DTGC_LUT_MAX)
{
throw SonoException("Dtgc lut is out of range");
}
scenParams->hwRegister->pulseTypeNumber = scenGenHw.hwRegister.pulseTypeNumber;
if(scenParams->hwRegister->pulseTypeNumber > PULSE_LUT_MAX)
_scenParams->hwRegister->pulseTypeNumber = scenGenHw.hwRegister.pulseTypeNumber;
if(_scenParams->hwRegister->pulseTypeNumber > PULSE_LUT_MAX)
{
throw SonoException("Pulse type number is out of range");
}
scenParams->hwRegister->rxBeamFormerTypeNumber = scenGenHw.hwRegister.rxBeamFormerTypeNumber;
if(scenParams->hwRegister->rxBeamFormerTypeNumber > RXBEAMFORMER_LUT_MAX)
_scenParams->hwRegister->rxBeamFormerTypeNumber = scenGenHw.hwRegister.rxBeamFormerTypeNumber;
if(_scenParams->hwRegister->rxBeamFormerTypeNumber > RXBEAMFORMER_LUT_MAX)
{
throw SonoException("Rx beam former type number is out of range");
}
scenParams->hwRegister->receiverConfigTypeNumber =
_scenParams->hwRegister->receiverConfigTypeNumber =
scenGenHw.hwRegister.receiverConfigTypeNumber;
if(scenParams->hwRegister->receiverConfigTypeNumber > RRECEIVER_CONFIGURATION_LUT_MAX)
if(_scenParams->hwRegister->receiverConfigTypeNumber > RRECEIVER_CONFIGURATION_LUT_MAX)
{
throw SonoException("Receiver config type number is out of range");
}
scenParams->hwRegister->pulse->clear();
_scenParams->hwRegister->pulse->clear();
foreach(auto i, scenGenHw.hwRegister.pulseProps)
{
scenParams->hwRegister->pulse->halfPeriod.append(i.halfPeriod);
scenParams->hwRegister->pulse->startPhase.append(i.startPhase);
scenParams->hwRegister->pulse->halfCycleNo.append(i.halfCycleNo);
scenParams->hwRegister->pulse->pulseVoltSel.append(i.pulseVoltSel);
scenParams->hwRegister->pulse->dampingPulseWidth.append(i.dampingPulseWidth);
_scenParams->hwRegister->pulse->halfPeriod.append(i.halfPeriod);
_scenParams->hwRegister->pulse->startPhase.append(i.startPhase);
_scenParams->hwRegister->pulse->halfCycleNo.append(i.halfCycleNo);
_scenParams->hwRegister->pulse->pulseVoltSel.append(i.pulseVoltSel);
_scenParams->hwRegister->pulse->dampingPulseWidth.append(i.dampingPulseWidth);
}
scenParams->hwRegister->rxBeamformer->clear();
_scenParams->hwRegister->rxBeamformer->clear();
foreach(auto j, scenGenHw.hwRegister.rxBeamFormerProps)
{
scenParams->hwRegister->rxBeamformer->lag.append(j.lag);
scenParams->hwRegister->rxBeamformer->mla.append(j.mla);
scenParams->hwRegister->rxBeamformer->apodization.append(j.apodizationSel);
_scenParams->hwRegister->rxBeamformer->lag.append(j.lag);
_scenParams->hwRegister->rxBeamformer->mla.append(j.mla);
_scenParams->hwRegister->rxBeamformer->apodization.append(j.apodizationSel);
}
scenParams->hwRegister->configLut->clear();
_scenParams->hwRegister->configLut->clear();
foreach(auto k, scenGenHw.hwRegister.receiverConfigProps)
{
scenParams->hwRegister->configLut->mla.append(k.mla);
scenParams->hwRegister->configLut->stb.append(k.stb);
scenParams->hwRegister->configLut->absEn.append(k.absEn);
scenParams->hwRegister->configLut->ddcEn.append(k.ddcn);
scenParams->hwRegister->configLut->dpeEn.append(k.dpeEn);
scenParams->hwRegister->configLut->stbEn.append(k.stbEn);
scenParams->hwRegister->configLut->wmfEn.append(k.wmfEn);
scenParams->hwRegister->configLut->lpfSel.append(k.lpfSel);
scenParams->hwRegister->configLut->aTgcSel.append(k.aTgcSel);
scenParams->hwRegister->configLut->focusNo.append(k.focusNo);
scenParams->hwRegister->configLut->lineMode.append(k.lineMode);
scenParams->hwRegister->configLut->ncoFreqSel.append(k.ncoFreqSel);
scenParams->hwRegister->configLut->dcCancelerEn.append(k.dcCancelEn);
scenParams->hwRegister->configLut->lineFilterEn.append(k.lineFilterEn);
scenParams->hwRegister->configLut->subtractFilterEn.append(k.subtractFilterEn);
}
scenParams->indexParams->dLineNum = scenGenHw.indexParams.dLineNum;
scenParams->indexParams->frameType = scenGenHw.frameType;
scenParams->indexParams->dEnsembleNum = scenGenHw.indexParams.dEnsembleNum;
scenParams->indexParams->lastLineInFrame = scenGenHw.indexParams.lastLineInFrame;
scenParams->indexParams->firstLineInFrame = scenGenHw.indexParams.firstLineInFrame;
scenParams->indexParams->shotPropertiesIndex = scenGenHw.indexParams.shotPropertiesIndex;
scenParams->indexParams->pulsePropertiesIndex = scenGenHw.indexParams.pulsePropertiesIndex;
scenParams->indexParams->receiverConfigurationIndex =
_scenParams->hwRegister->configLut->mla.append(k.mla);
_scenParams->hwRegister->configLut->stb.append(k.stb);
_scenParams->hwRegister->configLut->absEn.append(k.absEn);
_scenParams->hwRegister->configLut->ddcEn.append(k.ddcn);
_scenParams->hwRegister->configLut->dpeEn.append(k.dpeEn);
_scenParams->hwRegister->configLut->stbEn.append(k.stbEn);
_scenParams->hwRegister->configLut->wmfEn.append(k.wmfEn);
_scenParams->hwRegister->configLut->lpfSel.append(k.lpfSel);
_scenParams->hwRegister->configLut->aTgcSel.append(k.aTgcSel);
_scenParams->hwRegister->configLut->focusNo.append(k.focusNo);
_scenParams->hwRegister->configLut->lineMode.append(k.lineMode);
_scenParams->hwRegister->configLut->ncoFreqSel.append(k.ncoFreqSel);
_scenParams->hwRegister->configLut->dcCancelerEn.append(k.dcCancelEn);
_scenParams->hwRegister->configLut->lineFilterEn.append(k.lineFilterEn);
_scenParams->hwRegister->configLut->subtractFilterEn.append(k.subtractFilterEn);
}
_scenParams->indexParams->dLineNum = scenGenHw.indexParams.dLineNum;
_scenParams->indexParams->frameType = scenGenHw.frameType;
_scenParams->indexParams->dEnsembleNum = scenGenHw.indexParams.dEnsembleNum;
_scenParams->indexParams->lastLineInFrame = scenGenHw.indexParams.lastLineInFrame;
_scenParams->indexParams->firstLineInFrame = scenGenHw.indexParams.firstLineInFrame;
_scenParams->indexParams->shotPropertiesIndex = scenGenHw.indexParams.shotPropertiesIndex;
_scenParams->indexParams->pulsePropertiesIndex = scenGenHw.indexParams.pulsePropertiesIndex;
_scenParams->indexParams->receiverConfigurationIndex =
scenGenHw.indexParams.receiverConfigurationIndex;
scenParams->txParams->maxDelayQ = scenGenHw.txParams.maxDelayQ;
scenParams->txParams->txFocusXPos = scenGenHw.txParams.txFocusXPos;
scenParams->txParams->txFocusYPos = scenGenHw.txParams.txFocusYPos;
scenParams->txParams->txFocusZPos = scenGenHw.txParams.txFocusZPos;
scenParams->txParams->pulseInterval = scenGenHw.pulseInterval;
scenParams->txParams->txActiveElementNumber = scenGenHw.txParams.txActiveElementNumber;
scenParams->txParams->txStartActiveElementNumber =
_scenParams->txParams->maxDelayQ = scenGenHw.txParams.maxDelayQ;
_scenParams->txParams->txFocusXPos = scenGenHw.txParams.txFocusXPos;
_scenParams->txParams->txFocusYPos = scenGenHw.txParams.txFocusYPos;
_scenParams->txParams->txFocusZPos = scenGenHw.txParams.txFocusZPos;
_scenParams->txParams->pulseInterval = scenGenHw.pulseInterval;
_scenParams->txParams->txActiveElementNumber = scenGenHw.txParams.txActiveElementNumber;
_scenParams->txParams->txStartActiveElementNumber =
scenGenHw.txParams.txStartActiveElementNumber;
scenParams->rxParams->phiCos = scenGenHw.rxParams.phiCos;
scenParams->rxParams->phiSin = scenGenHw.rxParams.phiSin;
scenParams->rxParams->thetaCos = scenGenHw.rxParams.thetaCos;
scenParams->rxParams->thetaSin = scenGenHw.rxParams.thetaSin;
scenParams->rxParams->r0Position = scenGenHw.rxParams.r0Position;
scenParams->rxParams->interceptXPos = scenGenHw.rxParams.interceptXPos;
scenParams->rxParams->interceptYPos = scenGenHw.rxParams.interceptYPos;
scenParams->rxParams->interceptZPos = scenGenHw.rxParams.interceptZPos;
scenParams->rxParams->rxR0MaxDelayQ = scenGenHw.rxParams.rxR0MaxDelayQ;
scenParams->rxParams->rxR0MinDelayQ = scenGenHw.rxParams.rxR0MinDelayQ;
scenParams->rxParams->txR0MinDelayQ = scenGenHw.rxParams.txR0MinDelayQ;
scenParams->rxParams->rxFocusPointNumber = scenGenHw.rxParams.rxFocusPointNumber;
scenParams->rxParams->rxActiveElementStep = scenGenHw.rxParams.rxActiveElementStep;
scenParams->rxParams->rxR0ActiveElementNumber = scenGenHw.rxParams.rxR0ActiveElementNumber;
scenParams->rxParams->interceptPointFiringTime = scenGenHw.rxParams.interceptPointFiringTime;
scenParams->rxParams->rxR0CenterActiveElementNumber =
_scenParams->rxParams->phiCos = scenGenHw.rxParams.phiCos;
_scenParams->rxParams->phiSin = scenGenHw.rxParams.phiSin;
_scenParams->rxParams->thetaCos = scenGenHw.rxParams.thetaCos;
_scenParams->rxParams->thetaSin = scenGenHw.rxParams.thetaSin;
_scenParams->rxParams->r0Position = scenGenHw.rxParams.r0Position;
_scenParams->rxParams->interceptXPos = scenGenHw.rxParams.interceptXPos;
_scenParams->rxParams->interceptYPos = scenGenHw.rxParams.interceptYPos;
_scenParams->rxParams->interceptZPos = scenGenHw.rxParams.interceptZPos;
_scenParams->rxParams->rxR0MaxDelayQ = scenGenHw.rxParams.rxR0MaxDelayQ;
_scenParams->rxParams->rxR0MinDelayQ = scenGenHw.rxParams.rxR0MinDelayQ;
_scenParams->rxParams->txR0MinDelayQ = scenGenHw.rxParams.txR0MinDelayQ;
_scenParams->rxParams->rxFocusPointNumber = scenGenHw.rxParams.rxFocusPointNumber;
_scenParams->rxParams->rxActiveElementStep = scenGenHw.rxParams.rxActiveElementStep;
_scenParams->rxParams->rxR0ActiveElementNumber = scenGenHw.rxParams.rxR0ActiveElementNumber;
_scenParams->rxParams->interceptPointFiringTime = scenGenHw.rxParams.interceptPointFiringTime;
_scenParams->rxParams->rxR0CenterActiveElementNumber =
scenGenHw.rxParams.rxR0CenterActiveElementNumber;
this->setScenario(scenParams);
this->setScenario(_scenParams);
}
void TrxBoard::setScenario (ScenGenHardwareParam* scenParams)
void TrxBoard::setScenario (ScenGenHardwareParam* _scenParams)
{
///////////////////////////////// BeamFormer setting ///////////////////////////////
QList<QList<quint32> > elementPosition;
@ -608,7 +633,7 @@ void TrxBoard::setScenario (ScenGenHardwareParam* scenParams)
QList<quint32> z;
//_signedQntzrVec.clear();
_unsignedQntzrVec = Calculation::qntzr(scenParams->hwRegister->elementPosition->xPosition,
_unsignedQntzrVec = Calculation::qntzr(_scenParams->hwRegister->elementPosition->xPosition,
1,
18,
0,
@ -619,7 +644,7 @@ void TrxBoard::setScenario (ScenGenHardwareParam* scenParams)
QList<quint32> xPosQ = _unsignedQntzrVec.toList();
//QList<quint32> xPosQ = signedVector2unsignedList(_signedQntzrVec);
_unsignedQntzrVec = Calculation::qntzr(scenParams->hwRegister->elementPosition->yPosition,
_unsignedQntzrVec = Calculation::qntzr(_scenParams->hwRegister->elementPosition->yPosition,
1,
18,
0,
@ -629,7 +654,7 @@ void TrxBoard::setScenario (ScenGenHardwareParam* scenParams)
true);
QList<quint32> yPosQ = _unsignedQntzrVec.toList();
_unsignedQntzrVec = Calculation::qntzr(scenParams->hwRegister->elementPosition->zPosition,
_unsignedQntzrVec = Calculation::qntzr(_scenParams->hwRegister->elementPosition->zPosition,
0,
17,
0,
@ -674,44 +699,44 @@ void TrxBoard::setScenario (ScenGenHardwareParam* scenParams)
}
scenParamsFilling(set);
this->_beamFormerSlave0->rxBeamformerProperties(scenParams->hwRegister->rxBeamFormerTypeNumber,
scenParams->hwRegister->rxBeamformer);
this->_beamFormerSlave1->rxBeamformerProperties(scenParams->hwRegister->rxBeamFormerTypeNumber,
scenParams->hwRegister->rxBeamformer);
this->_beamFormerSlave2->rxBeamformerProperties(scenParams->hwRegister->rxBeamFormerTypeNumber,
scenParams->hwRegister->rxBeamformer);
this->_beamFormerSlave0->rxBeamformerProperties(_scenParams->hwRegister->rxBeamFormerTypeNumber,
_scenParams->hwRegister->rxBeamformer);
this->_beamFormerSlave1->rxBeamformerProperties(_scenParams->hwRegister->rxBeamFormerTypeNumber,
_scenParams->hwRegister->rxBeamformer);
this->_beamFormerSlave2->rxBeamformerProperties(_scenParams->hwRegister->rxBeamFormerTypeNumber,
_scenParams->hwRegister->rxBeamformer);
scenParamsFilling(set);
this->_beamFormerSlave0->pulseProperties(scenParams->hwRegister->pulseTypeNumber,
scenParams->hwRegister->pulse);
this->_beamFormerSlave1->pulseProperties(scenParams->hwRegister->pulseTypeNumber,
scenParams->hwRegister->pulse);
this->_beamFormerSlave2->pulseProperties(scenParams->hwRegister->pulseTypeNumber,
scenParams->hwRegister->pulse);
this->_beamFormerSlave0->pulseProperties(_scenParams->hwRegister->pulseTypeNumber,
_scenParams->hwRegister->pulse);
this->_beamFormerSlave1->pulseProperties(_scenParams->hwRegister->pulseTypeNumber,
_scenParams->hwRegister->pulse);
this->_beamFormerSlave2->pulseProperties(_scenParams->hwRegister->pulseTypeNumber,
_scenParams->hwRegister->pulse);
scenParamsFilling(set);
////this->_beamFormerSlave0->afeLut(scenParams->hwRegister->afe);
////this->_beamFormerSlave1->afeLut(scenParams->hwRegister->afe);
////this->_beamFormerSlave2->afeLut(scenParams->hwRegister->afe);
////this->_beamFormerSlave0->afeLut(_scenParams->hwRegister->afe);
////this->_beamFormerSlave1->afeLut(_scenParams->hwRegister->afe);
////this->_beamFormerSlave2->afeLut(_scenParams->hwRegister->afe);
////scenParamsFilling(set);
///////////////////////////////// DSP setting ///////////////////////////////
this->_dsp->receiverConfigurationLut(scenParams->hwRegister->receiverConfigTypeNumber,
scenParams->hwRegister->configLut);
this->_dsp->receiverConfigurationLut(_scenParams->hwRegister->receiverConfigTypeNumber,
_scenParams->hwRegister->configLut);
_unsignedQntzrVec = Calculation::qntzr(scenParams->hwRegister->freqLut, 0, 24, 0, 0, true);
_unsignedQntzrVec = Calculation::qntzr(_scenParams->hwRegister->freqLut, 0, 24, 0, 0, true);
QList<quint32> freqLutQ = _unsignedQntzrVec.toList();
this->_dsp->frequencyLut(freqLutQ);
_unsignedQntzrVec =
Calculation::qntzr(scenParams->hwRegister->dtgcLut, 0, 12, 8, 0, true, false);
Calculation::qntzr(_scenParams->hwRegister->dtgcLut, 0, 12, 8, 0, true, false);
QList<quint32> dtgcLutQ = _unsignedQntzrVec.toList();
this->_dsp->dtgcLut(dtgcLutQ);
QList<quint32> temp;
QList<QList<quint32> > blendWeightQ;
//_signedQntzrVec.clear();
foreach(auto vec, scenParams->hwRegister->blendWeight)
foreach(auto vec, _scenParams->hwRegister->blendWeight)
{
temp.clear();
_unsignedQntzrVec = Calculation::qntzr(vec, 0, 9, 8, 0, true, false, true);
@ -721,19 +746,19 @@ void TrxBoard::setScenario (ScenGenHardwareParam* scenParams)
this->_dsp->blendWeight(blendWeightQ);
///////////////////////////////// Sram setting ///////////////////////////////
this->_sram->setSramIndex(scenParams->totalTxShotNumber, scenParams->indexParams);
this->_sram->setSramIndex(_scenParams->totalTxShotNumber, _scenParams->indexParams);
this->_sram->setSramTx(scenParams->focusTypeNumber, scenParams->txParams);
this->_sram->setSramTx(_scenParams->focusTypeNumber, _scenParams->txParams);
this->_sram->setSramRx(scenParams->rxBeamFormerNumber,
scenParams->focusTypeNumber,
scenParams->rxParams);
this->_sram->setSramRx(_scenParams->rxBeamFormerNumber,
_scenParams->focusTypeNumber,
_scenParams->rxParams);
scenParamsFilling(set);
////////////////////////////// Scen Index setting ////////////////////////////
this->_scenPlayer->setStartIndex(scenParams->scenarioStartIndex);
this->_scenPlayer->setEndIndex(scenParams->scenarioEndIndex);
this->_scenPlayer->setStartIndex(_scenParams->scenarioStartIndex);
this->_scenPlayer->setEndIndex(_scenParams->scenarioEndIndex);
}
void TrxBoard::setLineFilterCoefficient(QVector<float>& lineFilterLut)
@ -795,43 +820,32 @@ void TrxBoard::setFramesMetaData(const QByteArray& metaData) const
void TrxBoard::setBiteDacData(const QByteArray &iData, const QByteArray &qData) const
{
this->_builtInTest->biteDacEnable(BITE_INTERVAL, false);
this->_builtInTest->biteDacMemoryWrite(iData, qData);
}
void TrxBoard::biteScenPlayerStart()
{
DebugMode debug;
DebugMode debugRb;
debug.rxBfDbgModeEn = false;
debug.rxBfSimDataGenModeEn = false;
debug.txBfTestModeEn = true;
debug.txBfTestModeCfg = pulserTr;
setDebuggerMode(pulserTr, true);
this->debuggerMode(_debugSlave0, debug, debugRb, "slave0");
this->debuggerMode(_debugSlave1, debug, debugRb, "slave1");
this->debuggerMode(_debugSlave2, debug, debugRb, "slave2");
setAdgCfg(adgIQ);
setTxDacEnable(BITE_INTERVAL, true);
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");
setTxDacEnable(BITE_INTERVAL, false);
setAdgCfg(adgGnd);
setDebuggerMode(pulserHz, true);
setDebuggerMode(pulserHz, false);
}
void TrxBoard::setScenarioCompare(const QString scenPath)
@ -1020,13 +1034,25 @@ QList<quint32> TrxBoard::getAfeReg(eSlaveSelect sel, quint32 afeRegAddr)
return afeRegValue;
}
void TrxBoard::setAdgCfg(eBiteDacOutput adg) const
{
this->_builtInTest->biteAdgCfg(adg);
}
void TrxBoard::setTxDacEnable(quint8 biteInterval, bool cmd) const
{
this->_builtInTest->biteDacEnable(biteInterval, cmd);
}
void TrxBoard::slaveFpgaProgram(const QString path)
{
scenParamsFilling(clear);
fpgaProgram (path);
#ifndef DEVELOP_UI
afeAdcsSync();
#endif
}
void TrxBoard::setBeamFormerMode(eClkMode mode) const
@ -1544,12 +1570,20 @@ void TrxBoard::selectProbe(eSelectProbe prbSel)
void TrxBoard::getHealthStatus(HealthStatus* healStat) const
{
//healStat->criticalComponentTemperature = this->_bCtrlMngt->getTrxFpgaTemp();
healStat->systemTemperature = this->_bCtrlMngt->getTrxTempSensor();
this->_bCtrlMngt->getTrxBoardVoltages(_adc, _pg);
this->_bCtrlMngt->getTrxVoltagesPg(_pg);
healStat->adcMon = _adc;
healStat->voltsPg = _pg;
this->_bCtrlMngt->getFanRpm(_tachoRpm);
this->_bCtrlMngt->getTrxVoltagesPg(_pg);
this->_bCtrlMngt->getFpgaTemp(_coreTemp);
this->_bCtrlMngt->getTrxBoardVoltages(_adc, _pg);
this->_bCtrlMngt->getFpgaVccInt(_coreVolt->vccInt);
this->_bCtrlMngt->getFpgaVccAux(_coreVolt->vccAux);
this->_bCtrlMngt->getFpgaVccBram(_coreVolt->vccBram);
healStat->voltsPg = _pg;
healStat->adcMon = _adc;
healStat->fanRpm = _tachoRpm;
healStat->fpgaCoreVoltages = _coreVolt;
healStat->fpgaCoreTemperature = _coreTemp;
healStat->systemTemperature = this->_bCtrlMngt->getTrxTempSensor();
}
void TrxBoard::mcsProgram(QString path)
@ -1592,7 +1626,7 @@ void TrxBoard::mcsVerify(QString path) const
QTextStream save(&mcsFile);
this->_bpiFlash->readMcs(&mcsList);
mcsList = this->_bpiFlash->readMcs();
for(auto i = 0; i < MCS_FILE_SIZE; i++)
{
@ -1624,7 +1658,15 @@ quint32 TrxBoard::getFrameLostCounter() const
return (this->_misc->getFrameLostCount());
}
void TrxBoard::adcCaptureStart(captureConfig &capCfg, eSyncMode syncMode)
void TrxBoard::adcCaptureConfig(captureConfig &capCfg) const
{
// ADC capture config
this->_debugSlave0->adcLoggerConfig(capCfg);
this->_debugSlave1->adcLoggerConfig(capCfg);
this->_debugSlave2->adcLoggerConfig(capCfg);
}
void TrxBoard::adcCaptureStart(void) const
{
// ADC capture reset
this->_debugSlave0->adcLoggerRst(true);
@ -1634,43 +1676,36 @@ void TrxBoard::adcCaptureStart(captureConfig &capCfg, eSyncMode syncMode)
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);
// ADC capture start
adcCaptureStart(_debugSlave0);
adcCaptureStart(_debugSlave1);
adcCaptureStart(_debugSlave2);
}
void TrxBoard::setCaptureManualSync(void) const
{
this->_misc->setSyncMode(otherAdcLogMode);
this->_misc->setManualSync(true);
this->_misc->setManualSync(false);
this->_misc->setSyncMode(bfSyncMode);
}
void TrxBoard::adcLoggerStart(const QString path)
void TrxBoard::adcCaptureDone(void) const
{
// // 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.");
waitForCaptureDone(_debugSlave0);
waitForCaptureDone(_debugSlave1);
waitForCaptureDone(_debugSlave2);
// }
// this->_bCtrlMngt->timerStop();
//this->_debugSlave0->adcCaptureCmd(captureStop);
adcCaptureStop(_debugSlave0);
adcCaptureStop(_debugSlave1);
adcCaptureStop(_debugSlave2);
}
void TrxBoard::adcLoggerStart(const QString path, const QString fileName)
{
quint8 fpgaSel(0);
quint8 chNumPerFpga(0);
QList<qint16> adcDataList;
QTime t = QTime::currentTime();
QString logPath = path + "/adcLog_" + QString("%1_%2_%3.csv")
QString logPath = path + "/" + fileName + "_adcLog" + QString("_%1_%2_%3.csv")
.arg(t.hour())
.arg(t.minute())
.arg(t.second());
@ -1688,27 +1723,24 @@ void TrxBoard::adcLoggerStart(const QString path)
}
log << "SYNC Offset(ns): ";
log << this->_debugSlave0->getCapSyncOffset() * 5 << ',';
log << this->_debugSlave1->getCapSyncOffset() * 5 << ',';
log << this->_debugSlave2->getCapSyncOffset() * 5 << ',';
log << endl;
log << this->_debugSlave0->getCapSyncOffset() * 5 << ", ";
log << this->_debugSlave1->getCapSyncOffset() * 5 << ", ";
log << this->_debugSlave2->getCapSyncOffset() * 5 << 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 << this->_afeSlave0->getAdcLatency() * 2.5f << ", ";
log << this->_afeSlave1->getAdcLatency() * 2.5f << ", ";
log << this->_afeSlave2->getAdcLatency() * 2.5f << endl;
log << "ADC Sample Logger Offset(sample): ";
log << this->_debugSlave0->getCaptureSampleNo() << ',';
log << this->_debugSlave1->getCaptureSampleNo() << ',';
log << this->_debugSlave2->getCaptureSampleNo() << ',';
log << endl;
log << this->_debugSlave0->getCaptureSampleNo() << ", ";
log << this->_debugSlave1->getCaptureSampleNo() << ", ";
log << this->_debugSlave2->getCaptureSampleNo() << endl;
// Set gt to adc mode
// Set gt to adc mode.
this->_misc->setGtSendMode(adcMode);
// Stop adc log transfer
// Stop adc log transfer.
this->_debugSlave0->adcLoggerTransferCmd(loggerStop);
this->_debugSlave1->adcLoggerTransferCmd(loggerStop);
this->_debugSlave2->adcLoggerTransferCmd(loggerStop);
@ -1718,7 +1750,7 @@ void TrxBoard::adcLoggerStart(const QString path)
fpgaSel = chNum / AFE_CHANNEL_NUM_PER_SLAVE;
chNumPerFpga = chNum % AFE_CHANNEL_NUM_PER_SLAVE;
// ADC sampler start according to selected fpga
// ADC sampler start according to selected fpga.
this->_misc->setAdcSamplerCmd(samplerStop);
this->_misc->setAdcSamplerFpgaSel(fpgaSel);
this->_misc->setAdcSamplerCmd(samplerStart);
@ -1738,21 +1770,49 @@ void TrxBoard::adcLoggerStart(const QString path)
break;
}
// Read adc data bram
this->_misc->getAdcDataBram(&adcDataList);
// Read adc data bram.
QList<qint16> adcDataList = this->_misc->getAdcDataBram();
foreach (auto data, adcDataList)
{
log << data << ',';
}
log << endl;
// ADC sampler stop
// ADC sampler stop.
this->_misc->setAdcSamplerCmd(samplerStop);
}
logFile.flush();
logFile.close();
// Set gt to beamformer mode
// Set gt to beamformer mode.
this->_misc->setGtSendMode(bfMode);
}
void TrxBoard::setDebuggerMode(eDebugMode bfMode, bool enable)
{
DebugMode debug;
DebugMode debugRb;
debug.rxBfDbgModeEn = false;
debug.rxBfSimDataGenModeEn = false;
debug.txBfTestModeEn = enable;
debug.txBfTestModeCfg = bfMode;
this->debuggerMode(_debugSlave0, debug, debugRb, "slave0");
this->debuggerMode(_debugSlave1, debug, debugRb, "slave1");
this->debuggerMode(_debugSlave2, debug, debugRb, "slave2");
}
void TrxBoard::setAfeConfig(AfeConfig& afeCfg) const
{
this->_afeSlave0->setAfeParams(afeCfg);
this->_afeSlave1->setAfeParams(afeCfg);
this->_afeSlave2->setAfeParams(afeCfg);
}
void TrxBoard::setAfePwr(eAfePwrdnMode pwrMode) const
{
this->_afeSlave0->setAfeGblPwr(pwrMode);
this->_afeSlave1->setAfeGblPwr(pwrMode);
this->_afeSlave2->setAfeGblPwr(pwrMode);
}

101
src/model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.cpp

@ -60,10 +60,9 @@ void BoardsCtrlMngt::eepromWrite(QByteArray& arr,
timerStop();
timerShot(6); //must be >= 4
while(!checkTimeout())
{
;
}
// uncrustify off
while(!checkTimeout());
// uncrustify on
//_rom->dataIn = static_cast<quint32>(i.toLatin1());
_rom->dataIn = i;
@ -191,10 +190,20 @@ void BoardsCtrlMngt::setEepromRead(BoardsCtrlMngt::EepromReq* _rom, T6* request)
/***************************************************************************************************/
/***************************************************************************************************/
template<class T7>
float BoardsCtrlMngt::fanTacho(T7 *tachoMean)
{
tachoMean->sync();
quint32 meanValue = tachoMean->fanTachoMean->getValue();
if (meanValue==0)
return 0.0f;
else
return (60.0f / (meanValue / F_SYS_CLK));
}
float BoardsCtrlMngt::resDiv(float r1, float r2, quint32 adcValue)
{
float result = (static_cast<float>(adcValue)) * (r1 + r2) / (r2 * 1000);
return result;
}
@ -208,6 +217,40 @@ QVector<float> BoardsCtrlMngt::voltPg(float adcVolt)
return pgVec;
}
float BoardsCtrlMngt::fpgaVoltage(quint32 coreVolt) const
{
return ((coreVolt / 4096.0f) * 3.0f);
}
float BoardsCtrlMngt::fpgaTemp(FpgaXadc1 *coreTemp) const
{
coreTemp->sync();
quint32 temp = coreTemp->fpgaCoreTemp->getValue();
return (((temp / 4096.0f) * 503.975f) - 273.15f);
}
float BoardsCtrlMngt::fpgaVccInt(FpgaXadc1 *coreVccInt) const
{
coreVccInt->sync();
quint32 vccInt = coreVccInt->fpgaVccInt->getValue();
return (fpgaVoltage(vccInt));
}
float BoardsCtrlMngt::fpgaVccAux(FpgaXadc2 *coreVccAux) const
{
coreVccAux->sync();
quint32 VccAux = coreVccAux->fpgaVccAux->getValue();
return (fpgaVoltage(VccAux));
}
float BoardsCtrlMngt::fpgaVccBram(FpgaXadc2 *coreVccBram) const
{
coreVccBram->sync();
quint32 VccBram = coreVccBram->fpgaVccBram->getValue();
return (fpgaVoltage(VccBram));
}
float BoardsCtrlMngt::getCWdpValue() const
{
_sRbCwdp->sync();
@ -527,8 +570,7 @@ void BoardsCtrlMngt::prbCtrlInit() const
float BoardsCtrlMngt::getTrxTempSensor() const
{
this->_tempSensor->sync();
qint32 temp = static_cast<qint32>(this->_tempSensor->temperature->getValue());
qint16 temp = static_cast<qint16>(this->_tempSensor->temperature->getValue());
return (temp * TEMP_SENSOR_RESOLUTION);
}
@ -614,10 +656,9 @@ void BoardsCtrlMngt::getSupervisorValue(SupervisorRbValue* sValue) const
getSupervisorI2cDone();
timerShot(72);
while(!checkTimeout())
{
;
}
// uncrustify off
while(!checkTimeout());
// uncrustify on
getSupervisorI2cTimeout();
setReadbackCmd(false, true, false); //avgValueCommand_pulse
@ -755,6 +796,44 @@ void BoardsCtrlMngt::mpsHvSet(float& hva, float& hvb) const
}
}
void BoardsCtrlMngt::getFpgaTemp(criticalComponentTemperature *coreTemp)
{
coreTemp->master = this->fpgaTemp(_mXadc1);
coreTemp->slave0 = this->fpgaTemp(_s0Xadc1);
coreTemp->slave1 = this->fpgaTemp(_s1Xadc1);
coreTemp->slave2 = this->fpgaTemp(_s2Xadc1);
}
void BoardsCtrlMngt::getFpgaVccInt(FpgaVccInt &coreVcc)
{
coreVcc.master = this->fpgaVccInt(_mXadc1);
coreVcc.slave0 = this->fpgaVccInt(_s0Xadc1);
coreVcc.slave1 = this->fpgaVccInt(_s1Xadc1);
coreVcc.slave2 = this->fpgaVccInt(_s2Xadc1);
}
void BoardsCtrlMngt::getFpgaVccAux(FpgaVccAux &coreAux)
{
coreAux.master = this->fpgaVccAux(_mXadc2);
coreAux.slave0 = this->fpgaVccAux(_s0Xadc2);
coreAux.slave1 = this->fpgaVccAux(_s1Xadc2);
coreAux.slave2 = this->fpgaVccAux(_s2Xadc2);
}
void BoardsCtrlMngt::getFpgaVccBram(FpgaVccBram &coreBram)
{
coreBram.master = this->fpgaVccBram(_mXadc2);
coreBram.slave0 = this->fpgaVccBram(_s0Xadc2);
coreBram.slave1 = this->fpgaVccBram(_s1Xadc2);
coreBram.slave2 = this->fpgaVccBram(_s2Xadc2);
}
void BoardsCtrlMngt::getFanRpm(FanRpm *_rpm)
{
_rpm->fan1 = this->fanTacho<FanTacho1>(_fanTacho1);
_rpm->fan2 = this->fanTacho<FanTacho2>(_fanTacho2);
}
QByteArray BoardsCtrlMngt::trxEepromRead(quint32 address, quint32 length)
{
if(address + length >= TRX_ROM_MAX_LEN)

4
src/model/hardware/core/register/bpiFlash/BpiFlash.cpp

@ -38,9 +38,9 @@ void BpiFlash::writeMcs(QByteArray& mcs) const
this->_mcsRdWr->updateArray();
}
void BpiFlash::readMcs(QList<quint32>* mcs) const
QList<quint32> BpiFlash::readMcs(void) const
{
this->_mcsRdWr->mcsListRd.clear();
this->_mcsRdWr->syncArray();
mcs = &(this->_mcsRdWr->mcsListRd);
return (this->_mcsRdWr->mcsListRd);
}

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

@ -114,11 +114,11 @@ bool Misc::getAdcSamplerError() const
return (this->_adcSamplerStatus->error->getValue() != 0);
}
void Misc::getAdcDataBram(QList<qint16> *adcDataList) const
QList<qint16> Misc::getAdcDataBram(void) const
{
this->_adcDataBram->adcDataList.clear();
this->_adcDataBram->syncArray();
adcDataList = &(this->_adcDataBram->adcDataList);
return (this->_adcDataBram->adcDataList);
}
void Misc::getFpgaVersion(FpgaCodeVersion *version) const

Loading…
Cancel
Save