diff options
author | Johnathan Corgan <johnathan@corganlabs.com> | 2014-01-16 12:31:22 -0800 |
---|---|---|
committer | Johnathan Corgan <johnathan@corganlabs.com> | 2014-01-16 12:31:22 -0800 |
commit | 67aa043b837e38fc04d612ced68ff2e4558c06ea (patch) | |
tree | ee31a6d7af731083c26760d6d98fe530922974e7 | |
parent | df5dfc35ea76425f6f3505087b58e565b2189636 (diff) | |
parent | c9c4ffc9153a2b57dd25451bdbcfc06991e1f24b (diff) |
Merge remote-tracking branch 'martin/ofdm-fixes'
4 files changed, 23 insertions, 9 deletions
diff --git a/gr-digital/grc/digital_packet_headergenerator_bb.xml b/gr-digital/grc/digital_packet_headergenerator_bb.xml index a0ec14ae80..25dfcbb27b 100644 --- a/gr-digital/grc/digital_packet_headergenerator_bb.xml +++ b/gr-digital/grc/digital_packet_headergenerator_bb.xml @@ -2,12 +2,18 @@ <name>Packet Header Generator</name> <key>digital_packet_headergenerator_bb</key> <import>from gnuradio import digital</import> - <make>digital.packet_headergenerator_bb($header_formatter)</make> + <make>digital.packet_headergenerator_bb($header_formatter, $len_tag_key)</make> <param> <name>Formatter Object</name> <key>header_formatter</key> <type>raw</type> </param> + <param> + <name>Length Tag Name</name> + <key>len_tag_key</key> + <value>"packet_len"</value> + <type>string</type> + </param> <sink> <name>in</name> <type>byte</type> diff --git a/gr-digital/include/gnuradio/digital/ofdm_carrier_allocator_cvc.h b/gr-digital/include/gnuradio/digital/ofdm_carrier_allocator_cvc.h index 1ea90a67d5..ab371a98e8 100644 --- a/gr-digital/include/gnuradio/digital/ofdm_carrier_allocator_cvc.h +++ b/gr-digital/include/gnuradio/digital/ofdm_carrier_allocator_cvc.h @@ -56,6 +56,11 @@ namespace gr { * with negative numbers, or with indexes larger than \p fft_len/2. Index -1 and index * \p fft_len-1 both identify the carrier below the DC carrier. * + * There are some basic checks in place during initialization which check that the + * carrier allocation table is valid. However, it is possible to overwrite data symbols + * with pilot symbols, or provide a carrier allocation that has mismatching pilot symbol + * positions and -values. + * * Tags are propagated such that a tag on an incoming complex symbol is mapped to the * corresponding OFDM symbol. There is one exception: If a tag is on the first OFDM * symbol, it is assumed that this tag should stay there, so it is moved to the front diff --git a/gr-digital/lib/ofdm_carrier_allocator_cvc_impl.cc b/gr-digital/lib/ofdm_carrier_allocator_cvc_impl.cc index 171fd95934..7c094abb92 100644 --- a/gr-digital/lib/ofdm_carrier_allocator_cvc_impl.cc +++ b/gr-digital/lib/ofdm_carrier_allocator_cvc_impl.cc @@ -87,9 +87,6 @@ namespace gr { } } for (unsigned i = 0; i < d_pilot_carriers.size(); i++) { - if (d_pilot_carriers[i].size() != pilot_symbols[i].size()) { - throw std::invalid_argument("pilot_carriers do not match pilot_symbols"); - } for (unsigned j = 0; j < d_pilot_carriers[i].size(); j++) { if (d_pilot_carriers[i][j] < 0) { d_pilot_carriers[i][j] += d_fft_len; @@ -102,6 +99,11 @@ namespace gr { } } } + for (unsigned i = 0; i < std::max(d_pilot_carriers.size(), d_pilot_symbols.size()); i++) { + if (d_pilot_carriers[i % d_pilot_carriers.size()].size() != d_pilot_symbols[i % d_pilot_symbols.size()].size()) { + throw std::invalid_argument("pilot_carriers do not match pilot_symbols"); + } + } for (unsigned i = 0; i < d_sync_words.size(); i++) { if (d_sync_words[i].size() != (unsigned) d_fft_len) { throw std::invalid_argument("sync words must be fft length"); @@ -180,12 +182,10 @@ namespace gr { } } // Copy pilot symbols - curr_set = 0; for (int i = 0; i < n_ofdm_symbols; i++) { - for (unsigned k = 0; k < d_pilot_carriers[curr_set].size(); k++) { - out[i * d_fft_len + d_pilot_carriers[curr_set][k]] = d_pilot_symbols[curr_set][k]; + for (unsigned k = 0; k < d_pilot_carriers[i % d_pilot_carriers.size()].size(); k++) { + out[i * d_fft_len + d_pilot_carriers[i % d_pilot_carriers.size()][k]] = d_pilot_symbols[i % d_pilot_symbols.size()][k]; } - curr_set = (curr_set + 1) % d_pilot_carriers.size(); } return n_ofdm_symbols + d_sync_words.size(); diff --git a/gr-digital/lib/packet_headergenerator_bb_impl.cc b/gr-digital/lib/packet_headergenerator_bb_impl.cc index a0191fe85a..def050dfb2 100644 --- a/gr-digital/lib/packet_headergenerator_bb_impl.cc +++ b/gr-digital/lib/packet_headergenerator_bb_impl.cc @@ -80,7 +80,10 @@ namespace gr { gr_vector_void_star &output_items) { unsigned char *out = (unsigned char *) output_items[0]; - if (!d_formatter->header_formatter(ninput_items[0], out)) { + + std::vector<tag_t> tags; + get_tags_in_range(tags, 0, nitems_read(0), nitems_read(0) + ninput_items[0]); + if (!d_formatter->header_formatter(ninput_items[0], out, tags)) { GR_LOG_FATAL(d_logger, boost::format("header_formatter() returned false (this shouldn't happen). Offending header started at %1%") % nitems_read(0)); throw std::runtime_error("header formatter returned false."); } |