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.
962 lines
27 KiB
962 lines
27 KiB
#include "model/hardware/core/TrxBoard.h"
|
|
|
|
void TrxBoard::readData()
|
|
{
|
|
_swCounter = 0;
|
|
while(_run)
|
|
{
|
|
auto cnt = _device.getCounter();
|
|
|
|
if(cnt == 0)
|
|
{
|
|
_hwCounter = 0;
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(3));
|
|
continue;
|
|
}
|
|
else if(cnt != _hwCounter)
|
|
{
|
|
_hwCounter++;
|
|
|
|
if (_hwCounter > HW_BUFFER_NUM)
|
|
_hwCounter = 1;
|
|
|
|
_device.copy(_hwCounter - 1, _swCounter);
|
|
|
|
auto temp = QByteArray::fromRawData(_device.getBufferPtr(_swCounter), BUFFER_SIZE);
|
|
packetEngine.newData(temp);
|
|
|
|
emit sendFramePacket(temp);
|
|
|
|
_swCounter++;
|
|
if(_swCounter >= SW_BUFFER_NUM)
|
|
{
|
|
_swCounter = 0;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
void TrxBoard::scenParamsFilling(TrxBoard::eScenParams cmd)
|
|
{
|
|
static quint8 scenParams = 0;
|
|
scenParams = cmd ? (scenParams + cmd) : (cmd);
|
|
if(scenParams >= TOTAL_SCEN_LUT_SRAM)
|
|
{
|
|
scenParams = TOTAL_SCEN_LUT_SRAM;
|
|
_allow = true;
|
|
}
|
|
else
|
|
{
|
|
_allow = false;
|
|
}
|
|
}
|
|
|
|
void TrxBoard::setSwapVector()
|
|
{
|
|
_swapVec.clear();
|
|
_swapVec << 0 << 113 << 98 << 19 << 4 << 117 << 102 << 23 << 8 << 121 << 106 << 27
|
|
<< 12 << 125 << 110 << 31 << 16 << 1 << 114 << 99 << 20 << 5 << 118 << 103
|
|
<< 24 << 9 << 122 << 107 << 28 << 13 << 126 << 111 << 96 << 17 << 2 << 115
|
|
<< 100 << 21 << 6 << 119 << 104 << 25 << 10 << 123 << 108 << 29 << 14 << 127
|
|
<< 112 << 97 << 18 << 3 << 116 << 101 << 22 << 7 << 120 << 105 << 26 << 11
|
|
<< 124 << 109 << 30 << 15 << 32 << 145 << 130 << 51 << 36 << 149 << 134 << 55
|
|
<< 40 << 153 << 138 << 59 << 44 << 157 << 142 << 63 << 48 << 33 << 146 << 131
|
|
<< 52 << 37 << 150 << 135 << 56 << 41 << 154 << 139 << 60 << 45 << 158 << 143
|
|
<< 128 << 49 << 34 << 147 << 132 << 53 << 38 << 151 << 136 << 57 << 42 << 155
|
|
<< 140 << 61 << 46 << 159 << 144 << 129 << 50 << 35 << 148 << 133 << 54 << 39
|
|
<< 152 << 137 << 58 << 43 << 156 << 141 << 62 << 47 << 64 << 177 << 162 << 83
|
|
<< 68 << 181 << 166 << 87 << 72 << 185 << 170 << 91 << 76 << 189 << 174 << 95
|
|
<< 80 << 65 << 178 << 163 << 84 << 69 << 182 << 167 << 88 << 73 << 186 << 171
|
|
<< 92 << 77 << 190 << 175 << 160 << 81 << 66 << 179 << 164 << 85 << 70 << 183
|
|
<< 168 << 89 << 74 << 187 << 172 << 93 << 78 << 191 << 176 << 161 << 82 << 67
|
|
<< 180 << 165 << 86 << 71 << 184 << 169 << 90 << 75 << 188 << 173 << 94 << 79;
|
|
}
|
|
|
|
void TrxBoard::setAfeModuleOffset()
|
|
{
|
|
_afeModuleOffset.clear();
|
|
_afeModuleOffset << 0x1000 << 0x2000 << 0x4000 << 0x8000;
|
|
}
|
|
|
|
void TrxBoard::setFpgaOffset()
|
|
{
|
|
_fpgaOffset.clear();
|
|
_fpgaOffset << 0x100000 << 0x200000 << 0x300000;
|
|
}
|
|
|
|
//QList<quint32> TrxBoard::signedVector2unsignedList (QVector<qint32>& sgnVec)
|
|
//{
|
|
// _unsignedQntzrList.clear();
|
|
//// std::list<uint> _usgnList (sgnVec.begin(), sgnVec.end());
|
|
//// _unsignedQntzrList.fromStdList(_usgnList);
|
|
// foreach (auto i, sgnVec)
|
|
// {
|
|
// _unsignedQntzrList.push_back(static_cast<quint32>(i));
|
|
// }
|
|
|
|
// return _unsignedQntzrList;
|
|
//}
|
|
|
|
TrxBoard::TrxBoard() : _offsetSlave0(0), _offsetSlave1(0x400000), _offsetSlave2(0x800000)
|
|
{
|
|
_beamFormerSlave0 = new BeamFormer(&_device, _offsetSlave0);
|
|
_beamFormerSlave1 = new BeamFormer(&_device, _offsetSlave1);
|
|
_beamFormerSlave2 = new BeamFormer(&_device, _offsetSlave2);
|
|
_clkDistributer = new ClockDistributer(&_device);
|
|
_afeSlave0 = new Afe(&_device, _offsetSlave0);
|
|
_afeSlave1 = new Afe(&_device, _offsetSlave1);
|
|
_afeSlave2 = new Afe(&_device, _offsetSlave2);
|
|
_fpgaProgram = new FpgaProgram(&_device);
|
|
_scenPlayer = new ScenPalyer(&_device);
|
|
_bCtrlMngt = new BoardsCtrlMngt(&_device);
|
|
_bpiFlash = new BpiFlash(&_device);
|
|
_emul = new Emulator(&_device);
|
|
_misc = new Misc(&_device);
|
|
_sram = new Sram(&_device);
|
|
_dsp = new Dsp(&_device);
|
|
|
|
|
|
_adc = new AdcVoltages;
|
|
_pg = new VoltagesPg;
|
|
scenParams = new ScenGenHardwareOutput;
|
|
|
|
_allow = false;
|
|
_run = false;
|
|
setSwapVector();
|
|
setFpgaOffset();
|
|
setAfeModuleOffset();
|
|
}
|
|
|
|
TrxBoard::HwRegister::HwRegister()
|
|
{
|
|
configLut = new ReceiverConfiguration;
|
|
elementPosition = new ProbeElementPosition;
|
|
rxBeamformer = new RxBeamformerProperties;
|
|
pulse = new PulseProperties;
|
|
}
|
|
|
|
TrxBoard::ScenGenHardwareOutput::ScenGenHardwareOutput()
|
|
{
|
|
hwRegister = new HwRegister;
|
|
indexParams = new SramIndex;
|
|
rxParams = new SramRx;
|
|
txParams = new SramTx;
|
|
}
|
|
|
|
TrxBoard::~TrxBoard()
|
|
{
|
|
delete _beamFormerSlave0;
|
|
delete _beamFormerSlave1;
|
|
delete _beamFormerSlave2;
|
|
delete _clkDistributer;
|
|
delete _fpgaProgram;
|
|
delete _scenPlayer;
|
|
delete _bCtrlMngt;
|
|
delete _bpiFlash;
|
|
delete _emul;
|
|
delete _misc;
|
|
delete _sram;
|
|
delete _dsp;
|
|
|
|
delete _adc;
|
|
delete _pg;
|
|
delete scenParams;
|
|
}
|
|
|
|
TrxBoard::HwRegister::~HwRegister()
|
|
{
|
|
delete configLut;
|
|
delete rxBeamformer;
|
|
delete elementPosition;
|
|
delete pulse;
|
|
}
|
|
|
|
TrxBoard::ScenGenHardwareOutput::~ScenGenHardwareOutput()
|
|
{
|
|
delete hwRegister;
|
|
delete indexParams;
|
|
delete rxParams;
|
|
delete txParams;
|
|
}
|
|
|
|
void TrxBoard::init()
|
|
{
|
|
this->_device.init();
|
|
this->_bCtrlMngt->prbCtrlInit();
|
|
}
|
|
|
|
void TrxBoard::setScenario(ScenGenHardwareOutput_t scenGenHw)
|
|
{
|
|
scenParams->focusTypeNumber = scenGenHw.focusTypeNumber;
|
|
scenParams->totalTxShotNumber = scenGenHw.totalTxShotNumber;
|
|
scenParams->rxBeamFormerNumber = scenGenHw.rxBeamFormerNumber;
|
|
scenParams->scenarioStartIndex = scenGenHw.hwRegister.scenarioStartIndex;
|
|
scenParams->scenarioEndIndex = scenGenHw.hwRegister.scenarioEndIndex;
|
|
|
|
scenParams->hwRegister->lpfLut = scenGenHw.hwRegister.lpfLut;
|
|
scenParams->hwRegister->atgcLut=scenGenHw.hwRegister.atgcLut;
|
|
scenParams->hwRegister->apodization=scenGenHw.hwRegister.apodizationLut;
|
|
scenParams->hwRegister->blendWeight = scenGenHw.hwRegister.blendWeight;
|
|
scenParams->hwRegister->elementPosition->xPosition = scenGenHw.hwRegister.elementXPosition;
|
|
scenParams->hwRegister->elementPosition->yPosition = scenGenHw.hwRegister.elementYPosition;
|
|
scenParams->hwRegister->elementPosition->zPosition = scenGenHw.hwRegister.elementZPosition;
|
|
scenParams->hwRegister->freqLut = scenGenHw.hwRegister.freqLut;
|
|
scenParams->hwRegister->dtgcLut = scenGenHw.hwRegister.dtgcLut;
|
|
scenParams->hwRegister->pulseTypeNumber = scenGenHw.hwRegister.pulseTypeNumber;
|
|
scenParams->hwRegister->rxBeamFormerTypeNumber = scenGenHw.hwRegister.rxBeamFormerTypeNumber;
|
|
scenParams->hwRegister->receiverConfigTypeNumber =
|
|
scenGenHw.hwRegister.receiverConfigTypeNumber;
|
|
|
|
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->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->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.ddcEn);
|
|
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.indexParams.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 =
|
|
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 =
|
|
scenGenHw.rxParams.rxR0CenterActiveElementNumber;
|
|
|
|
this->setScenario(scenParams);
|
|
}
|
|
|
|
void TrxBoard::setScenario (ScenGenHardwareOutput* scenParams)
|
|
{
|
|
///////////////////////////////// BeamFormer setting ///////////////////////////////
|
|
QList<QList<quint32> > elementPosition;
|
|
QList<quint32> x;
|
|
QList<quint32> y;
|
|
QList<quint32> z;
|
|
|
|
//_signedQntzrVec.clear();
|
|
_unsignedQntzrVec = Calculation::qntzr(scenParams->hwRegister->elementPosition->xPosition,
|
|
1,
|
|
18,
|
|
0,
|
|
0,
|
|
true,
|
|
true,
|
|
true);
|
|
QList<quint32> xPosQ = _unsignedQntzrVec.toList();
|
|
//QList<quint32> xPosQ = signedVector2unsignedList(_signedQntzrVec);
|
|
|
|
_unsignedQntzrVec = Calculation::qntzr(scenParams->hwRegister->elementPosition->yPosition,
|
|
1,
|
|
18,
|
|
0,
|
|
0,
|
|
true,
|
|
true,
|
|
true);
|
|
QList<quint32> yPosQ = _unsignedQntzrVec.toList();
|
|
|
|
_unsignedQntzrVec = Calculation::qntzr(scenParams->hwRegister->elementPosition->zPosition,
|
|
0,
|
|
17,
|
|
0,
|
|
0,
|
|
true,
|
|
true,
|
|
true);
|
|
QList<quint32> zPosQ = _unsignedQntzrVec.toList();
|
|
|
|
for(quint8 i = 0; i < 3; i++)
|
|
{
|
|
for(quint8 j = 0; j < SLAVE_ELEMENT_SEGMENT; j++)
|
|
{
|
|
x.append(xPosQ.at(_swapVec.at(j + i * SLAVE_ELEMENT_SEGMENT)));
|
|
y.append(yPosQ.at(_swapVec.at(j + i * SLAVE_ELEMENT_SEGMENT)));
|
|
z.append(zPosQ.at(_swapVec.at(j + i * SLAVE_ELEMENT_SEGMENT)));
|
|
}
|
|
|
|
elementPosition.append(x);
|
|
elementPosition.append(y);
|
|
elementPosition.append(z);
|
|
|
|
switch(i)
|
|
{
|
|
case 0:
|
|
this->_beamFormerSlave0->probeElementPosition(elementPosition);
|
|
break;
|
|
|
|
case 1:
|
|
this->_beamFormerSlave1->probeElementPosition(elementPosition);
|
|
break;
|
|
|
|
case 2:
|
|
this->_beamFormerSlave2->probeElementPosition(elementPosition);
|
|
break;
|
|
}
|
|
|
|
x.clear();
|
|
y.clear();
|
|
z.clear();
|
|
elementPosition.clear();
|
|
}
|
|
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);
|
|
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);
|
|
scenParamsFilling(set);
|
|
|
|
QList<QList<quint32> > apodizationQ;
|
|
foreach(auto vec, scenParams->hwRegister->apodization)
|
|
{
|
|
apodizationQ.push_back(vec.toList());
|
|
}
|
|
this->_beamFormerSlave0->apodizationLut(apodizationQ);
|
|
this->_beamFormerSlave1->apodizationLut(apodizationQ);
|
|
this->_beamFormerSlave2->apodizationLut(apodizationQ);
|
|
scenParamsFilling(set);
|
|
|
|
//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);
|
|
|
|
_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);
|
|
QList<quint32> dtgcLutQ = _unsignedQntzrVec.toList();
|
|
this->_dsp->dtgcLut(dtgcLutQ);
|
|
|
|
QList<quint32> temp;
|
|
QList<QList<quint32> > blendWeightQ;
|
|
//_signedQntzrVec.clear();
|
|
foreach(auto vec, scenParams->hwRegister->blendWeight)
|
|
{
|
|
temp.clear();
|
|
_unsignedQntzrVec = Calculation::qntzr(vec, 0, 9, 8, 0, true, false, true);
|
|
temp = _unsignedQntzrVec.toList();
|
|
blendWeightQ.push_back(temp);
|
|
}
|
|
this->_dsp->blendWeight(blendWeightQ);
|
|
|
|
QList<QList<quint32> > atgcLutQ;
|
|
foreach(auto vec, scenParams->hwRegister->atgcLut)
|
|
{
|
|
atgcLutQ.push_back(vec.toList());
|
|
}
|
|
this->_dsp->atgcLut(atgcLutQ);
|
|
|
|
QList<QList<quint32> > lpfLutQ;
|
|
foreach(auto vec, scenParams->hwRegister->lpfLut)
|
|
{
|
|
lpfLutQ.push_back(vec.toList());
|
|
}
|
|
this->_dsp->lpfLut(lpfLutQ);
|
|
|
|
///////////////////////////////// Sram setting ///////////////////////////////
|
|
this->_sram->setSramIndex(scenParams->totalTxShotNumber, scenParams->indexParams);
|
|
|
|
this->_sram->setSramTx(scenParams->focusTypeNumber, scenParams->txParams);
|
|
|
|
this->_sram->setSramRx(scenParams->rxBeamFormerNumber,
|
|
scenParams->focusTypeNumber,
|
|
scenParams->rxParams);
|
|
|
|
scenParamsFilling(set);
|
|
////////////////////////////// Scen Index setting ////////////////////////////
|
|
if(scenParams->scenarioEndIndex >= scenParams->scenarioStartIndex)
|
|
{
|
|
this->_scenPlayer->setStartIndex(scenParams->scenarioStartIndex);
|
|
this->_scenPlayer->setEndIndex(scenParams->scenarioEndIndex);
|
|
}
|
|
else
|
|
{
|
|
throw SonoException(
|
|
"The scenario end index must be greater than or equal to the scenario start index");
|
|
}
|
|
}
|
|
|
|
void TrxBoard::setLineFilterCoefficient(QVector<float>& lineFilterLut)
|
|
{
|
|
_unsignedQntzrVec = Calculation::qntzr(lineFilterLut, 0, 9, 8, 0, true, false);
|
|
QList<quint32> lineFilterLutQ = _unsignedQntzrVec.toList();
|
|
this->_dsp->lineFilterCoefficient(lineFilterLutQ);
|
|
}
|
|
|
|
void TrxBoard::setStbCoefficient(QVector<quint32>& stbLut)
|
|
{
|
|
QList<quint32> stbLutQ = stbLut.toList();
|
|
this->_dsp->stbCoefficient(stbLutQ);
|
|
}
|
|
|
|
void TrxBoard::setAtgcMode(eAtgcMode mode, quint16 value) const
|
|
{
|
|
this->_dsp->atgcMode(mode, value);
|
|
}
|
|
|
|
void TrxBoard::setMetaData(const QByteArray metaData) const
|
|
{
|
|
QList<quint64> data;
|
|
QByteArray temp;
|
|
qint32 num(0);
|
|
|
|
while (num < metaData.size())
|
|
{
|
|
for (quint8 j=0; j < sizeof (quint64); j++)
|
|
{
|
|
temp.append(metaData[j+num]);
|
|
}
|
|
|
|
data.push_back(byteArray2UintBigEndian <quint64>(temp));
|
|
temp.clear();
|
|
num += sizeof (quint64);
|
|
}
|
|
this->_sram->setSramMetaData(data);
|
|
}
|
|
|
|
void TrxBoard::setDtgcLut(QVector<float>& dtgcLut)
|
|
{
|
|
_unsignedQntzrVec = Calculation::qntzr(dtgcLut, 0, 12, 8, 0, true, false);
|
|
QList<quint32> dtgcLutQ = _unsignedQntzrVec.toList();
|
|
this->_dsp->dtgcLut(dtgcLutQ);
|
|
}
|
|
|
|
void TrxBoard::setAfePwrdnMode(eAfePwrdnMode cmd) const
|
|
{
|
|
this->_afeSlave0->setAfeGblPwr(cmd);
|
|
this->_afeSlave1->setAfeGblPwr(cmd);
|
|
this->_afeSlave2->setAfeGblPwr(cmd);
|
|
}
|
|
|
|
QList<quint32> TrxBoard::getAfeReg(eSlaveSelect sel, quint32 afeRegAddr)
|
|
{
|
|
QList<quint32> afeRegValue;
|
|
quint32 offset(0);
|
|
afeRegValue.clear();
|
|
|
|
switch (sel)
|
|
{
|
|
case slave0 :
|
|
this->_afeSlave0->setReadRegEnable(true);
|
|
for (quint8 i=0; i < _afeModuleOffset.size(); i++)
|
|
{
|
|
offset = (_fpgaOffset.at(slave0) + _afeModuleOffset.at(i) + afeRegAddr) * 4;
|
|
afeRegValue.push_back(this->_device.device.readWord(BAR_REG, offset));
|
|
}
|
|
break;
|
|
|
|
case slave1 :
|
|
this->_afeSlave1->setReadRegEnable(true);
|
|
for (quint8 i=0; i < _afeModuleOffset.size(); i++)
|
|
{
|
|
offset = (_fpgaOffset.at(slave1) + _afeModuleOffset.at(i) + afeRegAddr) * 4;
|
|
afeRegValue.push_back(this->_device.device.readWord(BAR_REG, offset));
|
|
}
|
|
break;
|
|
|
|
case slave2 :
|
|
this->_afeSlave2->setReadRegEnable(true);
|
|
for (quint8 i=0; i < _afeModuleOffset.size(); i++)
|
|
{
|
|
offset = (_fpgaOffset.at(slave2) + _afeModuleOffset.at(i) + afeRegAddr) * 4;
|
|
afeRegValue.push_back(this->_device.device.readWord(BAR_REG, offset));
|
|
}
|
|
break;
|
|
}
|
|
|
|
this->_afeSlave0->setReadRegEnable(false);
|
|
this->_afeSlave1->setReadRegEnable(false);
|
|
this->_afeSlave2->setReadRegEnable(false);
|
|
|
|
return afeRegValue;
|
|
}
|
|
|
|
void TrxBoard::setAfeConfig(AfeConfig afe)
|
|
{
|
|
this->_afeSlave0->setAfeParams(afe);
|
|
this->_afeSlave1->setAfeParams(afe);
|
|
this->_afeSlave2->setAfeParams(afe);
|
|
}
|
|
|
|
void TrxBoard::slaveFpgaProgram(QString path)
|
|
{
|
|
QByteArray bitFileData;
|
|
QFile bitFile(path);
|
|
bitFileData.clear();
|
|
|
|
if(bitFile.fileName().isEmpty())
|
|
{
|
|
throw SonoException("No file is selected");
|
|
}
|
|
|
|
if(!bitFile.open(QIODevice::ReadOnly))
|
|
{
|
|
throw SonoException("Couldn't open bit file programming");
|
|
}
|
|
|
|
bitFileData = bitFile.readAll();
|
|
bitFile.close();
|
|
|
|
this->_fpgaProgram->program(bitFileData, SLAVE_FPGA_NUMBER);
|
|
|
|
scenParamsFilling(clear);
|
|
}
|
|
|
|
void TrxBoard::setBeamFormerMode(eClkMode mode) const
|
|
{
|
|
this->_clkDistributer->clockMode(CLOCK_DIVISION, mode);
|
|
}
|
|
|
|
void TrxBoard::scenPlayerStart(void)
|
|
{
|
|
|
|
if(_allow)
|
|
{
|
|
_run = false;
|
|
|
|
this->_beamFormerSlave0->regValid(true);
|
|
this->_beamFormerSlave1->regValid(true);
|
|
this->_beamFormerSlave2->regValid(true);
|
|
|
|
this->_misc->setGtSendMode(BfMode);
|
|
|
|
this->_misc->setSyncMode(BfSyncMode);
|
|
|
|
this->_emul->setEmulatorDis();
|
|
|
|
this->_device.startDma();
|
|
|
|
this->_scenPlayer->control.command(true);
|
|
|
|
_run = true;
|
|
|
|
QtConcurrent::run(this, &TrxBoard::readData);
|
|
}
|
|
else
|
|
{
|
|
throw SonoException("Total scenario luts and sram parameters are not written compeletely");
|
|
}
|
|
|
|
}
|
|
|
|
void TrxBoard::scenPlayerStop(void)
|
|
{
|
|
_run = false;
|
|
|
|
this->_device.stopDma();
|
|
|
|
this->_scenPlayer->control.command(false);
|
|
|
|
this->_bCtrlMngt->mpsDacsOff();
|
|
}
|
|
|
|
//void TrxBoard::scenPlayerPause(bool pause) const
|
|
//{
|
|
//this->_scenPlayer->control.pause(pause);
|
|
//}
|
|
|
|
void TrxBoard::emulatorInit(EmulatorProperties* config) const
|
|
{
|
|
this->_emul->setTransferMode(config->emulOption, config->emulMode, config->transferLength);
|
|
this->_emul->setRamOffsetAddress(config->ramBufAddress);
|
|
this->_emul->setTransferRate(config->transferRate);
|
|
}
|
|
|
|
void TrxBoard::fillRam(QString path)
|
|
{
|
|
QFile emulFile(path);
|
|
QByteArray sramData;
|
|
QByteArray temp;
|
|
qint32 num(0);
|
|
sramData.clear();
|
|
temp.clear();
|
|
|
|
if(emulFile.fileName().isEmpty())
|
|
{
|
|
throw SonoException("No file is selected");
|
|
}
|
|
|
|
if(!emulFile.open(QIODevice::ReadOnly))
|
|
{
|
|
throw SonoException("Couldn't open frame file to emulator test");
|
|
}
|
|
|
|
sramData = emulFile.readAll();
|
|
emulFile.close();
|
|
|
|
while (num < sramData.size())
|
|
{
|
|
for (quint8 j=0; j < sizeof (quint64); j++)
|
|
{
|
|
temp.append(sramData[j+num]);
|
|
}
|
|
|
|
this->_device.device.writeLong(BAR_SRAM, static_cast<quint32>(num), byteArray2UintBigEndian <quint64>(temp));
|
|
temp.clear();
|
|
num += sizeof (quint64);
|
|
}
|
|
}
|
|
|
|
void TrxBoard::emulatorStart()
|
|
{
|
|
_run = false;
|
|
|
|
this->_scenPlayer->control.command(false);
|
|
|
|
this->_emul->setEmulatorEn();
|
|
|
|
this->_device.startDma();
|
|
|
|
_run = true;
|
|
|
|
QtConcurrent::run(this, &TrxBoard::readData);
|
|
}
|
|
|
|
void TrxBoard::emulatorStop()
|
|
{
|
|
_run = false;
|
|
|
|
this->_device.stopDma();
|
|
|
|
this->_emul->setEmulatorDis();
|
|
}
|
|
|
|
quint32 TrxBoard::deviceId() const
|
|
{
|
|
auto pid = this->_bCtrlMngt->getPid();
|
|
|
|
return pid;
|
|
}
|
|
|
|
quint32 TrxBoard::vendorId() const
|
|
{
|
|
auto vid = this->_bCtrlMngt->getVid();
|
|
|
|
return vid;
|
|
}
|
|
|
|
quint32 TrxBoard::trxId() const
|
|
{
|
|
QByteArray id = this->_bCtrlMngt->trxEepromRead(EEPROM_ID_BYTE_BEGIN, EEPROM_ID_BYTE_NUMBER);
|
|
|
|
return byteArray2UintBigEndian <quint32> (id);
|
|
}
|
|
|
|
quint32 TrxBoard::mpsId() const
|
|
{
|
|
QByteArray id = this->_bCtrlMngt->mpsEepromRead(EEPROM_ID_BYTE_BEGIN, EEPROM_ID_BYTE_NUMBER);
|
|
|
|
return byteArray2UintBigEndian <quint32>(id);
|
|
}
|
|
|
|
quint32 TrxBoard::prbCtrlId() const
|
|
{
|
|
QByteArray id =
|
|
this->_bCtrlMngt->prbCtrlEepromRead(EEPROM_ID_BYTE_BEGIN, EEPROM_ID_BYTE_NUMBER);
|
|
|
|
return byteArray2UintBigEndian <quint32>(id);
|
|
}
|
|
|
|
quint32 TrxBoard::prbId(quint8 prbSel) const
|
|
{
|
|
QByteArray id = this->_bCtrlMngt->prbEepromRead(EEPROM_ID_BYTE_BEGIN,
|
|
EEPROM_ID_BYTE_NUMBER,
|
|
prbSel);
|
|
|
|
return byteArray2UintBigEndian <quint32>(id);
|
|
}
|
|
|
|
void TrxBoard::getConnectedPrbId(ConnectedPrbId* prbId) const
|
|
{
|
|
QVector<bool> vec;
|
|
QByteArray id;
|
|
vec.clear();
|
|
id.clear();
|
|
|
|
vec = this->_bCtrlMngt->getConnectedPrb();
|
|
|
|
for(quint8 i = 0; i < vec.size(); i++)
|
|
{
|
|
if(vec.at(i))
|
|
{
|
|
id = this->_bCtrlMngt->prbEepromRead(EEPROM_ID_BYTE_BEGIN, EEPROM_ID_BYTE_NUMBER, i);
|
|
}
|
|
else
|
|
{
|
|
id.append(nullptr);
|
|
}
|
|
|
|
switch(i)
|
|
{
|
|
case 0:
|
|
prbId->prbA = byteArray2UintBigEndian <quint32>(id);
|
|
break;
|
|
|
|
case 1:
|
|
prbId->prbB = byteArray2UintBigEndian <quint32>(id);
|
|
break;
|
|
|
|
case 2:
|
|
prbId->prbC = byteArray2UintBigEndian <quint32>(id);
|
|
break;
|
|
|
|
case 3:
|
|
prbId->prbD = byteArray2UintBigEndian <quint32>(id);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
QString TrxBoard::trxInfo() const
|
|
{
|
|
QString str =
|
|
QString(this->_bCtrlMngt->trxEepromRead(EEPROM_INFO_BYTE_BEGIN, EEPROM_INFO_BYTE_NUMBER));
|
|
|
|
return str;
|
|
}
|
|
|
|
QString TrxBoard::mpsInfo() const
|
|
{
|
|
QString str =
|
|
QString(this->_bCtrlMngt->mpsEepromRead(EEPROM_INFO_BYTE_BEGIN, EEPROM_INFO_BYTE_NUMBER));
|
|
|
|
return str;
|
|
}
|
|
|
|
QString TrxBoard::prbCtrlInfo() const
|
|
{
|
|
QString str =
|
|
QString(this->_bCtrlMngt->prbCtrlEepromRead(EEPROM_INFO_BYTE_BEGIN,
|
|
EEPROM_INFO_BYTE_NUMBER));
|
|
|
|
return str;
|
|
}
|
|
|
|
QByteArray TrxBoard::prbInfo(quint8 prbSel) const
|
|
{
|
|
return this->_bCtrlMngt->prbEepromRead(EEPROM_INFO_BYTE_BEGIN, EEPROM_INFO_BYTE_NUMBER, prbSel);
|
|
}
|
|
|
|
void TrxBoard::getConnectedPrbInfo(ConnectedPrbInfo* prbInfo) const
|
|
{
|
|
QByteArray info;
|
|
QVector<bool> vec;
|
|
info.clear();
|
|
vec.clear();
|
|
|
|
vec = this->_bCtrlMngt->getConnectedPrb();
|
|
|
|
for(quint8 i = 0; i < vec.size(); i++)
|
|
{
|
|
if(vec.at(i))
|
|
{
|
|
info = this->_bCtrlMngt->prbEepromRead(EEPROM_INFO_BYTE_BEGIN,
|
|
EEPROM_INFO_BYTE_NUMBER,
|
|
i);
|
|
}
|
|
else
|
|
{
|
|
info.append(nullptr);
|
|
}
|
|
|
|
switch(i)
|
|
{
|
|
case 0:
|
|
prbInfo->prbA = info;
|
|
break;
|
|
|
|
case 1:
|
|
prbInfo->prbB = info;
|
|
break;
|
|
|
|
case 2:
|
|
prbInfo->prbC = info;
|
|
break;
|
|
|
|
case 3:
|
|
prbInfo->prbD = info;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
void TrxBoard::supervisorRbValue(SupervisorRbValue* sValue) const
|
|
{
|
|
this->_bCtrlMngt->getSupervisorValue(sValue);
|
|
}
|
|
|
|
void TrxBoard::mpsFaultStatus(MpsFaultStatus* faultStatus) const
|
|
{
|
|
this->_bCtrlMngt->getMpsFault(faultStatus);
|
|
}
|
|
|
|
void TrxBoard::mpsPwrOn() const
|
|
{
|
|
this->_bCtrlMngt->mpsInit();
|
|
}
|
|
|
|
void TrxBoard::mpsPwrOff() const
|
|
{
|
|
this->_bCtrlMngt->mpsDeInit();
|
|
}
|
|
|
|
void TrxBoard::mpsReset() const
|
|
{
|
|
this->_bCtrlMngt->setMpsReset();
|
|
}
|
|
|
|
void TrxBoard::mpsSetAo(float voltA, float voltB) const
|
|
{
|
|
this->_bCtrlMngt->mpsHvSet(voltA, voltB);
|
|
}
|
|
|
|
void TrxBoard::selectProbe(eSelectProbe prbSel) const
|
|
{
|
|
this->_bCtrlMngt->setProbeSelect(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;
|
|
}
|
|
|
|
void TrxBoard::mcsProgram(QString path)
|
|
{
|
|
QFile mcsFile(path);
|
|
|
|
if(mcsFile.fileName().isEmpty())
|
|
{
|
|
throw SonoException("No file is selected");
|
|
}
|
|
|
|
if(!mcsFile.open(QIODevice::ReadOnly))
|
|
{
|
|
throw SonoException("Couldn't open mcs file programming");
|
|
}
|
|
|
|
QByteArray mcsFileData = mcsFile.readAll();
|
|
this->_bpiFlash->writeMcs(mcsFileData);
|
|
|
|
mcsFileData.clear();
|
|
mcsFile.close();
|
|
|
|
scenParamsFilling(clear);
|
|
}
|
|
|
|
void TrxBoard::mcsVerify(QString path) const
|
|
{
|
|
QFile mcsFile(path);
|
|
|
|
if(mcsFile.fileName().isEmpty())
|
|
{
|
|
throw SonoException("No file is selected");
|
|
}
|
|
|
|
if(!mcsFile.open(QIODevice::WriteOnly))
|
|
{
|
|
throw SonoException("Couldn't open mcs file programming");
|
|
}
|
|
|
|
QTextStream save(&mcsFile);
|
|
|
|
(*_mcsList).clear();
|
|
this->_bpiFlash->readMcs(_mcsList);
|
|
|
|
for(auto i = 0; i < MCS_FILE_SIZE; i++)
|
|
{
|
|
save << (*_mcsList).at(i);
|
|
}
|
|
mcsFile.flush();
|
|
mcsFile.close();
|
|
}
|
|
|
|
void TrxBoard::getTrxStatus(StatusVec* status) const
|
|
{
|
|
this->_misc->getStatusVector(status);
|
|
}
|
|
|
|
void TrxBoard::getFpgasCodeVersion(FpgaCodeVersion* version) const
|
|
{
|
|
this->_misc->getFpgaVersion(version);
|
|
}
|
|
|