|
|
@ -1,5 +1,3 @@ |
|
|
|
<<<<<<< HEAD |
|
|
|
|
|
|
|
#include <include/LowLevel/Utils/Utils.h> |
|
|
|
#include "include/LowLevel/HonaLowLevelAPI.h" |
|
|
|
#include "include/Wrapper/PlxWrapper.h" |
|
|
@ -11,25 +9,25 @@ PlxWrapper plx; |
|
|
|
|
|
|
|
bool HonaLowLevelAPI::getHsruIsStarted() const |
|
|
|
{ |
|
|
|
return _hsruIsStarted; |
|
|
|
return _hsruIsStarted; |
|
|
|
} |
|
|
|
|
|
|
|
/*************************************************************************************************/ |
|
|
|
void HonaLowLevelAPI::setHsruIsStarted(bool hsruIsStarted) |
|
|
|
{ |
|
|
|
_hsruIsStarted = hsruIsStarted; |
|
|
|
_hsruIsStarted = hsruIsStarted; |
|
|
|
} |
|
|
|
|
|
|
|
/*************************************************************************************************/ |
|
|
|
bool HonaLowLevelAPI::getHiruIsStarted() const |
|
|
|
{ |
|
|
|
return _hiruIsStarted; |
|
|
|
return _hiruIsStarted; |
|
|
|
} |
|
|
|
|
|
|
|
/*************************************************************************************************/ |
|
|
|
void HonaLowLevelAPI::setHiruIsStarted(bool hiruIsStarted) |
|
|
|
{ |
|
|
|
_hiruIsStarted = hiruIsStarted; |
|
|
|
_hiruIsStarted = hiruIsStarted; |
|
|
|
} |
|
|
|
|
|
|
|
/*************************************************************************************************/ |
|
|
@ -40,55 +38,54 @@ HonaLowLevelAPI::HonaLowLevelAPI(QObject* parent) : QObject(parent) |
|
|
|
/*************************************************************************************************/ |
|
|
|
bool HonaLowLevelAPI::isHsruStarted() |
|
|
|
{ |
|
|
|
return getHsruIsStarted(); |
|
|
|
return getHsruIsStarted(); |
|
|
|
} |
|
|
|
|
|
|
|
/*************************************************************************************************/ |
|
|
|
bool HonaLowLevelAPI::isHiruStarted() |
|
|
|
{ |
|
|
|
return getHiruIsStarted(); |
|
|
|
return getHiruIsStarted(); |
|
|
|
} |
|
|
|
|
|
|
|
/*************************************************************************************************/ |
|
|
|
void HonaLowLevelAPI::deviceReset() |
|
|
|
{ |
|
|
|
ApiResult status; |
|
|
|
if(ApiResult::success) |
|
|
|
{ |
|
|
|
|
|
|
|
} |
|
|
|
/*
|
|
|
|
QTime t; |
|
|
|
t.elapsed() |
|
|
|
//ApiResult status;
|
|
|
|
//if(ApiResult::success)
|
|
|
|
//{
|
|
|
|
//}
|
|
|
|
/*
|
|
|
|
QTime t; |
|
|
|
t.elapsed() |
|
|
|
|
|
|
|
PLX_STATUS status = base.DeviceReset(); |
|
|
|
qDebug() << "Board Reseted, status: " + status.ToString()); |
|
|
|
PLX_STATUS status = base.DeviceReset(); |
|
|
|
qDebug() << "Board Reseted, status: " + status.ToString()); |
|
|
|
|
|
|
|
if (status == PLX_STATUS.ApiSuccess) |
|
|
|
{ |
|
|
|
toaStartBoard = (ulong) (DateTime.Now.Ticks); |
|
|
|
return ApiResult.Success; |
|
|
|
} |
|
|
|
else |
|
|
|
return ApiResult.Error; */ |
|
|
|
if (status == PLX_STATUS.ApiSuccess) |
|
|
|
{ |
|
|
|
toaStartBoard = (ulong) (DateTime.Now.Ticks); |
|
|
|
return ApiResult.Success; |
|
|
|
} |
|
|
|
else |
|
|
|
return ApiResult.Error; */ |
|
|
|
} |
|
|
|
|
|
|
|
/*************************************************************************************************/ |
|
|
|
void HonaLowLevelAPI::setConfig(HonaSetting* honaSetting) |
|
|
|
{ |
|
|
|
//Initial State Checking
|
|
|
|
/*
|
|
|
|
HonaRegisterBuffer = new uint[8]; // Mode4 :: changed from 5 to 8 by H.H
|
|
|
|
DeviceReadRegisters(0x10000000, ref HonaRegisterBuffer); |
|
|
|
//Initial State Checking
|
|
|
|
/*
|
|
|
|
HonaRegisterBuffer = new uint[8]; // Mode4 :: changed from 5 to 8 by H.H
|
|
|
|
DeviceReadRegisters(0x10000000, ref HonaRegisterBuffer); |
|
|
|
|
|
|
|
_honaSetting = Settings; |
|
|
|
HonaFillRegisters(Settings); |
|
|
|
DeviceWriteRegisters(0x10000000, HonaRegisterBuffer); |
|
|
|
_honaSetting = Settings; |
|
|
|
HonaFillRegisters(Settings); |
|
|
|
DeviceWriteRegisters(0x10000000, HonaRegisterBuffer); |
|
|
|
|
|
|
|
HonaRegisterBuffer = new uint[8]; // Mode4 :: changed from 5 to 8 by H.H
|
|
|
|
DeviceReadRegisters(0x10000000, ref HonaRegisterBuffer); |
|
|
|
HonaRegisterBuffer = new uint[8]; // Mode4 :: changed from 5 to 8 by H.H
|
|
|
|
DeviceReadRegisters(0x10000000, ref HonaRegisterBuffer); |
|
|
|
|
|
|
|
return ApiResult.Success; */ |
|
|
|
return ApiResult.Success; */ |
|
|
|
} |
|
|
|
|
|
|
|
/*************************************************************************************************/ |
|
|
@ -105,24 +102,20 @@ QString HonaLowLevelAPI::getSwVersion() |
|
|
|
/*************************************************************************************************/ |
|
|
|
QString HonaLowLevelAPI::getDeviceId() |
|
|
|
{ |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/*************************************************************************************************/ |
|
|
|
void HonaLowLevelAPI::hsruStart() |
|
|
|
{ |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/*************************************************************************************************/ |
|
|
|
void HonaLowLevelAPI::hiruStart() |
|
|
|
{ |
|
|
|
if(isHiruStarted()) |
|
|
|
//exceptiom
|
|
|
|
|
|
|
|
if (isHiruStarted()) |
|
|
|
//exceptiom
|
|
|
|
|
|
|
|
QtConcurrent::run(this,&HonaLowLevelAPI::hsruMainThread); |
|
|
|
|
|
|
|
QtConcurrent::run(this, &HonaLowLevelAPI::hsruMainThread); |
|
|
|
} |
|
|
|
|
|
|
|
/*************************************************************************************************/ |
|
|
@ -131,36 +124,35 @@ void HonaLowLevelAPI::init() |
|
|
|
} |
|
|
|
|
|
|
|
/*************************************************************************************************/ |
|
|
|
void HonaLowLevelAPI::writeSettingToRegisters(honaSettings& settings) |
|
|
|
void HonaLowLevelAPI::writeSettingToRegisters(HonaSetting& 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[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[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[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; |
|
|
|
} |
|
|
|
|
|
|
|
/*************************************************************************************************/ |
|
|
@ -171,47 +163,45 @@ void HonaLowLevelAPI::setConfig() |
|
|
|
/*************************************************************************************************/ |
|
|
|
void HonaLowLevelAPI::hsruMainThread() |
|
|
|
{ |
|
|
|
QtConcurrent::run(this, &HonaLowLevelAPI::hsruReadThread); |
|
|
|
QtConcurrent::run(this, &HonaLowLevelAPI::hsruUpdateThread); |
|
|
|
QtConcurrent::run(this, &HonaLowLevelAPI::hsruReadThread); |
|
|
|
QtConcurrent::run(this, &HonaLowLevelAPI::hsruUpdateThread); |
|
|
|
|
|
|
|
_mutex.lock(); |
|
|
|
HsruStopEvent.wait(&_mutex); |
|
|
|
_mutex.unlock(); |
|
|
|
_mutex.lock(); |
|
|
|
_hsruStopEvent.wait(&_mutex); |
|
|
|
_mutex.unlock(); |
|
|
|
|
|
|
|
_isReaderThreadFree = true; |
|
|
|
_isUpdateThreadFree = true; |
|
|
|
_isReaderThreadFree = true; |
|
|
|
_isUpdateThreadFree = true; |
|
|
|
} |
|
|
|
|
|
|
|
/*************************************************************************************************/ |
|
|
|
void HonaLowLevelAPI::hsruReadThread() |
|
|
|
{ |
|
|
|
while (true) |
|
|
|
{ |
|
|
|
if (_isReaderThreadFree) |
|
|
|
break; |
|
|
|
//dosth
|
|
|
|
_mutex.lock(); |
|
|
|
HsruReadDone.wakeAll(); |
|
|
|
HsruUpdateAck.wait(&_mutex); |
|
|
|
_mutex.unlock(); |
|
|
|
} |
|
|
|
while(true) |
|
|
|
{ |
|
|
|
if(_isReaderThreadFree) |
|
|
|
break; |
|
|
|
//dosth
|
|
|
|
_mutex.lock(); |
|
|
|
_hsruReadDone.wakeAll(); |
|
|
|
_hsruUpdateAck.wait(&_mutex); |
|
|
|
_mutex.unlock(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/*************************************************************************************************/ |
|
|
|
void HonaLowLevelAPI::hsruUpdateThread() |
|
|
|
{ |
|
|
|
while (true) |
|
|
|
{ |
|
|
|
_mutex.lock(); |
|
|
|
HsruReadDone.wait(&_mutex); |
|
|
|
_mutex.unlock(); |
|
|
|
if (_isUpdateThreadFree) |
|
|
|
break; |
|
|
|
//dosth
|
|
|
|
HsruUpdateAck.wakeAll(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
while(true) |
|
|
|
{ |
|
|
|
_mutex.lock(); |
|
|
|
_hsruReadDone.wait(&_mutex); |
|
|
|
_mutex.unlock(); |
|
|
|
if(_isUpdateThreadFree) |
|
|
|
break; |
|
|
|
//dosth
|
|
|
|
_hsruUpdateAck.wakeAll(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/*************************************************************************************************/ |
|
|
|