14 #include "chardevicedriver.h"
15 #include "charinterface.h"
18 #define DEV_ADDR_PROT 0x6
23 XWinCUSBInterface(
const char *name,
bool runtime,
const shared_ptr<XDriver> &driver, uint8_t addr_offset,
const char*
id);
31 void writeToRegister8(
unsigned int addr, uint8_t data);
32 void writeToRegister16(
unsigned int addr, uint16_t data);
33 void bulkWriteStored();
34 void resetBulkWrite();
36 void burstRead(
unsigned int addr, uint8_t *buf,
unsigned int cnt);
37 uint8_t singleRead(
unsigned int addr);
38 uint16_t readRegister8(
unsigned int addr) {
return singleRead(addr);}
39 uint16_t readRegister16(
unsigned int addr);
41 XString getIDN(
int maxlen = 255) {
return getIDN(m_handle, maxlen); }
43 void lock() {m_mutex->lock();}
44 void unlock() {m_mutex->unlock();}
45 bool isLocked()
const {
return m_mutex->isLockedByCurrentThread();}
47 virtual void send(
const char *str)
throw (XCommError &);
48 virtual void receive() throw (XCommError &);
50 virtual
bool isOpened()
const {
return m_handle != 0;}
53 XString getIDN(
void *handle,
int maxlen = 255) {
54 XString str = getIDN(handle, maxlen, m_addrOffset);
55 if(str.empty() || (str.find(m_idString,0) != 0))
59 static void setLED(
void *handle, uint8_t data);
60 static uint8_t readDIPSW(
void *handle);
61 static uint8_t singleRead(
void *handle,
unsigned int addr,
unsigned int addroffset);
64 shared_ptr<XRecursiveMutex> mutex;
68 static std::deque<USBDevice> s_devices;
70 static void openAllEZUSBdevices();
71 static void setWave(
void *handle,
const uint8_t *wave);
72 static void closeAllEZUSBdevices();
73 static XString getIDN(
void *handle,
int maxlen,
int offsetaddr);
75 shared_ptr<XRecursiveMutex> m_mutex;
79 std::vector<uint8_t> m_buffer;