|
|
@ -138,9 +138,6 @@ void HonaLowLevelAPI::hiruStart() |
|
|
|
/*************************************************************************************************/ |
|
|
|
void HonaLowLevelAPI::hsruStop() |
|
|
|
{ |
|
|
|
if(_hsruIsStarted) |
|
|
|
_hsruIsStarted = false; |
|
|
|
|
|
|
|
_hsruStopEvent.wakeAll(); |
|
|
|
} |
|
|
|
|
|
|
@ -158,6 +155,11 @@ void HonaLowLevelAPI::init() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
bool HonaLowLevelAPI::isHsruStarted() |
|
|
|
{ |
|
|
|
return _hsruIsStarted; |
|
|
|
} |
|
|
|
|
|
|
|
/*************************************************************************************************/ |
|
|
|
void HonaLowLevelAPI::writeSettingToRegisters(HonaSettings& settings) |
|
|
|
{ |
|
|
@ -204,6 +206,7 @@ void HonaLowLevelAPI::hsruMainThread() |
|
|
|
deviceReset(); |
|
|
|
setConfig(); |
|
|
|
deviceReset(); |
|
|
|
|
|
|
|
if(!plxWrapper.deviceEnableInterrupt()) |
|
|
|
{ |
|
|
|
throw HonaException(); |
|
|
@ -215,13 +218,18 @@ void HonaLowLevelAPI::hsruMainThread() |
|
|
|
QtConcurrent::run(this, &HonaLowLevelAPI::hsruReadThread); |
|
|
|
QtConcurrent::run(this, &HonaLowLevelAPI::hsruUpdateThread); |
|
|
|
|
|
|
|
_mutex.lock(); |
|
|
|
_hsruStopEvent.wait(&_mutex); |
|
|
|
_mutex.unlock(); |
|
|
|
_mainMutex.lock(); |
|
|
|
_hsruStopEvent.wait(&_mainMutex); |
|
|
|
_mainMutex.unlock(); |
|
|
|
|
|
|
|
_isHsruReaderThreadFree = true; |
|
|
|
_isHsruUpdateThreadFree = true; |
|
|
|
|
|
|
|
_hsruReadDone.wakeAll(); |
|
|
|
_hsruUpdateAck.wakeAll(); |
|
|
|
|
|
|
|
_hsruIsStarted = false; |
|
|
|
|
|
|
|
if(!plxWrapper.deviceDisableInterrupt()) |
|
|
|
{ |
|
|
|
throw HonaException(); |
|
|
@ -241,8 +249,8 @@ void HonaLowLevelAPI::hsruReadThread() |
|
|
|
{ |
|
|
|
throw HonaException(); |
|
|
|
} |
|
|
|
honaPacketList.clear(); |
|
|
|
_hsruLoss = 0; |
|
|
|
|
|
|
|
|
|
|
|
if(!plxWrapper.deviceOpenPCIChannel()) |
|
|
|
{ |
|
|
|
throw HonaException(); |
|
|
@ -250,11 +258,11 @@ void HonaLowLevelAPI::hsruReadThread() |
|
|
|
|
|
|
|
_hsruLoss += hsruParserInt123C(hsruReadHonaBuffer(honaReceivers::int123C), honaPacketList); |
|
|
|
_hsruLoss += hsruParserRes123C(hsruReadHonaBuffer(honaReceivers::res123C), honaPacketList); |
|
|
|
_hsruLoss += hsruParserIntS(hsruReadHonaBuffer(honaReceivers::intS), 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); |
|
|
|
// _hsruLoss += hsruParserInt4(hsruReadHonaBuffer(honaReceivers::int4), honaPacketList);
|
|
|
|
// _hsruLoss += hsruParserRes4(hsruReadHonaBuffer(honaReceivers::res4), honaPacketList);
|
|
|
|
// _hsruLoss += hsruParserSinglePulse(hsruReadHonaBuffer(honaReceivers::singlePulse),honaPacketList);
|
|
|
|
|
|
|
|
if(!plxWrapper.deviceClosePCIChannel()) |
|
|
|
{ |
|
|
@ -264,11 +272,11 @@ void HonaLowLevelAPI::hsruReadThread() |
|
|
|
{ |
|
|
|
throw HonaException(); |
|
|
|
} |
|
|
|
QThread::usleep(200000); |
|
|
|
_mutex.lock(); |
|
|
|
|
|
|
|
_readMutex.lock(); |
|
|
|
_hsruReadDone.wakeAll(); |
|
|
|
_hsruUpdateAck.wait(&_mutex); |
|
|
|
_mutex.unlock(); |
|
|
|
_hsruUpdateAck.wait(&_readMutex); |
|
|
|
_readMutex.unlock(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -277,14 +285,19 @@ void HonaLowLevelAPI::hsruUpdateThread() |
|
|
|
{ |
|
|
|
while(true) |
|
|
|
{ |
|
|
|
_mutex.lock(); |
|
|
|
_hsruReadDone.wait(&_mutex); |
|
|
|
_mutex.unlock(); |
|
|
|
if(_isHsruUpdateThreadFree) |
|
|
|
break; |
|
|
|
|
|
|
|
_updateMutex.lock(); |
|
|
|
_hsruReadDone.wait(&_updateMutex); |
|
|
|
_updateMutex.unlock(); |
|
|
|
|
|
|
|
quint32 Doa = 0; |
|
|
|
Doa = hiruGetDOA(); |
|
|
|
emit lowLevelHonaData(honaPacketList, _hsruLoss, Doa); |
|
|
|
_hsruLoss = 0; |
|
|
|
honaPacketList.clear(); |
|
|
|
QThread::usleep(200000); |
|
|
|
_hsruUpdateAck.wakeAll(); |
|
|
|
} |
|
|
|
} |
|
|
@ -292,14 +305,7 @@ void HonaLowLevelAPI::hsruUpdateThread() |
|
|
|
/*************************************************************************************************/ |
|
|
|
void HonaLowLevelAPI::hiruMainThread() |
|
|
|
{ |
|
|
|
QtConcurrent::run(this, &HonaLowLevelAPI::hiruReadThread); |
|
|
|
QtConcurrent::run(this, &HonaLowLevelAPI::hiruUpdateThread); |
|
|
|
while(true) |
|
|
|
{ |
|
|
|
_mutex.lock(); |
|
|
|
_hsruStopEvent.wait(&_mutex); |
|
|
|
_mutex.unlock(); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/*************************************************************************************************/ |
|
|
|