GNU Radio 3.4.2 C++ API
usrp_source_c.h
Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 /*
00003  * Copyright 2004 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 #ifndef INCLUDED_USRP_SOURCE_C_H
00024 #define INCLUDED_USRP_SOURCE_C_H
00025 
00026 #include <usrp_source_base.h>
00027 #include <stdexcept>
00028 
00029 class usrp_standard_rx;
00030 
00031 
00032 class usrp_source_c;
00033 typedef boost::shared_ptr<usrp_source_c> usrp_source_c_sptr;
00034 
00035 
00036 // public shared_ptr constructor
00037 
00038 usrp_source_c_sptr
00039 usrp_make_source_c (int which_board=0,
00040                      unsigned int decim_rate=16,
00041                      int nchan = 1,
00042                      int mux = -1,
00043                      int mode = 0,
00044                      int fusb_block_size = 0,
00045                      int fusb_nblocks = 0,
00046                      const std::string fpga_filename = "",
00047                      const std::string firmware_filename = ""
00048                      ) throw (std::runtime_error);
00049 
00050 /*!
00051  * \brief Interface to Universal Software Radio Peripheral Rx path
00052  * \ingroup usrp
00053  * \ingroup source_blk
00054  *
00055  * output: 1 stream of complex<float>
00056  */
00057 class usrp_source_c : public usrp_source_base {
00058  private:
00059   friend usrp_source_c_sptr
00060   usrp_make_source_c (int which_board,
00061                        unsigned int decim_rate,
00062                        int nchan,
00063                        int mux,
00064                        int mode,
00065                        int fusb_block_size,
00066                        int fusb_nblocks,
00067                        const std::string fpga_filename,
00068                        const std::string firmware_filename
00069                        ) throw (std::runtime_error);
00070 
00071  protected:
00072   usrp_source_c (int which_board,
00073                   unsigned int decim_rate,
00074                   int nchan,
00075                   int mux,
00076                   int mode,
00077                   int fusb_block_size,
00078                   int fusb_nblocks,
00079                   const std::string fpga_filename,
00080                   const std::string firmware_filename
00081                   ) throw (std::runtime_error);
00082 
00083   virtual int ninput_bytes_reqd_for_noutput_items (int noutput_items);
00084 
00085   virtual void copy_from_usrp_buffer (gr_vector_void_star &output_items,
00086                                       int output_index,
00087                                       int output_items_available,
00088                                       int &output_items_produced,
00089                                       const void *usrp_buffer,
00090                                       int usrp_buffer_length,
00091                                       int &bytes_read);
00092 
00093  public:
00094   ~usrp_source_c ();
00095 };
00096 
00097 #endif /* INCLUDED_USRP_SOURCE_C_H */