6 changed files with 231 additions and 46 deletions
@ -0,0 +1,140 @@ |
|||
#include <QDebug> |
|||
#include <QVector> |
|||
#include "include/Wrapper/PlxWrapper.h" |
|||
|
|||
PlxWrapper::PlxWrapper() |
|||
{ |
|||
|
|||
} |
|||
/*************************************************************************************************/ |
|||
bool PlxWrapper::deviceInit(quint32 devicekey) |
|||
{ |
|||
return PlxPci_9054_SelDevice(devicekey); |
|||
} |
|||
/*************************************************************************************************/ |
|||
bool PlxWrapper::deviceOpen(void) |
|||
{ |
|||
return PlxPci_9054_Open(); |
|||
} |
|||
/*************************************************************************************************/ |
|||
|
|||
bool PlxWrapper::deviceClose(void) |
|||
{ |
|||
return PlxPci_9054_Close(); |
|||
} |
|||
/*************************************************************************************************/ |
|||
bool PlxWrapper::deviceReset(void) |
|||
{ |
|||
return PlxPci_9054_Reset(); |
|||
} |
|||
/*************************************************************************************************/ |
|||
bool PlxWrapper::deviceLoadE2pToFPGA(void) |
|||
{ |
|||
return PlxPci_9054_LoadE2pToFPGA(); |
|||
} |
|||
/*************************************************************************************************/ |
|||
bool PlxWrapper::deviceReadEeprom(quint16 offset,quint32 length, QVector<quint32> &data) |
|||
{ |
|||
bool ret = true; |
|||
data.clear(); |
|||
|
|||
for(auto i = 0U; i < (length-1)*4; i+=4) |
|||
{ |
|||
quint32 temp; |
|||
ret &= PlxPci_9054_ReadEep(offset+i, &temp); |
|||
data.append(temp); |
|||
} |
|||
return ret; |
|||
} |
|||
/*************************************************************************************************/ |
|||
bool PlxWrapper::deviceWriteEeprom(quint16 offset,quint32 data) |
|||
{ |
|||
return PlxPci_9054_WriteEep(offset,data); |
|||
} |
|||
/*************************************************************************************************/ |
|||
bool PlxWrapper::deviceReadRegister(quint32 address,QVector<quint32> &data,quint32 length) |
|||
{ |
|||
bool ret = true; |
|||
data.clear(); |
|||
|
|||
quint32 temp[length]; |
|||
ret &= PlxPci_9054_ReadBar(address,&temp,length * 4); |
|||
if(ret == true) |
|||
{ |
|||
for(auto i = 0U; i <length; i++) |
|||
{ |
|||
data.append(temp[i]); |
|||
qDebug()<<hex<<temp[i]; |
|||
} |
|||
} |
|||
return ret; |
|||
} |
|||
/*************************************************************************************************/ |
|||
bool PlxWrapper::deviceReadRegister(quint32 address,quint32 &data) |
|||
{ |
|||
return PlxPci_9054_ReadBar(address,&data,4); |
|||
} |
|||
/*************************************************************************************************/ |
|||
bool PlxWrapper::deviceWriteRegister(quint32 address,QVector<quint32> &data) |
|||
{ |
|||
bool ret = true; |
|||
auto length = data.length(); |
|||
quint32 temp[length]; |
|||
|
|||
for(auto i = 0U; i <length; i++) |
|||
temp[i] = data.at(i); |
|||
|
|||
ret &= PlxPci_9054_WriteBar(address,&temp,length * 4); |
|||
|
|||
return ret; |
|||
} |
|||
/*************************************************************************************************/ |
|||
bool PlxWrapper::deviceWriteRegister(quint32 address,quint32 data) |
|||
{ |
|||
return PlxPci_9054_WriteBar(address,&data,4); |
|||
} |
|||
/*************************************************************************************************/ |
|||
bool PlxWrapper::deviceReadMemory(quint32 localAddress ,QVector<quint32> &data,quint32 length) |
|||
{ |
|||
bool ret = true; |
|||
data.clear(); |
|||
|
|||
quint32 temp[length]; |
|||
ret &= PlxPci_9054_DMATransfer(localAddress,&temp,(quint32)(length*4)); |
|||
|
|||
for(auto i = 0U; i <length; i++) |
|||
data.append(temp[i]); |
|||
|
|||
return ret; |
|||
} |
|||
/*************************************************************************************************/ |
|||
bool PlxWrapper::deviceOpenPCIChannel(void) |
|||
{ |
|||
return PlxPci_9054_DMAChannelOpen(); |
|||
} |
|||
/*************************************************************************************************/ |
|||
bool PlxWrapper::deviceClosePCIChannel(void) |
|||
{ |
|||
return PlxPci_9054_DMAChannelClose(); |
|||
} |
|||
/*************************************************************************************************/ |
|||
|
|||
bool PlxWrapper::deviceEnableInterrupt(void) |
|||
{ |
|||
return PlxPci_9054_EnableInterrupt(); |
|||
} |
|||
/*************************************************************************************************/ |
|||
bool PlxWrapper::deviceDisableInterrupt(void) |
|||
{ |
|||
return PlxPci_9054_DisableInterrupt(); |
|||
} |
|||
/*************************************************************************************************/ |
|||
bool PlxWrapper::deviceWaitForInterrupt(quint32 timeout) |
|||
{ |
|||
return PlxPci_9054_WaitForInterrupt(timeout); |
|||
} |
|||
/*************************************************************************************************/ |
|||
bool PlxWrapper::deviceGetChipType(quint8 revision,quint16 chipType) |
|||
{ |
|||
return PlxPci_9054_ChipTypeGet(revision,chipType); |
|||
} |
Loading…
Reference in new issue