diff options
author | Balint Seeber <balint@ettus.com> | 2013-11-19 13:30:21 -0800 |
---|---|---|
committer | Balint Seeber <balint@ettus.com> | 2013-11-19 13:30:21 -0800 |
commit | 48ab2a971e73e46a7165ca5ebfff9a946fd5e981 (patch) | |
tree | d3b07bd21a7327d35022ab5efe35d8298975cbe4 /host/lib/usrp/b200/b200_io_impl.cpp | |
parent | 01cfe2118f0bd72719809d2539c61df46a164fec (diff) | |
parent | 8a78802c10fa64af5d1ec7cf39ce389f003cce11 (diff) | |
download | uhd-48ab2a971e73e46a7165ca5ebfff9a946fd5e981.tar.gz uhd-48ab2a971e73e46a7165ca5ebfff9a946fd5e981.tar.bz2 uhd-48ab2a971e73e46a7165ca5ebfff9a946fd5e981.zip |
Merge remote-tracking branch 'origin/b200/dtor-master' into b200/kitchen_sink
Diffstat (limited to 'host/lib/usrp/b200/b200_io_impl.cpp')
-rw-r--r-- | host/lib/usrp/b200/b200_io_impl.cpp | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/host/lib/usrp/b200/b200_io_impl.cpp b/host/lib/usrp/b200/b200_io_impl.cpp index 1feeff1a3..7b09c87df 100644 --- a/host/lib/usrp/b200/b200_io_impl.cpp +++ b/host/lib/usrp/b200/b200_io_impl.cpp @@ -139,27 +139,44 @@ bool b200_impl::recv_async_msg( return _async_task_data->async_md->pop_with_timed_wait(async_metadata, timeout); } -void b200_impl::handle_async_task( +/* + * This method is constantly called in a msg_task loop. + * Incoming messages are dispatched in to the hosts radio_ctrl_cores. + * The radio_ctrl_core queues are accessed via a weak_ptr to them, stored in AsyncTaskData. + * During shutdown the radio_ctrl_core dtor's are called. + * An empty peek32(0) is sent out to flush pending async messages. + * The response to those messages can't be delivered to the ctrl_core queues anymore + * because the shared pointer corresponding to the weak_ptrs is no longer valid. + * Those stranded messages are put into a dump_queue implemented in msg_task. + * A radio_ctrl_core can search for missing messages there. + */ +boost::optional<uhd::msg_task::msg_type_t> b200_impl::handle_async_task( uhd::transport::zero_copy_if::sptr xport, boost::shared_ptr<AsyncTaskData> data ) { managed_recv_buffer::sptr buff = xport->get_recv_buff(); - if (not buff or buff->size() < 8) return; + if (not buff or buff->size() < 8) + return NULL; + const boost::uint32_t sid = uhd::wtohx(buff->cast<const boost::uint32_t *>()[1]); - switch (sid) - { + switch (sid) { //if the packet is a control response case B200_RESP0_MSG_SID: case B200_RESP1_MSG_SID: case B200_LOCAL_RESP_SID: { - radio_ctrl_core_3000::sptr ctrl; + radio_ctrl_core_3000::sptr ctrl; if (sid == B200_RESP0_MSG_SID) ctrl = data->radio_ctrl[0].lock(); if (sid == B200_RESP1_MSG_SID) ctrl = data->radio_ctrl[1].lock(); if (sid == B200_LOCAL_RESP_SID) ctrl = data->local_ctrl.lock(); - if (ctrl) ctrl->push_response(buff->cast<const boost::uint32_t *>()); + if (ctrl){ + ctrl->push_response(buff->cast<const boost::uint32_t *>()); + } + else{ + return std::make_pair(sid, uhd::msg_task::buff_to_vector(buff->cast<boost::uint8_t *>(), buff->size() ) ); + } break; } @@ -204,6 +221,7 @@ void b200_impl::handle_async_task( default: UHD_MSG(error) << "Got a ctrl packet with unknown SID " << sid << std::endl; } + return NULL; } /*********************************************************************** |