Cat
UsbFTMLInterface.h
Go to the documentation of this file.
1 //$Id: UsbFTMLInterface.h,v 1.9 2006/10/24 13:28:40 fmachefe Exp $
2 //-----------------------------------------------------------------------------
3 //
4 // Package : UsbFTMLInterface
5 //
6 // Description:
7 //
8 // Author(s) : F. Machefert -
9 // Date : 18 January 2004
10 //
11 //-----------------------------------------------------------------------------
12 
17 #ifndef USBFTMLINTERFACE_H
18 #define USBFTMLINTERFACE_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 "LALUsbML.h"
29 
30 #include "Interface.h"
31 
41 class UsbFTMLInterface : public Interface {
42 public:
43  typedef unsigned long U32;
44  typedef unsigned short U16;
45  typedef unsigned char U8;
46 
47  enum WordSize
48  {
52  };
53 
54  enum IOMode
55  {
61  };
62 
63  UsbFTMLInterface( );
64  virtual ~UsbFTMLInterface( ){
65  close();
66  } //< Destructor
67 
71  virtual void help() { info("UsbFTMLInterface "+name()+". No help.","UsbFTMLInterface::help"); };
72 
77  virtual StatusCode init();
78 
82  void close();
83 
91  virtual void reset() {
93  info("Reset of the Usb interface "+name(),"UsbFTMLInterface::reset");
94  close();
95  init();
96  };
97 
101  virtual void update () {
102  info("UsbFTMLInterface "+name()+". Nothing to do.","UsbFTMLInterface::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 
249  void setSerialNum (std::string serialNum) {
251  }
252 
257  std::string serialNum () {
258  return m_serialNum;
259  }
260 
265  void setDeviceDesc (std::string deviceDesc) {
267  }
268 
273  std::string deviceDesc () {
274  return m_deviceDesc;
275  }
276 
281  void setLatencyTimer (unsigned char latencyTimer) {
284  }
285 
290  unsigned char latencyTimer () {
292  return m_latencyTimer;
293  }
294 
299  void setTimeOut (int txTimeOut,int rxTimeOut) {
303  }
304 
309  int txTimeOut () {
310  // USB_SetTimeouts(m_usbId,&m_txTimeOut,&m_rxTimeOut)
311  return m_txTimeOut;
312  }
313 
318  int rxTimeOut () {
319  // USB_SetTimeouts(m_usbId,&m_txTimeOut,&m_rxTimeOut)
320  return m_rxTimeOut;
321  }
322 
327  void setBuffer (int txBuffer, int rxBuffer) {
331  }
332 
337  int txBuffer () {
338  return m_txBuffer;
339  }
340 
345  int rxBuffer () {
346  return m_rxBuffer;
347  }
348 
353  void setNFrames (long int nFrames) {
354  m_nFrames = nFrames;
355  }
356 
361  long int nFrames () {
362  return m_nFrames;
363  }
364 
365 
370  void setWordCount (unsigned long wordCount) {
372  }
373 
378  unsigned long wordCount () {
379  return m_wordCount;
380  }
381 
386  void setWordSize (unsigned long wordSize) {
388  }
389 
394  unsigned long wordSize () {
395  return m_wordSize;
396  }
397 
402  void setFakeErr (unsigned int fakeErr) {
403  m_fakeErr = fakeErr;
404  }
405 
410  unsigned int fakeErr () {
411  return m_fakeErr;
412  }
413 
418  void setInterrupts (bool interrupts) {
420  }
421 
426  bool interrupts () {
427  return m_interrupts;
428  }
429 
436  }
437 
442  bool showEpromState () {
443  return m_showEpromState;
444  }
445 
450  bool wrBlockMax () {
451  return m_wrBlockMax;
452  }
453 
458  void setWrBlockMax (bool wrBlockMax) {
460  }
461 
466  bool rdBlockMax () {
467  return m_rdBlockMax;
468  }
469 
474  void setRdBlockMax (bool rdBlockMax) {
476  }
477 
482  void setPrintout (bool printout) {
484  }
485 
490  bool printout () {
491  return m_printout;
492  }
493 
495 
497 
499 
500 private:
501  int m_usbId;
502  std::string m_serialNum;
503  std::string m_deviceDesc;
504  unsigned char m_latencyTimer;
509  long int m_nFrames;
510  unsigned long m_wordCount;
511  unsigned long m_wordSize;
512  unsigned int m_fakeErr;
518 
519 protected:
520 
521 };
522 
523 #endif
524 
void info(std::string mymsg)
Definition: Object.h:38
void setRdBlockMax(bool rdBlockMax)
void setSerialNum(std::string serialNum)
void setUsbId(int usbId)
StatusCode usbReadU8(unsigned long int, unsigned long int, unsigned char *)
LALUSB_API BOOL _cstmcall USB_GetLatencyTimer(int id, PUCHAR msecs)
StatusCode usbWrite(unsigned long int, std::vector< U32 >)
void setDeviceDesc(std::string deviceDesc)
void setPrintout(bool printout)
unsigned long m_wordSize
std::string serialNum()
void setShowEpromState(bool showEpromState)
unsigned long wordSize()
LALUSB_API BOOL _cstmcall USB_SetLatencyTimer(int id, UCHAR msecs)
void setLatencyTimer(unsigned char latencyTimer)
StatusCode read(IOdata *)
StatusCode usbWriteU32(unsigned long int, unsigned long int, unsigned long *)
std::string deviceDesc()
virtual void help()
void setTimeOut(int txTimeOut, int rxTimeOut)
StatusCode write(IOdata *)
LALUSB_API BOOL _cstmcall USB_ResetDevice(int id)
void setBuffer(int txBuffer, int rxBuffer)
void setNFrames(long int nFrames)
LALUSB_API BOOL _cstmcall USB_ResetMode(int id)
unsigned short U16
LALUSB_API BOOL _cstmcall USB_PurgeBuffers(int id)
unsigned int m_fakeErr
unsigned char U8
unsigned long m_wordCount
void setFakeErr(unsigned int fakeErr)
unsigned char m_latencyTimer
Definition: IOdata.h:17
virtual StatusCode init()
virtual void reset()
void setWordSize(unsigned long wordSize)
StatusCode usbReadU16(unsigned long int, unsigned long int, unsigned short *)
std::string m_deviceDesc
StatusCode usbWriteRead(unsigned long int, std::vector< U8 >, std::vector< U8 > &)
unsigned long wordCount()
StatusCode usbWriteU8(unsigned long int, unsigned long int, unsigned char *)
unsigned char latencyTimer()
void setWrBlockMax(bool wrBlockMax)
LALUSB_API BOOL _cstmcall USB_SetTimeouts(int id, int tx_timeout, int rx_timeout)
StatusCode usbReadU32(unsigned long int, unsigned long int, unsigned long *)
std::string name() const
Definition: Object.h:28
virtual void update()
void setWordCount(unsigned long wordCount)
unsigned int fakeErr()
LALUSB_API BOOL _cstmcall USB_SetSynchronousMode(int id, int sleep_time)
StatusCode usbWriteU16(unsigned long int, unsigned long int, unsigned short *)
virtual ~UsbFTMLInterface()
unsigned long U32
StatusCode usbRead(unsigned long int, unsigned long int, std::vector< U32 > &)
std::string m_serialNum
LALUSB_API BOOL _cstmcall USB_SetXferSize(int id, unsigned long txsize, unsigned long rxsize)
void setInterrupts(bool interrupts)