Editing Tagged Stream Blocks
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
− | |||
== Introduction == | == Introduction == | ||
Line 6: | Line 5: | ||
traditional GNU Radio blocks, if we stream N bytes into a block, there's no way of | traditional GNU Radio blocks, if we stream N bytes into a block, there's no way of | ||
knowing the packet boundary. This might be relevant: Perhaps the modulator has to | knowing the packet boundary. This might be relevant: Perhaps the modulator has to | ||
− | prepend a | + | prepend a synchronisation word before every packet, or append a CRC. So while some |
blocks don't care about packet boundaries, other blocks do: These are tagged | blocks don't care about packet boundaries, other blocks do: These are tagged | ||
stream blocks. | stream blocks. | ||
These blocks are different from all the other GNU Radio block types (gr::block, | These blocks are different from all the other GNU Radio block types (gr::block, | ||
− | gr::sync_block etc.) in that they are driven by the input: The PDU length tag tells the block how to operate, whereas other blocks are output-driven (the scheduler tries to fill up the output buffer | + | gr::sync_block etc.) in that they are driven by the input: The PDU length tag tells the block how to operate, whereas other blocks are output-driven (the scheduler tries to fill up the output buffer are much as possible). |
=== How do they work? === | === How do they work? === | ||
Line 43: | Line 42: | ||
Here's a minimal example of how the header file could look: | Here's a minimal example of how the header file could look: | ||
− | |||
#include <gnuradio/digital/api.h> | #include <gnuradio/digital/api.h> | ||
#include <gnuradio/tagged_stream_block.h> | #include <gnuradio/tagged_stream_block.h> | ||
Line 60: | Line 58: | ||
} // namespace digital | } // namespace digital | ||
} // namespace gr | } // namespace gr | ||
− | |||
It is very similar to any other block definition. Two things are stand out: First, | It is very similar to any other block definition. Two things are stand out: First, | ||
Line 72: | Line 69: | ||
The implementation header (*_impl.h) also looks a bit different (again this is cropped to the relevant parts): | The implementation header (*_impl.h) also looks a bit different (again this is cropped to the relevant parts): | ||
− | |||
− | |||
#include <digital/crc32_bb.h> | #include <digital/crc32_bb.h> | ||
namespace gr { | namespace gr { | ||
Line 93: | Line 88: | ||
} // namespace digital | } // namespace digital | ||
} // namespace gr | } // namespace gr | ||
− | |||
First, the work function signature is new. The argument list looks like that from | First, the work function signature is new. The argument list looks like that from | ||
Line 109: | Line 103: | ||
Finally, this is part of the actual block implementation (heavily cropped again, to highlight the relevant parts): | Finally, this is part of the actual block implementation (heavily cropped again, to highlight the relevant parts): | ||
− | |||
− | |||
#include <gnuradio/io_signature.h> | #include <gnuradio/io_signature.h> | ||
#include "crc32_bb_impl.h" | #include "crc32_bb_impl.h" | ||
Line 158: | Line 150: | ||
} // namespace digital | } // namespace digital | ||
} // namespace gr | } // namespace gr | ||
− | |||
The make function is not different to any other block. The constructor calls | The make function is not different to any other block. The constructor calls | ||
Line 284: | Line 275: | ||
Block: [https://github.com/gnuradio/gnuradio/blob/master/gr-digital/lib/ofdm_cyclic_prefixer_impl.cc ofdm_cyclic_prefixer] | Block: [https://github.com/gnuradio/gnuradio/blob/master/gr-digital/lib/ofdm_cyclic_prefixer_impl.cc ofdm_cyclic_prefixer] | ||
− | This block uses the gr::block | + | This block uses the gr::block behaviour fallback. |
=== Troubleshooting === | === Troubleshooting === |