diff options
author | Josh Blum <josh@joshknows.com> | 2010-12-16 00:07:19 -0800 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2010-12-16 00:07:19 -0800 |
commit | 28194df43e34b8f5c89d7a3f0fdea0be3a15b7b2 (patch) | |
tree | ed0a45655371281d2ef9da6581e4ef4d19157e35 | |
parent | fa7d4a2a15cf332085b218373e7746604285bf2c (diff) | |
download | uhd-28194df43e34b8f5c89d7a3f0fdea0be3a15b7b2.tar.gz uhd-28194df43e34b8f5c89d7a3f0fdea0be3a15b7b2.tar.bz2 uhd-28194df43e34b8f5c89d7a3f0fdea0be3a15b7b2.zip |
usrp2: brought err0 transports into device and mboard constructors
-rw-r--r-- | host/lib/usrp/usrp2/mboard_impl.cpp | 7 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/usrp2_impl.cpp | 17 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/usrp2_impl.hpp | 6 |
3 files changed, 23 insertions, 7 deletions
diff --git a/host/lib/usrp/usrp2/mboard_impl.cpp b/host/lib/usrp/usrp2/mboard_impl.cpp index b64d4e3f6..9afa6eda7 100644 --- a/host/lib/usrp/usrp2/mboard_impl.cpp +++ b/host/lib/usrp/usrp2/mboard_impl.cpp @@ -38,6 +38,7 @@ usrp2_mboard_impl::usrp2_mboard_impl( size_t index, transport::udp_simple::sptr ctrl_transport, transport::zero_copy_if::sptr data_transport, + transport::zero_copy_if::sptr err0_transport, const device_addr_t &device_args, size_t recv_samps_per_packet ): @@ -47,11 +48,15 @@ usrp2_mboard_impl::usrp2_mboard_impl( //Send a small data packet so the usrp2 knows the udp source port. //This setup must happen before further initialization occurs //or the async update packets will cause ICMP destination unreachable. - transport::managed_send_buffer::sptr send_buff = data_transport->get_send_buff(); + transport::managed_send_buffer::sptr send_buff; static const boost::uint32_t data[2] = { uhd::htonx(boost::uint32_t(0 /* don't care seq num */)), uhd::htonx(boost::uint32_t(USRP2_INVALID_VRT_HEADER)) }; + send_buff = data_transport->get_send_buff(); + std::memcpy(send_buff->cast<void*>(), &data, sizeof(data)); + send_buff->commit(sizeof(data)); + send_buff = err0_transport->get_send_buff(); std::memcpy(send_buff->cast<void*>(), &data, sizeof(data)); send_buff->commit(sizeof(data)); diff --git a/host/lib/usrp/usrp2/usrp2_impl.cpp b/host/lib/usrp/usrp2/usrp2_impl.cpp index 133c39a35..ca4a463b7 100644 --- a/host/lib/usrp/usrp2/usrp2_impl.cpp +++ b/host/lib/usrp/usrp2/usrp2_impl.cpp @@ -201,6 +201,7 @@ sep_indexed_dev_addrs(device_addr); //create a ctrl and data transport for each address std::vector<udp_simple::sptr> ctrl_transports; std::vector<zero_copy_if::sptr> data_transports; + std::vector<zero_copy_if::sptr> err0_transports; const device_addrs_t device_addrs = sep_indexed_dev_addrs(device_addr); BOOST_FOREACH(const device_addr_t &dev_addr_i, device_addrs){ @@ -210,12 +211,15 @@ sep_indexed_dev_addrs(device_addr); data_transports.push_back(udp_zero_copy::make( dev_addr_i["addr"], num2str(USRP2_UDP_DATA_PORT), device_addr )); + err0_transports.push_back(udp_zero_copy::make( + dev_addr_i["addr"], num2str(USRP2_UDP_ERR0_PORT), device_addr + )); } //create the usrp2 implementation guts - return device::sptr( - new usrp2_impl(ctrl_transports, data_transports, device_addrs) - ); + return device::sptr(new usrp2_impl( + ctrl_transports, data_transports, err0_transports, device_addrs + )); } UHD_STATIC_BLOCK(register_usrp2_device){ @@ -228,9 +232,11 @@ UHD_STATIC_BLOCK(register_usrp2_device){ usrp2_impl::usrp2_impl( std::vector<udp_simple::sptr> ctrl_transports, std::vector<zero_copy_if::sptr> data_transports, + std::vector<zero_copy_if::sptr> err0_transports, const device_addrs_t &device_args ): - _data_transports(data_transports) + _data_transports(data_transports), + _err0_transports(err0_transports) { //setup rx otw type _rx_otw_type.width = 16; @@ -247,7 +253,8 @@ usrp2_impl::usrp2_impl( //create a new mboard handler for each control transport for(size_t i = 0; i < device_args.size(); i++){ _mboards.push_back(usrp2_mboard_impl::sptr(new usrp2_mboard_impl( - i, ctrl_transports[i], data_transports[i], device_args[i], + i, ctrl_transports[i], data_transports[i], + err0_transports[i], device_args[i], this->get_max_recv_samps_per_packet() ))); //use an empty name when there is only one mboard diff --git a/host/lib/usrp/usrp2/usrp2_impl.hpp b/host/lib/usrp/usrp2/usrp2_impl.hpp index 16a7a0a7c..be97e1121 100644 --- a/host/lib/usrp/usrp2/usrp2_impl.hpp +++ b/host/lib/usrp/usrp2/usrp2_impl.hpp @@ -85,6 +85,7 @@ public: size_t index, uhd::transport::udp_simple::sptr, uhd::transport::zero_copy_if::sptr, + uhd::transport::zero_copy_if::sptr, const uhd::device_addr_t &device_args, size_t recv_samps_per_packet ); @@ -185,11 +186,13 @@ public: * Create a new usrp2 impl base. * \param ctrl_transports the udp transports for control * \param data_transports the udp transports for data - * \param flow_control_hints optional flow control params + * \param err0_transports the udp transports for error + * \param device_args optional misc device parameters */ usrp2_impl( std::vector<uhd::transport::udp_simple::sptr> ctrl_transports, std::vector<uhd::transport::zero_copy_if::sptr> data_transports, + std::vector<uhd::transport::zero_copy_if::sptr> err0_transports, const uhd::device_addrs_t &device_args ); @@ -221,6 +224,7 @@ private: //io impl methods and members std::vector<uhd::transport::zero_copy_if::sptr> _data_transports; + std::vector<uhd::transport::zero_copy_if::sptr> _err0_transports; uhd::otw_type_t _rx_otw_type, _tx_otw_type; UHD_PIMPL_DECL(io_impl) _io_impl; void io_init(void); |