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.

282 lines
6.9 KiB

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