fusb.h

Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 /*
00003  * Copyright 2003 Free Software Foundation, Inc.
00004  * 
00005  * This file is part of GNU Radio
00006  * 
00007  * GNU Radio is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 3, or (at your option)
00010  * any later version.
00011  * 
00012  * GNU Radio is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  * 
00017  * You should have received a copy of the GNU General Public License
00018  * along with GNU Radio; see the file COPYING.  If not, write to
00019  * the Free Software Foundation, Inc., 51 Franklin Street,
00020  * Boston, MA 02110-1301, USA.
00021  */
00022 
00023 // Fast USB interface
00024 
00025 #ifndef _FUSB_H_
00026 #define _FUSB_H_
00027 
00028 
00029 struct  usb_dev_handle;
00030 class   fusb_ephandle;
00031 
00035 class fusb_devhandle {
00036 private:
00037   // NOT IMPLEMENTED
00038   fusb_devhandle (const fusb_devhandle &rhs);             // no copy constructor
00039   fusb_devhandle &operator= (const fusb_devhandle &rhs);  // no assignment operator
00040 
00041 protected:
00042   usb_dev_handle                *d_udh;
00043 
00044 public:
00045   // CREATORS
00046   fusb_devhandle (usb_dev_handle *udh);
00047   virtual ~fusb_devhandle ();
00048 
00049   // MANIPULATORS
00050   
00054   virtual fusb_ephandle *make_ephandle (int endpoint, bool input_p,
00055                                         int block_size = 0, int nblocks = 0) = 0;
00056   
00057   // ACCESSORS
00058   usb_dev_handle *get_usb_dev_handle () const { return d_udh; }
00059 };
00060 
00061 
00065 class fusb_ephandle {
00066 private:
00067   // NOT IMPLEMENTED
00068   fusb_ephandle (const fusb_ephandle &rhs);             // no copy constructor
00069   fusb_ephandle &operator= (const fusb_ephandle &rhs);  // no assignment operator
00070 
00071 protected:
00072   int                           d_endpoint;
00073   bool                          d_input_p;
00074   int                           d_block_size;
00075   int                           d_nblocks;
00076   bool                          d_started;
00077 
00078 public:
00079   fusb_ephandle (int endpoint, bool input_p,
00080                  int block_size = 0, int nblocks = 0);
00081   virtual ~fusb_ephandle ();
00082 
00083   virtual bool start () = 0;    
00084   virtual bool stop () = 0;     
00085 
00090   virtual int write (const void *buffer, int nbytes) = 0;
00091 
00097   virtual int read (void *buffer, int nbytes) = 0;
00098 
00099   /*
00100    * block until all outstanding writes have completed
00101    */
00102   virtual void wait_for_completion () = 0;
00103 
00107   int block_size () { return d_block_size; };
00108 };
00109 
00110 
00114 class fusb_sysconfig {
00115 public:
00119   static fusb_devhandle *make_devhandle (usb_dev_handle *udh);
00120 
00124   static int max_block_size ();
00125 
00129   static int default_block_size ();
00130 
00134   static int default_buffer_size ();
00135 
00136 };
00137 
00138 #endif /* _FUSB_H_ */

Generated on Thu Mar 5 09:01:09 2009 for GNU Radio 3.1.3 by  doxygen 1.5.8