summaryrefslogtreecommitdiff
path: root/gnuradio-runtime
diff options
context:
space:
mode:
authorJohnathan Corgan <johnathan@corganlabs.com>2013-05-12 09:46:25 +1000
committerJohnathan Corgan <johnathan@corganlabs.com>2013-05-12 09:46:25 +1000
commit792302fbdfa37cf680234353dbe973886c4b2898 (patch)
treee999bcf6dbfe12cf19ae49b1762cd71d724aa8ae /gnuradio-runtime
parenta7adf4689b58d91bd88d0dc948b017e1d42bff01 (diff)
parent9851f2377d099ffe72312375e7f761f66b664aa6 (diff)
Merge branch 'next' into runtime_pimpl
Catches up runtime_pimpl branch with changes on next since the initial branch start. Conflicts: gnuradio-runtime/include/gnuradio/constants.h gnuradio-runtime/include/gnuradio/tags.h gnuradio-runtime/include/gr_block_detail.h gnuradio-runtime/include/gr_buffer.h gnuradio-runtime/lib/CMakeLists.txt gnuradio-runtime/lib/gr_block.cc gnuradio-runtime/lib/gr_block_detail.cc gnuradio-runtime/lib/gr_block_executor.cc gnuradio-runtime/lib/gr_buffer.cc gnuradio-runtime/lib/gr_realtime.cc gr-blocks/lib/interleaved_short_to_complex_impl.cc
Diffstat (limited to 'gnuradio-runtime')
-rw-r--r--gnuradio-runtime/CMakeLists.txt1
-rw-r--r--gnuradio-runtime/include/gnuradio/block_detail.h15
-rw-r--r--gnuradio-runtime/include/gnuradio/buffer.h11
-rw-r--r--gnuradio-runtime/include/gnuradio/constants.h10
-rw-r--r--gnuradio-runtime/include/gnuradio/tags.h3
-rw-r--r--gnuradio-runtime/lib/CMakeLists.txt12
-rw-r--r--gnuradio-runtime/lib/block.cc6
-rw-r--r--gnuradio-runtime/lib/block_detail.cc16
-rw-r--r--gnuradio-runtime/lib/block_executor.cc8
-rw-r--r--gnuradio-runtime/lib/buffer.cc17
-rw-r--r--gnuradio-runtime/lib/controlport/frontend.ice5
-rw-r--r--gnuradio-runtime/lib/realtime.cc2
12 files changed, 65 insertions, 41 deletions
diff --git a/gnuradio-runtime/CMakeLists.txt b/gnuradio-runtime/CMakeLists.txt
index abdc969690..4940f7e58c 100644
--- a/gnuradio-runtime/CMakeLists.txt
+++ b/gnuradio-runtime/CMakeLists.txt
@@ -27,6 +27,7 @@ include(GrPython)
# Setup compatibility checks and defines
########################################################################
include(${CMAKE_CURRENT_SOURCE_DIR}/ConfigChecks.cmake)
+GR_CHECK_LINUX_SCHED_AVAIL()
########################################################################
# Register component
diff --git a/gnuradio-runtime/include/gnuradio/block_detail.h b/gnuradio-runtime/include/gnuradio/block_detail.h
index 0a8615a2b6..a76874a9be 100644
--- a/gnuradio-runtime/include/gnuradio/block_detail.h
+++ b/gnuradio-runtime/include/gnuradio/block_detail.h
@@ -114,13 +114,14 @@ namespace gr {
/*!
* \brief Removes a tag from the given input stream.
*
- * Calls gr::buffer::remove_item_tag(), which removes the tag from
- * its deque.
+ * Calls gr::buffer::remove_item_tag().
+ * The tag in question will then no longer appear on subsequent calls of get_tags_in_range().
*
* \param which_input an integer of which input stream to remove the tag from
* \param tag the tag object to add
+ * \param id The unique block ID (use gr::block::unique_id())
*/
- void remove_item_tag(unsigned int which_input, const tag_t &tag);
+ void remove_item_tag(unsigned int which_input, const tag_t &tag, long id);
/*!
* \brief Given a [start,end), returns a vector of all tags in the range.
@@ -135,11 +136,13 @@ namespace gr {
* \param which_input an integer of which input stream to pull from
* \param abs_start a uint64 count of the start of the range of interest
* \param abs_end a uint64 count of the end of the range of interest
+ * \param id Block ID
*/
void get_tags_in_range(std::vector<tag_t> &v,
unsigned int which_input,
uint64_t abs_start,
- uint64_t abs_end);
+ uint64_t abs_end,
+ long id);
/*!
* \brief Given a [start,end), returns a vector of all tags in the
@@ -158,12 +161,14 @@ namespace gr {
* \param abs_start a uint64 count of the start of the range of interest
* \param abs_end a uint64 count of the end of the range of interest
* \param key a PMT symbol to select only tags of this key
+ * \param id Block ID
*/
void get_tags_in_range(std::vector<tag_t> &v,
unsigned int which_input,
uint64_t abs_start,
uint64_t abs_end,
- const pmt::pmt_t &key);
+ const pmt::pmt_t &key,
+ long id);
/*!
* \brief Set core affinity of block to the cores in the vector
diff --git a/gnuradio-runtime/include/gnuradio/buffer.h b/gnuradio-runtime/include/gnuradio/buffer.h
index 490c8e0e9f..adf00d14ac 100644
--- a/gnuradio-runtime/include/gnuradio/buffer.h
+++ b/gnuradio-runtime/include/gnuradio/buffer.h
@@ -108,10 +108,15 @@ namespace gr {
* \brief Removes an existing tag from the buffer.
*
* If no such tag is found, does nothing.
+ * Note: Doesn't actually physically delete the tag, but
+ * marks it as deleted. For the user, this has the same effect:
+ * Any subsequent calls to get_tags_in_range() will not return
+ * the tag.
*
* \param tag the tag that needs to be removed
+ * \param id the unique ID of the block calling this function
*/
- void remove_item_tag(const tag_t &tag);
+ void remove_item_tag(const tag_t &tag, long id);
/*!
* \brief Removes all tags before \p max_time from buffer
@@ -273,10 +278,12 @@ namespace gr {
* \param v a vector reference to return tags into
* \param abs_start a uint64 count of the start of the range of interest
* \param abs_end a uint64 count of the end of the range of interest
+ * \param id the unique ID of the block to make sure already deleted tags are not returned
*/
void get_tags_in_range(std::vector<tag_t> &v,
uint64_t abs_start,
- uint64_t abs_end);
+ uint64_t abs_end,
+ long id);
// -------------------------------------------------------------------------
diff --git a/gnuradio-runtime/include/gnuradio/constants.h b/gnuradio-runtime/include/gnuradio/constants.h
index 5ae924ca0d..beba6f2745 100644
--- a/gnuradio-runtime/include/gnuradio/constants.h
+++ b/gnuradio-runtime/include/gnuradio/constants.h
@@ -29,27 +29,27 @@
namespace gr {
/*!
- * \brief return ./configure --prefix argument. Typically /usr/local
+ * \brief return SYSCONFDIR. Typically ${CMAKE_INSTALL_PREFIX}/etc or /etc
*/
GR_RUNTIME_API const std::string prefix();
/*!
- * \brief return ./configure --sysconfdir argument. Typically $prefix/etc or /etc
+ * \brief return SYSCONFDIR. Typically ${CMAKE_INSTALL_PREFIX}/etc or /etc
*/
GR_RUNTIME_API const std::string sysconfdir();
/*!
- * \brief return preferences file directory. Typically $sysconfdir/etc/conf.d
+ * \brief return preferences file directory. Typically ${SYSCONFDIR}/etc/conf.d
*/
GR_RUNTIME_API const std::string prefsdir();
/*!
- * \brief return date/time of build, as set when 'bootstrap' is run
+ * \brief return date/time of build, as set when 'cmake' is run
*/
GR_RUNTIME_API const std::string build_date();
/*!
- * \brief return version string defined in configure.ac
+ * \brief return version string defined by cmake (GrVersion.cmake)
*/
GR_RUNTIME_API const std::string version();
diff --git a/gnuradio-runtime/include/gnuradio/tags.h b/gnuradio-runtime/include/gnuradio/tags.h
index 5600601741..0bd7b8537f 100644
--- a/gnuradio-runtime/include/gnuradio/tags.h
+++ b/gnuradio-runtime/include/gnuradio/tags.h
@@ -42,6 +42,9 @@ namespace gr {
//! the source ID of \p tag (as a PMT)
pmt::pmt_t srcid;
+ //! Used by gr_buffer to mark a tagged as deleted by a specific block. You can usually ignore this.
+ std::vector<long> marked_deleted;
+
/*!
* Comparison function to test which tag, \p x or \p y, came
* first in time
diff --git a/gnuradio-runtime/lib/CMakeLists.txt b/gnuradio-runtime/lib/CMakeLists.txt
index 3206e3c224..a87141cb92 100644
--- a/gnuradio-runtime/lib/CMakeLists.txt
+++ b/gnuradio-runtime/lib/CMakeLists.txt
@@ -69,8 +69,6 @@ GR_INCLUDE_SUBDIRECTORY(math)
# Setup library
########################################################################
list(APPEND gnuradio_runtime_sources
- complex_vec_test.cc
- malloc16.c
basic_block.cc
block.cc
block_detail.cc
@@ -79,6 +77,7 @@ list(APPEND gnuradio_runtime_sources
block_registry.cc
buffer.cc
circular_file.cc
+ complex_vec_test.cc
feval.cc
flat_flowgraph.cc
flowgraph.cc
@@ -87,6 +86,7 @@ list(APPEND gnuradio_runtime_sources
io_signature.cc
local_sighandler.cc
logger.cc
+ malloc16.c
message.cc
misc.cc
msg_accepter.cc
@@ -94,10 +94,6 @@ list(APPEND gnuradio_runtime_sources
msg_queue.cc
pagesize.cc
prefs.cc
- tagged_stream_block.cc
- test.cc
- top_block.cc
- top_block_impl.cc
realtime.cc
scheduler.cc
scheduler_sts.cc
@@ -108,6 +104,10 @@ list(APPEND gnuradio_runtime_sources
sync_decimator.cc
sync_interpolator.cc
sys_paths.cc
+ tagged_stream_block.cc
+ test.cc
+ top_block.cc
+ top_block_impl.cc
tpb_detail.cc
tpb_thread_body.cc
vmcircbuf.cc
diff --git a/gnuradio-runtime/lib/block.cc b/gnuradio-runtime/lib/block.cc
index b38377e856..4246180d80 100644
--- a/gnuradio-runtime/lib/block.cc
+++ b/gnuradio-runtime/lib/block.cc
@@ -240,7 +240,7 @@ namespace gr {
block::remove_item_tag(unsigned int which_input,
const tag_t &tag)
{
- d_detail->remove_item_tag(which_input, tag);
+ d_detail->remove_item_tag(which_input, tag, unique_id());
}
void
@@ -248,7 +248,7 @@ namespace gr {
unsigned int which_output,
uint64_t start, uint64_t end)
{
- d_detail->get_tags_in_range(v, which_output, start, end);
+ d_detail->get_tags_in_range(v, which_output, start, end, unique_id());
}
void
@@ -257,7 +257,7 @@ namespace gr {
uint64_t start, uint64_t end,
const pmt::pmt_t &key)
{
- d_detail->get_tags_in_range(v, which_output, start, end, key);
+ d_detail->get_tags_in_range(v, which_output, start, end, key, unique_id());
}
block::tag_propagation_policy_t
diff --git a/gnuradio-runtime/lib/block_detail.cc b/gnuradio-runtime/lib/block_detail.cc
index a3ab4b3f7b..293412f513 100644
--- a/gnuradio-runtime/lib/block_detail.cc
+++ b/gnuradio-runtime/lib/block_detail.cc
@@ -171,14 +171,14 @@ namespace gr {
}
void
- block_detail::remove_item_tag(unsigned int which_input, const tag_t &tag)
+ block_detail::remove_item_tag(unsigned int which_input, const tag_t &tag, long id)
{
if(!pmt::is_symbol(tag.key)) {
throw pmt::wrong_type("block_detail::add_item_tag key", tag.key);
}
else {
// Add tag to gr_buffer's deque tags
- d_input[which_input]->buffer()->remove_item_tag(tag);
+ d_input[which_input]->buffer()->remove_item_tag(tag, id);
}
}
@@ -186,10 +186,11 @@ namespace gr {
block_detail::get_tags_in_range(std::vector<tag_t> &v,
unsigned int which_input,
uint64_t abs_start,
- uint64_t abs_end)
+ uint64_t abs_end,
+ long id)
{
// get from gr_buffer_reader's deque of tags
- d_input[which_input]->get_tags_in_range(v, abs_start, abs_end);
+ d_input[which_input]->get_tags_in_range(v, abs_start, abs_end, id);
}
void
@@ -197,14 +198,15 @@ namespace gr {
unsigned int which_input,
uint64_t abs_start,
uint64_t abs_end,
- const pmt::pmt_t &key)
+ const pmt::pmt_t &key,
+ long id)
{
std::vector<tag_t> found_items;
v.resize(0);
// get from gr_buffer_reader's deque of tags
- d_input[which_input]->get_tags_in_range(found_items, abs_start, abs_end);
+ d_input[which_input]->get_tags_in_range(found_items, abs_start, abs_end, id);
// Filter further by key name
pmt::pmt_t itemkey;
@@ -261,6 +263,7 @@ namespace gr {
d_avg_noutput_items = noutput_items;
d_var_noutput_items = 0;
for(size_t i=0; i < d_input.size(); i++) {
+ gr::thread::scoped_lock guard(*d_output[i]->mutex());
float pfull = static_cast<float>(d_input[i]->items_available()) /
static_cast<float>(d_input[i]->max_possible_items_available());
d_ins_input_buffers_full[i] = pfull;
@@ -268,6 +271,7 @@ namespace gr {
d_var_input_buffers_full[i] = 0;
}
for(size_t i=0; i < d_output.size(); i++) {
+ gr::thread::scoped_lock guard(*d_output[i]->mutex());
float pfull = 1.0f - static_cast<float>(d_output[i]->space_available()) /
static_cast<float>(d_output[i]->bufsize());
d_ins_output_buffers_full[i] = pfull;
diff --git a/gnuradio-runtime/lib/block_executor.cc b/gnuradio-runtime/lib/block_executor.cc
index 8059ea2d5a..b0eb2eccee 100644
--- a/gnuradio-runtime/lib/block_executor.cc
+++ b/gnuradio-runtime/lib/block_executor.cc
@@ -93,7 +93,7 @@ namespace gr {
static bool
propagate_tags(block::tag_propagation_policy_t policy, block_detail *d,
const std::vector<uint64_t> &start_nitems_read, double rrate,
- std::vector<tag_t> &rtags)
+ std::vector<tag_t> &rtags, long block_id)
{
// Move tags downstream
// if a sink, we don't need to move downstream
@@ -109,7 +109,7 @@ namespace gr {
// every tag on every input propogates to everyone downstream
for(int i = 0; i < d->ninputs(); i++) {
d->get_tags_in_range(rtags, i, start_nitems_read[i],
- d->nitems_read(i));
+ d->nitems_read(i), block_id);
std::vector<tag_t>::iterator t;
if(rrate == 1.0) {
@@ -135,7 +135,7 @@ namespace gr {
if(d->ninputs() == d->noutputs()) {
for(int i = 0; i < d->ninputs(); i++) {
d->get_tags_in_range(rtags, i, start_nitems_read[i],
- d->nitems_read(i));
+ d->nitems_read(i), block_id);
std::vector<tag_t>::iterator t;
for(t = rtags.begin(); t != rtags.end(); t++) {
@@ -450,7 +450,7 @@ namespace gr {
if(!propagate_tags(m->tag_propagation_policy(), d,
d_start_nitems_read, m->relative_rate(),
- d_returned_tags))
+ d_returned_tags, m->unique_id()))
goto were_done;
if(n == block::WORK_DONE)
diff --git a/gnuradio-runtime/lib/buffer.cc b/gnuradio-runtime/lib/buffer.cc
index 1bcfc2a6e4..cd6feefe34 100644
--- a/gnuradio-runtime/lib/buffer.cc
+++ b/gnuradio-runtime/lib/buffer.cc
@@ -228,13 +228,12 @@ namespace gr {
}
void
- buffer::remove_item_tag(const tag_t &tag)
+ buffer::remove_item_tag(const tag_t &tag, long id)
{
gr::thread::scoped_lock guard(*mutex());
for(std::deque<tag_t>::iterator it = d_item_tags.begin(); it != d_item_tags.end(); ++it) {
if(*it == tag) {
- d_item_tags.erase(it);
- break;
+ (*it).marked_deleted.push_back(id);
}
}
}
@@ -315,7 +314,8 @@ namespace gr {
void
buffer_reader::get_tags_in_range(std::vector<tag_t> &v,
uint64_t abs_start,
- uint64_t abs_end)
+ uint64_t abs_end,
+ long id)
{
gr::thread::scoped_lock guard(*mutex());
@@ -327,9 +327,14 @@ namespace gr {
item_time = (*itr).offset;
if((item_time >= abs_start) && (item_time < abs_end)) {
- v.push_back(*itr);
+ std::vector<long>::iterator id_itr;
+ id_itr = std::find(itr->marked_deleted.begin(), itr->marked_deleted.end(), id);
+ if (id_itr == itr->marked_deleted.end()) { // If id is not in the vector of marked blocks
+ v.push_back(*itr);
+ v.back().marked_deleted.clear();
+ }
}
-
+
itr++;
}
}
diff --git a/gnuradio-runtime/lib/controlport/frontend.ice b/gnuradio-runtime/lib/controlport/frontend.ice
index b7474f37bf..50d056df72 100644
--- a/gnuradio-runtime/lib/controlport/frontend.ice
+++ b/gnuradio-runtime/lib/controlport/frontend.ice
@@ -98,15 +98,14 @@ module GNURadio {
idempotent void setInfo(string k, string v) throws ReceiverFailure, NotSupported, InvalidSetting;
};
- interface Channel {
+ interface Channel extends Tuner {
void start();
void stop();
void destroyChannel() throws NotSupported;
idempotent bool active();
- idempotent ChannelStatus status();
+ idempotent ChannelStatus channelStat();
idempotent StreamInfo stream();
idempotent bool setComplex(bool complex) throws ReceiverFailure, NotSupported, InvalidSetting;
- idempotent void setInfo(string k, string v) throws ReceiverFailure, NotSupported, InvalidSetting;
idempotent void setStreamInfo(string k, string v) throws ReceiverFailure, NotSupported, InvalidSetting;
};
diff --git a/gnuradio-runtime/lib/realtime.cc b/gnuradio-runtime/lib/realtime.cc
index 81f92ae488..e3fea1c6a6 100644
--- a/gnuradio-runtime/lib/realtime.cc
+++ b/gnuradio-runtime/lib/realtime.cc
@@ -31,7 +31,7 @@ namespace gr {
rt_status_t
enable_realtime_scheduling()
{
- return enable_realtime_scheduling();
+ return gr::enable_realtime_scheduling();
}
} /* namespace gr */