You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

408 lines
11 KiB

4 years ago
#ifndef TRXBOARD_H
#define TRXBOARD_H
#include <QVector>
#include <QString>
#include <QByteArray>
#include <QDebug>
4 years ago
#include "model/hardware/core/register/clockDistributer/ClockDistributer.h"
#include "model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.h"
#include "model/hardware/core/register/fpgaProgram/FpgaProgram.h"
#include "model/hardware/core/register/builtInTest/BuiltInTest.h"
#include "model/hardware/core/register/beamFormer/BeamFormer.h"
#include "model/hardware/core/register/scenPlayer/ScenPlayer.h"
#include "model/hardware/core/register/bpiFlash/BpiFlash.h"
4 years ago
#include "model/hardware/core/register/emulator/Emulator.h"
#include "model/hardware/core/register/misc/Misc.h"
#include "model/hardware/core/register/sram/Sram.h"
4 years ago
#include "model/hardware/core/register/dsp/Dsp.h"
#include "model/hardware/device/SonoDevice.h"
#define SLAVE_ELEMENT_SEGMENT 64U
4 years ago
#define TOTAL_SCEN_LUT_SRAM 5U
#define SLAVE_FPGA_NUMBER 1U
4 years ago
#define CLOCK_DIVISION 0x55
4 years ago
#define EEPROM_ID_BYTE_BEGIN 19U
#define EEPROM_ID_BYTE_NUMBER 2U
#define EEPROM_INFO_BYTE_BEGIN 0U
4 years ago
#define EEPROM_INFO_BYTE_NUMBER 19U
4 years ago
4 years ago
enum eEmulatorOption : bool
{
performance = false,
functionality = true
};
4 years ago
4 years ago
enum eEmulatorMode : bool
4 years ago
{
4 years ago
dynamically = false,
statically = true
4 years ago
};
4 years ago
enum eAfePwrdnMode : bool
4 years ago
{
4 years ago
disable = false,
enable = true
4 years ago
};
enum eSelectProbe : quint8
{
prbA = 1,
prbB,
prbC,
prbD,
};
4 years ago
struct EmulatorProperties
{
quint32 ramBufAddress;
quint32 transferLength;
float transferRate;
eEmulatorMode emulMode;
eEmulatorOption emulOption;
};
struct ProbeElementPosition
{
QVector<float> xPosition;
QVector<float> yPosition;
QVector<float> zPosition;
};
struct HealthStatus
{
float systemTemperature;
float criticalComponentTemperature;
AdcVoltages* adcMon;
VoltagesPg* voltsPg;
};
struct ConnectedPrbId
{
quint32 prbA;
quint32 prbB;
quint32 prbC;
quint32 prbD;
};
struct ConnectedPrbInfo
{
QByteArray prbA;
QByteArray prbB;
QByteArray prbC;
QByteArray prbD;
};
4 years ago
typedef struct Pulse_t {
quint32 halfPeriod;
quint32 halfCycleNo;
bool pulseVoltSel;
bool startPhase;
quint32 dampingPulseWidth;
}Pulse_t;
struct RxBeamFormer_t {
quint32 mla;
quint32 lag;
quint32 apodizationSel;
};
struct ReceiverConfig_t {
quint32 mla;
quint32 lineMode;
quint32 aTgcSel;
quint32 stbEn;
quint32 stb;
quint32 subtractFilterEn;
quint32 dcCancelEn;
quint32 ncoFreqSel;
quint32 lpfSel;
quint32 absEn;
quint32 focusNo;
quint32 lineFilterEn;
};
struct SramIndex_t {
QVector<quint32> shotPropertiesIndex;
QVector<quint32> pulsePropertiesIndex;
QVector<quint32> receiverConfigurationIndex;
QVector<bool> firstLineInFrame;
QVector<bool> lastLineInFrame;
QVector<quint32> dLineNum;
QVector<quint32> dEnsembleNum;
};
struct SramTx_t {
QVector<float> txFocusXPos;
QVector<float> txFocusYPos;
QVector<float> txFocusZPos;
QVector<quint32> txStartActiveElementNumber;
QVector<quint32> txActiveElementNumber;
QVector<float> minDelay;
QVector<float> maxDelay;
QVector<quint32> maxDelayQ;
QVector<float> interceptXPos;
QVector<float> interceptYPos;
QVector<float> interceptZPos;
void clear()
{
txFocusXPos.clear();
txFocusYPos.clear();
txFocusZPos.clear();
txStartActiveElementNumber.clear();
txActiveElementNumber.clear();
minDelay.clear();
maxDelay.clear();
maxDelayQ.clear();
interceptXPos.clear();
interceptYPos.clear();
interceptZPos.clear();
}
};
struct SramRx_t {
QVector<quint32> rxR0CenterActiveElementNumber;
QVector<quint32> rxR0ActiveElementNumber;
QVector<float> rxActiveElementStep;
QVector<quint32> interceptPointFiringTime;
QVector<float> r0Position;
QVector<quint32> rxFocusPointNumber;
QVector<float> thetaCos;
QVector<float> thetaSin;
QVector<float> phiCos;
QVector<float> phiSin;
QVector<float> interceptXPos;
QVector<float> interceptYPos;
QVector<float> interceptZPos;
QVector<float> txR0MinDelay;
QVector<float> rxR0MinDelay;
QVector<float> rxR0MaxDelay;
QVector<quint32> txR0MinDelayQ;
QVector<quint32> rxR0MinDelayQ;
QVector<quint32> rxR0MaxDelayQ;
QVector<quint32> rxR0StartActiveElementNumber;
QVector<float> r0XPosition;
QVector<float> r0YPosition;
QVector<float> r0ZPosition;
void clear()
{
rxR0CenterActiveElementNumber.clear();
rxR0ActiveElementNumber.clear();
rxActiveElementStep.clear();
interceptPointFiringTime.clear();
r0Position.clear();
rxFocusPointNumber.clear();
thetaCos.clear();
thetaSin.clear();
phiCos.clear();
phiSin.clear();
interceptXPos.clear();
interceptYPos.clear();
interceptZPos.clear();
txR0MinDelay.clear();
rxR0MinDelay.clear();
rxR0MaxDelay.clear();
txR0MinDelayQ.clear();
rxR0MinDelayQ.clear();
rxR0MaxDelayQ.clear();
rxR0StartActiveElementNumber.clear();
r0XPosition.clear();
r0YPosition.clear();
r0ZPosition.clear();
}
};
struct HwRegister_t {
QVector<float> dtgcLut;
QVector<QVector<float> > blendWeight;
QVector<float> elementXPosition;
QVector<float> elementYPosition;
QVector<float> elementZPosition;
QVector<float> freqLut;
quint32 scenarioStartIndex;
quint32 scenarioEndIndex;
QList<Pulse_t> pulseProps;
quint8 pulseTypeNumber;
quint8 rxBeamFormerTypeNumber;
QList<RxBeamFormer_t> rxBeamFormerProps;
quint8 receiverConfigTypeNumber;
QList<ReceiverConfig_t> receiverConfigProps;
QList<QVector<float>> lpfLut;
QList<QVector<float>> atgcLut;
QList<QVector<int> > apodizationLut;
};
struct ScenGenHardwareOutput_t
{
quint32 focusTypeNumber;
quint32 totalTxShotNumber;
QVector<quint8> rxBeamFormerNumber;
QVector<float> pulseInterval;
HwRegister_t hwRegister;
SramIndex_t indexParams;
SramRx_t rxParams;
SramTx_t txParams;
};
4 years ago
class TrxBoard
{
private:
4 years ago
QVector<quint8> _swapVec;
QVector<quint32> _unsignedQntzrVec;
QList<quint32>* _mcsList;
const quint32 _offsetSlave0;
const quint32 _offsetSlave1;
const quint32 _offsetSlave2;
4 years ago
bool _allow;
4 years ago
int _swCounter;
int _hwCounter;
bool _run;
SonoDevice _device;
AdcVoltages* _adc;
VoltagesPg* _pg;
4 years ago
ClockDistributer* _clkDistributer;
BoardsCtrlMngt* _bCtrlMngt;
FpgaProgram* _fpgaProgram;
BeamFormer* _beamFormerSlave0;
BeamFormer* _beamFormerSlave1;
BeamFormer* _beamFormerSlave2;
ScenPalyer* _scenPlayer;
BpiFlash* _bpiFlash;
4 years ago
Emulator* _emul;
Misc* _misc;
Sram* _sram;
4 years ago
Dsp* _dsp;
enum eScenParams : quint8
{
clear,
set
};
4 years ago
struct HwRegister
{
///////////// BeamFormer /////////////
RxBeamformerProperties* rxBeamformer;
QList<QVector<quint32>> apodization;
ProbeElementPosition* elementPosition;
PulseProperties* pulse;
//AfeProperties* afe;
quint8 pulseTypeNumber;
quint8 rxBeamFormerTypeNumber;
//////////////// DSP ////////////////
QVector<float> freqLut;
QVector<float> dtgcLut;
QList<QVector<quint32>> lpfLut;
QList<QVector<quint32>> atgcLut;
ReceiverConfiguration* configLut;
QVector<QVector<float>> blendWeight;
quint8 receiverConfigTypeNumber;
HwRegister();
~HwRegister();
};
4 years ago
4 years ago
struct ScenGenHardwareOutput {
quint32 focusTypeNumber;
quint32 totalTxShotNumber;
QVector<quint8> rxBeamFormerNumber;
quint32 scenarioStartIndex;
quint32 scenarioEndIndex;
4 years ago
4 years ago
HwRegister* hwRegister;
SramIndex* indexParams;
SramRx* rxParams;
SramTx* txParams;
ScenGenHardwareOutput();
~ScenGenHardwareOutput();
}*scenParams;
4 years ago
4 years ago
void setScenario (ScenGenHardwareOutput* scenParams);
4 years ago
4 years ago
void scenParamsFilling(eScenParams cmd);
void setSwapVector (void);
//QList<quint32> signedVector2unsignedList (QVector<qint32>& sgnVec);
4 years ago
public:
TrxBoard();
~TrxBoard();
4 years ago
////////////////////////////////// Scenario API ///////////////////////////////
void setLineFilterCoefficient (QVector<float>& lineFilterLut);
void setStbCoefficient (QVector<quint32>& stbLut);
void setDtgcLut (QVector<float>& dtgcLut);
4 years ago
void setAtgcMode (eAtgcMode mode, quint16 value) const;
4 years ago
void setScenario (ScenGenHardwareOutput_t scenGenHw);
4 years ago
4 years ago
void setAfePwrdnMode (eAfePwrdnMode cmd) const;
void setAfeConfig (AfeProperties* afe) const;
4 years ago
void scenPlayerStart (void) const;
//void scenPlayerPause (bool pause) const;
void scenPlayerStop (void) const;
4 years ago
4 years ago
////////////////////////////// Slave Programming API ///////////////////////////
void slaveFpgaProgram (QString path);
/////////////////////////////// BeamFormer Mode API ////////////////////////////
void setBeamFormerMode (eClkMode mode) const;
4 years ago
///////////////////////////////// Emulator API /////////////////////////////////
void emulatorInit(EmulatorProperties* config) const;
4 years ago
void emulatorEnable(void) const;
void emulatorDisable(void) const;
4 years ago
////////////////////////////// BoardCtrlMngt API ///////////////////////////////
quint32 deviceId (void) const;
quint32 vendorId (void) const;
quint32 trxId (void) const;
quint32 mpsId (void) const;
quint32 prbCtrlId (void) const;
quint32 prbId (quint8 prbSel) const;
void getConnectedPrbId (ConnectedPrbId* prbId) const;
4 years ago
QString trxInfo (void) const;
QString mpsInfo (void) const;
QString prbCtrlInfo (void) const;
QByteArray prbInfo (quint8 prbSel) const;
void getConnectedPrbInfo (ConnectedPrbInfo* prbInfo) const;
4 years ago
void supervisorRbValue(SupervisorRbValue* sValue) const;
void mpsFaultStatus (MpsFaultStatus* faultStatus) const;
void mpsReset (void) const;
void mpsSetAo (float voltA, float voltB) const;
void selectProbe (eSelectProbe prbSel) const;
void getHealthStatus (HealthStatus* healStat) const;
void init (void) const;
//////////////////////////////// BPI Flash API /////////////////////////////////
void mcsProgram (QString path);
void mcsVerify (QString path) const;
4 years ago
//////////////////////////////// Miscellaneous API /////////////////////////////////
void getTrxStatus (StatusVec* status) const;
void getFpgasCodeVersion (FpgaCodeVersion* version) const;
4 years ago
///////////////////////////////// Old TRX //////////////////////////////////////
void readData();
};
#endif // TRXBOARD_H