|
|
@ -5,7 +5,6 @@ |
|
|
|
#include "qdebug.h" |
|
|
|
#include "QTime" |
|
|
|
#include "QtConcurrent/QtConcurrent" |
|
|
|
PlxWrapper plx; |
|
|
|
|
|
|
|
bool HonaLowLevelAPI::getHsruIsStarted() const |
|
|
|
{ |
|
|
@ -126,33 +125,34 @@ void HonaLowLevelAPI::init() |
|
|
|
/*************************************************************************************************/ |
|
|
|
void HonaLowLevelAPI::writeSettingToRegisters(HonaSettings& settings) |
|
|
|
{ |
|
|
|
honaRegisterBuffer[0] = 0x00000000; |
|
|
|
/************************************************************************/ |
|
|
|
if(settings.hiruSettings.recordStard == recorderStart::selfTestCounter) |
|
|
|
honaRegisterBuffer[0] = 0x80000000; |
|
|
|
else |
|
|
|
honaRegisterBuffer[0] = 0x7FFFFFFF; |
|
|
|
/************************************************************************/ |
|
|
|
if(settings.hiruSettings.recordChannel == drxDeviceIfChannel::ifChannel12) |
|
|
|
honaRegisterBuffer[0] = 0x20000000; |
|
|
|
else |
|
|
|
honaRegisterBuffer[0] = 0xDFFFFFFF; |
|
|
|
/************************************************************************/ |
|
|
|
if(settings.hiruSettings.recordMode == recorderMode::dualChannel) |
|
|
|
honaRegisterBuffer[0] = 0x10000000; |
|
|
|
else |
|
|
|
honaRegisterBuffer[0] = 0xEFFFFFFF; |
|
|
|
/************************************************************************/ |
|
|
|
|
|
|
|
honaRegisterBuffer[0] += (settings.hiruSettings.threshold & 0x00000FFF); |
|
|
|
|
|
|
|
honaRegisterBuffer[1] = settings.hsruSettings.honaInt123CTHR; |
|
|
|
honaRegisterBuffer[2] = settings.hsruSettings.honaRes123CTHR; |
|
|
|
honaRegisterBuffer[3] = settings.hsruSettings.honaIntSTHR; |
|
|
|
honaRegisterBuffer[4] = settings.hsruSettings.honaResSTHR; |
|
|
|
honaRegisterBuffer[5] = settings.hsruSettings.honaSPTHR; |
|
|
|
honaRegisterBuffer[6] = settings.hsruSettings.intM4_THR; |
|
|
|
honaRegisterBuffer[7] = settings.hsruSettings.resM4_THR; |
|
|
|
honaRegisterBuffer.clear(); |
|
|
|
honaRegisterBuffer.insert(0,0x00000000); |
|
|
|
/************************************************************************/ |
|
|
|
if(settings.hiruSettings.recordStard == recorderStart::selfTestCounter) |
|
|
|
honaRegisterBuffer.insert(0,0x80000000); |
|
|
|
else |
|
|
|
honaRegisterBuffer.insert(0,0x7FFFFFFF); |
|
|
|
/************************************************************************/ |
|
|
|
if(settings.hiruSettings.recordChannel == drxDeviceIfChannel::ifChannel12) |
|
|
|
honaRegisterBuffer.insert(0,0x20000000); |
|
|
|
else |
|
|
|
honaRegisterBuffer.insert(0,0xDFFFFFFF); |
|
|
|
/************************************************************************/ |
|
|
|
if(settings.hiruSettings.recordMode == recorderMode::dualChannel) |
|
|
|
honaRegisterBuffer.insert(0,0x10000000); |
|
|
|
else |
|
|
|
honaRegisterBuffer.insert(0,0xEFFFFFFF); |
|
|
|
/************************************************************************/ |
|
|
|
|
|
|
|
honaRegisterBuffer.insert(0,(honaRegisterBuffer.at(0)+ (settings.hiruSettings.threshold & 0x00000FFF))); |
|
|
|
|
|
|
|
honaRegisterBuffer.insert(1,settings.hsruSettings.honaInt123CTHR); |
|
|
|
honaRegisterBuffer.insert(2,settings.hsruSettings.honaRes123CTHR); |
|
|
|
honaRegisterBuffer.insert(3,settings.hsruSettings.honaIntSTHR); |
|
|
|
honaRegisterBuffer.insert(4,settings.hsruSettings.honaResSTHR); |
|
|
|
honaRegisterBuffer.insert(5,settings.hsruSettings.honaSPTHR); |
|
|
|
honaRegisterBuffer.insert(6,settings.hsruSettings.intM4_THR); |
|
|
|
honaRegisterBuffer.insert(7,settings.hsruSettings.resM4_THR); |
|
|
|
} |
|
|
|
|
|
|
|
/*************************************************************************************************/ |
|
|
@ -210,3 +210,147 @@ int HonaLowLevelAPI::hiruGetDOA() |
|
|
|
} |
|
|
|
|
|
|
|
/*************************************************************************************************/ |
|
|
|
/*************************************************************************************************/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void HonaLowLevelAPI::hsruReaderMethod() |
|
|
|
{ |
|
|
|
DateTime dtStartSim = DateTime.Now; |
|
|
|
hsruLoss = 0; |
|
|
|
while (true) |
|
|
|
{ |
|
|
|
if (_honaSettings.hsruSettings.isReal) |
|
|
|
{ |
|
|
|
plxwrapper.deviceWaitForInterrupt(1000); |
|
|
|
honaPacketList.clear(); |
|
|
|
hsruLoss = 0; |
|
|
|
plxwrapper.deviceOpenPCIChannel(); |
|
|
|
hsruLoss += hsruParserInt123C(hsruReadHonaBuffer(honaReceivers::int123C),&honaPacketList); |
|
|
|
hsruLoss += hsruParserRes123C(hsruReadHonaBuffer(honaReceivers::res123C),&honaPacketList); |
|
|
|
hsruLoss += hsruParserIntS(hsruReadHonaBuffer(honaReceivers::intS),&honaPacketList); |
|
|
|
hsruLoss += hsruParserResS(hsruReadHonaBuffer(honaReceivers::resS),&honaPacketList); |
|
|
|
hsruLoss += hsruParserInt4(hsruReadHonaBuffer(honaReceivers::int4),&honaPacketList); |
|
|
|
hsruLoss += hsruParserRes4(hsruReadHonaBuffer(honaReceivers::res4),&honaPacketList); |
|
|
|
hsruLoss += hsruParserSinglePulse(hsruReadHonaBuffer(honaReceivers::singlePulse),&honaPacketList); |
|
|
|
plxwrapper.deviceClosePCIChannel(); |
|
|
|
plxwrapper.deviceEnableInterrupt(); |
|
|
|
} |
|
|
|
|
|
|
|
hsruReadDone.Set(); |
|
|
|
hsruUpdateAck.WaitOne(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/*************************************************************************************************/ |
|
|
|
QVector<quint32> HonaLowLevelAPI::hsruReadHonaBuffer(honaReceivers receiver) |
|
|
|
{ |
|
|
|
QVector<quint32> honaData; |
|
|
|
honaData.resize(16384); |
|
|
|
quint32 address = 0; |
|
|
|
|
|
|
|
if (receiver == honaReceivers::int123C) |
|
|
|
address = 0X50000000; |
|
|
|
else if (receiver == honaReceivers::res123C) |
|
|
|
address = 0X60000000; |
|
|
|
else if (receiver == honaReceivers::intS) |
|
|
|
address = 0X70000000; |
|
|
|
else if (receiver == honaReceivers::resS) |
|
|
|
address = 0X80000000; |
|
|
|
else if (receiver == honaReceivers::int4)// Mode4 :: added by H.H
|
|
|
|
address = 0X90000000; |
|
|
|
else if (receiver == honaReceivers::res4)// Mode4 :: added by H.H
|
|
|
|
address = 0XA0000000; |
|
|
|
else if (receiver == honaReceivers::singlePulse)// Mode4 :: added by H.H
|
|
|
|
address = 0XB0000000; |
|
|
|
|
|
|
|
else |
|
|
|
return false; |
|
|
|
|
|
|
|
plxwrapper.deviceReadMemory(address, honaData,honaData.size()); |
|
|
|
|
|
|
|
//TODO for test (Debug)
|
|
|
|
WriteToFile(Receiver, honaData); |
|
|
|
|
|
|
|
return honaData; |
|
|
|
} |
|
|
|
/*************************************************************************************************/ |
|
|
|
|
|
|
|
quint32 hsruParserInt123C(QVector<quint32> honaData,QList<HonaPacket> honaPacketList) |
|
|
|
{ |
|
|
|
quint32 lossFound; |
|
|
|
for (quint32 Ind = 0; Ind < honaData.length(); Ind++) |
|
|
|
{ |
|
|
|
if ((honaData.at(Ind) & 0xFF000000) == 0x0F000000) |
|
|
|
{ |
|
|
|
HonaPacket tempHonaPacketInt123C; |
|
|
|
tempHonaPacketInt123C.setPacketType(honaPacketType.InterrogationMode123C); |
|
|
|
packetLenInt123C = 6; |
|
|
|
TempHonaPacketInt123C.PacketNumber = HonaData[Ind] & 0x0000FFFF; |
|
|
|
if ((TempHonaPacketInt123C.PacketNumber != (LastPNInt123C + 1)) & (LastPNInt123C > 0)) |
|
|
|
// & (LastPNInt123C != 65535))
|
|
|
|
{ |
|
|
|
LossFound += ((TempHonaPacketInt123C.PacketNumber - LastPNInt123C + 65536)%65536 - 1); |
|
|
|
} |
|
|
|
LastPNInt123C = TempHonaPacketInt123C.PacketNumber; |
|
|
|
if (NextInt123C > 0) |
|
|
|
LossFound++; |
|
|
|
NextInt123C = 1; |
|
|
|
} |
|
|
|
else if (((HonaData[Ind] & 0xF0000000) == 0x10000000) && (NextInt123C == 1)) |
|
|
|
{ |
|
|
|
TempHonaPacketInt123C.TOA = (ulong) (HonaData[Ind] & 0x0FFFFFFF); |
|
|
|
NextInt123C = 2; |
|
|
|
} |
|
|
|
else if (((HonaData[Ind] & 0xF0000000) == 0x20000000) && (NextInt123C == 2)) |
|
|
|
{ |
|
|
|
TempHonaPacketInt123C.TOA += (((ulong) (HonaData[Ind] & 0x0000FFFF)) << 28); |
|
|
|
TempHonaPacketInt123C.PA2 = ((HonaData[Ind] & 0x0FFF0000) >> 16); |
|
|
|
NextInt123C = 3; |
|
|
|
} |
|
|
|
else if (((HonaData[Ind] & 0xF0000000) == 0x30000000) && (NextInt123C == 3)) |
|
|
|
{ |
|
|
|
TempHonaPacketInt123C.DOA = (HonaData[Ind] & 0x0000FFFF); |
|
|
|
TempHonaPacketInt123C.PA3 = ((HonaData[Ind] & 0x0FFF0000) >> 16); |
|
|
|
NextInt123C = 4; |
|
|
|
} |
|
|
|
else if (((HonaData[Ind] & 0xF0000000) == 0x40000000) && (NextInt123C == 4)) |
|
|
|
{ |
|
|
|
TempHonaPacketInt123C.PA1 = (HonaData[Ind] & 0x0000FFFF); |
|
|
|
TempHonaPacketInt123C.PA2 += ((HonaData[Ind] & 0x000F0000) >> 4); |
|
|
|
TempHonaPacketInt123C.PA3 += ((HonaData[Ind] & 0x00F00000) >> 8); |
|
|
|
NextInt123C = 5; |
|
|
|
} |
|
|
|
else if (((HonaData[Ind] & 0xF0000000) == 0x50000000) && (NextInt123C == 5)) |
|
|
|
{ |
|
|
|
TempHonaPacketInt123C.CodeM = ((ulong) (HonaData[Ind] & 0x0000001F)) << 59; |
|
|
|
TempHonaPacketInt123C.CodeL = 0; |
|
|
|
NextInt123C = 6; |
|
|
|
} |
|
|
|
else if (HonaData[Ind] == 0xEEEEEEEE) |
|
|
|
{ |
|
|
|
//Console.Write("-");
|
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
//Console.Write(".");
|
|
|
|
} |
|
|
|
|
|
|
|
if (NextInt123C == PacketLenInt123C) |
|
|
|
{ |
|
|
|
if (Isvalid(TempHonaPacketInt123C)) |
|
|
|
{ |
|
|
|
TempHonaPacketInt123C.TOA = (TempHonaPacketInt123C.TOA/8)/SimulationSpeed + toaStartBoard; |
|
|
|
//toa converted to 100nsec
|
|
|
|
HonaPacketList.Add(TempHonaPacketInt123C); |
|
|
|
} |
|
|
|
NextInt123C = 0; |
|
|
|
} |
|
|
|
} |
|
|
|
return LossFound; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|