summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Blum2012-08-22 18:33:37 -0700
committerJosh Blum2012-08-26 16:03:51 -0700
commit963f04378fcf2693518ec4eeb43c67abb41e4cbf (patch)
treed7fec75e28a615960481de5a106370a56389df9a
parent9245a625b6119143934adeb09a1782a4ed3d5b22 (diff)
downloadsandhi-963f04378fcf2693518ec4eeb43c67abb41e4cbf.tar.gz
sandhi-963f04378fcf2693518ec4eeb43c67abb41e4cbf.tar.bz2
sandhi-963f04378fcf2693518ec4eeb43c67abb41e4cbf.zip
runtime: fill in more top block hooks
-rw-r--r--lib/block.cpp2
-rw-r--r--lib/block_handlers.cpp2
-rw-r--r--lib/element_impl.hpp7
-rw-r--r--lib/top_block.cpp13
4 files changed, 16 insertions, 8 deletions
diff --git a/lib/block.cpp b/lib/block.cpp
index 3719b24..f9ad12a 100644
--- a/lib/block.cpp
+++ b/lib/block.cpp
@@ -36,7 +36,7 @@ Block::Block(const std::string &name):
tsbe::BlockConfig config;
config.port_callback = boost::bind(&ElementImpl::handle_port_msg, this->get(), _1, _2);
- config.update_callback = boost::bind(&ElementImpl::topology_update, this->get(), _1);
+ config.update_callback = boost::bind(&ElementImpl::topology_update, this->get(), _1, _2);
//TODO other callbacks
(*this)->block = tsbe::Block(config);
diff --git a/lib/block_handlers.cpp b/lib/block_handlers.cpp
index fa9a950..ab58aaf 100644
--- a/lib/block_handlers.cpp
+++ b/lib/block_handlers.cpp
@@ -39,7 +39,7 @@ void resize_fill_front(V &v, const size_t new_len)
resize_fill(v, new_len, v.front());
}
-void ElementImpl::topology_update(const tsbe::TaskInterface &task_iface)
+void ElementImpl::topology_update(const tsbe::TaskInterface &task_iface, const tsbe::Wax &state)
{
const size_t num_inputs = task_iface.get_num_inputs();
const size_t num_outputs = task_iface.get_num_outputs();
diff --git a/lib/element_impl.hpp b/lib/element_impl.hpp
index 2de54fe..c0d5211 100644
--- a/lib/element_impl.hpp
+++ b/lib/element_impl.hpp
@@ -19,12 +19,16 @@
#include <tsbe/block.hpp>
#include <tsbe/topology.hpp>
+#include <tsbe/executor.hpp>
#include <gnuradio/element.hpp>
#include <gnuradio/block.hpp>
#include <gr_types.h>
#include <gr_io_signature.h>
#include <vector>
+static const int STATE_INERT = 0;
+static const int STATE_ACTIVE = 1;
+
static inline int mylround(double x)
{
return int(x + 0.5);
@@ -68,6 +72,7 @@ struct ElementImpl
tsbe::Block block;
tsbe::Topology topology;
+ tsbe::Executor executor;
const tsbe::Element &get_elem(void)
{
if (block) return block;
@@ -75,7 +80,7 @@ struct ElementImpl
}
void handle_port_msg(const size_t, const tsbe::Wax &);
- void topology_update(const tsbe::TaskInterface &);
+ void topology_update(const tsbe::TaskInterface &, const tsbe::Wax &);
bool enble_fixed_rate;
double relative_rate;
diff --git a/lib/top_block.cpp b/lib/top_block.cpp
index 268064e..62cc3d2 100644
--- a/lib/top_block.cpp
+++ b/lib/top_block.cpp
@@ -14,6 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License
// along with io_sig program. If not, see <http://www.gnu.org/licenses/>.
+#include "element_impl.hpp"
#include <gnuradio/top_block.hpp>
using namespace gnuradio;
@@ -26,25 +27,27 @@ TopBlock::TopBlock(void)
TopBlock::TopBlock(const std::string &name):
HierBlock(name)
{
- //TODO
+ tsbe::ExecutorConfig config;
+ config.topology = (*this)->topology;
+ (*this)->executor = tsbe::Executor(config);
}
void TopBlock::update(void)
{
-
+ (*this)->executor.update();
}
void TopBlock::start(void)
{
-
+ (*this)->executor.set_state(STATE_ACTIVE);
}
void TopBlock::stop(void)
{
-
+ (*this)->executor.set_state(STATE_INERT);
}
void TopBlock::wait(void)
{
-
+ //NOP/TODO?
}