root / host / lib / usrp / b100 / b100_impl.hpp @ a0887f3b
History | View | Annotate | Download (4.71 KB)
| 1 |
//
|
|---|---|
| 2 |
// Copyright 2011 Ettus Research LLC
|
| 3 |
//
|
| 4 |
// This program is free software: you can redistribute it and/or modify
|
| 5 |
// it under the terms of the GNU General Public License as published by
|
| 6 |
// the Free Software Foundation, either version 3 of the License, or
|
| 7 |
// (at your option) any later version.
|
| 8 |
//
|
| 9 |
// This program is distributed in the hope that it will be useful,
|
| 10 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 11 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 12 |
// GNU General Public License for more details.
|
| 13 |
//
|
| 14 |
// You should have received a copy of the GNU General Public License
|
| 15 |
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
| 16 |
//
|
| 17 |
|
| 18 |
#ifndef INCLUDED_B100_IMPL_HPP
|
| 19 |
#define INCLUDED_B100_IMPL_HPP
|
| 20 |
|
| 21 |
#include "fx2_ctrl.hpp" |
| 22 |
#include "b100_ctrl.hpp" |
| 23 |
#include "clock_ctrl.hpp" |
| 24 |
#include "codec_ctrl.hpp" |
| 25 |
#include "spi_core_100.hpp" |
| 26 |
#include "i2c_core_100.hpp" |
| 27 |
#include "rx_frontend_core_200.hpp" |
| 28 |
#include "tx_frontend_core_200.hpp" |
| 29 |
#include "rx_dsp_core_200.hpp" |
| 30 |
#include "tx_dsp_core_200.hpp" |
| 31 |
#include "time64_core_200.hpp" |
| 32 |
#include "user_settings_core_200.hpp" |
| 33 |
#include <uhd/device.hpp> |
| 34 |
#include <uhd/property_tree.hpp> |
| 35 |
#include <uhd/utils/pimpl.hpp> |
| 36 |
#include <uhd/types/dict.hpp> |
| 37 |
#include <uhd/types/sensors.hpp> |
| 38 |
#include <uhd/types/clock_config.hpp> |
| 39 |
#include <uhd/types/stream_cmd.hpp> |
| 40 |
#include <uhd/usrp/mboard_eeprom.hpp> |
| 41 |
#include <uhd/usrp/subdev_spec.hpp> |
| 42 |
#include <uhd/usrp/dboard_eeprom.hpp> |
| 43 |
#include <uhd/usrp/dboard_manager.hpp> |
| 44 |
#include <uhd/transport/usb_zero_copy.hpp> |
| 45 |
#include <boost/weak_ptr.hpp> |
| 46 |
|
| 47 |
static const double B100_LINK_RATE_BPS = 256e6/5; //pratical link rate (< 480 Mbps) |
| 48 |
static const std::string B100_FW_FILE_NAME = "usrp_b100_fw.ihx"; |
| 49 |
static const std::string B100_FPGA_FILE_NAME = "usrp_b100_fpga.bin"; |
| 50 |
static const boost::uint16_t B100_FW_COMPAT_NUM = 0x03; |
| 51 |
static const boost::uint16_t B100_FPGA_COMPAT_NUM = 0x09; |
| 52 |
static const boost::uint32_t B100_RX_SID_BASE = 2; |
| 53 |
static const boost::uint32_t B100_TX_ASYNC_SID = 1; |
| 54 |
static const double B100_DEFAULT_TICK_RATE = 64e6; |
| 55 |
|
| 56 |
//! Make a b100 dboard interface
|
| 57 |
uhd::usrp::dboard_iface::sptr make_b100_dboard_iface( |
| 58 |
wb_iface::sptr wb_iface, |
| 59 |
uhd::i2c_iface::sptr i2c_iface, |
| 60 |
uhd::spi_iface::sptr spi_iface, |
| 61 |
b100_clock_ctrl::sptr clock, |
| 62 |
b100_codec_ctrl::sptr codec |
| 63 |
); |
| 64 |
|
| 65 |
//! Implementation guts
|
| 66 |
class b100_impl : public uhd::device { |
| 67 |
public:
|
| 68 |
//structors
|
| 69 |
b100_impl(const uhd::device_addr_t &);
|
| 70 |
~b100_impl(void);
|
| 71 |
|
| 72 |
//the io interface
|
| 73 |
uhd::rx_streamer::sptr get_rx_stream(const uhd::stream_args_t &args);
|
| 74 |
uhd::tx_streamer::sptr get_tx_stream(const uhd::stream_args_t &args);
|
| 75 |
bool recv_async_msg(uhd::async_metadata_t &, double); |
| 76 |
|
| 77 |
private:
|
| 78 |
uhd::property_tree::sptr _tree; |
| 79 |
|
| 80 |
//controllers
|
| 81 |
spi_core_100::sptr _fpga_spi_ctrl; |
| 82 |
i2c_core_100::sptr _fpga_i2c_ctrl; |
| 83 |
rx_frontend_core_200::sptr _rx_fe; |
| 84 |
tx_frontend_core_200::sptr _tx_fe; |
| 85 |
std::vector<rx_dsp_core_200::sptr> _rx_dsps; |
| 86 |
tx_dsp_core_200::sptr _tx_dsp; |
| 87 |
time64_core_200::sptr _time64; |
| 88 |
user_settings_core_200::sptr _user; |
| 89 |
b100_clock_ctrl::sptr _clock_ctrl; |
| 90 |
b100_codec_ctrl::sptr _codec_ctrl; |
| 91 |
b100_ctrl::sptr _fpga_ctrl; |
| 92 |
uhd::usrp::fx2_ctrl::sptr _fx2_ctrl; |
| 93 |
|
| 94 |
//transports
|
| 95 |
uhd::transport::zero_copy_if::sptr _data_transport, _ctrl_transport; |
| 96 |
|
| 97 |
//dboard stuff
|
| 98 |
uhd::usrp::dboard_manager::sptr _dboard_manager; |
| 99 |
uhd::usrp::dboard_iface::sptr _dboard_iface; |
| 100 |
|
| 101 |
//handle io stuff
|
| 102 |
UHD_PIMPL_DECL(io_impl) _io_impl; |
| 103 |
void io_init(void); |
| 104 |
|
| 105 |
//device properties interface
|
| 106 |
uhd::property_tree::sptr get_tree(void) const{ |
| 107 |
return _tree;
|
| 108 |
} |
| 109 |
|
| 110 |
std::vector<boost::weak_ptr<uhd::rx_streamer> > _rx_streamers; |
| 111 |
std::vector<boost::weak_ptr<uhd::tx_streamer> > _tx_streamers; |
| 112 |
|
| 113 |
void check_fw_compat(void); |
| 114 |
void check_fpga_compat(void); |
| 115 |
double update_rx_codec_gain(const double); //sets A and B at once |
| 116 |
void set_mb_eeprom(const uhd::usrp::mboard_eeprom_t &); |
| 117 |
void set_db_eeprom(const std::string &, const uhd::usrp::dboard_eeprom_t &); |
| 118 |
void update_tick_rate(const double rate); |
| 119 |
void update_rx_samp_rate(const size_t, const double rate); |
| 120 |
void update_tx_samp_rate(const size_t, const double rate); |
| 121 |
void update_rates(void); |
| 122 |
void update_rx_subdev_spec(const uhd::usrp::subdev_spec_t &); |
| 123 |
void update_tx_subdev_spec(const uhd::usrp::subdev_spec_t &); |
| 124 |
void update_clock_source(const std::string &); |
| 125 |
void reset_gpif(const boost::uint16_t); |
| 126 |
void enable_gpif(const bool); |
| 127 |
void clear_fpga_fifo(void); |
| 128 |
void handle_async_message(uhd::transport::managed_recv_buffer::sptr);
|
| 129 |
uhd::sensor_value_t get_ref_locked(void);
|
| 130 |
void set_rx_fe_corrections(const double); |
| 131 |
void set_tx_fe_corrections(const double); |
| 132 |
}; |
| 133 |
|
| 134 |
#endif /* INCLUDED_b100_IMPL_HPP */ |