|
|
@ -56,17 +56,27 @@ bool HonaLowLevelAPI::isHiruStarted() |
|
|
|
void HonaLowLevelAPI::deviceReset() |
|
|
|
{ |
|
|
|
if(!plxWrapper.deviceReset()) |
|
|
|
throw HonaAlreadyStartedException("reset Doesnt Occur"); |
|
|
|
throw HonaAlreadyStartedException("Reset Doesnt Occur"); |
|
|
|
} |
|
|
|
|
|
|
|
/*************************************************************************************************/ |
|
|
|
void HonaLowLevelAPI::setConfig(HonaSettings& settings) |
|
|
|
{ |
|
|
|
plxWrapper.deviceReadRegister(0x10000000, honaRegisterBuffer, 8); |
|
|
|
if(!plxWrapper.deviceReadRegister(0x10000000, honaRegisterBuffer, 8)) |
|
|
|
{ |
|
|
|
throw HonaAlreadyStartedException("DeviceReadRegister Doesnt Occur"); |
|
|
|
} |
|
|
|
_honaSetting = settings; |
|
|
|
writeSettingToRegisters(settings); |
|
|
|
plxWrapper.deviceWriteRegister(0x10000000, honaRegisterBuffer); |
|
|
|
plxWrapper.deviceReadRegister(0x10000000, honaRegisterBuffer, 8); |
|
|
|
if(!plxWrapper.deviceWriteRegister(0x10000000, honaRegisterBuffer)) |
|
|
|
{ |
|
|
|
throw HonaAlreadyStartedException("DeviceWriteRegister Doesnt Occur"); |
|
|
|
} |
|
|
|
|
|
|
|
if(!plxWrapper.deviceReadRegister(0x10000000, honaRegisterBuffer, 8)) |
|
|
|
{ |
|
|
|
throw HonaAlreadyStartedException("DeviceReadRegister Doesnt Occur"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/*************************************************************************************************/ |
|
|
@ -92,7 +102,7 @@ QString HonaLowLevelAPI::getDeviceId() |
|
|
|
void HonaLowLevelAPI::hsruStart() |
|
|
|
{ |
|
|
|
if(!isHsruStarted()) |
|
|
|
throw HonaAlreadyStartedException("HsruStarted doesn't started "); |
|
|
|
throw HonaException("HsruStarted doesn't started "); |
|
|
|
QtConcurrent::run(this, &HonaLowLevelAPI::hsruMainThread); |
|
|
|
setHsruIsStarted(true); |
|
|
|
} |
|
|
@ -101,14 +111,26 @@ void HonaLowLevelAPI::hsruStart() |
|
|
|
void HonaLowLevelAPI::hiruStart() |
|
|
|
{ |
|
|
|
if(!isHiruStarted()) |
|
|
|
throw HonaAlreadyStartedException("HiruStarted doesn't started "); |
|
|
|
throw HonaException("HiruStarted doesn't started "); |
|
|
|
QtConcurrent::run(this, &HonaLowLevelAPI::hiruMainThread); |
|
|
|
setHiruIsStarted(true); |
|
|
|
} |
|
|
|
|
|
|
|
/*************************************************************************************************/ |
|
|
|
void HonaLowLevelAPI::hsruStop() |
|
|
|
{ |
|
|
|
if(isHiruStarted()) |
|
|
|
setHsruIsStarted(false); |
|
|
|
_hsruStopEvent.wakeAll(); |
|
|
|
} |
|
|
|
|
|
|
|
/*************************************************************************************************/ |
|
|
|
void HonaLowLevelAPI::init() |
|
|
|
{ |
|
|
|
if(!plxWrapper.deviceInit(0X9054)) |
|
|
|
{ |
|
|
|
throw HonaAlreadyStartedException("Init Doesnt Occur"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/*************************************************************************************************/ |
|
|
@ -160,7 +182,10 @@ void HonaLowLevelAPI::hsruMainThread() |
|
|
|
deviceReset(); |
|
|
|
setConfig(); |
|
|
|
deviceReset(); |
|
|
|
plxWrapper.deviceEnableInterrupt(); |
|
|
|
if(!plxWrapper.deviceEnableInterrupt()) |
|
|
|
{ |
|
|
|
throw HonaAlreadyStartedException("DeviceEnableInterrupt Doesnt Occur"); |
|
|
|
} |
|
|
|
|
|
|
|
QtConcurrent::run(this, &HonaLowLevelAPI::hsruReadThread); |
|
|
|
QtConcurrent::run(this, &HonaLowLevelAPI::hsruUpdateThread); |
|
|
@ -169,7 +194,7 @@ void HonaLowLevelAPI::hsruMainThread() |
|
|
|
{ |
|
|
|
_isHsruReaderThreadFree = true; |
|
|
|
_isHsruUpdateThreadFree = true; |
|
|
|
setHiruIsStarted(false); |
|
|
|
hsruStop(); |
|
|
|
} |
|
|
|
|
|
|
|
_mutex.lock(); |
|
|
@ -178,7 +203,10 @@ void HonaLowLevelAPI::hsruMainThread() |
|
|
|
_isHsruReaderThreadFree = true; |
|
|
|
_isHsruUpdateThreadFree = true; |
|
|
|
|
|
|
|
plxWrapper.deviceDisableInterrupt(); |
|
|
|
if(!plxWrapper.deviceDisableInterrupt()) |
|
|
|
{ |
|
|
|
throw HonaAlreadyStartedException("DeviceEnableInterrupt Doesnt Occur"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/*************************************************************************************************/ |
|
|
@ -190,10 +218,16 @@ void HonaLowLevelAPI::hsruReadThread() |
|
|
|
if(_isHsruReaderThreadFree) |
|
|
|
break; |
|
|
|
|
|
|
|
plxWrapper.deviceWaitForInterrupt(1000); |
|
|
|
if(!plxWrapper.deviceWaitForInterrupt(1000)) |
|
|
|
{ |
|
|
|
throw HonaAlreadyStartedException("DeviceWaitForInterrupt Doesnt Occur"); |
|
|
|
} |
|
|
|
honaPacketList.clear(); |
|
|
|
_hsruLoss = 0; |
|
|
|
plxWrapper.deviceOpenPCIChannel(); |
|
|
|
if(!plxWrapper.deviceOpenPCIChannel()) |
|
|
|
{ |
|
|
|
throw HonaAlreadyStartedException("DeviceOpenPCIChannel Doesnt Occur"); |
|
|
|
} |
|
|
|
|
|
|
|
_hsruLoss += hsruParserInt123C(hsruReadHonaBuffer(honaReceivers::int123C), |
|
|
|
honaPacketList); |
|
|
@ -205,8 +239,14 @@ void HonaLowLevelAPI::hsruReadThread() |
|
|
|
_hsruLoss += hsruParserRes4(hsruReadHonaBuffer(honaReceivers::res4), honaPacketList); |
|
|
|
_hsruLoss += hsruParserSinglePulse(hsruReadHonaBuffer(honaReceivers::singlePulse), |
|
|
|
honaPacketList); |
|
|
|
plxWrapper.deviceClosePCIChannel(); |
|
|
|
plxWrapper.deviceEnableInterrupt(); |
|
|
|
if(!plxWrapper.deviceClosePCIChannel()) |
|
|
|
{ |
|
|
|
throw HonaAlreadyStartedException("DeviceClosePCIChannel Doesnt Occur"); |
|
|
|
} |
|
|
|
if(!plxWrapper.deviceEnableInterrupt()) |
|
|
|
{ |
|
|
|
throw HonaAlreadyStartedException("DeviceEnableInterrupt Doesnt Occur"); |
|
|
|
} |
|
|
|
|
|
|
|
_mutex.lock(); |
|
|
|
_hsruReadDone.wakeAll(); |
|
|
@ -242,9 +282,6 @@ void HonaLowLevelAPI::hiruMainThread() |
|
|
|
_mutex.lock(); |
|
|
|
_hsruStopEvent.wait(&_mutex); |
|
|
|
_mutex.unlock(); |
|
|
|
|
|
|
|
//_isReaderThreadFree = true;
|
|
|
|
//_isUpdateThreadFree = true;
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -262,7 +299,10 @@ void HonaLowLevelAPI::hiruUpdateThread() |
|
|
|
quint32 HonaLowLevelAPI::hiruGetDOA() |
|
|
|
{ |
|
|
|
quint32 Doa = 0; |
|
|
|
plxWrapper.deviceReadRegister(0x30000004, Doa); |
|
|
|
if(!plxWrapper.deviceReadRegister(0x30000004, Doa)) |
|
|
|
{ |
|
|
|
throw HonaAlreadyStartedException("DeviceReadRegister Doesnt Occur"); |
|
|
|
} |
|
|
|
Doa = Doa & 0x0000FFFF; |
|
|
|
|
|
|
|
return Doa; |
|
|
@ -711,7 +751,7 @@ quint32 HonaLowLevelAPI::hsruParserInt4(const QVector<quint32>& honaData, |
|
|
|
tempHonaPacketInt4.setCodeL(tempHonaPacketInt4.getCodeL() + |
|
|
|
((static_cast<qulonglong>(honaData.at(Ind) & 0x000F0000)) << |
|
|
|
12)); |
|
|
|
tempHonaPacketInt4.M4Status = ((byte)((honaData.at(Ind) & 0x0F000000) >> 20)); |
|
|
|
tempHonaPacketInt4.setm4Status((quint8)((honaData.at(Ind) & 0x0F000000) >> 20)); |
|
|
|
nextInt4 = 7; |
|
|
|
} |
|
|
|
else if(honaData.at(Ind) == 0xEEEEEEEE) |
|
|
@ -912,7 +952,10 @@ QVector<quint32> HonaLowLevelAPI::hsruReadHonaBuffer(honaReceivers receiver) |
|
|
|
else |
|
|
|
throw HonaException("honaReceivers is Not Valid"); |
|
|
|
|
|
|
|
plxWrapper.deviceReadMemory(address, honaData, honaData.size()); |
|
|
|
if(!plxWrapper.deviceReadMemory(address, honaData, honaData.size())) |
|
|
|
{ |
|
|
|
throw HonaAlreadyStartedException("DeviceReadMemory Doesnt Occur"); |
|
|
|
} |
|
|
|
|
|
|
|
return honaData; |
|
|
|
} |
|
|
|