Cat
UsbFTInterface.h
Go to the documentation of this file.
1 //$Id: UsbFTInterface.h,v 1.9 2006/10/24 13:28:40 fmachefe Exp $
2 //-----------------------------------------------------------------------------
3 //
4 // Package : UsbFTInterface
5 //
6 // Description:
7 //
8 // Author(s) : F. Machefert -
9 // Date : 18 January 2004
10 //
11 //-----------------------------------------------------------------------------
12 
17 #ifndef USBINTERFACE_H
18 #define USBINTERFACE_H 1
19 
20 #include <algorithm>
21 #include <string>
22 #include <vector>
23 #include <list>
24 
25 #include <boost/python/list.hpp>
26 #include <boost/python/extract.hpp>
27 
28 #include "LALUsb.h"
29 #include "Interface.h"
30 
40 class UsbFTInterface : public Interface {
41 public:
42  typedef unsigned long U32;
43  typedef unsigned short U16;
44  typedef unsigned char U8;
45 
46  enum WordSize
47  {
51  };
52 
53  enum IOMode
54  {
60  };
61 
62  UsbFTInterface( );
63  virtual ~UsbFTInterface( ){
64  close();
65  } //< Destructor
66 
67 
71  virtual void help() { info("UsbFTInterface "+name()+". No help.","UsbFTInterface::help"); };
72 
77  virtual StatusCode init();
78 
82  void close();
83 
91  virtual void reset() {
92  // USB_ResetDevice(m_usbId);
93  info("Reset of the Usb interface "+name(),"UsbFTInterface::reset");
94  close();
95  init();
96  };
97 
101  virtual void update () {
102  info("UsbFTInterface "+name()+". Nothing to do.","UsbFTInterface::update");
103  };
104 
105  // **********************************************************************
106 
108 
109  // **********************************************************************
110 
112 
113  // **********************************************************************
114 
118  StatusCode read(unsigned long int,
119  unsigned long int,
120  boost::python::list&);
121 
125  StatusCode write(unsigned long int,
126  boost::python::list);
127 
128  // **********************************************************************
129 
134 // StatusCode usbReadu8( unsigned long int,
135 // unsigned long int,
136 // std::vector<U8> &);
137 
142 // StatusCode usbWriteU8(unsigned long int,
143 // std::vector<U8> );
144 
149 // StatusCode usbReadU16(unsigned long int,
150 // unsigned long int,
151 // std::vector<U16> &);
152 
157 // StatusCode usbWriteU16(unsigned long int,
158 // std::vector<U16> );
159 
164  StatusCode usbRead( unsigned long int,
165  unsigned long int,
166  std::vector<U32> &);
167 
172  StatusCode usbWrite (unsigned long int,
173  std::vector<U32> );
174 
175 // **********************************************************************
176 
181  StatusCode usbReadU8( unsigned long int,
182  unsigned long int,
183  unsigned char * );
184 
185  StatusCode usbReadU16( unsigned long int,
186  unsigned long int,
187  unsigned short * );
188 
189  StatusCode usbReadU32( unsigned long int,
190  unsigned long int,
191  unsigned long * );
192 
193 // **********************************************************************
194 
199  StatusCode usbWriteU8( unsigned long int ,
200  unsigned long int ,
201  unsigned char* );
202 
207  StatusCode usbWriteU16( unsigned long int ,
208  unsigned long int ,
209  unsigned short* );
210 
215  StatusCode usbWriteU32( unsigned long int,
216  unsigned long int,
217  unsigned long* );
218 // **********************************************************************
219 
224  StatusCode usbWriteRead( unsigned long int,
225  std::vector<U8>,
226  std::vector<U8>& );
227 
232  void setUsbId (int usbId) {
233  m_usbId = usbId;
234  }
235 
240  int usbId () {
241  return m_usbId;
242  }
243 
248  void setSerialNum (std::string serialNum) {
250  }
251 
256  std::string serialNum () {
257  return m_serialNum;
258  }
259 
264  void setDeviceDesc (std::string deviceDesc) {
266  }
267 
272  std::string deviceDesc () {
273  return m_deviceDesc;
274  }
275 
280  void setLatencyTimer (unsigned char latencyTimer) {
283  }
284 
289  unsigned char latencyTimer () {
291  return m_latencyTimer;
292  }
293 
298  void setTimeOut (int txTimeOut,int rxTimeOut) {
302  }
303 
308  int txTimeOut () {
309  // USB_SetTimeouts(m_usbId,&m_txTimeOut,&m_rxTimeOut)
310  return m_txTimeOut;
311  }
312 
317  int rxTimeOut () {
318  // USB_SetTimeouts(m_usbId,&m_txTimeOut,&m_rxTimeOut)
319  return m_rxTimeOut;
320  }
321 
326  void setBuffer (int txBuffer, int rxBuffer) {
330  }
331 
336  int txBuffer () {
337  return m_txBuffer;
338  }
339 
344  int rxBuffer () {
345  return m_rxBuffer;
346  }
347 
352  void setNFrames (long int nFrames) {
353  m_nFrames = nFrames;
354  }
355 
360  long int nFrames () {
361  return m_nFrames;
362  }
363 
364 
369  void setWordCount (unsigned long wordCount) {
371  }
372 
377  unsigned long wordCount () {
378  return m_wordCount;
379  }
380 
385  void setWordSize (unsigned long wordSize) {
387  }
388 
393  unsigned long wordSize () {
394  return m_wordSize;
395  }
396 
401  void setFakeErr (unsigned int fakeErr) {
402  m_fakeErr = fakeErr;
403  }
404 
409  unsigned int fakeErr () {
410  return m_fakeErr;
411  }
412 
417  void setInterrupts (bool interrupts) {
419  }
420 
425  bool interrupts () {
426  return m_interrupts;
427  }
428 
435  }
436 
441  bool showEpromState () {
442  return m_showEpromState;
443  }
444 
449  bool wrBlockMax () {
450  return m_wrBlockMax;
451  }
452 
457  void setWrBlockMax (bool wrBlockMax) {
459  }
460 
465  bool rdBlockMax () {
466  return m_rdBlockMax;
467  }
468 
473  void setRdBlockMax (bool rdBlockMax) {
475  }
476 
481  void setPrintout (bool printout) {
483  }
484 
489  bool printout () {
490  return m_printout;
491  }
492 
493 private:
494  int m_usbId;
495  std::string m_serialNum;
496  std::string m_deviceDesc;
497  unsigned char m_latencyTimer;
502  long int m_nFrames;
503  unsigned long m_wordCount;
504  unsigned long m_wordSize;
505  unsigned int m_fakeErr;
511 
512 protected:
513 
514 };
515 
516 #endif
517 
void info(std::string mymsg)
Definition: Object.h:38
StatusCode usbRead(unsigned long int, unsigned long int, std::vector< U32 > &)
void setWordCount(unsigned long wordCount)
void setUsbId(int usbId)
StatusCode usbReadU8(unsigned long int, unsigned long int, unsigned char *)
LALUSB_API BOOL _cstmcall USB_GetLatencyTimer(int id, PUCHAR msecs)
unsigned int fakeErr()
unsigned long wordCount()
StatusCode usbWrite(unsigned long int, std::vector< U32 >)
void setTimeOut(int txTimeOut, int rxTimeOut)
virtual void reset()
unsigned char U8
StatusCode usbWriteRead(unsigned long int, std::vector< U8 >, std::vector< U8 > &)
void setBuffer(int txBuffer, int rxBuffer)
LALUSB_API BOOL _cstmcall USB_SetLatencyTimer(int id, UCHAR msecs)
long int m_nFrames
std::string serialNum()
unsigned long wordSize()
unsigned long m_wordSize
void setShowEpromState(bool showEpromState)
StatusCode read(IOdata *)
void setNFrames(long int nFrames)
void setSerialNum(std::string serialNum)
long int nFrames()
StatusCode usbWriteU32(unsigned long int, unsigned long int, unsigned long *)
std::string deviceDesc()
void setWrBlockMax(bool wrBlockMax)
Definition: IOdata.h:17
void setRdBlockMax(bool rdBlockMax)
StatusCode usbWriteU16(unsigned long int, unsigned long int, unsigned short *)
StatusCode usbWriteU8(unsigned long int, unsigned long int, unsigned char *)
void setFakeErr(unsigned int fakeErr)
std::string m_deviceDesc
std::string m_serialNum
void setLatencyTimer(unsigned char latencyTimer)
unsigned long U32
LALUSB_API BOOL _cstmcall USB_SetTimeouts(int id, int tx_timeout, int rx_timeout)
unsigned char m_latencyTimer
std::string name() const
Definition: Object.h:28
virtual ~UsbFTInterface()
StatusCode write(IOdata *)
void setDeviceDesc(std::string deviceDesc)
virtual void update()
void setPrintout(bool printout)
void setWordSize(unsigned long wordSize)
unsigned long m_wordCount
unsigned short U16
unsigned int m_fakeErr
StatusCode usbReadU16(unsigned long int, unsigned long int, unsigned short *)
unsigned char latencyTimer()
StatusCode usbReadU32(unsigned long int, unsigned long int, unsigned long *)
virtual StatusCode init()
virtual void help()
LALUSB_API BOOL _cstmcall USB_SetXferSize(int id, unsigned long txsize, unsigned long rxsize)
void setInterrupts(bool interrupts)