Browse Source

delete Test2 folder

mehrabi
mehrabi 3 years ago
parent
commit
34d188c6c1
  1. 0
      .gitignore
  2. 19
      Plx/Plx.pro
  3. 0
      Plx/include/API/.gitKeep
  4. 0
      Plx/include/LowLevel/Exception/.gitKeep
  5. 0
      Plx/include/LowLevel/Exception/HonaAlreadyStartedException.h
  6. 0
      Plx/include/LowLevel/Exception/HonaBusyException.h
  7. 0
      Plx/include/LowLevel/Exception/HonaException.h
  8. 21
      Plx/include/LowLevel/HonaLowLevelAPI.h
  9. 0
      Plx/include/LowLevel/HonaPacket.h
  10. 0
      Plx/include/LowLevel/Setting/.gitKeep
  11. 0
      Plx/include/LowLevel/Setting/Setting.h
  12. 0
      Plx/include/LowLevel/Utils/.gitKeep
  13. 9
      Plx/include/LowLevel/Utils/Utils.h
  14. 0
      Plx/include/Wrapper/.gitKeep
  15. 45
      Plx/include/Wrapper/PlxWrapper.h
  16. 0
      Plx/src/API/.gitKeep
  17. 0
      Plx/src/LowLevel/.gitKeep
  18. 200
      Plx/src/LowLevel/HonaLowLevelAPI.cpp
  19. 0
      Plx/src/LowLevel/HonaPacket.cpp
  20. 0
      Plx/src/LowLevel/Setting/.gitKeep
  21. 0
      Plx/src/LowLevel/Utils/.gitKeep
  22. 0
      Plx/src/Wrapper/.gitKeep
  23. 0
      Plx/src/Wrapper/PlxWrapper.cpp
  24. 0
      PlxBoard.pro
  25. 0
      Test/MainWindow.cpp
  26. 0
      Test/MainWindow.h
  27. 0
      Test/MainWindow.ui
  28. 0
      Test/Test.pro
  29. 0
      Test/main.cpp

0
.gitignore

19
Plx/Plx.pro

@ -17,18 +17,27 @@ DEFINES += QT_DEPRECATED_WARNINGS
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \ SOURCES += \
$$files(*.cpp, true) \ \ $$files(*.cpp, true)
src/Wrapper/PlxWrapper.cpp
HEADERS += \ HEADERS += \
$$files(*.h, true) \ $$files(*.h, true)
INCLUDEPATH += $$PWD/include INCLUDEPATH += $$PWD/include
# Default rules for deployment. # Default rules for deployment.
unix { unix {
target.path = $$[QT_INSTALL_PLUGINS]/generic target.path = $$[QT_INSTALL_PLUGINS]/generic
} }
!isEmpty(target.path): INSTALLS += target !isEmpty(target.path): INSTALLS += target
unix:!macx: LIBS += -L$$PWD/../../Plxlibrary/Library/ -lPlxApi
INCLUDEPATH += $$PWD/../../Plxlibrary/Library
DEPENDPATH += $$PWD/../../Plxlibrary/Library
INCLUDEPATH += $$PWD/../../Plxlibrary
DEPENDPATH += $$PWD/../../Plxlibrary
unix:!macx: PRE_TARGETDEPS += $$PWD/../../Plxlibrary/Library/libPlxApi.a

0
Plx/include/API/.gitKeep

0
Plx/include/LowLevel/Exception/.gitKeep

0
Plx/include/LowLevel/Exception/HonaAlreadyStartedException.h

0
Plx/include/LowLevel/Exception/HonaBusyException.h

0
Plx/include/LowLevel/Exception/HonaException.h

21
Plx/include/LowLevel/HonaLowLevelAPI.h

@ -9,7 +9,11 @@
#include "HonaPacket.h" #include "HonaPacket.h"
#include "QWaitCondition" #include "QWaitCondition"
#include "QMutex" #include "QMutex"
#include "include/LowLevel/Exception/HonaAlreadyStartedException.h"
#include "include/LowLevel/HonaPacket.h"
#include "include/Wrapper/PlxWrapper.h"
class HonaLowLevelAPI : public QObject class HonaLowLevelAPI : public QObject
{ {
@ -24,7 +28,16 @@ private:
int _threadSforValue = 0; int _threadSforValue = 0;
bool _isReaderThreadFree = false; bool _isReaderThreadFree = false;
bool _isUpdateThreadFree = false; bool _isUpdateThreadFree = false;
quint32 honaRegisterBuffer[8]; QVector<quint32> honaRegisterBuffer;
QList<HonaPacket> honaPacketList;
PlxWrapper plxwrapper;
quint32 hsruLoss = 0;
static quint32 packetLenInt123C;
static quint32 packetLenRes123C;
static quint32 packetLenIntS;
static quint32 packetLenResS;
public: public:
explicit HonaLowLevelAPI(QObject* parent = nullptr); explicit HonaLowLevelAPI(QObject* parent = nullptr);
@ -55,6 +68,10 @@ private:
void hsruUpdateThread(); void hsruUpdateThread();
int hiruGetDOA(); int hiruGetDOA();
void hsruReaderMethod();
QVector<quint32> hsruReadHonaBuffer(honaReceivers receiver);
quint32 hsruParserInt123C(quint32 honaData,QList<HonaPacket> honaPacketList);
signals: signals:
void signalToTop(QList<HonaPacket*> honaPacketList, int i, int j); void signalToTop(QList<HonaPacket*> honaPacketList, int i, int j);
//uncrustify off //uncrustify off

0
Plx/include/LowLevel/HonaPacket.h

0
Plx/include/LowLevel/Setting/.gitKeep

0
Plx/include/LowLevel/Setting/Setting.h

0
Plx/include/LowLevel/Utils/.gitKeep

9
Plx/include/LowLevel/Utils/Utils.h

@ -2,6 +2,7 @@
#define UTILS_H #define UTILS_H
#include <QtCore> #include <QtCore>
/*************************************************************************************************/ /*************************************************************************************************/
enum apiResult : quint8 enum apiResult : quint8
{ {
@ -21,11 +22,13 @@ enum drxDeviceIfChannel : quint8
enum honaReceivers : quint8 enum honaReceivers : quint8
{ {
int123C, int123C,
res123C,
intS, intS,
resS, resS,
int4, //Mode 4 int4, //Mode 4
res4, //Mode 4 res4, //Mode 4
signalPulse //Mode 4 singlePulse //Mode 4
}; };
/*************************************************************************************************/ /*************************************************************************************************/
enum recorderMode : quint8 enum recorderMode : quint8
@ -58,8 +61,4 @@ enum honaPacketType : quint8
}; };
/*************************************************************************************************/ /*************************************************************************************************/
#endif // UTILS_H #endif // UTILS_H

0
Plx/include/Wrapper/.gitKeep

45
Plx/include/Wrapper/PlxWrapper.h

@ -1,34 +1,33 @@
#ifndef PLXWRAPPER_H #ifndef PLXWRAPPER_H
#define PLXWRAPPER_H #define PLXWRAPPER_H
#include <QtGlobal> #include <QtGlobal>
#include "../../plxlib/plxinc/PlxPci_9054_Func.h" #include "PlxPci_9054_Func.h"
class PlxWrapper class PlxWrapper
{ {
public: public:
PlxWrapper(); PlxWrapper();
bool deviceInit(quint32 devicekey); bool deviceInit(quint32 devicekey);
bool deviceOpen(void); bool deviceOpen(void);
bool deviceClose(void); bool deviceClose(void);
bool deviceReset(void); bool deviceReset(void);
bool deviceLoadE2pToFPGA(void); bool deviceLoadE2pToFPGA(void);
bool deviceReadEeprom(quint16 offset,quint32 length, QVector<quint32> &data); bool deviceReadEeprom(quint16 offset, quint32 length, QVector<quint32>& data);
bool deviceWriteEeprom(quint16 offset, quint32 data); bool deviceWriteEeprom(quint16 offset, quint32 data);
bool deviceReadRegister(quint32 address,QVector<quint32> &data,quint32 length); bool deviceReadRegister(quint32 address, QVector<quint32>& data, quint32 length);
bool deviceReadRegister(quint32 address,quint32 &data); bool deviceReadRegister(quint32 address, quint32& data);
bool deviceWriteRegister(quint32 address,QVector<quint32> &data); bool deviceWriteRegister(quint32 address, QVector<quint32>& data);
bool deviceWriteRegister(quint32 address,quint32 data); bool deviceWriteRegister(quint32 address, quint32 data);
bool deviceReadMemory(quint32 localAddress ,QVector<quint32> &data,quint32 length); bool deviceReadMemory(quint32 localAddress, QVector<quint32>& data, quint32 length);
bool deviceOpenPCIChannel(void); bool deviceOpenPCIChannel(void);
bool deviceClosePCIChannel(void); bool deviceClosePCIChannel(void);
bool deviceEnableInterrupt(void); bool deviceEnableInterrupt(void);
bool deviceDisableInterrupt(void); bool deviceDisableInterrupt(void);
bool deviceWaitForInterrupt(quint32 timeout); bool deviceWaitForInterrupt(quint32 timeout);
bool deviceGetChipType(quint8 revision,quint16 chipType); bool deviceGetChipType(quint8 revision, quint16 chipType);
}; };
#endif // PLXWRAPPER_H
#endif //PLXWRAPPER_H

0
Plx/src/API/.gitKeep

0
Plx/src/LowLevel/.gitKeep

200
Plx/src/LowLevel/HonaLowLevelAPI.cpp

@ -5,7 +5,6 @@
#include "qdebug.h" #include "qdebug.h"
#include "QTime" #include "QTime"
#include "QtConcurrent/QtConcurrent" #include "QtConcurrent/QtConcurrent"
PlxWrapper plx;
bool HonaLowLevelAPI::getHsruIsStarted() const bool HonaLowLevelAPI::getHsruIsStarted() const
{ {
@ -126,33 +125,34 @@ void HonaLowLevelAPI::init()
/*************************************************************************************************/ /*************************************************************************************************/
void HonaLowLevelAPI::writeSettingToRegisters(HonaSettings& settings) void HonaLowLevelAPI::writeSettingToRegisters(HonaSettings& settings)
{ {
honaRegisterBuffer[0] = 0x00000000; honaRegisterBuffer.clear();
/************************************************************************/ honaRegisterBuffer.insert(0,0x00000000);
if(settings.hiruSettings.recordStard == recorderStart::selfTestCounter) /************************************************************************/
honaRegisterBuffer[0] = 0x80000000; if(settings.hiruSettings.recordStard == recorderStart::selfTestCounter)
else honaRegisterBuffer.insert(0,0x80000000);
honaRegisterBuffer[0] = 0x7FFFFFFF; else
/************************************************************************/ honaRegisterBuffer.insert(0,0x7FFFFFFF);
if(settings.hiruSettings.recordChannel == drxDeviceIfChannel::ifChannel12) /************************************************************************/
honaRegisterBuffer[0] = 0x20000000; if(settings.hiruSettings.recordChannel == drxDeviceIfChannel::ifChannel12)
else honaRegisterBuffer.insert(0,0x20000000);
honaRegisterBuffer[0] = 0xDFFFFFFF; else
/************************************************************************/ honaRegisterBuffer.insert(0,0xDFFFFFFF);
if(settings.hiruSettings.recordMode == recorderMode::dualChannel) /************************************************************************/
honaRegisterBuffer[0] = 0x10000000; if(settings.hiruSettings.recordMode == recorderMode::dualChannel)
else honaRegisterBuffer.insert(0,0x10000000);
honaRegisterBuffer[0] = 0xEFFFFFFF; else
/************************************************************************/ honaRegisterBuffer.insert(0,0xEFFFFFFF);
/************************************************************************/
honaRegisterBuffer[0] += (settings.hiruSettings.threshold & 0x00000FFF);
honaRegisterBuffer.insert(0,(honaRegisterBuffer.at(0)+ (settings.hiruSettings.threshold & 0x00000FFF)));
honaRegisterBuffer[1] = settings.hsruSettings.honaInt123CTHR;
honaRegisterBuffer[2] = settings.hsruSettings.honaRes123CTHR; honaRegisterBuffer.insert(1,settings.hsruSettings.honaInt123CTHR);
honaRegisterBuffer[3] = settings.hsruSettings.honaIntSTHR; honaRegisterBuffer.insert(2,settings.hsruSettings.honaRes123CTHR);
honaRegisterBuffer[4] = settings.hsruSettings.honaResSTHR; honaRegisterBuffer.insert(3,settings.hsruSettings.honaIntSTHR);
honaRegisterBuffer[5] = settings.hsruSettings.honaSPTHR; honaRegisterBuffer.insert(4,settings.hsruSettings.honaResSTHR);
honaRegisterBuffer[6] = settings.hsruSettings.intM4_THR; honaRegisterBuffer.insert(5,settings.hsruSettings.honaSPTHR);
honaRegisterBuffer[7] = settings.hsruSettings.resM4_THR; 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;
}

0
Plx/src/LowLevel/HonaPacket.cpp

0
Plx/src/LowLevel/Setting/.gitKeep

0
Plx/src/LowLevel/Utils/.gitKeep

0
Plx/src/Wrapper/.gitKeep

0
Plx/src/Wrapper/PlxWrapper.cpp

0
PlxBoard.pro

0
Test/MainWindow.cpp

0
Test/MainWindow.h

0
Test/MainWindow.ui

0
Test/Test.pro

0
Test/main.cpp

Loading…
Cancel
Save