3 * Copyright 2008,2009 Free Software Foundation, Inc.
5 * This file is part of GNU Radio
7 * GNU Radio is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3, or (at your option)
12 * GNU Radio is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with GNU Radio; see the file COPYING. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street,
20 * Boston, MA 02110-1301, USA.
23 #ifndef INCLUDED_USRP2_BASE_H
24 #define INCLUDED_USRP2_BASE_H
26 #include <gr_sync_block.h>
27 #include <usrp2/usrp2.h>
30 // BIG ASS FIXME: get from lower layer MTU calculation
31 #define USRP2_MIN_RX_SAMPLES 371
34 * Base class for all USRP2 blocks
36 class usrp2_base : public gr_sync_block
39 usrp2_base(const char *name,
40 gr_io_signature_sptr input_signature,
41 gr_io_signature_sptr output_signature,
42 const std::string &ifc,
43 const std::string &mac)
44 throw (std::runtime_error);
46 usrp2::usrp2::sptr d_u2;
52 * \brief Get USRP2 hardware MAC address
54 std::string mac_addr() const;
57 * \brief Get interface name used to communicat with USRP2
59 std::string interface_name() const;
62 * \brief Get USRP2 master clock rate
64 bool fpga_master_clock_freq(long *freq) const;
67 * \brief MIMO configuration
69 bool config_mimo(int flags);
72 * \brief Set master time to 0 at next PPS rising edge
77 * Reset master time to 0 at every PPS edge
79 bool sync_every_pps(bool enable);
82 * \brief Read memory from Wishbone bus as words
84 std::vector<uint32_t> peek32(uint32_t addr, uint32_t words);
87 * \brief Write memory to Wishbone bus as words
89 bool poke32(uint32_t addr, const std::vector<uint32_t> &data);
92 * \brief Called by scheduler when starting flowgraph
97 * \brief Called by scheduler when stopping flowgraph
102 * \brief Derived class must override this
104 virtual int work(int noutput_items,
105 gr_vector_const_void_star &input_items,
106 gr_vector_void_star &output_items) = 0;
109 #endif /* INCLUDED_USRP2_BASE_H */