diff options
| author | Josh Blum <josh@joshknows.com> | 2010-05-17 09:52:43 -0700 | 
|---|---|---|
| committer | Josh Blum <josh@joshknows.com> | 2010-05-17 09:52:43 -0700 | 
| commit | d20595a3fe9ba864d824c160c3db39fc7a3d1e7c (patch) | |
| tree | 4331866545f1ee5394247b724cbd6173ed64e0f0 /host/lib/usrp/usrp2/io_impl.cpp | |
| parent | 695dd535d5a7419f467598a90c51c7e0f3d611e5 (diff) | |
| download | uhd-d20595a3fe9ba864d824c160c3db39fc7a3d1e7c.tar.gz uhd-d20595a3fe9ba864d824c160c3db39fc7a3d1e7c.tar.bz2 uhd-d20595a3fe9ba864d824c160c3db39fc7a3d1e7c.zip | |
calculate max samples per packet using otw type
Diffstat (limited to 'host/lib/usrp/usrp2/io_impl.cpp')
| -rw-r--r-- | host/lib/usrp/usrp2/io_impl.cpp | 23 | 
1 files changed, 15 insertions, 8 deletions
| diff --git a/host/lib/usrp/usrp2/io_impl.cpp b/host/lib/usrp/usrp2/io_impl.cpp index 7c9d003ce..de0c76eb1 100644 --- a/host/lib/usrp/usrp2/io_impl.cpp +++ b/host/lib/usrp/usrp2/io_impl.cpp @@ -31,10 +31,16 @@ namespace asio = boost::asio;   * Helper Functions   **********************************************************************/  void usrp2_impl::io_init(void){ -    //setup otw type -    _otw_type.width = 16; -    _otw_type.shift = 0; -    _otw_type.byteorder = otw_type_t::BO_BIG_ENDIAN; +    //setup rx otw type +    _rx_otw_type.width = 16; +    _rx_otw_type.shift = 0; +    _rx_otw_type.byteorder = otw_type_t::BO_BIG_ENDIAN; + +    //setup tx otw type +    _tx_otw_type.width = 16; +    _tx_otw_type.shift = 0; +    _tx_otw_type.byteorder = otw_type_t::BO_BIG_ENDIAN; +      //initially empty copy buffer      _rx_copy_buff = asio::buffer("", 0); @@ -49,7 +55,8 @@ void usrp2_impl::io_init(void){      send_buff->done(sizeof(data));      //setup RX DSP regs -    _iface->poke32(FR_RX_CTRL_NSAMPS_PER_PKT, _max_rx_samples_per_packet); +    std::cout << "RX samples per packet: " << max_rx_samps_per_packet() << std::endl; +    _iface->poke32(FR_RX_CTRL_NSAMPS_PER_PKT, max_rx_samps_per_packet());      _iface->poke32(FR_RX_CTRL_NCHANNELS, 1);      _iface->poke32(FR_RX_CTRL_CLEAR_OVERRUN, 1); //reset      _iface->poke32(FR_RX_CTRL_VRT_HEADER, 0 @@ -121,7 +128,7 @@ size_t usrp2_impl::send(      boost::uint32_t *tx_mem = send_buff->cast<boost::uint32_t *>();      size_t num_samps = std::min(std::min(          asio::buffer_size(buff)/io_type.size, -        size_t(_max_tx_samples_per_packet)), +        size_t(max_tx_samps_per_packet())),          send_buff->size()/io_type.size      ); @@ -148,7 +155,7 @@ size_t usrp2_impl::send(      //copy-convert the samples into the send buffer      convert_io_type_to_otw_type(          asio::buffer_cast<const void*>(buff), io_type, -        (void*)items, _otw_type, +        (void*)items, _tx_otw_type,          num_samps      ); @@ -192,7 +199,7 @@ size_t usrp2_impl::recv(      //copy-convert the samples from the recv buffer      convert_otw_type_to_io_type( -        (const void*)items, _otw_type, +        (const void*)items, _rx_otw_type,          asio::buffer_cast<void*>(buff), io_type,          num_samps      ); | 
