aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/rfnoc
diff options
context:
space:
mode:
Diffstat (limited to 'host/lib/rfnoc')
-rw-r--r--host/lib/rfnoc/block_ctrl_base.cpp1
-rw-r--r--host/lib/rfnoc/ctrl_iface.cpp100
-rw-r--r--host/lib/rfnoc/ctrl_iface.hpp12
-rw-r--r--host/lib/rfnoc/xports.hpp2
4 files changed, 14 insertions, 101 deletions
diff --git a/host/lib/rfnoc/block_ctrl_base.cpp b/host/lib/rfnoc/block_ctrl_base.cpp
index c273fa76b..20299a3c3 100644
--- a/host/lib/rfnoc/block_ctrl_base.cpp
+++ b/host/lib/rfnoc/block_ctrl_base.cpp
@@ -48,7 +48,6 @@ inline uint32_t _sr_to_addr64(uint32_t reg) { return reg * 8; }; // for peek64
block_ctrl_base::block_ctrl_base(
const make_args_t &make_args
) : _tree(make_args.tree),
- _transport_is_big_endian(make_args.is_big_endian),
_ctrl_ifaces(make_args.ctrl_ifaces),
_base_address(make_args.base_address & 0xFFF0)
{
diff --git a/host/lib/rfnoc/ctrl_iface.cpp b/host/lib/rfnoc/ctrl_iface.cpp
index b2ac1778e..8e4474af7 100644
--- a/host/lib/rfnoc/ctrl_iface.cpp
+++ b/host/lib/rfnoc/ctrl_iface.cpp
@@ -16,7 +16,6 @@
//
#include "ctrl_iface.hpp"
-#include "async_packet_handler.hpp"
#include <uhd/exception.hpp>
#include <uhd/utils/msg.hpp>
#include <uhd/utils/byteswap.hpp>
@@ -37,7 +36,6 @@ using namespace uhd::transport;
static const double ACK_TIMEOUT = 2.0; //supposed to be worst case practical timeout
static const double MASSIVE_TIMEOUT = 10.0; //for when we wait on a timed command
-static const size_t SR_READBACK = 32;
ctrl_iface::~ctrl_iface(void){
/* NOP */
@@ -60,13 +58,12 @@ public:
_name(name),
_seq_out(0),
_timeout(ACK_TIMEOUT),
- _resp_queue(128/*max response msgs*/),
- _resp_queue_size(_resp_xport ? _resp_xport->get_num_recv_frames() : 3),
+ _resp_queue_size(_resp_xport->get_num_recv_frames()),
_rb_address(uhd::rfnoc::SR_READBACK)
{
- if (resp_xport) {
- while (resp_xport->get_recv_buff(0.0)) {} //flush
- }
+ UHD_ASSERT_THROW(_ctrl_xport);
+ UHD_ASSERT_THROW(_resp_xport);
+ while (resp_xport->get_recv_buff(0.0)) {} //flush
this->set_time(uhd::time_spec_t(0.0));
this->set_tick_rate(1.0); //something possible but bogus
}
@@ -76,7 +73,6 @@ public:
_timeout = ACK_TIMEOUT; //reset timeout to something small
UHD_SAFE_CALL(
this->peek32(0);//dummy peek with the purpose of ack'ing all packets
- _async_task.reset();//now its ok to release the task
)
}
@@ -196,50 +192,16 @@ private:
uint32_t const *pkt = NULL;
managed_recv_buffer::sptr buff;
- //get buffer from response endpoint - or die in timeout
- if (_resp_xport)
- {
- buff = _resp_xport->get_recv_buff(_timeout);
- try
- {
- UHD_ASSERT_THROW(bool(buff));
- UHD_ASSERT_THROW(buff->size() > 0);
- }
- catch(const std::exception &ex)
- {
- throw uhd::io_error(str(boost::format("Block ctrl (%s) no response packet - %s") % _name % ex.what()));
- }
- pkt = buff->cast<const uint32_t *>();
- packet_info.num_packet_words32 = buff->size()/sizeof(uint32_t);
+ buff = _resp_xport->get_recv_buff(_timeout);
+ try {
+ UHD_ASSERT_THROW(bool(buff));
+ UHD_ASSERT_THROW(buff->size() > 0);
}
-
- //get buffer from response endpoint - or die in timeout
- else
- {
- /*
- * Couldn't get message with haste.
- * Now check both possible queues for messages.
- * Messages should come in on _resp_queue,
- * but could end up in dump_queue.
- * If we don't get a message --> Die in timeout.
- */
- double accum_timeout = 0.0;
- const double short_timeout = 0.005; // == 5ms
- while(not ((_resp_queue.pop_with_haste(resp_buff))
- || (check_dump_queue(resp_buff))
- || (_resp_queue.pop_with_timed_wait(resp_buff, short_timeout))
- )){
- /*
- * If a message couldn't be received within a given timeout
- * --> throw AssertionError!
- */
- accum_timeout += short_timeout;
- UHD_ASSERT_THROW(accum_timeout < _timeout);
- }
-
- pkt = resp_buff.data;
- packet_info.num_packet_words32 = sizeof(resp_buff)/sizeof(uint32_t);
+ catch(const std::exception &ex) {
+ throw uhd::io_error(str(boost::format("Block ctrl (%s) no response packet - %s") % _name % ex.what()));
}
+ pkt = buff->cast<const uint32_t *>();
+ packet_info.num_packet_words32 = buff->size()/sizeof(uint32_t);
//parse the buffer
try
@@ -306,48 +268,11 @@ private:
return 0;
}
- /*
- * If ctrl_core waits for a message that didn't arrive it can search for it in the dump queue.
- * This actually happens during shutdown.
- * handle_async_task can't access queue anymore thus it returns the corresponding message.
- * msg_task class implements a dump_queue to store such messages.
- * With check_dump_queue we can check if a message we are waiting for got stranded there.
- * If a message got stuck we get it here and push it onto our own message_queue.
- */
- bool check_dump_queue(resp_buff_type& b) {
- const size_t min_buff_size = 8; // Same value as in b200_io_impl->handle_async_task
- uint32_t recv_sid = (((_sid)<<16)|((_sid)>>16));
- uhd::msg_task::msg_payload_t msg;
- do{
- msg = _async_task->get_msg_from_dump_queue(recv_sid);
- }
- while(msg.size() < min_buff_size && msg.size() != 0);
-
- if(msg.size() >= min_buff_size) {
- memcpy(b.data, &msg.front(), std::min(msg.size(), sizeof(b.data)));
- return true;
- }
- return false;
- }
-
- void push_response(const uint32_t *buff)
- {
- resp_buff_type resp_buff;
- std::memcpy(resp_buff.data, buff, sizeof(resp_buff));
- _resp_queue.push_with_haste(resp_buff);
- }
-
- void hold_task(uhd::msg_task::sptr task)
- {
- _async_task = task;
- }
-
const vrt::if_packet_info_t::link_type_t _link_type;
const vrt::if_packet_info_t::packet_type_t _packet_type;
const bool _bige;
const uhd::transport::zero_copy_if::sptr _ctrl_xport;
const uhd::transport::zero_copy_if::sptr _resp_xport;
- uhd::msg_task::sptr _async_task;
const uint32_t _sid;
const std::string _name;
boost::mutex _mutex;
@@ -357,7 +282,6 @@ private:
double _tick_rate;
double _timeout;
std::queue<size_t> _outstanding_seqs;
- bounded_buffer<resp_buff_type> _resp_queue;
const size_t _resp_queue_size;
const size_t _rb_address;
diff --git a/host/lib/rfnoc/ctrl_iface.hpp b/host/lib/rfnoc/ctrl_iface.hpp
index 3690874f9..5e88c3dd6 100644
--- a/host/lib/rfnoc/ctrl_iface.hpp
+++ b/host/lib/rfnoc/ctrl_iface.hpp
@@ -47,18 +47,6 @@ public:
const std::string &name = "0"
);
- //! Hold a ref to a task thats feeding push response
- virtual void hold_task(uhd::msg_task::sptr task) = 0;
-
- //! Push a response externall (resp_xport is NULL)
- virtual void push_response(const uint32_t *buff) = 0;
-
- //! Set the command time that will activate
- virtual void set_time(const uhd::time_spec_t &time) = 0;
-
- //! Get the command time that will activate
- virtual uhd::time_spec_t get_time(void) = 0;
-
//! Set the tick rate (converting time into ticks)
virtual void set_tick_rate(const double rate) = 0;
};
diff --git a/host/lib/rfnoc/xports.hpp b/host/lib/rfnoc/xports.hpp
index 7872f2e1b..1ce05c6c8 100644
--- a/host/lib/rfnoc/xports.hpp
+++ b/host/lib/rfnoc/xports.hpp
@@ -16,6 +16,7 @@
//
#include <uhd/types/sid.hpp>
+#include <uhd/types/endianness.hpp>
#include <uhd/transport/zero_copy.hpp>
namespace uhd {
@@ -30,6 +31,7 @@ namespace uhd {
size_t send_buff_size;
uhd::sid_t send_sid;
uhd::sid_t recv_sid;
+ uhd::endianness_t endianness;
};
};