summaryrefslogtreecommitdiff
path: root/gr-digital
diff options
context:
space:
mode:
Diffstat (limited to 'gr-digital')
-rw-r--r--gr-digital/CMakeLists.txt5
-rw-r--r--gr-digital/examples/CMakeLists.txt1
-rwxr-xr-xgr-digital/examples/berawgn.py57
-rw-r--r--gr-digital/examples/demod/ber_simulation.grc36
-rw-r--r--gr-digital/examples/demod/digital_freq_lock.grc512
-rw-r--r--gr-digital/examples/demod/dpsk_loopback.grc224
-rw-r--r--gr-digital/examples/demod/gfsk_loopback.grc480
-rw-r--r--gr-digital/examples/demod/gmsk_loopback.grc590
-rw-r--r--gr-digital/examples/demod/mpsk_demod.grc374
-rw-r--r--gr-digital/examples/demod/pam_sync.grc827
-rw-r--r--gr-digital/examples/demod/pam_timing.grc733
-rwxr-xr-xgr-digital/examples/example_costas.py30
-rwxr-xr-xgr-digital/examples/example_fll.py30
-rwxr-xr-xgr-digital/examples/example_timing.py43
-rwxr-xr-xgr-digital/examples/gen_whitener.py20
-rwxr-xr-xgr-digital/examples/narrowband/benchmark_add_channel.py16
-rwxr-xr-xgr-digital/examples/narrowband/benchmark_rx.py3
-rwxr-xr-xgr-digital/examples/narrowband/benchmark_tx.py3
-rwxr-xr-xgr-digital/examples/narrowband/digital_bert_rx.py17
-rwxr-xr-xgr-digital/examples/narrowband/digital_bert_tx.py14
-rw-r--r--gr-digital/examples/narrowband/receive_path.py21
-rwxr-xr-xgr-digital/examples/narrowband/rx_voice.py19
-rw-r--r--gr-digital/examples/narrowband/transmit_path.py7
-rwxr-xr-xgr-digital/examples/narrowband/tunnel.py5
-rwxr-xr-xgr-digital/examples/narrowband/tx_voice.py14
-rwxr-xr-xgr-digital/examples/ofdm/benchmark_add_channel.py14
-rwxr-xr-xgr-digital/examples/ofdm/benchmark_rx.py5
-rwxr-xr-xgr-digital/examples/ofdm/benchmark_tx.py3
-rwxr-xr-xgr-digital/examples/ofdm/ofdm_mod_demod_test.py179
-rw-r--r--gr-digital/examples/ofdm/receive_path.py7
-rw-r--r--gr-digital/examples/ofdm/rx_ofdm.grc18
-rw-r--r--gr-digital/examples/ofdm/transmit_path.py7
-rwxr-xr-xgr-digital/examples/ofdm/tunnel.py5
-rw-r--r--gr-digital/examples/ofdm/tx_ofdm.grc14
-rwxr-xr-xgr-digital/examples/snr_estimators.py24
-rw-r--r--gr-digital/grc/digital_block_tree.xml43
-rw-r--r--gr-digital/grc/digital_correlate_access_code_tag_bb.xml36
-rw-r--r--gr-digital/grc/digital_dxpsk_demod.xml11
-rw-r--r--gr-digital/grc/digital_dxpsk_mod.xml15
-rw-r--r--gr-digital/grc/digital_gmskmod_bc.xml2
-rw-r--r--gr-digital/grc/digital_mpsk_receiver_cc.xml20
-rw-r--r--gr-digital/grc/digital_ofdm_frame_sink.xml79
-rw-r--r--gr-digital/grc/digital_packet_sink.xml1
-rw-r--r--gr-digital/grc/digital_simple_framer.xml4
-rw-r--r--gr-digital/include/CMakeLists.txt111
-rw-r--r--gr-digital/include/digital/CMakeLists.txt99
-rw-r--r--gr-digital/include/digital/additive_scrambler_bb.h73
-rw-r--r--gr-digital/include/digital/api.h2
-rw-r--r--gr-digital/include/digital/binary_slicer_fb.h (renamed from gr-digital/include/digital_binary_slicer_fb.h)50
-rw-r--r--gr-digital/include/digital/chunks_to_symbols_XX.h.t76
-rw-r--r--gr-digital/include/digital/clock_recovery_mm_cc.h81
-rw-r--r--gr-digital/include/digital/clock_recovery_mm_ff.h78
-rw-r--r--gr-digital/include/digital/cma_equalizer_cc.h75
-rw-r--r--gr-digital/include/digital/constellation.h477
-rw-r--r--gr-digital/include/digital/constellation_decoder_cb.h62
-rw-r--r--gr-digital/include/digital/constellation_receiver_cb.h93
-rw-r--r--gr-digital/include/digital/correlate_access_code_bb.h74
-rw-r--r--gr-digital/include/digital/correlate_access_code_tag_bb.h70
-rw-r--r--gr-digital/include/digital/costas_loop_cc.h75
-rw-r--r--gr-digital/include/digital/cpmmod_bc.h118
-rw-r--r--gr-digital/include/digital/crc32.h (renamed from gr-digital/include/digital_crc32.h)44
-rw-r--r--gr-digital/include/digital/descrambler_bb.h61
-rw-r--r--gr-digital/include/digital/diff_decoder_bb.h (renamed from gr-digital/include/digital_diff_decoder_bb.h)58
-rw-r--r--gr-digital/include/digital/diff_encoder_bb.h (renamed from gr-digital/include/digital_diff_encoder_bb.h)59
-rw-r--r--gr-digital/include/digital/diff_phasor_cc.h (renamed from gr-digital/include/digital_diff_phasor_cc.h)61
-rw-r--r--gr-digital/include/digital/fll_band_edge_cc.h181
-rw-r--r--gr-digital/include/digital/framer_sink_1.h67
-rw-r--r--gr-digital/include/digital/glfsr.h65
-rw-r--r--gr-digital/include/digital/glfsr_source_b.h63
-rw-r--r--gr-digital/include/digital/glfsr_source_f.h63
-rw-r--r--gr-digital/include/digital/kurtotic_equalizer_cc.h63
-rw-r--r--gr-digital/include/digital/lfsr.h162
-rw-r--r--gr-digital/include/digital/lms_dd_equalizer_cc.h101
-rw-r--r--gr-digital/include/digital/map_bb.h (renamed from gr-digital/include/digital_map_bb.h)68
-rw-r--r--gr-digital/include/digital/metric_type.h (renamed from gr-digital/include/digital_metric_type.h)14
-rw-r--r--gr-digital/include/digital/mpsk_receiver_cc.h147
-rw-r--r--gr-digital/include/digital/mpsk_snr_est.h287
-rw-r--r--gr-digital/include/digital/mpsk_snr_est_cc.h96
-rw-r--r--gr-digital/include/digital/ofdm_cyclic_prefixer.h57
-rw-r--r--gr-digital/include/digital/ofdm_frame_acquisition.h82
-rw-r--r--gr-digital/include/digital/ofdm_frame_sink.h71
-rw-r--r--gr-digital/include/digital/ofdm_insert_preamble.h82
-rw-r--r--gr-digital/include/digital/ofdm_mapper_bcv.h67
-rw-r--r--gr-digital/include/digital/ofdm_sampler.h57
-rw-r--r--gr-digital/include/digital/packet_sink.h79
-rw-r--r--gr-digital/include/digital/pfb_clock_sync_ccf.h333
-rw-r--r--gr-digital/include/digital/pfb_clock_sync_fff.h319
-rw-r--r--gr-digital/include/digital/pn_correlator_cc.h63
-rw-r--r--gr-digital/include/digital/probe_density_b.h66
-rw-r--r--gr-digital/include/digital/probe_mpsk_snr_est_c.h94
-rw-r--r--gr-digital/include/digital/scrambler_bb.h59
-rw-r--r--gr-digital/include/digital/simple_correlator.h (renamed from gr-digital/swig/digital_simple_correlator.i)31
-rw-r--r--gr-digital/include/digital/simple_framer.h57
-rw-r--r--gr-digital/include/digital/simple_framer_sync.h57
-rw-r--r--gr-digital/include/digital_additive_scrambler_bb.h73
-rw-r--r--gr-digital/include/digital_api.h33
-rw-r--r--gr-digital/include/digital_bytes_to_syms.h62
-rw-r--r--gr-digital/include/digital_chunks_to_symbols_XX.h.t75
-rw-r--r--gr-digital/include/digital_clock_recovery_mm_cc.h117
-rw-r--r--gr-digital/include/digital_clock_recovery_mm_ff.h100
-rw-r--r--gr-digital/include/digital_cma_equalizer_cc.h103
-rw-r--r--gr-digital/include/digital_constellation.h526
-rw-r--r--gr-digital/include/digital_constellation_decoder_cb.h66
-rw-r--r--gr-digital/include/digital_constellation_receiver_cb.h103
-rw-r--r--gr-digital/include/digital_correlate_access_code_bb.h85
-rw-r--r--gr-digital/include/digital_correlate_access_code_tag_bb.h89
-rw-r--r--gr-digital/include/digital_costas_loop_cc.h117
-rw-r--r--gr-digital/include/digital_cpmmod_bc.h98
-rw-r--r--gr-digital/include/digital_crc32_bb.h2
-rw-r--r--gr-digital/include/digital_descrambler_bb.h62
-rw-r--r--gr-digital/include/digital_fll_band_edge_cc.h226
-rw-r--r--gr-digital/include/digital_framer_sink_1.h107
-rw-r--r--gr-digital/include/digital_glfsr_source_b.h78
-rw-r--r--gr-digital/include/digital_glfsr_source_f.h78
-rw-r--r--gr-digital/include/digital_gmskmod_bc.h63
-rw-r--r--gr-digital/include/digital_impl_mpsk_snr_est.h279
-rw-r--r--gr-digital/include/digital_kurtotic_equalizer_cc.h113
-rw-r--r--gr-digital/include/digital_lms_dd_equalizer_cc.h118
-rw-r--r--gr-digital/include/digital_mpsk_receiver_cc.h320
-rw-r--r--gr-digital/include/digital_mpsk_snr_est_cc.h115
-rw-r--r--gr-digital/include/digital_ofdm_carrier_allocator_cvc.h2
-rw-r--r--gr-digital/include/digital_ofdm_chanest_vcvc.h2
-rw-r--r--gr-digital/include/digital_ofdm_cyclic_prefixer.h2
-rw-r--r--gr-digital/include/digital_ofdm_equalizer_base.h2
-rw-r--r--gr-digital/include/digital_ofdm_equalizer_simpledfe.h10
-rw-r--r--gr-digital/include/digital_ofdm_equalizer_static.h4
-rw-r--r--gr-digital/include/digital_ofdm_frame_acquisition.h116
-rw-r--r--gr-digital/include/digital_ofdm_frame_sink.h127
-rw-r--r--gr-digital/include/digital_ofdm_insert_preamble.h107
-rw-r--r--gr-digital/include/digital_ofdm_mapper_bcv.h88
-rw-r--r--gr-digital/include/digital_ofdm_sampler.h68
-rw-r--r--gr-digital/include/digital_ofdm_sync_sc_cfb.h2
-rw-r--r--gr-digital/include/digital_packet_sink.h131
-rw-r--r--gr-digital/include/digital_pfb_clock_sync_ccf.h376
-rw-r--r--gr-digital/include/digital_pfb_clock_sync_fff.h376
-rw-r--r--gr-digital/include/digital_pn_correlator_cc.h72
-rw-r--r--gr-digital/include/digital_probe_density_b.h75
-rw-r--r--gr-digital/include/digital_probe_mpsk_snr_est_c.h113
-rw-r--r--gr-digital/include/digital_scrambler_bb.h62
-rw-r--r--gr-digital/include/digital_simple_correlator.h107
-rw-r--r--gr-digital/include/digital_simple_framer.h66
-rw-r--r--gr-digital/include/digital_simple_framer_sync.h51
-rw-r--r--gr-digital/lib/CMakeLists.txt150
-rw-r--r--gr-digital/lib/additive_scrambler_bb_impl.cc104
-rw-r--r--gr-digital/lib/additive_scrambler_bb_impl.h60
-rw-r--r--gr-digital/lib/binary_slicer_fb_impl.cc (renamed from gr-digital/lib/digital_binary_slicer_fb.cc)63
-rw-r--r--gr-digital/lib/binary_slicer_fb_impl.h (renamed from gr-digital/swig/digital_kurtotic_equalizer_cc.i)35
-rw-r--r--gr-digital/lib/chunks_to_symbols_XX_impl.cc.t80
-rw-r--r--gr-digital/lib/chunks_to_symbols_XX_impl.h.t (renamed from gr-digital/swig/digital_chunks_to_symbols_XX.i.t)43
-rw-r--r--gr-digital/lib/clock_recovery_mm_cc_impl.cc214
-rw-r--r--gr-digital/lib/clock_recovery_mm_cc_impl.h87
-rw-r--r--gr-digital/lib/clock_recovery_mm_ff_impl.cc120
-rw-r--r--gr-digital/lib/clock_recovery_mm_ff_impl.h81
-rw-r--r--gr-digital/lib/cma_equalizer_cc_impl.cc131
-rw-r--r--gr-digital/lib/cma_equalizer_cc_impl.h89
-rw-r--r--gr-digital/lib/constellation.cc669
-rw-r--r--gr-digital/lib/constellation_decoder_cb_impl.cc84
-rw-r--r--gr-digital/lib/constellation_decoder_cb_impl.h53
-rw-r--r--gr-digital/lib/constellation_receiver_cb_impl.cc133
-rw-r--r--gr-digital/lib/constellation_receiver_cb_impl.h70
-rw-r--r--gr-digital/lib/correlate_access_code_bb_impl.cc133
-rw-r--r--gr-digital/lib/correlate_access_code_bb_impl.h59
-rw-r--r--gr-digital/lib/correlate_access_code_tag_bb_impl.cc136
-rw-r--r--gr-digital/lib/correlate_access_code_tag_bb_impl.h61
-rw-r--r--gr-digital/lib/costas_loop_cc_impl.cc161
-rw-r--r--gr-digital/lib/costas_loop_cc_impl.h70
-rw-r--r--gr-digital/lib/cpmmod_bc_impl.cc125
-rw-r--r--gr-digital/lib/cpmmod_bc_impl.h68
-rw-r--r--gr-digital/lib/crc32.cc136
-rw-r--r--gr-digital/lib/descrambler_bb_impl.cc68
-rw-r--r--gr-digital/lib/descrambler_bb_impl.h (renamed from gr-digital/swig/digital_scrambler_bb.i)31
-rw-r--r--gr-digital/lib/diff_decoder_bb_impl.cc71
-rw-r--r--gr-digital/lib/diff_decoder_bb_impl.h (renamed from gr-digital/swig/digital_diff_phasor_cc.i)31
-rw-r--r--gr-digital/lib/diff_encoder_bb_impl.cc73
-rw-r--r--gr-digital/lib/diff_encoder_bb_impl.h (renamed from gr-digital/swig/digital_diff_encoder_bb.i)31
-rw-r--r--gr-digital/lib/diff_phasor_cc_impl.cc (renamed from gr-digital/lib/digital_diff_phasor_cc.cc)58
-rw-r--r--gr-digital/lib/diff_phasor_cc_impl.h (renamed from gr-digital/swig/digital_map_bb.i)27
-rw-r--r--gr-digital/lib/digital_additive_scrambler_bb.cc69
-rw-r--r--gr-digital/lib/digital_bytes_to_syms.cc74
-rw-r--r--gr-digital/lib/digital_chunks_to_symbols_XX.cc.t74
-rw-r--r--gr-digital/lib/digital_clock_recovery_mm_cc.cc217
-rw-r--r--gr-digital/lib/digital_clock_recovery_mm_ff.cc139
-rw-r--r--gr-digital/lib/digital_cma_equalizer_cc.cc46
-rw-r--r--gr-digital/lib/digital_constellation.cc596
-rw-r--r--gr-digital/lib/digital_constellation_decoder_cb.cc77
-rw-r--r--gr-digital/lib/digital_constellation_receiver_cb.cc126
-rw-r--r--gr-digital/lib/digital_correlate_access_code_bb.cc134
-rw-r--r--gr-digital/lib/digital_correlate_access_code_tag_bb.cc131
-rw-r--r--gr-digital/lib/digital_costas_loop_cc.cc153
-rw-r--r--gr-digital/lib/digital_cpmmod_bc.cc69
-rw-r--r--gr-digital/lib/digital_crc32.cc130
-rw-r--r--gr-digital/lib/digital_crc32_bb.cc8
-rw-r--r--gr-digital/lib/digital_descrambler_bb.cc56
-rw-r--r--gr-digital/lib/digital_diff_decoder_bb.cc61
-rw-r--r--gr-digital/lib/digital_diff_encoder_bb.cc62
-rw-r--r--gr-digital/lib/digital_fll_band_edge_cc.cc271
-rw-r--r--gr-digital/lib/digital_framer_sink_1.cc192
-rw-r--r--gr-digital/lib/digital_glfsr_source_b.cc86
-rw-r--r--gr-digital/lib/digital_glfsr_source_f.cc86
-rw-r--r--gr-digital/lib/digital_gmskmod_bc.cc44
-rw-r--r--gr-digital/lib/digital_impl_glfsr.cc67
-rw-r--r--gr-digital/lib/digital_impl_mpsk_snr_est.cc256
-rw-r--r--gr-digital/lib/digital_kurtotic_equalizer_cc.cc51
-rw-r--r--gr-digital/lib/digital_lms_dd_equalizer_cc.cc85
-rw-r--r--gr-digital/lib/digital_map_bb.cc61
-rw-r--r--gr-digital/lib/digital_mpsk_receiver_cc.cc329
-rw-r--r--gr-digital/lib/digital_mpsk_snr_est_cc.cc186
-rw-r--r--gr-digital/lib/digital_ofdm_chanest_vcvc.cc8
-rw-r--r--gr-digital/lib/digital_ofdm_equalizer_simpledfe.cc4
-rw-r--r--gr-digital/lib/digital_ofdm_frame_acquisition.cc210
-rw-r--r--gr-digital/lib/digital_ofdm_frame_sink.cc405
-rw-r--r--gr-digital/lib/digital_ofdm_insert_preamble.cc194
-rw-r--r--gr-digital/lib/digital_ofdm_mapper_bcv.cc241
-rw-r--r--gr-digital/lib/digital_ofdm_sampler.cc133
-rw-r--r--gr-digital/lib/digital_ofdm_sync_sc_cfb.cc18
-rw-r--r--gr-digital/lib/digital_packet_sink.cc207
-rw-r--r--gr-digital/lib/digital_pfb_clock_sync_ccf.cc440
-rw-r--r--gr-digital/lib/digital_pfb_clock_sync_fff.cc434
-rw-r--r--gr-digital/lib/digital_pn_correlator_cc.cc80
-rw-r--r--gr-digital/lib/digital_probe_density_b.cc68
-rw-r--r--gr-digital/lib/digital_probe_mpsk_snr_est_c.cc152
-rw-r--r--gr-digital/lib/digital_scrambler_bb.cc57
-rw-r--r--gr-digital/lib/digital_simple_correlator.cc231
-rw-r--r--gr-digital/lib/digital_simple_framer.cc102
-rw-r--r--gr-digital/lib/fll_band_edge_cc_impl.cc276
-rw-r--r--gr-digital/lib/fll_band_edge_cc_impl.h82
-rw-r--r--gr-digital/lib/framer_sink_1_impl.cc195
-rw-r--r--gr-digital/lib/framer_sink_1_impl.h83
-rw-r--r--gr-digital/lib/glfsr.cc77
-rw-r--r--gr-digital/lib/glfsr_source_b_impl.cc89
-rw-r--r--gr-digital/lib/glfsr_source_b_impl.h (renamed from gr-digital/swig/digital_pn_correlator_cc.i)41
-rw-r--r--gr-digital/lib/glfsr_source_f_impl.cc90
-rw-r--r--gr-digital/lib/glfsr_source_f_impl.h (renamed from gr-digital/include/digital_impl_glfsr.h)54
-rw-r--r--gr-digital/lib/header_payload_demux_impl.cc26
-rw-r--r--gr-digital/lib/kurtotic_equalizer_cc_impl.cc97
-rw-r--r--gr-digital/lib/kurtotic_equalizer_cc_impl.h108
-rw-r--r--gr-digital/lib/lms_dd_equalizer_cc_impl.cc137
-rw-r--r--gr-digital/lib/lms_dd_equalizer_cc_impl.h80
-rw-r--r--gr-digital/lib/map_bb_impl.cc90
-rw-r--r--gr-digital/lib/map_bb_impl.h (renamed from gr-digital/swig/digital_diff_decoder_bb.i)35
-rw-r--r--gr-digital/lib/mpsk_receiver_cc_impl.cc331
-rw-r--r--gr-digital/lib/mpsk_receiver_cc_impl.h244
-rw-r--r--gr-digital/lib/mpsk_snr_est.cc252
-rw-r--r--gr-digital/lib/mpsk_snr_est_cc_impl.cc192
-rw-r--r--gr-digital/lib/mpsk_snr_est_cc_impl.h79
-rw-r--r--gr-digital/lib/ofdm_cyclic_prefixer_impl.cc79
-rw-r--r--gr-digital/lib/ofdm_cyclic_prefixer_impl.h (renamed from gr-digital/swig/digital_lms_dd_equalizer_cc.i)41
-rw-r--r--gr-digital/lib/ofdm_frame_acquisition_impl.cc217
-rw-r--r--gr-digital/lib/ofdm_frame_acquisition_impl.h76
-rw-r--r--gr-digital/lib/ofdm_frame_equalizer_vcvc_impl.cc8
-rw-r--r--gr-digital/lib/ofdm_frame_sink_impl.cc413
-rw-r--r--gr-digital/lib/ofdm_frame_sink_impl.h106
-rw-r--r--gr-digital/lib/ofdm_insert_preamble_impl.cc201
-rw-r--r--gr-digital/lib/ofdm_insert_preamble_impl.h67
-rw-r--r--gr-digital/lib/ofdm_mapper_bcv_impl.cc252
-rw-r--r--gr-digital/lib/ofdm_mapper_bcv_impl.h74
-rw-r--r--gr-digital/lib/ofdm_sampler_impl.cc144
-rw-r--r--gr-digital/lib/ofdm_sampler_impl.h60
-rw-r--r--gr-digital/lib/ofdm_serializer_vcc_impl.cc12
-rw-r--r--gr-digital/lib/packet_header_default.cc8
-rw-r--r--gr-digital/lib/packet_header_ofdm.cc8
-rw-r--r--gr-digital/lib/packet_headergenerator_bb_impl.cc4
-rw-r--r--gr-digital/lib/packet_headerparser_b_impl.cc4
-rw-r--r--gr-digital/lib/packet_sink_impl.cc209
-rw-r--r--gr-digital/lib/packet_sink_impl.h96
-rw-r--r--gr-digital/lib/pfb_clock_sync_ccf_impl.cc505
-rw-r--r--gr-digital/lib/pfb_clock_sync_ccf_impl.h121
-rw-r--r--gr-digital/lib/pfb_clock_sync_fff_impl.cc435
-rw-r--r--gr-digital/lib/pfb_clock_sync_fff_impl.h112
-rw-r--r--gr-digital/lib/pn_correlator_cc_impl.cc86
-rw-r--r--gr-digital/lib/pn_correlator_cc_impl.h (renamed from gr-digital/swig/digital_glfsr_source_f.i)38
-rw-r--r--gr-digital/lib/probe_density_b_impl.cc73
-rw-r--r--gr-digital/lib/probe_density_b_impl.h58
-rw-r--r--gr-digital/lib/probe_mpsk_snr_est_c_impl.cc157
-rw-r--r--gr-digital/lib/probe_mpsk_snr_est_c_impl.h78
-rw-r--r--gr-digital/lib/scrambler_bb_impl.cc68
-rw-r--r--gr-digital/lib/scrambler_bb_impl.h (renamed from gr-digital/swig/digital_descrambler_bb.i)32
-rw-r--r--gr-digital/lib/simple_correlator_impl.cc237
-rw-r--r--gr-digital/lib/simple_correlator_impl.h102
-rw-r--r--gr-digital/lib/simple_framer_impl.cc110
-rw-r--r--gr-digital/lib/simple_framer_impl.h (renamed from gr-digital/swig/digital_simple_framer.i)37
-rw-r--r--gr-digital/python/CMakeLists.txt12
-rw-r--r--gr-digital/python/__init__.py4
-rw-r--r--gr-digital/python/bpsk.py149
-rw-r--r--gr-digital/python/cpm.py83
-rw-r--r--gr-digital/python/crc.py6
-rw-r--r--gr-digital/python/digital_voice.py.real103
-rw-r--r--gr-digital/python/generic_mod_demod.py217
-rw-r--r--gr-digital/python/gfsk.py74
-rw-r--r--gr-digital/python/gmsk.py108
-rw-r--r--gr-digital/python/modulation_utils.py9
-rw-r--r--gr-digital/python/ofdm.py61
-rw-r--r--gr-digital/python/ofdm_packet_utils.py34
-rw-r--r--gr-digital/python/ofdm_receiver.py69
-rw-r--r--gr-digital/python/ofdm_sync_fixed.py3
-rw-r--r--gr-digital/python/ofdm_sync_ml.py78
-rw-r--r--gr-digital/python/ofdm_sync_pn.py58
-rw-r--r--gr-digital/python/ofdm_sync_pnac.py52
-rw-r--r--gr-digital/python/packet_utils.py28
-rw-r--r--gr-digital/python/pkt.py43
-rw-r--r--gr-digital/python/psk.py76
-rwxr-xr-xgr-digital/python/qa_binary_slicer_fb.py30
-rwxr-xr-xgr-digital/python/qa_chunks_to_symbols.py6
-rwxr-xr-xgr-digital/python/qa_clock_recovery_mm.py50
-rwxr-xr-xgr-digital/python/qa_cma_equalizer.py8
-rwxr-xr-xgr-digital/python/qa_constellation.py59
-rwxr-xr-xgr-digital/python/qa_constellation_decoder_cb.py52
-rwxr-xr-xgr-digital/python/qa_constellation_receiver.py66
-rwxr-xr-xgr-digital/python/qa_correlate_access_code.py37
-rwxr-xr-xgr-digital/python/qa_costas_loop_cc.py39
-rwxr-xr-xgr-digital/python/qa_cpm.py28
-rwxr-xr-xgr-digital/python/qa_crc32.py26
-rwxr-xr-xgr-digital/python/qa_crc32_bb.py47
-rwxr-xr-xgr-digital/python/qa_diff_encoder.py8
-rwxr-xr-xgr-digital/python/qa_diff_phasor_cc.py26
-rwxr-xr-xgr-digital/python/qa_digital.py8
-rwxr-xr-xgr-digital/python/qa_fll_band_edge.py27
-rwxr-xr-xgr-digital/python/qa_framer_sink.py8
-rwxr-xr-xgr-digital/python/qa_glfsr_source.py14
-rwxr-xr-xgr-digital/python/qa_header_payload_demux.py6
-rwxr-xr-xgr-digital/python/qa_lfsr.py (renamed from gr-digital/python/qa_bytes_to_syms.py)38
-rwxr-xr-xgr-digital/python/qa_lms_equalizer.py10
-rwxr-xr-xgr-digital/python/qa_map.py10
-rwxr-xr-xgr-digital/python/qa_mpsk_receiver.py105
-rwxr-xr-xgr-digital/python/qa_mpsk_snr_est.py63
-rwxr-xr-xgr-digital/python/qa_ofdm_carrier_allocator_cvc.py36
-rwxr-xr-xgr-digital/python/qa_ofdm_chanest_vcvc.py84
-rwxr-xr-xgr-digital/python/qa_ofdm_cyclic_prefixer.py8
-rwxr-xr-xgr-digital/python/qa_ofdm_frame_equalizer_vcvc.py44
-rwxr-xr-xgr-digital/python/qa_ofdm_insert_preamble.py21
-rwxr-xr-xgr-digital/python/qa_ofdm_serializer_vcc.py54
-rwxr-xr-xgr-digital/python/qa_ofdm_sync_sc_cfb.py20
-rwxr-xr-xgr-digital/python/qa_packet_headergenerator_bb.py50
-rwxr-xr-xgr-digital/python/qa_packet_headerparser_b.py3
-rwxr-xr-xgr-digital/python/qa_pfb_clock_sync.py43
-rwxr-xr-xgr-digital/python/qa_pn_correlator_cc.py5
-rwxr-xr-xgr-digital/python/qa_probe_density.py24
-rwxr-xr-xgr-digital/python/qa_scrambler.py2
-rwxr-xr-xgr-digital/python/qa_simple_correlator.py14
-rwxr-xr-xgr-digital/python/qa_simple_framer.py27
-rw-r--r--gr-digital/python/qam.py40
-rw-r--r--gr-digital/python/qpsk.py189
-rw-r--r--gr-digital/python/utils/mod_codes.py1
-rw-r--r--gr-digital/python/utils/tagged_streams.py16
-rw-r--r--gr-digital/swig/CMakeLists.txt157
-rw-r--r--gr-digital/swig/_digital_hier.i33
-rw-r--r--gr-digital/swig/constellation.i71
-rw-r--r--gr-digital/swig/digital_additive_scrambler_bb.i31
-rw-r--r--gr-digital/swig/digital_binary_slicer_fb.i33
-rw-r--r--gr-digital/swig/digital_bytes_to_syms.i29
-rw-r--r--gr-digital/swig/digital_clock_recovery_mm_cc.i51
-rw-r--r--gr-digital/swig/digital_clock_recovery_mm_ff.i47
-rw-r--r--gr-digital/swig/digital_cma_equalizer_cc.i44
-rw-r--r--gr-digital/swig/digital_constellation.i236
-rw-r--r--gr-digital/swig/digital_constellation_decoder_cb.i38
-rw-r--r--gr-digital/swig/digital_constellation_receiver_cb.i36
-rw-r--r--gr-digital/swig/digital_correlate_access_code_bb.i60
-rw-r--r--gr-digital/swig/digital_correlate_access_code_tag_bb.i35
-rw-r--r--gr-digital/swig/digital_costas_loop_cc.i33
-rw-r--r--gr-digital/swig/digital_cpmmod_bc.i40
-rw-r--r--gr-digital/swig/digital_crc32.i27
-rw-r--r--gr-digital/swig/digital_fll_band_edge_cc.i60
-rw-r--r--gr-digital/swig/digital_framer_sink_1.i30
-rw-r--r--gr-digital/swig/digital_glfsr_source_b.i35
-rw-r--r--gr-digital/swig/digital_gmskmod_bc.i39
-rw-r--r--gr-digital/swig/digital_mpsk_receiver_cc.i57
-rw-r--r--gr-digital/swig/digital_mpsk_snr_est_cc.i45
-rw-r--r--gr-digital/swig/digital_ofdm_equalizer_simpledfe.i2
-rw-r--r--gr-digital/swig/digital_ofdm_frame_acquisition.i49
-rw-r--r--gr-digital/swig/digital_ofdm_frame_sink.i41
-rw-r--r--gr-digital/swig/digital_ofdm_insert_preamble.i37
-rw-r--r--gr-digital/swig/digital_ofdm_mapper_bcv.i46
-rw-r--r--gr-digital/swig/digital_ofdm_sampler.i35
-rw-r--r--gr-digital/swig/digital_packet_sink.i34
-rw-r--r--gr-digital/swig/digital_pfb_clock_sync_ccf.i58
-rw-r--r--gr-digital/swig/digital_pfb_clock_sync_fff.i58
-rw-r--r--gr-digital/swig/digital_probe_density_b.i33
-rw-r--r--gr-digital/swig/digital_probe_mpsk_snr_est_c.i45
-rw-r--r--gr-digital/swig/digital_swig.i311
-rw-r--r--gr-digital/swig/gnuradio/digital.scm28
380 files changed, 19214 insertions, 17643 deletions
diff --git a/gr-digital/CMakeLists.txt b/gr-digital/CMakeLists.txt
index 12918bbfb3..7d3046dc50 100644
--- a/gr-digital/CMakeLists.txt
+++ b/gr-digital/CMakeLists.txt
@@ -28,7 +28,11 @@ include(GrBoost)
include(GrComponent)
GR_REGISTER_COMPONENT("gr-digital" ENABLE_GR_DIGITAL
Boost_FOUND
+ ENABLE_VOLK
ENABLE_GR_CORE
+ ENABLE_GR_FFT
+ ENABLE_GR_FILTER
+ ENABLE_GR_BLOCKS
ENABLE_GR_ANALOG
ENABLE_GR_BLOCKS
ENABLE_GR_FILTER
@@ -36,6 +40,7 @@ GR_REGISTER_COMPONENT("gr-digital" ENABLE_GR_DIGITAL
GR_SET_GLOBAL(GR_DIGITAL_INCLUDE_DIRS
${CMAKE_CURRENT_SOURCE_DIR}/include
+ ${CMAKE_CURRENT_BINARY_DIR}/include
)
GR_SET_GLOBAL(GR_DIGITAL_SWIG_INCLUDE_DIRS
diff --git a/gr-digital/examples/CMakeLists.txt b/gr-digital/examples/CMakeLists.txt
index 63e1eba4e4..64c4641aa5 100644
--- a/gr-digital/examples/CMakeLists.txt
+++ b/gr-digital/examples/CMakeLists.txt
@@ -53,7 +53,6 @@ GR_PYTHON_INSTALL(PROGRAMS
ofdm/benchmark_rx.py
ofdm/benchmark_tx.py
ofdm/gr_plot_ofdm.py
- ofdm/ofdm_mod_demod_test.py
ofdm/receive_path.py
ofdm/transmit_path.py
ofdm/tunnel.py
diff --git a/gr-digital/examples/berawgn.py b/gr-digital/examples/berawgn.py
index d58dfbaaeb..6f9679d555 100755
--- a/gr-digital/examples/berawgn.py
+++ b/gr-digital/examples/berawgn.py
@@ -1,4 +1,25 @@
#!/usr/bin/env python
+#
+# Copyright 2012 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
"""
BER simulation for QPSK signals, compare to theoretical values.
Change the N_BITS value to simulate more bits per Eb/N0 value,
@@ -14,9 +35,21 @@ magnitude below what you chose for N_BITS.
import math
import numpy
-from scipy.special import erfc
-import pylab
from gnuradio import gr, digital
+from gnuradio import analog
+from gnuradio import blocks
+
+try:
+ from scipy.special import erfc
+except ImportError:
+ print "Error: could not import scipy (http://www.scipy.org/)"
+ sys.exit(1)
+
+try:
+ import pylab
+except ImportError:
+ print "Error: could not import pylab (http://matplotlib.sourceforge.net/)"
+ sys.exit(1)
# Best to choose powers of 10
N_BITS = 1e7
@@ -38,16 +71,16 @@ class BitErrors(gr.hier_block2):
gr.io_signature(1, 1, gr.sizeof_int))
# Bit comparison
- comp = gr.xor_bb()
+ comp = blocks.xor_bb()
intdump_decim = 100000
if N_BITS < intdump_decim:
intdump_decim = int(N_BITS)
self.connect(self,
comp,
- gr.unpack_k_bits_bb(bits_per_byte),
- gr.uchar_to_float(),
- gr.integrate_ff(intdump_decim),
- gr.multiply_const_ff(1.0/N_BITS),
+ blocks.unpack_k_bits_bb(bits_per_byte),
+ blocks.uchar_to_float(),
+ blocks.integrate_ff(intdump_decim),
+ blocks.multiply_const_ff(1.0/N_BITS),
self)
self.connect((self, 1), (comp, 1))
@@ -59,11 +92,11 @@ class BERAWGNSimu(gr.top_block):
# Source is N_BITS bits, non-repeated
data = map(int, numpy.random.randint(0, self.const.arity(), N_BITS/self.const.bits_per_symbol()))
src = gr.vector_source_b(data, False)
- mod = gr.chunks_to_symbols_bc((self.const.points()), 1)
- add = gr.add_vcc()
- noise = gr.noise_source_c(gr.GR_GAUSSIAN,
- self.EbN0_to_noise_voltage(EbN0),
- RAND_SEED)
+ mod = digital.chunks_to_symbols_bc((self.const.points()), 1)
+ add = blocks.add_vcc()
+ noise = analog.noise_source_c(analog.GR_GAUSSIAN,
+ self.EbN0_to_noise_voltage(EbN0),
+ RAND_SEED)
demod = digital.constellation_decoder_cb(self.const.base())
ber = BitErrors(self.const.bits_per_symbol())
self.sink = gr.vector_sink_f()
diff --git a/gr-digital/examples/demod/ber_simulation.grc b/gr-digital/examples/demod/ber_simulation.grc
index 9d7b9c9468..b216912a6f 100644
--- a/gr-digital/examples/demod/ber_simulation.grc
+++ b/gr-digital/examples/demod/ber_simulation.grc
@@ -61,10 +61,10 @@
</param>
</block>
<block>
- <key>gr_throttle</key>
+ <key>blocks_throttle</key>
<param>
<key>id</key>
- <value>gr_throttle</value>
+ <value>blocks_throttle</value>
</param>
<param>
<key>_enabled</key>
@@ -92,10 +92,10 @@
</param>
</block>
<block>
- <key>gr_add_xx</key>
+ <key>blocks_add_xx</key>
<param>
<key>id</key>
- <value>gr_add_xx</value>
+ <value>blocks_add_xx</value>
</param>
<param>
<key>_enabled</key>
@@ -350,10 +350,10 @@
</param>
</block>
<block>
- <key>gr_noise_source_x</key>
+ <key>analog_noise_source_x</key>
<param>
<key>id</key>
- <value>gr_noise_source_x</value>
+ <value>analog_noise_source_x</value>
</param>
<param>
<key>_enabled</key>
@@ -365,7 +365,7 @@
</param>
<param>
<key>noise_type</key>
- <value>gr.GR_GAUSSIAN</value>
+ <value>analog.GR_GAUSSIAN</value>
</param>
<param>
<key>amp</key>
@@ -385,10 +385,10 @@
</param>
</block>
<block>
- <key>gr_chunks_to_symbols_xx</key>
+ <key>digital_chunks_to_symbols_xx</key>
<param>
<key>id</key>
- <value>gr_chunks_to_symbols_xx</value>
+ <value>digital_chunks_to_symbols_xx</value>
</param>
<param>
<key>_enabled</key>
@@ -648,37 +648,37 @@
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_throttle</source_block_id>
+ <source_block_id>blocks_throttle</source_block_id>
<sink_block_id>blks2_error_rate</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_chunks_to_symbols_xx</source_block_id>
- <sink_block_id>gr_add_xx</sink_block_id>
+ <source_block_id>digital_chunks_to_symbols_xx</source_block_id>
+ <sink_block_id>blocks_add_xx</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_noise_source_x</source_block_id>
- <sink_block_id>gr_add_xx</sink_block_id>
+ <source_block_id>analog_noise_source_x</source_block_id>
+ <sink_block_id>blocks_add_xx</sink_block_id>
<source_key>0</source_key>
<sink_key>1</sink_key>
</connection>
<connection>
<source_block_id>random_source_x</source_block_id>
- <sink_block_id>gr_throttle</sink_block_id>
+ <sink_block_id>blocks_throttle</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>random_source_x</source_block_id>
- <sink_block_id>gr_chunks_to_symbols_xx</sink_block_id>
+ <sink_block_id>digital_chunks_to_symbols_xx</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_add_xx</source_block_id>
+ <source_block_id>blocks_add_xx</source_block_id>
<sink_block_id>wxgui_scopesink2_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
@@ -690,7 +690,7 @@
<sink_key>1</sink_key>
</connection>
<connection>
- <source_block_id>gr_add_xx</source_block_id>
+ <source_block_id>blocks_add_xx</source_block_id>
<sink_block_id>digital_constellation_decoder_cb_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
diff --git a/gr-digital/examples/demod/digital_freq_lock.grc b/gr-digital/examples/demod/digital_freq_lock.grc
index 589c651f4a..965768ece3 100644
--- a/gr-digital/examples/demod/digital_freq_lock.grc
+++ b/gr-digital/examples/demod/digital_freq_lock.grc
@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='ASCII'?>
<flow_graph>
- <timestamp>Mon Jan 14 10:49:20 2013</timestamp>
+ <timestamp>Tue Jan 15 14:17:18 2013</timestamp>
<block>
<key>options</key>
<param>
@@ -61,38 +61,22 @@
</param>
</block>
<block>
- <key>random_source_x</key>
+ <key>variable</key>
<param>
<key>id</key>
- <value>random_source_x</value>
+ <value>sps</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>type</key>
- <value>byte</value>
- </param>
- <param>
- <key>min</key>
- <value>0</value>
- </param>
- <param>
- <key>max</key>
- <value>256</value>
- </param>
- <param>
- <key>num_samps</key>
- <value>10000000</value>
- </param>
- <param>
- <key>repeat</key>
- <value>True</value>
+ <key>value</key>
+ <value>4</value>
</param>
<param>
<key>_coordinate</key>
- <value>(-2, 111)</value>
+ <value>(166, -2)</value>
</param>
<param>
<key>_rotation</key>
@@ -100,30 +84,22 @@
</param>
</block>
<block>
- <key>gr_throttle</key>
+ <key>variable</key>
<param>
<key>id</key>
- <value>gr_throttle_0</value>
+ <value>rolloff</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>type</key>
- <value>complex</value>
- </param>
- <param>
- <key>samples_per_second</key>
- <value>samp_rate</value>
- </param>
- <param>
- <key>vlen</key>
- <value>1</value>
+ <key>value</key>
+ <value>0.35</value>
</param>
<param>
<key>_coordinate</key>
- <value>(456, 134)</value>
+ <value>(231, 0)</value>
</param>
<param>
<key>_rotation</key>
@@ -134,7 +110,7 @@
<key>variable</key>
<param>
<key>id</key>
- <value>sps</value>
+ <value>samp_rate</value>
</param>
<param>
<key>_enabled</key>
@@ -142,11 +118,11 @@
</param>
<param>
<key>value</key>
- <value>4</value>
+ <value>32000</value>
</param>
<param>
<key>_coordinate</key>
- <value>(166, -2)</value>
+ <value>(439, -1)</value>
</param>
<param>
<key>_rotation</key>
@@ -154,61 +130,54 @@
</param>
</block>
<block>
- <key>variable</key>
+ <key>variable_slider</key>
<param>
<key>id</key>
- <value>rolloff</value>
+ <value>freq_offset</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>value</key>
- <value>0.35</value>
- </param>
- <param>
- <key>_coordinate</key>
- <value>(231, 0)</value>
+ <key>label</key>
+ <value>Frequency Offset</value>
</param>
<param>
- <key>_rotation</key>
+ <key>value</key>
<value>0</value>
</param>
- </block>
- <block>
- <key>digital_fll_band_edge_cc</key>
<param>
- <key>id</key>
- <value>digital_fll_band_edge_cc_0</value>
+ <key>min</key>
+ <value>-0.5</value>
</param>
<param>
- <key>_enabled</key>
- <value>True</value>
+ <key>max</key>
+ <value>0.5</value>
</param>
<param>
- <key>type</key>
- <value>cc</value>
+ <key>num_steps</key>
+ <value>1000</value>
</param>
<param>
- <key>samps_per_sym</key>
- <value>sps</value>
+ <key>style</key>
+ <value>wx.SL_HORIZONTAL</value>
</param>
<param>
- <key>rolloff</key>
- <value>rolloff</value>
+ <key>converver</key>
+ <value>float_converter</value>
</param>
<param>
- <key>filter_size</key>
- <value>44</value>
+ <key>grid_pos</key>
+ <value></value>
</param>
<param>
- <key>w</key>
- <value>freq_bw</value>
+ <key>notebook</key>
+ <value></value>
</param>
<param>
<key>_coordinate</key>
- <value>(81, 248)</value>
+ <value>(673, -1)</value>
</param>
<param>
<key>_rotation</key>
@@ -216,42 +185,54 @@
</param>
</block>
<block>
- <key>variable_slider</key>
+ <key>wxgui_scopesink2</key>
<param>
<key>id</key>
- <value>freq_bw</value>
+ <value>wxgui_scopesink2_0_0</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>label</key>
- <value>FLL Loop Bandwidth</value>
+ <key>type</key>
+ <value>complex</value>
</param>
<param>
- <key>value</key>
+ <key>title</key>
+ <value>Frequency Corrected Signal</value>
+ </param>
+ <param>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>v_scale</key>
<value>0</value>
</param>
<param>
- <key>min</key>
+ <key>v_offset</key>
<value>0</value>
</param>
<param>
- <key>max</key>
- <value>0.1</value>
+ <key>t_scale</key>
+ <value>0</value>
</param>
<param>
- <key>num_steps</key>
- <value>1000</value>
+ <key>ac_couple</key>
+ <value>False</value>
</param>
<param>
- <key>style</key>
- <value>wx.SL_HORIZONTAL</value>
+ <key>xy_mode</key>
+ <value>False</value>
</param>
<param>
- <key>converver</key>
- <value>float_converter</value>
+ <key>num_inputs</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>win_size</key>
+ <value></value>
</param>
<param>
<key>grid_pos</key>
@@ -259,11 +240,19 @@
</param>
<param>
<key>notebook</key>
- <value></value>
+ <value>notebook_0,1</value>
+ </param>
+ <param>
+ <key>trig_mode</key>
+ <value>gr.gr_TRIG_MODE_AUTO</value>
+ </param>
+ <param>
+ <key>y_axis_label</key>
+ <value>Counts</value>
</param>
<param>
<key>_coordinate</key>
- <value>(80, 382)</value>
+ <value>(439, 289)</value>
</param>
<param>
<key>_rotation</key>
@@ -271,65 +260,74 @@
</param>
</block>
<block>
- <key>variable</key>
+ <key>wxgui_fftsink2</key>
<param>
<key>id</key>
- <value>samp_rate</value>
+ <value>wxgui_fftsink2_0_0</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>value</key>
- <value>32000</value>
+ <key>type</key>
+ <value>complex</value>
</param>
<param>
- <key>_coordinate</key>
- <value>(439, -1)</value>
+ <key>title</key>
+ <value>Frequency Corrected Signal</value>
</param>
<param>
- <key>_rotation</key>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>baseband_freq</key>
<value>0</value>
</param>
- </block>
- <block>
- <key>variable_slider</key>
<param>
- <key>id</key>
- <value>noise_amp</value>
+ <key>y_per_div</key>
+ <value>10</value>
</param>
<param>
- <key>_enabled</key>
- <value>True</value>
+ <key>y_divs</key>
+ <value>10</value>
</param>
<param>
- <key>label</key>
- <value>Channel Noise</value>
+ <key>ref_level</key>
+ <value>10</value>
</param>
<param>
- <key>value</key>
- <value>0</value>
+ <key>ref_scale</key>
+ <value>2.0</value>
</param>
<param>
- <key>min</key>
- <value>0</value>
+ <key>fft_size</key>
+ <value>1024</value>
</param>
<param>
- <key>max</key>
- <value>1.0</value>
+ <key>fft_rate</key>
+ <value>30</value>
</param>
<param>
- <key>num_steps</key>
- <value>1000</value>
+ <key>peak_hold</key>
+ <value>False</value>
</param>
<param>
- <key>style</key>
- <value>wx.SL_HORIZONTAL</value>
+ <key>average</key>
+ <value>False</value>
</param>
<param>
- <key>converver</key>
- <value>float_converter</value>
+ <key>avg_alpha</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>win</key>
+ <value>None</value>
+ </param>
+ <param>
+ <key>win_size</key>
+ <value></value>
</param>
<param>
<key>grid_pos</key>
@@ -337,11 +335,15 @@
</param>
<param>
<key>notebook</key>
- <value></value>
+ <value>notebook_0,0</value>
+ </param>
+ <param>
+ <key>freqvar</key>
+ <value>None</value>
</param>
<param>
<key>_coordinate</key>
- <value>(553, 0)</value>
+ <value>(439, 423)</value>
</param>
<param>
<key>_rotation</key>
@@ -352,7 +354,7 @@
<key>variable_slider</key>
<param>
<key>id</key>
- <value>freq_offset</value>
+ <value>freq_bw</value>
</param>
<param>
<key>_enabled</key>
@@ -360,7 +362,7 @@
</param>
<param>
<key>label</key>
- <value>Frequency Offset</value>
+ <value>FLL Loop Bandwidth</value>
</param>
<param>
<key>value</key>
@@ -368,11 +370,11 @@
</param>
<param>
<key>min</key>
- <value>-0.5</value>
+ <value>0</value>
</param>
<param>
<key>max</key>
- <value>0.5</value>
+ <value>0.1</value>
</param>
<param>
<key>num_steps</key>
@@ -396,7 +398,7 @@
</param>
<param>
<key>_coordinate</key>
- <value>(673, -1)</value>
+ <value>(74, 436)</value>
</param>
<param>
<key>_rotation</key>
@@ -404,38 +406,34 @@
</param>
</block>
<block>
- <key>gr_channel_model</key>
+ <key>notebook</key>
<param>
<key>id</key>
- <value>gr_channel_model_0</value>
+ <value>notebook_0</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>noise_voltage</key>
- <value>noise_amp</value>
- </param>
- <param>
- <key>freq_offset</key>
- <value>freq_offset</value>
+ <key>style</key>
+ <value>wx.NB_TOP</value>
</param>
<param>
- <key>epsilon</key>
- <value>1.0</value>
+ <key>labels</key>
+ <value>['Freq', 'Time']</value>
</param>
<param>
- <key>taps</key>
- <value>1.0</value>
+ <key>grid_pos</key>
+ <value></value>
</param>
<param>
- <key>seed</key>
- <value>42</value>
+ <key>notebook</key>
+ <value></value>
</param>
<param>
<key>_coordinate</key>
- <value>(649, 104)</value>
+ <value>(108, 568)</value>
</param>
<param>
<key>_rotation</key>
@@ -443,10 +441,10 @@
</param>
</block>
<block>
- <key>wxgui_scopesink2</key>
+ <key>digital_fll_band_edge_cc</key>
<param>
<key>id</key>
- <value>wxgui_scopesink2_0</value>
+ <value>digital_fll_band_edge_cc_0</value>
</param>
<param>
<key>_enabled</key>
@@ -454,63 +452,27 @@
</param>
<param>
<key>type</key>
- <value>complex</value>
- </param>
- <param>
- <key>title</key>
- <value>Signal into Receiver</value>
- </param>
- <param>
- <key>samp_rate</key>
- <value>samp_rate</value>
- </param>
- <param>
- <key>v_scale</key>
- <value>0</value>
- </param>
- <param>
- <key>v_offset</key>
- <value>0</value>
- </param>
- <param>
- <key>t_scale</key>
- <value>0</value>
- </param>
- <param>
- <key>ac_couple</key>
- <value>False</value>
- </param>
- <param>
- <key>xy_mode</key>
- <value>False</value>
- </param>
- <param>
- <key>num_inputs</key>
- <value>1</value>
- </param>
- <param>
- <key>win_size</key>
- <value></value>
+ <value>cc</value>
</param>
<param>
- <key>grid_pos</key>
- <value></value>
+ <key>samps_per_sym</key>
+ <value>sps</value>
</param>
<param>
- <key>notebook</key>
- <value>notebook_0,1</value>
+ <key>rolloff</key>
+ <value>rolloff</value>
</param>
<param>
- <key>trig_mode</key>
- <value>gr.gr_TRIG_MODE_AUTO</value>
+ <key>filter_size</key>
+ <value>44</value>
</param>
<param>
- <key>y_axis_label</key>
- <value>Counts</value>
+ <key>w</key>
+ <value>freq_bw</value>
</param>
<param>
<key>_coordinate</key>
- <value>(875, 0)</value>
+ <value>(75, 295)</value>
</param>
<param>
<key>_rotation</key>
@@ -601,7 +563,7 @@
</param>
<param>
<key>_coordinate</key>
- <value>(875, 108)</value>
+ <value>(918, 107)</value>
</param>
<param>
<key>_rotation</key>
@@ -612,7 +574,7 @@
<key>wxgui_scopesink2</key>
<param>
<key>id</key>
- <value>wxgui_scopesink2_0_0</value>
+ <value>wxgui_scopesink2_0</value>
</param>
<param>
<key>_enabled</key>
@@ -624,7 +586,7 @@
</param>
<param>
<key>title</key>
- <value>Frequency Corrected Signal</value>
+ <value>Signal into Receiver</value>
</param>
<param>
<key>samp_rate</key>
@@ -676,7 +638,7 @@
</param>
<param>
<key>_coordinate</key>
- <value>(439, 289)</value>
+ <value>(918, 0)</value>
</param>
<param>
<key>_rotation</key>
@@ -684,90 +646,124 @@
</param>
</block>
<block>
- <key>wxgui_fftsink2</key>
+ <key>digital_psk_mod</key>
<param>
<key>id</key>
- <value>wxgui_fftsink2_0_0</value>
+ <value>digital_psk_mod_0</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>type</key>
- <value>complex</value>
+ <key>constellation_points</key>
+ <value>2</value>
</param>
<param>
- <key>title</key>
- <value>Frequency Corrected Signal</value>
+ <key>mod_code</key>
+ <value>"gray"</value>
</param>
<param>
- <key>samp_rate</key>
- <value>samp_rate</value>
+ <key>differential</key>
+ <value>False</value>
</param>
<param>
- <key>baseband_freq</key>
+ <key>samples_per_symbol</key>
+ <value>sps</value>
+ </param>
+ <param>
+ <key>excess_bw</key>
+ <value>rolloff</value>
+ </param>
+ <param>
+ <key>verbose</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>log</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(202, 142)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
<value>0</value>
</param>
+ </block>
+ <block>
+ <key>random_source_x</key>
<param>
- <key>y_per_div</key>
- <value>10</value>
+ <key>id</key>
+ <value>random_source_x</value>
</param>
<param>
- <key>y_divs</key>
- <value>10</value>
+ <key>_enabled</key>
+ <value>True</value>
</param>
<param>
- <key>ref_level</key>
- <value>10</value>
+ <key>type</key>
+ <value>byte</value>
</param>
<param>
- <key>ref_scale</key>
- <value>2.0</value>
+ <key>min</key>
+ <value>0</value>
</param>
<param>
- <key>fft_size</key>
- <value>1024</value>
+ <key>max</key>
+ <value>256</value>
</param>
<param>
- <key>fft_rate</key>
- <value>30</value>
+ <key>num_samps</key>
+ <value>10000000</value>
</param>
<param>
- <key>peak_hold</key>
- <value>False</value>
+ <key>repeat</key>
+ <value>True</value>
</param>
<param>
- <key>average</key>
- <value>False</value>
+ <key>_coordinate</key>
+ <value>(8, 150)</value>
</param>
<param>
- <key>avg_alpha</key>
+ <key>_rotation</key>
<value>0</value>
</param>
+ </block>
+ <block>
+ <key>channels_channel_model</key>
<param>
- <key>win</key>
- <value>None</value>
+ <key>id</key>
+ <value>channels_channel_model_0</value>
</param>
<param>
- <key>win_size</key>
- <value></value>
+ <key>_enabled</key>
+ <value>True</value>
</param>
<param>
- <key>grid_pos</key>
- <value></value>
+ <key>noise_voltage</key>
+ <value>noise_amp</value>
</param>
<param>
- <key>notebook</key>
- <value>notebook_0,0</value>
+ <key>freq_offset</key>
+ <value>freq_offset</value>
</param>
<param>
- <key>freqvar</key>
- <value>None</value>
+ <key>epsilon</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>taps</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>seed</key>
+ <value>42</value>
</param>
<param>
<key>_coordinate</key>
- <value>(439, 423)</value>
+ <value>(681, 142)</value>
</param>
<param>
<key>_rotation</key>
@@ -775,34 +771,30 @@
</param>
</block>
<block>
- <key>notebook</key>
+ <key>blocks_throttle</key>
<param>
<key>id</key>
- <value>notebook_0</value>
+ <value>blocks_throttle_0</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>style</key>
- <value>wx.NB_TOP</value>
- </param>
- <param>
- <key>labels</key>
- <value>['Freq', 'Time']</value>
+ <key>type</key>
+ <value>complex</value>
</param>
<param>
- <key>grid_pos</key>
- <value></value>
+ <key>samples_per_second</key>
+ <value>samp_rate</value>
</param>
<param>
- <key>notebook</key>
- <value></value>
+ <key>vlen</key>
+ <value>1</value>
</param>
<param>
<key>_coordinate</key>
- <value>(114, 521)</value>
+ <value>(487, 174)</value>
</param>
<param>
<key>_rotation</key>
@@ -810,46 +802,54 @@
</param>
</block>
<block>
- <key>digital_psk_mod</key>
+ <key>variable_slider</key>
<param>
<key>id</key>
- <value>digital_psk_mod_0</value>
+ <value>noise_amp</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>constellation_points</key>
- <value>2</value>
+ <key>label</key>
+ <value>Channel Noise</value>
</param>
<param>
- <key>mod_code</key>
- <value>"gray"</value>
+ <key>value</key>
+ <value>0</value>
</param>
<param>
- <key>differential</key>
- <value>False</value>
+ <key>min</key>
+ <value>0</value>
</param>
<param>
- <key>samples_per_symbol</key>
- <value>sps</value>
+ <key>max</key>
+ <value>1.0</value>
</param>
<param>
- <key>excess_bw</key>
- <value>rolloff</value>
+ <key>num_steps</key>
+ <value>1000</value>
</param>
<param>
- <key>verbose</key>
- <value>False</value>
+ <key>style</key>
+ <value>wx.SL_HORIZONTAL</value>
</param>
<param>
- <key>log</key>
- <value>False</value>
+ <key>converver</key>
+ <value>float_converter</value>
+ </param>
+ <param>
+ <key>grid_pos</key>
+ <value></value>
+ </param>
+ <param>
+ <key>notebook</key>
+ <value></value>
</param>
<param>
<key>_coordinate</key>
- <value>(194, 104)</value>
+ <value>(549, 0)</value>
</param>
<param>
<key>_rotation</key>
@@ -857,13 +857,13 @@
</param>
</block>
<connection>
- <source_block_id>gr_channel_model_0</source_block_id>
+ <source_block_id>channels_channel_model_0</source_block_id>
<sink_block_id>wxgui_scopesink2_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_channel_model_0</source_block_id>
+ <source_block_id>channels_channel_model_0</source_block_id>
<sink_block_id>wxgui_fftsink2_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
@@ -876,18 +876,18 @@
</connection>
<connection>
<source_block_id>digital_psk_mod_0</source_block_id>
- <sink_block_id>gr_throttle_0</sink_block_id>
+ <sink_block_id>blocks_throttle_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_throttle_0</source_block_id>
- <sink_block_id>gr_channel_model_0</sink_block_id>
+ <source_block_id>blocks_throttle_0</source_block_id>
+ <sink_block_id>channels_channel_model_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_channel_model_0</source_block_id>
+ <source_block_id>channels_channel_model_0</source_block_id>
<sink_block_id>digital_fll_band_edge_cc_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
diff --git a/gr-digital/examples/demod/dpsk_loopback.grc b/gr-digital/examples/demod/dpsk_loopback.grc
index c9867bea20..9befa69b6c 100644
--- a/gr-digital/examples/demod/dpsk_loopback.grc
+++ b/gr-digital/examples/demod/dpsk_loopback.grc
@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='ASCII'?>
<flow_graph>
- <timestamp>Thu Jul 5 16:26:53 2012</timestamp>
+ <timestamp>Sat Nov 10 15:13:23 2012</timestamp>
<block>
<key>options</key>
<param>
@@ -139,10 +139,10 @@
</param>
</block>
<block>
- <key>gr_sig_source_x</key>
+ <key>blocks_throttle</key>
<param>
<key>id</key>
- <value>gr_sig_source_x_0</value>
+ <value>blocks_throttle_0_0</value>
</param>
<param>
<key>_enabled</key>
@@ -153,28 +153,16 @@
<value>float</value>
</param>
<param>
- <key>samp_rate</key>
+ <key>samples_per_second</key>
<value>samp_rate</value>
</param>
<param>
- <key>waveform</key>
- <value>gr.GR_COS_WAVE</value>
- </param>
- <param>
- <key>freq</key>
- <value>freq</value>
- </param>
- <param>
- <key>amp</key>
+ <key>vlen</key>
<value>1</value>
</param>
<param>
- <key>offset</key>
- <value>0</value>
- </param>
- <param>
<key>_coordinate</key>
- <value>(184, 9)</value>
+ <value>(381, 51)</value>
</param>
<param>
<key>_rotation</key>
@@ -182,10 +170,10 @@
</param>
</block>
<block>
- <key>digital_dxpsk_mod</key>
+ <key>blks2_packet_encoder</key>
<param>
<key>id</key>
- <value>digital_dxpsk_mod_1</value>
+ <value>blks2_packet_encoder_0</value>
</param>
<param>
<key>_enabled</key>
@@ -193,62 +181,31 @@
</param>
<param>
<key>type</key>
- <value>dbpsk</value>
+ <value>float</value>
</param>
<param>
<key>samples_per_symbol</key>
<value>2</value>
</param>
<param>
- <key>excess_bw</key>
- <value>0.35</value>
- </param>
- <param>
- <key>gray_coded</key>
- <value>True</value>
- </param>
- <param>
- <key>verbose</key>
- <value>False</value>
- </param>
- <param>
- <key>log</key>
- <value>False</value>
- </param>
- <param>
- <key>_coordinate</key>
- <value>(745, 16)</value>
- </param>
- <param>
- <key>_rotation</key>
- <value>0</value>
+ <key>bits_per_symbol</key>
+ <value>1</value>
</param>
- </block>
- <block>
- <key>gr_throttle</key>
<param>
- <key>id</key>
- <value>gr_throttle_0_0</value>
+ <key>access_code</key>
+ <value></value>
</param>
<param>
- <key>_enabled</key>
+ <key>pad_for_usrp</key>
<value>True</value>
</param>
<param>
- <key>type</key>
- <value>float</value>
- </param>
- <param>
- <key>samples_per_second</key>
- <value>samp_rate</value>
- </param>
- <param>
- <key>vlen</key>
- <value>1</value>
+ <key>payload_length</key>
+ <value>0</value>
</param>
<param>
<key>_coordinate</key>
- <value>(358, 39)</value>
+ <value>(598, 19)</value>
</param>
<param>
<key>_rotation</key>
@@ -256,10 +213,10 @@
</param>
</block>
<block>
- <key>blks2_packet_encoder</key>
+ <key>digital_dxpsk_mod</key>
<param>
<key>id</key>
- <value>blks2_packet_encoder_0</value>
+ <value>digital_dxpsk_mod_1</value>
</param>
<param>
<key>_enabled</key>
@@ -267,31 +224,31 @@
</param>
<param>
<key>type</key>
- <value>float</value>
+ <value>dbpsk</value>
</param>
<param>
<key>samples_per_symbol</key>
<value>2</value>
</param>
<param>
- <key>bits_per_symbol</key>
- <value>1</value>
+ <key>excess_bw</key>
+ <value>0.35</value>
</param>
<param>
- <key>access_code</key>
- <value></value>
+ <key>mod_code</key>
+ <value>"gray"</value>
</param>
<param>
- <key>pad_for_usrp</key>
- <value>True</value>
+ <key>verbose</key>
+ <value>False</value>
</param>
<param>
- <key>payload_length</key>
- <value>0</value>
+ <key>log</key>
+ <value>False</value>
</param>
<param>
<key>_coordinate</key>
- <value>(541, 9)</value>
+ <value>(806, 27)</value>
</param>
<param>
<key>_rotation</key>
@@ -333,12 +290,8 @@
<value>6.28/100.0</value>
</param>
<param>
- <key>omega_relative_limit</key>
- <value>0.005</value>
- </param>
- <param>
- <key>gray_coded</key>
- <value>True</value>
+ <key>mod_code</key>
+ <value>"gray"</value>
</param>
<param>
<key>verbose</key>
@@ -354,38 +307,7 @@
</param>
<param>
<key>_coordinate</key>
- <value>(746, 135)</value>
- </param>
- <param>
- <key>_rotation</key>
- <value>180</value>
- </param>
- </block>
- <block>
- <key>blks2_packet_decoder</key>
- <param>
- <key>id</key>
- <value>blks2_packet_decoder_0</value>
- </param>
- <param>
- <key>_enabled</key>
- <value>True</value>
- </param>
- <param>
- <key>type</key>
- <value>float</value>
- </param>
- <param>
- <key>access_code</key>
- <value></value>
- </param>
- <param>
- <key>threshold</key>
- <value>-1</value>
- </param>
- <param>
- <key>_coordinate</key>
- <value>(545, 187)</value>
+ <value>(745, 139)</value>
</param>
<param>
<key>_rotation</key>
@@ -460,7 +382,81 @@
</param>
<param>
<key>_coordinate</key>
- <value>(184, 165)</value>
+ <value>(184, 163)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>180</value>
+ </param>
+ </block>
+ <block>
+ <key>analog_sig_source_x</key>
+ <param>
+ <key>id</key>
+ <value>analog_sig_source_x_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>float</value>
+ </param>
+ <param>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>waveform</key>
+ <value>analog.GR_COS_WAVE</value>
+ </param>
+ <param>
+ <key>freq</key>
+ <value>freq</value>
+ </param>
+ <param>
+ <key>amp</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>offset</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(190, 19)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>blks2_packet_decoder</key>
+ <param>
+ <key>id</key>
+ <value>blks2_packet_decoder_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>float</value>
+ </param>
+ <param>
+ <key>access_code</key>
+ <value></value>
+ </param>
+ <param>
+ <key>threshold</key>
+ <value>-1</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(545, 187)</value>
</param>
<param>
<key>_rotation</key>
@@ -492,14 +488,14 @@
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_throttle_0_0</source_block_id>
+ <source_block_id>blocks_throttle_0_0</source_block_id>
<sink_block_id>blks2_packet_encoder_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_sig_source_x_0</source_block_id>
- <sink_block_id>gr_throttle_0_0</sink_block_id>
+ <source_block_id>analog_sig_source_x_0</source_block_id>
+ <sink_block_id>blocks_throttle_0_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
diff --git a/gr-digital/examples/demod/gfsk_loopback.grc b/gr-digital/examples/demod/gfsk_loopback.grc
index f74a835266..179a8102f3 100644
--- a/gr-digital/examples/demod/gfsk_loopback.grc
+++ b/gr-digital/examples/demod/gfsk_loopback.grc
@@ -1,55 +1,59 @@
<?xml version='1.0' encoding='ASCII'?>
<flow_graph>
- <timestamp>Sun Jul 8 16:56:18 2012</timestamp>
+ <timestamp>Tue Nov 6 20:52:00 2012</timestamp>
<block>
- <key>variable_slider</key>
+ <key>options</key>
<param>
<key>id</key>
- <value>freq</value>
+ <value>gfsk_loopback</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>label</key>
- <value>Frequency (Hz)</value>
+ <key>title</key>
+ <value></value>
</param>
<param>
- <key>value</key>
- <value>500</value>
+ <key>author</key>
+ <value></value>
</param>
<param>
- <key>min</key>
- <value>0</value>
+ <key>description</key>
+ <value></value>
</param>
<param>
- <key>max</key>
- <value>samp_rate/2</value>
+ <key>window_size</key>
+ <value>1280, 1024</value>
</param>
<param>
- <key>num_steps</key>
- <value>100</value>
+ <key>generate_options</key>
+ <value>qt_gui</value>
</param>
<param>
- <key>style</key>
- <value>wx.SL_HORIZONTAL</value>
+ <key>category</key>
+ <value>Custom</value>
</param>
<param>
- <key>converver</key>
- <value>float_converter</value>
+ <key>run_options</key>
+ <value>prompt</value>
</param>
<param>
- <key>grid_pos</key>
- <value></value>
+ <key>run</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>max_nouts</key>
+ <value>0</value>
</param>
<param>
- <key>notebook</key>
+ <key>realtime_scheduling</key>
<value></value>
</param>
<param>
<key>_coordinate</key>
- <value>(34, 241)</value>
+ <value>(10, 10)</value>
</param>
<param>
<key>_rotation</key>
@@ -57,42 +61,45 @@
</param>
</block>
<block>
- <key>gr_sig_source_x</key>
+ <key>variable</key>
<param>
<key>id</key>
- <value>gr_sig_source_x_0</value>
+ <value>fm_sensitivity</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>type</key>
- <value>float</value>
+ <key>value</key>
+ <value>1.0</value>
</param>
<param>
- <key>samp_rate</key>
- <value>samp_rate</value>
+ <key>_coordinate</key>
+ <value>(14, 273)</value>
</param>
<param>
- <key>waveform</key>
- <value>gr.GR_COS_WAVE</value>
+ <key>_rotation</key>
+ <value>0</value>
</param>
+ </block>
+ <block>
+ <key>variable</key>
<param>
- <key>freq</key>
- <value>freq</value>
+ <key>id</key>
+ <value>sps</value>
</param>
<param>
- <key>amp</key>
- <value>1</value>
+ <key>_enabled</key>
+ <value>True</value>
</param>
<param>
- <key>offset</key>
- <value>0</value>
+ <key>value</key>
+ <value>4</value>
</param>
<param>
<key>_coordinate</key>
- <value>(215, 26)</value>
+ <value>(15, 338)</value>
</param>
<param>
<key>_rotation</key>
@@ -100,30 +107,22 @@
</param>
</block>
<block>
- <key>gr_throttle</key>
+ <key>variable</key>
<param>
<key>id</key>
- <value>gr_throttle_0_0</value>
+ <value>samp_rate</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>type</key>
- <value>float</value>
- </param>
- <param>
- <key>samples_per_second</key>
- <value>samp_rate</value>
- </param>
- <param>
- <key>vlen</key>
- <value>1</value>
+ <key>value</key>
+ <value>32000</value>
</param>
<param>
<key>_coordinate</key>
- <value>(272.5, 142.0)</value>
+ <value>(12, 76)</value>
</param>
<param>
<key>_rotation</key>
@@ -131,65 +130,54 @@
</param>
</block>
<block>
- <key>blks2_packet_encoder</key>
+ <key>variable_qtgui_range</key>
<param>
<key>id</key>
- <value>blks2_packet_encoder_0</value>
+ <value>freq</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>type</key>
- <value>float</value>
- </param>
- <param>
- <key>samples_per_symbol</key>
- <value>2</value>
- </param>
- <param>
- <key>bits_per_symbol</key>
- <value>1</value>
- </param>
- <param>
- <key>access_code</key>
+ <key>label</key>
<value></value>
</param>
<param>
- <key>pad_for_usrp</key>
- <value>True</value>
+ <key>value</key>
+ <value>500</value>
</param>
<param>
- <key>payload_length</key>
+ <key>start</key>
<value>0</value>
</param>
<param>
- <key>_coordinate</key>
- <value>(261, 227)</value>
+ <key>stop</key>
+ <value>500</value>
</param>
<param>
- <key>_rotation</key>
- <value>0</value>
+ <key>step</key>
+ <value>1</value>
</param>
- </block>
- <block>
- <key>variable</key>
<param>
- <key>id</key>
- <value>samp_rate</value>
+ <key>widget</key>
+ <value>counter_slider</value>
</param>
<param>
- <key>_enabled</key>
- <value>True</value>
+ <key>orient</key>
+ <value>Qt.Horizontal</value>
</param>
<param>
- <key>value</key>
- <value>10000</value>
+ <key>min_len</key>
+ <value>200</value>
+ </param>
+ <param>
+ <key>gui_hint</key>
+ <value></value>
</param>
<param>
<key>_coordinate</key>
- <value>(10, 170)</value>
+ <value>(13, 152)</value>
</param>
<param>
<key>_rotation</key>
@@ -197,50 +185,50 @@
</param>
</block>
<block>
- <key>digital_gfsk_demod</key>
+ <key>qtgui_time_sink_x</key>
<param>
<key>id</key>
- <value>digital_gfsk_demod_0</value>
+ <value>qtgui_time_sink_x_1</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>samples_per_symbol</key>
- <value>sps</value>
+ <key>type</key>
+ <value>float</value>
</param>
<param>
- <key>sensitivity</key>
- <value>fm_sensitivity</value>
+ <key>name</key>
+ <value>QT GUI Plot</value>
</param>
<param>
- <key>gain_mu</key>
- <value>0.175</value>
+ <key>size</key>
+ <value>1024</value>
</param>
<param>
- <key>mu</key>
- <value>0.5</value>
+ <key>srate</key>
+ <value>samp_rate</value>
</param>
<param>
- <key>omega_relative_limit</key>
- <value>0.005</value>
+ <key>ymin</key>
+ <value>-1</value>
</param>
<param>
- <key>freq_error</key>
- <value>0.0</value>
+ <key>ymax</key>
+ <value>1</value>
</param>
<param>
- <key>verbose</key>
- <value>False</value>
+ <key>nconnections</key>
+ <value>1</value>
</param>
<param>
- <key>log</key>
- <value>False</value>
+ <key>gui_hint</key>
+ <value></value>
</param>
<param>
<key>_coordinate</key>
- <value>(669, 257)</value>
+ <value>(906, 122)</value>
</param>
<param>
<key>_rotation</key>
@@ -248,84 +236,42 @@
</param>
</block>
<block>
- <key>variable</key>
+ <key>blks2_packet_encoder</key>
<param>
<key>id</key>
- <value>sps</value>
+ <value>blks2_packet_encoder_0</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>value</key>
- <value>8</value>
- </param>
- <param>
- <key>_coordinate</key>
- <value>(47, 445)</value>
- </param>
- <param>
- <key>_rotation</key>
- <value>0</value>
- </param>
- </block>
- <block>
- <key>digital_gfsk_mod</key>
- <param>
- <key>id</key>
- <value>digital_gfsk_mod_0</value>
- </param>
- <param>
- <key>_enabled</key>
- <value>True</value>
+ <key>type</key>
+ <value>float</value>
</param>
<param>
<key>samples_per_symbol</key>
<value>sps</value>
</param>
<param>
- <key>sensitivity</key>
- <value>fm_sensitivity</value>
- </param>
- <param>
- <key>bt</key>
- <value>0.35</value>
- </param>
- <param>
- <key>verbose</key>
- <value>False</value>
- </param>
- <param>
- <key>log</key>
- <value>False</value>
- </param>
- <param>
- <key>_coordinate</key>
- <value>(456, 277)</value>
- </param>
- <param>
- <key>_rotation</key>
- <value>0</value>
+ <key>bits_per_symbol</key>
+ <value>1</value>
</param>
- </block>
- <block>
- <key>variable</key>
<param>
- <key>id</key>
- <value>fm_sensitivity</value>
+ <key>access_code</key>
+ <value></value>
</param>
<param>
- <key>_enabled</key>
+ <key>pad_for_usrp</key>
<value>True</value>
</param>
<param>
- <key>value</key>
- <value>1.0</value>
+ <key>payload_length</key>
+ <value>0</value>
</param>
<param>
<key>_coordinate</key>
- <value>(40, 366)</value>
+ <value>(237, 261)</value>
</param>
<param>
<key>_rotation</key>
@@ -356,7 +302,7 @@
</param>
<param>
<key>_coordinate</key>
- <value>(705, 130)</value>
+ <value>(720, 130)</value>
</param>
<param>
<key>_rotation</key>
@@ -364,22 +310,30 @@
</param>
</block>
<block>
- <key>gr_quadrature_demod_cf</key>
+ <key>blocks_throttle</key>
<param>
<key>id</key>
- <value>gr_quadrature_demod_cf_0</value>
+ <value>blocks_throttle_0_0</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>gain</key>
+ <key>type</key>
+ <value>float</value>
+ </param>
+ <param>
+ <key>samples_per_second</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>vlen</key>
<value>1</value>
</param>
<param>
<key>_coordinate</key>
- <value>(627, 417)</value>
+ <value>(413, 50)</value>
</param>
<param>
<key>_rotation</key>
@@ -387,58 +341,42 @@
</param>
</block>
<block>
- <key>options</key>
+ <key>analog_sig_source_x</key>
<param>
<key>id</key>
- <value>gfsk_loopback</value>
+ <value>analog_sig_source_x_0</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>title</key>
- <value></value>
- </param>
- <param>
- <key>author</key>
- <value></value>
- </param>
- <param>
- <key>description</key>
- <value></value>
- </param>
- <param>
- <key>window_size</key>
- <value>1280, 1024</value>
+ <key>type</key>
+ <value>float</value>
</param>
<param>
- <key>generate_options</key>
- <value>wx_gui</value>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
</param>
<param>
- <key>category</key>
- <value>Custom</value>
+ <key>waveform</key>
+ <value>analog.GR_COS_WAVE</value>
</param>
<param>
- <key>run_options</key>
- <value>prompt</value>
+ <key>freq</key>
+ <value>freq</value>
</param>
<param>
- <key>run</key>
- <value>True</value>
+ <key>amp</key>
+ <value>1</value>
</param>
<param>
- <key>max_nouts</key>
+ <key>offset</key>
<value>0</value>
</param>
<param>
- <key>realtime_scheduling</key>
- <value></value>
- </param>
- <param>
<key>_coordinate</key>
- <value>(10, 10)</value>
+ <value>(214, 18)</value>
</param>
<param>
<key>_rotation</key>
@@ -446,74 +384,89 @@
</param>
</block>
<block>
- <key>wxgui_scopesink2</key>
+ <key>digital_gfsk_demod</key>
<param>
<key>id</key>
- <value>wxgui_scopesink2_0</value>
+ <value>digital_gfsk_demod_0</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>type</key>
- <value>float</value>
+ <key>samples_per_symbol</key>
+ <value>sps</value>
</param>
<param>
- <key>title</key>
- <value>Scope Plot</value>
+ <key>sensitivity</key>
+ <value>fm_sensitivity</value>
</param>
<param>
- <key>samp_rate</key>
- <value>samp_rate</value>
+ <key>gain_mu</key>
+ <value>0.175</value>
</param>
<param>
- <key>v_scale</key>
- <value>0</value>
+ <key>mu</key>
+ <value>0.5</value>
</param>
<param>
- <key>v_offset</key>
- <value>0</value>
+ <key>omega_relative_limit</key>
+ <value>0.005</value>
</param>
<param>
- <key>t_scale</key>
- <value>1./freq</value>
+ <key>freq_error</key>
+ <value>0.0</value>
</param>
<param>
- <key>ac_couple</key>
+ <key>verbose</key>
<value>False</value>
</param>
<param>
- <key>xy_mode</key>
+ <key>log</key>
<value>False</value>
</param>
<param>
- <key>num_inputs</key>
- <value>1</value>
+ <key>_coordinate</key>
+ <value>(670, 253)</value>
</param>
<param>
- <key>win_size</key>
- <value></value>
+ <key>_rotation</key>
+ <value>0</value>
</param>
+ </block>
+ <block>
+ <key>digital_gfsk_mod</key>
<param>
- <key>grid_pos</key>
- <value></value>
+ <key>id</key>
+ <value>digital_gfsk_mod_0</value>
</param>
<param>
- <key>notebook</key>
- <value></value>
+ <key>_enabled</key>
+ <value>True</value>
</param>
<param>
- <key>trig_mode</key>
- <value>gr.gr_TRIG_MODE_AUTO</value>
+ <key>samples_per_symbol</key>
+ <value>sps</value>
</param>
<param>
- <key>y_axis_label</key>
- <value>Counts</value>
+ <key>sensitivity</key>
+ <value>fm_sensitivity</value>
+ </param>
+ <param>
+ <key>bt</key>
+ <value>0.35</value>
+ </param>
+ <param>
+ <key>verbose</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>log</key>
+ <value>False</value>
</param>
<param>
<key>_coordinate</key>
- <value>(907, 59)</value>
+ <value>(456, 277)</value>
</param>
<param>
<key>_rotation</key>
@@ -521,10 +474,10 @@
</param>
</block>
<block>
- <key>wxgui_scopesink2</key>
+ <key>qtgui_time_sink_x</key>
<param>
<key>id</key>
- <value>wxgui_scopesink2_1</value>
+ <value>qtgui_time_sink_x_1_0</value>
</param>
<param>
<key>_enabled</key>
@@ -535,60 +488,59 @@
<value>float</value>
</param>
<param>
- <key>title</key>
- <value>Scope Plot</value>
+ <key>name</key>
+ <value>QT GUI Plot</value>
</param>
<param>
- <key>samp_rate</key>
- <value>samp_rate</value>
+ <key>size</key>
+ <value>1024</value>
</param>
<param>
- <key>v_scale</key>
- <value>0</value>
- </param>
- <param>
- <key>v_offset</key>
- <value>0</value>
- </param>
- <param>
- <key>t_scale</key>
- <value>0</value>
+ <key>srate</key>
+ <value>samp_rate</value>
</param>
<param>
- <key>ac_couple</key>
- <value>False</value>
+ <key>ymin</key>
+ <value>-1</value>
</param>
<param>
- <key>xy_mode</key>
- <value>False</value>
+ <key>ymax</key>
+ <value>1</value>
</param>
<param>
- <key>num_inputs</key>
+ <key>nconnections</key>
<value>1</value>
</param>
<param>
- <key>win_size</key>
+ <key>gui_hint</key>
<value></value>
</param>
<param>
- <key>grid_pos</key>
- <value></value>
+ <key>_coordinate</key>
+ <value>(888, 386)</value>
</param>
<param>
- <key>notebook</key>
- <value></value>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>analog_quadrature_demod_cf</key>
+ <param>
+ <key>id</key>
+ <value>analog_quadrature_demod_cf_0</value>
</param>
<param>
- <key>trig_mode</key>
- <value>gr.gr_TRIG_MODE_AUTO</value>
+ <key>_enabled</key>
+ <value>True</value>
</param>
<param>
- <key>y_axis_label</key>
- <value>Counts</value>
+ <key>gain</key>
+ <value>1</value>
</param>
<param>
<key>_coordinate</key>
- <value>(853, 400)</value>
+ <value>(673, 403)</value>
</param>
<param>
<key>_rotation</key>
@@ -596,50 +548,50 @@
</param>
</block>
<connection>
- <source_block_id>digital_gfsk_mod_0</source_block_id>
- <sink_block_id>digital_gfsk_demod_0</sink_block_id>
+ <source_block_id>blks2_packet_encoder_0</source_block_id>
+ <sink_block_id>digital_gfsk_mod_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_sig_source_x_0</source_block_id>
- <sink_block_id>gr_throttle_0_0</sink_block_id>
+ <source_block_id>blocks_throttle_0_0</source_block_id>
+ <sink_block_id>blks2_packet_encoder_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_throttle_0_0</source_block_id>
- <sink_block_id>blks2_packet_encoder_0</sink_block_id>
+ <source_block_id>digital_gfsk_demod_0</source_block_id>
+ <sink_block_id>blks2_packet_decoder_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>blks2_packet_encoder_0</source_block_id>
- <sink_block_id>digital_gfsk_mod_0</sink_block_id>
+ <source_block_id>digital_gfsk_mod_0</source_block_id>
+ <sink_block_id>digital_gfsk_demod_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>digital_gfsk_demod_0</source_block_id>
- <sink_block_id>blks2_packet_decoder_0</sink_block_id>
+ <source_block_id>blks2_packet_decoder_0</source_block_id>
+ <sink_block_id>qtgui_time_sink_x_1</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>blks2_packet_decoder_0</source_block_id>
- <sink_block_id>wxgui_scopesink2_0</sink_block_id>
+ <source_block_id>analog_sig_source_x_0</source_block_id>
+ <sink_block_id>blocks_throttle_0_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>digital_gfsk_mod_0</source_block_id>
- <sink_block_id>gr_quadrature_demod_cf_0</sink_block_id>
+ <sink_block_id>analog_quadrature_demod_cf_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_quadrature_demod_cf_0</source_block_id>
- <sink_block_id>wxgui_scopesink2_1</sink_block_id>
+ <source_block_id>analog_quadrature_demod_cf_0</source_block_id>
+ <sink_block_id>qtgui_time_sink_x_1_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
diff --git a/gr-digital/examples/demod/gmsk_loopback.grc b/gr-digital/examples/demod/gmsk_loopback.grc
new file mode 100644
index 0000000000..710070e908
--- /dev/null
+++ b/gr-digital/examples/demod/gmsk_loopback.grc
@@ -0,0 +1,590 @@
+<?xml version='1.0' encoding='ASCII'?>
+<flow_graph>
+ <timestamp>Tue Nov 6 20:49:18 2012</timestamp>
+ <block>
+ <key>options</key>
+ <param>
+ <key>id</key>
+ <value>gfsk_loopback</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>title</key>
+ <value></value>
+ </param>
+ <param>
+ <key>author</key>
+ <value></value>
+ </param>
+ <param>
+ <key>description</key>
+ <value></value>
+ </param>
+ <param>
+ <key>window_size</key>
+ <value>1280, 1024</value>
+ </param>
+ <param>
+ <key>generate_options</key>
+ <value>qt_gui</value>
+ </param>
+ <param>
+ <key>category</key>
+ <value>Custom</value>
+ </param>
+ <param>
+ <key>run_options</key>
+ <value>prompt</value>
+ </param>
+ <param>
+ <key>run</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>max_nouts</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>realtime_scheduling</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(10, 10)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>fm_sensitivity</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(14, 273)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>sps</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>4</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(15, 338)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>32000</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(12, 76)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable_qtgui_range</key>
+ <param>
+ <key>id</key>
+ <value>freq</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>label</key>
+ <value></value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>500</value>
+ </param>
+ <param>
+ <key>start</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>stop</key>
+ <value>500</value>
+ </param>
+ <param>
+ <key>step</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>widget</key>
+ <value>counter_slider</value>
+ </param>
+ <param>
+ <key>orient</key>
+ <value>Qt.Horizontal</value>
+ </param>
+ <param>
+ <key>min_len</key>
+ <value>200</value>
+ </param>
+ <param>
+ <key>gui_hint</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(13, 152)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>qtgui_time_sink_x</key>
+ <param>
+ <key>id</key>
+ <value>qtgui_time_sink_x_1</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>float</value>
+ </param>
+ <param>
+ <key>name</key>
+ <value>QT GUI Plot</value>
+ </param>
+ <param>
+ <key>size</key>
+ <value>1024</value>
+ </param>
+ <param>
+ <key>srate</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>ymin</key>
+ <value>-1</value>
+ </param>
+ <param>
+ <key>ymax</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>nconnections</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>gui_hint</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(906, 122)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>blks2_packet_encoder</key>
+ <param>
+ <key>id</key>
+ <value>blks2_packet_encoder_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>float</value>
+ </param>
+ <param>
+ <key>samples_per_symbol</key>
+ <value>sps</value>
+ </param>
+ <param>
+ <key>bits_per_symbol</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>access_code</key>
+ <value></value>
+ </param>
+ <param>
+ <key>pad_for_usrp</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>payload_length</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(237, 261)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>blks2_packet_decoder</key>
+ <param>
+ <key>id</key>
+ <value>blks2_packet_decoder_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>float</value>
+ </param>
+ <param>
+ <key>access_code</key>
+ <value></value>
+ </param>
+ <param>
+ <key>threshold</key>
+ <value>-1</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(720, 130)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>digital_gmsk_demod</key>
+ <param>
+ <key>id</key>
+ <value>digital_gmsk_demod_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>samples_per_symbol</key>
+ <value>2</value>
+ </param>
+ <param>
+ <key>gain_mu</key>
+ <value>0.175</value>
+ </param>
+ <param>
+ <key>mu</key>
+ <value>0.5</value>
+ </param>
+ <param>
+ <key>omega_relative_limit</key>
+ <value>0.005</value>
+ </param>
+ <param>
+ <key>freq_error</key>
+ <value>0.0</value>
+ </param>
+ <param>
+ <key>verbose</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>log</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(666, 261)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>blocks_throttle</key>
+ <param>
+ <key>id</key>
+ <value>blocks_throttle_0_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>float</value>
+ </param>
+ <param>
+ <key>samples_per_second</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(413, 50)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>analog_sig_source_x</key>
+ <param>
+ <key>id</key>
+ <value>analog_sig_source_x_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>float</value>
+ </param>
+ <param>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>waveform</key>
+ <value>analog.GR_COS_WAVE</value>
+ </param>
+ <param>
+ <key>freq</key>
+ <value>freq</value>
+ </param>
+ <param>
+ <key>amp</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>offset</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(210, 18)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>qtgui_time_sink_x</key>
+ <param>
+ <key>id</key>
+ <value>qtgui_time_sink_x_1_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>float</value>
+ </param>
+ <param>
+ <key>name</key>
+ <value>QT GUI Plot</value>
+ </param>
+ <param>
+ <key>size</key>
+ <value>1024</value>
+ </param>
+ <param>
+ <key>srate</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>ymin</key>
+ <value>-1</value>
+ </param>
+ <param>
+ <key>ymax</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>nconnections</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>gui_hint</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(888, 386)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>digital_gmsk_mod</key>
+ <param>
+ <key>id</key>
+ <value>digital_gmsk_mod_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>samples_per_symbol</key>
+ <value>2</value>
+ </param>
+ <param>
+ <key>bt</key>
+ <value>0.35</value>
+ </param>
+ <param>
+ <key>verbose</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>log</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(446, 285)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>analog_quadrature_demod_cf</key>
+ <param>
+ <key>id</key>
+ <value>analog_quadrature_demod_cf_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>gain</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(675, 402)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <connection>
+ <source_block_id>blocks_throttle_0_0</source_block_id>
+ <sink_block_id>blks2_packet_encoder_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>blks2_packet_decoder_0</source_block_id>
+ <sink_block_id>qtgui_time_sink_x_1</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>blks2_packet_encoder_0</source_block_id>
+ <sink_block_id>digital_gmsk_mod_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>digital_gmsk_mod_0</source_block_id>
+ <sink_block_id>digital_gmsk_demod_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>digital_gmsk_demod_0</source_block_id>
+ <sink_block_id>blks2_packet_decoder_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>analog_sig_source_x_0</source_block_id>
+ <sink_block_id>blocks_throttle_0_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>analog_quadrature_demod_cf_0</source_block_id>
+ <sink_block_id>qtgui_time_sink_x_1_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>digital_gmsk_mod_0</source_block_id>
+ <sink_block_id>analog_quadrature_demod_cf_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+</flow_graph>
diff --git a/gr-digital/examples/demod/mpsk_demod.grc b/gr-digital/examples/demod/mpsk_demod.grc
index b718fb68af..1045ef5797 100644
--- a/gr-digital/examples/demod/mpsk_demod.grc
+++ b/gr-digital/examples/demod/mpsk_demod.grc
@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='ASCII'?>
<flow_graph>
- <timestamp>Thu Jul 5 16:28:45 2012</timestamp>
+ <timestamp>Mon Aug 20 19:51:38 2012</timestamp>
<block>
<key>options</key>
<param>
@@ -29,7 +29,7 @@
</param>
<param>
<key>generate_options</key>
- <value>wx_gui</value>
+ <value>qt_gui</value>
</param>
<param>
<key>category</key>
@@ -84,45 +84,18 @@
</param>
</block>
<block>
- <key>variable</key>
- <param>
- <key>id</key>
- <value>samps_per_sym</value>
- </param>
- <param>
- <key>_enabled</key>
- <value>True</value>
- </param>
- <param>
- <key>value</key>
- <value>4</value>
- </param>
- <param>
- <key>_coordinate</key>
- <value>(7, 89)</value>
- </param>
- <param>
- <key>_rotation</key>
- <value>0</value>
- </param>
- </block>
- <block>
- <key>variable_slider</key>
+ <key>random_source_x</key>
<param>
<key>id</key>
- <value>noise</value>
+ <value>random_source_x_0</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>label</key>
- <value>Noise</value>
- </param>
- <param>
- <key>value</key>
- <value>.1</value>
+ <key>type</key>
+ <value>byte</value>
</param>
<param>
<key>min</key>
@@ -130,31 +103,19 @@
</param>
<param>
<key>max</key>
- <value>1</value>
- </param>
- <param>
- <key>num_steps</key>
- <value>100</value>
- </param>
- <param>
- <key>style</key>
- <value>wx.SL_HORIZONTAL</value>
- </param>
- <param>
- <key>converver</key>
- <value>float_converter</value>
+ <value>2**8</value>
</param>
<param>
- <key>grid_pos</key>
- <value></value>
+ <key>num_samps</key>
+ <value>10000</value>
</param>
<param>
- <key>notebook</key>
- <value></value>
+ <key>repeat</key>
+ <value>True</value>
</param>
<param>
<key>_coordinate</key>
- <value>(259, 353)</value>
+ <value>(161, 119)</value>
</param>
<param>
<key>_rotation</key>
@@ -162,54 +123,42 @@
</param>
</block>
<block>
- <key>variable_slider</key>
+ <key>digital_dxpsk_mod</key>
<param>
<key>id</key>
- <value>freq_off</value>
+ <value>digital_dxpsk_mod_0</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>label</key>
- <value>Freq Offset</value>
- </param>
- <param>
- <key>value</key>
- <value>0</value>
- </param>
- <param>
- <key>min</key>
- <value>-.5</value>
- </param>
- <param>
- <key>max</key>
- <value>.5</value>
+ <key>type</key>
+ <value>dqpsk</value>
</param>
<param>
- <key>num_steps</key>
- <value>1000</value>
+ <key>samples_per_symbol</key>
+ <value>samps_per_sym</value>
</param>
<param>
- <key>style</key>
- <value>wx.SL_HORIZONTAL</value>
+ <key>excess_bw</key>
+ <value>0.35</value>
</param>
<param>
- <key>converver</key>
- <value>float_converter</value>
+ <key>mod_code</key>
+ <value>"gray"</value>
</param>
<param>
- <key>grid_pos</key>
- <value></value>
+ <key>verbose</key>
+ <value>False</value>
</param>
<param>
- <key>notebook</key>
- <value></value>
+ <key>log</key>
+ <value>False</value>
</param>
<param>
<key>_coordinate</key>
- <value>(126, 345)</value>
+ <value>(361, 119)</value>
</param>
<param>
<key>_rotation</key>
@@ -217,34 +166,22 @@
</param>
</block>
<block>
- <key>notebook</key>
+ <key>variable</key>
<param>
<key>id</key>
- <value>notebook</value>
+ <value>samps_per_sym</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>style</key>
- <value>wx.NB_TOP</value>
- </param>
- <param>
- <key>labels</key>
- <value>['Constellation', 'Spectrum']</value>
- </param>
- <param>
- <key>grid_pos</key>
- <value></value>
- </param>
- <param>
- <key>notebook</key>
- <value></value>
+ <key>value</key>
+ <value>4</value>
</param>
<param>
<key>_coordinate</key>
- <value>(520, 407)</value>
+ <value>(12, 99)</value>
</param>
<param>
<key>_rotation</key>
@@ -252,78 +189,54 @@
</param>
</block>
<block>
- <key>wxgui_constellationsink2</key>
+ <key>variable_qtgui_range</key>
<param>
<key>id</key>
- <value>wxgui_constellationsink2_0</value>
+ <value>freq_off</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>title</key>
- <value>Constellation Plot</value>
- </param>
- <param>
- <key>samp_rate</key>
- <value>samp_rate</value>
- </param>
- <param>
- <key>frame_rate</key>
- <value>5</value>
- </param>
- <param>
- <key>const_size</key>
- <value>2048</value>
- </param>
- <param>
- <key>M</key>
- <value>4</value>
+ <key>label</key>
+ <value>Freq. Offset</value>
</param>
<param>
- <key>theta</key>
+ <key>value</key>
<value>0</value>
</param>
<param>
- <key>loop_bw</key>
- <value>6.28/100.0</value>
- </param>
- <param>
- <key>fmax</key>
- <value>0.06</value>
+ <key>start</key>
+ <value>-0.5</value>
</param>
<param>
- <key>mu</key>
+ <key>stop</key>
<value>0.5</value>
</param>
<param>
- <key>gain_mu</key>
- <value>0.005</value>
+ <key>step</key>
+ <value>0.01</value>
</param>
<param>
- <key>symbol_rate</key>
- <value>samp_rate/4.</value>
+ <key>widget</key>
+ <value>counter_slider</value>
</param>
<param>
- <key>omega_limit</key>
- <value>0.005</value>
+ <key>orient</key>
+ <value>Qt.Horizontal</value>
</param>
<param>
- <key>win_size</key>
- <value></value>
+ <key>min_len</key>
+ <value>200</value>
</param>
<param>
- <key>grid_pos</key>
+ <key>gui_hint</key>
<value></value>
</param>
<param>
- <key>notebook</key>
- <value>notebook, 0</value>
- </param>
- <param>
<key>_coordinate</key>
- <value>(824, 212)</value>
+ <value>(17, 260)</value>
</param>
<param>
<key>_rotation</key>
@@ -331,90 +244,101 @@
</param>
</block>
<block>
- <key>wxgui_fftsink2</key>
+ <key>variable_qtgui_range</key>
<param>
<key>id</key>
- <value>wxgui_fftsink2_0</value>
+ <value>noise</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>type</key>
- <value>complex</value>
+ <key>label</key>
+ <value>Noise</value>
</param>
<param>
- <key>title</key>
- <value>FFT Plot</value>
+ <key>value</key>
+ <value>0.1</value>
</param>
<param>
- <key>samp_rate</key>
- <value>samp_rate</value>
+ <key>start</key>
+ <value>0</value>
</param>
<param>
- <key>baseband_freq</key>
- <value>0</value>
+ <key>stop</key>
+ <value>1</value>
</param>
<param>
- <key>y_per_div</key>
- <value>10</value>
+ <key>step</key>
+ <value>0.01</value>
</param>
<param>
- <key>y_divs</key>
- <value>10</value>
+ <key>widget</key>
+ <value>counter_slider</value>
</param>
<param>
- <key>ref_level</key>
- <value>50</value>
+ <key>orient</key>
+ <value>Qt.Horizontal</value>
</param>
<param>
- <key>ref_scale</key>
- <value>2.0</value>
+ <key>min_len</key>
+ <value>200</value>
</param>
<param>
- <key>fft_size</key>
- <value>1024</value>
+ <key>gui_hint</key>
+ <value></value>
</param>
<param>
- <key>fft_rate</key>
- <value>30</value>
+ <key>_coordinate</key>
+ <value>(146, 262)</value>
</param>
<param>
- <key>peak_hold</key>
- <value>False</value>
+ <key>_rotation</key>
+ <value>0</value>
</param>
+ </block>
+ <block>
+ <key>qtgui_tab_widget</key>
<param>
- <key>average</key>
- <value>False</value>
+ <key>id</key>
+ <value>notebook</value>
</param>
<param>
- <key>avg_alpha</key>
- <value>0</value>
+ <key>_enabled</key>
+ <value>True</value>
</param>
<param>
- <key>win</key>
- <value>None</value>
+ <key>num_tabs</key>
+ <value>2</value>
</param>
<param>
- <key>win_size</key>
- <value></value>
+ <key>label0</key>
+ <value>Constellation</value>
</param>
<param>
- <key>grid_pos</key>
- <value></value>
+ <key>label1</key>
+ <value>Spectrum</value>
</param>
<param>
- <key>notebook</key>
- <value>notebook, 1</value>
+ <key>label2</key>
+ <value>Tab 2</value>
</param>
<param>
- <key>freqvar</key>
- <value>None</value>
+ <key>label3</key>
+ <value>Tab 3</value>
+ </param>
+ <param>
+ <key>label4</key>
+ <value>Tab 4</value>
+ </param>
+ <param>
+ <key>gui_hint</key>
+ <value></value>
</param>
<param>
<key>_coordinate</key>
- <value>(847, 10)</value>
+ <value>(21, 394)</value>
</param>
<param>
<key>_rotation</key>
@@ -422,10 +346,10 @@
</param>
</block>
<block>
- <key>gr_channel_model</key>
+ <key>channel_model</key>
<param>
<key>id</key>
- <value>gr_channel_model_0</value>
+ <value>channel_model_0</value>
</param>
<param>
<key>_enabled</key>
@@ -449,11 +373,11 @@
</param>
<param>
<key>seed</key>
- <value>42</value>
+ <value>0</value>
</param>
<param>
<key>_coordinate</key>
- <value>(487, 282)</value>
+ <value>(369, 264)</value>
</param>
<param>
<key>_rotation</key>
@@ -461,10 +385,10 @@
</param>
</block>
<block>
- <key>gr_throttle</key>
+ <key>blocks_throttle</key>
<param>
<key>id</key>
- <value>gr_throttle_0</value>
+ <value>blocks_throttle_0</value>
</param>
<param>
<key>_enabled</key>
@@ -484,7 +408,7 @@
</param>
<param>
<key>_coordinate</key>
- <value>(633, 82)</value>
+ <value>(597, 142)</value>
</param>
<param>
<key>_rotation</key>
@@ -492,10 +416,10 @@
</param>
</block>
<block>
- <key>random_source_x</key>
+ <key>qtgui_const_sink_x</key>
<param>
<key>id</key>
- <value>random_source_x_0</value>
+ <value>qtgui_const_sink_x_0</value>
</param>
<param>
<key>_enabled</key>
@@ -503,27 +427,27 @@
</param>
<param>
<key>type</key>
- <value>byte</value>
+ <value>complex</value>
</param>
<param>
- <key>min</key>
- <value>0</value>
+ <key>name</key>
+ <value>QT GUI Plot</value>
</param>
<param>
- <key>max</key>
- <value>2**8</value>
+ <key>size</key>
+ <value>1024</value>
</param>
<param>
- <key>num_samps</key>
- <value>10000</value>
+ <key>nconnections</key>
+ <value>1</value>
</param>
<param>
- <key>repeat</key>
- <value>True</value>
+ <key>gui_hint</key>
+ <value>notebook@0</value>
</param>
<param>
<key>_coordinate</key>
- <value>(161, 119)</value>
+ <value>(810, 184)</value>
</param>
<param>
<key>_rotation</key>
@@ -531,10 +455,10 @@
</param>
</block>
<block>
- <key>digital_dxpsk_mod</key>
+ <key>qtgui_freq_sink_x</key>
<param>
<key>id</key>
- <value>digital_dxpsk_mod_0</value>
+ <value>qtgui_freq_sink_x_0</value>
</param>
<param>
<key>_enabled</key>
@@ -542,31 +466,43 @@
</param>
<param>
<key>type</key>
- <value>dqpsk</value>
+ <value>complex</value>
</param>
<param>
- <key>samples_per_symbol</key>
- <value>samps_per_sym</value>
+ <key>name</key>
+ <value>QT GUI Plot</value>
</param>
<param>
- <key>excess_bw</key>
- <value>0.35</value>
+ <key>fftsize</key>
+ <value>1024</value>
</param>
<param>
- <key>gray_coded</key>
- <value>True</value>
+ <key>wintype</key>
+ <value>firdes.WIN_BLACKMAN_hARRIS</value>
</param>
<param>
- <key>verbose</key>
- <value>False</value>
+ <key>fc</key>
+ <value>0</value>
</param>
<param>
- <key>log</key>
- <value>False</value>
+ <key>bw</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>rate</key>
+ <value>10</value>
+ </param>
+ <param>
+ <key>nconnections</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>gui_hint</key>
+ <value>notebook@1</value>
</param>
<param>
<key>_coordinate</key>
- <value>(361, 119)</value>
+ <value>(810, 65)</value>
</param>
<param>
<key>_rotation</key>
@@ -574,32 +510,32 @@
</param>
</block>
<connection>
- <source_block_id>gr_throttle_0</source_block_id>
- <sink_block_id>wxgui_constellationsink2_0</sink_block_id>
+ <source_block_id>random_source_x_0</source_block_id>
+ <sink_block_id>digital_dxpsk_mod_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_throttle_0</source_block_id>
- <sink_block_id>wxgui_fftsink2_0</sink_block_id>
+ <source_block_id>digital_dxpsk_mod_0</source_block_id>
+ <sink_block_id>channel_model_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_channel_model_0</source_block_id>
- <sink_block_id>gr_throttle_0</sink_block_id>
+ <source_block_id>channel_model_0</source_block_id>
+ <sink_block_id>blocks_throttle_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>digital_dxpsk_mod_0</source_block_id>
- <sink_block_id>gr_channel_model_0</sink_block_id>
+ <source_block_id>blocks_throttle_0</source_block_id>
+ <sink_block_id>qtgui_freq_sink_x_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>random_source_x_0</source_block_id>
- <sink_block_id>digital_dxpsk_mod_0</sink_block_id>
+ <source_block_id>blocks_throttle_0</source_block_id>
+ <sink_block_id>qtgui_const_sink_x_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
diff --git a/gr-digital/examples/demod/pam_sync.grc b/gr-digital/examples/demod/pam_sync.grc
index 7bc071d110..4785482e3f 100644
--- a/gr-digital/examples/demod/pam_sync.grc
+++ b/gr-digital/examples/demod/pam_sync.grc
@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='ASCII'?>
<flow_graph>
- <timestamp>Mon Jan 14 10:47:40 2013</timestamp>
+ <timestamp>Tue Jan 15 15:21:49 2013</timestamp>
<block>
<key>options</key>
<param>
@@ -107,100 +107,6 @@
</param>
</block>
<block>
- <key>gr_pfb_clock_sync_xxx</key>
- <param>
- <key>id</key>
- <value>gr_pfb_clock_sync_xxx_0</value>
- </param>
- <param>
- <key>_enabled</key>
- <value>True</value>
- </param>
- <param>
- <key>type</key>
- <value>ccf</value>
- </param>
- <param>
- <key>sps</key>
- <value>spb</value>
- </param>
- <param>
- <key>alpha</key>
- <value>time_alpha</value>
- </param>
- <param>
- <key>beta</key>
- <value>time_beta</value>
- </param>
- <param>
- <key>taps</key>
- <value>rrctaps</value>
- </param>
- <param>
- <key>filter_size</key>
- <value>nfilts</value>
- </param>
- <param>
- <key>init_phase</key>
- <value>16</value>
- </param>
- <param>
- <key>max_dev</key>
- <value>1.5</value>
- </param>
- <param>
- <key>osps</key>
- <value>1</value>
- </param>
- <param>
- <key>_coordinate</key>
- <value>(598, 241)</value>
- </param>
- <param>
- <key>_rotation</key>
- <value>0</value>
- </param>
- </block>
- <block>
- <key>digital_fll_band_edge_cc</key>
- <param>
- <key>id</key>
- <value>digital_fll_band_edge_cc_0</value>
- </param>
- <param>
- <key>_enabled</key>
- <value>True</value>
- </param>
- <param>
- <key>type</key>
- <value>cc</value>
- </param>
- <param>
- <key>samps_per_sym</key>
- <value>spb</value>
- </param>
- <param>
- <key>rolloff</key>
- <value>rolloff</value>
- </param>
- <param>
- <key>filter_size</key>
- <value>44</value>
- </param>
- <param>
- <key>w</key>
- <value>freq_bw</value>
- </param>
- <param>
- <key>_coordinate</key>
- <value>(331, 239)</value>
- </param>
- <param>
- <key>_rotation</key>
- <value>0</value>
- </param>
- </block>
- <block>
<key>variable</key>
<param>
<key>id</key>
@@ -263,99 +169,6 @@
</param>
</block>
<block>
- <key>gr_channel_model</key>
- <param>
- <key>id</key>
- <value>gr_channel_model_0</value>
- </param>
- <param>
- <key>_enabled</key>
- <value>True</value>
- </param>
- <param>
- <key>noise_voltage</key>
- <value>noise_amp</value>
- </param>
- <param>
- <key>freq_offset</key>
- <value>freq_offset</value>
- </param>
- <param>
- <key>epsilon</key>
- <value>interpratio</value>
- </param>
- <param>
- <key>taps</key>
- <value>1.0</value>
- </param>
- <param>
- <key>seed</key>
- <value>42</value>
- </param>
- <param>
- <key>_coordinate</key>
- <value>(46, 183)</value>
- </param>
- <param>
- <key>_rotation</key>
- <value>0</value>
- </param>
- </block>
- <block>
- <key>gr_throttle</key>
- <param>
- <key>id</key>
- <value>gr_throttle_0</value>
- </param>
- <param>
- <key>_enabled</key>
- <value>True</value>
- </param>
- <param>
- <key>type</key>
- <value>complex</value>
- </param>
- <param>
- <key>samples_per_second</key>
- <value>samp_rate</value>
- </param>
- <param>
- <key>vlen</key>
- <value>1</value>
- </param>
- <param>
- <key>_coordinate</key>
- <value>(857, 95)</value>
- </param>
- <param>
- <key>_rotation</key>
- <value>0</value>
- </param>
- </block>
- <block>
- <key>virtual_source</key>
- <param>
- <key>id</key>
- <value>virtual_source_0</value>
- </param>
- <param>
- <key>_enabled</key>
- <value>True</value>
- </param>
- <param>
- <key>stream_id</key>
- <value>input_signal_probe</value>
- </param>
- <param>
- <key>_coordinate</key>
- <value>(835, 562)</value>
- </param>
- <param>
- <key>_rotation</key>
- <value>0</value>
- </param>
- </block>
- <block>
<key>wxgui_scopesink2</key>
<param>
<key>id</key>
@@ -522,165 +335,185 @@
</param>
</block>
<block>
- <key>wxgui_fftsink2</key>
+ <key>variable_slider</key>
<param>
<key>id</key>
- <value>wxgui_fftsink2_0_0</value>
+ <value>phase_bw</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>type</key>
- <value>complex</value>
+ <key>label</key>
+ <value>Costas Loop (Phase) Bandwidth</value>
</param>
<param>
- <key>title</key>
- <value>Post-sync spectrum</value>
+ <key>value</key>
+ <value>0</value>
</param>
<param>
- <key>samp_rate</key>
- <value>samp_rate</value>
+ <key>min</key>
+ <value>0</value>
</param>
<param>
- <key>baseband_freq</key>
- <value>0</value>
+ <key>max</key>
+ <value>0.1</value>
</param>
<param>
- <key>y_per_div</key>
- <value>10</value>
+ <key>num_steps</key>
+ <value>1000</value>
</param>
<param>
- <key>y_divs</key>
- <value>10</value>
+ <key>style</key>
+ <value>wx.SL_HORIZONTAL</value>
</param>
<param>
- <key>ref_level</key>
- <value>10</value>
+ <key>converver</key>
+ <value>float_converter</value>
</param>
<param>
- <key>ref_scale</key>
- <value>2.0</value>
+ <key>grid_pos</key>
+ <value>(7,2,1,1)</value>
</param>
<param>
- <key>fft_size</key>
- <value>1024</value>
+ <key>notebook</key>
+ <value></value>
</param>
<param>
- <key>fft_rate</key>
- <value>30</value>
+ <key>_coordinate</key>
+ <value>(866, 313)</value>
</param>
<param>
- <key>peak_hold</key>
- <value>False</value>
+ <key>_rotation</key>
+ <value>0</value>
</param>
+ </block>
+ <block>
+ <key>digital_chunks_to_symbols_xx</key>
<param>
- <key>average</key>
- <value>False</value>
+ <key>id</key>
+ <value>digital_chunks_to_symbols_xx</value>
</param>
<param>
- <key>avg_alpha</key>
- <value>0</value>
+ <key>_enabled</key>
+ <value>True</value>
</param>
<param>
- <key>win</key>
- <value>None</value>
+ <key>in_type</key>
+ <value>byte</value>
</param>
<param>
- <key>win_size</key>
- <value></value>
+ <key>out_type</key>
+ <value>complex</value>
</param>
<param>
- <key>grid_pos</key>
- <value></value>
+ <key>symbol_table</key>
+ <value>const.points()</value>
</param>
<param>
- <key>notebook</key>
- <value>notebook_0,0</value>
+ <key>dimension</key>
+ <value>1</value>
</param>
<param>
- <key>freqvar</key>
- <value>None</value>
+ <key>num_ports</key>
+ <value>1</value>
</param>
<param>
<key>_coordinate</key>
- <value>(347, 516)</value>
+ <value>(178, 87)</value>
</param>
<param>
<key>_rotation</key>
- <value>180</value>
+ <value>0</value>
</param>
</block>
<block>
- <key>wxgui_scopesink2</key>
+ <key>variable</key>
<param>
<key>id</key>
- <value>wxgui_scopesink2_0</value>
+ <value>spb</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>type</key>
- <value>complex</value>
+ <key>value</key>
+ <value>4.0</value>
</param>
<param>
- <key>title</key>
- <value>Post-sync Signal</value>
+ <key>_coordinate</key>
+ <value>(513, -1)</value>
</param>
<param>
- <key>samp_rate</key>
- <value>samp_rate</value>
+ <key>_rotation</key>
+ <value>0</value>
</param>
+ </block>
+ <block>
+ <key>variable</key>
<param>
- <key>v_scale</key>
- <value>0</value>
+ <key>id</key>
+ <value>rolloff</value>
</param>
<param>
- <key>v_offset</key>
- <value>0</value>
+ <key>_enabled</key>
+ <value>True</value>
</param>
<param>
- <key>t_scale</key>
+ <key>value</key>
+ <value>0.35</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(578, -1)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
<value>0</value>
</param>
+ </block>
+ <block>
+ <key>variable</key>
<param>
- <key>ac_couple</key>
- <value>False</value>
+ <key>id</key>
+ <value>rrctaps</value>
</param>
<param>
- <key>xy_mode</key>
+ <key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>num_inputs</key>
- <value>1</value>
+ <key>value</key>
+ <value>firdes.root_raised_cosine(nfilts,1.0,1.0/(nfilts*spb), rolloff, int(11*spb*nfilts))</value>
</param>
<param>
- <key>win_size</key>
- <value></value>
+ <key>_coordinate</key>
+ <value>(660, 0)</value>
</param>
<param>
- <key>grid_pos</key>
- <value></value>
+ <key>_rotation</key>
+ <value>0</value>
</param>
+ </block>
+ <block>
+ <key>variable</key>
<param>
- <key>notebook</key>
- <value>notebook_0,0</value>
+ <key>id</key>
+ <value>sig_amp</value>
</param>
<param>
- <key>trig_mode</key>
- <value>gr.gr_TRIG_MODE_AUTO</value>
+ <key>_enabled</key>
+ <value>True</value>
</param>
<param>
- <key>y_axis_label</key>
- <value>Counts</value>
+ <key>value</key>
+ <value>1.0</value>
</param>
<param>
<key>_coordinate</key>
- <value>(1085, 213)</value>
+ <value>(887, -1)</value>
</param>
<param>
<key>_rotation</key>
@@ -688,109 +521,112 @@
</param>
</block>
<block>
- <key>variable_slider</key>
+ <key>variable</key>
<param>
<key>id</key>
- <value>freq_bw</value>
+ <value>nfilts</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>label</key>
- <value>FLL Bandwidth</value>
+ <key>value</key>
+ <value>32</value>
</param>
<param>
- <key>value</key>
- <value>0</value>
+ <key>_coordinate</key>
+ <value>(816, 0)</value>
</param>
<param>
- <key>min</key>
- <value>0.0</value>
+ <key>_rotation</key>
+ <value>0</value>
</param>
+ </block>
+ <block>
+ <key>digital_pfb_clock_sync_xxx</key>
<param>
- <key>max</key>
- <value>0.05</value>
+ <key>id</key>
+ <value>digital_pfb_clock_sync_xxx_0</value>
</param>
<param>
- <key>num_steps</key>
- <value>1000</value>
+ <key>_enabled</key>
+ <value>True</value>
</param>
<param>
- <key>style</key>
- <value>wx.SL_HORIZONTAL</value>
+ <key>type</key>
+ <value>ccf</value>
</param>
<param>
- <key>converver</key>
- <value>float_converter</value>
+ <key>sps</key>
+ <value>spb</value>
</param>
<param>
- <key>grid_pos</key>
- <value>(4,2,1,1)</value>
+ <key>loop_bw</key>
+ <value>time_bw</value>
</param>
<param>
- <key>notebook</key>
- <value></value>
+ <key>taps</key>
+ <value>rrctaps</value>
</param>
<param>
- <key>_coordinate</key>
- <value>(341, 373)</value>
+ <key>filter_size</key>
+ <value>nfilts</value>
</param>
<param>
- <key>_rotation</key>
- <value>180</value>
+ <key>init_phase</key>
+ <value>16</value>
</param>
- </block>
- <block>
- <key>variable_slider</key>
<param>
- <key>id</key>
- <value>time_alpha</value>
+ <key>max_dev</key>
+ <value>1.5</value>
</param>
<param>
- <key>_enabled</key>
- <value>True</value>
+ <key>osps</key>
+ <value>1</value>
</param>
<param>
- <key>label</key>
- <value>Timing Alpha</value>
+ <key>_coordinate</key>
+ <value>(598, 241)</value>
</param>
<param>
- <key>value</key>
+ <key>_rotation</key>
<value>0</value>
</param>
+ </block>
+ <block>
+ <key>pfb_arb_resampler_xxx</key>
<param>
- <key>min</key>
- <value>0</value>
+ <key>id</key>
+ <value>pfb_arb_resampler_xxx_0</value>
</param>
<param>
- <key>max</key>
- <value>1</value>
+ <key>_enabled</key>
+ <value>True</value>
</param>
<param>
- <key>num_steps</key>
- <value>1000</value>
+ <key>type</key>
+ <value>ccf</value>
</param>
<param>
- <key>style</key>
- <value>wx.SL_HORIZONTAL</value>
+ <key>rrate</key>
+ <value>spb</value>
</param>
<param>
- <key>converver</key>
- <value>float_converter</value>
+ <key>taps</key>
+ <value>firdes.root_raised_cosine(nfilts, 1.0, 1.0/nfilts, rolloff, int(11*spb*nfilts))</value>
</param>
<param>
- <key>grid_pos</key>
- <value>(5,2,1,1)</value>
+ <key>nfilts</key>
+ <value>32</value>
</param>
<param>
- <key>notebook</key>
- <value></value>
+ <key>atten</key>
+ <value>100</value>
</param>
<param>
<key>_coordinate</key>
- <value>(598, 388)</value>
+ <value>(503, 63)</value>
</param>
<param>
<key>_rotation</key>
@@ -801,7 +637,7 @@
<key>variable_slider</key>
<param>
<key>id</key>
- <value>time_beta</value>
+ <value>freq_offset</value>
</param>
<param>
<key>_enabled</key>
@@ -809,7 +645,7 @@
</param>
<param>
<key>label</key>
- <value>Timing Beta</value>
+ <value>Frequency Offset</value>
</param>
<param>
<key>value</key>
@@ -817,11 +653,11 @@
</param>
<param>
<key>min</key>
- <value>0.0</value>
+ <value>-0.5</value>
</param>
<param>
<key>max</key>
- <value>0.1</value>
+ <value>0.5</value>
</param>
<param>
<key>num_steps</key>
@@ -837,7 +673,7 @@
</param>
<param>
<key>grid_pos</key>
- <value>(6,2,1,1)</value>
+ <value>(2,2,1,1)</value>
</param>
<param>
<key>notebook</key>
@@ -845,18 +681,18 @@
</param>
<param>
<key>_coordinate</key>
- <value>(708, 388)</value>
+ <value>(8, 314)</value>
</param>
<param>
<key>_rotation</key>
- <value>180</value>
+ <value>0</value>
</param>
</block>
<block>
<key>variable_slider</key>
<param>
<key>id</key>
- <value>phase_bw</value>
+ <value>noise_amp</value>
</param>
<param>
<key>_enabled</key>
@@ -864,7 +700,7 @@
</param>
<param>
<key>label</key>
- <value>Costas Loop (Phase) Bandwidth</value>
+ <value>Channel Noise</value>
</param>
<param>
<key>value</key>
@@ -876,7 +712,7 @@
</param>
<param>
<key>max</key>
- <value>0.1</value>
+ <value>1.0</value>
</param>
<param>
<key>num_steps</key>
@@ -892,7 +728,7 @@
</param>
<param>
<key>grid_pos</key>
- <value>(7,2,1,1)</value>
+ <value>(1,2,1,1)</value>
</param>
<param>
<key>notebook</key>
@@ -900,7 +736,7 @@
</param>
<param>
<key>_coordinate</key>
- <value>(866, 313)</value>
+ <value>(136, 314)</value>
</param>
<param>
<key>_rotation</key>
@@ -908,34 +744,77 @@
</param>
</block>
<block>
- <key>notebook</key>
+ <key>channels_channel_model</key>
<param>
<key>id</key>
- <value>notebook_0</value>
+ <value>channels_channel_model_0</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>style</key>
- <value>wx.NB_TOP</value>
+ <key>noise_voltage</key>
+ <value>noise_amp</value>
</param>
<param>
- <key>labels</key>
- <value>['Synched Signal', 'Received Signal']</value>
+ <key>freq_offset</key>
+ <value>freq_offset</value>
</param>
<param>
- <key>grid_pos</key>
- <value>(1,1,8,1)</value>
+ <key>epsilon</key>
+ <value>interpratio</value>
</param>
<param>
- <key>notebook</key>
- <value></value>
+ <key>taps</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>seed</key>
+ <value>42</value>
</param>
<param>
<key>_coordinate</key>
- <value>(9, 601)</value>
+ <value>(59, 184)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>digital_fll_band_edge_cc</key>
+ <param>
+ <key>id</key>
+ <value>digital_fll_band_edge_cc_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>cc</value>
+ </param>
+ <param>
+ <key>samps_per_sym</key>
+ <value>spb</value>
+ </param>
+ <param>
+ <key>rolloff</key>
+ <value>rolloff</value>
+ </param>
+ <param>
+ <key>filter_size</key>
+ <value>44</value>
+ </param>
+ <param>
+ <key>w</key>
+ <value>freq_bw</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(331, 238)</value>
</param>
<param>
<key>_rotation</key>
@@ -946,7 +825,7 @@
<key>variable_slider</key>
<param>
<key>id</key>
- <value>interpratio</value>
+ <value>freq_bw</value>
</param>
<param>
<key>_enabled</key>
@@ -954,19 +833,19 @@
</param>
<param>
<key>label</key>
- <value>Timing Offset</value>
+ <value>FLL Bandwidth</value>
</param>
<param>
<key>value</key>
- <value>1.00</value>
+ <value>0</value>
</param>
<param>
<key>min</key>
- <value>0.99</value>
+ <value>0.0</value>
</param>
<param>
<key>max</key>
- <value>1.01</value>
+ <value>0.05</value>
</param>
<param>
<key>num_steps</key>
@@ -982,7 +861,7 @@
</param>
<param>
<key>grid_pos</key>
- <value>(3,2,1,1)</value>
+ <value>(4,2,1,1)</value>
</param>
<param>
<key>notebook</key>
@@ -990,7 +869,7 @@
</param>
<param>
<key>_coordinate</key>
- <value>(60, 407)</value>
+ <value>(335, 379)</value>
</param>
<param>
<key>_rotation</key>
@@ -998,10 +877,10 @@
</param>
</block>
<block>
- <key>gr_multiply_const_vxx</key>
+ <key>wxgui_fftsink2</key>
<param>
<key>id</key>
- <value>gr_multiply_const_vxx_0</value>
+ <value>wxgui_fftsink2_0_0</value>
</param>
<param>
<key>_enabled</key>
@@ -1012,78 +891,103 @@
<value>complex</value>
</param>
<param>
- <key>const</key>
- <value>sig_amp</value>
+ <key>title</key>
+ <value>Post-sync spectrum</value>
</param>
<param>
- <key>vlen</key>
- <value>1</value>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
</param>
<param>
- <key>_coordinate</key>
- <value>(659, 95)</value>
+ <key>baseband_freq</key>
+ <value>0</value>
</param>
<param>
- <key>_rotation</key>
- <value>0</value>
+ <key>y_per_div</key>
+ <value>10</value>
</param>
- </block>
- <block>
- <key>gr_chunks_to_symbols_xx</key>
<param>
- <key>id</key>
- <value>gr_chunks_to_symbols_xx</value>
+ <key>y_divs</key>
+ <value>10</value>
</param>
<param>
- <key>_enabled</key>
- <value>True</value>
+ <key>ref_level</key>
+ <value>10</value>
</param>
<param>
- <key>in_type</key>
- <value>byte</value>
+ <key>ref_scale</key>
+ <value>2.0</value>
</param>
<param>
- <key>out_type</key>
- <value>complex</value>
+ <key>fft_size</key>
+ <value>1024</value>
</param>
<param>
- <key>symbol_table</key>
- <value>const.points()</value>
+ <key>fft_rate</key>
+ <value>30</value>
</param>
<param>
- <key>dimension</key>
- <value>1</value>
+ <key>peak_hold</key>
+ <value>False</value>
</param>
<param>
- <key>num_ports</key>
- <value>1</value>
+ <key>average</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>avg_alpha</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>win</key>
+ <value>None</value>
+ </param>
+ <param>
+ <key>win_size</key>
+ <value></value>
+ </param>
+ <param>
+ <key>grid_pos</key>
+ <value></value>
+ </param>
+ <param>
+ <key>notebook</key>
+ <value>notebook_0,0</value>
+ </param>
+ <param>
+ <key>freqvar</key>
+ <value>None</value>
</param>
<param>
<key>_coordinate</key>
- <value>(178, 87)</value>
+ <value>(337, 523)</value>
</param>
<param>
<key>_rotation</key>
- <value>0</value>
+ <value>180</value>
</param>
</block>
<block>
- <key>variable</key>
+ <key>digital_costas_loop_cc</key>
<param>
<key>id</key>
- <value>spb</value>
+ <value>digital_costas_loop_cc_0</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>value</key>
- <value>4.0</value>
+ <key>w</key>
+ <value>phase_bw</value>
+ </param>
+ <param>
+ <key>order</key>
+ <value>const.arity()</value>
</param>
<param>
<key>_coordinate</key>
- <value>(513, -1)</value>
+ <value>(871, 225)</value>
</param>
<param>
<key>_rotation</key>
@@ -1091,45 +995,74 @@
</param>
</block>
<block>
- <key>variable</key>
+ <key>wxgui_scopesink2</key>
<param>
<key>id</key>
- <value>rolloff</value>
+ <value>wxgui_scopesink2_0</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>value</key>
- <value>0.35</value>
+ <key>type</key>
+ <value>complex</value>
</param>
<param>
- <key>_coordinate</key>
- <value>(578, -1)</value>
+ <key>title</key>
+ <value>Post-sync Signal</value>
</param>
<param>
- <key>_rotation</key>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>v_scale</key>
<value>0</value>
</param>
- </block>
- <block>
- <key>variable</key>
<param>
- <key>id</key>
- <value>rrctaps</value>
+ <key>v_offset</key>
+ <value>0</value>
</param>
<param>
- <key>_enabled</key>
+ <key>t_scale</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>ac_couple</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>xy_mode</key>
<value>True</value>
</param>
<param>
- <key>value</key>
- <value>firdes.root_raised_cosine(nfilts,1.0,1.0/(nfilts*spb), rolloff, int(11*spb*nfilts))</value>
+ <key>num_inputs</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>win_size</key>
+ <value></value>
+ </param>
+ <param>
+ <key>grid_pos</key>
+ <value></value>
+ </param>
+ <param>
+ <key>notebook</key>
+ <value>notebook_0,0</value>
+ </param>
+ <param>
+ <key>trig_mode</key>
+ <value>gr.gr_TRIG_MODE_AUTO</value>
+ </param>
+ <param>
+ <key>y_axis_label</key>
+ <value>Counts</value>
</param>
<param>
<key>_coordinate</key>
- <value>(660, 0)</value>
+ <value>(1103, 196)</value>
</param>
<param>
<key>_rotation</key>
@@ -1137,22 +1070,22 @@
</param>
</block>
<block>
- <key>variable</key>
+ <key>virtual_source</key>
<param>
<key>id</key>
- <value>sig_amp</value>
+ <value>virtual_source_0</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>value</key>
- <value>1.0</value>
+ <key>stream_id</key>
+ <value>input_signal_probe</value>
</param>
<param>
<key>_coordinate</key>
- <value>(887, -1)</value>
+ <value>(828, 562)</value>
</param>
<param>
<key>_rotation</key>
@@ -1160,22 +1093,30 @@
</param>
</block>
<block>
- <key>variable</key>
+ <key>blocks_multiply_const_vxx</key>
<param>
<key>id</key>
- <value>nfilts</value>
+ <value>blocks_multiply_const_vxx_0</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>value</key>
- <value>32</value>
+ <key>type</key>
+ <value>complex</value>
+ </param>
+ <param>
+ <key>const</key>
+ <value>sig_amp</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>1</value>
</param>
<param>
<key>_coordinate</key>
- <value>(816, 0)</value>
+ <value>(807, 95)</value>
</param>
<param>
<key>_rotation</key>
@@ -1183,30 +1124,30 @@
</param>
</block>
<block>
- <key>blks2_pfb_arb_resampler_ccf</key>
+ <key>blocks_throttle</key>
<param>
<key>id</key>
- <value>blks2_pfb_arb_resampler_ccf_0</value>
+ <value>blocks_throttle_0</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>rate</key>
- <value>spb</value>
+ <key>type</key>
+ <value>complex</value>
</param>
<param>
- <key>taps</key>
- <value>firdes.root_raised_cosine(nfilts, 1.0, 1.0/nfilts, rolloff, int(11*spb*nfilts))</value>
+ <key>samples_per_second</key>
+ <value>samp_rate</value>
</param>
<param>
- <key>size</key>
- <value>nfilts</value>
+ <key>vlen</key>
+ <value>1</value>
</param>
<param>
<key>_coordinate</key>
- <value>(411, 80)</value>
+ <value>(987, 95)</value>
</param>
<param>
<key>_rotation</key>
@@ -1217,7 +1158,7 @@
<key>variable_slider</key>
<param>
<key>id</key>
- <value>freq_offset</value>
+ <value>time_bw</value>
</param>
<param>
<key>_enabled</key>
@@ -1225,7 +1166,7 @@
</param>
<param>
<key>label</key>
- <value>Frequency Offset</value>
+ <value>Timing Loop BW</value>
</param>
<param>
<key>value</key>
@@ -1233,11 +1174,11 @@
</param>
<param>
<key>min</key>
- <value>-0.5</value>
+ <value>0</value>
</param>
<param>
<key>max</key>
- <value>0.5</value>
+ <value>0.1</value>
</param>
<param>
<key>num_steps</key>
@@ -1253,7 +1194,7 @@
</param>
<param>
<key>grid_pos</key>
- <value>(2,2,1,1)</value>
+ <value>(5,2,1,1)</value>
</param>
<param>
<key>notebook</key>
@@ -1261,7 +1202,7 @@
</param>
<param>
<key>_coordinate</key>
- <value>(-1, 285)</value>
+ <value>(598, 388)</value>
</param>
<param>
<key>_rotation</key>
@@ -1272,7 +1213,7 @@
<key>variable_slider</key>
<param>
<key>id</key>
- <value>noise_amp</value>
+ <value>interpratio</value>
</param>
<param>
<key>_enabled</key>
@@ -1280,19 +1221,19 @@
</param>
<param>
<key>label</key>
- <value>Channel Noise</value>
+ <value>Timing Offset</value>
</param>
<param>
<key>value</key>
- <value>0</value>
+ <value>1.00</value>
</param>
<param>
<key>min</key>
- <value>0</value>
+ <value>0.99</value>
</param>
<param>
<key>max</key>
- <value>1.0</value>
+ <value>1.01</value>
</param>
<param>
<key>num_steps</key>
@@ -1308,7 +1249,7 @@
</param>
<param>
<key>grid_pos</key>
- <value>(1,2,1,1)</value>
+ <value>(3,2,1,1)</value>
</param>
<param>
<key>notebook</key>
@@ -1316,34 +1257,42 @@
</param>
<param>
<key>_coordinate</key>
- <value>(129, 285)</value>
+ <value>(42, 459)</value>
</param>
<param>
<key>_rotation</key>
- <value>0</value>
+ <value>180</value>
</param>
</block>
<block>
- <key>digital_costas_loop_cc</key>
+ <key>notebook</key>
<param>
<key>id</key>
- <value>digital_costas_loop_cc_0</value>
+ <value>notebook_0</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>w</key>
- <value>phase_bw</value>
+ <key>style</key>
+ <value>wx.NB_TOP</value>
</param>
<param>
- <key>order</key>
- <value>const.arity()</value>
+ <key>labels</key>
+ <value>['Synched Signal', 'Received Signal']</value>
+ </param>
+ <param>
+ <key>grid_pos</key>
+ <value>(1,1,8,1)</value>
+ </param>
+ <param>
+ <key>notebook</key>
+ <value></value>
</param>
<param>
<key>_coordinate</key>
- <value>(866, 246)</value>
+ <value>(9, 601)</value>
</param>
<param>
<key>_rotation</key>
@@ -1351,19 +1300,19 @@
</param>
</block>
<connection>
- <source_block_id>gr_channel_model_0</source_block_id>
+ <source_block_id>channels_channel_model_0</source_block_id>
<sink_block_id>virtual_sink_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>digital_fll_band_edge_cc_0</source_block_id>
- <sink_block_id>gr_pfb_clock_sync_xxx_0</sink_block_id>
+ <sink_block_id>digital_pfb_clock_sync_xxx_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_pfb_clock_sync_xxx_0</source_block_id>
+ <source_block_id>digital_pfb_clock_sync_xxx_0</source_block_id>
<sink_block_id>digital_costas_loop_cc_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
@@ -1375,13 +1324,13 @@
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>blks2_pfb_arb_resampler_ccf_0</source_block_id>
- <sink_block_id>gr_multiply_const_vxx_0</sink_block_id>
+ <source_block_id>pfb_arb_resampler_xxx_0</source_block_id>
+ <sink_block_id>blocks_multiply_const_vxx_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_channel_model_0</source_block_id>
+ <source_block_id>channels_channel_model_0</source_block_id>
<sink_block_id>digital_fll_band_edge_cc_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
@@ -1406,25 +1355,25 @@
</connection>
<connection>
<source_block_id>random_source_x</source_block_id>
- <sink_block_id>gr_chunks_to_symbols_xx</sink_block_id>
+ <sink_block_id>digital_chunks_to_symbols_xx</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_throttle_0</source_block_id>
- <sink_block_id>gr_channel_model_0</sink_block_id>
+ <source_block_id>blocks_throttle_0</source_block_id>
+ <sink_block_id>channels_channel_model_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_multiply_const_vxx_0</source_block_id>
- <sink_block_id>gr_throttle_0</sink_block_id>
+ <source_block_id>blocks_multiply_const_vxx_0</source_block_id>
+ <sink_block_id>blocks_throttle_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_chunks_to_symbols_xx</source_block_id>
- <sink_block_id>blks2_pfb_arb_resampler_ccf_0</sink_block_id>
+ <source_block_id>digital_chunks_to_symbols_xx</source_block_id>
+ <sink_block_id>pfb_arb_resampler_xxx_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
diff --git a/gr-digital/examples/demod/pam_timing.grc b/gr-digital/examples/demod/pam_timing.grc
index af14191ebc..632477821a 100644
--- a/gr-digital/examples/demod/pam_timing.grc
+++ b/gr-digital/examples/demod/pam_timing.grc
@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='ASCII'?>
<flow_graph>
- <timestamp>Mon Jan 14 11:00:42 2013</timestamp>
+ <timestamp>Tue Jan 15 15:21:46 2013</timestamp>
<block>
<key>options</key>
<param>
@@ -61,116 +61,6 @@
</param>
</block>
<block>
- <key>variable_slider</key>
- <param>
- <key>id</key>
- <value>beta</value>
- </param>
- <param>
- <key>_enabled</key>
- <value>True</value>
- </param>
- <param>
- <key>label</key>
- <value>Timing Beta</value>
- </param>
- <param>
- <key>value</key>
- <value>0</value>
- </param>
- <param>
- <key>min</key>
- <value>0.0</value>
- </param>
- <param>
- <key>max</key>
- <value>0.1</value>
- </param>
- <param>
- <key>num_steps</key>
- <value>1000</value>
- </param>
- <param>
- <key>style</key>
- <value>wx.SL_HORIZONTAL</value>
- </param>
- <param>
- <key>converver</key>
- <value>float_converter</value>
- </param>
- <param>
- <key>grid_pos</key>
- <value></value>
- </param>
- <param>
- <key>notebook</key>
- <value></value>
- </param>
- <param>
- <key>_coordinate</key>
- <value>(668, 5)</value>
- </param>
- <param>
- <key>_rotation</key>
- <value>180</value>
- </param>
- </block>
- <block>
- <key>variable_slider</key>
- <param>
- <key>id</key>
- <value>alpha</value>
- </param>
- <param>
- <key>_enabled</key>
- <value>True</value>
- </param>
- <param>
- <key>label</key>
- <value>Timing Alpha</value>
- </param>
- <param>
- <key>value</key>
- <value>0</value>
- </param>
- <param>
- <key>min</key>
- <value>0</value>
- </param>
- <param>
- <key>max</key>
- <value>1</value>
- </param>
- <param>
- <key>num_steps</key>
- <value>1000</value>
- </param>
- <param>
- <key>style</key>
- <value>wx.SL_HORIZONTAL</value>
- </param>
- <param>
- <key>converver</key>
- <value>float_converter</value>
- </param>
- <param>
- <key>grid_pos</key>
- <value></value>
- </param>
- <param>
- <key>notebook</key>
- <value></value>
- </param>
- <param>
- <key>_coordinate</key>
- <value>(552, 4)</value>
- </param>
- <param>
- <key>_rotation</key>
- <value>0</value>
- </param>
- </block>
- <block>
<key>random_source_x</key>
<param>
<key>id</key>
@@ -210,10 +100,10 @@
</param>
</block>
<block>
- <key>gr_chunks_to_symbols_xx</key>
+ <key>digital_chunks_to_symbols_xx</key>
<param>
<key>id</key>
- <value>gr_chunks_to_symbols_xx</value>
+ <value>digital_chunks_to_symbols_xx</value>
</param>
<param>
<key>_enabled</key>
@@ -249,30 +139,22 @@
</param>
</block>
<block>
- <key>gr_multiply_const_vxx</key>
+ <key>variable</key>
<param>
<key>id</key>
- <value>gr_multiply_const_vxx_0</value>
+ <value>const</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>type</key>
- <value>complex</value>
- </param>
- <param>
- <key>const</key>
- <value>sig_amp</value>
- </param>
- <param>
- <key>vlen</key>
- <value>1</value>
+ <key>value</key>
+ <value>digital.qpsk_constellation()</value>
</param>
<param>
<key>_coordinate</key>
- <value>(651, 186)</value>
+ <value>(206, 116)</value>
</param>
<param>
<key>_rotation</key>
@@ -280,38 +162,22 @@
</param>
</block>
<block>
- <key>gr_channel_model</key>
+ <key>import</key>
<param>
<key>id</key>
- <value>gr_channel_model_0</value>
+ <value>import_0</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>noise_voltage</key>
- <value>noise_amp</value>
- </param>
- <param>
- <key>freq_offset</key>
- <value>freq_offset</value>
- </param>
- <param>
- <key>epsilon</key>
- <value>interpratio</value>
- </param>
- <param>
- <key>taps</key>
- <value>1.0</value>
- </param>
- <param>
- <key>seed</key>
- <value>42</value>
+ <key>import</key>
+ <value>from gnuradio import digital</value>
</param>
<param>
<key>_coordinate</key>
- <value>(73, 354)</value>
+ <value>(-1, 61)</value>
</param>
<param>
<key>_rotation</key>
@@ -319,30 +185,22 @@
</param>
</block>
<block>
- <key>gr_throttle</key>
+ <key>variable</key>
<param>
<key>id</key>
- <value>gr_throttle_0</value>
+ <value>spb</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>type</key>
- <value>complex</value>
- </param>
- <param>
- <key>samples_per_second</key>
- <value>samp_rate</value>
- </param>
- <param>
- <key>vlen</key>
- <value>1</value>
+ <key>value</key>
+ <value>4.2563</value>
</param>
<param>
<key>_coordinate</key>
- <value>(274, 384)</value>
+ <value>(300, 0)</value>
</param>
<param>
<key>_rotation</key>
@@ -365,7 +223,7 @@
</param>
<param>
<key>_coordinate</key>
- <value>(662, 128)</value>
+ <value>(791, 46)</value>
</param>
<param>
<key>_rotation</key>
@@ -373,109 +231,30 @@
</param>
</block>
<block>
- <key>variable_slider</key>
+ <key>blocks_throttle</key>
<param>
<key>id</key>
- <value>interpratio</value>
+ <value>blocks_throttle_0</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>label</key>
- <value>Timing Offset</value>
- </param>
- <param>
- <key>value</key>
- <value>1.00</value>
- </param>
- <param>
- <key>min</key>
- <value>0.99</value>
- </param>
- <param>
- <key>max</key>
- <value>1.01</value>
- </param>
- <param>
- <key>num_steps</key>
- <value>1000</value>
- </param>
- <param>
- <key>style</key>
- <value>wx.SL_HORIZONTAL</value>
- </param>
- <param>
- <key>converver</key>
- <value>float_converter</value>
- </param>
- <param>
- <key>grid_pos</key>
- <value></value>
- </param>
- <param>
- <key>notebook</key>
- <value></value>
- </param>
- <param>
- <key>_coordinate</key>
- <value>(-1, 465)</value>
- </param>
- <param>
- <key>_rotation</key>
- <value>180</value>
- </param>
- </block>
- <block>
- <key>variable_slider</key>
- <param>
- <key>id</key>
- <value>noise_amp</value>
- </param>
- <param>
- <key>_enabled</key>
- <value>True</value>
- </param>
- <param>
- <key>label</key>
- <value>Channel Noise</value>
- </param>
- <param>
- <key>value</key>
- <value>0</value>
- </param>
- <param>
- <key>min</key>
- <value>0</value>
- </param>
- <param>
- <key>max</key>
- <value>1.0</value>
- </param>
- <param>
- <key>num_steps</key>
- <value>1000</value>
- </param>
- <param>
- <key>style</key>
- <value>wx.SL_HORIZONTAL</value>
- </param>
- <param>
- <key>converver</key>
- <value>float_converter</value>
+ <key>type</key>
+ <value>complex</value>
</param>
<param>
- <key>grid_pos</key>
- <value></value>
+ <key>samples_per_second</key>
+ <value>samp_rate</value>
</param>
<param>
- <key>notebook</key>
- <value></value>
+ <key>vlen</key>
+ <value>1</value>
</param>
<param>
<key>_coordinate</key>
- <value>(114, 465)</value>
+ <value>(258, 431)</value>
</param>
<param>
<key>_rotation</key>
@@ -483,54 +262,38 @@
</param>
</block>
<block>
- <key>variable_slider</key>
+ <key>channels_channel_model</key>
<param>
<key>id</key>
- <value>freq_offset</value>
+ <value>channels_channel_model_0</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>label</key>
- <value>Frequency Offset</value>
- </param>
- <param>
- <key>value</key>
- <value>0</value>
- </param>
- <param>
- <key>min</key>
- <value>-0.5</value>
- </param>
- <param>
- <key>max</key>
- <value>0.5</value>
- </param>
- <param>
- <key>num_steps</key>
- <value>1000</value>
+ <key>noise_voltage</key>
+ <value>noise_amp</value>
</param>
<param>
- <key>style</key>
- <value>wx.SL_HORIZONTAL</value>
+ <key>freq_offset</key>
+ <value>freq_offset</value>
</param>
<param>
- <key>converver</key>
- <value>float_converter</value>
+ <key>epsilon</key>
+ <value>interpratio</value>
</param>
<param>
- <key>grid_pos</key>
- <value></value>
+ <key>taps</key>
+ <value>1.0</value>
</param>
<param>
- <key>notebook</key>
- <value></value>
+ <key>seed</key>
+ <value>42</value>
</param>
<param>
<key>_coordinate</key>
- <value>(236, 465)</value>
+ <value>(57, 401)</value>
</param>
<param>
<key>_rotation</key>
@@ -553,53 +316,7 @@
</param>
<param>
<key>_coordinate</key>
- <value>(282, 324)</value>
- </param>
- <param>
- <key>_rotation</key>
- <value>0</value>
- </param>
- </block>
- <block>
- <key>variable</key>
- <param>
- <key>id</key>
- <value>const</value>
- </param>
- <param>
- <key>_enabled</key>
- <value>True</value>
- </param>
- <param>
- <key>value</key>
- <value>digital.qpsk_constellation()</value>
- </param>
- <param>
- <key>_coordinate</key>
- <value>(206, 116)</value>
- </param>
- <param>
- <key>_rotation</key>
- <value>0</value>
- </param>
- </block>
- <block>
- <key>import</key>
- <param>
- <key>id</key>
- <value>import_0</value>
- </param>
- <param>
- <key>_enabled</key>
- <value>True</value>
- </param>
- <param>
- <key>import</key>
- <value>from gnuradio import digital</value>
- </param>
- <param>
- <key>_coordinate</key>
- <value>(-1, 61)</value>
+ <value>(267, 357)</value>
</param>
<param>
<key>_rotation</key>
@@ -622,7 +339,7 @@
</param>
<param>
<key>_coordinate</key>
- <value>(459, 262)</value>
+ <value>(482, 335)</value>
</param>
<param>
<key>_rotation</key>
@@ -645,7 +362,7 @@
</param>
<param>
<key>_coordinate</key>
- <value>(539, 262)</value>
+ <value>(562, 335)</value>
</param>
<param>
<key>_rotation</key>
@@ -653,10 +370,10 @@
</param>
</block>
<block>
- <key>gr_pfb_clock_sync_xxx</key>
+ <key>digital_pfb_clock_sync_xxx</key>
<param>
<key>id</key>
- <value>gr_pfb_clock_sync_xxx_0</value>
+ <value>digital_pfb_clock_sync_xxx_0</value>
</param>
<param>
<key>_enabled</key>
@@ -671,12 +388,8 @@
<value>spb</value>
</param>
<param>
- <key>alpha</key>
- <value>alpha</value>
- </param>
- <param>
- <key>beta</key>
- <value>beta</value>
+ <key>loop_bw</key>
+ <value>time_bw</value>
</param>
<param>
<key>taps</key>
@@ -700,7 +413,7 @@
</param>
<param>
<key>_coordinate</key>
- <value>(444, 331)</value>
+ <value>(467, 403)</value>
</param>
<param>
<key>_rotation</key>
@@ -708,17 +421,21 @@
</param>
</block>
<block>
- <key>blks2_pfb_arb_resampler_ccf</key>
+ <key>pfb_arb_resampler_xxx</key>
<param>
<key>id</key>
- <value>blks2_pfb_arb_resampler_ccf_0</value>
+ <value>pfb_arb_resampler_xxx_0</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>rate</key>
+ <key>type</key>
+ <value>ccf</value>
+ </param>
+ <param>
+ <key>rrate</key>
<value>spb</value>
</param>
<param>
@@ -726,12 +443,16 @@
<value>firdes.root_raised_cosine(nfilts, nfilts, 1.0, rolloff, 44*nfilts)</value>
</param>
<param>
- <key>size</key>
- <value>nfilts</value>
+ <key>nfilts</key>
+ <value>32</value>
+ </param>
+ <param>
+ <key>atten</key>
+ <value>100</value>
</param>
<param>
<key>_coordinate</key>
- <value>(438, 171)</value>
+ <value>(458, 179)</value>
</param>
<param>
<key>_rotation</key>
@@ -806,7 +527,7 @@
</param>
<param>
<key>_coordinate</key>
- <value>(826, 112)</value>
+ <value>(961, 84)</value>
</param>
<param>
<key>_rotation</key>
@@ -817,7 +538,7 @@
<key>wxgui_scopesink2</key>
<param>
<key>id</key>
- <value>wxgui_scopesink2_0</value>
+ <value>wxgui_scopesink2_0_0_0</value>
</param>
<param>
<key>_enabled</key>
@@ -825,7 +546,7 @@
</param>
<param>
<key>type</key>
- <value>complex</value>
+ <value>float</value>
</param>
<param>
<key>title</key>
@@ -837,7 +558,7 @@
</param>
<param>
<key>v_scale</key>
- <value>0</value>
+ <value>9</value>
</param>
<param>
<key>v_offset</key>
@@ -869,7 +590,7 @@
</param>
<param>
<key>notebook</key>
- <value></value>
+ <value>notebook_0,1</value>
</param>
<param>
<key>trig_mode</key>
@@ -881,7 +602,7 @@
</param>
<param>
<key>_coordinate</key>
- <value>(829, 266)</value>
+ <value>(991, 592)</value>
</param>
<param>
<key>_rotation</key>
@@ -892,7 +613,7 @@
<key>wxgui_scopesink2</key>
<param>
<key>id</key>
- <value>wxgui_scopesink2_0_0_0_0</value>
+ <value>wxgui_scopesink2_0</value>
</param>
<param>
<key>_enabled</key>
@@ -900,7 +621,7 @@
</param>
<param>
<key>type</key>
- <value>float</value>
+ <value>complex</value>
</param>
<param>
<key>title</key>
@@ -912,7 +633,7 @@
</param>
<param>
<key>v_scale</key>
- <value>1.25</value>
+ <value>0</value>
</param>
<param>
<key>v_offset</key>
@@ -944,7 +665,7 @@
</param>
<param>
<key>notebook</key>
- <value>notebook_0,2</value>
+ <value></value>
</param>
<param>
<key>trig_mode</key>
@@ -956,7 +677,7 @@
</param>
<param>
<key>_coordinate</key>
- <value>(824, 485)</value>
+ <value>(1029, 243)</value>
</param>
<param>
<key>_rotation</key>
@@ -1031,7 +752,7 @@
</param>
<param>
<key>_coordinate</key>
- <value>(829, 358)</value>
+ <value>(1029, 335)</value>
</param>
<param>
<key>_rotation</key>
@@ -1042,7 +763,7 @@
<key>wxgui_scopesink2</key>
<param>
<key>id</key>
- <value>wxgui_scopesink2_0_0_0</value>
+ <value>wxgui_scopesink2_0_0_0_0</value>
</param>
<param>
<key>_enabled</key>
@@ -1062,7 +783,7 @@
</param>
<param>
<key>v_scale</key>
- <value>9</value>
+ <value>1.25</value>
</param>
<param>
<key>v_offset</key>
@@ -1094,7 +815,7 @@
</param>
<param>
<key>notebook</key>
- <value>notebook_0,1</value>
+ <value>notebook_0,2</value>
</param>
<param>
<key>trig_mode</key>
@@ -1106,7 +827,7 @@
</param>
<param>
<key>_coordinate</key>
- <value>(754, 607)</value>
+ <value>(1024, 462)</value>
</param>
<param>
<key>_rotation</key>
@@ -1114,34 +835,140 @@
</param>
</block>
<block>
- <key>notebook</key>
+ <key>blocks_multiply_const_vxx</key>
<param>
<key>id</key>
- <value>notebook_0</value>
+ <value>blocks_multiply_const_vxx_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>complex</value>
+ </param>
+ <param>
+ <key>const</key>
+ <value>sig_amp</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(760, 159)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable_slider</key>
+ <param>
+ <key>id</key>
+ <value>interpratio</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
+ <key>label</key>
+ <value>Timing Offset</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>1.00</value>
+ </param>
+ <param>
+ <key>min</key>
+ <value>0.99</value>
+ </param>
+ <param>
+ <key>max</key>
+ <value>1.01</value>
+ </param>
+ <param>
+ <key>num_steps</key>
+ <value>1000</value>
+ </param>
+ <param>
<key>style</key>
- <value>wx.NB_TOP</value>
+ <value>wx.SL_HORIZONTAL</value>
</param>
<param>
- <key>labels</key>
- <value>['error', 'phase', 'freq', 'Resampled Signal']</value>
+ <key>converver</key>
+ <value>float_converter</value>
</param>
<param>
<key>grid_pos</key>
+ <value>(2,2,1,1)</value>
+ </param>
+ <param>
+ <key>notebook</key>
<value></value>
</param>
<param>
+ <key>_coordinate</key>
+ <value>(4, 530)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>180</value>
+ </param>
+ </block>
+ <block>
+ <key>variable_slider</key>
+ <param>
+ <key>id</key>
+ <value>time_bw</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>label</key>
+ <value>Timing Loop BW</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>min</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>max</key>
+ <value>0.1</value>
+ </param>
+ <param>
+ <key>num_steps</key>
+ <value>1000</value>
+ </param>
+ <param>
+ <key>style</key>
+ <value>wx.SL_HORIZONTAL</value>
+ </param>
+ <param>
+ <key>converver</key>
+ <value>float_converter</value>
+ </param>
+ <param>
+ <key>grid_pos</key>
+ <value>(1,2,1,1)</value>
+ </param>
+ <param>
<key>notebook</key>
<value></value>
</param>
<param>
<key>_coordinate</key>
- <value>(380, 511)</value>
+ <value>(552, 4)</value>
</param>
<param>
<key>_rotation</key>
@@ -1149,22 +976,144 @@
</param>
</block>
<block>
- <key>variable</key>
+ <key>variable_slider</key>
<param>
<key>id</key>
- <value>spb</value>
+ <value>noise_amp</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
+ <key>label</key>
+ <value>Channel Noise</value>
+ </param>
+ <param>
<key>value</key>
- <value>4.2563</value>
+ <value>0</value>
+ </param>
+ <param>
+ <key>min</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>max</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>num_steps</key>
+ <value>1000</value>
+ </param>
+ <param>
+ <key>style</key>
+ <value>wx.SL_HORIZONTAL</value>
+ </param>
+ <param>
+ <key>converver</key>
+ <value>float_converter</value>
+ </param>
+ <param>
+ <key>grid_pos</key>
+ <value>(3,2,1,1)</value>
+ </param>
+ <param>
+ <key>notebook</key>
+ <value></value>
</param>
<param>
<key>_coordinate</key>
- <value>(300, 0)</value>
+ <value>(149, 530)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable_slider</key>
+ <param>
+ <key>id</key>
+ <value>freq_offset</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>label</key>
+ <value>Frequency Offset</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>min</key>
+ <value>-0.5</value>
+ </param>
+ <param>
+ <key>max</key>
+ <value>0.5</value>
+ </param>
+ <param>
+ <key>num_steps</key>
+ <value>1000</value>
+ </param>
+ <param>
+ <key>style</key>
+ <value>wx.SL_HORIZONTAL</value>
+ </param>
+ <param>
+ <key>converver</key>
+ <value>float_converter</value>
+ </param>
+ <param>
+ <key>grid_pos</key>
+ <value>(4,2,1,1)</value>
+ </param>
+ <param>
+ <key>notebook</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(293, 530)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>notebook</key>
+ <param>
+ <key>id</key>
+ <value>notebook_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>style</key>
+ <value>wx.NB_TOP</value>
+ </param>
+ <param>
+ <key>labels</key>
+ <value>['error', 'phase', 'freq', 'Resampled Signal']</value>
+ </param>
+ <param>
+ <key>grid_pos</key>
+ <value>(1,1,5,1)</value>
+ </param>
+ <param>
+ <key>notebook</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(443, 577)</value>
</param>
<param>
<key>_rotation</key>
@@ -1172,69 +1121,69 @@
</param>
</block>
<connection>
- <source_block_id>gr_channel_model_0</source_block_id>
- <sink_block_id>gr_throttle_0</sink_block_id>
- <source_key>0</source_key>
- <sink_key>0</sink_key>
- </connection>
- <connection>
- <source_block_id>gr_throttle_0</source_block_id>
- <sink_block_id>gr_pfb_clock_sync_xxx_0</sink_block_id>
+ <source_block_id>blocks_throttle_0</source_block_id>
+ <sink_block_id>digital_pfb_clock_sync_xxx_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_pfb_clock_sync_xxx_0</source_block_id>
+ <source_block_id>digital_pfb_clock_sync_xxx_0</source_block_id>
<sink_block_id>wxgui_scopesink2_0_0_0_0</sink_block_id>
<source_key>2</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_multiply_const_vxx_0</source_block_id>
+ <source_block_id>blocks_multiply_const_vxx_0</source_block_id>
<sink_block_id>wxgui_scopesink2_0_0_1</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>blks2_pfb_arb_resampler_ccf_0</source_block_id>
- <sink_block_id>gr_multiply_const_vxx_0</sink_block_id>
+ <source_block_id>pfb_arb_resampler_xxx_0</source_block_id>
+ <sink_block_id>blocks_multiply_const_vxx_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_multiply_const_vxx_0</source_block_id>
- <sink_block_id>gr_channel_model_0</sink_block_id>
- <source_key>0</source_key>
- <sink_key>0</sink_key>
- </connection>
- <connection>
- <source_block_id>gr_chunks_to_symbols_xx</source_block_id>
- <sink_block_id>blks2_pfb_arb_resampler_ccf_0</sink_block_id>
+ <source_block_id>digital_chunks_to_symbols_xx</source_block_id>
+ <sink_block_id>pfb_arb_resampler_xxx_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>random_source_x</source_block_id>
- <sink_block_id>gr_chunks_to_symbols_xx</sink_block_id>
+ <sink_block_id>digital_chunks_to_symbols_xx</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_pfb_clock_sync_xxx_0</source_block_id>
+ <source_block_id>digital_pfb_clock_sync_xxx_0</source_block_id>
<sink_block_id>wxgui_scopesink2_0_0_0</sink_block_id>
<source_key>3</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_pfb_clock_sync_xxx_0</source_block_id>
+ <source_block_id>digital_pfb_clock_sync_xxx_0</source_block_id>
<sink_block_id>wxgui_scopesink2_0_0</sink_block_id>
<source_key>1</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_pfb_clock_sync_xxx_0</source_block_id>
+ <source_block_id>digital_pfb_clock_sync_xxx_0</source_block_id>
<sink_block_id>wxgui_scopesink2_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
+ <connection>
+ <source_block_id>channels_channel_model_0</source_block_id>
+ <sink_block_id>blocks_throttle_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>blocks_multiply_const_vxx_0</source_block_id>
+ <sink_block_id>channels_channel_model_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
</flow_graph>
diff --git a/gr-digital/examples/example_costas.py b/gr-digital/examples/example_costas.py
index aef0196cc0..726e0756d8 100755
--- a/gr-digital/examples/example_costas.py
+++ b/gr-digital/examples/example_costas.py
@@ -1,6 +1,26 @@
#!/usr/bin/env python
-
-from gnuradio import gr, digital
+#
+# Copyright 2011,2012 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+from gnuradio import gr, digital, filter
from gnuradio import eng_notation
from gnuradio.eng_option import eng_option
from optparse import OptionParser
@@ -21,15 +41,15 @@ class example_costas(gr.top_block):
def __init__(self, N, sps, rolloff, ntaps, bw, noise, foffset, toffset, poffset):
gr.top_block.__init__(self)
- rrc_taps = gr.firdes.root_raised_cosine(
+ rrc_taps = filter.firdes.root_raised_cosine(
sps, sps, 1.0, rolloff, ntaps)
data = 2.0*scipy.random.randint(0, 2, N) - 1.0
data = scipy.exp(1j*poffset) * data
self.src = gr.vector_source_c(data.tolist(), False)
- self.rrc = gr.interp_fir_filter_ccf(sps, rrc_taps)
- self.chn = gr.channel_model(noise, foffset, toffset)
+ self.rrc = filter.interp_fir_filter_ccf(sps, rrc_taps)
+ self.chn = filter.channel_model(noise, foffset, toffset)
self.cst = digital.costas_loop_cc(bw, 2)
self.vsnk_src = gr.vector_sink_c()
diff --git a/gr-digital/examples/example_fll.py b/gr-digital/examples/example_fll.py
index 3b75b5a758..ef6e1b1658 100755
--- a/gr-digital/examples/example_fll.py
+++ b/gr-digital/examples/example_fll.py
@@ -1,6 +1,26 @@
#!/usr/bin/env python
-
-from gnuradio import gr, digital
+#
+# Copyright 2011,2012 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+from gnuradio import gr, digital, filter
from gnuradio import eng_notation
from gnuradio.eng_option import eng_option
from optparse import OptionParser
@@ -21,15 +41,15 @@ class example_fll(gr.top_block):
def __init__(self, N, sps, rolloff, ntaps, bw, noise, foffset, toffset, poffset):
gr.top_block.__init__(self)
- rrc_taps = gr.firdes.root_raised_cosine(
+ rrc_taps = filter.firdes.root_raised_cosine(
sps, sps, 1.0, rolloff, ntaps)
data = 2.0*scipy.random.randint(0, 2, N) - 1.0
data = scipy.exp(1j*poffset) * data
self.src = gr.vector_source_c(data.tolist(), False)
- self.rrc = gr.interp_fir_filter_ccf(sps, rrc_taps)
- self.chn = gr.channel_model(noise, foffset, toffset)
+ self.rrc = filter.interp_fir_filter_ccf(sps, rrc_taps)
+ self.chn = filter.channel_model(noise, foffset, toffset)
self.fll = digital.fll_band_edge_cc(sps, rolloff, ntaps, bw)
self.vsnk_src = gr.vector_sink_c()
diff --git a/gr-digital/examples/example_timing.py b/gr-digital/examples/example_timing.py
index fd86acfb16..d51aebb31d 100755
--- a/gr-digital/examples/example_timing.py
+++ b/gr-digital/examples/example_timing.py
@@ -1,6 +1,26 @@
#!/usr/bin/env python
-
-from gnuradio import gr, digital
+#
+# Copyright 2011,2012 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+from gnuradio import gr, digital, filter
from gnuradio import eng_notation
from gnuradio.eng_option import eng_option
from optparse import OptionParser
@@ -24,27 +44,27 @@ class example_timing(gr.top_block):
foffset, toffset, poffset, mode=0):
gr.top_block.__init__(self)
- rrc_taps = gr.firdes.root_raised_cosine(
+ rrc_taps = filter.firdes.root_raised_cosine(
sps, sps, 1.0, rolloff, ntaps)
gain = 2*scipy.pi/100.0
nfilts = 32
- rrc_taps_rx = gr.firdes.root_raised_cosine(
+ rrc_taps_rx = filter.firdes.root_raised_cosine(
nfilts, sps*nfilts, 1.0, rolloff, ntaps*nfilts)
data = 2.0*scipy.random.randint(0, 2, N) - 1.0
data = scipy.exp(1j*poffset) * data
self.src = gr.vector_source_c(data.tolist(), False)
- self.rrc = gr.interp_fir_filter_ccf(sps, rrc_taps)
- self.chn = gr.channel_model(noise, foffset, toffset)
- self.off = gr.fractional_interpolator_cc(0.20, 1.0)
+ self.rrc = filter.interp_fir_filter_ccf(sps, rrc_taps)
+ self.chn = filter.channel_model(noise, foffset, toffset)
+ self.off = filter.fractional_interpolator_cc(0.20, 1.0)
if mode == 0:
- self.clk = gr.pfb_clock_sync_ccf(sps, gain, rrc_taps_rx,
- nfilts, nfilts//2, 3.5)
- self.taps = self.clk.get_taps()
- self.dtaps = self.clk.get_diff_taps()
+ self.clk = digital.pfb_clock_sync_ccf(sps, gain, rrc_taps_rx,
+ nfilts, nfilts//2, 3.5)
+ self.taps = self.clk.taps()
+ self.dtaps = self.clk.diff_taps()
self.vsnk_err = gr.vector_sink_f()
self.vsnk_rat = gr.vector_sink_f()
@@ -164,6 +184,7 @@ def main():
for i,d in enumerate(diff_taps):
D = 20.0*scipy.log10(abs(fftpack.fftshift(fftpack.fft(d, 10000))))
+ #D = 20.0*scipy.log10(abs(scipy.fft(d, 10000)))
s31.plot(t[i::nfilts].real, d, "-o")
s32.plot(D)
diff --git a/gr-digital/examples/gen_whitener.py b/gr-digital/examples/gen_whitener.py
index 9a81e4eaa3..0b1591c3ab 100755
--- a/gr-digital/examples/gen_whitener.py
+++ b/gr-digital/examples/gen_whitener.py
@@ -1,4 +1,24 @@
#!/usr/bin/env python
+#
+# Copyright 2011 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
from gnuradio import gr, gru
from gnuradio.eng_option import eng_option
diff --git a/gr-digital/examples/narrowband/benchmark_add_channel.py b/gr-digital/examples/narrowband/benchmark_add_channel.py
index c69ee60b0b..b614895b63 100755
--- a/gr-digital/examples/narrowband/benchmark_add_channel.py
+++ b/gr-digital/examples/narrowband/benchmark_add_channel.py
@@ -20,7 +20,8 @@
# Boston, MA 02110-1301, USA.
#
-from gnuradio import gr
+from gnuradio import gr, filter
+from gnuradio import blocks
from gnuradio import eng_notation
from gnuradio.eng_option import eng_option
from optparse import OptionParser
@@ -41,13 +42,14 @@ class my_top_block(gr.top_block):
noise_power = power_in_signal/SNR
noise_voltage = math.sqrt(noise_power)
- self.src = gr.file_source(gr.sizeof_gr_complex, ifile)
- #self.throttle = gr.throttle(gr.sizeof_gr_complex, options.sample_rate)
- self.channel = gr.channel_model(noise_voltage, frequency_offset,
- time_offset, noise_seed=-random.randint(0,100000))
- self.phase = gr.multiply_const_cc(complex(math.cos(phase_offset),
+ self.src = blocks.file_source(gr.sizeof_gr_complex, ifile)
+ #self.throttle = blocks.throttle(gr.sizeof_gr_complex, options.sample_rate)
+
+ self.channel = filter.channel_model(noise_voltage, frequency_offset,
+ time_offset, noise_seed=-random.randint(0,100000))
+ self.phase = blocks.multiply_const_cc(complex(math.cos(phase_offset),
math.sin(phase_offset)))
- self.snk = gr.file_sink(gr.sizeof_gr_complex, ofile)
+ self.snk = blocks.file_sink(gr.sizeof_gr_complex, ofile)
self.connect(self.src, self.channel, self.phase, self.snk)
diff --git a/gr-digital/examples/narrowband/benchmark_rx.py b/gr-digital/examples/narrowband/benchmark_rx.py
index 1962fdc4b0..ce47bf87b8 100755
--- a/gr-digital/examples/narrowband/benchmark_rx.py
+++ b/gr-digital/examples/narrowband/benchmark_rx.py
@@ -21,6 +21,7 @@
#
from gnuradio import gr, gru
+from gnuradio import blocks
from gnuradio import eng_notation
from gnuradio.eng_option import eng_option
from optparse import OptionParser
@@ -57,7 +58,7 @@ class my_top_block(gr.top_block):
elif(options.from_file is not None):
sys.stderr.write(("Reading samples from '%s'.\n\n" % (options.from_file)))
- self.source = gr.file_source(gr.sizeof_gr_complex, options.from_file)
+ self.source = blocks.file_source(gr.sizeof_gr_complex, options.from_file)
else:
sys.stderr.write("No source defined, pulling samples from null source.\n\n")
self.source = gr.null_source(gr.sizeof_gr_complex)
diff --git a/gr-digital/examples/narrowband/benchmark_tx.py b/gr-digital/examples/narrowband/benchmark_tx.py
index 9afacb4952..593abb3cae 100755
--- a/gr-digital/examples/narrowband/benchmark_tx.py
+++ b/gr-digital/examples/narrowband/benchmark_tx.py
@@ -21,6 +21,7 @@
#
from gnuradio import gr
+from gnuradio import blocks
from gnuradio import eng_notation
from gnuradio.eng_option import eng_option
from optparse import OptionParser
@@ -56,7 +57,7 @@ class my_top_block(gr.top_block):
elif(options.to_file is not None):
sys.stderr.write(("Saving samples to '%s'.\n\n" % (options.to_file)))
- self.sink = gr.file_sink(gr.sizeof_gr_complex, options.to_file)
+ self.sink = blocks.file_sink(gr.sizeof_gr_complex, options.to_file)
else:
sys.stderr.write("No sink defined, dumping samples to null sink.\n\n")
self.sink = gr.null_sink(gr.sizeof_gr_complex)
diff --git a/gr-digital/examples/narrowband/digital_bert_rx.py b/gr-digital/examples/narrowband/digital_bert_rx.py
index 4055aa2444..cf42742736 100755
--- a/gr-digital/examples/narrowband/digital_bert_rx.py
+++ b/gr-digital/examples/narrowband/digital_bert_rx.py
@@ -27,6 +27,7 @@ import gnuradio.gr.gr_threading as _threading
import sys, time, math
from gnuradio import digital
+from gnuradio import blocks
# from current dir
from uhd_interface import uhd_receiver
@@ -65,8 +66,9 @@ class bert_receiver(gr.hier_block2):
self._bitrate = bitrate
- self._demod = digital.generic_demod(constellation, samples_per_symbol,
- differential, excess_bw, gray_coded,
+ self._demod = digital.generic_demod(constellation, differential,
+ samples_per_symbol,
+ gray_coded, excess_bw,
freq_bw, timing_bw, phase_bw,
verbose, log)
@@ -74,14 +76,15 @@ class bert_receiver(gr.hier_block2):
self._sample_rate = self._symbol_rate * samples_per_symbol
# Add an SNR probe on the demodulated constellation
- self._snr_probe = digital.probe_mpsk_snr_est_c(digital.SNR_EST_M2M4, alpha=10.0/self._symbol_rate)
+ self._snr_probe = digital.probe_mpsk_snr_est_c(digital.SNR_EST_M2M4, 1000,
+ alpha=10.0/self._symbol_rate)
self.connect(self._demod.time_recov, self._snr_probe)
# Descramble BERT sequence. A channel error will create 3 incorrect bits
- self._descrambler = gr.descrambler_bb(0x8A, 0x7F, 7) # CCSDS 7-bit descrambler
+ self._descrambler = digital.descrambler_bb(0x8A, 0x7F, 7) # CCSDS 7-bit descrambler
# Measure BER by the density of 0s in the stream
- self._ber = gr.probe_density_b(1.0/self._symbol_rate)
+ self._ber = digital.probe_density_b(1.0/self._symbol_rate)
self.connect(self, self._demod, self._descrambler, self._ber)
@@ -89,7 +92,7 @@ class bert_receiver(gr.hier_block2):
return self._demod.freq_recov.get_frequency()*self._sample_rate/(2*math.pi)
def timing_offset(self):
- return self._demod.time_recov.get_clock_rate()
+ return self._demod.time_recov.clock_rate()
def snr(self):
return self._snr_probe.snr()
@@ -122,7 +125,7 @@ class rx_psk_block(gr.top_block):
options.samples_per_symbol = self._source._sps
elif(options.from_file is not None):
- self._source = gr.file_source(gr.sizeof_gr_complex, options.from_file)
+ self._source = blocks.file_source(gr.sizeof_gr_complex, options.from_file)
else:
self._source = gr.null_source(gr.sizeof_gr_complex)
diff --git a/gr-digital/examples/narrowband/digital_bert_tx.py b/gr-digital/examples/narrowband/digital_bert_tx.py
index f29e997af6..2a99137704 100755
--- a/gr-digital/examples/narrowband/digital_bert_tx.py
+++ b/gr-digital/examples/narrowband/digital_bert_tx.py
@@ -25,6 +25,7 @@ from gnuradio.eng_option import eng_option
from optparse import OptionParser
import sys
+from gnuradio import blocks
from gnuradio import digital
# from current dir
@@ -43,13 +44,14 @@ class bert_transmit(gr.hier_block2):
# Create BERT data bit stream
self._bits = gr.vector_source_b([1,], True) # Infinite stream of ones
- self._scrambler = gr.scrambler_bb(0x8A, 0x7F, 7) # CCSDS 7-bit scrambler
+ self._scrambler = digital.scrambler_bb(0x8A, 0x7F, 7) # CCSDS 7-bit scrambler
- self._mod = digital.generic_mod(constellation, samples_per_symbol,
- differential, excess_bw, gray_coded,
+ self._mod = digital.generic_mod(constellation, differential,
+ samples_per_symbol,
+ gray_coded, excess_bw,
verbose, log)
- self._pack = gr.unpacked_to_packed_bb(self._mod.bits_per_symbol(), gr.GR_MSB_FIRST)
+ self._pack = blocks.unpacked_to_packed_bb(self._mod.bits_per_symbol(), gr.GR_MSB_FIRST)
self.connect(self._bits, self._scrambler, self._pack, self._mod, self)
@@ -76,7 +78,7 @@ class tx_psk_block(gr.top_block):
options.samples_per_symbol = self._sink._sps
elif(options.to_file is not None):
- self._sink = gr.file_sink(gr.sizeof_gr_complex, options.to_file)
+ self._sink = blocks.file_sink(gr.sizeof_gr_complex, options.to_file)
else:
self._sink = gr.null_sink(gr.sizeof_gr_complex)
@@ -89,7 +91,7 @@ class tx_psk_block(gr.top_block):
verbose=options.verbose,
log=options.log)
- self.amp = gr.multiply_const_cc(options.amplitude)
+ self.amp = blocks.multiply_const_cc(options.amplitude)
self.connect(self._transmitter, self.amp, self._sink)
diff --git a/gr-digital/examples/narrowband/receive_path.py b/gr-digital/examples/narrowband/receive_path.py
index 1f93105068..dc155e1d12 100644
--- a/gr-digital/examples/narrowband/receive_path.py
+++ b/gr-digital/examples/narrowband/receive_path.py
@@ -20,9 +20,10 @@
# Boston, MA 02110-1301, USA.
#
-from gnuradio import gr, gru
+from gnuradio import gr, gru, filter
from gnuradio import eng_notation
from gnuradio import digital
+from gnuradio import analog
import copy
import sys
@@ -61,12 +62,12 @@ class receive_path(gr.hier_block2):
# Design filter to get actual channel we want
sw_decim = 1
- chan_coeffs = gr.firdes.low_pass (1.0, # gain
- sw_decim * self.samples_per_symbol(), # sampling rate
- self._chbw_factor, # midpoint of trans. band
- 0.5, # width of trans. band
- gr.firdes.WIN_HANN) # filter type
- self.channel_filter = gr.fft_filter_ccc(sw_decim, chan_coeffs)
+ chan_coeffs = filter.firdes.low_pass(1.0, # gain
+ sw_decim * self.samples_per_symbol(), # sampling rate
+ self._chbw_factor, # midpoint of trans. band
+ 0.5, # width of trans. band
+ filter.firdes.WIN_HANN) # filter type
+ self.channel_filter = filter.fft_filter_ccc(sw_decim, chan_coeffs)
# receiver
self.packet_receiver = \
@@ -78,7 +79,7 @@ class receive_path(gr.hier_block2):
# Carrier Sensing Blocks
alpha = 0.001
thresh = 30 # in dB, will have to adjust
- self.probe = gr.probe_avg_mag_sqrd_c(thresh,alpha)
+ self.probe = analog.probe_avg_mag_sqrd_c(thresh,alpha)
# Display some information about the setup
if self._verbose:
@@ -119,8 +120,8 @@ class receive_path(gr.hier_block2):
"""
Set carrier threshold.
- @param threshold_in_db: set detection threshold
- @type threshold_in_db: float (dB)
+ Args:
+ threshold_in_db: set detection threshold (float (dB))
"""
self.probe.set_threshold(threshold_in_db)
diff --git a/gr-digital/examples/narrowband/rx_voice.py b/gr-digital/examples/narrowband/rx_voice.py
index 100caff8ea..b2b4174cc4 100755
--- a/gr-digital/examples/narrowband/rx_voice.py
+++ b/gr-digital/examples/narrowband/rx_voice.py
@@ -20,11 +20,14 @@
# Boston, MA 02110-1301, USA.
#
-from gnuradio import gr, blks2, audio, uhd
+from gnuradio import gr, audio, uhd
+from gnuradio import blocks
+from gnuradio import filter
from gnuradio import eng_notation
from gnuradio.eng_option import eng_option
from optparse import OptionParser
+from gnuradio import blocks
from gnuradio import digital
from gnuradio import vocoder
@@ -48,10 +51,10 @@ class audio_tx(gr.hier_block2):
gr.io_signature(0, 0, 0)) # Output signature
self.sample_rate = sample_rate = 8000
- self.packet_src = gr.message_source(33)
+ self.packet_src = blocks.message_source(33)
voice_decoder = vocoder.gsm_fr_decode_ps()
- s2f = gr.short_to_float ()
- sink_scale = gr.multiply_const_ff(1.0/32767.)
+ s2f = blocks.short_to_float()
+ sink_scale = blocks.multiply_const_ff(1.0/32767.)
audio_sink = audio.sink(sample_rate, audio_output_dev)
self.connect(self.packet_src, voice_decoder, s2f, sink_scale, audio_sink)
@@ -75,17 +78,17 @@ class my_top_block(gr.top_block):
audio_rate = self.audio_tx.sample_rate
usrp_rate = self.source.get_sample_rate()
rrate = audio_rate / usrp_rate
- self.resampler = blks2.pfb_arb_resampler_ccf(rrate)
+ self.resampler = filter.pfb.arb_resampler_ccf(rrate)
self.connect(self.source, self.resampler, self.rxpath)
elif(options.from_file is not None):
- self.thr = gr.throttle(gr.sizeof_gr_complex, options.bitrate)
- self.source = gr.file_source(gr.sizeof_gr_complex, options.from_file)
+ self.thr = blocks.throttle(gr.sizeof_gr_complex, options.bitrate)
+ self.source = blocks.file_source(gr.sizeof_gr_complex, options.from_file)
self.connect(self.source, self.thr, self.rxpath)
else:
- self.thr = gr.throttle(gr.sizeof_gr_complex, 1e6)
+ self.thr = blocks.throttle(gr.sizeof_gr_complex, 1e6)
self.source = gr.null_source(gr.sizeof_gr_complex)
self.connect(self.source, self.thr, self.rxpath)
diff --git a/gr-digital/examples/narrowband/transmit_path.py b/gr-digital/examples/narrowband/transmit_path.py
index 4d6162ed61..43a96050e9 100644
--- a/gr-digital/examples/narrowband/transmit_path.py
+++ b/gr-digital/examples/narrowband/transmit_path.py
@@ -21,6 +21,7 @@
from gnuradio import gr
from gnuradio import eng_notation
+from gnuradio import blocks
from gnuradio import digital
import copy
@@ -58,7 +59,7 @@ class transmit_path(gr.hier_block2):
msgq_limit=4,
pad_for_usrp=True)
- self.amp = gr.multiply_const_cc(1)
+ self.amp = blocks.multiply_const_cc(1)
self.set_tx_amplitude(self._tx_amplitude)
# Display some information about the setup
@@ -71,7 +72,9 @@ class transmit_path(gr.hier_block2):
def set_tx_amplitude(self, ampl):
"""
Sets the transmit amplitude sent to the USRP in volts
- @param: ampl 0 <= ampl < 1.
+
+ Args:
+ : ampl 0 <= ampl < 1.
"""
self._tx_amplitude = max(0.0, min(ampl, 1))
self.amp.set_k(self._tx_amplitude)
diff --git a/gr-digital/examples/narrowband/tunnel.py b/gr-digital/examples/narrowband/tunnel.py
index 65205b9f6f..7b9b69cc8a 100755
--- a/gr-digital/examples/narrowband/tunnel.py
+++ b/gr-digital/examples/narrowband/tunnel.py
@@ -161,8 +161,9 @@ class cs_mac(object):
"""
Invoked by thread associated with PHY to pass received packet up.
- @param ok: bool indicating whether payload CRC was OK
- @param payload: contents of the packet (string)
+ Args:
+ ok: bool indicating whether payload CRC was OK
+ payload: contents of the packet (string)
"""
if self.verbose:
print "Rx: ok = %r len(payload) = %4d" % (ok, len(payload))
diff --git a/gr-digital/examples/narrowband/tx_voice.py b/gr-digital/examples/narrowband/tx_voice.py
index 3d767a0770..d3df9d788f 100755
--- a/gr-digital/examples/narrowband/tx_voice.py
+++ b/gr-digital/examples/narrowband/tx_voice.py
@@ -20,11 +20,13 @@
# Boston, MA 02110-1301, USA.
#
-from gnuradio import gr, blks2, audio, uhd
+from gnuradio import gr, audio, uhd
from gnuradio import eng_notation
from gnuradio.eng_option import eng_option
from optparse import OptionParser
+from gnuradio import blocks
+from gnuradio import filter
from gnuradio import digital
from gnuradio import vocoder
@@ -49,11 +51,11 @@ class audio_rx(gr.hier_block2):
gr.io_signature(0, 0, 0)) # Output signature
self.sample_rate = sample_rate = 8000
src = audio.source(sample_rate, audio_input_dev)
- src_scale = gr.multiply_const_ff(32767)
- f2s = gr.float_to_short()
+ src_scale = blocks.multiply_const_ff(32767)
+ f2s = blocks.float_to_short()
voice_coder = vocoder.gsm_fr_encode_sp()
self.packets_from_encoder = gr.msg_queue()
- packet_sink = gr.message_sink(33, self.packets_from_encoder, False)
+ packet_sink = blocks.message_sink(33, self.packets_from_encoder, False)
self.connect(src, src_scale, f2s, voice_coder, packet_sink)
def get_encoded_voice_packet(self):
@@ -78,13 +80,13 @@ class my_top_block(gr.top_block):
rrate = usrp_rate / audio_rate
elif(options.to_file is not None):
- self.sink = gr.file_sink(gr.sizeof_gr_complex, options.to_file)
+ self.sink = blocks.file_sink(gr.sizeof_gr_complex, options.to_file)
rrate = 1
else:
self.sink = gr.null_sink(gr.sizeof_gr_complex)
rrate = 1
- self.resampler = blks2.pfb_arb_resampler_ccf(rrate)
+ self.resampler = filter.pfb.arb_resampler_ccf(rrate)
self.connect(self.audio_rx)
self.connect(self.txpath, self.resampler, self.sink)
diff --git a/gr-digital/examples/ofdm/benchmark_add_channel.py b/gr-digital/examples/ofdm/benchmark_add_channel.py
index cbdd990f4f..f97214f78d 100755
--- a/gr-digital/examples/ofdm/benchmark_add_channel.py
+++ b/gr-digital/examples/ofdm/benchmark_add_channel.py
@@ -20,7 +20,8 @@
# Boston, MA 02110-1301, USA.
#
-from gnuradio import gr
+from gnuradio import gr, filter
+from gnuradio import blocks
from gnuradio import eng_notation
from gnuradio.eng_option import eng_option
from optparse import OptionParser
@@ -43,13 +44,14 @@ class my_top_block(gr.top_block):
frequency_offset = options.frequency_offset / options.fft_length
- self.src = gr.file_source(gr.sizeof_gr_complex, ifile)
- #self.throttle = gr.throttle(gr.sizeof_gr_complex, options.sample_rate)
- self.channel = gr.channel_model(noise_voltage, frequency_offset,
+ self.src = blocks.file_source(gr.sizeof_gr_complex, ifile)
+ #self.throttle = blocks.throttle(gr.sizeof_gr_complex, options.sample_rate)
+
+ self.channel = filter.channel_model(noise_voltage, frequency_offset,
time_offset, noise_seed=-random.randint(0,100000))
- self.phase = gr.multiply_const_cc(complex(math.cos(phase_offset),
+ self.phase = blocks.multiply_const_cc(complex(math.cos(phase_offset),
math.sin(phase_offset)))
- self.snk = gr.file_sink(gr.sizeof_gr_complex, ofile)
+ self.snk = blocks.file_sink(gr.sizeof_gr_complex, ofile)
self.connect(self.src, self.channel, self.phase, self.snk)
diff --git a/gr-digital/examples/ofdm/benchmark_rx.py b/gr-digital/examples/ofdm/benchmark_rx.py
index 57817c5018..740e0aed0e 100755
--- a/gr-digital/examples/ofdm/benchmark_rx.py
+++ b/gr-digital/examples/ofdm/benchmark_rx.py
@@ -20,11 +20,12 @@
# Boston, MA 02110-1301, USA.
#
-from gnuradio import gr, blks2
+from gnuradio import gr
from gnuradio import eng_notation
from gnuradio.eng_option import eng_option
from optparse import OptionParser
+from gnuradio import blocks
from gnuradio import digital
# from current dir
@@ -44,7 +45,7 @@ class my_top_block(gr.top_block):
options.spec, options.antenna,
options.verbose)
elif(options.from_file is not None):
- self.source = gr.file_source(gr.sizeof_gr_complex, options.from_file)
+ self.source = blocks.file_source(gr.sizeof_gr_complex, options.from_file)
else:
self.source = gr.null_source(gr.sizeof_gr_complex)
diff --git a/gr-digital/examples/ofdm/benchmark_tx.py b/gr-digital/examples/ofdm/benchmark_tx.py
index 5962fe7ecb..44b127e0cc 100755
--- a/gr-digital/examples/ofdm/benchmark_tx.py
+++ b/gr-digital/examples/ofdm/benchmark_tx.py
@@ -27,6 +27,7 @@ from optparse import OptionParser
import time, struct, sys
from gnuradio import digital
+from gnuradio import blocks
# from current dir
from transmit_path import transmit_path
@@ -43,7 +44,7 @@ class my_top_block(gr.top_block):
options.spec, options.antenna,
options.verbose)
elif(options.to_file is not None):
- self.sink = gr.file_sink(gr.sizeof_gr_complex, options.to_file)
+ self.sink = blocks.file_sink(gr.sizeof_gr_complex, options.to_file)
else:
self.sink = gr.null_sink(gr.sizeof_gr_complex)
diff --git a/gr-digital/examples/ofdm/ofdm_mod_demod_test.py b/gr-digital/examples/ofdm/ofdm_mod_demod_test.py
deleted file mode 100755
index b1521da6d7..0000000000
--- a/gr-digital/examples/ofdm/ofdm_mod_demod_test.py
+++ /dev/null
@@ -1,179 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2005,2006,2008 Free Software Foundation, Inc.
-#
-# This file is part of GNU Radio
-#
-# GNU Radio is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3, or (at your option)
-# any later version.
-#
-# GNU Radio is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Radio; see the file COPYING. If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street,
-# Boston, MA 02110-1301, USA.
-#
-
-from gnuradio import gr, ofdm_packet_utils
-import gnuradio.gr.gr_threading as _threading
-from gnuradio import eng_notation
-from gnuradio.eng_option import eng_option
-from optparse import OptionParser
-
-import random, time, struct, sys, math, os
-
-class my_top_block(gr.top_block):
- def __init__(self, callback, options):
- gr.top_block.__init__(self)
-
- # hard-coded known symbol
- ks1 = known_symbols_4512_1[0:options.occupied_tones]
- ks2 = known_symbols_4512_2[0:options.occupied_tones]
-
- self._rcvd_pktq = gr.msg_queue()
-
- # accepts messages from the outside world
- self.ofdm_mapper = gr.ofdm_bpsk_mapper(4, options.occupied_tones, options.fft_length, ks1, ks2)
- self.ofdm_corr = gr.ofdm_correlator(options.occupied_tones, options.fft_length, 0, ks1, ks2)
- self.ofdm_framer = gr.ofdm_frame_sink(self._rcvd_pktq, options.occupied_tones)
-
- if 0: # set to 1 to put the correlator in the path to take over the signalling
- self.connect((self.ofdm_mapper, 0), (self.ofdm_corr, 0))
- self.connect((self.ofdm_corr, 0), (self.ofdm_framer, 0))
- self.connect((self.ofdm_corr, 1), (self.ofdm_framer, 1))
-
- self.connect((self.ofdm_mapper,0), gr.file_sink(gr.sizeof_gr_complex*options.fft_length, "ofdm_mapper.dat"))
- self.connect((self.ofdm_corr,0), gr.file_sink(gr.sizeof_gr_complex*options.occupied_tones, "ofdm_corr.dat"))
- self.connect((self.ofdm_corr,1), gr.file_sink(gr.sizeof_char, "ofdm_sig.dat"))
-
- else:
- self.connect((self.ofdm_mapper, 0), (self.ofdm_framer, 0))
- self.connect((self.ofdm_mapper, 1), (self.ofdm_framer, 1))
-
- self.connect((self.ofdm_mapper,0), gr.file_sink(gr.sizeof_gr_complex*options.fft_length, "ofdm_mapper.dat"))
- self.connect((self.ofdm_mapper,1), gr.file_sink(gr.sizeof_char, "ofdm_sig.dat"))
-
- self._watcher = _queue_watcher_thread(self._rcvd_pktq, callback)
-
- def send_pkt(self, payload='', eof=False):
- if eof:
- msg = gr.message(1)
- else:
- pkt = ofdm_packet_utils.make_packet(payload, 1, 1, False, whiten=False)
- msg = gr.message_from_string(pkt)
- self.ofdm_mapper.msgq().insert_tail(msg)
-
-class _queue_watcher_thread(_threading.Thread):
- def __init__(self, rcvd_pktq, callback):
- _threading.Thread.__init__(self)
- self.setDaemon(1)
- self.rcvd_pktq = rcvd_pktq
- self.callback = callback
- self.keep_running = True
- self.start()
-
- def run(self):
- while self.keep_running:
- msg = self.rcvd_pktq.delete_head()
- ok, payload = ofdm_packet_utils.unmake_packet(msg.to_string(), whiten=False)
- if self.callback:
- self.callback(ok, payload)
-
-# /////////////////////////////////////////////////////////////////////////////
-# main
-# /////////////////////////////////////////////////////////////////////////////
-
-def main():
- ''' Use this program to tie the OFDM modulators straight into the frame sink, with or without
- the correlator in between. This is for testing of the modulators and demodulators only without
- receiver and sync functionality.'''
-
- global n_rcvd, n_right
-
- n_rcvd = 0
- n_right = 0
-
- def send_pkt(payload='', eof=False):
- return fg.send_pkt(payload, eof)
-
- def rx_callback(ok, payload):
- global n_rcvd, n_right
- n_rcvd += 1
- (pktno,) = struct.unpack('!H', payload[0:2])
- if ok:
- n_right += 1
- print "ok: %r \t pktno: %d \t n_rcvd: %d \t n_right: %d" % (ok, pktno, n_rcvd, n_right)
-
- printlst = list()
- for x in payload[2:]:
- t = hex(ord(x)).replace('0x', '')
- if(len(t) == 1):
- t = '0' + t
- printlst.append(t)
- printable = ''.join(printlst)
-
- print printable
- print "\n"
-
- parser = OptionParser(option_class=eng_option, conflict_handler="resolve")
- expert = parser.add_option_group("Expert")
- parser.add_option("-s", "--size", type="eng_float", default=1450,
- help="set packet size [default=%default]")
- parser.add_option("-M", "--megabytes", type="eng_float", default=1.0,
- help="set megabytes to transmit [default=%default]")
- expert.add_option("", "--fft-length", type="intx", default=512,
- help="set the number of FFT bins [default=%default]")
- expert.add_option("", "--occupied-tones", type="intx", default=200,
- help="set the number of occupied FFT bins [default=%default]")
- expert.add_option("", "--cp-length", type="intx", default=128,
- help="set the number of bits in the cyclic prefix [default=%default]")
- expert.add_option("", "--fft-length", type="intx", default=512,
- help="set the number of FFT bins [default=%default]")
- expert.add_option("", "--occupied-tones", type="intx", default=200,
- help="set the number of occupied FFT bins [default=%default]")
- expert.add_option("", "--cp-length", type="intx", default=128,
- help="set the number of bits in the cyclic prefix [default=%default]")
-
- (options, args) = parser.parse_args ()
-
- # build the graph
- tb = my_top_block(rx_callback, options)
-
- tb.start() # start flow graph
-
- # generate and send packets
- nbytes = int(1e6 * options.megabytes)
- n = 0
- pktno = 0
- pkt_size = int(options.size)
-
- while n < nbytes:
- #r = ''.join([chr(random.randint(0,255)) for i in range(pkt_size-2)])
- #pkt_contents = struct.pack('!H', pktno) + r
-
- pkt_contents = struct.pack('!H', pktno) + (pkt_size - 2) * chr(pktno & 0xff)
-
- send_pkt(pkt_contents)
- n += pkt_size
- pktno += 1
-
- send_pkt(eof=True)
- tb.wait() # wait for it to finish
-
-known_symbols_4512_1 = [-1, 1, 1, 1, -1, -1, 1, -1, 1, -1, 1, 1, 1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, -1, 1, -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, -1, 1, 1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, 1, -1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, -1, -1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, -1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, 1, 1, -1, 1, -1, 1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, 1, 1, 1, 1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, -1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1, -1, 1, -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, 1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, -1, -1, -1, 1, 1, -1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, -1, -1, 1, -1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1, -1, 1, -1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, -1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1, -1, -1, 1, -1, 1, 1, -1, -1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, 1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, -1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1, -1, -1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, -1, 1, 1, 1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, -1, 1, 1, 1, -1, -1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, -1, -1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, -1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, -1, 1, 1, -1, -1, -1, -1, -1, -1, 1, -1, 1, -1, 1, 1, 1, -1, -1, -1, -1, 1, -1, -1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, 1, 1, -1, 1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, 1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, 1, -1, -1, -1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, -1, 1, -1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, -1, -1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, -1, -1, -1, -1, 1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, 1, -1, -1, -1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, 1, 1, 1, -1, -1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, -1, -1, -1, 1, -1, 1, 1, 1, -1, -1, 1, -1, 1, -1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, -1, -1, -1, 1, -1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, 1, 1, 1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, -1, 1, -1, -1, 1, -1, -1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, 1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, -1, 1, -1, -1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, -1, -1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, -1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, 1, -1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, -1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, 1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, -1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, 1, 1, 1, 1, -1, -1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, -1, -1, -1, 1, -1, 1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1, -1, 1, 1, 1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1, 1, 1, -1, -1, 1, -1, -1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, -1, 1, -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, -1, 1, 1, -1, -1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1, -1, 1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1, -1, 1, -1, 1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, 1, 1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, 1, 1, -1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1]
-
-known_symbols_4512_2 = [1, 1, 1, -1, -1, -1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, 1, -1, -1, 1, 1, 1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, -1, -1, -1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 1, 1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, 1, 1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, -1, 1, -1, -1, -1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, -1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, 1, -1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, -1, 1, 1, -1, -1, -1, 1, 1, -1, -1, -1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, 1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, -1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, -1, -1, -1, -1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, -1, 1, -1, -1, -1, -1, 1, 1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1, 1, -1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, 1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, -1, -1, 1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, -1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, 1, 1, 1, 1, -1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, 1, -1, 1, 1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, 1, 1, 1, -1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, 1, 1, 1, -1, -1, -1, -1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, 1, -1, -1, 1, -1, -1, -1, -1, -1, -1, 1, -1, 1, -1, 1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, -1, -1, 1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1, 1, 1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, 1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, 1, -1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, -1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, -1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, -1, -1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, 1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, 1, -1, -1, -1, 1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, -1, -1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, -1, -1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, 1, -1, -1, -1, -1, 1, 1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, 1, 1, 1, -1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, -1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1, -1, 1, 1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, -1, -1, 1, -1, -1, 1, -1, -1, 1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, -1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, -1, -1, 1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, 1, -1, -1, -1, -1, -1, -1, 1, 1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, -1, 1, 1, -1, -1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, -1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, -1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, -1, 1, -1, 1, -1, -1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, -1, 1, 1, -1, 1, -1, 1, -1, 1, 1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1, -1, -1, 1, -1, 1, -1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, -1, -1, -1, 1, -1, -1, -1, -1, 1, 1, 1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1, 1, 1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, -1, 1, 1, -1, 1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1]
-
-
-if __name__ == '__main__':
- try:
- main()
- except KeyboardInterrupt:
- pass
-
diff --git a/gr-digital/examples/ofdm/receive_path.py b/gr-digital/examples/ofdm/receive_path.py
index e1c7868a0e..2a6813f8f9 100644
--- a/gr-digital/examples/ofdm/receive_path.py
+++ b/gr-digital/examples/ofdm/receive_path.py
@@ -22,6 +22,7 @@
from gnuradio import gr
from gnuradio import eng_notation
from gnuradio import digital
+from gnuradio import analog
import copy
import sys
@@ -51,7 +52,7 @@ class receive_path(gr.hier_block2):
# Carrier Sensing Blocks
alpha = 0.001
thresh = 30 # in dB, will have to adjust
- self.probe = gr.probe_avg_mag_sqrd_c(thresh,alpha)
+ self.probe = analog.probe_avg_mag_sqrd_c(thresh,alpha)
self.connect(self, self.ofdm_rx)
self.connect(self.ofdm_rx, self.probe)
@@ -77,8 +78,8 @@ class receive_path(gr.hier_block2):
"""
Set carrier threshold.
- @param threshold_in_db: set detection threshold
- @type threshold_in_db: float (dB)
+ Args:
+ threshold_in_db: set detection threshold (float (dB))
"""
self.probe.set_threshold(threshold_in_db)
diff --git a/gr-digital/examples/ofdm/rx_ofdm.grc b/gr-digital/examples/ofdm/rx_ofdm.grc
index 766fd9dc2b..1541e8dedf 100644
--- a/gr-digital/examples/ofdm/rx_ofdm.grc
+++ b/gr-digital/examples/ofdm/rx_ofdm.grc
@@ -292,10 +292,10 @@
</param>
</block>
<block>
- <key>gr_delay</key>
+ <key>blocks_delay</key>
<param>
<key>id</key>
- <value>gr_delay_0</value>
+ <value>blocks_delay_0</value>
</param>
<param>
<key>_enabled</key>
@@ -465,10 +465,10 @@
</param>
</block>
<block>
- <key>gr_throttle</key>
+ <key>blocks_throttle</key>
<param>
<key>id</key>
- <value>gr_throttle_0</value>
+ <value>blocks_throttle_0</value>
</param>
<param>
<key>_enabled</key>
@@ -989,24 +989,24 @@
</connection>
<connection>
<source_block_id>analog_noise_source_x_0</source_block_id>
- <sink_block_id>gr_throttle_0</sink_block_id>
+ <sink_block_id>blocks_throttle_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_throttle_0</source_block_id>
+ <source_block_id>blocks_throttle_0</source_block_id>
<sink_block_id>digital_ofdm_sync_sc_cfb_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_throttle_0</source_block_id>
- <sink_block_id>gr_delay_0</sink_block_id>
+ <source_block_id>blocks_throttle_0</source_block_id>
+ <sink_block_id>blocks_delay_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_delay_0</source_block_id>
+ <source_block_id>blocks_delay_0</source_block_id>
<sink_block_id>blocks_multiply_xx_0</sink_block_id>
<source_key>0</source_key>
<sink_key>1</sink_key>
diff --git a/gr-digital/examples/ofdm/transmit_path.py b/gr-digital/examples/ofdm/transmit_path.py
index ec357d6173..aa146cea96 100644
--- a/gr-digital/examples/ofdm/transmit_path.py
+++ b/gr-digital/examples/ofdm/transmit_path.py
@@ -21,6 +21,7 @@
from gnuradio import gr
from gnuradio import eng_notation
+from gnuradio import blocks
from gnuradio import digital
import copy
@@ -49,7 +50,7 @@ class transmit_path(gr.hier_block2):
msgq_limit=4,
pad_for_usrp=False)
- self.amp = gr.multiply_const_cc(1)
+ self.amp = blocks.multiply_const_cc(1)
self.set_tx_amplitude(self._tx_amplitude)
# Display some information about the setup
@@ -62,7 +63,9 @@ class transmit_path(gr.hier_block2):
def set_tx_amplitude(self, ampl):
"""
Sets the transmit amplitude sent to the USRP
- @param: ampl 0 <= ampl < 1.0. Try 0.10
+
+ Args:
+ : ampl 0 <= ampl < 1.0. Try 0.10
"""
self._tx_amplitude = max(0.0, min(ampl, 1))
self.amp.set_k(self._tx_amplitude)
diff --git a/gr-digital/examples/ofdm/tunnel.py b/gr-digital/examples/ofdm/tunnel.py
index e253cf5161..f407aef8d6 100755
--- a/gr-digital/examples/ofdm/tunnel.py
+++ b/gr-digital/examples/ofdm/tunnel.py
@@ -146,8 +146,9 @@ class cs_mac(object):
"""
Invoked by thread associated with PHY to pass received packet up.
- @param ok: bool indicating whether payload CRC was OK
- @param payload: contents of the packet (string)
+ Args:
+ ok: bool indicating whether payload CRC was OK
+ payload: contents of the packet (string)
"""
if self.verbose:
print "Rx: ok = %r len(payload) = %4d" % (ok, len(payload))
diff --git a/gr-digital/examples/ofdm/tx_ofdm.grc b/gr-digital/examples/ofdm/tx_ofdm.grc
index 62472ebbce..6c4f9797d1 100644
--- a/gr-digital/examples/ofdm/tx_ofdm.grc
+++ b/gr-digital/examples/ofdm/tx_ofdm.grc
@@ -268,10 +268,10 @@
</param>
</block>
<block>
- <key>gr_throttle</key>
+ <key>blocks_throttle</key>
<param>
<key>id</key>
- <value>gr_throttle_0</value>
+ <value>blocks_throttle_0</value>
</param>
<param>
<key>_enabled</key>
@@ -1006,10 +1006,10 @@
</param>
</block>
<block>
- <key>gr_tag_debug</key>
+ <key>blocks_tag_debug</key>
<param>
<key>id</key>
- <value>gr_tag_debug_0</value>
+ <value>blocks_tag_debug_0</value>
</param>
<param>
<key>_enabled</key>
@@ -1046,12 +1046,12 @@
</block>
<connection>
<source_block_id>gr_vector_source_x_1</source_block_id>
- <sink_block_id>gr_throttle_0</sink_block_id>
+ <sink_block_id>blocks_throttle_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_throttle_0</source_block_id>
+ <source_block_id>blocks_throttle_0</source_block_id>
<sink_block_id>digital_crc32_bb_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
@@ -1136,7 +1136,7 @@
</connection>
<connection>
<source_block_id>digital_crc32_bb_0</source_block_id>
- <sink_block_id>gr_tag_debug_0</sink_block_id>
+ <sink_block_id>blocks_tag_debug_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
diff --git a/gr-digital/examples/snr_estimators.py b/gr-digital/examples/snr_estimators.py
index 432abd4553..e310ec2937 100755
--- a/gr-digital/examples/snr_estimators.py
+++ b/gr-digital/examples/snr_estimators.py
@@ -1,4 +1,24 @@
#!/usr/bin/env python
+#
+# Copyright 2011,2012 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
import sys
@@ -15,7 +35,7 @@ except ImportError:
print "Error: Program requires Matplotlib (matplotlib.sourceforge.net)."
sys.exit(1)
-from gnuradio import gr, digital
+from gnuradio import gr, digital, filter
from optparse import OptionParser
from gnuradio.eng_option import eng_option
@@ -147,7 +167,7 @@ def main():
gr_src = gr.vector_source_c(bits.tolist(), False)
gr_snr = digital.mpsk_snr_est_cc(gr_est, ntag, 0.001)
- gr_chn = gr.channel_model(1.0/scale)
+ gr_chn = filter.channel_model(1.0/scale)
gr_snk = gr.null_sink(gr.sizeof_gr_complex)
tb = gr.top_block()
tb.connect(gr_src, gr_chn, gr_snr, gr_snk)
diff --git a/gr-digital/grc/digital_block_tree.xml b/gr-digital/grc/digital_block_tree.xml
index 26c316bfd8..762ac66538 100644
--- a/gr-digital/grc/digital_block_tree.xml
+++ b/gr-digital/grc/digital_block_tree.xml
@@ -28,8 +28,10 @@
<cat>
<name></name> <!-- Blank for Root Name -->
<cat>
- <name>Digital</name>
+ <name>Coding</name>
<block>digital_additive_scrambler_bb</block>
+ <block>digital_scrambler_bb</block>
+ <block>digital_descrambler_bb</block>
<block>digital_binary_slicer_fb</block>
<block>digital_bytes_to_syms</block>
<block>digital_chunks_to_symbols_xx</block>
@@ -57,16 +59,52 @@
<block>digital_pn_correlator_cc</block>
<block>digital_probe_density_b</block>
<block>digital_probe_mpsk_snr_est_c</block>
- <block>digital_scrambler_bb</block>
+ </cat>
+ <cat>
+ <name>Converters</name>
+ <block>digital_binary_slicer_fb</block>
+ <block>digital_chunks_to_symbols_xx</block>
<block>digital_diff_decoder_bb</block>
<block>digital_diff_encoder_bb</block>
<block>digital_diff_phasor_cc</block>
+ <block>digital_map_bb</block>
+ </cat>
+ <cat>
+ <name>Digital</name>
+ <block>digital_constellation_decoder_cb</block>
+ <block>digital_constellation_receiver_cb</block>
+ <block>digital_correlate_access_code_bb</block>
+ <block>digital_correlate_access_code_tag_bb</block>
<block>digital_framer_sink_1</block>
+ <block>digital_mpsk_snr_est_cc</block>
+ <block>digital_mpsk_receiver_cc</block>
<block>digital_packet_sink</block>
+ <block>digital_pn_correlator_cc</block>
<block>digital_simple_framer</block>
<block>digital_simple_correlator</block>
</cat>
<cat>
+ <name>Probes</name>
+ <block>digital_probe_density_b</block>
+ <block>digital_probe_mpsk_snr_est_c</block>
+ </cat>
+ <cat>
+ <name>Sources</name>
+ <block>digital_glfsr_source_x</block>
+ </cat>
+ <cat>
+ <name>Synchronizers</name>
+ <block>digital_clock_recovery_mm_xx</block>
+ <block>digital_costas_loop_cc</block>
+ <block>digital_fll_band_edge_cc</block>
+ <block>digital_pfb_clock_sync_xxx</block>
+ </cat>
+ <cat>
+ <name>Equalizers</name>
+ <block>digital_cma_equalizer_cc</block>
+ <block>digital_lms_dd_equalizer_cc</block>
+ </cat>
+ <cat>
<name>Digital Modulators</name>
<block>digital_dxpsk_mod</block>
<block>digital_dxpsk_demod</block>
@@ -88,6 +126,7 @@
<block>digital_ofdm_chanest_vcvc</block>
<block>digital_ofdm_cyclic_prefixer</block>
<block>digital_ofdm_frame_acquisition</block>
+ <block>digital_ofdm_frame_sink</block>
<block>digital_ofdm_frame_equalizer_vcvc</block>
<block>digital_ofdm_insert_preamble</block>
<block>digital_ofdm_sampler</block>
diff --git a/gr-digital/grc/digital_correlate_access_code_tag_bb.xml b/gr-digital/grc/digital_correlate_access_code_tag_bb.xml
new file mode 100644
index 0000000000..7d43f1b3f1
--- /dev/null
+++ b/gr-digital/grc/digital_correlate_access_code_tag_bb.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Correlate Access Code
+###################################################
+ -->
+<block>
+ <name>Correlate Access Code - Tag</name>
+ <key>digital_correlate_access_code_tag_bb</key>
+ <import>from gnuradio import digital</import>
+ <make>digital.correlate_access_code_tag_bb($access_code, $threshold, $tagname)</make>
+ <param>
+ <name>Access Code</name>
+ <key>access_code</key>
+ <value>101010</value>
+ <type>string</type>
+ </param>
+ <param>
+ <name>Threshold</name>
+ <key>threshold</key>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Tag Name</name>
+ <key>tagname</key>
+ <type>string</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>byte</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>byte</type>
+ </source>
+</block>
diff --git a/gr-digital/grc/digital_dxpsk_demod.xml b/gr-digital/grc/digital_dxpsk_demod.xml
index f3e9ee6fcc..1c6314d305 100644
--- a/gr-digital/grc/digital_dxpsk_demod.xml
+++ b/gr-digital/grc/digital_dxpsk_demod.xml
@@ -23,7 +23,7 @@
<!--
###################################################
-##DPSK2 Mod - 2, 4, 8
+##DPSK2 Mod - 2, 4
###################################################
-->
<block>
@@ -36,7 +36,7 @@
freq_bw=$freq_bw,
phase_bw=$phase_bw,
timing_bw=$timing_bw,
- gray_coded=$gray_coded,
+ mod_code=$mod_code,
verbose=$verbose,
log=$log
)</make>
@@ -87,16 +87,15 @@
</param>
<param>
<name>Gray Code</name>
- <key>gray_coded</key>
- <value>True</value>
+ <key>mod_code</key>
<type>enum</type>
<option>
<name>Yes</name>
- <key>True</key>
+ <key>"gray"</key>
</option>
<option>
<name>No</name>
- <key>False</key>
+ <key>"none"</key>
</option>
</param>
<param>
diff --git a/gr-digital/grc/digital_dxpsk_mod.xml b/gr-digital/grc/digital_dxpsk_mod.xml
index 93334d27d5..08a95f1a9c 100644
--- a/gr-digital/grc/digital_dxpsk_mod.xml
+++ b/gr-digital/grc/digital_dxpsk_mod.xml
@@ -23,7 +23,7 @@
<!--
###################################################
-## DPSK Mod - 2, 4, 8
+## DPSK Mod - 2, 4
###################################################
-->
<block>
@@ -33,7 +33,7 @@
<make>digital.$(type)_mod(
samples_per_symbol=$samples_per_symbol,
excess_bw=$excess_bw,
- gray_coded=$gray_coded,
+ mod_code=$mod_code,
verbose=$verbose,
log=$log)
</make>
@@ -49,10 +49,6 @@
<name>DQPSK</name>
<key>dqpsk</key>
</option>
- <option>
- <name>D8PSK</name>
- <key>d8psk</key>
- </option>
</param>
<param>
<name>Samples/Symbol</name>
@@ -68,16 +64,15 @@
</param>
<param>
<name>Gray Code</name>
- <key>gray_coded</key>
- <value>True</value>
+ <key>mod_code</key>
<type>enum</type>
<option>
<name>Yes</name>
- <key>True</key>
+ <key>"gray"</key>
</option>
<option>
<name>No</name>
- <key>False</key>
+ <key>"none"</key>
</option>
</param>
<param>
diff --git a/gr-digital/grc/digital_gmskmod_bc.xml b/gr-digital/grc/digital_gmskmod_bc.xml
index a44afe798f..6cda687f76 100644
--- a/gr-digital/grc/digital_gmskmod_bc.xml
+++ b/gr-digital/grc/digital_gmskmod_bc.xml
@@ -8,7 +8,7 @@
<name>GMSK Modulator</name>
<key>digital_gmskmod_bc</key>
<import>from gnuradio import digital</import>
- <make>digital.gmskmod_bc($samples_per_symbol, $bt, $L)</make>
+ <make>digital.gmskmod_bc($samples_per_symbol, $L, $bt)</make>
<param>
<name>Samples/Symbol</name>
<key>samples_per_symbol</key>
diff --git a/gr-digital/grc/digital_mpsk_receiver_cc.xml b/gr-digital/grc/digital_mpsk_receiver_cc.xml
index bd738fccc3..a9b66b7a19 100644
--- a/gr-digital/grc/digital_mpsk_receiver_cc.xml
+++ b/gr-digital/grc/digital_mpsk_receiver_cc.xml
@@ -17,61 +17,61 @@
<param>
<name>M</name>
<key>M</key>
- <value>4</value>
+ <value>4</value>
<type>int</type>
</param>
<param>
<name>Theta</name>
<key>theta</key>
- <value>0</value>
+ <value>0</value>
<type>real</type>
</param>
<param>
<name>Loop Bandwidth</name>
<key>w</key>
- <value>cmath.pi/100.0</value>
+ <value>cmath.pi/100.0</value>
<type>real</type>
</param>
<param>
<name>Min Freq</name>
<key>fmin</key>
- <value>-0.5</value>
+ <value>-0.5</value>
<type>real</type>
</param>
<param>
<name>Max Freq</name>
<key>fmax</key>
- <value>0.5</value>
+ <value>0.5</value>
<type>real</type>
</param>
<param>
<name>Mu</name>
<key>mu</key>
- <value>0.25</value>
+ <value>0.25</value>
<type>real</type>
</param>
<param>
<name>Gain Mu</name>
<key>gain_mu</key>
- <value>0.01</value>
+ <value>0.01</value>
<type>real</type>
</param>
<param>
<name>Omega</name>
<key>omega</key>
- <value>2</value>
+ <value>2</value>
<type>real</type>
</param>
<param>
<name>Gain Omega</name>
<key>gain_omega</key>
- <value>0.001</value>
+ <value>0.001</value>
<type>real</type>
</param>
<param>
<name>Omega Relative Limit</name>
<key>omega_relative_limit</key>
- <value>0.001</value>
+ <value>0.001</value>
<type>real</type>
</param>
<sink>
diff --git a/gr-digital/grc/digital_ofdm_frame_sink.xml b/gr-digital/grc/digital_ofdm_frame_sink.xml
new file mode 100644
index 0000000000..64c69ec0ad
--- /dev/null
+++ b/gr-digital/grc/digital_ofdm_frame_sink.xml
@@ -0,0 +1,79 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 2012 Free Software Foundation, Inc.
+
+ This file is part of GNU Radio
+
+ GNU Radio is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3, or (at your option)
+ any later version.
+
+ GNU Radio is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Radio; see the file COPYING. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street,
+ Boston, MA 02110-1301, USA.
+-->
+
+<!--
+###################################################
+##OFDM Frame Sink
+###################################################
+ -->
+<block>
+ <name>OFDM Frame Sink</name>
+ <key>digital_ofdm_frame_sink</key>
+ <import>from gnuradio import digital</import>
+ <make>digital.ofdm_frame_sink($syms, $vals, $queue, $occ_tones, $ph_gain, $frq_gain)</make>
+ <param>
+ <name>Symbol Points</name>
+ <key>syms</key>
+ <type>complex_vector</type>
+ </param>
+ <param>
+ <name>Symbol Values</name>
+ <key>vals</key>
+ <type>int_vector</type>
+ </param>
+ <param>
+ <name>Message Queue</name>
+ <key>queue</key>
+ <type>raw</type>
+ </param>
+ <param>
+ <name>Occupied Tones</name>
+ <key>occ_tones</key>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Phase Gain</name>
+ <key>ph_gain</key>
+ <value>0.25</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Freq. Gain</name>
+ <key>frq_gain</key>
+ <value>0.015625</value>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>complex</type>
+ <vlen>$occ_tones</vlen>
+ </sink>
+ <sink>
+ <name>flag</name>
+ <type>byte</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>complex</type>
+ <vlen>$occ_tones</vlen>
+ </source>
+</block>
diff --git a/gr-digital/grc/digital_packet_sink.xml b/gr-digital/grc/digital_packet_sink.xml
index e9231bd059..2c6653d7ec 100644
--- a/gr-digital/grc/digital_packet_sink.xml
+++ b/gr-digital/grc/digital_packet_sink.xml
@@ -22,6 +22,7 @@
<param>
<name>Threshold</name>
<key>threshold</key>
+ <value>-1</value>
<type>int</type>
</param>
<sink>
diff --git a/gr-digital/grc/digital_simple_framer.xml b/gr-digital/grc/digital_simple_framer.xml
index bbeed32d3e..2d57222f3b 100644
--- a/gr-digital/grc/digital_simple_framer.xml
+++ b/gr-digital/grc/digital_simple_framer.xml
@@ -7,8 +7,8 @@
<block>
<name>Simple Framer</name>
<key>digital_simple_framer</key>
- <import>from gnuradio import gr</import>
- <make>gr.simple_framer($payload_bytesize)</make>
+ <import>from gnuradio import digital</import>
+ <make>digital.simple_framer($payload_bytesize)</make>
<param>
<name>Payload Byte Size</name>
<key>payload_bytesize</key>
diff --git a/gr-digital/include/CMakeLists.txt b/gr-digital/include/CMakeLists.txt
index 06300cc27b..a32f11ed4d 100644
--- a/gr-digital/include/CMakeLists.txt
+++ b/gr-digital/include/CMakeLists.txt
@@ -17,121 +17,18 @@
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-
-########################################################################
-# generate helper scripts to expand templated files
-########################################################################
-include(GrPython)
-
-file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py "
-#!${PYTHON_EXECUTABLE}
-
-import sys, os, re
-sys.path.append('${GR_CORE_PYTHONPATH}')
-os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}'
-os.chdir('${CMAKE_CURRENT_BINARY_DIR}')
-
-if __name__ == '__main__':
- import build_utils
- root, inp = sys.argv[1:3]
- for sig in sys.argv[3:]:
- name = re.sub ('X+', sig, root)
- d = build_utils.standard_dict(name, sig, 'digital')
- build_utils.expand_template(d, inp)
-
-")
-
-macro(expand_h root)
- #make a list of all the generated files
- unset(expanded_files_h)
- foreach(sig ${ARGN})
- string(REGEX REPLACE "X+" ${sig} name ${root})
- list(APPEND expanded_files_h ${CMAKE_CURRENT_BINARY_DIR}/${name}.h)
- endforeach(sig)
-
- #create a command to generate the files
- add_custom_command(
- OUTPUT ${expanded_files_h}
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.h.t
- COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B}
- ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
- ${root} ${root}.h.t ${ARGN}
- )
-
- #install rules for the generated h files
- list(APPEND generated_includes ${expanded_files_h})
-endmacro(expand_h)
-
-########################################################################
-# Invoke macro to generate various sources
-########################################################################
-expand_h(digital_chunks_to_symbols_XX bf bc sf sc if ic)
-
-add_custom_target(digital_generated_includes DEPENDS
- ${generated_includes}
-)
-
########################################################################
# Install header files
########################################################################
install(FILES
- ${generated_includes}
- digital_api.h
- digital_impl_glfsr.h
- digital_impl_mpsk_snr_est.h
- digital_additive_scrambler_bb.h
- digital_binary_slicer_fb.h
- digital_bytes_to_syms.h
- digital_clock_recovery_mm_cc.h
- digital_clock_recovery_mm_ff.h
- digital_cma_equalizer_cc.h
- digital_cpmmod_bc.h
- digital_constellation.h
- digital_constellation_receiver_cb.h
- digital_constellation_decoder_cb.h
- digital_correlate_access_code_bb.h
- digital_correlate_access_code_tag_bb.h
- digital_costas_loop_cc.h
- digital_crc32.h
- digital_descrambler_bb.h
- digital_diff_decoder_bb.h
- digital_diff_encoder_bb.h
- digital_diff_phasor_cc.h
- digital_framer_sink_1.h
- digital_fll_band_edge_cc.h
- digital_glfsr_source_b.h
- digital_glfsr_source_f.h
- digital_gmskmod_bc.h
- digital_lms_dd_equalizer_cc.h
- digital_kurtotic_equalizer_cc.h
- digital_map_bb.h
- digital_metric_type.h
- digital_mpsk_receiver_cc.h
- digital_mpsk_snr_est_cc.h
- digital_ofdm_cyclic_prefixer.h
- digital_ofdm_frame_acquisition.h
- digital_ofdm_frame_sink.h
- digital_ofdm_insert_preamble.h
- digital_ofdm_mapper_bcv.h
- digital_ofdm_sampler.h
- digital_packet_sink.h
- digital_pfb_clock_sync_ccf.h
- digital_pfb_clock_sync_fff.h
- digital_pn_correlator_cc.h
- digital_probe_density_b.h
- digital_probe_mpsk_snr_est_c.h
- digital_scrambler_bb.h
- digital_simple_framer.h
- digital_simple_framer_sync.h
- digital_ofdm_sync_sc_cfb.h
- digital_ofdm_chanest_vcvc.h
digital_crc32_bb.h
digital_ofdm_carrier_allocator_cvc.h
+ digital_ofdm_chanest_vcvc.h
+ digital_ofdm_cyclic_prefixer.h
digital_ofdm_equalizer_base.h
- digital_ofdm_equalizer_static.h
digital_ofdm_equalizer_simpledfe.h
- digital_simple_correlator.h
+ digital_ofdm_equalizer_static.h
+ digital_ofdm_sync_sc_cfb.h
DESTINATION ${GR_INCLUDE_DIR}/gnuradio
COMPONENT "digital_devel"
)
-
diff --git a/gr-digital/include/digital/CMakeLists.txt b/gr-digital/include/digital/CMakeLists.txt
index 1042517294..0531e837d5 100644
--- a/gr-digital/include/digital/CMakeLists.txt
+++ b/gr-digital/include/digital/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2012 Free Software Foundation, Inc.
+# Copyright 2011,2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -22,19 +22,114 @@
########################################################################
include(GrPython)
+file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py "
+#!${PYTHON_EXECUTABLE}
+
+import sys, os, re
+sys.path.append('${GR_CORE_PYTHONPATH}')
+os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}'
+os.chdir('${CMAKE_CURRENT_BINARY_DIR}')
+
+if __name__ == '__main__':
+ import build_utils
+ root, inp = sys.argv[1:3]
+ for sig in sys.argv[3:]:
+ name = re.sub ('X+', sig, root)
+ d = build_utils.standard_dict2(name, sig, 'digital')
+ build_utils.expand_template(d, inp)
+
+")
+
+macro(expand_h root)
+ #make a list of all the generated files
+ unset(expanded_files_h)
+ foreach(sig ${ARGN})
+ string(REGEX REPLACE "X+" ${sig} name ${root})
+ list(APPEND expanded_files_h ${CMAKE_CURRENT_BINARY_DIR}/${name}.h)
+ endforeach(sig)
+
+ #create a command to generate the files
+ add_custom_command(
+ OUTPUT ${expanded_files_h}
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.h.t
+ COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B}
+ ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
+ ${root} ${root}.h.t ${ARGN}
+ )
+
+ #install rules for the generated h files
+ list(APPEND generated_includes ${expanded_files_h})
+endmacro(expand_h)
+
+########################################################################
+# Invoke macro to generate various sources
+#######################################################################
+expand_h(chunks_to_symbols_XX bf bc sf sc if ic)
+
+add_custom_target(digital_generated_includes DEPENDS
+ ${generated_includes}
+)
+
########################################################################
# Install header files
########################################################################
install(FILES
+ ${generated_includes}
+ additive_scrambler_bb.h
api.h
+ binary_slicer_fb.h
+ clock_recovery_mm_cc.h
+ clock_recovery_mm_ff.h
+ cma_equalizer_cc.h
+ constellation.h
+ constellation_decoder_cb.h
+ constellation_receiver_cb.h
+ correlate_access_code_bb.h
+ correlate_access_code_tag_bb.h
+ costas_loop_cc.h
+ cpmmod_bc.h
+ crc32.h
+ descrambler_bb.h
+ diff_decoder_bb.h
+ diff_encoder_bb.h
+ diff_phasor_cc.h
+ fll_band_edge_cc.h
+ framer_sink_1.h
+ glfsr.h
+ glfsr_source_b.h
+ glfsr_source_f.h
+ header_payload_demux.h
+ kurtotic_equalizer_cc.h
+ lfsr.h
+ lms_dd_equalizer_cc.h
+ map_bb.h
+ metric_type.h
+ mpsk_receiver_cc.h
+ mpsk_snr_est.h
+ mpsk_snr_est_cc.h
+ ofdm_cyclic_prefixer.h
+ ofdm_frame_acquisition.h
ofdm_frame_equalizer_vcvc.h
+ ofdm_frame_sink.h
+ ofdm_insert_preamble.h
+ ofdm_mapper_bcv.h
+ ofdm_sampler.h
ofdm_serializer_vcc.h
packet_header_default.h
packet_header_ofdm.h
packet_headergenerator_bb.h
packet_headerparser_b.h
+ packet_sink.h
+ pfb_clock_sync_ccf.h
+ pfb_clock_sync_fff.h
+ pn_correlator_cc.h
+ probe_density_b.h
+ probe_mpsk_snr_est_c.h
+ scrambler_bb.h
+ simple_correlator.h
+ simple_framer.h
+ simple_framer_sync.h
header_payload_demux.h
DESTINATION ${GR_INCLUDE_DIR}/gnuradio/digital
COMPONENT "digital_devel"
)
-
diff --git a/gr-digital/include/digital/additive_scrambler_bb.h b/gr-digital/include/digital/additive_scrambler_bb.h
new file mode 100644
index 0000000000..345bd45dc8
--- /dev/null
+++ b/gr-digital/include/digital/additive_scrambler_bb.h
@@ -0,0 +1,73 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2010,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_DIGITAL_ADDITIVE_SCRAMBLER_BB_H
+#define INCLUDED_DIGITAL_ADDITIVE_SCRAMBLER_BB_H
+
+#include <digital/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace digital {
+
+ /*!
+ * \ingroup coding_blk
+ *
+ * Scramble an input stream using an LFSR. This block works on the
+ * LSB only of the input data stream, i.e., on an "unpacked
+ * binary" stream, and produces the same format on its output.
+ */
+ class DIGITAL_API additive_scrambler_bb : virtual public gr_sync_block
+ {
+ public:
+ // gr::digital::additive_scrambler_bb::sptr
+ typedef boost::shared_ptr<additive_scrambler_bb> sptr;
+
+ /*!
+ * \brief Create additive scrambler.
+ *
+ * Scramble an input stream using an LFSR. This block works on
+ * the LSB only of the input data stream, i.e., on an "unpacked
+ * binary" stream, and produces the same format on its output.
+ *
+ * \param mask Polynomial mask for LFSR
+ * \param seed Initial shift register contents
+ * \param len Shift register length
+ * \param count Number of bits after which shift register is reset, 0=never
+ *
+ * The scrambler works by XORing the incoming bit stream by the
+ * output of the LFSR. Optionally, after 'count' bits have been
+ * processed, the shift register is reset to the seed value.
+ * This allows processing fixed length vectors of samples.
+ */
+ static sptr make(int mask, int seed, int len, int count=0);
+
+ virtual int mask() const = 0;
+ virtual int seed() const = 0;
+ virtual int len() const = 0;
+ virtual int count() const = 0;
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_DIGITAL_ADDITIVE_SCRAMBLER_BB_H */
diff --git a/gr-digital/include/digital/api.h b/gr-digital/include/digital/api.h
index 0912f7e0d4..d45ace13f2 100644
--- a/gr-digital/include/digital/api.h
+++ b/gr-digital/include/digital/api.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2012 Free Software Foundation, Inc.
+ * Copyright 2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
diff --git a/gr-digital/include/digital_binary_slicer_fb.h b/gr-digital/include/digital/binary_slicer_fb.h
index 35a7380fb9..f56b48a633 100644
--- a/gr-digital/include/digital_binary_slicer_fb.h
+++ b/gr-digital/include/digital/binary_slicer_fb.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2006,2011 Free Software Foundation, Inc.
+ * Copyright 2006,2011,2012 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -23,31 +23,33 @@
#ifndef INCLUDED_DIGITAL_BINARY_SLICER_FB_H
#define INCLUDED_DIGITAL_BINARY_SLICER_FB_H
-#include <digital_api.h>
+#include <digital/api.h>
#include <gr_sync_block.h>
-class digital_binary_slicer_fb;
-typedef boost::shared_ptr<digital_binary_slicer_fb> digital_binary_slicer_fb_sptr;
+namespace gr {
+ namespace digital {
+
+ /*!
+ * \brief slice float binary symbol outputting 1 bit output
+ * \ingroup converter_blk
+ * \ingroup digital
+ *
+ * x < 0 --> 0
+ * x >= 0 --> 1
+ */
+ class DIGITAL_API binary_slicer_fb : virtual public gr_sync_block
+ {
+ public:
+ // gr::digital::binary_slicer_fb::sptr
+ typedef boost::shared_ptr<binary_slicer_fb> sptr;
-DIGITAL_API digital_binary_slicer_fb_sptr digital_make_binary_slicer_fb ();
+ /*!
+ * \brief Make binary symbol slicer block.
+ */
+ static sptr make();
+ };
-/*!
- * \brief slice float binary symbol outputting 1 bit output
- * \ingroup converter_blk
- * \ingroup digital
- *
- * x < 0 --> 0
- * x >= 0 --> 1
- */
-class DIGITAL_API digital_binary_slicer_fb : public gr_sync_block
-{
- friend DIGITAL_API digital_binary_slicer_fb_sptr digital_make_binary_slicer_fb ();
- digital_binary_slicer_fb ();
-
- public:
- int work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
+ } /* namespace digital */
+} /* namespace gr */
-#endif
+#endif /* INCLUDED_DIGITAL_BINARY_SLICER_FB_H */
diff --git a/gr-digital/include/digital/chunks_to_symbols_XX.h.t b/gr-digital/include/digital/chunks_to_symbols_XX.h.t
new file mode 100644
index 0000000000..6ad10ae261
--- /dev/null
+++ b/gr-digital/include/digital/chunks_to_symbols_XX.h.t
@@ -0,0 +1,76 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+/* @WARNING@ */
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <digital/api.h>
+#include <gr_sync_interpolator.h>
+
+namespace gr {
+ namespace digital {
+
+ /*!
+ * \brief Map a stream of symbol indexes (unpacked bytes or
+ * shorts) to stream of float or complex constellation points in D
+ * dimensions (D = 1 by default)
+ * \ingroup converter_blk
+ *
+ * input: stream of @I_TYPE@; output: stream of @O_TYPE@
+ *
+ * out[n D + k] = symbol_table[in[n] D + k], k=0,1,...,D-1
+ *
+ * The combination of gr::blocks::packed_to_unpacked_XX followed by
+ * digital_chunks_to_symbols_XY handles the general case of mapping
+ * from a stream of bytes or shorts into arbitrary float
+ * or complex symbols.
+ *
+ * \sa gr::blocks::packed_to_unpacked_bb, gr::blocks::unpacked_to_packed_bb,
+ * \sa gr::blocks::packed_to_unpacked_ss, gr::blocks::unpacked_to_packed_ss,
+ * \sa gr::digital::chunks_to_symbols_bf, gr::digital::chunks_to_symbols_bc.
+ * \sa gr::digital::chunks_to_symbols_sf, gr::digital::chunks_to_symbols_sc.
+ */
+
+ class DIGITAL_API @NAME@ : virtual public gr_sync_interpolator
+ {
+ public:
+ // gr::digital::@BASE_NAME@::sptr
+ typedef boost::shared_ptr<@BASE_NAME@> sptr;
+
+ /*!
+ * Make a chunks-to-symbols block.
+ *
+ * \param symbol_table: list that maps chunks to symbols.
+ * \param D: dimension of table.
+ */
+ static sptr make(const std::vector<@O_TYPE@> &symbol_table, const int D = 1);
+
+ virtual int D() const = 0;
+ virtual std::vector<@O_TYPE@> symbol_table() const = 0;
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-digital/include/digital/clock_recovery_mm_cc.h b/gr-digital/include/digital/clock_recovery_mm_cc.h
new file mode 100644
index 0000000000..ec121c0fdf
--- /dev/null
+++ b/gr-digital/include/digital/clock_recovery_mm_cc.h
@@ -0,0 +1,81 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2011,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_DIGITAL_CLOCK_RECOVERY_MM_CC_H
+#define INCLUDED_DIGITAL_CLOCK_RECOVERY_MM_CC_H
+
+#include <digital/api.h>
+#include <gr_block.h>
+
+namespace gr {
+ namespace digital {
+
+ /*!
+ * \brief Mueller and Müller (M&M) based clock recovery block with complex input, complex output.
+ * \ingroup sync_blk
+ * \ingroup digital
+ *
+ * This implements the Mueller and Müller (M&M) discrete-time
+ * error-tracking synchronizer.
+ *
+ * The complex version here is based on: Modified Mueller and
+ * Muller clock recovery circuit:
+ *
+ * G. R. Danesfahani, T.G. Jeans, "Optimisation of modified Mueller
+ * and Muller algorithm," Electronics Letters, Vol. 31, no. 13, 22
+ * June 1995, pp. 1032 - 1033.
+ */
+ class DIGITAL_API clock_recovery_mm_cc : virtual public gr_block
+ {
+ public:
+ // gr::digital::clock_recovery_mm_cc::sptr
+ typedef boost::shared_ptr<clock_recovery_mm_cc> sptr;
+
+ /*!
+ * Make a M&M clock recovery block.
+ *
+ * \param omega Initial estimate of samples per symbol
+ * \param gain_omega Gain setting for omega update loop
+ * \param mu Initial estimate of phase of sample
+ * \param gain_mu Gain setting for mu update loop
+ * \param omega_relative_limit limit on omega
+ */
+ static sptr make(float omega, float gain_omega,
+ float mu, float gain_mu,
+ float omega_relative_limit);
+
+ virtual float mu() const = 0;
+ virtual float omega() const = 0;
+ virtual float gain_mu() const = 0;
+ virtual float gain_omega() const = 0;
+
+ virtual void set_verbose(bool verbose) = 0;
+ virtual void set_gain_mu (float gain_mu) = 0;
+ virtual void set_gain_omega (float gain_omega) = 0;
+ virtual void set_mu (float mu) = 0;
+ virtual void set_omega (float omega) = 0;
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_DIGITAL_CLOCK_RECOVERY_MM_CC_H */
diff --git a/gr-digital/include/digital/clock_recovery_mm_ff.h b/gr-digital/include/digital/clock_recovery_mm_ff.h
new file mode 100644
index 0000000000..556fe0a876
--- /dev/null
+++ b/gr-digital/include/digital/clock_recovery_mm_ff.h
@@ -0,0 +1,78 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2011,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_DIGITAL_CLOCK_RECOVERY_MM_FF_H
+#define INCLUDED_DIGITAL_CLOCK_RECOVERY_MM_FF_H
+
+#include <digital/api.h>
+#include <gr_block.h>
+
+namespace gr {
+ namespace digital {
+
+ /*!
+ * \brief Mueller and Müller (M&M) based clock recovery block with float input, float output.
+ * \ingroup sync_blk
+ * \ingroup digital
+ *
+ * This implements the Mueller and Müller (M&M) discrete-time
+ * error-tracking synchronizer.
+ *
+ * See "Digital Communication Receivers: Synchronization, Channel
+ * Estimation and Signal Processing" by Heinrich Meyr, Marc
+ * Moeneclaey, & Stefan Fechtel. ISBN 0-471-50275-8.
+ */
+ class DIGITAL_API clock_recovery_mm_ff : virtual public gr_block
+ {
+ public:
+ // gr::digital::clock_recovery_mm_ff::sptr
+ typedef boost::shared_ptr<clock_recovery_mm_ff> sptr;
+
+ /*!
+ * Make a M&M clock recovery block.
+ *
+ * \param omega Initial estimate of samples per symbol
+ * \param gain_omega Gain setting for omega update loop
+ * \param mu Initial estimate of phase of sample
+ * \param gain_mu Gain setting for mu update loop
+ * \param omega_relative_limit limit on omega
+ */
+ static sptr make(float omega, float gain_omega,
+ float mu, float gain_mu,
+ float omega_relative_limit);
+
+ virtual float mu() const = 0;
+ virtual float omega() const = 0;
+ virtual float gain_mu() const = 0;
+ virtual float gain_omega() const = 0;
+
+ virtual void set_verbose(bool verbose) = 0;
+ virtual void set_gain_mu (float gain_mu) = 0;
+ virtual void set_gain_omega (float gain_omega) = 0;
+ virtual void set_mu (float mu) = 0;
+ virtual void set_omega (float omega) = 0;
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_DIGITAL_CLOCK_RECOVERY_MM_FF_H */
diff --git a/gr-digital/include/digital/cma_equalizer_cc.h b/gr-digital/include/digital/cma_equalizer_cc.h
new file mode 100644
index 0000000000..60c58db1e1
--- /dev/null
+++ b/gr-digital/include/digital/cma_equalizer_cc.h
@@ -0,0 +1,75 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_DIGITAL_CMA_EQUALIZER_CC_H
+#define INCLUDED_DIGITAL_CMA_EQUALIZER_CC_H
+
+#include <digital/api.h>
+#include <gr_sync_decimator.h>
+
+namespace gr {
+ namespace digital {
+
+ /*!
+ * \brief Implements constant modulus adaptive filter on complex stream
+ * \ingroup eq_blk
+ * \ingroup digital
+ *
+ * The error value and tap update equations (for p=2) can be found in:
+ *
+ * D. Godard, "Self-Recovering Equalization and Carrier Tracking
+ * in Two-Dimensional Data Communication Systems," IEEE
+ * Transactions on Communications, Vol. 28, No. 11, pp. 1867 -
+ * 1875, 1980.
+ */
+ class DIGITAL_API cma_equalizer_cc: virtual public gr_sync_decimator
+ {
+ protected:
+ virtual gr_complex error(const gr_complex &out) = 0;
+ virtual void update_tap(gr_complex &tap, const gr_complex &in) = 0;
+
+ public:
+ // gr::digital::cma_equalizer_cc::sptr
+ typedef boost::shared_ptr<cma_equalizer_cc> sptr;
+
+ /*!
+ * Make a CMA Equalizer block
+ *
+ * \param num_taps Numer of taps in the equalizer (channel size)
+ * \param modulus Modulus of the modulated signals
+ * \param mu Gain of the update loop
+ * \param sps Number of samples per symbol of the input signal
+ */
+ static sptr make(int num_taps, float modulus, float mu, int sps);
+
+ virtual void set_taps(const std::vector<gr_complex> &taps) = 0;
+ virtual std::vector<gr_complex> taps() const = 0;
+ virtual float gain() const = 0;
+ virtual void set_gain(float mu) = 0;
+ virtual float modulus() const = 0;
+ virtual void set_modulus(float mod) = 0;
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_DIGITAL_CMA_EQUALIZER_CC_H */
diff --git a/gr-digital/include/digital/constellation.h b/gr-digital/include/digital/constellation.h
new file mode 100644
index 0000000000..a7a2ec2023
--- /dev/null
+++ b/gr-digital/include/digital/constellation.h
@@ -0,0 +1,477 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2010-2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_DIGITAL_CONSTELLATION_H
+#define INCLUDED_DIGITAL_CONSTELLATION_H
+
+#include <digital/api.h>
+#include <digital/metric_type.h>
+#include <boost/enable_shared_from_this.hpp>
+#include <gr_complex.h>
+#include <vector>
+
+namespace gr {
+ namespace digital {
+
+ /************************************************************/
+ /* constellation */
+ /* */
+ /* Base class defining interface. */
+ /************************************************************/
+
+ class constellation;
+ typedef boost::shared_ptr<constellation> constellation_sptr;
+
+ /*!
+ * \brief An abstracted constellation object
+ * \ingroup digital
+ *
+ * The constellation objects hold the necessary information to pass
+ * around constellation information for modulators and
+ * demodulators. These objects contain the mapping between the bits
+ * and the constellation points used to represent them as well as
+ * methods for slicing the symbol space. Various implementations are
+ * possible for efficiency and ease of use.
+ *
+ * Standard constellations (BPSK, QPSK, QAM, etc) can be inherited
+ * from this class and overloaded to perform optimized slicing and
+ * constellation mappings.
+ */
+ class DIGITAL_API constellation
+ : public boost::enable_shared_from_this<constellation>
+ {
+ public:
+ constellation(std::vector<gr_complex> constell,
+ std::vector<int> pre_diff_code,
+ unsigned int rotational_symmetry,
+ unsigned int dimensionality);
+ constellation();
+ ~constellation();
+
+ //! Returns the constellation points for a symbol value
+ void map_to_points(unsigned int value, gr_complex *points);
+ std::vector<gr_complex> map_to_points_v(unsigned int value);
+
+ //! Returns the constellation point that matches best.
+ virtual unsigned int decision_maker(const gr_complex *sample) = 0;
+ //! Takes a vector rather than a pointer. Better for SWIG wrapping.
+ unsigned int decision_maker_v(std::vector<gr_complex> sample);
+ //! Also calculates the phase error.
+ unsigned int decision_maker_pe(const gr_complex *sample, float *phase_error);
+ //! Calculates distance.
+ //unsigned int decision_maker_e(const gr_complex *sample, float *error);
+
+ //! Calculates metrics for all points in the constellation.
+ //! For use with the viterbi algorithm.
+ virtual void calc_metric(const gr_complex *sample, float *metric, gr::digital::trellis_metric_type_t type);
+ virtual void calc_euclidean_metric(const gr_complex *sample, float *metric);
+ virtual void calc_hard_symbol_metric(const gr_complex *sample, float *metric);
+
+ //! Returns the set of points in this constellation.
+ std::vector<gr_complex> points() { return d_constellation;}
+ //! Returns the vector of points in this constellation.
+ //! Raise error if dimensionality is not one.
+ std::vector<gr_complex> s_points();
+ //! Returns a vector of vectors of points.
+ std::vector<std::vector<gr_complex> > v_points();
+ //! Whether to apply an encoding before doing differential encoding. (e.g. gray coding)
+ bool apply_pre_diff_code() { return d_apply_pre_diff_code;}
+ //! Whether to apply an encoding before doing differential encoding. (e.g. gray coding)
+ void set_pre_diff_code(bool a) { d_apply_pre_diff_code = a;}
+ //! Returns the encoding to apply before differential encoding.
+ std::vector<int> pre_diff_code() { return d_pre_diff_code;}
+ //! Returns the order of rotational symmetry.
+ unsigned int rotational_symmetry() { return d_rotational_symmetry;}
+ //! Returns the number of complex numbers in a single symbol.
+ unsigned int dimensionality() {return d_dimensionality;}
+
+ unsigned int bits_per_symbol()
+ {
+ return floor(log(double(d_constellation.size()))/d_dimensionality/log(2.0));
+ }
+
+ unsigned int arity()
+ {
+ return d_arity;
+ }
+
+ constellation_sptr base()
+ {
+ return shared_from_this();
+ }
+
+ protected:
+ std::vector<gr_complex> d_constellation;
+ std::vector<int> d_pre_diff_code;
+ bool d_apply_pre_diff_code;
+ unsigned int d_rotational_symmetry;
+ unsigned int d_dimensionality;
+ unsigned int d_arity;
+ //! The factor by which the user given constellation points were
+ //! scaled by to achieve an average amplitude of 1.
+ float d_scalefactor;
+
+ float get_distance(unsigned int index, const gr_complex *sample);
+ unsigned int get_closest_point(const gr_complex *sample);
+ void calc_arity();
+ };
+
+ /************************************************************/
+ /* constellation_calcdist */
+ /* */
+ /************************************************************/
+
+ /*! \brief Calculate Euclidian distance for any constellation
+ * \ingroup digital
+ *
+ * Constellation which calculates the distance to each point in the
+ * constellation for decision making. Inefficient for large
+ * constellations.
+ */
+ class DIGITAL_API constellation_calcdist
+ : public constellation
+ {
+ public:
+ typedef boost::shared_ptr<constellation_calcdist> sptr;
+
+ // public constructor
+ static sptr make(std::vector<gr_complex> constell,
+ std::vector<int> pre_diff_code,
+ unsigned int rotational_symmetry,
+ unsigned int dimensionality);
+
+ unsigned int decision_maker(const gr_complex *sample);
+ // void calc_metric(gr_complex *sample, float *metric, trellis_metric_type_t type);
+ // void calc_euclidean_metric(gr_complex *sample, float *metric);
+ // void calc_hard_symbol_metric(gr_complex *sample, float *metric);
+
+ protected:
+ constellation_calcdist(std::vector<gr_complex> constell,
+ std::vector<int> pre_diff_code,
+ unsigned int rotational_symmetry,
+ unsigned int dimensionality);
+ };
+
+
+ /************************************************************/
+ /*! constellation_sector */
+ /************************************************************/
+
+ /*!
+ * \brief Sectorized digital constellation
+ * \ingroup digital
+ *
+ * Constellation space is divided into sectors. Each sector is
+ * associated with the nearest constellation point.
+ *
+ */
+ class DIGITAL_API constellation_sector : public constellation
+ {
+ public:
+
+ constellation_sector(std::vector<gr_complex> constell,
+ std::vector<int> pre_diff_code,
+ unsigned int rotational_symmetry,
+ unsigned int dimensionality,
+ unsigned int n_sectors);
+
+ ~constellation_sector();
+
+ unsigned int decision_maker(const gr_complex *sample);
+
+ protected:
+ virtual unsigned int get_sector(const gr_complex *sample) = 0;
+ virtual unsigned int calc_sector_value(unsigned int sector) = 0;
+ void find_sector_values();
+
+ unsigned int n_sectors;
+
+ private:
+ std::vector<int> sector_values;
+ };
+
+ /************************************************************/
+ /* constellation_rect */
+ /************************************************************/
+
+ /*!
+ * \brief Rectangular digital constellation
+ * \ingroup digital
+ *
+ * Only implemented for 1-(complex)dimensional constellation.
+ *
+ * Constellation space is divided into rectangular sectors. Each
+ * sector is associated with the nearest constellation point.
+ *
+ * Works well for square QAM.
+ *
+ * Works for any generic constellation provided sectors are not
+ * too large.
+ */
+
+
+ class DIGITAL_API constellation_rect
+ : public constellation_sector
+ {
+ public:
+ typedef boost::shared_ptr<constellation_rect> sptr;
+
+ // public constructor
+ static constellation_rect::sptr make(std::vector<gr_complex> constell,
+ std::vector<int> pre_diff_code,
+ unsigned int rotational_symmetry,
+ unsigned int real_sectors,
+ unsigned int imag_sectors,
+ float width_real_sectors,
+ float width_imag_sectors);
+ ~constellation_rect();
+
+ protected:
+
+ constellation_rect(std::vector<gr_complex> constell,
+ std::vector<int> pre_diff_code,
+ unsigned int rotational_symmetry,
+ unsigned int real_sectors,
+ unsigned int imag_sectors,
+ float width_real_sectors,
+ float width_imag_sectors);
+
+ unsigned int get_sector(const gr_complex *sample);
+
+ unsigned int calc_sector_value(unsigned int sector);
+
+ private:
+ unsigned int n_real_sectors;
+ unsigned int n_imag_sectors;
+ float d_width_real_sectors;
+ float d_width_imag_sectors;
+ };
+
+
+ /************************************************************/
+ /* constellation_expl_rect */
+ /************************************************************/
+
+ /*!
+ * \brief Rectangular digital constellation
+ * \ingroup digital
+ *
+ * Only implemented for 1-(complex)dimensional constellation.
+ *
+ * Constellation space is divided into rectangular sectors. Each
+ * sector is associated with the nearest constellation point.
+ *
+ * This class is different from constellation_rect in that the
+ * mapping from sector to constellation point is explicitly passed
+ * into the constructor as sector_values. Usually we do not need
+ * this, since we want each sector to be automatically mapped to
+ * the closest constellation point, however sometimes it's nice to
+ * have the flexibility.
+ */
+ class DIGITAL_API constellation_expl_rect
+ : public constellation_rect
+ {
+ public:
+ typedef boost::shared_ptr<constellation_expl_rect> sptr;
+
+ static sptr make(std::vector<gr_complex> constellation,
+ std::vector<int> pre_diff_code,
+ unsigned int rotational_symmetry,
+ unsigned int real_sectors,
+ unsigned int imag_sectors,
+ float width_real_sectors,
+ float width_imag_sectors,
+ std::vector<unsigned int> sector_values);
+ ~constellation_expl_rect();
+
+ protected:
+ constellation_expl_rect(std::vector<gr_complex> constellation,
+ std::vector<int> pre_diff_code,
+ unsigned int rotational_symmetry,
+ unsigned int real_sectors,
+ unsigned int imag_sectors,
+ float width_real_sectors,
+ float width_imag_sectors,
+ std::vector<unsigned int> sector_values);
+
+ unsigned int calc_sector_value (unsigned int sector) {
+ return d_sector_values[sector];
+ }
+
+ private:
+ std::vector<unsigned int> d_sector_values;
+ };
+
+ /************************************************************/
+ /* constellation_psk */
+ /************************************************************/
+
+ /*!
+ * \brief constellation_psk
+ * \ingroup digital
+ *
+ * Constellation space is divided into pie slices sectors.
+ *
+ * Each slice is associated with the nearest constellation point.
+ *
+ * Works well for PSK but nothing else.
+ *
+ * Assumes that there is a constellation point at 1.x
+ */
+ class DIGITAL_API constellation_psk : public constellation_sector
+ {
+ public:
+ typedef boost::shared_ptr<constellation_psk> sptr;
+
+ // public constructor
+ static sptr make(std::vector<gr_complex> constell,
+ std::vector<int> pre_diff_code,
+ unsigned int n_sectors);
+
+ ~constellation_psk();
+
+ protected:
+ unsigned int get_sector(const gr_complex *sample);
+
+ unsigned int calc_sector_value(unsigned int sector);
+
+ constellation_psk(std::vector<gr_complex> constell,
+ std::vector<int> pre_diff_code,
+ unsigned int n_sectors);
+ };
+
+
+ /************************************************************/
+ /* constellation_bpsk */
+ /* */
+ /* Only works for BPSK. */
+ /* */
+ /************************************************************/
+
+ /*!
+ * \brief Digital constellation for BPSK
+ * \ingroup digital
+ */
+ class DIGITAL_API constellation_bpsk : public constellation
+ {
+ public:
+ typedef boost::shared_ptr<constellation_bpsk> sptr;
+
+ // public constructor
+ static sptr make();
+
+ ~constellation_bpsk();
+
+ unsigned int decision_maker(const gr_complex *sample);
+
+ protected:
+ constellation_bpsk();
+ };
+
+
+ /************************************************************/
+ /* constellation_qpsk */
+ /* */
+ /* Only works for QPSK. */
+ /* */
+ /************************************************************/
+
+ /*!
+ * \brief Digital constellation for QPSK
+ * \ingroup digital
+ */
+ class DIGITAL_API constellation_qpsk : public constellation
+ {
+ public:
+ typedef boost::shared_ptr<constellation_qpsk> sptr;
+
+ // public constructor
+ static sptr make();
+
+ ~constellation_qpsk();
+
+ unsigned int decision_maker(const gr_complex *sample);
+
+ protected:
+ constellation_qpsk();
+ };
+
+
+ /************************************************************/
+ /* constellation_dqpsk */
+ /* */
+ /* Works with differential encoding; slower decisions. */
+ /* */
+ /************************************************************/
+
+ /*!
+ * \brief Digital constellation for DQPSK
+ * \ingroup digital
+ */
+ class DIGITAL_API constellation_dqpsk : public constellation
+ {
+ public:
+ typedef boost::shared_ptr<constellation_dqpsk> sptr;
+
+ // public constructor
+ static sptr make();
+
+ ~constellation_dqpsk();
+
+ unsigned int decision_maker(const gr_complex *sample);
+
+ protected:
+ constellation_dqpsk();
+ };
+
+
+ /************************************************************/
+ /* constellation_8psk */
+ /* */
+ /* Only works for 8PSK. */
+ /* */
+ /************************************************************/
+
+ /*!
+ * \brief Digital constellation for 8PSK
+ * \ingroup digital
+ */
+ class DIGITAL_API constellation_8psk : public constellation
+ {
+ public:
+ typedef boost::shared_ptr<constellation_8psk> sptr;
+
+ // public constructor
+ static sptr make();
+
+ ~constellation_8psk();
+
+ unsigned int decision_maker(const gr_complex *sample);
+
+ protected:
+ constellation_8psk();
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_DIGITAL_CONSTELLATION_H */
diff --git a/gr-digital/include/digital/constellation_decoder_cb.h b/gr-digital/include/digital/constellation_decoder_cb.h
new file mode 100644
index 0000000000..01b35db905
--- /dev/null
+++ b/gr-digital/include/digital/constellation_decoder_cb.h
@@ -0,0 +1,62 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_DIGITAL_CONSTELLATION_DECODER_CB_H
+#define INCLUDED_DIGITAL_CONSTELLATION_DECODER_CB_H
+
+#include <digital/api.h>
+#include <digital/constellation.h>
+#include <gr_block.h>
+
+namespace gr {
+ namespace digital {
+
+ /*!
+ * \brief Constellation Decoder
+ * \ingroup coding_blk
+ * \ingroup digital
+ *
+ * Decode a constellation's points from a complex space to
+ * (unpacked) bits based on the map of the \p consetllation
+ * object.
+ */
+ class DIGITAL_API constellation_decoder_cb
+ : virtual public gr_block
+ {
+ public:
+ // gr::digital::constellation_decoder_cb::sptr
+ typedef boost::shared_ptr<constellation_decoder_cb> sptr;
+
+ /*!
+ * \brief Make constellation decoder block.
+ *
+ * \param constellation A constellation derived from class
+ * 'constellation'. Use base() method to get a shared pointer to
+ * this base class type.
+ */
+ static sptr make(constellation_sptr constellation);
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_DIGITAL_CONSTELLATION_DECODER_CB_H */
diff --git a/gr-digital/include/digital/constellation_receiver_cb.h b/gr-digital/include/digital/constellation_receiver_cb.h
new file mode 100644
index 0000000000..b1c415ea09
--- /dev/null
+++ b/gr-digital/include/digital/constellation_receiver_cb.h
@@ -0,0 +1,93 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_DIGITAL_CONSTELLATION_RECEIVER_CB_H
+#define INCLUDED_DIGITAL_CONSTELLATION_RECEIVER_CB_H
+
+#include <digital/api.h>
+#include <digital/constellation.h>
+#include <gr_block.h>
+
+namespace gr {
+ namespace digital {
+
+ /*!
+ * \brief This block takes care of receiving generic modulated signals
+ * through phase, frequency, and symbol synchronization.
+ * \ingroup sync_blk
+ * \ingroup demod_blk
+ * \ingroup digital
+ *
+ * This block takes care of receiving generic modulated signals
+ * through phase, frequency, and symbol synchronization. It
+ * performs carrier frequency and phase locking as well as symbol
+ * timing recovery.
+ *
+ * The phase and frequency synchronization are based on a Costas
+ * loop that finds the error of the incoming signal point compared
+ * to its nearest constellation point. The frequency and phase of
+ * the NCO are updated according to this error.
+ *
+ * The symbol synchronization is done using a modified Mueller and
+ * Muller circuit from the paper:
+ *
+ * "G. R. Danesfahani, T.G. Jeans, "Optimisation of modified
+ * Mueller and Muller algorithm," Electronics Letters, Vol. 31,
+ * no. 13, 22 June 1995, pp. 1032 - 1033."
+ *
+ * This circuit interpolates the downconverted sample (using the
+ * NCO developed by the Costas loop) every mu samples, then it
+ * finds the sampling error based on this and the past symbols and
+ * the decision made on the samples. Like the phase error
+ * detector, there are optimized decision algorithms for BPSK and
+ * QPKS, but 8PSK uses another brute force computation against all
+ * possible symbols. The modifications to the M&M used here reduce
+ * self-noise.
+ */
+ class DIGITAL_API constellation_receiver_cb
+ : virtual public gr_block
+ {
+ public:
+ // gr::digital::constellation_receiver_cb::sptr
+ typedef boost::shared_ptr<constellation_receiver_cb> sptr;
+
+ /*!
+ * \brief Constructor to synchronize incoming M-PSK symbols
+ *
+ * \param constellation constellation of points for generic modulation
+ * \param loop_bw Loop bandwidth of the Costas Loop (~ 2pi/100)
+ * \param fmin minimum normalized frequency value the loop can achieve
+ * \param fmax maximum normalized frequency value the loop can achieve
+ *
+ * The constructor chooses which phase detector and decision
+ * maker to use in the work loop based on the value of M.
+ */
+ static sptr make(constellation_sptr constellation,
+ float loop_bw, float fmin, float fmax);
+
+ virtual void phase_error_tracking(float phase_error) = 0;
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_DIGITAL_CONSTELLATION_RECEIVER_CB_H */
diff --git a/gr-digital/include/digital/correlate_access_code_bb.h b/gr-digital/include/digital/correlate_access_code_bb.h
new file mode 100644
index 0000000000..c2ef788a37
--- /dev/null
+++ b/gr-digital/include/digital/correlate_access_code_bb.h
@@ -0,0 +1,74 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,2006,2011,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_DIGITAL_CORRELATE_ACCESS_CODE_BB_H
+#define INCLUDED_DIGITAL_CORRELATE_ACCESS_CODE_BB_H
+
+#include <digital/api.h>
+#include <gr_sync_block.h>
+#include <string>
+
+namespace gr {
+ namespace digital {
+
+ /*!
+ * \brief Examine input for specified access code, one bit at a time.
+ * \ingroup sync_blk
+ * \ingroup digital
+ *
+ * input: stream of bits, 1 bit per input byte (data in LSB)
+ * output: stream of bits, 2 bits per output byte (data in LSB, flag in next higher bit)
+ *
+ * Each output byte contains two valid bits, the data bit, and the
+ * flag bit. The LSB (bit 0) is the data bit, and is the original
+ * input data, delayed 64 bits. Bit 1 is the flag bit and is 1 if
+ * the corresponding data bit is the first data bit following the
+ * access code. Otherwise the flag bit is 0.
+ */
+ class DIGITAL_API correlate_access_code_bb : virtual public gr_sync_block
+ {
+ public:
+ // gr::digital::correlate_access_code_bb::sptr
+ typedef boost::shared_ptr<correlate_access_code_bb> sptr;
+
+ /*!
+ * Make a correlate_access_code block.
+ *
+ * \param access_code is represented with 1 byte per bit,
+ * e.g., "010101010111000100"
+ * \param threshold maximum number of bits that may be wrong
+ */
+ static sptr make(const std::string &access_code, int threshold);
+
+ /*!
+ * Set a new access code.
+ *
+ * \param access_code is represented with 1 byte per bit,
+ * e.g., "010101010111000100"
+ */
+ virtual bool set_access_code(const std::string &access_code) = 0;
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_DIGITAL_CORRELATE_ACCESS_CODE_BB_H */
diff --git a/gr-digital/include/digital/correlate_access_code_tag_bb.h b/gr-digital/include/digital/correlate_access_code_tag_bb.h
new file mode 100644
index 0000000000..0c51f3aead
--- /dev/null
+++ b/gr-digital/include/digital/correlate_access_code_tag_bb.h
@@ -0,0 +1,70 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,2006,2011,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_DIGITAL_CORRELATE_ACCESS_CODE_TAG_BB_H
+#define INCLUDED_DIGITAL_CORRELATE_ACCESS_CODE_TAG_BB_H
+
+#include <digital/api.h>
+#include <gr_sync_block.h>
+#include <string>
+
+namespace gr {
+ namespace digital {
+
+ /*!
+ * \brief Examine input for specified access code, one bit at a time.
+ * \ingroup sync_blk
+ *
+ * input: stream of bits, 1 bit per input byte (data in LSB)
+ * output: unaltered stream of bits (plus tags)
+ *
+ * This block annotates the input stream with tags. The tags have
+ * key name [tag_name], specified in the constructor. Used for
+ * searching an input data stream for preambles, etc.
+ */
+ class DIGITAL_API correlate_access_code_tag_bb : virtual public gr_sync_block
+ {
+ public:
+ // gr::digital::correlate_access_code_tag_bb::sptr
+ typedef boost::shared_ptr<correlate_access_code_tag_bb> sptr;
+
+ /*!
+ * \param access_code is represented with 1 byte per bit,
+ * e.g., "010101010111000100"
+ * \param threshold maximum number of bits that may be wrong
+ * \param tag_name key of the tag inserted into the tag stream
+ */
+ static sptr make(const std::string &access_code,
+ int threshold,
+ const std::string &tag_name);
+
+ /*!
+ * \param access_code is represented with 1 byte per bit,
+ * e.g., "010101010111000100"
+ */
+ virtual bool set_access_code(const std::string &access_code) = 0;
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_DIGITAL_CORRELATE_ACCESS_CODE_TAG_BB_H */
diff --git a/gr-digital/include/digital/costas_loop_cc.h b/gr-digital/include/digital/costas_loop_cc.h
new file mode 100644
index 0000000000..bad6de9363
--- /dev/null
+++ b/gr-digital/include/digital/costas_loop_cc.h
@@ -0,0 +1,75 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,2011,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_DIGITAL_COSTAS_LOOP_CC_H
+#define INCLUDED_DIGITAL_COSTAS_LOOP_CC_H
+
+#include <digital/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace digital {
+
+ /*!
+ * \brief A Costas loop carrier recovery module.
+ * \ingroup sync_blk
+ * \ingroup digital
+ *
+ * The Costas loop locks to the center frequency of a signal and
+ * downconverts it to baseband. The second (order=2) order loop
+ * is used for BPSK where the real part of the output signal is
+ * the baseband BPSK signal and the imaginary part is the error
+ * signal. When order=4, it can be used for quadrature
+ * modulations where both I and Q (real and imaginary) are
+ * outputted.
+ *
+ * More details can be found online:
+ *
+ * J. Feigin, "Practical Costas loop design: Designing a simple
+ * and inexpensive BPSK Costas loop carrier recovery circuit," RF
+ * signal processing, pp. 20-36, 2002.
+ *
+ * http://rfdesign.com/images/archive/0102Feigin20.pdf
+ *
+ * The Costas loop can have two output streams:
+ * stream 1 is the baseband I and Q;
+ * stream 2 is the normalized frequency of the loop
+ */
+ class DIGITAL_API costas_loop_cc : virtual public gr_sync_block
+ {
+ public:
+ // gr::digital::costas_loop_cc::sptr
+ typedef boost::shared_ptr<costas_loop_cc> sptr;
+
+ /*!
+ * Make a Costas loop carrier recovery block.
+ *
+ * \param loop_bw internal 2nd order loop bandwidth (~ 2pi/100)
+ * \param order the loop order, either 2, 4, or 8
+ */
+ static sptr make(float loop_bw, int order);
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_DIGITAL_COSTAS_LOOP_CC_H */
diff --git a/gr-digital/include/digital/cpmmod_bc.h b/gr-digital/include/digital/cpmmod_bc.h
new file mode 100644
index 0000000000..7d91915cdd
--- /dev/null
+++ b/gr-digital/include/digital/cpmmod_bc.h
@@ -0,0 +1,118 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2010,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_DIGITAL_CPMMOD_BC_H
+#define INCLUDED_DIGITAL_CPMMOD_BC_H
+
+#include <digital/api.h>
+#include <gr_hier_block2.h>
+#include <analog/cpm.h>
+
+namespace gr {
+ namespace digital {
+
+ /*!
+ * \brief Generic CPM modulator
+ *
+ * \ingroup modulation_blk
+ * \ingroup digital
+ *
+ * Examples:
+ * - Setting h = 0.5, L = 1, type = LREC yields MSK.
+ * - Setting h = 0.5, type = GAUSSIAN and beta = 0.3 yields GMSK
+ * as used in GSM.
+ *
+ * The input of this block are symbols from an M-ary alphabet
+ * +/-1, +/-3, ..., +/-(M-1). Usually, M = 2 and therefore, the
+ * valid inputs are +/-1.
+ * The modulator will silently accept any other inputs, though.
+ * The output is the phase-modulated signal.
+ */
+ class DIGITAL_API cpmmod_bc : virtual public gr_hier_block2
+ {
+ public:
+ // gr::digital::cpmmod_bc::sptr
+ typedef boost::shared_ptr<cpmmod_bc> sptr;
+
+ /*!
+ * Make CPM modulator block.
+ *
+ * \param type The modulation type. Can be one of LREC, LRC, LSRC, TFM
+ * or GAUSSIAN. See gr_cpm::phase_response() for a
+ * detailed description.
+ * \param h The modulation index. \f$ h \cdot \pi\f$ is the maximum
+ * phase change that can occur between two symbols, i.e., if
+ * you only send ones, the phase will increase by \f$ h \cdot
+ * \pi\f$ every \p samples_per_sym samples. Set this to 0.5
+ * for Minimum Shift Keying variants.
+ * \param samples_per_sym Samples per symbol.
+ * \param L The length of the phase duration in symbols. For L=1, this
+ * yields full- response CPM symbols, for L > 1,
+ * partial-response.
+ * \param beta For LSRC, this is the rolloff factor. For Gaussian
+ * pulses, this is the 3 dB time-bandwidth product.
+ */
+ static sptr make(analog::cpm::cpm_type type, float h,
+ int samples_per_sym,
+ int L, double beta=0.3);
+
+ /*!
+ * Make GMSK modulator block.
+ *
+ * The type is GAUSSIAN and the modulation index for GMSK is
+ * 0.5. This are populated automatically by this factory
+ * function.
+ *
+ * \param samples_per_sym Samples per symbol.
+ * \param L The length of the phase duration in symbols. For L=1, this
+ * yields full- response CPM symbols, for L > 1,
+ * partial-response.
+ * \param beta For LSRC, this is the rolloff factor. For Gaussian
+ * pulses, this is the 3 dB time-bandwidth product.
+ */
+ static sptr make_gmskmod_bc(int samples_per_sym=2,
+ int L=4, double beta=0.3);
+
+ //! Return the phase response FIR taps
+ virtual std::vector<float> taps() const = 0;
+
+ //! Return the type of CPM modulator
+ virtual int type() const = 0;
+
+ //! Return the modulation index of the modulator.
+ virtual float index() const = 0;
+
+ //! Return the number of samples per symbol
+ virtual int samples_per_sym() const = 0;
+
+ //! Return the length of the phase duration (in symbols)
+ virtual int length() const = 0;
+
+ //! Return the value of beta for the modulator
+ virtual double beta() const = 0;
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_DIGITAL_CPMMOD_BC_H */
+
diff --git a/gr-digital/include/digital_crc32.h b/gr-digital/include/digital/crc32.h
index ec4a0df5b0..b84dd6832d 100644
--- a/gr-digital/include/digital_crc32.h
+++ b/gr-digital/include/digital/crc32.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2005,2011 Free Software Foundation, Inc.
+ * Copyright 2005,2011,2012 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -23,29 +23,35 @@
#ifndef INCLUDED_DIGITAL_CRC32_H
#define INCLUDED_DIGITAL_CRC32_H
-#include <digital_api.h>
+#include <digital/api.h>
#include <string>
#include <gr_types.h>
-/*!
- * \brief update running CRC-32
- * \ingroup digital
- *
- * Update a running CRC with the bytes buf[0..len-1] The CRC should be
- * initialized to all 1's, and the transmitted value is the 1's
- * complement of the final running CRC. The resulting CRC should be
- * transmitted in big endian order.
- */
-DIGITAL_API unsigned int
-digital_update_crc32(unsigned int crc, const unsigned char *buf, size_t len);
+namespace gr {
+ namespace digital {
+
+ /*!
+ * \brief update running CRC-32
+ * \ingroup digital
+ *
+ * Update a running CRC with the bytes buf[0..len-1] The CRC
+ * should be initialized to all 1's, and the transmitted value is
+ * the 1's complement of the final running CRC. The resulting CRC
+ * should be transmitted in big endian order.
+ */
+ DIGITAL_API unsigned int
+ update_crc32(unsigned int crc, const unsigned char *buf, size_t len);
+
+ DIGITAL_API unsigned int
+ update_crc32(unsigned int crc, const std::string buf);
-DIGITAL_API unsigned int
-digital_update_crc32(unsigned int crc, const std::string buf);
+ DIGITAL_API unsigned int
+ crc32(const unsigned char *buf, size_t len);
-DIGITAL_API unsigned int
-digital_crc32(const unsigned char *buf, size_t len);
+ DIGITAL_API unsigned int
+ crc32(const std::string buf);
-DIGITAL_API unsigned int
-digital_crc32(const std::string buf);
+ } /* namespace digital */
+} /* namespace gr */
#endif /* INCLUDED_CRC32_H */
diff --git a/gr-digital/include/digital/descrambler_bb.h b/gr-digital/include/digital/descrambler_bb.h
new file mode 100644
index 0000000000..512efc503a
--- /dev/null
+++ b/gr-digital/include/digital/descrambler_bb.h
@@ -0,0 +1,61 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_DESCRAMBLER_BB_H
+#define INCLUDED_GR_DESCRAMBLER_BB_H
+
+#include <digital/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace digital {
+
+ /*!
+ * \brief Descramber an input stream using an LFSR.
+ * \ingroup coding_blk
+ *
+ * Descramble an input stream using an LFSR. This block works on
+ * the LSB only of the input data stream, i.e., on an "unpacked
+ * binary" stream, and produces the same format on its output.
+ */
+ class DIGITAL_API descrambler_bb : virtual public gr_sync_block
+ {
+ public:
+ // gr::digital::descrambler_bb::sptr
+ typedef boost::shared_ptr<descrambler_bb> sptr;
+
+ /*!
+ * Descramble an input stream using an LFSR. This block works on
+ * the LSB only of the input data stream, i.e., on an "unpacked
+ * binary" stream, and produces the same format on its output.
+ *
+ * \param mask Polynomial mask for LFSR
+ * \param seed Initial shift register contents
+ * \param len Shift register length
+ */
+ static sptr make(int mask, int seed, int len);
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_DESCRAMBLER_BB_H */
diff --git a/gr-digital/include/digital_diff_decoder_bb.h b/gr-digital/include/digital/diff_decoder_bb.h
index 928035d0e7..88b9f754ef 100644
--- a/gr-digital/include/digital_diff_decoder_bb.h
+++ b/gr-digital/include/digital/diff_decoder_bb.h
@@ -23,34 +23,34 @@
#ifndef INCLUDED_GR_DIFF_DECODER_BB_H
#define INCLUDED_GR_DIFF_DECODER_BB_H
-#include <digital_api.h>
+#include <digital/api.h>
#include <gr_sync_block.h>
-class digital_diff_decoder_bb;
-typedef boost::shared_ptr<digital_diff_decoder_bb> digital_diff_decoder_bb_sptr;
-
-DIGITAL_API digital_diff_decoder_bb_sptr
-digital_make_diff_decoder_bb(unsigned int modulus);
-
-/*!
- * \brief y[0] = (x[0] - x[-1]) % M
- * \ingroup coding_blk
- *
- * Uses current and previous symbols and the alphabet modulus to
- * perform differential decoding.
- */
-class DIGITAL_API digital_diff_decoder_bb : public gr_sync_block
-{
- friend DIGITAL_API digital_diff_decoder_bb_sptr
- digital_make_diff_decoder_bb(unsigned int modulus);
- digital_diff_decoder_bb(unsigned int modulus);
-
- unsigned int d_modulus;
-
- public:
- int work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
-
-#endif
+namespace gr {
+ namespace digital {
+
+ /*!
+ * \brief Differential encoder: y[0] = (x[0] - x[-1]) % M
+ * \ingroup coding_blk
+ *
+ * Uses current and previous symbols and the alphabet modulus to
+ * perform differential decoding.
+ */
+ class DIGITAL_API diff_decoder_bb : virtual public gr_sync_block
+ {
+ public:
+ // gr::digital::diff_decoder_bb::sptr
+ typedef boost::shared_ptr<diff_decoder_bb> sptr;
+
+ /*!
+ * Make a differntial decoder block.
+ *
+ * \param modulus Modulus of code's alphabet
+ */
+ static sptr make(unsigned int modulus);
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_DIFF_DECODER_BB_H */
diff --git a/gr-digital/include/digital_diff_encoder_bb.h b/gr-digital/include/digital/diff_encoder_bb.h
index d4be69cadd..08fc6bef8c 100644
--- a/gr-digital/include/digital_diff_encoder_bb.h
+++ b/gr-digital/include/digital/diff_encoder_bb.h
@@ -23,35 +23,34 @@
#ifndef INCLUDED_GR_DIFF_ENCODER_BB_H
#define INCLUDED_GR_DIFF_ENCODER_BB_H
-#include <digital_api.h>
+#include <digital/api.h>
#include <gr_sync_block.h>
-class digital_diff_encoder_bb;
-typedef boost::shared_ptr<digital_diff_encoder_bb> digital_diff_encoder_bb_sptr;
-
-DIGITAL_API digital_diff_encoder_bb_sptr
-digital_make_diff_encoder_bb(unsigned int modulus);
-
-/*!
- * \brief y[0] = (x[0] + y[-1]) % M
- * \ingroup coding_blk
- *
- * Uses current and previous symbols and the alphabet modulus to
- * perform differential encoding.
- */
-class DIGITAL_API digital_diff_encoder_bb : public gr_sync_block
-{
- friend DIGITAL_API digital_diff_encoder_bb_sptr
- digital_make_diff_encoder_bb(unsigned int modulus);
- digital_diff_encoder_bb(unsigned int modulus);
-
- unsigned int d_last_out;
- unsigned int d_modulus;
-
- public:
- int work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
-
-#endif
+namespace gr {
+ namespace digital {
+
+ /*!
+ * \brief Differential decoder: y[0] = (x[0] + y[-1]) % M
+ * \ingroup coding_blk
+ *
+ * Uses current and previous symbols and the alphabet modulus to
+ * perform differential encoding.
+ */
+ class DIGITAL_API diff_encoder_bb : virtual public gr_sync_block
+ {
+ public:
+ // gr::digital::diff_encoder_bb::sptr
+ typedef boost::shared_ptr<diff_encoder_bb> sptr;
+
+ /*!
+ * Make a differntial encoder block.
+ *
+ * \param modulus Modulus of code's alphabet
+ */
+ static sptr make(unsigned int modulus);
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_DIFF_ENCODER_BB_H */
diff --git a/gr-digital/include/digital_diff_phasor_cc.h b/gr-digital/include/digital/diff_phasor_cc.h
index 32a2464b28..bf5a0a6326 100644
--- a/gr-digital/include/digital_diff_phasor_cc.h
+++ b/gr-digital/include/digital/diff_phasor_cc.h
@@ -23,37 +23,34 @@
#ifndef INCLUDED_GR_DIFF_PHASOR_CC_H
#define INCLUDED_GR_DIFF_PHASOR_CC_H
-#include <digital_api.h>
+#include <digital/api.h>
#include <gr_sync_block.h>
-/*!
- * \brief Differential decoding based on phase change.
- * \ingroup coding_blk
- *
- * Uses the phase difference between two symbols to determine the
- * output symbol:
- *
- * out[i] = in[i] * conj(in[i-1]);
- */
-class digital_diff_phasor_cc;
-typedef boost::shared_ptr<digital_diff_phasor_cc> digital_diff_phasor_cc_sptr;
-
-DIGITAL_API digital_diff_phasor_cc_sptr digital_make_diff_phasor_cc();
-
-
-class DIGITAL_API digital_diff_phasor_cc : public gr_sync_block
-{
- friend DIGITAL_API digital_diff_phasor_cc_sptr
- digital_make_diff_phasor_cc();
-
- digital_diff_phasor_cc(); //constructor
-
- public:
- ~digital_diff_phasor_cc(); //destructor
-
- int work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
-
-#endif
+namespace gr {
+ namespace digital {
+
+ /*!
+ * \brief Differential decoding based on phase change.
+ * \ingroup coding_blk
+ *
+ * Uses the phase difference between two symbols to determine the
+ * output symbol:
+ *
+ * out[i] = in[i] * conj(in[i-1]);
+ */
+ class DIGITAL_API diff_phasor_cc : virtual public gr_sync_block
+ {
+ public:
+ // gr::digital::diff_phasor_cc::sptr
+ typedef boost::shared_ptr<diff_phasor_cc> sptr;
+
+ /*!
+ * Make a differential phasor decoding block.
+ */
+ static sptr make();
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_DIFF_PHASOR_CC_H */
diff --git a/gr-digital/include/digital/fll_band_edge_cc.h b/gr-digital/include/digital/fll_band_edge_cc.h
new file mode 100644
index 0000000000..7b823630ed
--- /dev/null
+++ b/gr-digital/include/digital/fll_band_edge_cc.h
@@ -0,0 +1,181 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009,2011,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_DIGITAL_FLL_BAND_EDGE_CC_H
+#define INCLUDED_DIGITAL_FLL_BAND_EDGE_CC_H
+
+#include <digital/api.h>
+#include <gr_sync_block.h>
+#include <blocks/control_loop.h>
+
+namespace gr {
+ namespace digital {
+
+ /*!
+ * \class digital_fll_band_edge_cc
+ * \brief Frequency Lock Loop using band-edge filters
+ *
+ * \ingroup general
+ * \ingroup digital
+ *
+ * The frequency lock loop derives a band-edge filter that covers
+ * the upper and lower bandwidths of a digitally-modulated
+ * signal. The bandwidth range is determined by the excess
+ * bandwidth (e.g., rolloff factor) of the modulated signal. The
+ * placement in frequency of the band-edges is determined by the
+ * oversampling ratio (number of samples per symbol) and the
+ * excess bandwidth. The size of the filters should be fairly
+ * large so as to average over a number of symbols.
+ *
+ * The FLL works by filtering the upper and lower band edges into
+ * x_u(t) and x_l(t), respectively. These are combined to form
+ * cc(t) = x_u(t) + x_l(t) and ss(t) = x_u(t) - x_l(t). Combining
+ * these to form the signal e(t) = Re{cc(t) \\times ss(t)^*}
+ * (where ^* is the complex conjugate) provides an error signal at
+ * the DC term that is directly proportional to the carrier
+ * frequency. We then make a second-order loop using the error
+ * signal that is the running average of e(t).
+ *
+ * In practice, the above equation can be simplified by just
+ * comparing the absolute value squared of the output of both
+ * filters: abs(x_l(t))^2 - abs(x_u(t))^2 = norm(x_l(t)) -
+ * norm(x_u(t)).
+ *
+ * In theory, the band-edge filter is the derivative of the
+ * matched filter in frequency, (H_be(f) = frac{H(f)}{df}). In
+ * practice, this comes down to a quarter sine wave at the point
+ * of the matched filter's rolloff (if it's a raised-cosine, the
+ * derivative of a cosine is a sine). Extend this sine by another
+ * quarter wave to make a half wave around the band-edges is
+ * equivalent in time to the sum of two sinc functions. The
+ * baseband filter fot the band edges is therefore derived from
+ * this sum of sincs. The band edge filters are then just the
+ * baseband signal modulated to the correct place in
+ * frequency. All of these calculations are done in the
+ * 'design_filter' function.
+ *
+ * Note: We use FIR filters here because the filters have to have
+ * a flat phase response over the entire frequency range to allow
+ * their comparisons to be valid.
+ *
+ * It is very important that the band edge filters be the
+ * derivatives of the pulse shaping filter, and that they be
+ * linear phase. Otherwise, the variance of the error will be very
+ * large.
+ */
+ class DIGITAL_API fll_band_edge_cc
+ : virtual public gr_sync_block,
+ virtual public blocks::control_loop
+ {
+ public:
+ // gr::digital::fll_band_edge_cc::sptr
+ typedef boost::shared_ptr<fll_band_edge_cc> sptr;
+
+ /*!
+ * Make an FLL block.
+ *
+ * \param samps_per_sym (float) number of samples per symbol
+ * \param rolloff (float) Rolloff (excess bandwidth) of signal filter
+ * \param filter_size (int) number of filter taps to generate
+ * \param bandwidth (float) Loop bandwidth
+ */
+ static sptr make(float samps_per_sym, float rolloff,
+ int filter_size, float bandwidth);
+
+ /*******************************************************************
+ SET FUNCTIONS
+ *******************************************************************/
+
+ /*!
+ * \brief Set the number of samples per symbol
+ *
+ * Set's the number of samples per symbol the system should
+ * use. This value is uesd to calculate the filter taps and will
+ * force a recalculation.
+ *
+ * \param sps (float) new samples per symbol
+ */
+ virtual void set_samples_per_symbol(float sps) = 0;
+
+ /*!
+ * \brief Set the rolloff factor of the shaping filter
+ *
+ * This sets the rolloff factor that is used in the pulse
+ * shaping filter and is used to calculate the filter
+ * taps. Changing this will force a recalculation of the filter
+ * taps.
+ *
+ * This should be the same value that is used in the
+ * transmitter's pulse shaping filter. It must be between 0 and
+ * 1 and is usually between 0.2 and 0.5 (where 0.22 and 0.35 are
+ * commonly used values).
+ *
+ * \param rolloff (float) new shaping filter rolloff factor [0,1]
+ */
+ virtual void set_rolloff(float rolloff) = 0;
+
+ /*!
+ * \brief Set the number of taps in the filter
+ *
+ * This sets the number of taps in the band-edge
+ * filters. Setting this will force a recalculation of the
+ * filter taps.
+ *
+ * This should be about the same number of taps used in the
+ * transmitter's shaping filter and also not very large. A large
+ * number of taps will result in a large delay between input and
+ * frequency estimation, and so will not be as accurate. Between
+ * 30 and 70 taps is usual.
+ *
+ * \param filter_size (float) number of taps in the filters
+ */
+ virtual void set_filter_size(int filter_size) = 0;
+
+ /*******************************************************************
+ GET FUNCTIONS
+ *******************************************************************/
+
+ /*!
+ * \brief Returns the number of sampler per symbol used for the filter
+ */
+ virtual float samples_per_symbol() const = 0;
+
+ /*!
+ * \brief Returns the rolloff factor used for the filter
+ */
+ virtual float rolloff() const = 0;
+
+ /*!
+ * \brief Returns the number of taps of the filter
+ */
+ virtual int filter_size() const = 0;
+
+ /*!
+ * Print the taps to screen.
+ */
+ virtual void print_taps() = 0;
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_DIGITAL_FLL_BAND_EDGE_CC_H */
diff --git a/gr-digital/include/digital/framer_sink_1.h b/gr-digital/include/digital/framer_sink_1.h
new file mode 100644
index 0000000000..13e649b1f2
--- /dev/null
+++ b/gr-digital/include/digital/framer_sink_1.h
@@ -0,0 +1,67 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,2006,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_FRAMER_SINK_1_H
+#define INCLUDED_GR_FRAMER_SINK_1_H
+
+#include <digital/api.h>
+#include <gr_sync_block.h>
+#include <gr_msg_queue.h>
+
+namespace gr {
+ namespace digital {
+
+ /*!
+ * \brief Given a stream of bits and access_code flags, assemble packets.
+ * \ingroup sink_blk
+ *
+ * input: stream of bytes from digital_correlate_access_code_bb
+ * output: none. Pushes assembled packet into target queue
+ *
+ * The framer expects a fixed length header of 2 16-bit shorts
+ * containing the payload length, followed by the payload. If the
+ * 2 16-bit shorts are not identical, this packet is
+ * ignored. Better algs are welcome.
+ *
+ * The input data consists of bytes that have two bits used. Bit
+ * 0, the LSB, contains the data bit. Bit 1 if set, indicates that
+ * the corresponding bit is the the first bit of the packet. That
+ * is, this bit is the first one after the access code.
+ */
+ class DIGITAL_API framer_sink_1 : virtual public gr_sync_block
+ {
+ public:
+ // gr::digital::framer_sink_1::sptr
+ typedef boost::shared_ptr<framer_sink_1> sptr;
+
+ /*!
+ * Make a framer_sink_1 block.
+ *
+ * \param target_queue The message queue where frames go.
+ */
+ static sptr make(gr_msg_queue_sptr target_queue);
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_FRAMER_SINK_1_H */
diff --git a/gr-digital/include/digital/glfsr.h b/gr-digital/include/digital/glfsr.h
new file mode 100644
index 0000000000..211956e842
--- /dev/null
+++ b/gr-digital/include/digital/glfsr.h
@@ -0,0 +1,65 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_DIGITAL_GLFSR_H
+#define INCLUDED_DIGITAL_GLFSR_H
+
+#include <digital/api.h>
+
+namespace gr {
+ namespace digital {
+
+ /*!
+ * \brief Galois Linear Feedback Shift Register using specified polynomial mask
+ * \ingroup misc
+ *
+ * Generates a maximal length pseudo-random sequence of length 2^degree-1
+ */
+
+ class DIGITAL_API glfsr
+ {
+ private:
+ int d_shift_register;
+ int d_mask;
+
+ public:
+ glfsr(int mask, int seed) { d_shift_register = seed; d_mask = mask; }
+ ~glfsr();
+
+ static int glfsr_mask(int degree);
+
+ unsigned char next_bit()
+ {
+ unsigned char bit = d_shift_register & 1;
+ d_shift_register >>= 1;
+ if(bit)
+ d_shift_register ^= d_mask;
+ return bit;
+ }
+
+ int mask() const { return d_mask; }
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_DIGITAL_GLFSR_H */
diff --git a/gr-digital/include/digital/glfsr_source_b.h b/gr-digital/include/digital/glfsr_source_b.h
new file mode 100644
index 0000000000..9e245875d4
--- /dev/null
+++ b/gr-digital/include/digital/glfsr_source_b.h
@@ -0,0 +1,63 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_GLFSR_SOURCE_B_H
+#define INCLUDED_GR_GLFSR_SOURCE_B_H
+
+#include <digital/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace digital {
+
+ /*!
+ * \brief Galois LFSR pseudo-random source
+ * \ingroup source_blk
+ */
+ class DIGITAL_API glfsr_source_b : virtual public gr_sync_block
+ {
+ public:
+ // gr::digital::glfsr_source_b::sptr
+ typedef boost::shared_ptr<glfsr_source_b> sptr;
+
+ /*!
+ * Make a Galois LFSR pseudo-random source block.
+ *
+ * \param degree Degree of shift register must be in [1, 32]. If mask
+ * is 0, the degree determines a default mask (see
+ * digital_impl_glfsr.cc for the mapping).
+ * \param repeat Set to repeat sequence.
+ * \param mask Allows a user-defined bit mask for indexes of the shift
+ * register to feed back.
+ * \param seed Initial setting for values in shift register.
+ */
+ static sptr make(int degree, bool repeat=true,
+ int mask=0, int seed=1);
+
+ virtual unsigned int period() const = 0;
+ virtual int mask() const = 0;
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_GLFSR_SOURCE_B_H */
diff --git a/gr-digital/include/digital/glfsr_source_f.h b/gr-digital/include/digital/glfsr_source_f.h
new file mode 100644
index 0000000000..4feb3562b3
--- /dev/null
+++ b/gr-digital/include/digital/glfsr_source_f.h
@@ -0,0 +1,63 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_GLFSR_SOURCE_F_H
+#define INCLUDED_GR_GLFSR_SOURCE_F_H
+
+#include <digital/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace digital {
+
+ /*!
+ * \brief Galois LFSR pseudo-random source generating float outputs -1.0 - 1.0.
+ * \ingroup source_blk
+ */
+ class DIGITAL_API glfsr_source_f : virtual public gr_sync_block
+ {
+ public:
+ // gr::digital::glfsr_source_f::sptr
+ typedef boost::shared_ptr<glfsr_source_f> sptr;
+
+ /*!
+ * Make a Galois LFSR pseudo-random source block.
+ *
+ * \param degree Degree of shift register must be in [1, 32]. If mask
+ * is 0, the degree determines a default mask (see
+ * digital_impl_glfsr.cc for the mapping).
+ * \param repeat Set to repeat sequence.
+ * \param mask Allows a user-defined bit mask for indexes of the shift
+ * register to feed back.
+ * \param seed Initial setting for values in shift register.
+ */
+ static sptr make(int degree, bool repeat=true,
+ int mask=0, int seed=1);
+
+ virtual unsigned int period() const = 0;
+ virtual int mask() const = 0;
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_GLFSR_SOURCE_F_H */
diff --git a/gr-digital/include/digital/kurtotic_equalizer_cc.h b/gr-digital/include/digital/kurtotic_equalizer_cc.h
new file mode 100644
index 0000000000..2753cb3cce
--- /dev/null
+++ b/gr-digital/include/digital/kurtotic_equalizer_cc.h
@@ -0,0 +1,63 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_DIGITAL_KURTOTIC_EQUALIZER_CC_H
+#define INCLUDED_DIGITAL_KURTOTIC_EQUALIZER_CC_H
+
+#include <digital/api.h>
+#include <gr_sync_decimator.h>
+
+namespace gr {
+ namespace digital {
+
+ /*!
+ * \brief Implements a kurtosis-based adaptive equalizer on complex stream
+ * \ingroup eq_blk
+ * \ingroup digital
+ *
+ * WARNING: This block does not yet work.
+ *
+ * "Y. Guo, J. Zhao, Y. Sun, "Sign kurtosis maximization based blind
+ * equalization algorithm," IEEE Conf. on Control, Automation,
+ * Robotics and Vision, Vol. 3, Dec. 2004, pp. 2052 - 2057."
+ */
+ class DIGITAL_API kurtotic_equalizer_cc :
+ virtual public gr_sync_decimator
+ {
+ protected:
+ virtual gr_complex error(const gr_complex &out) = 0;
+ virtual void update_tap(gr_complex &tap, const gr_complex &in) = 0;
+
+ public:
+ // gr::digital::kurtotic_equalizer_cc::sptr
+ typedef boost::shared_ptr<kurtotic_equalizer_cc> sptr;
+
+ static sptr make(int num_taps, float mu);
+
+ virtual float gain() const = 0;
+ virtual void set_gain(float mu) = 0;
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_DIGITAL_KURTOTIC_EQUALIZER_CC_H */
diff --git a/gr-digital/include/digital/lfsr.h b/gr-digital/include/digital/lfsr.h
new file mode 100644
index 0000000000..2319961257
--- /dev/null
+++ b/gr-digital/include/digital/lfsr.h
@@ -0,0 +1,162 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2010,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_DIGITAL_LFSR_H
+#define INCLUDED_DIGITAL_LFSR_H
+
+#include <digital/api.h>
+#include <stdexcept>
+#include <stdint.h>
+
+namespace gr {
+ namespace digital {
+
+ /*!
+ * \brief Fibonacci Linear Feedback Shift Register using specified
+ * polynomial mask
+ * \ingroup misc
+ *
+ * Generates a maximal length pseudo-random sequence of length
+ * 2^degree-1
+ *
+ * Constructor: digital::lfsr(int mask, int seed, int reg_len);
+ *
+ * \param mask - polynomial coefficients representing the
+ * locations of feedback taps from a shift register
+ * which are xor'ed together to form the new high
+ * order bit.
+ *
+ * Some common masks might be:
+ * x^4 + x^3 + x^0 = 0x19
+ * x^5 + x^3 + x^0 = 0x29
+ * x^6 + x^5 + x^0 = 0x61
+ *
+ * \param seed - the initialization vector placed into the
+ * register durring initialization. Low order bit
+ * corresponds to x^0 coefficient -- the first to be
+ * shifted as output.
+ *
+ * \param reg_len - specifies the length of the feedback shift
+ * register to be used. Durring each iteration, the
+ * register is rightshifted one and the new bit is
+ * placed in bit reg_len. reg_len should generally be
+ * at least order(mask) + 1
+ *
+ *
+ * see http://en.wikipedia.org/wiki/Linear_feedback_shift_register
+ * for more explanation.
+ *
+ * next_bit() - Standard LFSR operation
+ *
+ * Perform one cycle of the LFSR. The output bit is taken from
+ * the shift register LSB. The shift register MSB is assigned from
+ * the modulo 2 sum of the masked shift register.
+ *
+ * next_bit_scramble(unsigned char input) - Scramble an input stream
+ *
+ * Perform one cycle of the LFSR. The output bit is taken from
+ * the shift register LSB. The shift register MSB is assigned from
+ * the modulo 2 sum of the masked shift register and the input LSB.
+ *
+ * next_bit_descramble(unsigned char input) - Descramble an input stream
+ *
+ * Perform one cycle of the LFSR. The output bit is taken from
+ * the modulo 2 sum of the masked shift register and the input LSB.
+ * The shift register MSB is assigned from the LSB of the input.
+ *
+ * See http://en.wikipedia.org/wiki/Scrambler for operation of these
+ * last two functions (see multiplicative scrambler.)
+ */
+ class lfsr
+ {
+ private:
+ uint32_t d_shift_register;
+ uint32_t d_mask;
+ uint32_t d_seed;
+ uint32_t d_shift_register_length; // less than 32
+
+ static uint32_t
+ popCount(uint32_t x)
+ {
+ uint32_t r = x - ((x >> 1) & 033333333333)
+ - ((x >> 2) & 011111111111);
+ return ((r + (r >> 3)) & 030707070707) % 63;
+ }
+
+ public:
+ lfsr(uint32_t mask, uint32_t seed, uint32_t reg_len)
+ : d_shift_register(seed),
+ d_mask(mask),
+ d_seed(seed),
+ d_shift_register_length(reg_len)
+ {
+ if(reg_len > 31)
+ throw std::invalid_argument("reg_len must be <= 31");
+ }
+
+ unsigned char next_bit()
+ {
+ unsigned char output = d_shift_register & 1;
+ unsigned char newbit = popCount( d_shift_register & d_mask )%2;
+ d_shift_register = ((d_shift_register>>1) | (newbit<<d_shift_register_length));
+ return output;
+ }
+
+ unsigned char next_bit_scramble(unsigned char input)
+ {
+ unsigned char output = d_shift_register & 1;
+ unsigned char newbit = (popCount( d_shift_register & d_mask )%2)^(input & 1);
+ d_shift_register = ((d_shift_register>>1) | (newbit<<d_shift_register_length));
+ return output;
+ }
+
+ unsigned char next_bit_descramble(unsigned char input)
+ {
+ unsigned char output = (popCount( d_shift_register & d_mask )%2)^(input & 1);
+ unsigned char newbit = input & 1;
+ d_shift_register = ((d_shift_register>>1) | (newbit<<d_shift_register_length));
+ return output;
+ }
+
+ /*!
+ * Reset shift register to initial seed value
+ */
+ void reset() { d_shift_register = d_seed; }
+
+ /*!
+ * Rotate the register through x number of bits
+ * where we are just throwing away the results to get queued up correctly
+ */
+ void pre_shift(int num)
+ {
+ for(int i=0; i<num; i++) {
+ next_bit();
+ }
+ }
+
+ int mask() const { return d_mask; }
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_DIGITAL_LFSR_H */
diff --git a/gr-digital/include/digital/lms_dd_equalizer_cc.h b/gr-digital/include/digital/lms_dd_equalizer_cc.h
new file mode 100644
index 0000000000..8084396759
--- /dev/null
+++ b/gr-digital/include/digital/lms_dd_equalizer_cc.h
@@ -0,0 +1,101 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_DIGITAL_LMS_DD_EQUALIZER_CC_H
+#define INCLUDED_DIGITAL_LMS_DD_EQUALIZER_CC_H
+
+#include <digital/api.h>
+#include <gr_sync_decimator.h>
+#include <digital/constellation.h>
+
+namespace gr {
+ namespace digital {
+
+ /*!
+ * \brief Least-Mean-Square Decision Directed Equalizer (complex in/out)
+ * \ingroup eq_blk
+ * \ingroup digital
+ *
+ * This block implements an LMS-based decision-directed equalizer.
+ * It uses a set of weights, w, to correlate against the inputs,
+ * u, and a decisions is then made from this output. The error in
+ * the decision is used to update teh weight vector.
+ *
+ * y[n] = conj(w[n]) u[n]
+ * d[n] = decision(y[n])
+ * e[n] = d[n] - y[n]
+ * w[n+1] = w[n] + mu u[n] conj(e[n])
+ *
+ * Where mu is a gain value (between 0 and 1 and usualy small,
+ * around 0.001 - 0.01.
+ *
+ * This block uses the digital_constellation object for making the
+ * decision from y[n]. Create the constellation object for
+ * whatever constellation is to be used and pass in the object.
+ * In Python, you can use something like:
+ *
+ * self.constellation = digital.constellation_qpsk()
+ *
+ * To create a QPSK constellation (see the digital_constellation
+ * block for more details as to what constellations are available
+ * or how to create your own). You then pass the object to this
+ * block as an sptr, or using "self.constellation.base()".
+ *
+ * The theory for this algorithm can be found in Chapter 9 of:
+ * S. Haykin, Adaptive Filter Theory, Upper Saddle River, NJ:
+ * Prentice Hall, 1996.
+ */
+ class DIGITAL_API lms_dd_equalizer_cc :
+ virtual public gr_sync_decimator
+ {
+ protected:
+ virtual gr_complex error(const gr_complex &out) = 0;
+ virtual void update_tap(gr_complex &tap, const gr_complex &in) = 0;
+
+ public:
+ // gr::digital::lms_dd_equalizer_cc::sptr
+ typedef boost::shared_ptr<lms_dd_equalizer_cc> sptr;
+
+ /*!
+ * Make an LMS decision-directed equalizer
+ *
+ * \param num_taps Numer of taps in the equalizer (channel size)
+ * \param mu Gain of the update loop
+ * \param sps Number of samples per symbol of the input signal
+ * \param cnst A constellation derived from class
+ * 'constellation'. Use base() method to get a shared pointer to
+ * this base class type.
+ */
+ static sptr make(int num_taps,
+ float mu, int sps,
+ constellation_sptr cnst);
+
+ virtual void set_taps(const std::vector<gr_complex> &taps) = 0;
+ virtual std::vector<gr_complex> taps() const = 0;
+ virtual float gain() const = 0;
+ virtual void set_gain(float mu) = 0;
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_DIGITAL_LMS_DD_EQUALIZER_CC_H */
diff --git a/gr-digital/include/digital_map_bb.h b/gr-digital/include/digital/map_bb.h
index 4aca66fbe1..6a380e2cc1 100644
--- a/gr-digital/include/digital_map_bb.h
+++ b/gr-digital/include/digital/map_bb.h
@@ -19,44 +19,44 @@
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
+
#ifndef INCLUDED_GR_MAP_BB_H
#define INCLUDED_GR_MAP_BB_H
-#include <digital_api.h>
+#include <digital/api.h>
#include <gr_sync_block.h>
-class digital_map_bb;
-typedef boost::shared_ptr<digital_map_bb> digital_map_bb_sptr;
-
-DIGITAL_API digital_map_bb_sptr
-digital_make_map_bb(const std::vector<int> &map);
-
-/*!
- * \brief output[i] = map[input[i]]
- * \ingroup coding_blk
- *
- * This block maps an incoming signal to the value in the map.
- * The block expects that the incoming signal has a maximum
- * value of len(map)-1.
- *
- * -> output[i] = map[input[i]]
- *
- * \param map a vector of integers.
- */
-
-class DIGITAL_API digital_map_bb : public gr_sync_block
-{
- friend DIGITAL_API digital_map_bb_sptr
- digital_make_map_bb(const std::vector<int> &map);
-
- unsigned char d_map[0x100];
-
- digital_map_bb(const std::vector<int> &map);
-
-public:
- int work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
+namespace gr {
+ namespace digital {
+
+ /*!
+ * \brief output[i] = map[input[i]]
+ * \ingroup coding_blk
+ *
+ * This block maps an incoming signal to the value in the map.
+ * The block expects that the incoming signal has a maximum
+ * value of len(map)-1.
+ *
+ * -> output[i] = map[input[i]]
+ */
+ class DIGITAL_API map_bb : virtual public gr_sync_block
+ {
+ public:
+ // gr::digital::map_bb::sptr
+ typedef boost::shared_ptr<map_bb> sptr;
+
+ /*!
+ * Make a map block.
+ *
+ * \param map a vector of integers that maps x to map[x].
+ */
+ static sptr make(const std::vector<int> &map);
+
+ virtual void set_map(const std::vector<int> &map) = 0;
+ virtual std::vector<int> map() const = 0;
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
#endif /* INCLUDED_GR_MAP_BB_H */
diff --git a/gr-digital/include/digital_metric_type.h b/gr-digital/include/digital/metric_type.h
index 83de166f09..c277f01d27 100644
--- a/gr-digital/include/digital_metric_type.h
+++ b/gr-digital/include/digital/metric_type.h
@@ -23,9 +23,15 @@
#ifndef INCLUDED_DIGITAL_METRIC_TYPE_H
#define INCLUDED_DIGITAL_METRIC_TYPE_H
-typedef enum {
- TRELLIS_EUCLIDEAN = 200, TRELLIS_HARD_SYMBOL, TRELLIS_HARD_BIT
-} trellis_metric_type_t;
+namespace gr {
+ namespace digital {
-#endif
+ typedef enum {
+ TRELLIS_EUCLIDEAN = 200, TRELLIS_HARD_SYMBOL, TRELLIS_HARD_BIT
+ } trellis_metric_type_t;
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_DIGITAL_METRIC_TYPE_H */
diff --git a/gr-digital/include/digital/mpsk_receiver_cc.h b/gr-digital/include/digital/mpsk_receiver_cc.h
new file mode 100644
index 0000000000..14094e25b7
--- /dev/null
+++ b/gr-digital/include/digital/mpsk_receiver_cc.h
@@ -0,0 +1,147 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2007,2011,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_DIGITAL_MPSK_RECEIVER_CC_H
+#define INCLUDED_DIGITAL_MPSK_RECEIVER_CC_H
+
+#include <digital/api.h>
+#include <gr_block.h>
+
+namespace gr {
+ namespace digital {
+
+ /*!
+ * \brief This block takes care of receiving M-PSK modulated
+ * signals through phase, frequency, and symbol synchronization.
+ * \ingroup sync_blk
+ * \ingroup demod_blk
+ * \ingroup digital
+ *
+ * This block takes care of receiving M-PSK modulated signals
+ * through phase, frequency, and symbol synchronization. It
+ * performs carrier frequency and phase locking as well as symbol
+ * timing recovery. It works with (D)BPSK, (D)QPSK, and (D)8PSK
+ * as tested currently. It should also work for OQPSK and PI/4
+ * DQPSK.
+ *
+ * The phase and frequency synchronization are based on a Costas
+ * loop that finds the error of the incoming signal point compared
+ * to its nearest constellation point. The frequency and phase of
+ * the NCO are updated according to this error. There are
+ * optimized phase error detectors for BPSK and QPSK, but 8PSK is
+ * done using a brute-force computation of the constellation
+ * points to find the minimum.
+ *
+ * The symbol synchronization is done using a modified Mueller and
+ * Muller circuit from the paper:
+ *
+ * "G. R. Danesfahani, T. G. Jeans, "Optimisation of modified Mueller
+ * and Muller algorithm," Electronics Letters, Vol. 31, no. 13, 22
+ * June 1995, pp. 1032 - 1033."
+ *
+ * This circuit interpolates the downconverted sample (using the
+ * NCO developed by the Costas loop) every mu samples, then it
+ * finds the sampling error based on this and the past symbols and
+ * the decision made on the samples. Like the phase error
+ * detector, there are optimized decision algorithms for BPSK and
+ * QPKS, but 8PSK uses another brute force computation against all
+ * possible symbols. The modifications to the M&M used here reduce
+ * self-noise.
+ *
+ */
+ class DIGITAL_API mpsk_receiver_cc : virtual public gr_block
+ {
+ public:
+ // gr::digital::mpsk_receiver_cc::sptr
+ typedef boost::shared_ptr<mpsk_receiver_cc> sptr;
+
+ /*!
+ * \brief Buil M-PSK receiver block.
+ *
+ * \param M modulation order of the M-PSK modulation
+ * \param theta any constant phase rotation from the real axis of the constellation
+ * \param loop_bw Loop bandwidth to set gains of phase/freq tracking loop
+ * \param fmin minimum normalized frequency value the loop can achieve
+ * \param fmax maximum normalized frequency value the loop can achieve
+ * \param mu initial parameter for the interpolator [0,1]
+ * \param gain_mu gain parameter of the M&M error signal to adjust mu (~0.05)
+ * \param omega initial value for the number of symbols between samples (~number of samples/symbol)
+ * \param gain_omega gain parameter to adjust omega based on the error (~omega^2/4)
+ * \param omega_rel sets the maximum (omega*(1+omega_rel)) and minimum (omega*(1+omega_rel)) omega (~0.005)
+ *
+ * The constructor also chooses which phase detector and
+ * decision maker to use in the work loop based on the value of
+ * M.
+ */
+ static sptr make(unsigned int M, float theta,
+ float loop_bw,
+ float fmin, float fmax,
+ float mu, float gain_mu,
+ float omega, float gain_omega, float omega_rel);
+
+ //! Returns the modulation order (M) currently set
+ virtual float modulation_order() const = 0;
+
+ //! Returns current value of theta
+ virtual float theta() const = 0;
+
+ //! Returns current value of mu
+ virtual float mu() const = 0;
+
+ //! Returns current value of omega
+ virtual float omega() const = 0;
+
+ //! Returns mu gain factor
+ virtual float gain_mu() const = 0;
+
+ //! Returns omega gain factor
+ virtual float gain_omega() const = 0;
+
+ //! Returns the relative omega limit
+ virtual float gain_omega_rel() const = 0;
+
+ //! Sets the modulation order (M) currently
+ virtual void set_modulation_order(unsigned int M) = 0;
+
+ //! Sets value of theta
+ virtual void set_theta(float theta) = 0;
+
+ //! Sets value of mu
+ virtual void set_mu(float mu) = 0;
+
+ //! Sets value of omega and its min and max values
+ virtual void set_omega(float omega) = 0;
+
+ //! Sets value for mu gain factor
+ virtual void set_gain_mu(float gain_mu) = 0;
+
+ //! Sets value for omega gain factor
+ virtual void set_gain_omega(float gain_omega) = 0;
+
+ //! Sets the relative omega limit and resets omega min/max values
+ virtual void set_gain_omega_rel(float omega_rel) = 0;
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_DIGITAL_MPSK_RECEIVER_CC_H */
diff --git a/gr-digital/include/digital/mpsk_snr_est.h b/gr-digital/include/digital/mpsk_snr_est.h
new file mode 100644
index 0000000000..69c03430d3
--- /dev/null
+++ b/gr-digital/include/digital/mpsk_snr_est.h
@@ -0,0 +1,287 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_DIGITAL_MPSK_SNR_EST_H
+#define INCLUDED_DIGITAL_MPSK_SNR_EST_H
+
+#include <digital/api.h>
+#include <gr_complex.h>
+
+namespace gr {
+ namespace digital {
+
+ //! Enum for the type of SNR estimator to select
+ /*! \ingroup snr_blk
+ * \anchor ref_snr_est_types
+ *
+ * Below are some ROUGH estimates of what values of SNR each of
+ * these types of estimators is good for. In general, these offer
+ * a trade-off between accuracy and performance.
+ *
+ * \li SNR_EST_SIMPLE: Simple estimator (>= 7 dB)
+ * \li SNR_EST_SKEW: Skewness-base est (>= 5 dB)
+ * \li SNR_EST_M2M4: 2nd & 4th moment est (>= 1 dB)
+ * \li SNR_EST_SVR: SVR-based est (>= 0dB)
+ */
+ typedef enum {
+ SNR_EST_SIMPLE = 0, // Simple estimator (>= 7 dB)
+ SNR_EST_SKEW, // Skewness-base est (>= 5 dB)
+ SNR_EST_M2M4, // 2nd & 4th moment est (>= 1 dB)
+ SNR_EST_SVR // SVR-based est (>= 0dB)
+ } snr_est_type_t;
+
+ /*! \brief A parent class for SNR estimators, specifically for
+ * M-PSK signals in AWGN channels.
+ * \ingroup snr_blk
+ */
+ class DIGITAL_API mpsk_snr_est
+ {
+ protected:
+ double d_alpha, d_beta;
+
+ public:
+ /*! Constructor
+ *
+ * Parameters:
+ * \param alpha: the update rate of internal running average
+ * calculations.
+ */
+ mpsk_snr_est(double alpha);
+ virtual ~mpsk_snr_est();
+
+ //! Get the running-average coefficient
+ double alpha() const;
+
+ //! Set the running-average coefficient
+ void set_alpha(double alpha);
+
+ //! Update the current registers
+ virtual int update(int noutput_items,
+ const gr_complex *input);
+
+ //! Use the register values to compute a new estimate
+ virtual double snr();
+ };
+
+
+ //! \brief SNR Estimator using simple mean/variance estimates.
+ /*! \ingroup snr_blk
+ *
+ * A very simple SNR estimator that just uses mean and variance
+ * estimates of an M-PSK constellation. This esimator is quick
+ * and cheap and accurate for high SNR (above 7 dB or so) but
+ * quickly starts to overestimate the SNR at low SNR.
+ */
+ class DIGITAL_API mpsk_snr_est_simple :
+ public mpsk_snr_est
+ {
+ private:
+ double d_y1, d_y2;
+
+ public:
+ /*! Constructor
+ *
+ * Parameters:
+ * \param alpha: the update rate of internal running average
+ * calculations.
+ */
+ mpsk_snr_est_simple(double alpha);
+ ~mpsk_snr_est_simple() {}
+
+ int update(int noutput_items,
+ const gr_complex *input);
+ double snr();
+ };
+
+
+ //! \brief SNR Estimator using skewness correction.
+ /*! \ingroup snr_blk
+ *
+ * This is an estimator that came from a discussion between Tom
+ * Rondeau and fred harris with no known paper reference. The
+ * idea is that at low SNR, the variance estimations will be
+ * affected because of fold-over around the decision boundaries,
+ * which results in a skewness to the samples. We estimate the
+ * skewness and use this as a correcting term.
+ */
+ class DIGITAL_API mpsk_snr_est_skew :
+ public mpsk_snr_est
+ {
+ private:
+ double d_y1, d_y2, d_y3;
+
+ public:
+ /*! Constructor
+ *
+ * Parameters:
+ * \param alpha: the update rate of internal running average
+ * calculations.
+ */
+ mpsk_snr_est_skew(double alpha);
+ ~mpsk_snr_est_skew() {}
+
+ int update(int noutput_items,
+ const gr_complex *input);
+ double snr();
+ };
+
+
+ //! \brief SNR Estimator using 2nd and 4th-order moments.
+ /*! \ingroup snr_blk
+ *
+ * An SNR estimator for M-PSK signals that uses 2nd (M2) and 4th
+ * (M4) order moments. This estimator uses knowledge of the
+ * kurtosis of the signal (k_a) and noise (k_w) to make its
+ * estimation. We use Beaulieu's approximations here to M-PSK
+ * signals and AWGN channels such that k_a=1 and k_w=2. These
+ * approximations significantly reduce the complexity of the
+ * calculations (and computations) required.
+ *
+ * Reference:
+ * D. R. Pauluzzi and N. C. Beaulieu, "A comparison of SNR
+ * estimation techniques for the AWGN channel," IEEE
+ * Trans. Communications, Vol. 48, No. 10, pp. 1681-1691, 2000.
+ */
+ class DIGITAL_API mpsk_snr_est_m2m4 :
+ public mpsk_snr_est
+ {
+ private:
+ double d_y1, d_y2;
+
+ public:
+ /*! Constructor
+ *
+ * Parameters:
+ * \param alpha: the update rate of internal running average
+ * calculations.
+ */
+ mpsk_snr_est_m2m4(double alpha);
+ ~mpsk_snr_est_m2m4() {}
+
+ int update(int noutput_items,
+ const gr_complex *input);
+ double snr();
+ };
+
+
+ //! \brief SNR Estimator using 2nd and 4th-order moments.
+ /*! \ingroup snr_blk
+ *
+ * An SNR estimator for M-PSK signals that uses 2nd (M2) and 4th
+ * (M4) order moments. This estimator uses knowledge of the
+ * kurtosis of the signal (k_a) and noise (k_w) to make its
+ * estimation. In this case, you can set your own estimations for
+ * k_a and k_w, the kurtosis of the signal and noise, to fit this
+ * estimation better to your signal and channel conditions.
+ *
+ * A word of warning: this estimator has not been fully tested or
+ * proved with any amount of rigor. The estimation for M4 in
+ * particular might be ignoring effectf of when k_a and k_w are
+ * different. Use this estimator with caution and a copy of the
+ * reference on hand.
+ *
+ * The digital_mpsk_snr_est_m2m4 assumes k_a and k_w to simplify
+ * the computations for M-PSK and AWGN channels. Use that
+ * estimator unless you have a way to guess or estimate these
+ * values here.
+ *
+ * Original paper:
+ * R. Matzner, "An SNR estimation algorithm for complex baseband
+ * signal using higher order statistics," Facta Universitatis
+ * (Nis), no. 6, pp. 41-52, 1993.
+ *
+ * Reference used in derivation:
+ * D. R. Pauluzzi and N. C. Beaulieu, "A comparison of SNR
+ * estimation techniques for the AWGN channel," IEEE
+ * Trans. Communications, Vol. 48, No. 10, pp. 1681-1691, 2000.
+ */
+ class DIGITAL_API snr_est_m2m4 :
+ public mpsk_snr_est
+ {
+ private:
+ double d_y1, d_y2;
+ double d_ka, d_kw;
+
+ public:
+ /*! Constructor
+ *
+ * Parameters:
+ * \param alpha: the update rate of internal running average
+ * calculations.
+ * \param ka: estimate of the signal kurtosis (1 for PSK)
+ * \param kw: estimate of the channel noise kurtosis (2 for AWGN)
+ */
+ snr_est_m2m4(double alpha, double ka, double kw);
+ ~snr_est_m2m4() {}
+
+ int update(int noutput_items,
+ const gr_complex *input);
+ double snr();
+ };
+
+
+ //! \brief Signal-to-Variation Ratio SNR Estimator.
+ /*! \ingroup snr_blk
+ *
+ * This estimator actually comes from an SNR estimator for M-PSK
+ * signals in fading channels, but this implementation is
+ * specifically for AWGN channels. The math was simplified to
+ * assume a signal and noise kurtosis (k_a and k_w) for M-PSK
+ * signals in AWGN. These approximations significantly reduce the
+ * complexity of the calculations (and computations) required.
+ *
+ * Original paper:
+ * A. L. Brandao, L. B. Lopes, and D. C. McLernon, "In-service
+ * monitoring of multipath delay and cochannel interference for
+ * indoor mobile communication systems," Proc. IEEE
+ * Int. Conf. Communications, vol. 3, pp. 1458-1462, May 1994.
+ *
+ * Reference:
+ * D. R. Pauluzzi and N. C. Beaulieu, "A comparison of SNR
+ * estimation techniques for the AWGN channel," IEEE
+ * Trans. Communications, Vol. 48, No. 10, pp. 1681-1691, 2000.
+ */
+ class DIGITAL_API mpsk_snr_est_svr :
+ public mpsk_snr_est
+ {
+ private:
+ double d_y1, d_y2;
+
+ public:
+ /*! Constructor
+ *
+ * Parameters:
+ * \param alpha: the update rate of internal running average
+ * calculations.
+ */
+ mpsk_snr_est_svr(double alpha);
+ ~mpsk_snr_est_svr() {}
+
+ int update(int noutput_items,
+ const gr_complex *input);
+ double snr();
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_DIGITAL_MPSK_SNR_EST_H */
diff --git a/gr-digital/include/digital/mpsk_snr_est_cc.h b/gr-digital/include/digital/mpsk_snr_est_cc.h
new file mode 100644
index 0000000000..c2d1fd43d2
--- /dev/null
+++ b/gr-digital/include/digital/mpsk_snr_est_cc.h
@@ -0,0 +1,96 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_DIGITAL_MPSK_SNR_EST_CC_H
+#define INCLUDED_DIGITAL_MPSK_SNR_EST_CC_H
+
+#include <digital/api.h>
+#include <digital/mpsk_snr_est.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace digital {
+
+ //! \brief A block for computing SNR of a signal.
+ /*! \ingroup snr_blk
+ *
+ * This block can be used to monitor and retrieve estimations of
+ * the signal SNR. It is designed to work in a flowgraph and
+ * passes all incoming data along to its output.
+ *
+ * The block is designed for use with M-PSK signals
+ * especially. The type of estimator is specified as the \p type
+ * parameter in the constructor. The estimators tend to trade off
+ * performance for accuracy, although experimentation should be
+ * done to figure out the right approach for a given
+ * implementation. Further, the current set of estimators are
+ * designed and proven theoretically under AWGN conditions; some
+ * amount of error should be assumed and/or estimated for real
+ * channel conditions.
+ */
+ class DIGITAL_API mpsk_snr_est_cc : virtual public gr_sync_block
+ {
+ public:
+ // gr::digital::mpsk_snr_est_cc::sptr
+ typedef boost::shared_ptr<mpsk_snr_est_cc> sptr;
+
+ /*! Factory function returning shared pointer of this class
+ *
+ * Parameters:
+ *
+ * \param type: the type of estimator to use \ref ref_snr_est_types
+ * "snr_est_type_t" for details about the available types
+ * \param tag_nsamples: after this many samples, a tag containing
+ * the SNR (key='snr') will be sent
+ * \param alpha: the update rate of internal running average
+ * calculations
+ */
+ static sptr make(snr_est_type_t type,
+ int tag_nsamples=10000,
+ double alpha=0.001);
+
+ //! Return the estimated signal-to-noise ratio in decibels
+ virtual double snr() = 0;
+
+ //! Return the type of estimator in use
+ virtual snr_est_type_t type() const = 0;
+
+ //! Return how many samples between SNR tags
+ virtual int tag_nsample() const = 0;
+
+ //! Get the running-average coefficient
+ virtual double alpha() const = 0;
+
+ //! Set type of estimator to use
+ virtual void set_type(snr_est_type_t t) = 0;
+
+ //! Set the number of samples between SNR tags
+ virtual void set_tag_nsample(int n) = 0;
+
+ //! Set the running-average coefficient
+ virtual void set_alpha(double alpha) = 0;
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_DIGITAL_MPSK_SNR_EST_CC_H */
diff --git a/gr-digital/include/digital/ofdm_cyclic_prefixer.h b/gr-digital/include/digital/ofdm_cyclic_prefixer.h
new file mode 100644
index 0000000000..551d1ee834
--- /dev/null
+++ b/gr-digital/include/digital/ofdm_cyclic_prefixer.h
@@ -0,0 +1,57 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004-2006,2011,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_DIGITAL_OFDM_CYCLIC_PREFIXER_H
+#define INCLUDED_DIGITAL_OFDM_CYCLIC_PREFIXER_H
+
+#include <digital/api.h>
+#include <gr_sync_interpolator.h>
+
+namespace gr {
+ namespace digital {
+
+ /*!
+ * \brief adds a cyclic prefix vector to an input size long ofdm
+ * symbol(vector) and converts vector to a stream output_size
+ * long.
+ * \ingroup ofdm_blk
+ */
+ class DIGITAL_API ofdm_cyclic_prefixer : virtual public gr_sync_interpolator
+ {
+ public:
+ // gr::digital::ofdm_cyclic_prefixer::sptr
+ typedef boost::shared_ptr<ofdm_cyclic_prefixer> sptr;
+
+ /*!
+ * Make an OFDM cyclic prefix adder block.
+ *
+ * \param input_size size of the input symbol
+ * \param output_size output of the symbol
+ * (CP len = output_size - input_size)
+ */
+ static sptr make(size_t input_size, size_t output_size);
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_DIGITAL_OFDM_CYCLIC_PREFIXER_H */
diff --git a/gr-digital/include/digital/ofdm_frame_acquisition.h b/gr-digital/include/digital/ofdm_frame_acquisition.h
new file mode 100644
index 0000000000..ec49b47f97
--- /dev/null
+++ b/gr-digital/include/digital/ofdm_frame_acquisition.h
@@ -0,0 +1,82 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,2007,2011,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_DIGITAL_OFDM_FRAME_ACQUISITION_H
+#define INCLUDED_DIGITAL_OFDM_FRAME_ACQUISITION_H
+
+#include <digital/api.h>
+#include <gr_block.h>
+#include <vector>
+
+namespace gr {
+ namespace digital {
+
+ /*!
+ * \brief take a vector of complex constellation points in from an
+ * FFT and performs a correlation and equalization.
+ * \ingroup demodulation_blk
+ * \ingroup ofdm_blk
+ *
+ * This block takes the output of an FFT of a received OFDM symbol
+ * and finds the start of a frame based on two known symbols. It
+ * also looks at the surrounding bins in the FFT output for the
+ * correlation in case there is a large frequency shift in the
+ * data. This block assumes that the fine frequency shift has
+ * already been corrected and that the samples fall in the middle
+ * of one FFT bin.
+ *
+ * It then uses one of those known symbols to estimate the channel
+ * response over all subcarriers and does a simple 1-tap
+ * equalization on all subcarriers. This corrects for the phase
+ * and amplitude distortion caused by the channel.
+ */
+ class DIGITAL_API ofdm_frame_acquisition : virtual public gr_block
+ {
+ public:
+ // gr::digital::ofdm_frame_acquisition::sptr
+ typedef boost::shared_ptr<ofdm_frame_acquisition> sptr;
+
+ /*!
+ * Make an OFDM correlator and equalizer.
+ *
+ * \param occupied_carriers The number of subcarriers with data in the received symbol
+ * \param fft_length The size of the FFT vector (occupied_carriers + unused carriers)
+ * \param cplen The length of the cycle prefix
+ * \param known_symbol A vector of complex numbers representing a known symbol at the
+ * start of a frame (usually a BPSK PN sequence)
+ * \param max_fft_shift_len Set's the maximum distance you can look between bins for correlation
+ */
+ static sptr make(unsigned int occupied_carriers, unsigned int fft_length,
+ unsigned int cplen,
+ const std::vector<gr_complex> &known_symbol,
+ unsigned int max_fft_shift_len=4);
+
+ /*!
+ * \brief Return an estimate of the SNR of the channel
+ */
+ virtual float snr() = 0;
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_DIGITAL_OFDM_FRAME_ACQUISITION_H */
diff --git a/gr-digital/include/digital/ofdm_frame_sink.h b/gr-digital/include/digital/ofdm_frame_sink.h
new file mode 100644
index 0000000000..427d6eb460
--- /dev/null
+++ b/gr-digital/include/digital/ofdm_frame_sink.h
@@ -0,0 +1,71 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,2011,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_DIGITAL_OFDM_FRAME_SINK_H
+#define INCLUDED_DIGITAL_OFDM_FRAME_SINK_H
+
+#include <digital/api.h>
+#include <gr_sync_block.h>
+#include <gr_msg_queue.h>
+
+namespace gr {
+ namespace digital {
+
+ /*!
+ * \brief Takes an OFDM symbol in, demaps it into bits of 0's and
+ * 1's, packs them into packets, and sends to to a message queue
+ * sink.
+ * \ingroup sink_blk
+ * \ingroup ofdm_blk
+ *
+ * NOTE: The mod input parameter simply chooses a pre-defined
+ * demapper/slicer. Eventually, we want to be able to pass in a
+ * reference to an object to do the demapping and slicing for a
+ * given modulation type.
+ */
+ class DIGITAL_API ofdm_frame_sink : virtual public gr_sync_block
+ {
+ public:
+ // gr::digital::ofdm_frame_sink::sptr
+ typedef boost::shared_ptr<ofdm_frame_sink> sptr;
+
+ /*!
+ * Make an OFDM frame sink block.
+ *
+ * \param sym_position vector of OFDM carrier symbols in complex space
+ * \param sym_value_out vector of bit mapped from the complex symbol space
+ * \param target_queue message queue for the packets to go into
+ * \param occupied_tones The number of subcarriers with data in the received symbol
+ * \param phase_gain gain of the phase tracking loop
+ * \param freq_gain gain of the frequency tracking loop
+ */
+ static sptr make(const std::vector<gr_complex> &sym_position,
+ const std::vector<char> &sym_value_out,
+ gr_msg_queue_sptr target_queue,
+ int occupied_tones,
+ float phase_gain=0.25, float freq_gain=0.25*0.25/4);
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_OFDM_FRAME_SINK_H */
diff --git a/gr-digital/include/digital/ofdm_insert_preamble.h b/gr-digital/include/digital/ofdm_insert_preamble.h
new file mode 100644
index 0000000000..27db837e42
--- /dev/null
+++ b/gr-digital/include/digital/ofdm_insert_preamble.h
@@ -0,0 +1,82 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,2011,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef INCLUDED_DIGITAL_OFDM_INSERT_PREAMBLE_H
+#define INCLUDED_DIGITAL_OFDM_INSERT_PREAMBLE_H
+
+#include <digital/api.h>
+#include <gr_block.h>
+#include <vector>
+
+namespace gr {
+ namespace digital {
+
+ /*!
+ * \brief insert "pre-modulated" preamble symbols before each payload.
+ * \ingroup sync_blk
+ * \ingroup ofdm_blk
+ *
+ * <pre>
+ * input 1: stream of vectors of gr_complex [fft_length]
+ * These are the modulated symbols of the payload.
+ *
+ * input 2: stream of char. The LSB indicates whether the corresponding
+ * symbol on input 1 is the first symbol of the payload or not.
+ * It's a 1 if the corresponding symbol is the first symbol,
+ * otherwise 0.
+ *
+ * N.B., this implies that there must be at least 1 symbol in the payload.
+ *
+ *
+ * output 1: stream of vectors of gr_complex [fft_length]
+ * These include the preamble symbols and the payload symbols.
+ *
+ * output 2: stream of char. The LSB indicates whether the corresponding
+ * symbol on input 1 is the first symbol of a packet (i.e., the
+ * first symbol of the preamble.) It's a 1 if the corresponding
+ * symbol is the first symbol, otherwise 0.
+ * </pre>
+ *
+ * \param fft_length length of each symbol in samples.
+ * \param preamble vector of symbols that represent the pre-modulated preamble.
+ */
+ class DIGITAL_API ofdm_insert_preamble : virtual public gr_block
+ {
+ public:
+ // gr::digital::ofdm_insert_preamble::sptr
+ typedef boost::shared_ptr<ofdm_insert_preamble> sptr;
+
+ /*!
+ * Make an OFDM preamble inserter block.
+ *
+ * \param fft_length length of each symbol in samples.
+ * \param preamble vector of symbols that represent the pre-modulated preamble.
+ */
+ static sptr make(int fft_length,
+ const std::vector<std::vector<gr_complex> > &preamble);
+
+ virtual void enter_preamble() = 0;
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_DIGITAL_OFDM_INSERT_PREAMBLE_H */
diff --git a/gr-digital/include/digital/ofdm_mapper_bcv.h b/gr-digital/include/digital/ofdm_mapper_bcv.h
new file mode 100644
index 0000000000..1e541d2edb
--- /dev/null
+++ b/gr-digital/include/digital/ofdm_mapper_bcv.h
@@ -0,0 +1,67 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,2007,2011,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_DIGITAL_OFDM_MAPPER_BCV_H
+#define INCLUDED_DIGITAL_OFDM_MAPPER_BCV_H
+
+#include <digital/api.h>
+#include <gr_sync_block.h>
+#include <gr_msg_queue.h>
+
+namespace gr {
+ namespace digital {
+
+ /*!
+ * \brief take a stream of bytes in and map to a vector of complex
+ * constellation points suitable for IFFT input to be used in an
+ * ofdm modulator.
+ * \ingroup modulation_blk
+ * \ingroup ofdm_blk
+ *
+ * Abstract class must be subclassed with specific mapping.
+ */
+ class DIGITAL_API ofdm_mapper_bcv : virtual public gr_sync_block
+ {
+ public:
+ // gr::digital::ofdm_mapper_bcv::sptr
+ typedef boost::shared_ptr<ofdm_mapper_bcv> sptr;
+
+ /*!
+ * Make an OFDM mapper block.
+ *
+ * \param constellation vector of OFDM carrier symbols in complex space
+ * \param msgq_limit limit on number of messages the queue can store
+ * \param occupied_carriers The number of subcarriers with data in the received symbol
+ * \param fft_length The size of the FFT vector (occupied_carriers + unused carriers)
+ */
+ static sptr make(const std::vector<gr_complex> &constellation,
+ unsigned msgq_limit,
+ unsigned occupied_carriers,
+ unsigned int fft_length);
+
+ virtual gr_msg_queue_sptr msgq() const = 0;
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_DIGITAL_OFDM_MAPPER_BCV_H */
diff --git a/gr-digital/include/digital/ofdm_sampler.h b/gr-digital/include/digital/ofdm_sampler.h
new file mode 100644
index 0000000000..5df16be3e4
--- /dev/null
+++ b/gr-digital/include/digital/ofdm_sampler.h
@@ -0,0 +1,57 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,2011,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_DIGITAL_OFDM_SAMPLER_H
+#define INCLUDED_DIGITAL_OFDM_SAMPLER_H
+
+#include <digital/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace digital {
+
+ /*!
+ * \brief does the rest of the OFDM stuff
+ * \ingroup ofdm_blk
+ */
+ class DIGITAL_API ofdm_sampler : virtual public gr_block
+ {
+ public:
+ // gr::digital::ofdm_sampler::sptr
+ typedef boost::shared_ptr<ofdm_sampler> sptr;
+
+ /*!
+ * Make an OFDM sampler block.
+ *
+ * \param fft_length The size of the FFT vector (occupied_carriers + unused carriers)
+ * \param symbol_length Length of the full symbol (fft_length + CP length)
+ * \param timeout timeout in samples when we stop looking for a symbol after initial ack.
+ */
+ static sptr make(unsigned int fft_length,
+ unsigned int symbol_length,
+ unsigned int timeout=1000);
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_DIGITAL_OFDM_SAMPLER_H */
diff --git a/gr-digital/include/digital/packet_sink.h b/gr-digital/include/digital/packet_sink.h
new file mode 100644
index 0000000000..cca3d49cec
--- /dev/null
+++ b/gr-digital/include/digital/packet_sink.h
@@ -0,0 +1,79 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_PACKET_SINK_H
+#define INCLUDED_GR_PACKET_SINK_H
+
+#include <digital/api.h>
+#include <gr_sync_block.h>
+#include <gr_msg_queue.h>
+
+namespace gr {
+ namespace digital {
+
+ /*!
+ * \brief process received bits looking for packet sync, header,
+ * and process bits into packet
+ * \ingroup sink_blk
+ *
+ * input: stream of symbols to be sliced.
+ *
+ * output: none. Pushes assembled packet into target queue
+ *
+ * The packet sink takes in a stream of binary symbols that are
+ * sliced around 0. The bits are then checked for the \p
+ * sync_vector to determine find and decode the packet. It then
+ * expects a fixed length header of 2 16-bit shorts containing the
+ * payload length, followed by the payload. If the 2 16-bit shorts
+ * are not identical, this packet is ignored. Better algs are
+ * welcome.
+ *
+ * This block is not very useful anymore as it only works with
+ * 2-level modulations such as BPSK or GMSK. The block can
+ * generally be replaced with a correlate access code and frame
+ * sink blocks.
+ */
+ class DIGITAL_API packet_sink : virtual public gr_sync_block
+ {
+ public:
+ // gr::digital::packet_sink::sptr
+ typedef boost::shared_ptr<packet_sink> sptr;
+
+ /*!
+ * Make a packet_sink block.
+ *
+ * \param sync_vector The synchronization vector as a vector of 1's and 0's.
+ * \param target_queue The message queue that packets are sent to.
+ * \param threshold Number of bits that can be incorrect in the \p sync_vector.
+ */
+ static sptr make(const std::vector<unsigned char>& sync_vector,
+ gr_msg_queue_sptr target_queue,
+ int threshold=-1);
+
+ //! return true if we detect carrier
+ virtual bool carrier_sensed() const = 0;
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_PACKET_SINK_H */
diff --git a/gr-digital/include/digital/pfb_clock_sync_ccf.h b/gr-digital/include/digital/pfb_clock_sync_ccf.h
new file mode 100644
index 0000000000..0720a15a88
--- /dev/null
+++ b/gr-digital/include/digital/pfb_clock_sync_ccf.h
@@ -0,0 +1,333 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009,2010,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef INCLUDED_DIGITAL_PFB_CLOCK_SYNC_CCF_H
+#define INCLUDED_DIGITAL_PFB_CLOCK_SYNC_CCF_H
+
+#include <digital/api.h>
+#include <filter/fir_filter.h>
+#include <gr_block.h>
+
+namespace gr {
+ namespace digital {
+
+ /*!
+ * \class digital_pfb_clock_sync_ccf
+ *
+ * \brief Timing synchronizer using polyphase filterbanks
+ *
+ * \ingroup filter_blk
+ * \ingroup pfb_blk
+ *
+ * This block performs timing synchronization for PAM signals by
+ * minimizing the derivative of the filtered signal, which in turn
+ * maximizes the SNR and minimizes ISI.
+ *
+ * This approach works by setting up two filterbanks; one
+ * filterbank contains the signal's pulse shaping matched filter
+ * (such as a root raised cosine filter), where each branch of the
+ * filterbank contains a different phase of the filter. The
+ * second filterbank contains the derivatives of the filters in
+ * the first filterbank. Thinking of this in the time domain, the
+ * first filterbank contains filters that have a sinc shape to
+ * them. We want to align the output signal to be sampled at
+ * exactly the peak of the sinc shape. The derivative of the sinc
+ * contains a zero at the maximum point of the sinc (sinc(0) = 1,
+ * sinc(0)' = 0). Furthermore, the region around the zero point
+ * is relatively linear. We make use of this fact to generate the
+ * error signal.
+ *
+ * If the signal out of the derivative filters is d_i[n] for the
+ * ith filter, and the output of the matched filter is x_i[n], we
+ * calculate the error as: e[n] = (Re{x_i[n]} * Re{d_i[n]} +
+ * Im{x_i[n]} * Im{d_i[n]}) / 2.0 This equation averages the error
+ * in the real and imaginary parts. There are two reasons we
+ * multiply by the signal itself. First, if the symbol could be
+ * positive or negative going, but we want the error term to
+ * always tell us to go in the same direction depending on which
+ * side of the zero point we are on. The sign of x_i[n] adjusts
+ * the error term to do this. Second, the magnitude of x_i[n]
+ * scales the error term depending on the symbol's amplitude, so
+ * larger signals give us a stronger error term because we have
+ * more confidence in that symbol's value. Using the magnitude of
+ * x_i[n] instead of just the sign is especially good for signals
+ * with low SNR.
+ *
+ * The error signal, e[n], gives us a value proportional to how
+ * far away from the zero point we are in the derivative
+ * signal. We want to drive this value to zero, so we set up a
+ * second order loop. We have two variables for this loop; d_k is
+ * the filter number in the filterbank we are on and d_rate is the
+ * rate which we travel through the filters in the steady
+ * state. That is, due to the natural clock differences between
+ * the transmitter and receiver, d_rate represents that difference
+ * and would traverse the filter phase paths to keep the receiver
+ * locked. Thinking of this as a second-order PLL, the d_rate is
+ * the frequency and d_k is the phase. So we update d_rate and d_k
+ * using the standard loop equations based on two error signals,
+ * d_alpha and d_beta. We have these two values set based on each
+ * other for a critically damped system, so in the block
+ * constructor, we just ask for "gain," which is d_alpha while
+ * d_beta is equal to (gain^2)/4.
+ *
+ * The block's parameters are:
+ *
+ * \li \p sps: The clock sync block needs to know the number of
+ * samples per symbol, because it defaults to return a single
+ * point representing the symbol. The sps can be any positive real
+ * number and does not need to be an integer.
+ *
+ * \li \p loop_bw: The loop bandwidth is used to set the gain of
+ * the inner control loop (see:
+ * http://gnuradio.squarespace.com/blog/2011/8/13/control-loop-gain-values.html).
+ * This should be set small (a value of around 2pi/100 is
+ * suggested in that blog post as the step size for the number of
+ * radians around the unit circle to move relative to the error).
+ *
+ * \li \p taps: One of the most important parameters for this
+ * block is the taps of the filter. One of the benefits of this
+ * algorithm is that you can put the matched filter in here as the
+ * taps, so you get both the matched filter and sample timing
+ * correction in one go. So create your normal matched filter. For
+ * a typical digital modulation, this is a root raised cosine
+ * filter. The number of taps of this filter is based on how long
+ * you expect the channel to be; that is, how many symbols do you
+ * want to combine to get the current symbols energy back (there's
+ * probably a better way of stating that). It's usually 5 to 10 or
+ * so. That gives you your filter, but now we need to think about
+ * it as a filter with different phase profiles in each filter. So
+ * take this number of taps and multiply it by the number of
+ * filters. This is the number you would use to create your
+ * prototype filter. When you use this in the PFB filerbank, it
+ * segments these taps into the filterbanks in such a way that
+ * each bank now represents the filter at different phases,
+ * equally spaced at 2pi/N, where N is the number of filters.
+ *
+ * \li \p filter_size (default=32): The number of filters can also
+ * be set and defaults to 32. With 32 filters, you get a good
+ * enough resolution in the phase to produce very small, almost
+ * unnoticeable, ISI. Going to 64 filters can reduce this more,
+ * but after that there is very little gained for the extra
+ * complexity.
+ *
+ * \li \p init_phase (default=0): The initial phase is another
+ * settable parameter and refers to the filter path the algorithm
+ * initially looks at (i.e., d_k starts at init_phase). This value
+ * defaults to zero, but it might be useful to start at a
+ * different phase offset, such as the mid-point of the filters.
+ *
+ * \li \p max_rate_deviation (default=1.5): The next parameter is
+ * the max_rate_devitation, which defaults to 1.5. This is how far
+ * we allow d_rate to swing, positive or negative, from
+ * 0. Constraining the rate can help keep the algorithm from
+ * walking too far away to lock during times when there is no
+ * signal.
+ *
+ * \li \p osps (default=1): The osps is the number of output
+ * samples per symbol. By default, the algorithm produces 1 sample
+ * per symbol, sampled at the exact sample value. This osps value
+ * was added to better work with equalizers, which do a better job
+ * of modeling the channel if they have 2 samps/sym.
+ */
+ class DIGITAL_API pfb_clock_sync_ccf : virtual public gr_block
+ {
+ public:
+ // gr::digital::pfb_clock_sync_ccf::sptr
+ typedef boost::shared_ptr<pfb_clock_sync_ccf> sptr;
+
+ /*!
+ * Build the polyphase filterbank timing synchronizer.
+ * \param sps (double) The number of samples per symbol in the incoming signal
+ * \param loop_bw (float) The bandwidth of the control loop; set's alpha and beta.
+ * \param taps (vector<int>) The filter taps.
+ * \param filter_size (uint) The number of filters in the filterbank (default = 32).
+ * \param init_phase (float) The initial phase to look at, or which filter to start
+ * with (default = 0).
+ * \param max_rate_deviation (float) Distance from 0 d_rate can get (default = 1.5).
+ * \param osps (int) The number of output samples per symbol (default=1).
+ */
+ static sptr make(double sps, float loop_bw,
+ const std::vector<float> &taps,
+ unsigned int filter_size=32,
+ float init_phase=0,
+ float max_rate_deviation=1.5,
+ int osps=1);
+
+ /*! \brief update the system gains from omega and eta
+ *
+ * This function updates the system gains based on the loop
+ * bandwidth and damping factor of the system.
+ * These two factors can be set separately through their own
+ * set functions.
+ */
+ virtual void update_gains() = 0;
+
+ /*!
+ * Resets the filterbank's filter taps with the new prototype filter
+ */
+ virtual void set_taps(const std::vector<float> &taps,
+ std::vector< std::vector<float> > &ourtaps,
+ std::vector<gr::filter::kernel::fir_filter_ccf*> &ourfilter) = 0;
+
+ /*!
+ * Returns all of the taps of the matched filter
+ */
+ virtual std::vector< std::vector<float> > taps() const = 0;
+
+ /*!
+ * Returns all of the taps of the derivative filter
+ */
+ virtual std::vector< std::vector<float> > diff_taps() const = 0;
+
+ /*!
+ * Returns the taps of the matched filter for a particular channel
+ */
+ virtual std::vector<float> channel_taps(int channel) const = 0;
+
+ /*!
+ * Returns the taps in the derivative filter for a particular channel
+ */
+ virtual std::vector<float> diff_channel_taps(int channel) const = 0;
+
+ /*!
+ * Return the taps as a formatted string for printing
+ */
+ virtual std::string taps_as_string() const = 0;
+
+ /*!
+ * Return the derivative filter taps as a formatted string for printing
+ */
+ virtual std::string diff_taps_as_string() const = 0;
+
+
+ /*******************************************************************
+ SET FUNCTIONS
+ *******************************************************************/
+
+ /*!
+ * \brief Set the loop bandwidth
+ *
+ * Set the loop filter's bandwidth to \p bw. This should be
+ * between 2*pi/200 and 2*pi/100 (in rads/samp). It must also be
+ * a positive number.
+ *
+ * When a new damping factor is set, the gains, alpha and beta,
+ * of the loop are recalculated by a call to update_gains().
+ *
+ * \param bw (float) new bandwidth
+ */
+ virtual void set_loop_bandwidth(float bw) = 0;
+
+ /*!
+ * \brief Set the loop damping factor
+ *
+ * Set the loop filter's damping factor to \p df. The damping
+ * factor should be sqrt(2)/2.0 for critically damped systems.
+ * Set it to anything else only if you know what you are
+ * doing. It must be a number between 0 and 1.
+ *
+ * When a new damping factor is set, the gains, alpha and beta,
+ * of the loop are recalculated by a call to update_gains().
+ *
+ * \param df (float) new damping factor
+ */
+ virtual void set_damping_factor(float df) = 0;
+
+ /*!
+ * \brief Set the loop gain alpha
+ *
+ * Set's the loop filter's alpha gain parameter.
+ *
+ * This value should really only be set by adjusting the loop
+ * bandwidth and damping factor.
+ *
+ * \param alpha (float) new alpha gain
+ */
+ virtual void set_alpha(float alpha) = 0;
+
+ /*!
+ * \brief Set the loop gain beta
+ *
+ * Set's the loop filter's beta gain parameter.
+ *
+ * This value should really only be set by adjusting the loop
+ * bandwidth and damping factor.
+ *
+ * \param beta (float) new beta gain
+ */
+ virtual void set_beta(float beta) = 0;
+
+ /*!
+ * Set the maximum deviation from 0 d_rate can have
+ */
+ virtual void set_max_rate_deviation(float m) = 0;
+
+ /*******************************************************************
+ GET FUNCTIONS
+ *******************************************************************/
+
+ /*!
+ * \brief Returns the loop bandwidth
+ */
+ virtual float loop_bandwidth() const = 0;
+
+ /*!
+ * \brief Returns the loop damping factor
+ */
+ virtual float damping_factor() const = 0;
+
+ /*!
+ * \brief Returns the loop gain alpha
+ */
+ virtual float alpha() const = 0;
+
+ /*!
+ * \brief Returns the loop gain beta
+ */
+ virtual float beta() const = 0;
+
+ /*!
+ * \brief Returns the current clock rate
+ */
+ virtual float clock_rate() const = 0;
+
+ /*!
+ * \brief Returns the current error of the control loop.
+ */
+ virtual float error() const = 0;
+
+ /*!
+ * \brief Returns the current rate of the control loop.
+ */
+ virtual float rate() const = 0;
+
+ /*!
+ * \brief Returns the current phase arm of the control loop.
+ */
+ virtual float phase() const = 0;
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_DIGITAL_PFB_CLOCK_SYNC_CCF_H */
diff --git a/gr-digital/include/digital/pfb_clock_sync_fff.h b/gr-digital/include/digital/pfb_clock_sync_fff.h
new file mode 100644
index 0000000000..5bc04e07d4
--- /dev/null
+++ b/gr-digital/include/digital/pfb_clock_sync_fff.h
@@ -0,0 +1,319 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009,2010,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_DIGITAL_PFB_CLOCK_SYNC_FFF_H
+#define INCLUDED_DIGITAL_PFB_CLOCK_SYNC_FFF_H
+
+#include <digital/api.h>
+#include <filter/fir_filter.h>
+#include <gr_block.h>
+
+namespace gr {
+ namespace digital {
+
+ /*!
+ * \class digital_pfb_clock_sync_fff
+ *
+ * \brief Timing synchronizer using polyphase filterbanks
+ *
+ * \ingroup filter_blk
+ * \ingroup pfb_blk
+ *
+ * This block performs timing synchronization for PAM signals by
+ * minimizing the derivative of the filtered signal, which in turn
+ * maximizes the SNR and minimizes ISI.
+ *
+ * This approach works by setting up two filterbanks; one
+ * filterbank contains the signal's pulse shaping matched filter
+ * (such as a root raised cosine filter), where each branch of the
+ * filterbank contains a different phase of the filter. The
+ * second filterbank contains the derivatives of the filters in
+ * the first filterbank. Thinking of this in the time domain, the
+ * first filterbank contains filters that have a sinc shape to
+ * them. We want to align the output signal to be sampled at
+ * exactly the peak of the sinc shape. The derivative of the sinc
+ * contains a zero at the maximum point of the sinc (sinc(0) = 1,
+ * sinc(0)' = 0). Furthermore, the region around the zero point
+ * is relatively linear. We make use of this fact to generate the
+ * error signal.
+ *
+ * If the signal out of the derivative filters is d_i[n] for the
+ * ith filter, and the output of the matched filter is x_i[n], we
+ * calculate the error as: e[n] = (Re{x_i[n]} * Re{d_i[n]} +
+ * Im{x_i[n]} * Im{d_i[n]}) / 2.0 This equation averages the error
+ * in the real and imaginary parts. There are two reasons we
+ * multiply by the signal itself. First, if the symbol could be
+ * positive or negative going, but we want the error term to
+ * always tell us to go in the same direction depending on which
+ * side of the zero point we are on. The sign of x_i[n] adjusts
+ * the error term to do this. Second, the magnitude of x_i[n]
+ * scales the error term depending on the symbol's amplitude, so
+ * larger signals give us a stronger error term because we have
+ * more confidence in that symbol's value. Using the magnitude of
+ * x_i[n] instead of just the sign is especially good for signals
+ * with low SNR.
+ *
+ * The error signal, e[n], gives us a value proportional to how
+ * far away from the zero point we are in the derivative
+ * signal. We want to drive this value to zero, so we set up a
+ * second order loop. We have two variables for this loop; d_k is
+ * the filter number in the filterbank we are on and d_rate is the
+ * rate which we travel through the filters in the steady
+ * state. That is, due to the natural clock differences between
+ * the transmitter and receiver, d_rate represents that difference
+ * and would traverse the filter phase paths to keep the receiver
+ * locked. Thinking of this as a second-order PLL, the d_rate is
+ * the frequency and d_k is the phase. So we update d_rate and d_k
+ * using the standard loop equations based on two error signals,
+ * d_alpha and d_beta. We have these two values set based on each
+ * other for a critically damped system, so in the block
+ * constructor, we just ask for "gain," which is d_alpha while
+ * d_beta is equal to (gain^2)/4.
+ *
+ * The block's parameters are:
+ *
+ * \li \p sps: The clock sync block needs to know the number of
+ * samples per symbol, because it defaults to return a single
+ * point representing the symbol. The sps can be any positive real
+ * number and does not need to be an integer.
+ *
+ * \li \p loop_bw: The loop bandwidth is used to set the gain of
+ * the inner control loop (see:
+ * http://gnuradio.squarespace.com/blog/2011/8/13/control-loop-gain-values.html).
+ * This should be set small (a value of around 2pi/100 is
+ * suggested in that blog post as the step size for the number of
+ * radians around the unit circle to move relative to the error).
+ *
+ * \li \p taps: One of the most important parameters for this
+ * block is the taps of the filter. One of the benefits of this
+ * algorithm is that you can put the matched filter in here as the
+ * taps, so you get both the matched filter and sample timing
+ * correction in one go. So create your normal matched filter. For
+ * a typical digital modulation, this is a root raised cosine
+ * filter. The number of taps of this filter is based on how long
+ * you expect the channel to be; that is, how many symbols do you
+ * want to combine to get the current symbols energy back (there's
+ * probably a better way of stating that). It's usually 5 to 10 or
+ * so. That gives you your filter, but now we need to think about
+ * it as a filter with different phase profiles in each filter. So
+ * take this number of taps and multiply it by the number of
+ * filters. This is the number you would use to create your
+ * prototype filter. When you use this in the PFB filerbank, it
+ * segments these taps into the filterbanks in such a way that
+ * each bank now represents the filter at different phases,
+ * equally spaced at 2pi/N, where N is the number of filters.
+ *
+ * \li \p filter_size (default=32): The number of filters can also
+ * be set and defaults to 32. With 32 filters, you get a good
+ * enough resolution in the phase to produce very small, almost
+ * unnoticeable, ISI. Going to 64 filters can reduce this more,
+ * but after that there is very little gained for the extra
+ * complexity.
+ *
+ * \li \p init_phase (default=0): The initial phase is another
+ * settable parameter and refers to the filter path the algorithm
+ * initially looks at (i.e., d_k starts at init_phase). This value
+ * defaults to zero, but it might be useful to start at a
+ * different phase offset, such as the mid-point of the filters.
+ *
+ * \li \p max_rate_deviation (default=1.5): The next parameter is
+ * the max_rate_devitation, which defaults to 1.5. This is how far
+ * we allow d_rate to swing, positive or negative, from
+ * 0. Constraining the rate can help keep the algorithm from
+ * walking too far away to lock during times when there is no
+ * signal.
+ *
+ * \li \p osps (default=1): The osps is the number of output
+ * samples per symbol. By default, the algorithm produces 1 sample
+ * per symbol, sampled at the exact sample value. This osps value
+ * was added to better work with equalizers, which do a better job
+ * of modeling the channel if they have 2 samps/sym.
+ */
+ class DIGITAL_API pfb_clock_sync_fff : virtual public gr_block
+ {
+ public:
+ // gr::digital::pfb_clock_sync_fff::sptr
+ typedef boost::shared_ptr<pfb_clock_sync_fff> sptr;
+
+ /*!
+ * Build the polyphase filterbank timing synchronizer.
+ * \param sps (double) The number of samples per second in the incoming signal
+ * \param gain (float) The alpha gain of the control loop; beta = (gain^2)/4 by default.
+ * \param taps (vector<int>) The filter taps.
+ * \param filter_size (uint) The number of filters in the filterbank (default = 32).
+ * \param init_phase (float) The initial phase to look at, or which filter to start
+ * with (default = 0).
+ * \param max_rate_deviation (float) Distance from 0 d_rate can get (default = 1.5).
+ * \param osps (int) The number of output samples per symbol (default=1).
+ *
+ */
+ static sptr make(double sps, float gain,
+ const std::vector<float> &taps,
+ unsigned int filter_size=32,
+ float init_phase=0,
+ float max_rate_deviation=1.5,
+ int osps=1);
+
+ /*! \brief update the system gains from omega and eta
+ *
+ * This function updates the system gains based on the loop
+ * bandwidth and damping factor of the system.
+ * These two factors can be set separately through their own
+ * set functions.
+ */
+ virtual void update_gains() = 0;
+
+ /*!
+ * Resets the filterbank's filter taps with the new prototype filter
+ */
+ virtual void set_taps(const std::vector<float> &taps,
+ std::vector< std::vector<float> > &ourtaps,
+ std::vector<gr::filter::kernel::fir_filter_fff*> &ourfilter) = 0;
+
+ /*!
+ * Returns all of the taps of the matched filter
+ */
+ virtual std::vector< std::vector<float> > taps() const = 0;
+
+ /*!
+ * Returns all of the taps of the derivative filter
+ */
+ virtual std::vector< std::vector<float> > diff_taps() const = 0;
+
+ /*!
+ * Returns the taps of the matched filter for a particular channel
+ */
+ virtual std::vector<float> channel_taps(int channel) const = 0;
+
+ /*!
+ * Returns the taps in the derivative filter for a particular channel
+ */
+ virtual std::vector<float> diff_channel_taps(int channel) const = 0;
+
+ /*!
+ * Return the taps as a formatted string for printing
+ */
+ virtual std::string taps_as_string() const = 0;
+
+ /*!
+ * Return the derivative filter taps as a formatted string for printing
+ */
+ virtual std::string diff_taps_as_string() const = 0;
+
+
+ /*******************************************************************
+ SET FUNCTIONS
+ *******************************************************************/
+
+
+ /*!
+ * \brief Set the loop bandwidth
+ *
+ * Set the loop filter's bandwidth to \p bw. This should be
+ * between 2*pi/200 and 2*pi/100 (in rads/samp). It must also be
+ * a positive number.
+ *
+ * When a new damping factor is set, the gains, alpha and beta,
+ * of the loop are recalculated by a call to update_gains().
+ *
+ * \param bw (float) new bandwidth
+ */
+ virtual void set_loop_bandwidth(float bw) = 0;
+
+ /*!
+ * \brief Set the loop damping factor
+ *
+ * Set the loop filter's damping factor to \p df. The damping
+ * factor should be sqrt(2)/2.0 for critically damped systems.
+ * Set it to anything else only if you know what you are
+ * doing. It must be a number between 0 and 1.
+ *
+ * When a new damping factor is set, the gains, alpha and beta,
+ * of the loop are recalculated by a call to update_gains().
+ *
+ * \param df (float) new damping factor
+ */
+ virtual void set_damping_factor(float df) = 0;
+
+ /*!
+ * \brief Set the loop gain alpha
+ *
+ * Set's the loop filter's alpha gain parameter.
+ *
+ * This value should really only be set by adjusting the loop
+ * bandwidth and damping factor.
+ *
+ * \param alpha (float) new alpha gain
+ */
+ virtual void set_alpha(float alpha) = 0;
+
+ /*!
+ * \brief Set the loop gain beta
+ *
+ * Set's the loop filter's beta gain parameter.
+ *
+ * This value should really only be set by adjusting the loop
+ * bandwidth and damping factor.
+ *
+ * \param beta (float) new beta gain
+ */
+ virtual void set_beta(float beta) = 0;
+
+ /*!
+ * Set the maximum deviation from 0 d_rate can have
+ */
+ virtual void set_max_rate_deviation(float m) = 0;
+
+ /*******************************************************************
+ GET FUNCTIONS
+ *******************************************************************/
+
+ /*!
+ * \brief Returns the loop bandwidth
+ */
+ virtual float loop_bandwidth() const = 0;
+
+ /*!
+ * \brief Returns the loop damping factor
+ */
+ virtual float damping_factor() const = 0;
+
+ /*!
+ * \brief Returns the loop gain alpha
+ */
+ virtual float alpha() const = 0;
+
+ /*!
+ * \brief Returns the loop gain beta
+ */
+ virtual float beta() const = 0;
+
+ /*!
+ * \brief Returns the current clock rate
+ */
+ virtual float clock_rate() const = 0;
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_DIGITAL_PFB_CLOCK_SYNC_FFF_H */
diff --git a/gr-digital/include/digital/pn_correlator_cc.h b/gr-digital/include/digital/pn_correlator_cc.h
new file mode 100644
index 0000000000..257cbbfe01
--- /dev/null
+++ b/gr-digital/include/digital/pn_correlator_cc.h
@@ -0,0 +1,63 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_PN_CORRELATOR_CC_H
+#define INCLUDED_GR_PN_CORRELATOR_CC_H
+
+#include <digital/api.h>
+#include <gr_sync_decimator.h>
+
+namespace gr {
+ namespace digital {
+
+ /*!
+ * \brief PN code sequential search correlator
+ *
+ * \ingroup sync_blk
+ *
+ * Receives complex baseband signal, outputs complex correlation
+ * against reference PN code, one sample per PN code period. The
+ * PN sequence is generated using a GLFSR.
+ */
+ class DIGITAL_API pn_correlator_cc : virtual public gr_sync_decimator
+ {
+ public:
+ // gr::digital::pn_correlator_cc::sptr
+ typedef boost::shared_ptr<pn_correlator_cc> sptr;
+
+ /*!
+ * \brief Make PN code sequential search correlator block.
+ *
+ * \param degree Degree of shift register must be in [1, 32]. If mask
+ * is 0, the degree determines a default mask (see
+ * digital_impl_glfsr.cc for the mapping).
+ * \param mask Allows a user-defined bit mask for indexes of the shift
+ * register to feed back.
+ * \param seed Initial setting for values in shift register.
+ */
+ static sptr make(int degree, int mask=0, int seed=1);
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_PN_CORRELATOR_CC_H */
diff --git a/gr-digital/include/digital/probe_density_b.h b/gr-digital/include/digital/probe_density_b.h
new file mode 100644
index 0000000000..a81daf3f03
--- /dev/null
+++ b/gr-digital/include/digital/probe_density_b.h
@@ -0,0 +1,66 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2012 Free Software Foundation, Inc.
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_PROBE_DENSITY_B_H
+#define INCLUDED_GR_PROBE_DENSITY_B_H
+
+#include <digital/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace digital {
+
+ /*!
+ * This block maintains a running average of the input stream and
+ * makes it available as an accessor function. The input stream
+ * is type unsigned char.
+ *
+ * If you send this block a stream of unpacked bytes, it will tell
+ * you what the bit density is.
+ */
+ class DIGITAL_API probe_density_b : virtual public gr_sync_block
+ {
+ public:
+ // gr::digital::probe_density_b::sptr
+ typedef boost::shared_ptr<probe_density_b> sptr;
+
+ /*!
+ * Make a density probe block.
+ *
+ * \param alpha Average filter constant
+ *
+ */
+ static sptr make(double alpha);
+
+ /*!
+ * \brief Returns the current density value
+ */
+ virtual double density() const = 0;
+
+ /*!
+ * \brief Set the average filter constant
+ */
+ virtual void set_alpha(double alpha) = 0;
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_PROBE_DENSITY_B_H */
diff --git a/gr-digital/include/digital/probe_mpsk_snr_est_c.h b/gr-digital/include/digital/probe_mpsk_snr_est_c.h
new file mode 100644
index 0000000000..b58f1ab864
--- /dev/null
+++ b/gr-digital/include/digital/probe_mpsk_snr_est_c.h
@@ -0,0 +1,94 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_DIGITAL_PROBE_MPSK_SNR_EST_C_H
+#define INCLUDED_DIGITAL_PROBE_MPSK_SNR_EST_C_H
+
+#include <digital/api.h>
+#include <digital/mpsk_snr_est.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace digital {
+
+ //! \brief A probe for computing SNR of a signal.
+ /*! \ingroup snr_blk
+ *
+ * This is a probe block (a sink) that can be used to monitor and
+ * retrieve estimations of the signal SNR. This probe is designed
+ * for use with M-PSK signals especially. The type of estimator
+ * is specified as the \p type parameter in the constructor. The
+ * estimators tend to trade off performance for accuracy,
+ * although experimentation should be done to figure out the
+ * right approach for a given implementation. Further, the
+ * current set of estimators are designed and proven
+ * theoretically under AWGN conditions; some amount of error
+ * should be assumed and/or estimated for real channel
+ * conditions.
+ */
+ class DIGITAL_API probe_mpsk_snr_est_c : virtual public gr_sync_block
+ {
+ public:
+ // gr::digital::probe_mpsk_snr_est_c::sptr
+ typedef boost::shared_ptr<probe_mpsk_snr_est_c> sptr;
+
+ /*! Make an MPSK SNR probe.
+ *
+ * Parameters:
+ *
+ * \param type: the type of estimator to use \ref ref_snr_est_types
+ * "snr_est_type_t" for details about the available types.
+ * \param msg_nsamples: [not implemented yet] after this many
+ * samples, a message containing the SNR (key='snr') will be sent
+ * \param alpha: the update rate of internal running average
+ * calculations.
+ */
+ static sptr make(snr_est_type_t type,
+ int msg_nsamples=10000,
+ double alpha=0.001);
+
+ //! Return the estimated signal-to-noise ratio in decibels
+ virtual double snr() = 0;
+
+ //! Return the type of estimator in use
+ virtual snr_est_type_t type() const = 0;
+
+ //! Return how many samples between SNR messages
+ virtual int msg_nsample() const = 0;
+
+ //! Get the running-average coefficient
+ virtual double alpha() const = 0;
+
+ //! Set type of estimator to use
+ virtual void set_type(snr_est_type_t t) = 0;
+
+ //! Set the number of samples between SNR messages
+ virtual void set_msg_nsample(int n) = 0;
+
+ //! Set the running-average coefficient
+ virtual void set_alpha(double alpha) = 0;
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_DIGITAL_PROBE_MPSK_SNR_EST_C_H */
diff --git a/gr-digital/include/digital/scrambler_bb.h b/gr-digital/include/digital/scrambler_bb.h
new file mode 100644
index 0000000000..95fce6dad7
--- /dev/null
+++ b/gr-digital/include/digital/scrambler_bb.h
@@ -0,0 +1,59 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_SCRAMBLER_BB_H
+#define INCLUDED_GR_SCRAMBLER_BB_H
+
+#include <digital/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace digital {
+
+ /*!
+ * \brief Scramble an input stream using an LFSR.
+ * \ingroup coding_blk
+ *
+ * This block works on the LSB only of the input data stream,
+ * i.e., on an "unpacked binary" stream, and produces the same
+ * format on its output.
+ */
+ class DIGITAL_API scrambler_bb : virtual public gr_sync_block
+ {
+ public:
+ // gr::digital::scrambler_bb::sptr
+ typedef boost::shared_ptr<scrambler_bb> sptr;
+
+ /*!
+ * Make a scramber block.
+ *
+ * \param mask Polynomial mask for LFSR
+ * \param seed Initial shift register contents
+ * \param len Shift register length
+ */
+ static sptr make(int mask, int seed, int len);
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_SCRAMBLER_BB_H */
diff --git a/gr-digital/swig/digital_simple_correlator.i b/gr-digital/include/digital/simple_correlator.h
index 5ad5ca26cc..b75dc24765 100644
--- a/gr-digital/swig/digital_simple_correlator.i
+++ b/gr-digital/include/digital/simple_correlator.h
@@ -20,12 +20,29 @@
* Boston, MA 02110-1301, USA.
*/
-GR_SWIG_BLOCK_MAGIC(digital,simple_correlator);
+#ifndef INCLUDED_GR_SIMPLE_CORRELATOR_H
+#define INCLUDED_GR_SIMPLE_CORRELATOR_H
-digital_simple_correlator_sptr digital_make_simple_correlator(int payload_bytesize);
+#include <digital/api.h>
+#include <gr_block.h>
-class digital_simple_correlator : public gr_block
-{
- private:
- digital_simple_correlator(int payload_bytesize);
-};
+namespace gr {
+ namespace digital {
+
+ /*!
+ * \brief inverse of simple_framer (more or less)
+ * \ingroup sync_blk
+ */
+ class DIGITAL_API simple_correlator : virtual public gr_block
+ {
+ public:
+ // gr::digital::simple_correlator::sptr
+ typedef boost::shared_ptr<simple_correlator> sptr;
+
+ static sptr make(int payload_bytesize);
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_SIMPLE_CORRELATOR_H */
diff --git a/gr-digital/include/digital/simple_framer.h b/gr-digital/include/digital/simple_framer.h
new file mode 100644
index 0000000000..9e223081fb
--- /dev/null
+++ b/gr-digital/include/digital/simple_framer.h
@@ -0,0 +1,57 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_SIMPLE_FRAMER_H
+#define INCLUDED_GR_SIMPLE_FRAMER_H
+
+#include <digital/api.h>
+#include <gr_block.h>
+
+namespace gr {
+ namespace digital {
+
+ /*!
+ * \brief add sync field, seq number and command field to payload
+ * \ingroup sync_blk
+ *
+ * Takes in enough samples to create a full output frame. The
+ * frame is prepended with the GRSF_SYNC (defind in
+ * simple_framer_sync.h) and an 8-bit sequence number.
+ */
+ class DIGITAL_API simple_framer : virtual public gr_block
+ {
+ public:
+ // gr::digital::simple_framer::sptr
+ typedef boost::shared_ptr<simple_framer> sptr;
+
+ /*!
+ * Make a simple_framer block.
+ *
+ * \param payload_bytesize The size of the payload in bytes.
+ */
+ static sptr make(int payload_bytesize);
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_SIMPLE_FRAMER_H */
diff --git a/gr-digital/include/digital/simple_framer_sync.h b/gr-digital/include/digital/simple_framer_sync.h
new file mode 100644
index 0000000000..5dd2b82c3c
--- /dev/null
+++ b/gr-digital/include/digital/simple_framer_sync.h
@@ -0,0 +1,57 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2005,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_SIMPLE_FRAMER_SYNC_H
+#define INCLUDED_GR_SIMPLE_FRAMER_SYNC_H
+
+namespace gr {
+ namespace digital {
+
+ /*!
+ * \brief Here are a couple of maximum length sequences
+ * (m-sequences) that were generated by the the "mseq"
+ * matlab/octave code downloaded from: <a
+ * href="http://www.mathworks.com/matlabcentral/fileexchange/990">http://www.mathworks.com/matlabcentral/fileexchange/990</a>
+ *
+ * <pre>
+ * 31-bit m-sequence:
+ * 0110100100001010111011000111110
+ * 0x690AEC76 (padded on right with a zero)
+ *
+ * 63-bit m-sequence:
+ * 101011001101110110100100111000101111001010001100001000001111110
+ * 0xACDDA4E2F28C20FC (padded on right with a zero)
+ * </pre>
+ */
+
+ static const unsigned long long GRSF_SYNC = 0xacdda4e2f28c20fcULL;
+
+ static const int GRSF_BITS_PER_BYTE = 8;
+ static const int GRSF_SYNC_OVERHEAD = sizeof(GRSF_SYNC);
+ static const int GRSF_PAYLOAD_OVERHEAD = 1; // 1 byte seqno
+ static const int GRSF_TAIL_PAD = 1; // one byte trailing padding
+ static const int GRSF_OVERHEAD = GRSF_SYNC_OVERHEAD + GRSF_PAYLOAD_OVERHEAD + GRSF_TAIL_PAD;
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_SIMPLE_FRAMER_SYNC_H */
diff --git a/gr-digital/include/digital_additive_scrambler_bb.h b/gr-digital/include/digital_additive_scrambler_bb.h
deleted file mode 100644
index f1d0113e96..0000000000
--- a/gr-digital/include/digital_additive_scrambler_bb.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2008,2010,2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-#ifndef INCLUDED_GR_ADDITIVE_SCRAMBLER_BB_H
-#define INCLUDED_GR_ADDITIVE_SCRAMBLER_BB_H
-
-#include <digital_api.h>
-#include <gr_sync_block.h>
-#include <analog/lfsr.h>
-
-class digital_additive_scrambler_bb;
-typedef boost::shared_ptr<digital_additive_scrambler_bb> digital_additive_scrambler_bb_sptr;
-
-DIGITAL_API digital_additive_scrambler_bb_sptr
-digital_make_additive_scrambler_bb(int mask, int seed,
- int len, int count=0);
-
-/*!
- * Scramble an input stream using an LFSR. This block works on the LSB only
- * of the input data stream, i.e., on an "unpacked binary" stream, and
- * produces the same format on its output.
- *
- * \param mask Polynomial mask for LFSR
- * \param seed Initial shift register contents
- * \param len Shift register length
- * \param count Number of bits after which shift register is reset, 0=never
- *
- * The scrambler works by XORing the incoming bit stream by the output of
- * the LFSR. Optionally, after 'count' bits have been processed, the shift
- * register is reset to the seed value. This allows processing fixed length
- * vectors of samples.
- *
- * \ingroup coding_blk
- */
-
-class DIGITAL_API digital_additive_scrambler_bb : public gr_sync_block
-{
- friend DIGITAL_API digital_additive_scrambler_bb_sptr
- digital_make_additive_scrambler_bb(int mask, int seed,
- int len, int count);
-
- gr::analog::lfsr d_lfsr;
- int d_count;
- int d_bits;
-
- digital_additive_scrambler_bb(int mask, int seed,
- int len, int count);
-
-public:
- int work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
-
-#endif /* INCLUDED_GR_ADDITIVE_SCRAMBLER_BB_H */
diff --git a/gr-digital/include/digital_api.h b/gr-digital/include/digital_api.h
deleted file mode 100644
index d45ace13f2..0000000000
--- a/gr-digital/include/digital_api.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright 2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_DIGITAL_API_H
-#define INCLUDED_DIGITAL_API_H
-
-#include <gruel/attributes.h>
-
-#ifdef gnuradio_digital_EXPORTS
-# define DIGITAL_API __GR_ATTR_EXPORT
-#else
-# define DIGITAL_API __GR_ATTR_IMPORT
-#endif
-
-#endif /* INCLUDED_DIGITAL_API_H */
diff --git a/gr-digital/include/digital_bytes_to_syms.h b/gr-digital/include/digital_bytes_to_syms.h
deleted file mode 100644
index 3062366b95..0000000000
--- a/gr-digital/include/digital_bytes_to_syms.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-#ifndef INCLUDED_GR_BYTES_TO_SYMS_H
-#define INCLUDED_GR_BYTES_TO_SYMS_H
-
-#include <digital_api.h>
-#include <gr_sync_interpolator.h>
-
-class digital_bytes_to_syms;
-typedef boost::shared_ptr<digital_bytes_to_syms> digital_bytes_to_syms_sptr;
-
-DIGITAL_API digital_bytes_to_syms_sptr digital_make_bytes_to_syms();
-
-/*!
- * \brief Convert stream of bytes to stream of +/- 1 symbols
- * \ingroup converter_blk
- *
- * input: stream of bytes; output: stream of float
- *
- * This block is deprecated.
- *
- * The combination of gr_packed_to_unpacked_bb followed by
- * gr_chunks_to_symbols_bf or gr_chunks_to_symbols_bc handles the
- * general case of mapping from a stream of bytes into arbitrary float
- * or complex symbols.
- *
- * \sa gr_packed_to_unpacked_bb, gr_unpacked_to_packed_bb,
- * \sa gr_chunks_to_symbols_bf, gr_chunks_to_symbols_bc.
- */
-class DIGITAL_API digital_bytes_to_syms : public gr_sync_interpolator
-{
- friend DIGITAL_API digital_bytes_to_syms_sptr
- digital_make_bytes_to_syms();
-
- digital_bytes_to_syms();
-
- public:
- int work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
-
-#endif /* INCLUDED_GR_BYTES_TO_SYMS_H */
diff --git a/gr-digital/include/digital_chunks_to_symbols_XX.h.t b/gr-digital/include/digital_chunks_to_symbols_XX.h.t
deleted file mode 100644
index 92b7c94d58..0000000000
--- a/gr-digital/include/digital_chunks_to_symbols_XX.h.t
+++ /dev/null
@@ -1,75 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-// @WARNING@
-
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
-
-#include <digital_api.h>
-#include <gr_sync_interpolator.h>
-
-class @NAME@;
-typedef boost::shared_ptr<@NAME@> @SPTR_NAME@;
-
-DIGITAL_API @SPTR_NAME@
-digital_make_@BASE_NAME@ (const std::vector<@O_TYPE@> &symbol_table, const int D = 1);
-
-/*!
- * \brief Map a stream of symbol indexes (unpacked bytes or shorts) to stream of float or complex constellation points in D dimensions (D = 1 by default)
- * \ingroup converter_blk
- *
- * input: stream of @I_TYPE@; output: stream of @O_TYPE@
- *
- * out[n D + k] = symbol_table[in[n] D + k], k=0,1,...,D-1
- *
- * The combination of gr_packed_to_unpacked_XX followed by
- * gr_chunks_to_symbols_XY handles the general case of mapping
- * from a stream of bytes or shorts into arbitrary float
- * or complex symbols.
- *
- * \sa gr_packed_to_unpacked_bb, gr_unpacked_to_packed_bb,
- * \sa gr_packed_to_unpacked_ss, gr_unpacked_to_packed_ss,
- * \sa digital_chunks_to_symbols_bf, digital_chunks_to_symbols_bc.
- * \sa digital_chunks_to_symbols_sf, digital_chunks_to_symbols_sc.
- */
-
-class DIGITAL_API @NAME@ : public gr_sync_interpolator
-{
- friend DIGITAL_API @SPTR_NAME@ digital_make_@BASE_NAME@
- (const std::vector<@O_TYPE@> &symbol_table, const int D);
-
- int d_D;
- std::vector<@O_TYPE@> d_symbol_table;
- @NAME@ (const std::vector<@O_TYPE@> &symbol_table, const int D = 1);
-
- public:
- int D () const { return d_D; }
- std::vector<@O_TYPE@> symbol_table () const { return d_symbol_table; }
- int work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-
- bool check_topology(int ninputs, int noutputs) { return ninputs == noutputs; }
-};
-
-#endif
diff --git a/gr-digital/include/digital_clock_recovery_mm_cc.h b/gr-digital/include/digital_clock_recovery_mm_cc.h
deleted file mode 100644
index a2577d5378..0000000000
--- a/gr-digital/include/digital_clock_recovery_mm_cc.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_DIGITAL_CLOCK_RECOVERY_MM_CC_H
-#define INCLUDED_DIGITAL_CLOCK_RECOVERY_MM_CC_H
-
-#include <digital_api.h>
-#include <gr_block.h>
-#include <gr_complex.h>
-#include <gr_math.h>
-
-class gri_mmse_fir_interpolator_cc;
-
-class digital_clock_recovery_mm_cc;
-typedef boost::shared_ptr<digital_clock_recovery_mm_cc> digital_clock_recovery_mm_cc_sptr;
-
-// public constructor
-DIGITAL_API digital_clock_recovery_mm_cc_sptr
-digital_make_clock_recovery_mm_cc (float omega, float gain_omega,
- float mu, float gain_mu,
- float omega_relative_limit=0.001);
-
-/*!
- * \brief Mueller and Müller (M&M) based clock recovery block with complex input, complex output.
- * \ingroup sync_blk
- * \ingroup digital
- *
- * This implements the Mueller and Müller (M&M) discrete-time
- * error-tracking synchronizer.
- *
- * The complex version here is based on:
- * Modified Mueller and Muller clock recovery circuit
- * Based:
- * G. R. Danesfahani, T.G. Jeans, "Optimisation of modified Mueller
- * and Muller algorithm," Electronics Letters, Vol. 31, no. 13, 22
- * June 1995, pp. 1032 - 1033.
- */
-class DIGITAL_API digital_clock_recovery_mm_cc : public gr_block
-{
- public:
- ~digital_clock_recovery_mm_cc ();
- void forecast(int noutput_items, gr_vector_int &ninput_items_required);
- int general_work (int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
- float mu() const { return d_mu;}
- float omega() const { return d_omega;}
- float gain_mu() const { return d_gain_mu;}
- float gain_omega() const { return d_gain_omega;}
- void set_verbose (bool verbose) { d_verbose = verbose; }
-
- void set_gain_mu (float gain_mu) { d_gain_mu = gain_mu; }
- void set_gain_omega (float gain_omega) { d_gain_omega = gain_omega; }
- void set_mu (float mu) { d_mu = mu; }
- void set_omega (float omega) {
- d_omega = omega;
- d_min_omega = omega*(1.0 - d_omega_relative_limit);
- d_max_omega = omega*(1.0 + d_omega_relative_limit);
- d_omega_mid = 0.5*(d_min_omega+d_max_omega);
- }
-
-protected:
- digital_clock_recovery_mm_cc (float omega, float gain_omega,
- float mu, float gain_mu,
- float omega_relative_limi);
-
- private:
- float d_mu;
- float d_omega;
- float d_gain_omega;
- float d_min_omega; // minimum allowed omega
- float d_max_omega; // maximum allowed omeg
- float d_omega_relative_limit; // used to compute min and max omega
- float d_omega_mid;
- float d_gain_mu;
- gr_complex d_last_sample;
- gri_mmse_fir_interpolator_cc *d_interp;
- bool d_verbose;
-
- gr_complex d_p_2T;
- gr_complex d_p_1T;
- gr_complex d_p_0T;
-
- gr_complex d_c_2T;
- gr_complex d_c_1T;
- gr_complex d_c_0T;
-
- gr_complex slicer_0deg (gr_complex sample);
- gr_complex slicer_45deg (gr_complex sample);
-
- friend DIGITAL_API digital_clock_recovery_mm_cc_sptr
- digital_make_clock_recovery_mm_cc (float omega, float gain_omega,
- float mu, float gain_mu,
- float omega_relative_limit);
-};
-
-#endif
diff --git a/gr-digital/include/digital_clock_recovery_mm_ff.h b/gr-digital/include/digital_clock_recovery_mm_ff.h
deleted file mode 100644
index 36749553fb..0000000000
--- a/gr-digital/include/digital_clock_recovery_mm_ff.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_DIGITAL_CLOCK_RECOVERY_MM_FF_H
-#define INCLUDED_DIGITAL_CLOCK_RECOVERY_MM_FF_H
-
-#include <digital_api.h>
-#include <gr_block.h>
-#include <gr_math.h>
-#include <stdio.h>
-
-class gri_mmse_fir_interpolator;
-
-class digital_clock_recovery_mm_ff;
-typedef boost::shared_ptr<digital_clock_recovery_mm_ff> digital_clock_recovery_mm_ff_sptr;
-
-// public constructor
-DIGITAL_API digital_clock_recovery_mm_ff_sptr
-digital_make_clock_recovery_mm_ff (float omega, float gain_omega,
- float mu, float gain_mu,
- float omega_relative_limit=0.001);
-
-/*!
- * \brief Mueller and Müller (M&M) based clock recovery block with float input, float output.
- * \ingroup sync_blk
- * \ingroup digital
- *
- * This implements the Mueller and Müller (M&M) discrete-time error-tracking synchronizer.
- *
- * See "Digital Communication Receivers: Synchronization, Channel
- * Estimation and Signal Processing" by Heinrich Meyr, Marc Moeneclaey, & Stefan Fechtel.
- * ISBN 0-471-50275-8.
- */
-class DIGITAL_API digital_clock_recovery_mm_ff : public gr_block
-{
- public:
- ~digital_clock_recovery_mm_ff ();
- void forecast(int noutput_items, gr_vector_int &ninput_items_required);
- int general_work (int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
- float mu() const { return d_mu;}
- float omega() const { return d_omega;}
- float gain_mu() const { return d_gain_mu;}
- float gain_omega() const { return d_gain_omega;}
-
- void set_gain_mu (float gain_mu) { d_gain_mu = gain_mu; }
- void set_gain_omega (float gain_omega) { d_gain_omega = gain_omega; }
- void set_mu (float mu) { d_mu = mu; }
- void set_omega (float omega){
- d_omega = omega;
- d_min_omega = omega*(1.0 - d_omega_relative_limit);
- d_max_omega = omega*(1.0 + d_omega_relative_limit);
- d_omega_mid = 0.5*(d_min_omega+d_max_omega);
- }
-
-protected:
- digital_clock_recovery_mm_ff (float omega, float gain_omega, float mu, float gain_mu,
- float omega_relative_limit);
-
- private:
- float d_mu; // fractional sample position [0.0, 1.0]
- float d_omega; // nominal frequency
- float d_min_omega; // minimum allowed omega
- float d_omega_mid; // average omega
- float d_max_omega; // maximum allowed omega
- float d_gain_omega; // gain for adjusting omega
- float d_gain_mu; // gain for adjusting mu
- float d_last_sample;
- gri_mmse_fir_interpolator *d_interp;
- FILE *d_logfile;
- float d_omega_relative_limit; // used to compute min and max omega
-
- friend DIGITAL_API digital_clock_recovery_mm_ff_sptr
- digital_make_clock_recovery_mm_ff (float omega, float gain_omega,
- float mu, float gain_mu,
- float omega_relative_limit);
-};
-
-#endif
diff --git a/gr-digital/include/digital_cma_equalizer_cc.h b/gr-digital/include/digital_cma_equalizer_cc.h
deleted file mode 100644
index 79e84ca4b3..0000000000
--- a/gr-digital/include/digital_cma_equalizer_cc.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_DIGITAL_CMA_EQUALIZER_CC_H
-#define INCLUDED_DIGITAL_CMA_EQUALIZER_CC_H
-
-#include <digital_api.h>
-#include <gr_adaptive_fir_ccc.h>
-#include <gr_math.h>
-#include <iostream>
-
-class digital_cma_equalizer_cc;
-typedef boost::shared_ptr<digital_cma_equalizer_cc> digital_cma_equalizer_cc_sptr;
-
-DIGITAL_API digital_cma_equalizer_cc_sptr
-digital_make_cma_equalizer_cc(int num_taps, float modulus, float mu, int sps);
-
-/*!
- * \brief Implements constant modulus adaptive filter on complex stream
- * \ingroup eq_blk
- * \ingroup digital
- *
- * The error value and tap update equations (for p=2) can be found in:
- *
- * "D. Godard, "Self-Recovering Equalization and Carrier Tracking in
- * Two-Dimensional Data Communication Systems," IEEE Transactions on
- * Communications, Vol. 28, No. 11, pp. 1867 - 1875, 1980."
- */
-class DIGITAL_API digital_cma_equalizer_cc : public gr_adaptive_fir_ccc
-{
-private:
- float d_modulus;
- float d_mu;
-
- friend DIGITAL_API digital_cma_equalizer_cc_sptr digital_make_cma_equalizer_cc(int num_taps,
- float modulus,
- float mu,
- int sps);
- digital_cma_equalizer_cc(int num_taps, float modulus, float mu, int sps);
-
-protected:
-
- virtual gr_complex error(const gr_complex &out)
- {
- gr_complex error = out*(norm(out) - d_modulus);
- float re = gr_clip(error.real(), 1.0);
- float im = gr_clip(error.imag(), 1.0);
- return gr_complex(re, im);
- }
-
- virtual void update_tap(gr_complex &tap, const gr_complex &in)
- {
- // Hn+1 = Hn - mu*conj(Xn)*zn*(|zn|^2 - 1)
- tap -= d_mu*conj(in)*d_error;
- }
-
-public:
- float get_gain()
- {
- return d_mu;
- }
-
- void set_gain(float mu)
- {
- if(mu < 0.0f || mu > 1.0f) {
- throw std::out_of_range("digital_cma_equalizer::set_gain: Gain value must be in [0,1]");
- }
- d_mu = mu;
- }
-
- float get_modulus()
- {
- return d_modulus;
- }
-
- void set_modulus(float mod)
- {
- if(mod < 0)
- throw std::out_of_range("digital_cma_equalizer::set_modulus: Modulus value must be >= 0");
- d_modulus = mod;
- }
-};
-
-#endif
diff --git a/gr-digital/include/digital_constellation.h b/gr-digital/include/digital_constellation.h
deleted file mode 100644
index b9c27bbc44..0000000000
--- a/gr-digital/include/digital_constellation.h
+++ /dev/null
@@ -1,526 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2010, 2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_DIGITAL_CONSTELLATION_H
-#define INCLUDED_DIGITAL_CONSTELLATION_H
-
-#include <digital_api.h>
-#include <vector>
-#include <math.h>
-#include <gr_complex.h>
-#include <boost/enable_shared_from_this.hpp>
-#include <digital_metric_type.h>
-
-/************************************************************/
-/* digital_constellation */
-/* */
-/* Base class defining interface. */
-/************************************************************/
-
-class digital_constellation;
-typedef boost::shared_ptr<digital_constellation> digital_constellation_sptr;
-
-/*!
- * \brief An abstracted constellation object
- * \ingroup digital
- *
- * The constellation objects hold the necessary information to pass
- * around constellation information for modulators and
- * demodulators. These objects contain the mapping between the bits
- * and the constellation points used to represent them as well as
- * methods for slicing the symbol space. Various implementations are
- * possible for efficiency and ease of use.
- *
- * Standard constellations (BPSK, QPSK, QAM, etc) can be inherited
- * from this class and overloaded to perform optimized slicing and
- * constellation mappings.
- */
-class DIGITAL_API digital_constellation : public boost::enable_shared_from_this<digital_constellation>
-{
-public:
- digital_constellation (std::vector<gr_complex> constellation,
- std::vector<unsigned int> pre_diff_code,
- unsigned int rotational_symmetry,
- unsigned int dimensionality);
- digital_constellation ();
-
- //! Returns the constellation points for a symbol value
- void map_to_points(unsigned int value, gr_complex *points);
- std::vector<gr_complex> map_to_points_v(unsigned int value);
-
- //! Returns the constellation point that matches best.
- virtual unsigned int decision_maker (const gr_complex *sample) = 0;
- //! Takes a vector rather than a pointer. Better for SWIG wrapping.
- unsigned int decision_maker_v (std::vector<gr_complex> sample);
- //! Also calculates the phase error.
- unsigned int decision_maker_pe (const gr_complex *sample, float *phase_error);
- //! Calculates distance.
- unsigned int decision_maker_e (const gr_complex *sample, float *error);
-
- //! Calculates metrics for all points in the constellation.
- //! For use with the viterbi algorithm.
- virtual void calc_metric(const gr_complex *sample, float *metric, trellis_metric_type_t type);
- virtual void calc_euclidean_metric(const gr_complex *sample, float *metric);
- virtual void calc_hard_symbol_metric(const gr_complex *sample, float *metric);
-
- //! Returns the set of points in this constellation.
- std::vector<gr_complex> points() { return d_constellation;}
- //! Returns the vector of points in this constellation.
- //! Raise error if dimensionality is not one.
- std::vector<gr_complex> s_points();
- //! Returns a vector of vectors of points.
- std::vector<std::vector<gr_complex> > v_points();
- //! Whether to apply an encoding before doing differential encoding. (e.g. gray coding)
- bool apply_pre_diff_code() { return d_apply_pre_diff_code;}
- //! Whether to apply an encoding before doing differential encoding. (e.g. gray coding)
- void set_pre_diff_code(bool a) { d_apply_pre_diff_code = a;}
- //! Returns the encoding to apply before differential encoding.
- std::vector<unsigned int> pre_diff_code() { return d_pre_diff_code;}
- //! Returns the order of rotational symmetry.
- unsigned int rotational_symmetry() { return d_rotational_symmetry;}
- //! Returns the number of complex numbers in a single symbol.
- unsigned int dimensionality() {return d_dimensionality;}
-
- unsigned int bits_per_symbol () {
- return floor(log(double(d_constellation.size()))/d_dimensionality/log(2.0));
- }
-
- unsigned int arity () {
- return d_arity;
- }
-
- digital_constellation_sptr base() {
- return shared_from_this();
- }
-
- protected:
-
- std::vector<gr_complex> d_constellation;
- std::vector<unsigned int> d_pre_diff_code;
- bool d_apply_pre_diff_code;
- unsigned int d_rotational_symmetry;
- unsigned int d_dimensionality;
- unsigned int d_arity;
- // The orignal constellation points were multiplied by this factor to get a
- // constellation with average magnitude 1.
- float d_scalefactor;
-
- float get_distance(unsigned int index, const gr_complex *sample);
- unsigned int get_closest_point(const gr_complex *sample);
- void calc_arity ();
-};
-
-/************************************************************/
-/* digital_constellation_calcdist */
-/* */
-/************************************************************/
-
-class digital_constellation_calcdist;
-typedef boost::shared_ptr<digital_constellation_calcdist> digital_constellation_calcdist_sptr;
-
-// public constructor
-DIGITAL_API digital_constellation_calcdist_sptr
-digital_make_constellation_calcdist (std::vector<gr_complex> constellation,
- std::vector<unsigned int> pre_diff_code,
- unsigned int rotational_symmetry,
- unsigned int dimensionality);
-
-
-/*! \brief Calculate Euclidian distance for any constellation
- * \ingroup digital
- *
- * Constellation which calculates the distance to each point in the
- * constellation for decision making. Inefficient for large
- * constellations.
- */
-class DIGITAL_API digital_constellation_calcdist : public digital_constellation
-{
- public:
- digital_constellation_calcdist (std::vector<gr_complex> constellation,
- std::vector<unsigned int> pre_diff_code,
- unsigned int rotational_symmetry,
- unsigned int dimensionality);
- unsigned int decision_maker (const gr_complex *sample);
- // void calc_metric(gr_complex *sample, float *metric, trellis_metric_type_t type);
- // void calc_euclidean_metric(gr_complex *sample, float *metric);
- // void calc_hard_symbol_metric(gr_complex *sample, float *metric);
-
- private:
- friend DIGITAL_API digital_constellation_calcdist_sptr
- digital_make_constellation_calcdist (std::vector<gr_complex> constellation);
-};
-
-
-/************************************************************/
-/*! digital_constellation_sector */
-/************************************************************/
-
-/*!
- * \brief Sectorized digital constellation
- * \ingroup digital
- *
- * Constellation space is divided into sectors. Each sector is
- * associated with the nearest constellation point.
- *
- */
-class DIGITAL_API digital_constellation_sector : public digital_constellation
-{
- public:
-
- digital_constellation_sector (std::vector<gr_complex> constellation,
- std::vector<unsigned int> pre_diff_code,
- unsigned int rotational_symmetry,
- unsigned int dimensionality,
- unsigned int n_sectors);
-
- unsigned int decision_maker (const gr_complex *sample);
-
- protected:
-
- virtual unsigned int get_sector (const gr_complex *sample) = 0;
- virtual unsigned int calc_sector_value (unsigned int sector) = 0;
- void find_sector_values ();
-
- unsigned int n_sectors;
-
- private:
-
- std::vector<unsigned int> sector_values;
-
-};
-
-/************************************************************/
-/* digital_constellation_rect */
-/************************************************************/
-
-/*!
- * \brief Rectangular digital constellation
- * \ingroup digital
- *
- * Only implemented for 1-(complex)dimensional constellation.
- *
- * Constellation space is divided into rectangular sectors. Each
- * sector is associated with the nearest constellation point.
- *
- * Works well for square QAM.
- *
- * Works for any generic constellation provided sectors are not too
- * large.
- */
-
-class digital_constellation_rect;
-typedef boost::shared_ptr<digital_constellation_rect> digital_constellation_rect_sptr;
-
-// public constructor
-DIGITAL_API digital_constellation_rect_sptr
-digital_make_constellation_rect (std::vector<gr_complex> constellation,
- std::vector<unsigned int> pre_diff_code,
- unsigned int rotational_symmetry,
- unsigned int real_sectors,
- unsigned int imag_sectors,
- float width_real_sectors,
- float width_imag_sectors);
-
-class DIGITAL_API digital_constellation_rect : public digital_constellation_sector
-{
- public:
-
- digital_constellation_rect (std::vector<gr_complex> constellation,
- std::vector<unsigned int> pre_diff_code,
- unsigned int rotational_symmetry,
- unsigned int real_sectors,
- unsigned int imag_sectors,
- float width_real_sectors,
- float width_imag_sectors);
-
- protected:
-
- unsigned int get_sector (const gr_complex *sample);
-
- unsigned int calc_sector_value (unsigned int sector);
-
- private:
-
- unsigned int n_real_sectors;
- unsigned int n_imag_sectors;
- float d_width_real_sectors;
- float d_width_imag_sectors;
-
- friend DIGITAL_API digital_constellation_rect_sptr
- digital_make_constellation_rect (std::vector<gr_complex> constellation,
- std::vector<unsigned int> pre_diff_code,
- unsigned int rotational_symmetry,
- unsigned int real_sectors,
- unsigned int imag_sectors,
- float width_real_sectors,
- float width_imag_sectors);
-
-};
-
-/************************************************************/
-/* digital_constellation_expl_rect */
-/************************************************************/
-
-/*!
- * \brief Rectangular digital constellation
- * \ingroup digital
- *
- * Only implemented for 1-(complex)dimensional constellation.
- *
- * Constellation space is divided into rectangular sectors. Each
- * sector is associated with the nearest constellation point.
- *
- * This class is different from constellation_rect in that the mapping
- * from sector to constellation point is explicitly passed into the
- * constructor as sector_values. Usually we do not need this, since
- * we want each sector to be automatically mapped to the closest
- * constellation point, however sometimes it's nice to have the
- * flexibility.
- */
-
-class digital_constellation_expl_rect;
-typedef boost::shared_ptr<digital_constellation_expl_rect> digital_constellation_expl_rect_sptr;
-
-// public constructor
-DIGITAL_API digital_constellation_expl_rect_sptr
-digital_make_constellation_expl_rect (
- std::vector<gr_complex> constellation,
- std::vector<unsigned int> pre_diff_code,
- unsigned int rotational_symmetry,
- unsigned int real_sectors,
- unsigned int imag_sectors,
- float width_real_sectors,
- float width_imag_sectors,
- std::vector<unsigned int> sector_values
-);
-
-class DIGITAL_API digital_constellation_expl_rect : public digital_constellation_rect
-{
- public:
-
- digital_constellation_expl_rect (
- std::vector<gr_complex> constellation,
- std::vector<unsigned int> pre_diff_code,
- unsigned int rotational_symmetry,
- unsigned int real_sectors,
- unsigned int imag_sectors,
- float width_real_sectors,
- float width_imag_sectors,
- std::vector<unsigned int> sector_values
- );
-
- protected:
- unsigned int calc_sector_value (unsigned int sector) {
- return d_sector_values[sector];
- }
-
- private:
- std::vector<unsigned int> d_sector_values;
-
- friend DIGITAL_API digital_constellation_expl_rect_sptr
- digital_make_constellation_expl_rect (
- std::vector<gr_complex> constellation,
- std::vector<unsigned int> pre_diff_code,
- unsigned int rotational_symmetry,
- unsigned int real_sectors,
- unsigned int imag_sectors,
- float width_real_sectors,
- float width_imag_sectors,
- std::vector<unsigned int> sector_values
- );
-
-};
-
-
-/************************************************************/
-/* digital_constellation_psk */
-/************************************************************/
-
-class digital_constellation_psk;
-typedef boost::shared_ptr<digital_constellation_psk> digital_constellation_psk_sptr;
-
-// public constructor
-DIGITAL_API digital_constellation_psk_sptr
-digital_make_constellation_psk (std::vector<gr_complex> constellation,
- std::vector<unsigned int> pre_diff_code,
- unsigned int n_sectors);
-
-/*!
- * \brief digital_constellation_psk
- * \ingroup digital
- *
- * Constellation space is divided into pie slices sectors.
- *
- * Each slice is associated with the nearest constellation point.
- *
- * Works well for PSK but nothing else.
- *
- * Assumes that there is a constellation point at 1.x
- */
-class DIGITAL_API digital_constellation_psk : public digital_constellation_sector
-{
- public:
-
- digital_constellation_psk (std::vector<gr_complex> constellation,
- std::vector<unsigned int> pre_diff_code,
- unsigned int n_sectors);
-
- protected:
-
- unsigned int get_sector (const gr_complex *sample);
-
- unsigned int calc_sector_value (unsigned int sector);
-
- private:
-
- friend DIGITAL_API digital_constellation_psk_sptr
- digital_make_constellation_psk (std::vector<gr_complex> constellation,
- std::vector<unsigned int> pre_diff_code,
- unsigned int n_sectors);
-
-};
-
-
-/************************************************************/
-/* digital_constellation_bpsk */
-/* */
-/* Only works for BPSK. */
-/* */
-/************************************************************/
-
-class digital_constellation_bpsk;
-typedef boost::shared_ptr<digital_constellation_bpsk> digital_constellation_bpsk_sptr;
-
-// public constructor
-DIGITAL_API digital_constellation_bpsk_sptr
-digital_make_constellation_bpsk ();
-
-/*!
- * \brief Digital constellation for BPSK
- * \ingroup digital
- */
-class DIGITAL_API digital_constellation_bpsk : public digital_constellation
-{
- public:
-
- digital_constellation_bpsk ();
- unsigned int decision_maker (const gr_complex *sample);
-
- friend DIGITAL_API digital_constellation_bpsk_sptr
- digital_make_constellation_bpsk ();
-
-};
-
-
-/************************************************************/
-/* digital_constellation_qpsk */
-/* */
-/* Only works for QPSK. */
-/* */
-/************************************************************/
-
-class digital_constellation_qpsk;
-typedef boost::shared_ptr<digital_constellation_qpsk> digital_constellation_qpsk_sptr;
-
-// public constructor
-DIGITAL_API digital_constellation_qpsk_sptr
-digital_make_constellation_qpsk ();
-
-/*!
- * \brief Digital constellation for QPSK
- * \ingroup digital
- */
-class DIGITAL_API digital_constellation_qpsk : public digital_constellation
-{
- public:
-
- digital_constellation_qpsk ();
- unsigned int decision_maker (const gr_complex *sample);
-
- friend DIGITAL_API digital_constellation_qpsk_sptr
- digital_make_constellation_qpsk ();
-
-};
-
-
-/************************************************************/
-/* digital_constellation_dqpsk */
-/* */
-/* Works with differential encoding; slower decisions. */
-/* */
-/************************************************************/
-
-class digital_constellation_dqpsk;
-typedef boost::shared_ptr<digital_constellation_dqpsk> digital_constellation_dqpsk_sptr;
-
-// public constructor
-DIGITAL_API digital_constellation_dqpsk_sptr
-digital_make_constellation_dqpsk ();
-
-/*!
- * \brief Digital constellation for DQPSK
- * \ingroup digital
- */
-class DIGITAL_API digital_constellation_dqpsk : public digital_constellation
-{
- public:
-
- digital_constellation_dqpsk ();
- unsigned int decision_maker (const gr_complex *sample);
-
- friend DIGITAL_API digital_constellation_dqpsk_sptr
- digital_make_constellation_dqpsk ();
-
-};
-
-
-/************************************************************/
-/* digital_constellation_8psk */
-/* */
-/* Only works for 8PSK. */
-/* */
-/************************************************************/
-
-class digital_constellation_8psk;
-typedef boost::shared_ptr<digital_constellation_8psk> digital_constellation_8psk_sptr;
-
-// public constructor
-DIGITAL_API digital_constellation_8psk_sptr
-digital_make_constellation_8psk ();
-
-/*!
- * \brief Digital constellation for 8PSK
- * \ingroup digital
- */
-class DIGITAL_API digital_constellation_8psk : public digital_constellation
-{
- public:
-
- digital_constellation_8psk ();
- unsigned int decision_maker (const gr_complex *sample);
-
- friend DIGITAL_API digital_constellation_8psk_sptr
- digital_make_constellation_8psk ();
-
-};
-
-#endif
diff --git a/gr-digital/include/digital_constellation_decoder_cb.h b/gr-digital/include/digital_constellation_decoder_cb.h
deleted file mode 100644
index cce3a564f3..0000000000
--- a/gr-digital/include/digital_constellation_decoder_cb.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_DIGITAL_CONSTELLATION_DECODER_CB_H
-#define INCLUDED_DIGITAL_CONSTELLATION_DECODER_CB_H
-
-#include <digital_api.h>
-#include <gr_block.h>
-#include <digital_constellation.h>
-#include <vector>
-
-class digital_constellation_decoder_cb;
-typedef boost::shared_ptr<digital_constellation_decoder_cb>digital_constellation_decoder_cb_sptr;
-
-DIGITAL_API digital_constellation_decoder_cb_sptr
-digital_make_constellation_decoder_cb (digital_constellation_sptr constellation);
-
-/*!
- * \brief Constellation Decoder
- * \ingroup coding_blk
- * \ingroup digital
- *
- */
-class DIGITAL_API digital_constellation_decoder_cb : public gr_block
-{
-
- private:
- digital_constellation_sptr d_constellation;
- unsigned int d_dim;
-
- friend DIGITAL_API digital_constellation_decoder_cb_sptr
- digital_make_constellation_decoder_cb (digital_constellation_sptr constellation);
-
- digital_constellation_decoder_cb (digital_constellation_sptr constellation);
-
- public:
-
- void forecast (int noutput_items,
- gr_vector_int &ninput_items_required);
-
- int general_work (int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
-
-#endif
diff --git a/gr-digital/include/digital_constellation_receiver_cb.h b/gr-digital/include/digital_constellation_receiver_cb.h
deleted file mode 100644
index 92c31311f7..0000000000
--- a/gr-digital/include/digital_constellation_receiver_cb.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_DIGITAL_CONSTELLATION_RECEIVER_CB_H
-#define INCLUDED_DIGITAL_CONSTELLATION_RECEIVER_CB_H
-
-#include <digital_api.h>
-#include <gr_block.h>
-#include <digital_constellation.h>
-#include <gruel/attributes.h>
-#include <gri_control_loop.h>
-#include <gr_complex.h>
-#include <math.h>
-#include <fstream>
-
-class digital_constellation_receiver_cb;
-typedef boost::shared_ptr<digital_constellation_receiver_cb> digital_constellation_receiver_cb_sptr;
-
-// public constructor
-DIGITAL_API digital_constellation_receiver_cb_sptr
-digital_make_constellation_receiver_cb (digital_constellation_sptr constellation,
- float loop_bw, float fmin, float fmax);
-
-/*!
- * \brief This block does fine-phase and frequency locking and decision making.
- * \ingroup sync_blk
- * \ingroup demod_blk
- * \ingroup digital
- *
- * The phase and frequency synchronization are based on a Costas loop
- * that finds the error of the incoming signal point compared to its
- * nearest constellation point. The frequency and phase of the NCO are
- * updated according to this error.
- *
- * The decicision making itself is performed by the appropriate method of the
- * passed constellation object.
- *
- */
-
-class DIGITAL_API digital_constellation_receiver_cb : public gr_block, public gri_control_loop
-{
-public:
- int general_work (int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-
-protected:
-
- /*!
- * \brief Constructor to synchronize incoming M-PSK symbols
- *
- * \param constellation constellation object for generic demodulation
- * \param loop_bw Loop bandwidth of the Costas Loop (~ 2pi/100)
- * \param fmin minimum normalized frequency value the loop can achieve
- * \param fmax maximum normalized frequency value the loop can achieve
- *
- */
- digital_constellation_receiver_cb (digital_constellation_sptr constellation,
- float loop_bw, float fmin, float fmax);
-
- void phase_error_tracking(float phase_error);
-
-private:
- unsigned int d_M;
-
- digital_constellation_sptr d_constellation;
- unsigned int d_current_const_point;
-
- //! delay line length.
- static const unsigned int DLLEN = 8;
-
- //! delay line plus some length for overflow protection
- __GR_ATTR_ALIGNED(8) gr_complex d_dl[2*DLLEN];
-
- //! index to delay line
- unsigned int d_dl_idx;
-
- friend DIGITAL_API digital_constellation_receiver_cb_sptr
- digital_make_constellation_receiver_cb (digital_constellation_sptr constell,
- float loop_bw, float fmin, float fmax);
-};
-
-#endif
diff --git a/gr-digital/include/digital_correlate_access_code_bb.h b/gr-digital/include/digital_correlate_access_code_bb.h
deleted file mode 100644
index 8095dd4090..0000000000
--- a/gr-digital/include/digital_correlate_access_code_bb.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2005,2006,2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_DIGITAL_CORRELATE_ACCESS_CODE_BB_H
-#define INCLUDED_DIGITAL_CORRELATE_ACCESS_CODE_BB_H
-
-#include <digital_api.h>
-#include <gr_sync_block.h>
-#include <string>
-
-class digital_correlate_access_code_bb;
-typedef boost::shared_ptr<digital_correlate_access_code_bb> digital_correlate_access_code_bb_sptr;
-
-/*!
- * \param access_code is represented with 1 byte per bit, e.g., "010101010111000100"
- * \param threshold maximum number of bits that may be wrong
- */
-DIGITAL_API digital_correlate_access_code_bb_sptr
-digital_make_correlate_access_code_bb (const std::string &access_code, int threshold);
-
-/*!
- * \brief Examine input for specified access code, one bit at a time.
- * \ingroup sync_blk
- * \ingroup digital
- *
- * input: stream of bits, 1 bit per input byte (data in LSB)
- * output: stream of bits, 2 bits per output byte (data in LSB, flag in next higher bit)
- *
- * Each output byte contains two valid bits, the data bit, and the
- * flag bit. The LSB (bit 0) is the data bit, and is the original
- * input data, delayed 64 bits. Bit 1 is the
- * flag bit and is 1 if the corresponding data bit is the first data
- * bit following the access code. Otherwise the flag bit is 0.
- */
-class DIGITAL_API digital_correlate_access_code_bb : public gr_sync_block
-{
- friend DIGITAL_API digital_correlate_access_code_bb_sptr
- digital_make_correlate_access_code_bb (const std::string &access_code, int threshold);
- private:
- unsigned long long d_access_code; // access code to locate start of packet
- // access code is left justified in the word
- unsigned long long d_data_reg; // used to look for access_code
- unsigned long long d_flag_reg; // keep track of decisions
- unsigned long long d_flag_bit; // mask containing 1 bit which is location of new flag
- unsigned long long d_mask; // masks access_code bits (top N bits are set where
- // N is the number of bits in the access code)
- unsigned int d_threshold; // how many bits may be wrong in sync vector
-
- protected:
- digital_correlate_access_code_bb(const std::string &access_code, int threshold);
-
- public:
- ~digital_correlate_access_code_bb();
-
- int work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-
-
- /*!
- * \param access_code is represented with 1 byte per bit, e.g., "010101010111000100"
- */
- bool set_access_code (const std::string &access_code);
-};
-
-#endif /* INCLUDED_DIGITAL_CORRELATE_ACCESS_CODE_BB_H */
diff --git a/gr-digital/include/digital_correlate_access_code_tag_bb.h b/gr-digital/include/digital_correlate_access_code_tag_bb.h
deleted file mode 100644
index b4a12108f4..0000000000
--- a/gr-digital/include/digital_correlate_access_code_tag_bb.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2005,2006,2011,2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_digital_correlate_access_code_tag_bb_H
-#define INCLUDED_digital_correlate_access_code_tag_bb_H
-
-#include <digital_api.h>
-#include <gr_sync_block.h>
-#include <string>
-
-class digital_correlate_access_code_tag_bb;
-typedef boost::shared_ptr<digital_correlate_access_code_tag_bb> digital_correlate_access_code_tag_bb_sptr;
-
-/*!
- * \param access_code is represented with 1 byte per bit, e.g., "010101010111000100"
- * \param threshold maximum number of bits that may be wrong
- * \param tag_name key of the tag inserted into the tag stream
- */
-DIGITAL_API digital_correlate_access_code_tag_bb_sptr
-digital_make_correlate_access_code_tag_bb(const std::string &access_code,
- int threshold,
- const std::string &tag_name);
-
-/*!
- * \brief Examine input for specified access code, one bit at a time.
- * \ingroup sync_blk
- *
- * input: stream of bits, 1 bit per input byte (data in LSB)
- * output: unaltered stream of bits (plus tags)
- *
- * This block annotates the input stream with tags. The tags have key
- * name [tag_name], specified in the constructor. Used for searching
- * an input data stream for preambles, etc.
- */
-class DIGITAL_API digital_correlate_access_code_tag_bb : public gr_sync_block
-{
- friend DIGITAL_API digital_correlate_access_code_tag_bb_sptr
- digital_make_correlate_access_code_tag_bb(const std::string &access_code,
- int threshold,
- const std::string &tag_name);
- private:
- unsigned long long d_access_code; // access code to locate start of packet
- // access code is left justified in the word
- unsigned long long d_data_reg; // used to look for access_code
- unsigned long long d_mask; // masks access_code bits (top N bits are set where
- // N is the number of bits in the access code)
- unsigned int d_threshold; // how many bits may be wrong in sync vector
- unsigned int d_len; // the length of the access code
-
- pmt::pmt_t d_key, d_me; //d_key is the tag name, d_me is the block name + unique ID
-
- protected:
- digital_correlate_access_code_tag_bb(const std::string &access_code,
- int threshold,
- const std::string &tag_name);
-
- public:
- ~digital_correlate_access_code_tag_bb();
-
- int work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-
- /*!
- * \param access_code is represented with 1 byte per bit, e.g., "010101010111000100"
- */
- bool set_access_code(const std::string &access_code);
-};
-
-#endif /* INCLUDED_digital_correlate_access_code_tag_bb_H */
diff --git a/gr-digital/include/digital_costas_loop_cc.h b/gr-digital/include/digital_costas_loop_cc.h
deleted file mode 100644
index 4aab22fb45..0000000000
--- a/gr-digital/include/digital_costas_loop_cc.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2006,2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-
-#ifndef INCLUDED_DIGITAL_COSTAS_LOOP_CC_H
-#define INCLUDED_DIGITAL_COSTAS_LOOP_CC_H
-
-#include <gr_sync_block.h>
-#include <gri_control_loop.h>
-#include <stdexcept>
-#include <fstream>
-
-
-/*!
- * \brief A Costas loop carrier recovery module.
- * \ingroup sync_blk
- * \ingroup digital
- *
- * The Costas loop locks to the center frequency of a signal and
- * downconverts it to baseband. The second (order=2) order loop is
- * used for BPSK where the real part of the output signal is the
- * baseband BPSK signal and the imaginary part is the error
- * signal. When order=4, it can be used for quadrature modulations
- * where both I and Q (real and imaginary) are outputted.
- *
- * More details can be found online:
- *
- * J. Feigin, "Practical Costas loop design: Designing a simple and
- * inexpensive BPSK Costas loop carrier recovery circuit," RF signal
- * processing, pp. 20-36, 2002.
- *
- * http://rfdesign.com/images/archive/0102Feigin20.pdf
- *
- * \param loop_bw internal 2nd order loop bandwidth (~ 2pi/100)
- * \param order the loop order, either 2, 4, or 8
- */
-
-#include <digital_api.h>
-
-class digital_costas_loop_cc;
-typedef boost::shared_ptr<digital_costas_loop_cc> digital_costas_loop_cc_sptr;
-
-
-DIGITAL_API digital_costas_loop_cc_sptr
-digital_make_costas_loop_cc (float loop_bw, int order
- ) throw (std::invalid_argument);
-
-
-/*!
- * \brief Carrier tracking PLL for QPSK
- * \ingroup sync_blk
- * input: complex; output: complex
- * <br>The Costas loop can have two output streams:
- * stream 1 is the baseband I and Q;
- * stream 2 is the normalized frequency of the loop
- *
- * \p order must be 2, 4, or 8.
- */
-class DIGITAL_API digital_costas_loop_cc : public gr_sync_block, public gri_control_loop
-{
- friend DIGITAL_API digital_costas_loop_cc_sptr
- digital_make_costas_loop_cc (float loop_bw, int order
- ) throw (std::invalid_argument);
-
- int d_order;
-
- digital_costas_loop_cc (float loop_bw, int order
- ) throw (std::invalid_argument);
-
- /*! \brief the phase detector circuit for 8th-order PSK loops
- * \param sample complex sample
- * \return the phase error
- */
- float phase_detector_8(gr_complex sample) const; // for 8PSK
-
- /*! \brief the phase detector circuit for fourth-order loops
- * \param sample complex sample
- * \return the phase error
- */
- float phase_detector_4(gr_complex sample) const; // for QPSK
-
- /*! \brief the phase detector circuit for second-order loops
- * \param sample a complex sample
- * \return the phase error
- */
- float phase_detector_2(gr_complex sample) const; // for BPSK
-
-
- float (digital_costas_loop_cc::*d_phase_detector)(gr_complex sample) const;
-
-public:
-
- int work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
-
-#endif
diff --git a/gr-digital/include/digital_cpmmod_bc.h b/gr-digital/include/digital_cpmmod_bc.h
deleted file mode 100644
index f0f11ee30e..0000000000
--- a/gr-digital/include/digital_cpmmod_bc.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2010 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_DIGITAL_CPMMOD_BC_H
-#define INCLUDED_DIGITAL_CPMMOD_BC_H
-
-#include <digital_api.h>
-#include <gr_hier_block2.h>
-#include <gr_char_to_float.h>
-#include <gr_interp_fir_filter_fff.h>
-#include <gr_frequency_modulator_fc.h>
-#include <gr_cpm.h>
-
-
-class digital_cpmmod_bc;
-typedef boost::shared_ptr<digital_cpmmod_bc> digital_cpmmod_bc_sptr;
-
-
-DIGITAL_API digital_cpmmod_bc_sptr
-digital_make_cpmmod_bc(int type, float h,
- unsigned samples_per_sym,
- unsigned L, double beta=0.3);
-
-/*!
- * \brief Generic CPM modulator
- *
- * \ingroup modulation_blk
- * \ingroup digital
- *
- * \param type The modulation type. Can be one of LREC, LRC, LSRC, TFM
- * or GAUSSIAN. See gr_cpm::phase_response() for a
- * detailed description.
- * \param h The modulation index. \f$ h \cdot \pi\f$ is the maximum
- * phase change that can occur between two symbols, i.e., if
- * you only send ones, the phase will increase by \f$ h \cdot
- * \pi\f$ every \p samples_per_sym samples. Set this to 0.5
- * for Minimum Shift Keying variants.
- * \param samples_per_sym Samples per symbol.
- * \param L The length of the phase duration in symbols. For L=1, this
- * yields full- response CPM symbols, for L > 1,
- * partial-response.
- * \param beta For LSRC, this is the rolloff factor. For Gaussian
- * pulses, this is the 3 dB time-bandwidth product.
- *
- * Examples:
- * - Setting h = 0.5, L = 1, type = LREC yields MSK.
- * - Setting h = 0.5, type = GAUSSIAN and beta = 0.3 yields GMSK
- * as used in GSM.
- *
- * The input of this block are symbols from an M-ary alphabet
- * +/-1, +/-3, ..., +/-(M-1). Usually, M = 2 and therefore, the
- * valid inputs are +/-1.
- * The modulator will silently accept any other inputs, though.
- * The output is the phase-modulated signal.
- */
-class DIGITAL_API digital_cpmmod_bc : public gr_hier_block2
-{
- friend DIGITAL_API digital_cpmmod_bc_sptr
- digital_make_cpmmod_bc(int type, float h,
- unsigned samples_per_sym,
- unsigned L, double beta);
-
- std::vector<float> d_taps;
- gr_char_to_float_sptr d_char_to_float;
- gr_interp_fir_filter_fff_sptr d_pulse_shaper;
- gr_frequency_modulator_fc_sptr d_fm;
-
-protected:
- digital_cpmmod_bc(gr_cpm::cpm_type type, float h,
- unsigned samples_per_sym,
- unsigned L, double beta);
-
-public:
- //! Return the phase response FIR taps
- std::vector<float> get_taps() { return d_taps; };
-};
-
-#endif /* INCLUDED_DIGITAL_CPMMOD_BC_H */
-
diff --git a/gr-digital/include/digital_crc32_bb.h b/gr-digital/include/digital_crc32_bb.h
index 1f4771e861..efbf2d545a 100644
--- a/gr-digital/include/digital_crc32_bb.h
+++ b/gr-digital/include/digital_crc32_bb.h
@@ -23,7 +23,7 @@
#ifndef INCLUDED_DIGITAL_CRC32_BB_H
#define INCLUDED_DIGITAL_CRC32_BB_H
-#include <digital_api.h>
+#include <digital/api.h>
#include <gr_tagged_stream_block.h>
class digital_crc32_bb;
diff --git a/gr-digital/include/digital_descrambler_bb.h b/gr-digital/include/digital_descrambler_bb.h
deleted file mode 100644
index d503102a9e..0000000000
--- a/gr-digital/include/digital_descrambler_bb.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2008,2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-#ifndef INCLUDED_GR_DESCRAMBLER_BB_H
-#define INCLUDED_GR_DESCRAMBLER_BB_H
-
-#include <digital_api.h>
-#include <gr_sync_block.h>
-#include <analog/lfsr.h>
-
-class digital_descrambler_bb;
-typedef boost::shared_ptr<digital_descrambler_bb> digital_descrambler_bb_sptr;
-
-DIGITAL_API digital_descrambler_bb_sptr
-digital_make_descrambler_bb(int mask, int seed, int len);
-
-/*!
- * Descramble an input stream using an LFSR. This block works on the LSB only
- * of the input data stream, i.e., on an "unpacked binary" stream, and
- * produces the same format on its output.
- *
- * \param mask Polynomial mask for LFSR
- * \param seed Initial shift register contents
- * \param len Shift register length
- *
- * \ingroup coding_blk
- */
-
-class DIGITAL_API digital_descrambler_bb : public gr_sync_block
-{
- friend DIGITAL_API digital_descrambler_bb_sptr
- digital_make_descrambler_bb(int mask, int seed, int len);
-
- gr::analog::lfsr d_lfsr;
-
- digital_descrambler_bb(int mask, int seed, int len);
-
-public:
- int work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
-
-#endif /* INCLUDED_GR_DESCRAMBLER_BB_H */
diff --git a/gr-digital/include/digital_fll_band_edge_cc.h b/gr-digital/include/digital_fll_band_edge_cc.h
deleted file mode 100644
index 68083bbaeb..0000000000
--- a/gr-digital/include/digital_fll_band_edge_cc.h
+++ /dev/null
@@ -1,226 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2009,2011,2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-
-#ifndef INCLUDED_DIGITAL_FLL_BAND_EDGE_CC_H
-#define INCLUDED_DIGITAL_FLL_BAND_EDGE_CC_H
-
-#include <digital_api.h>
-#include <gr_sync_block.h>
-#include <gri_control_loop.h>
-#include <gr_fir_util.h>
-#include <gr_fir_ccc.h>
-
-typedef gr_fir_ccc* (*fir_maker_t)(const std::vector<gr_complex> &taps);
-typedef gr_fir_ccc filter_t;
-
-class digital_fll_band_edge_cc;
-typedef boost::shared_ptr<digital_fll_band_edge_cc> digital_fll_band_edge_cc_sptr;
-DIGITAL_API digital_fll_band_edge_cc_sptr
-digital_make_fll_band_edge_cc(float samps_per_sym,
- float rolloff,
- int filter_size,
- float bandwidth);
-
-/*!
- * \class digital_fll_band_edge_cc
- * \brief Frequency Lock Loop using band-edge filters
- *
- * \ingroup general
- * \ingroup digital
- *
- * The frequency lock loop derives a band-edge filter that covers the
- * upper and lower bandwidths of a digitally-modulated signal. The
- * bandwidth range is determined by the excess bandwidth (e.g.,
- * rolloff factor) of the modulated signal. The placement in frequency
- * of the band-edges is determined by the oversampling ratio (number
- * of samples per symbol) and the excess bandwidth. The size of the
- * filters should be fairly large so as to average over a number of
- * symbols.
- *
- * The FLL works by filtering the upper and lower band edges into
- * x_u(t) and x_l(t), respectively. These are combined to form cc(t)
- * = x_u(t) + x_l(t) and ss(t) = x_u(t) - x_l(t). Combining these to
- * form the signal e(t) = Re{cc(t) \\times ss(t)^*} (where ^* is the
- * complex conjugate) provides an error signal at the DC term that is
- * directly proportional to the carrier frequency. We then make a
- * second-order loop using the error signal that is the running
- * average of e(t).
- *
- * In practice, the above equation can be simplified by just comparing
- * the absolute value squared of the output of both filters:
- * abs(x_l(t))^2 - abs(x_u(t))^2 = norm(x_l(t)) - norm(x_u(t)).
- *
- * In theory, the band-edge filter is the derivative of the matched
- * filter in frequency, (H_be(f) = frac{H(f)}{df}). In practice,
- * this comes down to a quarter sine wave at the point of the matched
- * filter's rolloff (if it's a raised-cosine, the derivative of a
- * cosine is a sine). Extend this sine by another quarter wave to
- * make a half wave around the band-edges is equivalent in time to the
- * sum of two sinc functions. The baseband filter fot the band edges
- * is therefore derived from this sum of sincs. The band edge filters
- * are then just the baseband signal modulated to the correct place in
- * frequency. All of these calculations are done in the
- * 'design_filter' function.
- *
- * Note: We use FIR filters here because the filters have to have a
- * flat phase response over the entire frequency range to allow their
- * comparisons to be valid.
- *
- * It is very important that the band edge filters be the derivatives
- * of the pulse shaping filter, and that they be linear
- * phase. Otherwise, the variance of the error will be very large.
- *
- */
-
-class DIGITAL_API digital_fll_band_edge_cc :
- public gr_sync_block, public gri_control_loop
-{
- private:
- /*!
- * Build the FLL
- * \param samps_per_sym (float) Number of samples per symbol of signal
- * \param rolloff (float) Rolloff factor of signal
- * \param filter_size (int) Size (in taps) of the filter
- * \param bandwidth (float) Loop bandwidth
- */
- friend DIGITAL_API digital_fll_band_edge_cc_sptr
- digital_make_fll_band_edge_cc(float samps_per_sym,
- float rolloff,
- int filter_size,
- float bandwidth);
-
- float d_sps;
- float d_rolloff;
- int d_filter_size;
-
- std::vector<gr_complex> d_taps_lower;
- std::vector<gr_complex> d_taps_upper;
- bool d_updated;
- filter_t* d_filter_lower;
- filter_t* d_filter_upper;
- std::vector<gr_complex> d_output_hist;
- std::vector<gr_complex> d_fllbuffer;
-
- /*!
- * Build the FLL
- * \param samps_per_sym (float) number of samples per symbol
- * \param rolloff (float) Rolloff (excess bandwidth) of signal filter
- * \param filter_size (int) number of filter taps to generate
- * \param bandwidth (float) Loop bandwidth
- */
- digital_fll_band_edge_cc(float samps_per_sym, float rolloff,
- int filter_size, float bandwidth);
-
- /*!
- * Design the band-edge filter based on the number of samples per symbol,
- * filter rolloff factor, and the filter size
- *
- * \param samps_per_sym (float) Number of samples per symbol of signal
- * \param rolloff (float) Rolloff factor of signal
- * \param filter_size (int) Size (in taps) of the filter
- */
- void design_filter(float samps_per_sym, float rolloff, int filter_size);
-
-public:
- ~digital_fll_band_edge_cc();
-
- /*******************************************************************
- SET FUNCTIONS
- *******************************************************************/
-
- /*!
- * \brief Set the number of samples per symbol
- *
- * Set's the number of samples per symbol the system should
- * use. This value is uesd to calculate the filter taps and will
- * force a recalculation.
- *
- * \param sps (float) new samples per symbol
- *
- */
- void set_samples_per_symbol(float sps);
-
- /*!
- * \brief Set the rolloff factor of the shaping filter
- *
- * This sets the rolloff factor that is used in the pulse shaping
- * filter and is used to calculate the filter taps. Changing this
- * will force a recalculation of the filter taps.
- *
- * This should be the same value that is used in the transmitter's
- * pulse shaping filter. It must be between 0 and 1 and is usually
- * between 0.2 and 0.5 (where 0.22 and 0.35 are commonly used
- * values).
- *
- * \param rolloff (float) new shaping filter rolloff factor [0,1]
- *
- */
- void set_rolloff(float rolloff);
-
- /*!
- * \brief Set the number of taps in the filter
- *
- * This sets the number of taps in the band-edge filters. Setting
- * this will force a recalculation of the filter taps.
- *
- * This should be about the same number of taps used in the
- * transmitter's shaping filter and also not very large. A large
- * number of taps will result in a large delay between input and
- * frequency estimation, and so will not be as accurate. Between 30
- * and 70 taps is usual.
- *
- * \param filter_size (float) number of taps in the filters
- *
- */
- void set_filter_size(int filter_size);
-
- /*******************************************************************
- GET FUNCTIONS
- *******************************************************************/
-
- /*!
- * \brief Returns the number of sampler per symbol used for the filter
- */
- float get_samples_per_symbol() const;
-
- /*!
- * \brief Returns the rolloff factor used for the filter
- */
- float get_rolloff() const;
-
- /*!
- * \brief Returns the number of taps of the filter
- */
- int get_filter_size() const;
-
- /*!
- * Print the taps to screen.
- */
- void print_taps();
-
- int work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
-
-#endif
diff --git a/gr-digital/include/digital_framer_sink_1.h b/gr-digital/include/digital_framer_sink_1.h
deleted file mode 100644
index bb82bf5a73..0000000000
--- a/gr-digital/include/digital_framer_sink_1.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2005,2006,2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_GR_FRAMER_SINK_1_H
-#define INCLUDED_GR_FRAMER_SINK_1_H
-
-#include <digital_api.h>
-#include <gr_sync_block.h>
-#include <gr_msg_queue.h>
-
-class digital_framer_sink_1;
-typedef boost::shared_ptr<digital_framer_sink_1> digital_framer_sink_1_sptr;
-
-DIGITAL_API digital_framer_sink_1_sptr
-digital_make_framer_sink_1(gr_msg_queue_sptr target_queue);
-
-/*!
- * \brief Given a stream of bits and access_code flags, assemble packets.
- * \ingroup sink_blk
- *
- * input: stream of bytes from gr_correlate_access_code_bb
- * output: none. Pushes assembled packet into target queue
- *
- * The framer expects a fixed length header of 2 16-bit shorts
- * containing the payload length, followed by the payload. If the
- * 2 16-bit shorts are not identical, this packet is ignored. Better
- * algs are welcome.
- *
- * The input data consists of bytes that have two bits used.
- * Bit 0, the LSB, contains the data bit.
- * Bit 1 if set, indicates that the corresponding bit is the
- * the first bit of the packet. That is, this bit is the first
- * one after the access code.
- */
-class DIGITAL_API digital_framer_sink_1 : public gr_sync_block
-{
- friend DIGITAL_API digital_framer_sink_1_sptr
- digital_make_framer_sink_1(gr_msg_queue_sptr target_queue);
-
- private:
- enum state_t {STATE_SYNC_SEARCH, STATE_HAVE_SYNC, STATE_HAVE_HEADER};
-
- static const int MAX_PKT_LEN = 4096;
- static const int HEADERBITLEN = 32;
-
- gr_msg_queue_sptr d_target_queue; // where to send the packet when received
- state_t d_state;
- unsigned int d_header; // header bits
- int d_headerbitlen_cnt; // how many so far
-
- unsigned char d_packet[MAX_PKT_LEN]; // assembled payload
- unsigned char d_packet_byte; // byte being assembled
- int d_packet_byte_index; // which bit of d_packet_byte we're working on
- int d_packetlen; // length of packet
- int d_packet_whitener_offset; // offset into whitener string to use
- int d_packetlen_cnt; // how many so far
-
- protected:
- digital_framer_sink_1(gr_msg_queue_sptr target_queue);
-
- void enter_search();
- void enter_have_sync();
- void enter_have_header(int payload_len, int whitener_offset);
-
- bool header_ok()
- {
- // confirm that two copies of header info are identical
- return ((d_header >> 16) ^ (d_header & 0xffff)) == 0;
- }
-
- void header_payload(int *len, int *offset)
- {
- // header consists of two 16-bit shorts in network byte order
- // payload length is lower 12 bits
- // whitener offset is upper 4 bits
- *len = (d_header >> 16) & 0x0fff;
- *offset = (d_header >> 28) & 0x000f;
- }
-
- public:
- ~digital_framer_sink_1();
-
- int work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
-
-#endif /* INCLUDED_GR_FRAMER_SINK_1_H */
diff --git a/gr-digital/include/digital_glfsr_source_b.h b/gr-digital/include/digital_glfsr_source_b.h
deleted file mode 100644
index 92e5e81f5c..0000000000
--- a/gr-digital/include/digital_glfsr_source_b.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2007,2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_GR_GLFSR_SOURCE_B_H
-#define INCLUDED_GR_GLFSR_SOURCE_B_H
-
-#include <digital_api.h>
-#include <gr_sync_block.h>
-
-class gri_glfsr;
-
-class digital_glfsr_source_b;
-typedef boost::shared_ptr<digital_glfsr_source_b> digital_glfsr_source_b_sptr;
-
-DIGITAL_API digital_glfsr_source_b_sptr
-digital_make_glfsr_source_b(int degree, bool repeat=true,
- int mask=0, int seed=1);
-
-/*!
- * \brief Galois LFSR pseudo-random source
- * \ingroup source_blk
- *
- * \param degree Degree of shift register must be in [1, 32]. If mask
- * is 0, the degree determines a default mask (see
- * digital_impl_glfsr.cc for the mapping).
- * \param repeat Set to repeat sequence.
- * \param mask Allows a user-defined bit mask for indexes of the shift
- * register to feed back.
- * \param seed Initial setting for values in shift register.
- */
-class DIGITAL_API digital_glfsr_source_b : public gr_sync_block
-{
- private:
- friend DIGITAL_API digital_glfsr_source_b_sptr
- digital_make_glfsr_source_b(int degree, bool repeat,
- int mask, int seed);
-
- gri_glfsr *d_glfsr;
-
- bool d_repeat;
- unsigned int d_index;
- unsigned int d_length;
-
- digital_glfsr_source_b(int degree, bool repeat,
- int mask, int seed);
-
- public:
-
- ~digital_glfsr_source_b();
-
- int work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-
- unsigned int period() const { return d_length; }
- int mask() const;
-};
-
-#endif /* INCLUDED_GR_GLFSR_SOURCE_B_H */
diff --git a/gr-digital/include/digital_glfsr_source_f.h b/gr-digital/include/digital_glfsr_source_f.h
deleted file mode 100644
index 77d7b0f741..0000000000
--- a/gr-digital/include/digital_glfsr_source_f.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2007,2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_GR_GLFSR_SOURCE_F_H
-#define INCLUDED_GR_GLFSR_SOURCE_F_H
-
-#include <digital_api.h>
-#include <gr_sync_block.h>
-
-class gri_glfsr;
-
-class digital_glfsr_source_f;
-typedef boost::shared_ptr<digital_glfsr_source_f> digital_glfsr_source_f_sptr;
-
-DIGITAL_API digital_glfsr_source_f_sptr
-digital_make_glfsr_source_f(int degree, bool repeat=true,
- int mask=0, int seed=1);
-
-/*!
- * \brief Galois LFSR pseudo-random source generating float outputs -1.0 - 1.0.
- * \ingroup source_blk
- *
- * \param degree Degree of shift register must be in [1, 32]. If mask
- * is 0, the degree determines a default mask (see
- * digital_impl_glfsr.cc for the mapping).
- * \param repeat Set to repeat sequence.
- * \param mask Allows a user-defined bit mask for indexes of the shift
- * register to feed back.
- * \param seed Initial setting for values in shift register.
- */
-class DIGITAL_API digital_glfsr_source_f : public gr_sync_block
-{
- private:
- friend DIGITAL_API digital_glfsr_source_f_sptr
- digital_make_glfsr_source_f(int degree, bool repeat,
- int mask, int seed);
-
- gri_glfsr *d_glfsr;
-
- bool d_repeat;
- unsigned int d_index;
- unsigned int d_length;
-
- digital_glfsr_source_f(int degree, bool repeat,
- int mask, int seed);
-
- public:
-
- ~digital_glfsr_source_f();
-
- int work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-
- unsigned int period() const { return d_length; }
- int mask() const;
-};
-
-#endif /* INCLUDED_GR_GLFSR_SOURCE_F_H */
diff --git a/gr-digital/include/digital_gmskmod_bc.h b/gr-digital/include/digital_gmskmod_bc.h
deleted file mode 100644
index 9f378c8a70..0000000000
--- a/gr-digital/include/digital_gmskmod_bc.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2010 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_DIGITAL_GMSKMOD_BC_H
-#define INCLUDED_DIGITAL_GMSKMOD_BC_H
-
-#include <digital_api.h>
-#include <digital_cpmmod_bc.h>
-
-class digital_gmskmod_bc;
-typedef boost::shared_ptr<digital_gmskmod_bc> digital_gmskmod_bc_sptr;
-
-
-DIGITAL_API digital_gmskmod_bc_sptr
-digital_make_gmskmod_bc(unsigned samples_per_sym=2,
- double bt=0.3, unsigned L=4);
-
-/*!
- * \brief GMSK modulator
- *
- * \ingroup modulation_blk
- * \ingroup digital
- *
- * \param samples_per_sym Samples per symbol.
- * \param bt The 3 dB time-bandwidth product.
- * \param L The length of the phase duration in symbols. The Gaussian
- * pulse is truncated after L symbols.
- *
- * The input of this block are symbols from an M-ary alphabet
- * +/-1, +/-3, ..., +/-(M-1). Usually, M = 2 and therefore, the
- * valid inputs are +/-1.
- * The modulator will silently accept any other inputs, though.
- * The output is the phase-modulated signal.
- */
-class DIGITAL_API digital_gmskmod_bc : public digital_cpmmod_bc
-{
- friend DIGITAL_API digital_gmskmod_bc_sptr digital_make_gmskmod_bc(unsigned samples_per_sym,
- double bt, unsigned L);
- digital_gmskmod_bc(unsigned samples_per_sym,
- double bt, unsigned L);
-};
-
-#endif /* INCLUDED_DIGITAL_GMSKMOD_BC_H */
-
diff --git a/gr-digital/include/digital_impl_mpsk_snr_est.h b/gr-digital/include/digital_impl_mpsk_snr_est.h
deleted file mode 100644
index df7dbadec1..0000000000
--- a/gr-digital/include/digital_impl_mpsk_snr_est.h
+++ /dev/null
@@ -1,279 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-#ifndef INCLUDED_DIGITAL_IMPL_MPSK_SNR_EST_H
-#define INCLUDED_DIGITAL_IMPL_MPSK_SNR_EST_H
-
-#include <digital_api.h>
-#include <gr_sync_block.h>
-
-//! Enum for the type of SNR estimator to select
-/*! \ingroup snr_blk
- * \anchor ref_snr_est_types
- *
- * Below are some ROUGH estimates of what values of SNR each of these
- * types of estimators is good for. In general, these offer a
- * trade-off between accuracy and performance.
- *
- * \li SNR_EST_SIMPLE: Simple estimator (>= 7 dB)
- * \li SNR_EST_SKEW: Skewness-base est (>= 5 dB)
- * \li SNR_EST_M2M4: 2nd & 4th moment est (>= 1 dB)
- * \li SNR_EST_SVR: SVR-based est (>= 0dB)
-*/
-enum snr_est_type_t {
- SNR_EST_SIMPLE = 0, // Simple estimator (>= 7 dB)
- SNR_EST_SKEW, // Skewness-base est (>= 5 dB)
- SNR_EST_M2M4, // 2nd & 4th moment est (>= 1 dB)
- SNR_EST_SVR // SVR-based est (>= 0dB)
-};
-
-/*! \brief A parent class for SNR estimators, specifically for M-PSK
- * signals in AWGN channels.
- * \ingroup snr_blk
- */
-class DIGITAL_API digital_impl_mpsk_snr_est
-{
- protected:
- double d_alpha, d_beta;
-
- public:
- /*! Constructor
- *
- * Parameters:
- * \param alpha: the update rate of internal running average
- * calculations.
- */
- digital_impl_mpsk_snr_est(double alpha);
- virtual ~digital_impl_mpsk_snr_est();
-
- //! Get the running-average coefficient
- double alpha() const;
-
- //! Set the running-average coefficient
- void set_alpha(double alpha);
-
- //! Update the current registers
- virtual int update(int noutput_items,
- const gr_complex *in);
-
- //! Use the register values to compute a new estimate
- virtual double snr();
-};
-
-
-//! \brief SNR Estimator using simple mean/variance estimates.
-/*! \ingroup snr_blk
- *
- * A very simple SNR estimator that just uses mean and variance
- * estimates of an M-PSK constellation. This esimator is quick and
- * cheap and accurate for high SNR (above 7 dB or so) but quickly
- * starts to overestimate the SNR at low SNR.
- */
-class DIGITAL_API digital_impl_mpsk_snr_est_simple :
- public digital_impl_mpsk_snr_est
-{
- private:
- double d_y1, d_y2;
-
- public:
- /*! Constructor
- *
- * Parameters:
- * \param alpha: the update rate of internal running average
- * calculations.
- */
- digital_impl_mpsk_snr_est_simple(double alpha);
- ~digital_impl_mpsk_snr_est_simple() {}
-
- int update(int noutput_items,
- const gr_complex *in);
- double snr();
-};
-
-
-//! \brief SNR Estimator using skewness correction.
-/*! \ingroup snr_blk
- *
- * This is an estimator that came from a discussion between Tom
- * Rondeau and fred harris with no known paper reference. The idea is
- * that at low SNR, the variance estimations will be affected because
- * of fold-over around the decision boundaries, which results in a
- * skewness to the samples. We estimate the skewness and use this as
- * a correcting term.
- */
-class DIGITAL_API digital_impl_mpsk_snr_est_skew :
- public digital_impl_mpsk_snr_est
-{
- private:
- double d_y1, d_y2, d_y3;
-
- public:
- /*! Constructor
- *
- * Parameters:
- * \param alpha: the update rate of internal running average
- * calculations.
- */
- digital_impl_mpsk_snr_est_skew(double alpha);
- ~digital_impl_mpsk_snr_est_skew() {}
-
- int update(int noutput_items,
- const gr_complex *in);
- double snr();
-};
-
-
-//! \brief SNR Estimator using 2nd and 4th-order moments.
-/*! \ingroup snr_blk
- *
- * An SNR estimator for M-PSK signals that uses 2nd (M2) and 4th (M4)
- * order moments. This estimator uses knowledge of the kurtosis of
- * the signal (k_a) and noise (k_w) to make its estimation. We use
- * Beaulieu's approximations here to M-PSK signals and AWGN channels
- * such that k_a=1 and k_w=2. These approximations significantly
- * reduce the complexity of the calculations (and computations)
- * required.
- *
- * Reference:
- * D. R. Pauluzzi and N. C. Beaulieu, "A comparison of SNR
- * estimation techniques for the AWGN channel," IEEE
- * Trans. Communications, Vol. 48, No. 10, pp. 1681-1691, 2000.
- */
-class DIGITAL_API digital_impl_mpsk_snr_est_m2m4 :
- public digital_impl_mpsk_snr_est
-{
- private:
- double d_y1, d_y2;
-
- public:
- /*! Constructor
- *
- * Parameters:
- * \param alpha: the update rate of internal running average
- * calculations.
- */
- digital_impl_mpsk_snr_est_m2m4(double alpha);
- ~digital_impl_mpsk_snr_est_m2m4() {}
-
- int update(int noutput_items,
- const gr_complex *in);
- double snr();
-};
-
-
-//! \brief SNR Estimator using 2nd and 4th-order moments.
-/*! \ingroup snr_blk
- *
- * An SNR estimator for M-PSK signals that uses 2nd (M2) and 4th (M4)
- * order moments. This estimator uses knowledge of the kurtosis of
- * the signal (k_a) and noise (k_w) to make its estimation. In this
- * case, you can set your own estimations for k_a and k_w, the
- * kurtosis of the signal and noise, to fit this estimation better to
- * your signal and channel conditions.
- *
- * A word of warning: this estimator has not been fully tested or
- * proved with any amount of rigor. The estimation for M4 in
- * particular might be ignoring effectf of when k_a and k_w are
- * different. Use this estimator with caution and a copy of the
- * reference on hand.
- *
- * The digital_mpsk_snr_est_m2m4 assumes k_a and k_w to simplify the
- * computations for M-PSK and AWGN channels. Use that estimator
- * unless you have a way to guess or estimate these values here.
- *
- * Original paper:
- * R. Matzner, "An SNR estimation algorithm for complex baseband
- * signal using higher order statistics," Facta Universitatis
- * (Nis), no. 6, pp. 41-52, 1993.
- *
- * Reference used in derivation:
- * D. R. Pauluzzi and N. C. Beaulieu, "A comparison of SNR
- * estimation techniques for the AWGN channel," IEEE
- * Trans. Communications, Vol. 48, No. 10, pp. 1681-1691, 2000.
- */
-class DIGITAL_API digital_impl_snr_est_m2m4 :
- public digital_impl_mpsk_snr_est
-{
- private:
- double d_y1, d_y2;
- double d_ka, d_kw;
-
- public:
- /*! Constructor
- *
- * Parameters:
- * \param alpha: the update rate of internal running average
- * calculations.
- * \param ka: estimate of the signal kurtosis (1 for PSK)
- * \param kw: estimate of the channel noise kurtosis (2 for AWGN)
- */
- digital_impl_snr_est_m2m4(double alpha, double ka, double kw);
- ~digital_impl_snr_est_m2m4() {}
-
- int update(int noutput_items,
- const gr_complex *in);
- double snr();
-};
-
-
-//! \brief Signal-to-Variation Ratio SNR Estimator.
-/*! \ingroup snr_blk
- *
- * This estimator actually comes from an SNR estimator for M-PSK
- * signals in fading channels, but this implementation is
- * specifically for AWGN channels. The math was simplified to assume
- * a signal and noise kurtosis (k_a and k_w) for M-PSK signals in
- * AWGN. These approximations significantly reduce the complexity of
- * the calculations (and computations) required.
- *
- * Original paper:
- * A. L. Brandao, L. B. Lopes, and D. C. McLernon, "In-service
- * monitoring of multipath delay and cochannel interference for
- * indoor mobile communication systems," Proc. IEEE
- * Int. Conf. Communications, vol. 3, pp. 1458-1462, May 1994.
- *
- * Reference:
- * D. R. Pauluzzi and N. C. Beaulieu, "A comparison of SNR
- * estimation techniques for the AWGN channel," IEEE
- * Trans. Communications, Vol. 48, No. 10, pp. 1681-1691, 2000.
- */
-class DIGITAL_API digital_impl_mpsk_snr_est_svr :
- public digital_impl_mpsk_snr_est
-{
- private:
- double d_y1, d_y2;
-
- public:
- /*! Constructor
- *
- * Parameters:
- * \param alpha: the update rate of internal running average
- * calculations.
- */
- digital_impl_mpsk_snr_est_svr(double alpha);
- ~digital_impl_mpsk_snr_est_svr() {}
-
- int update(int noutput_items,
- const gr_complex *in);
- double snr();
-};
-
-#endif /* INCLUDED_DIGITAL_IMPL_MPSK_SNR_EST_H */
diff --git a/gr-digital/include/digital_kurtotic_equalizer_cc.h b/gr-digital/include/digital_kurtotic_equalizer_cc.h
deleted file mode 100644
index fed88c3741..0000000000
--- a/gr-digital/include/digital_kurtotic_equalizer_cc.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_DIGITAL_KURTOTIC_EQUALIZER_CC_H
-#define INCLUDED_DIGITAL_KURTOTIC_EQUALIZER_CC_H
-
-#include <digital_api.h>
-#include <gr_adaptive_fir_ccc.h>
-#include <gr_math.h>
-#include <iostream>
-
-class digital_kurtotic_equalizer_cc;
-typedef boost::shared_ptr<digital_kurtotic_equalizer_cc> digital_kurtotic_equalizer_cc_sptr;
-
-DIGITAL_API digital_kurtotic_equalizer_cc_sptr
-digital_make_kurtotic_equalizer_cc(int num_taps, float mu);
-
-/*!
- * \brief Implements a kurtosis-based adaptive equalizer on complex stream
- * \ingroup eq_blk
- * \ingroup digital
- *
- * "Y. Guo, J. Zhao, Y. Sun, "Sign kurtosis maximization based blind
- * equalization algorithm," IEEE Conf. on Control, Automation,
- * Robotics and Vision, Vol. 3, Dec. 2004, pp. 2052 - 2057."
- */
-class DIGITAL_API digital_kurtotic_equalizer_cc : public gr_adaptive_fir_ccc
-{
-private:
- float d_mu;
- float d_p, d_m;
- gr_complex d_q, d_u;
- float d_alpha_p, d_alpha_q, d_alpha_m;
-
- friend DIGITAL_API digital_kurtotic_equalizer_cc_sptr digital_make_kurtotic_equalizer_cc(int num_taps,
- float mu);
- digital_kurtotic_equalizer_cc(int num_taps, float mu);
-
- gr_complex sign(gr_complex x)
- {
- float re = (float)(x.real() >= 0.0f);
- float im = (float)(x.imag() >= 0.0f);
- return gr_complex(re, im);
- }
-
-protected:
-
- virtual gr_complex error(const gr_complex &out)
- {
-
- // p = E[|z|^2]
- // q = E[z^2]
- // m = E[|z|^4]
- // u = E[kurtosis(z)]
-
- float nrm = norm(out);
- gr_complex cnj = conj(out);
- float epsilon_f = 1e-12;
- gr_complex epsilon_c = gr_complex(1e-12, 1e-12);
-
-
- d_p = (1-d_alpha_p)*d_p + (d_alpha_p)*nrm + epsilon_f;
- d_q = (1-d_alpha_q)*d_q + (d_alpha_q)*out*out + epsilon_c;
- d_m = (1-d_alpha_m)*d_m + (d_alpha_m)*nrm*nrm + epsilon_f;
- d_u = d_m - 2.0f*(d_p*d_p) - d_q*d_q;
-
- gr_complex F = (1.0f / (d_p*d_p*d_p)) *
- (sign(d_u) * (nrm*cnj - 2.0f*d_p*cnj - conj(d_q)*out) -
- abs(d_u)*cnj);
-
- //std::cout << "out: " << out << " p: " << d_p << " q: " << d_q;
- //std::cout << " m: " << d_m << " u: " << d_u << std::endl;
- //std::cout << "error: " << F << std::endl;
-
- float re = gr_clip(F.real(), 1.0);
- float im = gr_clip(F.imag(), 1.0);
- return gr_complex(re, im);
- }
-
- virtual void update_tap(gr_complex &tap, const gr_complex &in)
- {
- tap += d_mu*in*d_error;
- }
-
-public:
- void set_gain(float mu)
- {
- if(mu < 0)
- throw std::out_of_range("digital_kurtotic_equalizer::set_gain: Gain value must be >= 0");
- d_mu = mu;
- }
-};
-
-#endif
diff --git a/gr-digital/include/digital_lms_dd_equalizer_cc.h b/gr-digital/include/digital_lms_dd_equalizer_cc.h
deleted file mode 100644
index 56871fa678..0000000000
--- a/gr-digital/include/digital_lms_dd_equalizer_cc.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_DIGITAL_LMS_DD_EQUALIZER_CC_H
-#define INCLUDED_DIGITAL_LMS_DD_EQUALIZER_CC_H
-
-#include <digital_api.h>
-#include <gr_adaptive_fir_ccc.h>
-#include <digital_constellation.h>
-
-class digital_lms_dd_equalizer_cc;
-typedef boost::shared_ptr<digital_lms_dd_equalizer_cc> digital_lms_dd_equalizer_cc_sptr;
-
-DIGITAL_API digital_lms_dd_equalizer_cc_sptr digital_make_lms_dd_equalizer_cc (int num_taps,
- float mu, int sps,
- digital_constellation_sptr cnst);
-
-/*!
- * \brief Least-Mean-Square Decision Directed Equalizer (complex in/out)
- * \ingroup eq_blk
- * \ingroup digital
- *
- * This block implements an LMS-based decision-directed equalizer.
- * It uses a set of weights, w, to correlate against the inputs, u,
- * and a decisions is then made from this output. The error
- * in the decision is used to update teh weight vector.
- *
- * y[n] = conj(w[n]) u[n]
- * d[n] = decision(y[n])
- * e[n] = d[n] - y[n]
- * w[n+1] = w[n] + mu u[n] conj(e[n])
- *
- * Where mu is a gain value (between 0 and 1 and usualy small,
- * around 0.001 - 0.01.
- *
- * This block uses the digital_constellation object for making
- * the decision from y[n]. Create the constellation object for
- * whatever constellation is to be used and pass in the object.
- * In Python, you can use something like:
- * self.constellation = digital.constellation_qpsk()
- * To create a QPSK constellation (see the digital_constellation
- * block for more details as to what constellations are available
- * or how to create your own). You then pass the object to this
- * block as an sptr, or using "self.constellation.base()".
- *
- * The theory for this algorithm can be found in Chapter 9 of:
- * S. Haykin, Adaptive Filter Theory, Upper Saddle River, NJ:
- * Prentice Hall, 1996.
- *
- */
-class DIGITAL_API digital_lms_dd_equalizer_cc : public gr_adaptive_fir_ccc
-{
-private:
- friend DIGITAL_API digital_lms_dd_equalizer_cc_sptr digital_make_lms_dd_equalizer_cc (int num_taps,
- float mu, int sps,
- digital_constellation_sptr cnst);
-
- float d_mu;
- std::vector<gr_complex> d_taps;
- digital_constellation_sptr d_cnst;
-
- digital_lms_dd_equalizer_cc (int num_taps,
- float mu, int sps,
- digital_constellation_sptr cnst);
-
-protected:
-
- virtual gr_complex error(const gr_complex &out)
- {
- gr_complex decision, error;
- d_cnst->map_to_points(d_cnst->decision_maker(&out), &decision);
- error = decision - out;
- return error;
- }
-
- virtual void update_tap(gr_complex &tap, const gr_complex &in)
- {
- tap += d_mu*conj(in)*d_error;
- }
-
-public:
- float get_gain()
- {
- return d_mu;
- }
-
- void set_gain(float mu)
- {
- if(mu < 0.0f || mu > 1.0f) {
- throw std::out_of_range("digital_lms_dd_equalizer::set_mu: Gain value must in [0, 1]");
- }
- else {
- d_mu = mu;
- }
- }
-
-};
-
-#endif
diff --git a/gr-digital/include/digital_mpsk_receiver_cc.h b/gr-digital/include/digital_mpsk_receiver_cc.h
deleted file mode 100644
index 1f11a26b64..0000000000
--- a/gr-digital/include/digital_mpsk_receiver_cc.h
+++ /dev/null
@@ -1,320 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2007,2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_DIGITAL_MPSK_RECEIVER_CC_H
-#define INCLUDED_DIGITAL_MPSK_RECEIVER_CC_H
-
-#include <digital_api.h>
-#include <gruel/attributes.h>
-#include <gri_control_loop.h>
-#include <gr_block.h>
-#include <gr_complex.h>
-#include <fstream>
-
-class gri_mmse_fir_interpolator_cc;
-
-class digital_mpsk_receiver_cc;
-typedef boost::shared_ptr<digital_mpsk_receiver_cc> digital_mpsk_receiver_cc_sptr;
-
-// public constructor
-DIGITAL_API digital_mpsk_receiver_cc_sptr
-digital_make_mpsk_receiver_cc (unsigned int M, float theta,
- float loop_bw,
- float fmin, float fmax,
- float mu, float gain_mu,
- float omega, float gain_omega, float omega_rel);
-
-/*!
- * \brief This block takes care of receiving M-PSK modulated signals
- * through phase, frequency, and symbol synchronization.
- * \ingroup sync_blk
- * \ingroup demod_blk
- * \ingroup digital
- *
- * This block takes care of receiving M-PSK modulated signals through
- * phase, frequency, and symbol synchronization. It performs carrier
- * frequency and phase locking as well as symbol timing recovery. It
- * works with (D)BPSK, (D)QPSK, and (D)8PSK as tested currently. It
- * should also work for OQPSK and PI/4 DQPSK.
- *
- * The phase and frequency synchronization are based on a Costas loop
- * that finds the error of the incoming signal point compared to its
- * nearest constellation point. The frequency and phase of the NCO are
- * updated according to this error. There are optimized phase error
- * detectors for BPSK and QPSK, but 8PSK is done using a brute-force
- * computation of the constellation points to find the minimum.
- *
- * The symbol synchronization is done using a modified Mueller and
- * Muller circuit from the paper:
- *
- * "G. R. Danesfahani, T. G. Jeans, "Optimisation of modified Mueller
- * and Muller algorithm," Electronics Letters, Vol. 31, no. 13, 22
- * June 1995, pp. 1032 - 1033."
- *
- * This circuit interpolates the downconverted sample (using the NCO
- * developed by the Costas loop) every mu samples, then it finds the
- * sampling error based on this and the past symbols and the decision
- * made on the samples. Like the phase error detector, there are
- * optimized decision algorithms for BPSK and QPKS, but 8PSK uses
- * another brute force computation against all possible symbols. The
- * modifications to the M&M used here reduce self-noise.
- *
- */
-
-class DIGITAL_API digital_mpsk_receiver_cc : public gr_block, public gri_control_loop
-{
- public:
- ~digital_mpsk_receiver_cc ();
- void forecast(int noutput_items, gr_vector_int &ninput_items_required);
- int general_work (int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-
-
- //! Returns the modulation order (M) currently set
- float modulation_order() const { return d_M; }
-
- //! Returns current value of theta
- float theta() const { return d_theta; }
-
- //! Returns current value of mu
- float mu() const { return d_mu; }
-
- //! Returns current value of omega
- float omega() const { return d_omega; }
-
- //! Returns mu gain factor
- float gain_mu() const { return d_gain_mu; }
-
- //! Returns omega gain factor
- float gain_omega() const { return d_gain_omega; }
-
- //! Returns the relative omega limit
- float gain_omega_rel() const {return d_omega_rel; }
-
- //! Sets the modulation order (M) currently
- void set_modulation_order(unsigned int M);
-
- //! Sets value of theta
- void set_theta(float theta) { d_theta = theta; }
-
- //! Sets value of mu
- void set_mu (float mu) { d_mu = mu; }
-
- //! Sets value of omega and its min and max values
- void set_omega (float omega) {
- d_omega = omega;
- d_min_omega = omega*(1.0 - d_omega_rel);
- d_max_omega = omega*(1.0 + d_omega_rel);
- d_omega_mid = 0.5*(d_min_omega+d_max_omega);
- }
-
- //! Sets value for mu gain factor
- void set_gain_mu (float gain_mu) { d_gain_mu = gain_mu; }
-
- //! Sets value for omega gain factor
- void set_gain_omega (float gain_omega) { d_gain_omega = gain_omega; }
-
- //! Sets the relative omega limit and resets omega min/max values
- void set_gain_omega_rel(float omega_rel);
-
-protected:
-
- /*!
- * \brief Constructor to synchronize incoming M-PSK symbols
- *
- * \param M modulation order of the M-PSK modulation
- * \param theta any constant phase rotation from the real axis of the constellation
- * \param loop_bw Loop bandwidth to set gains of phase/freq tracking loop
- * \param fmin minimum normalized frequency value the loop can achieve
- * \param fmax maximum normalized frequency value the loop can achieve
- * \param mu initial parameter for the interpolator [0,1]
- * \param gain_mu gain parameter of the M&M error signal to adjust mu (~0.05)
- * \param omega initial value for the number of symbols between samples (~number of samples/symbol)
- * \param gain_omega gain parameter to adjust omega based on the error (~omega^2/4)
- * \param omega_rel sets the maximum (omega*(1+omega_rel)) and minimum (omega*(1+omega_rel)) omega (~0.005)
- *
- * The constructor also chooses which phase detector and decision maker to use in the work loop based on the
- * value of M.
- */
- digital_mpsk_receiver_cc (unsigned int M, float theta,
- float loop_bw,
- float fmin, float fmax,
- float mu, float gain_mu,
- float omega, float gain_omega, float omega_rel);
-
- void make_constellation();
- void mm_sampler(const gr_complex symbol);
- void mm_error_tracking(gr_complex sample);
- void phase_error_tracking(gr_complex sample);
-
-
- /*!
- * \brief Phase error detector for MPSK modulations.
- *
- * \param sample the I&Q sample from which to determine the phase error
- *
- * This function determines the phase error for any MPSK signal by
- * creating a set of PSK constellation points and doing a
- * brute-force search to see which point minimizes the Euclidean
- * distance. This point is then used to derotate the sample to the
- * real-axis and a atan (using the fast approximation function) to
- * determine the phase difference between the incoming sample and
- * the real constellation point
- *
- * This should be cleaned up and made more efficient.
- *
- * \returns the approximated phase error.
- */
- float phase_error_detector_generic(gr_complex sample) const; // generic for M but more costly
-
- /*!
- * \brief Phase error detector for BPSK modulation.
- *
- * \param sample the I&Q sample from which to determine the phase error
- *
- * This function determines the phase error using a simple BPSK
- * phase error detector by multiplying the real and imaginary (the
- * error signal) components together. As the imaginary part goes to
- * 0, so does this error.
- *
- * \returns the approximated phase error.
- */
- float phase_error_detector_bpsk(gr_complex sample) const; // optimized for BPSK
-
- /*!
- * \brief Phase error detector for QPSK modulation.
- *
- * \param sample the I&Q sample from which to determine the phase error
- *
- * This function determines the phase error using the limiter
- * approach in a standard 4th order Costas loop
- *
- * \returns the approximated phase error.
- */
- float phase_error_detector_qpsk(gr_complex sample) const;
-
-
-
- /*!
- * \brief Decision maker for a generic MPSK constellation.
- *
- * \param sample the baseband I&Q sample from which to make the decision
- *
- * This decision maker is a generic implementation that does a
- * brute-force search for the constellation point that minimizes the
- * error between it and the incoming signal.
- *
- * \returns the index to d_constellation that minimizes the error/
- */
- unsigned int decision_generic(gr_complex sample) const;
-
-
- /*!
- * \brief Decision maker for BPSK constellation.
- *
- * \param sample the baseband I&Q sample from which to make the decision
- *
- * This decision maker is a simple slicer function that makes a
- * decision on the symbol based on its placement on the real axis of
- * greater than 0 or less than 0; the quadrature component is always
- * 0.
- *
- * \returns the index to d_constellation that minimizes the error/
- */
- unsigned int decision_bpsk(gr_complex sample) const;
-
-
- /*!
- * \brief Decision maker for QPSK constellation.
- *
- * \param sample the baseband I&Q sample from which to make the decision
- *
- * This decision maker is a simple slicer function that makes a
- * decision on the symbol based on its placement versus both axes
- * and returns which quadrant the symbol is in.
- *
- * \returns the index to d_constellation that minimizes the error/
- */
- unsigned int decision_qpsk(gr_complex sample) const;
-
-private:
- unsigned int d_M;
- float d_theta;
-
- /*!
- * \brief Decision maker function pointer
- *
- * \param sample the baseband I&Q sample from which to make the decision
- *
- * This is a function pointer that is set in the constructor to
- * point to the proper decision function for the specified
- * constellation order.
- *
- * \return index into d_constellation point that is the closest to the recieved sample
- */
- unsigned int (digital_mpsk_receiver_cc::*d_decision)(gr_complex sample) const; // pointer to decision function
-
-
- std::vector<gr_complex> d_constellation;
- unsigned int d_current_const_point;
-
- // Members related to symbol timing
- float d_mu, d_gain_mu;
- float d_omega, d_gain_omega, d_omega_rel, d_max_omega, d_min_omega, d_omega_mid;
- gr_complex d_p_2T, d_p_1T, d_p_0T;
- gr_complex d_c_2T, d_c_1T, d_c_0T;
-
- /*!
- * \brief Phase error detector function pointer
- *
- * \param sample the I&Q sample from which to determine the phase error
- *
- * This is a function pointer that is set in the constructor to
- * point to the proper phase error detector function for the
- * specified constellation order.
- */
- float (digital_mpsk_receiver_cc::*d_phase_error_detector)(gr_complex sample) const;
-
-
- //! get interpolated value
- gri_mmse_fir_interpolator_cc *d_interp;
-
- //! delay line length.
- static const unsigned int DLLEN = 8;
-
- //! delay line plus some length for overflow protection
- __GR_ATTR_ALIGNED(8) gr_complex d_dl[2*DLLEN];
-
- //! index to delay line
- unsigned int d_dl_idx;
-
- friend DIGITAL_API digital_mpsk_receiver_cc_sptr
- digital_make_mpsk_receiver_cc (unsigned int M, float theta,
- float loop_bw,
- float fmin, float fmax,
- float mu, float gain_mu,
- float omega, float gain_omega, float omega_rel);
-};
-
-#endif
diff --git a/gr-digital/include/digital_mpsk_snr_est_cc.h b/gr-digital/include/digital_mpsk_snr_est_cc.h
deleted file mode 100644
index 2cbd98bab8..0000000000
--- a/gr-digital/include/digital_mpsk_snr_est_cc.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-#ifndef INCLUDED_DIGITAL_MPSK_SNR_EST_CC_H
-#define INCLUDED_DIGITAL_MPSK_SNR_EST_CC_H
-
-#include <digital_api.h>
-#include <gr_sync_block.h>
-#include <digital_impl_mpsk_snr_est.h>
-
-class digital_mpsk_snr_est_cc;
-typedef boost::shared_ptr<digital_mpsk_snr_est_cc> digital_mpsk_snr_est_cc_sptr;
-
-DIGITAL_API digital_mpsk_snr_est_cc_sptr
-digital_make_mpsk_snr_est_cc(snr_est_type_t type,
- int tag_nsamples=10000,
- double alpha=0.001);
-
-//! \brief A block for computing SNR of a signal.
-/*! \ingroup snr_blk
- *
- * This block can be used to monitor and retrieve estimations of the
- * signal SNR. It is designed to work in a flowgraph and passes all
- * incoming data along to its output.
- *
- * The block is designed for use with M-PSK signals especially. The
- * type of estimator is specified as the \p type parameter in the
- * constructor. The estimators tend to trade off performance for
- * accuracy, although experimentation should be done to figure out
- * the right approach for a given implementation. Further, the
- * current set of estimators are designed and proven theoretically
- * under AWGN conditions; some amount of error should be assumed
- * and/or estimated for real channel conditions.
- */
-class DIGITAL_API digital_mpsk_snr_est_cc : public gr_sync_block
-{
- private:
- snr_est_type_t d_type;
- int d_nsamples, d_count;
- double d_alpha;
- digital_impl_mpsk_snr_est *d_snr_est;
-
- //d_key is the tag name, 'snr', d_me is the block name + unique ID
- pmt::pmt_t d_key, d_me;
-
- /*! Factory function returning shared pointer of this class
- *
- * Parameters:
- *
- * \param type: the type of estimator to use \ref ref_snr_est_types
- * "snr_est_type_t" for details about the available types.
- * \param tag_nsamples: after this many samples, a tag containing
- * the SNR (key='snr') will be sent
- * \param alpha: the update rate of internal running average
- * calculations.
- */
- friend DIGITAL_API digital_mpsk_snr_est_cc_sptr
- digital_make_mpsk_snr_est_cc(snr_est_type_t type,
- int tag_nsamples,
- double alpha);
-
- // Private constructor
- digital_mpsk_snr_est_cc(snr_est_type_t type,
- int tag_nsamples,
- double alpha);
-
-public:
-
- ~digital_mpsk_snr_est_cc();
-
- int work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-
- //! Return the estimated signal-to-noise ratio in decibels
- double snr();
-
- //! Return the type of estimator in use
- snr_est_type_t type() const;
-
- //! Return how many samples between SNR tags
- int tag_nsample() const;
-
- //! Get the running-average coefficient
- double alpha() const;
-
- //! Set type of estimator to use
- void set_type(snr_est_type_t t);
-
- //! Set the number of samples between SNR tags
- void set_tag_nsample(int n);
-
- //! Set the running-average coefficient
- void set_alpha(double alpha);
-};
-
-#endif /* INCLUDED_DIGITAL_MPSK_SNR_EST_CC_H */
diff --git a/gr-digital/include/digital_ofdm_carrier_allocator_cvc.h b/gr-digital/include/digital_ofdm_carrier_allocator_cvc.h
index c1efcead22..9052299aa9 100644
--- a/gr-digital/include/digital_ofdm_carrier_allocator_cvc.h
+++ b/gr-digital/include/digital_ofdm_carrier_allocator_cvc.h
@@ -23,7 +23,7 @@
#ifndef INCLUDED_DIGITAL_OFDM_CARRIER_ALLOCATOR_CVC_H
#define INCLUDED_DIGITAL_OFDM_CARRIER_ALLOCATOR_CVC_H
-#include <digital_api.h>
+#include <digital/api.h>
#include <gr_tagged_stream_block.h>
class digital_ofdm_carrier_allocator_cvc;
diff --git a/gr-digital/include/digital_ofdm_chanest_vcvc.h b/gr-digital/include/digital_ofdm_chanest_vcvc.h
index 74454a63b2..da03f96720 100644
--- a/gr-digital/include/digital_ofdm_chanest_vcvc.h
+++ b/gr-digital/include/digital_ofdm_chanest_vcvc.h
@@ -22,7 +22,7 @@
#ifndef INCLUDED_DIGITAL_OFDM_CHANEST_VCVC_H
#define INCLUDED_DIGITAL_OFDM_CHANEST_VCVC_H
-#include <digital_api.h>
+#include <digital/api.h>
#include <gr_block.h>
class digital_ofdm_chanest_vcvc;
diff --git a/gr-digital/include/digital_ofdm_cyclic_prefixer.h b/gr-digital/include/digital_ofdm_cyclic_prefixer.h
index e6c36b4c14..563a311fa3 100644
--- a/gr-digital/include/digital_ofdm_cyclic_prefixer.h
+++ b/gr-digital/include/digital_ofdm_cyclic_prefixer.h
@@ -23,7 +23,7 @@
#ifndef INCLUDED_DIGITAL_OFDM_CYCLIC_PREFIXER_H
#define INCLUDED_DIGITAL_OFDM_CYCLIC_PREFIXER_H
-#include <digital_api.h>
+#include <digital/api.h>
#include <gr_tagged_stream_block.h>
class digital_ofdm_cyclic_prefixer;
diff --git a/gr-digital/include/digital_ofdm_equalizer_base.h b/gr-digital/include/digital_ofdm_equalizer_base.h
index 178806a886..8665395540 100644
--- a/gr-digital/include/digital_ofdm_equalizer_base.h
+++ b/gr-digital/include/digital_ofdm_equalizer_base.h
@@ -22,7 +22,7 @@
#ifndef INCLUDED_DIGITAL_OFDM_EQUALIZER_BASE_H
#define INCLUDED_DIGITAL_OFDM_EQUALIZER_BASE_H
-#include <digital_api.h>
+#include <digital/api.h>
#include <gr_tags.h>
#include <gr_complex.h>
#include <boost/enable_shared_from_this.hpp>
diff --git a/gr-digital/include/digital_ofdm_equalizer_simpledfe.h b/gr-digital/include/digital_ofdm_equalizer_simpledfe.h
index 9fd6395904..89b0b5cd6d 100644
--- a/gr-digital/include/digital_ofdm_equalizer_simpledfe.h
+++ b/gr-digital/include/digital_ofdm_equalizer_simpledfe.h
@@ -22,8 +22,8 @@
#ifndef INCLUDED_DIGITAL_OFDM_EQUALIZER_SIMPLEDFE_H
#define INCLUDED_DIGITAL_OFDM_EQUALIZER_SIMPLEDFE_H
-#include <digital_api.h>
-#include <digital_constellation.h>
+#include <digital/api.h>
+#include <digital/constellation.h>
#include <digital_ofdm_equalizer_base.h>
class digital_ofdm_equalizer_simpledfe;
@@ -57,7 +57,7 @@ typedef boost::shared_ptr<digital_ofdm_equalizer_simpledfe> digital_ofdm_equaliz
DIGITAL_API digital_ofdm_equalizer_simpledfe_sptr
digital_make_ofdm_equalizer_simpledfe(
int fft_len,
- const digital_constellation_sptr &constellation,
+ const gr::digital::constellation_sptr &constellation,
const std::vector<std::vector<int> > &occupied_carriers = std::vector<std::vector<int> >(),
const std::vector<std::vector<int> > &pilot_carriers = std::vector<std::vector<int> >(),
const std::vector<std::vector<gr_complex> > &pilot_symbols = std::vector<std::vector<gr_complex> >(),
@@ -100,7 +100,7 @@ class DIGITAL_API digital_ofdm_equalizer_simpledfe : public digital_ofdm_equaliz
public:
digital_ofdm_equalizer_simpledfe(
int fft_len,
- const digital_constellation_sptr &constellation,
+ const gr::digital::constellation_sptr &constellation,
const std::vector<std::vector<int> > &occupied_carriers = std::vector<std::vector<int> >(),
const std::vector<std::vector<int> > &pilot_carriers = std::vector<std::vector<int> >(),
const std::vector<std::vector<gr_complex> > &pilot_symbols = std::vector<std::vector<gr_complex> >(),
@@ -116,7 +116,7 @@ class DIGITAL_API digital_ofdm_equalizer_simpledfe : public digital_ofdm_equaliz
const std::vector<gr_tag_t> &tags = std::vector<gr_tag_t>());
private:
- digital_constellation_sptr d_constellation;
+ gr::digital::constellation_sptr d_constellation;
//! Averaging coefficient
float d_alpha;
diff --git a/gr-digital/include/digital_ofdm_equalizer_static.h b/gr-digital/include/digital_ofdm_equalizer_static.h
index 21f76fbc6a..4537d329f4 100644
--- a/gr-digital/include/digital_ofdm_equalizer_static.h
+++ b/gr-digital/include/digital_ofdm_equalizer_static.h
@@ -22,8 +22,8 @@
#ifndef INCLUDED_DIGITAL_OFDM_EQUALIZER_STATIC_H
#define INCLUDED_DIGITAL_OFDM_EQUALIZER_STATIC_H
-#include <digital_api.h>
-#include <digital_constellation.h>
+#include <digital/api.h>
+#include <digital/constellation.h>
#include <digital_ofdm_equalizer_base.h>
class digital_ofdm_equalizer_static;
diff --git a/gr-digital/include/digital_ofdm_frame_acquisition.h b/gr-digital/include/digital_ofdm_frame_acquisition.h
deleted file mode 100644
index 9c2f602334..0000000000
--- a/gr-digital/include/digital_ofdm_frame_acquisition.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2006,2007,2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_DIGITAL_OFDM_FRAME_ACQUISITION_H
-#define INCLUDED_DIGITAL_OFDM_FRAME_ACQUISITION_H
-
-#include <digital_api.h>
-#include <gr_block.h>
-#include <vector>
-
-class digital_ofdm_frame_acquisition;
-typedef boost::shared_ptr<digital_ofdm_frame_acquisition> digital_ofdm_frame_acquisition_sptr;
-
-digital_ofdm_frame_acquisition_sptr
-DIGITAL_API digital_make_ofdm_frame_acquisition (unsigned int occupied_carriers, unsigned int fft_length,
- unsigned int cplen,
- const std::vector<gr_complex> &known_symbol,
- unsigned int max_fft_shift_len=10);
-
-/*!
- * \brief take a vector of complex constellation points in from an FFT
- * and performs a correlation and equalization.
- * \ingroup demodulation_blk
- * \ingroup ofdm_blk
- *
- * This block takes the output of an FFT of a received OFDM symbol and finds the
- * start of a frame based on two known symbols. It also looks at the surrounding
- * bins in the FFT output for the correlation in case there is a large frequency
- * shift in the data. This block assumes that the fine frequency shift has already
- * been corrected and that the samples fall in the middle of one FFT bin.
- *
- * It then uses one of those known
- * symbols to estimate the channel response over all subcarriers and does a simple
- * 1-tap equalization on all subcarriers. This corrects for the phase and amplitude
- * distortion caused by the channel.
- */
-
-class DIGITAL_API digital_ofdm_frame_acquisition : public gr_block
-{
- /*!
- * \brief Build an OFDM correlator and equalizer.
- * \param occupied_carriers The number of subcarriers with data in the received symbol
- * \param fft_length The size of the FFT vector (occupied_carriers + unused carriers)
- * \param cplen The length of the cycle prefix
- * \param known_symbol A vector of complex numbers representing a known symbol at the
- * start of a frame (usually a BPSK PN sequence)
- * \param max_fft_shift_len Set's the maximum distance you can look between bins for correlation
- */
- friend DIGITAL_API digital_ofdm_frame_acquisition_sptr
- digital_make_ofdm_frame_acquisition (unsigned int occupied_carriers, unsigned int fft_length,
- unsigned int cplen,
- const std::vector<gr_complex> &known_symbol,
- unsigned int max_fft_shift_len);
-
-protected:
- digital_ofdm_frame_acquisition (unsigned int occupied_carriers, unsigned int fft_length,
- unsigned int cplen,
- const std::vector<gr_complex> &known_symbol,
- unsigned int max_fft_shift_len);
-
- private:
- unsigned char slicer(gr_complex x);
- void correlate(const gr_complex *symbol, int zeros_on_left);
- void calculate_equalizer(const gr_complex *symbol, int zeros_on_left);
- gr_complex coarse_freq_comp(int freq_delta, int count);
-
- unsigned int d_occupied_carriers; // !< \brief number of subcarriers with data
- unsigned int d_fft_length; // !< \brief length of FFT vector
- unsigned int d_cplen; // !< \brief length of cyclic prefix in samples
- unsigned int d_freq_shift_len; // !< \brief number of surrounding bins to look at for correlation
- std::vector<gr_complex> d_known_symbol; // !< \brief known symbols at start of frame
- std::vector<float> d_known_phase_diff; // !< \brief factor used in correlation from known symbol
- std::vector<float> d_symbol_phase_diff; // !< \brief factor used in correlation from received symbol
- std::vector<gr_complex> d_hestimate; // !< channel estimate
- int d_coarse_freq; // !< \brief search distance in number of bins
- unsigned int d_phase_count; // !< \brief accumulator for coarse freq correction
- float d_snr_est; // !< an estimation of the signal to noise ratio
-
- gr_complex *d_phase_lut; // !< look-up table for coarse frequency compensation
-
- void forecast(int noutput_items, gr_vector_int &ninput_items_required);
-
- public:
- /*!
- * \brief Return an estimate of the SNR of the channel
- */
- float snr() { return d_snr_est; }
-
- ~digital_ofdm_frame_acquisition(void);
- int general_work(int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
-
-
-#endif
diff --git a/gr-digital/include/digital_ofdm_frame_sink.h b/gr-digital/include/digital_ofdm_frame_sink.h
deleted file mode 100644
index 5785d4be7b..0000000000
--- a/gr-digital/include/digital_ofdm_frame_sink.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2007,2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_DIGITAL_OFDM_FRAME_SINK_H
-#define INCLUDED_DIGITAL_OFDM_FRAME_SINK_H
-
-#include <digital_api.h>
-#include <gr_sync_block.h>
-#include <gr_msg_queue.h>
-
-class digital_ofdm_frame_sink;
-typedef boost::shared_ptr<digital_ofdm_frame_sink> digital_ofdm_frame_sink_sptr;
-
-DIGITAL_API digital_ofdm_frame_sink_sptr
-digital_make_ofdm_frame_sink (const std::vector<gr_complex> &sym_position,
- const std::vector<unsigned char> &sym_value_out,
- gr_msg_queue_sptr target_queue, unsigned int occupied_tones,
- float phase_gain=0.25, float freq_gain=0.25*0.25/4.0);
-
-/*!
- * \brief Takes an OFDM symbol in, demaps it into bits of 0's and 1's, packs
- * them into packets, and sends to to a message queue sink.
- * \ingroup sink_blk
- * \ingroup ofdm_blk
- *
- * NOTE: The mod input parameter simply chooses a pre-defined demapper/slicer. Eventually,
- * we want to be able to pass in a reference to an object to do the demapping and slicing
- * for a given modulation type.
- */
-class DIGITAL_API digital_ofdm_frame_sink : public gr_sync_block
-{
- friend DIGITAL_API digital_ofdm_frame_sink_sptr
- digital_make_ofdm_frame_sink (const std::vector<gr_complex> &sym_position,
- const std::vector<unsigned char> &sym_value_out,
- gr_msg_queue_sptr target_queue, unsigned int occupied_tones,
- float phase_gain, float freq_gain);
-
- private:
- enum state_t {STATE_SYNC_SEARCH, STATE_HAVE_SYNC, STATE_HAVE_HEADER};
-
- static const int MAX_PKT_LEN = 4096;
- static const int HEADERBYTELEN = 4;
-
- gr_msg_queue_sptr d_target_queue; // where to send the packet when received
- state_t d_state;
- unsigned int d_header; // header bits
- int d_headerbytelen_cnt; // how many so far
-
- unsigned char *d_bytes_out; // hold the current bytes produced by the demapper
-
- unsigned int d_occupied_carriers;
- unsigned int d_byte_offset;
- unsigned int d_partial_byte;
-
- unsigned char d_packet[MAX_PKT_LEN]; // assembled payload
- int d_packetlen; // length of packet
- int d_packet_whitener_offset; // offset into whitener string to use
- int d_packetlen_cnt; // how many so far
-
- gr_complex * d_derotated_output; // Pointer to output stream to send deroated symbols out
-
- std::vector<gr_complex> d_sym_position;
- std::vector<unsigned char> d_sym_value_out;
- std::vector<gr_complex> d_dfe;
- unsigned int d_nbits;
-
- unsigned char d_resid;
- unsigned int d_nresid;
- float d_phase;
- float d_freq;
- float d_phase_gain;
- float d_freq_gain;
- float d_eq_gain;
-
- std::vector<int> d_subcarrier_map;
-
- protected:
- digital_ofdm_frame_sink(const std::vector<gr_complex> &sym_position,
- const std::vector<unsigned char> &sym_value_out,
- gr_msg_queue_sptr target_queue, unsigned int occupied_tones,
- float phase_gain, float freq_gain);
-
- void enter_search();
- void enter_have_sync();
- void enter_have_header();
-
- bool header_ok()
- {
- // confirm that two copies of header info are identical
- return ((d_header >> 16) ^ (d_header & 0xffff)) == 0;
- }
-
- unsigned char slicer(const gr_complex x);
- unsigned int demapper(const gr_complex *in,
- unsigned char *out);
-
- bool set_sym_value_out(const std::vector<gr_complex> &sym_position,
- const std::vector<unsigned char> &sym_value_out);
-
- public:
- ~digital_ofdm_frame_sink();
-
- int work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
-
-#endif /* INCLUDED_GR_OFDM_FRAME_SINK_H */
diff --git a/gr-digital/include/digital_ofdm_insert_preamble.h b/gr-digital/include/digital_ofdm_insert_preamble.h
deleted file mode 100644
index fa44558add..0000000000
--- a/gr-digital/include/digital_ofdm_insert_preamble.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2007,2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef INCLUDED_DIGITAL_OFDM_INSERT_PREAMBLE_H
-#define INCLUDED_DIGITAL_OFDM_INSERT_PREAMBLE_H
-
-#include <digital_api.h>
-#include <gr_block.h>
-#include <vector>
-
-class digital_ofdm_insert_preamble;
-typedef boost::shared_ptr<digital_ofdm_insert_preamble> digital_ofdm_insert_preamble_sptr;
-
-DIGITAL_API digital_ofdm_insert_preamble_sptr
-digital_make_ofdm_insert_preamble(int fft_length,
- const std::vector<std::vector<gr_complex> > &preamble);
-
-/*!
- * \brief insert "pre-modulated" preamble symbols before each payload.
- * \ingroup sync_blk
- * \ingroup ofdm_blk
- *
- * <pre>
- * input 1: stream of vectors of gr_complex [fft_length]
- * These are the modulated symbols of the payload.
- *
- * input 2: stream of char. The LSB indicates whether the corresponding
- * symbol on input 1 is the first symbol of the payload or not.
- * It's a 1 if the corresponding symbol is the first symbol,
- * otherwise 0.
- *
- * N.B., this implies that there must be at least 1 symbol in the payload.
- *
- *
- * output 1: stream of vectors of gr_complex [fft_length]
- * These include the preamble symbols and the payload symbols.
- *
- * output 2: stream of char. The LSB indicates whether the corresponding
- * symbol on input 1 is the first symbol of a packet (i.e., the
- * first symbol of the preamble.) It's a 1 if the corresponding
- * symbol is the first symbol, otherwise 0.
- * </pre>
- *
- * \param fft_length length of each symbol in samples.
- * \param preamble vector of symbols that represent the pre-modulated preamble.
- */
-
-class DIGITAL_API digital_ofdm_insert_preamble : public gr_block
-{
- friend DIGITAL_API digital_ofdm_insert_preamble_sptr
- digital_make_ofdm_insert_preamble(int fft_length,
- const std::vector<std::vector<gr_complex> > &preamble);
-
-protected:
- digital_ofdm_insert_preamble(int fft_length,
- const std::vector<std::vector<gr_complex> > &preamble);
-
-private:
- enum state_t {
- ST_IDLE,
- ST_PREAMBLE,
- ST_FIRST_PAYLOAD,
- ST_PAYLOAD
- };
-
- int d_fft_length;
- const std::vector<std::vector<gr_complex> > d_preamble;
- state_t d_state;
- int d_nsymbols_output;
- int d_pending_flag;
-
- void enter_idle();
- void enter_first_payload();
- void enter_payload();
-
-
-public:
- ~digital_ofdm_insert_preamble();
- void enter_preamble();
-
- int general_work (int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
- void forecast (int noutput_items, gr_vector_int &ninput_items_required);
-
-};
-
-#endif /* INCLUDED_DIGITAL_OFDM_INSERT_PREAMBLE_H */
diff --git a/gr-digital/include/digital_ofdm_mapper_bcv.h b/gr-digital/include/digital_ofdm_mapper_bcv.h
deleted file mode 100644
index daed1eab29..0000000000
--- a/gr-digital/include/digital_ofdm_mapper_bcv.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2006,2007,2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_DIGITAL_OFDM_MAPPER_BCV_H
-#define INCLUDED_DIGITAL_OFDM_MAPPER_BCV_H
-
-#include <digital_api.h>
-#include <gr_sync_block.h>
-#include <gr_message.h>
-#include <gr_msg_queue.h>
-
-class digital_ofdm_mapper_bcv;
-typedef boost::shared_ptr<digital_ofdm_mapper_bcv> digital_ofdm_mapper_bcv_sptr;
-
-DIGITAL_API digital_ofdm_mapper_bcv_sptr
-digital_make_ofdm_mapper_bcv (const std::vector<gr_complex> &constellation, unsigned msgq_limit,
- unsigned occupied_carriers, unsigned int fft_length);
-
-/*!
- * \brief take a stream of bytes in and map to a vector of complex
- * constellation points suitable for IFFT input to be used in an ofdm
- * modulator. Abstract class must be subclassed with specific mapping.
- * \ingroup modulation_blk
- * \ingroup ofdm_blk
- */
-
-class DIGITAL_API digital_ofdm_mapper_bcv : public gr_sync_block
-{
- friend DIGITAL_API digital_ofdm_mapper_bcv_sptr
- digital_make_ofdm_mapper_bcv (const std::vector<gr_complex> &constellation, unsigned msgq_limit,
- unsigned occupied_carriers, unsigned int fft_length);
-protected:
- digital_ofdm_mapper_bcv (const std::vector<gr_complex> &constellation, unsigned msgq_limit,
- unsigned occupied_carriers, unsigned int fft_length);
-
- private:
- std::vector<gr_complex> d_constellation;
- gr_msg_queue_sptr d_msgq;
- gr_message_sptr d_msg;
- unsigned d_msg_offset;
- bool d_eof;
-
- unsigned int d_occupied_carriers;
- unsigned int d_fft_length;
- unsigned int d_bit_offset;
- int d_pending_flag;
-
- unsigned long d_nbits;
- unsigned char d_msgbytes;
-
- unsigned char d_resid;
- unsigned int d_nresid;
-
- std::vector<int> d_subcarrier_map;
-
- int randsym();
-
- public:
- ~digital_ofdm_mapper_bcv(void);
-
- gr_msg_queue_sptr msgq() const { return d_msgq; }
-
- int work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-
-};
-
-#endif
diff --git a/gr-digital/include/digital_ofdm_sampler.h b/gr-digital/include/digital_ofdm_sampler.h
deleted file mode 100644
index 9c54e4e776..0000000000
--- a/gr-digital/include/digital_ofdm_sampler.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2007,2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_DIGITAL_OFDM_SAMPLER_H
-#define INCLUDED_DIGITAL_OFDM_SAMPLER_H
-
-#include <digital_api.h>
-#include <gr_sync_block.h>
-
-class digital_ofdm_sampler;
-typedef boost::shared_ptr<digital_ofdm_sampler> digital_ofdm_sampler_sptr;
-
-DIGITAL_API digital_ofdm_sampler_sptr digital_make_ofdm_sampler (unsigned int fft_length,
- unsigned int symbol_length,
- unsigned int timeout=1000);
-
-/*!
- * \brief does the rest of the OFDM stuff
- * \ingroup ofdm_blk
- */
-class DIGITAL_API digital_ofdm_sampler : public gr_block
-{
- friend DIGITAL_API digital_ofdm_sampler_sptr digital_make_ofdm_sampler (unsigned int fft_length,
- unsigned int symbol_length,
- unsigned int timeout);
-
- digital_ofdm_sampler (unsigned int fft_length,
- unsigned int symbol_length,
- unsigned int timeout);
-
- private:
- enum state_t {STATE_NO_SIG, STATE_PREAMBLE, STATE_FRAME};
-
- state_t d_state;
- unsigned int d_timeout_max;
- unsigned int d_timeout;
- unsigned int d_fft_length;
- unsigned int d_symbol_length;
-
- public:
- void forecast (int noutput_items, gr_vector_int &ninput_items_required);
-
- int general_work (int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
-
-#endif
diff --git a/gr-digital/include/digital_ofdm_sync_sc_cfb.h b/gr-digital/include/digital_ofdm_sync_sc_cfb.h
index 36ea1b22fd..cc728814ed 100644
--- a/gr-digital/include/digital_ofdm_sync_sc_cfb.h
+++ b/gr-digital/include/digital_ofdm_sync_sc_cfb.h
@@ -22,7 +22,7 @@
#ifndef INCLUDED_DIGITAL_OFDM_SYNC_SC_CFB_H
#define INCLUDED_DIGITAL_OFDM_SYNC_SC_CFB_H
-#include <digital_api.h>
+#include <digital/api.h>
#include <gr_hier_block2.h>
class digital_ofdm_sync_sc_cfb;
diff --git a/gr-digital/include/digital_packet_sink.h b/gr-digital/include/digital_packet_sink.h
deleted file mode 100644
index 7ab41c0ef7..0000000000
--- a/gr-digital/include/digital_packet_sink.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2005,2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_GR_PACKET_SINK_H
-#define INCLUDED_GR_PACKET_SINK_H
-
-#include <digital_api.h>
-#include <gr_sync_block.h>
-#include <gr_msg_queue.h>
-
-class digital_packet_sink;
-typedef boost::shared_ptr<digital_packet_sink> digital_packet_sink_sptr;
-
-DIGITAL_API digital_packet_sink_sptr
-digital_make_packet_sink(const std::vector<unsigned char>& sync_vector,
- gr_msg_queue_sptr target_queue,
- int threshold = -1); // -1 -> use default
-
-/*!
- * \brief process received bits looking for packet sync, header, and process bits into packet
- * \ingroup sink_blk
- *
- * input: stream of symbols to be sliced.
- *
- * output: none. Pushes assembled packet into target queue
- *
- * The packet sink takes in a stream of binary symbols that are sliced
- * around 0. The bits are then checked for the \p sync_vector to
- * determine find and decode the packet. It then expects a fixed
- * length header of 2 16-bit shorts containing the payload length,
- * followed by the payload. If the 2 16-bit shorts are not identical,
- * this packet is ignored. Better algs are welcome.
- *
- * This block is not very useful anymore as it only works with 2-level
- * modulations such as BPSK or GMSK. The block can generally be
- * replaced with a correlate access code and frame sink blocks.
- *
- * \param sync_vector The synchronization vector as a vector of 1's and 0's.
- * \param target_queue The message queue that packets are sent to.
- * \param threshold Number of bits that can be incorrect in the \p sync_vector.
- */
-class DIGITAL_API digital_packet_sink : public gr_sync_block
-{
- friend DIGITAL_API digital_packet_sink_sptr
- digital_make_packet_sink(const std::vector<unsigned char>& sync_vector,
- gr_msg_queue_sptr target_queue,
- int threshold);
-
- private:
- enum state_t {STATE_SYNC_SEARCH, STATE_HAVE_SYNC, STATE_HAVE_HEADER};
-
- static const int MAX_PKT_LEN = 4096;
- static const int HEADERBITLEN = 32;
-
- gr_msg_queue_sptr d_target_queue; // where to send the packet when received
- unsigned long long d_sync_vector; // access code to locate start of packet
- unsigned int d_threshold; // how many bits may be wrong in sync vector
-
- state_t d_state;
-
- unsigned long long d_shift_reg; // used to look for sync_vector
-
- unsigned int d_header; // header bits
- int d_headerbitlen_cnt; // how many so far
-
- unsigned char d_packet[MAX_PKT_LEN]; // assembled payload
- unsigned char d_packet_byte; // byte being assembled
- int d_packet_byte_index; // which bit of d_packet_byte we're working on
- int d_packetlen; // length of packet
- int d_packetlen_cnt; // how many so far
-
- protected:
- digital_packet_sink(const std::vector<unsigned char>& sync_vector,
- gr_msg_queue_sptr target_queue,
- int threshold);
-
- void enter_search();
- void enter_have_sync();
- void enter_have_header(int payload_len);
-
- int slice(float x) { return x > 0 ? 1 : 0; }
-
- bool header_ok()
- {
- // confirm that two copies of header info are identical
- return ((d_header >> 16) ^ (d_header & 0xffff)) == 0;
- }
-
- int header_payload_len()
- {
- // header consists of two 16-bit shorts in network byte order
- int t = (d_header >> 16) & 0xffff;
- return t;
- }
-
- public:
- ~digital_packet_sink();
-
- int work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-
-
- //! return true if we detect carrier
- bool carrier_sensed() const
- {
- return d_state != STATE_SYNC_SEARCH;
- }
-
-};
-
-#endif /* INCLUDED_GR_PACKET_SINK_H */
diff --git a/gr-digital/include/digital_pfb_clock_sync_ccf.h b/gr-digital/include/digital_pfb_clock_sync_ccf.h
deleted file mode 100644
index 1b403ab253..0000000000
--- a/gr-digital/include/digital_pfb_clock_sync_ccf.h
+++ /dev/null
@@ -1,376 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2009,2010,2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-
-#ifndef INCLUDED_DIGITAL_PFB_CLOCK_SYNC_CCF_H
-#define INCLUDED_DIGITAL_PFB_CLOCK_SYNC_CCF_H
-
-#include <digital_api.h>
-#include <gr_block.h>
-
-class digital_pfb_clock_sync_ccf;
-typedef boost::shared_ptr<digital_pfb_clock_sync_ccf> digital_pfb_clock_sync_ccf_sptr;
-DIGITAL_API digital_pfb_clock_sync_ccf_sptr
-digital_make_pfb_clock_sync_ccf(double sps, float loop_bw,
- const std::vector<float> &taps,
- unsigned int filter_size=32,
- float init_phase=0,
- float max_rate_deviation=1.5,
- int osps=1);
-
-class gr_fir_ccf;
-
-/*!
- * \class digital_pfb_clock_sync_ccf
- *
- * \brief Timing synchronizer using polyphase filterbanks
- *
- * \ingroup filter_blk
- * \ingroup pfb_blk
- *
- * This block performs timing synchronization for PAM signals by
- * minimizing the derivative of the filtered signal, which in turn
- * maximizes the SNR and minimizes ISI.
- *
- * This approach works by setting up two filterbanks; one filterbank
- * contains the signal's pulse shaping matched filter (such as a root
- * raised cosine filter), where each branch of the filterbank contains
- * a different phase of the filter. The second filterbank contains
- * the derivatives of the filters in the first filterbank. Thinking of
- * this in the time domain, the first filterbank contains filters that
- * have a sinc shape to them. We want to align the output signal to be
- * sampled at exactly the peak of the sinc shape. The derivative of
- * the sinc contains a zero at the maximum point of the sinc (sinc(0)
- * = 1, sinc(0)' = 0). Furthermore, the region around the zero point
- * is relatively linear. We make use of this fact to generate the
- * error signal.
- *
- * If the signal out of the derivative filters is d_i[n] for the ith
- * filter, and the output of the matched filter is x_i[n], we
- * calculate the error as: e[n] = (Re{x_i[n]} * Re{d_i[n]} +
- * Im{x_i[n]} * Im{d_i[n]}) / 2.0 This equation averages the error in
- * the real and imaginary parts. There are two reasons we multiply by
- * the signal itself. First, if the symbol could be positive or
- * negative going, but we want the error term to always tell us to go
- * in the same direction depending on which side of the zero point we
- * are on. The sign of x_i[n] adjusts the error term to do
- * this. Second, the magnitude of x_i[n] scales the error term
- * depending on the symbol's amplitude, so larger signals give us a
- * stronger error term because we have more confidence in that
- * symbol's value. Using the magnitude of x_i[n] instead of just the
- * sign is especially good for signals with low SNR.
- *
- * The error signal, e[n], gives us a value proportional to how far
- * away from the zero point we are in the derivative signal. We want
- * to drive this value to zero, so we set up a second order loop. We
- * have two variables for this loop; d_k is the filter number in the
- * filterbank we are on and d_rate is the rate which we travel through
- * the filters in the steady state. That is, due to the natural clock
- * differences between the transmitter and receiver, d_rate represents
- * that difference and would traverse the filter phase paths to keep
- * the receiver locked. Thinking of this as a second-order PLL, the
- * d_rate is the frequency and d_k is the phase. So we update d_rate
- * and d_k using the standard loop equations based on two error
- * signals, d_alpha and d_beta. We have these two values set based on
- * each other for a critically damped system, so in the block
- * constructor, we just ask for "gain," which is d_alpha while d_beta
- * is equal to (gain^2)/4.
- *
- * The block's parameters are:
- *
- * \li \p sps: The clock sync block needs to know the number of samples per
- * symbol, because it defaults to return a single point representing
- * the symbol. The sps can be any positive real number and does not
- * need to be an integer.
- *
- * \li \p loop_bw: The loop bandwidth is used to set the gain of the
- * inner control loop (see:
- * http://gnuradio.squarespace.com/blog/2011/8/13/control-loop-gain-values.html).
- * This should be set small (a value of around 2pi/100 is suggested in
- * that blog post as the step size for the number of radians around
- * the unit circle to move relative to the error).
- *
- * \li \p taps: One of the most important parameters for this block is
- * the taps of the filter. One of the benefits of this algorithm is
- * that you can put the matched filter in here as the taps, so you get
- * both the matched filter and sample timing correction in one go. So
- * create your normal matched filter. For a typical digital
- * modulation, this is a root raised cosine filter. The number of taps
- * of this filter is based on how long you expect the channel to be;
- * that is, how many symbols do you want to combine to get the current
- * symbols energy back (there's probably a better way of stating
- * that). It's usually 5 to 10 or so. That gives you your filter, but
- * now we need to think about it as a filter with different phase
- * profiles in each filter. So take this number of taps and multiply
- * it by the number of filters. This is the number you would use to
- * create your prototype filter. When you use this in the PFB
- * filerbank, it segments these taps into the filterbanks in such a
- * way that each bank now represents the filter at different phases,
- * equally spaced at 2pi/N, where N is the number of filters.
- *
- * \li \p filter_size (default=32): The number of filters can also be
- * set and defaults to 32. With 32 filters, you get a good enough
- * resolution in the phase to produce very small, almost unnoticeable,
- * ISI. Going to 64 filters can reduce this more, but after that
- * there is very little gained for the extra complexity.
- *
- * \li \p init_phase (default=0): The initial phase is another
- * settable parameter and refers to the filter path the algorithm
- * initially looks at (i.e., d_k starts at init_phase). This value
- * defaults to zero, but it might be useful to start at a different
- * phase offset, such as the mid-point of the filters.
- *
- * \li \p max_rate_deviation (default=1.5): The next parameter is the
- * max_rate_devitation, which defaults to 1.5. This is how far we
- * allow d_rate to swing, positive or negative, from 0. Constraining
- * the rate can help keep the algorithm from walking too far away to
- * lock during times when there is no signal.
- *
- * \li \p osps (default=1): The osps is the number of output samples per symbol. By default,
- * the algorithm produces 1 sample per symbol, sampled at the exact
- * sample value. This osps value was added to better work with
- * equalizers, which do a better job of modeling the channel if they
- * have 2 samps/sym.
- */
-
-class DIGITAL_API digital_pfb_clock_sync_ccf : public gr_block
-{
- private:
- /*!
- * Build the polyphase filterbank timing synchronizer.
- * \param sps (double) The number of samples per symbol in the incoming signal
- * \param loop_bw (float) The bandwidth of the control loop; set's alpha and beta.
- * \param taps (vector<int>) The filter taps.
- * \param filter_size (uint) The number of filters in the filterbank (default = 32).
- * \param init_phase (float) The initial phase to look at, or which filter to start
- * with (default = 0).
- * \param max_rate_deviation (float) Distance from 0 d_rate can get (default = 1.5).
- * \param osps (int) The number of output samples per symbol (default=1).
- *
- */
- friend DIGITAL_API digital_pfb_clock_sync_ccf_sptr
- digital_make_pfb_clock_sync_ccf(double sps, float loop_bw,
- const std::vector<float> &taps,
- unsigned int filter_size,
- float init_phase,
- float max_rate_deviation,
- int osps);
-
- bool d_updated;
- double d_sps;
- double d_sample_num;
- float d_loop_bw;
- float d_damping;
- float d_alpha;
- float d_beta;
-
- int d_nfilters;
- int d_taps_per_filter;
- std::vector<gr_fir_ccf*> d_filters;
- std::vector<gr_fir_ccf*> d_diff_filters;
- std::vector< std::vector<float> > d_taps;
- std::vector< std::vector<float> > d_dtaps;
-
- float d_k;
- float d_rate;
- float d_rate_i;
- float d_rate_f;
- float d_max_dev;
- int d_filtnum;
- int d_osps;
- float d_error;
- int d_out_idx;
-
- /*!
- * Build the polyphase filterbank timing synchronizer.
- */
- digital_pfb_clock_sync_ccf(double sps, float loop_bw,
- const std::vector<float> &taps,
- unsigned int filter_size,
- float init_phase,
- float max_rate_deviation,
- int osps);
-
- void create_diff_taps(const std::vector<float> &newtaps,
- std::vector<float> &difftaps);
-
-public:
- ~digital_pfb_clock_sync_ccf();
-
- /*! \brief update the system gains from omega and eta
- *
- * This function updates the system gains based on the loop
- * bandwidth and damping factor of the system.
- * These two factors can be set separately through their own
- * set functions.
- */
- void update_gains();
-
- /*!
- * Resets the filterbank's filter taps with the new prototype filter
- */
- void set_taps(const std::vector<float> &taps,
- std::vector< std::vector<float> > &ourtaps,
- std::vector<gr_fir_ccf*> &ourfilter);
-
- /*!
- * Returns all of the taps of the matched filter
- */
- std::vector< std::vector<float> > get_taps();
-
- /*!
- * Returns all of the taps of the derivative filter
- */
- std::vector< std::vector<float> > get_diff_taps();
-
- /*!
- * Returns the taps of the matched filter for a particular channel
- */
- std::vector<float> get_channel_taps(int channel);
-
- /*!
- * Returns the taps in the derivative filter for a particular channel
- */
- std::vector<float> get_diff_channel_taps(int channel);
-
- /*!
- * Return the taps as a formatted string for printing
- */
- std::string get_taps_as_string();
-
- /*!
- * Return the derivative filter taps as a formatted string for printing
- */
- std::string get_diff_taps_as_string();
-
-
- /*******************************************************************
- SET FUNCTIONS
- *******************************************************************/
-
-
- /*!
- * \brief Set the loop bandwidth
- *
- * Set the loop filter's bandwidth to \p bw. This should be between
- * 2*pi/200 and 2*pi/100 (in rads/samp). It must also be a positive
- * number.
- *
- * When a new damping factor is set, the gains, alpha and beta, of the loop
- * are recalculated by a call to update_gains().
- *
- * \param bw (float) new bandwidth
- *
- */
- void set_loop_bandwidth(float bw);
-
- /*!
- * \brief Set the loop damping factor
- *
- * Set the loop filter's damping factor to \p df. The damping factor
- * should be sqrt(2)/2.0 for critically damped systems.
- * Set it to anything else only if you know what you are doing. It must
- * be a number between 0 and 1.
- *
- * When a new damping factor is set, the gains, alpha and beta, of the loop
- * are recalculated by a call to update_gains().
- *
- * \param df (float) new damping factor
- *
- */
- void set_damping_factor(float df);
-
- /*!
- * \brief Set the loop gain alpha
- *
- * Set's the loop filter's alpha gain parameter.
- *
- * This value should really only be set by adjusting the loop bandwidth
- * and damping factor.
- *
- * \param alpha (float) new alpha gain
- *
- */
- void set_alpha(float alpha);
-
- /*!
- * \brief Set the loop gain beta
- *
- * Set's the loop filter's beta gain parameter.
- *
- * This value should really only be set by adjusting the loop bandwidth
- * and damping factor.
- *
- * \param beta (float) new beta gain
- *
- */
- void set_beta(float beta);
-
- /*!
- * Set the maximum deviation from 0 d_rate can have
- */
- void set_max_rate_deviation(float m)
- {
- d_max_dev = m;
- }
-
- /*******************************************************************
- GET FUNCTIONS
- *******************************************************************/
-
- /*!
- * \brief Returns the loop bandwidth
- */
- float get_loop_bandwidth() const;
-
- /*!
- * \brief Returns the loop damping factor
- */
- float get_damping_factor() const;
-
- /*!
- * \brief Returns the loop gain alpha
- */
- float get_alpha() const;
-
- /*!
- * \brief Returns the loop gain beta
- */
- float get_beta() const;
-
- /*!
- * \brief Returns the current clock rate
- */
- float get_clock_rate() const;
-
- /*******************************************************************
- *******************************************************************/
-
- bool check_topology(int ninputs, int noutputs);
-
- int general_work(int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
-
-#endif
diff --git a/gr-digital/include/digital_pfb_clock_sync_fff.h b/gr-digital/include/digital_pfb_clock_sync_fff.h
deleted file mode 100644
index c7e8babd69..0000000000
--- a/gr-digital/include/digital_pfb_clock_sync_fff.h
+++ /dev/null
@@ -1,376 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2009,2010,2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-
-#ifndef INCLUDED_DIGITAL_PFB_CLOCK_SYNC_FFF_H
-#define INCLUDED_DIGITAL_PFB_CLOCK_SYNC_FFF_H
-
-#include <digital_api.h>
-#include <gr_block.h>
-
-class digital_pfb_clock_sync_fff;
-typedef boost::shared_ptr<digital_pfb_clock_sync_fff> digital_pfb_clock_sync_fff_sptr;
-DIGITAL_API digital_pfb_clock_sync_fff_sptr
-digital_make_pfb_clock_sync_fff(double sps, float gain,
- const std::vector<float> &taps,
- unsigned int filter_size=32,
- float init_phase=0,
- float max_rate_deviation=1.5,
- int osps=1);
-
-class gr_fir_fff;
-
-/*!
- * \class digital_pfb_clock_sync_fff
- *
- * \brief Timing synchronizer using polyphase filterbanks
- *
- * \ingroup filter_blk
- * \ingroup pfb_blk
- *
- * This block performs timing synchronization for PAM signals by
- * minimizing the derivative of the filtered signal, which in turn
- * maximizes the SNR and minimizes ISI.
- *
- * This approach works by setting up two filterbanks; one filterbank
- * contains the signal's pulse shaping matched filter (such as a root
- * raised cosine filter), where each branch of the filterbank contains
- * a different phase of the filter. The second filterbank contains
- * the derivatives of the filters in the first filterbank. Thinking of
- * this in the time domain, the first filterbank contains filters that
- * have a sinc shape to them. We want to align the output signal to be
- * sampled at exactly the peak of the sinc shape. The derivative of
- * the sinc contains a zero at the maximum point of the sinc (sinc(0)
- * = 1, sinc(0)' = 0). Furthermore, the region around the zero point
- * is relatively linear. We make use of this fact to generate the
- * error signal.
- *
- * If the signal out of the derivative filters is d_i[n] for the ith
- * filter, and the output of the matched filter is x_i[n], we
- * calculate the error as: e[n] = (Re{x_i[n]} * Re{d_i[n]} +
- * Im{x_i[n]} * Im{d_i[n]}) / 2.0 This equation averages the error in
- * the real and imaginary parts. There are two reasons we multiply by
- * the signal itself. First, if the symbol could be positive or
- * negative going, but we want the error term to always tell us to go
- * in the same direction depending on which side of the zero point we
- * are on. The sign of x_i[n] adjusts the error term to do
- * this. Second, the magnitude of x_i[n] scales the error term
- * depending on the symbol's amplitude, so larger signals give us a
- * stronger error term because we have more confidence in that
- * symbol's value. Using the magnitude of x_i[n] instead of just the
- * sign is especially good for signals with low SNR.
- *
- * The error signal, e[n], gives us a value proportional to how far
- * away from the zero point we are in the derivative signal. We want
- * to drive this value to zero, so we set up a second order loop. We
- * have two variables for this loop; d_k is the filter number in the
- * filterbank we are on and d_rate is the rate which we travel through
- * the filters in the steady state. That is, due to the natural clock
- * differences between the transmitter and receiver, d_rate represents
- * that difference and would traverse the filter phase paths to keep
- * the receiver locked. Thinking of this as a second-order PLL, the
- * d_rate is the frequency and d_k is the phase. So we update d_rate
- * and d_k using the standard loop equations based on two error
- * signals, d_alpha and d_beta. We have these two values set based on
- * each other for a critically damped system, so in the block
- * constructor, we just ask for "gain," which is d_alpha while d_beta
- * is equal to (gain^2)/4.
- *
- * The block's parameters are:
- *
- * \li \p sps: The clock sync block needs to know the number of samples per
- * symbol, because it defaults to return a single point representing
- * the symbol. The sps can be any positive real number and does not
- * need to be an integer.
- *
- * \li \p loop_bw: The loop bandwidth is used to set the gain of the
- * inner control loop (see:
- * http://gnuradio.squarespace.com/blog/2011/8/13/control-loop-gain-values.html).
- * This should be set small (a value of around 2pi/100 is suggested in
- * that blog post as the step size for the number of radians around
- * the unit circle to move relative to the error).
- *
- * \li \p taps: One of the most important parameters for this block is
- * the taps of the filter. One of the benefits of this algorithm is
- * that you can put the matched filter in here as the taps, so you get
- * both the matched filter and sample timing correction in one go. So
- * create your normal matched filter. For a typical digital
- * modulation, this is a root raised cosine filter. The number of taps
- * of this filter is based on how long you expect the channel to be;
- * that is, how many symbols do you want to combine to get the current
- * symbols energy back (there's probably a better way of stating
- * that). It's usually 5 to 10 or so. That gives you your filter, but
- * now we need to think about it as a filter with different phase
- * profiles in each filter. So take this number of taps and multiply
- * it by the number of filters. This is the number you would use to
- * create your prototype filter. When you use this in the PFB
- * filerbank, it segments these taps into the filterbanks in such a
- * way that each bank now represents the filter at different phases,
- * equally spaced at 2pi/N, where N is the number of filters.
- *
- * \li \p filter_size (default=32): The number of filters can also be
- * set and defaults to 32. With 32 filters, you get a good enough
- * resolution in the phase to produce very small, almost unnoticeable,
- * ISI. Going to 64 filters can reduce this more, but after that
- * there is very little gained for the extra complexity.
- *
- * \li \p init_phase (default=0): The initial phase is another
- * settable parameter and refers to the filter path the algorithm
- * initially looks at (i.e., d_k starts at init_phase). This value
- * defaults to zero, but it might be useful to start at a different
- * phase offset, such as the mid-point of the filters.
- *
- * \li \p max_rate_deviation (default=1.5): The next parameter is the
- * max_rate_devitation, which defaults to 1.5. This is how far we
- * allow d_rate to swing, positive or negative, from 0. Constraining
- * the rate can help keep the algorithm from walking too far away to
- * lock during times when there is no signal.
- *
- * \li \p osps (default=1): The osps is the number of output samples
- * per symbol. By default, the algorithm produces 1 sample per symbol,
- * sampled at the exact sample value. This osps value was added to
- * better work with equalizers, which do a better job of modeling the
- * channel if they have 2 samps/sym.
- */
-
-class DIGITAL_API digital_pfb_clock_sync_fff : public gr_block
-{
- private:
- /*!
- * Build the polyphase filterbank timing synchronizer.
- * \param sps (double) The number of samples per second in the incoming signal
- * \param gain (float) The alpha gain of the control loop; beta = (gain^2)/4 by default.
- * \param taps (vector<int>) The filter taps.
- * \param filter_size (uint) The number of filters in the filterbank (default = 32).
- * \param init_phase (float) The initial phase to look at, or which filter to start
- * with (default = 0).
- * \param max_rate_deviation (float) Distance from 0 d_rate can get (default = 1.5).
- * \param osps (int) The number of output samples per symbol (default=1).
- *
- */
- friend DIGITAL_API digital_pfb_clock_sync_fff_sptr
- digital_make_pfb_clock_sync_fff(double sps, float gain,
- const std::vector<float> &taps,
- unsigned int filter_size,
- float init_phase,
- float max_rate_deviation,
- int osps);
-
- bool d_updated;
- double d_sps;
- double d_sample_num;
- float d_loop_bw;
- float d_damping;
- float d_alpha;
- float d_beta;
-
- int d_nfilters;
- int d_taps_per_filter;
- std::vector<gr_fir_fff*> d_filters;
- std::vector<gr_fir_fff*> d_diff_filters;
- std::vector< std::vector<float> > d_taps;
- std::vector< std::vector<float> > d_dtaps;
-
- float d_k;
- float d_rate;
- float d_rate_i;
- float d_rate_f;
- float d_max_dev;
- int d_filtnum;
- int d_osps;
- float d_error;
- int d_out_idx;
-
- /*!
- * Build the polyphase filterbank timing synchronizer.
- */
- digital_pfb_clock_sync_fff(double sps, float gain,
- const std::vector<float> &taps,
- unsigned int filter_size,
- float init_phase,
- float max_rate_deviation,
- int osps);
-
- void create_diff_taps(const std::vector<float> &newtaps,
- std::vector<float> &difftaps);
-
-public:
- ~digital_pfb_clock_sync_fff ();
-
- /*! \brief update the system gains from omega and eta
- *
- * This function updates the system gains based on the loop
- * bandwidth and damping factor of the system.
- * These two factors can be set separately through their own
- * set functions.
- */
- void update_gains();
-
- /*!
- * Resets the filterbank's filter taps with the new prototype filter
- */
- void set_taps(const std::vector<float> &taps,
- std::vector< std::vector<float> > &ourtaps,
- std::vector<gr_fir_fff*> &ourfilter);
-
- /*!
- * Returns all of the taps of the matched filter
- */
- std::vector< std::vector<float> > get_taps();
-
- /*!
- * Returns all of the taps of the derivative filter
- */
- std::vector< std::vector<float> > get_diff_taps();
-
- /*!
- * Returns the taps of the matched filter for a particular channel
- */
- std::vector<float> get_channel_taps(int channel);
-
- /*!
- * Returns the taps in the derivative filter for a particular channel
- */
- std::vector<float> get_diff_channel_taps(int channel);
-
- /*!
- * Return the taps as a formatted string for printing
- */
- std::string get_taps_as_string();
-
- /*!
- * Return the derivative filter taps as a formatted string for printing
- */
- std::string get_diff_taps_as_string();
-
-
- /*******************************************************************
- SET FUNCTIONS
- *******************************************************************/
-
-
- /*!
- * \brief Set the loop bandwidth
- *
- * Set the loop filter's bandwidth to \p bw. This should be between
- * 2*pi/200 and 2*pi/100 (in rads/samp). It must also be a positive
- * number.
- *
- * When a new damping factor is set, the gains, alpha and beta, of the loop
- * are recalculated by a call to update_gains().
- *
- * \param bw (float) new bandwidth
- *
- */
- void set_loop_bandwidth(float bw);
-
- /*!
- * \brief Set the loop damping factor
- *
- * Set the loop filter's damping factor to \p df. The damping factor
- * should be sqrt(2)/2.0 for critically damped systems.
- * Set it to anything else only if you know what you are doing. It must
- * be a number between 0 and 1.
- *
- * When a new damping factor is set, the gains, alpha and beta, of the loop
- * are recalculated by a call to update_gains().
- *
- * \param df (float) new damping factor
- *
- */
- void set_damping_factor(float df);
-
- /*!
- * \brief Set the loop gain alpha
- *
- * Set's the loop filter's alpha gain parameter.
- *
- * This value should really only be set by adjusting the loop bandwidth
- * and damping factor.
- *
- * \param alpha (float) new alpha gain
- *
- */
- void set_alpha(float alpha);
-
- /*!
- * \brief Set the loop gain beta
- *
- * Set's the loop filter's beta gain parameter.
- *
- * This value should really only be set by adjusting the loop bandwidth
- * and damping factor.
- *
- * \param beta (float) new beta gain
- *
- */
- void set_beta(float beta);
-
- /*!
- * Set the maximum deviation from 0 d_rate can have
- */
- void set_max_rate_deviation(float m)
- {
- d_max_dev = m;
- }
-
- /*******************************************************************
- GET FUNCTIONS
- *******************************************************************/
-
- /*!
- * \brief Returns the loop bandwidth
- */
- float get_loop_bandwidth() const;
-
- /*!
- * \brief Returns the loop damping factor
- */
- float get_damping_factor() const;
-
- /*!
- * \brief Returns the loop gain alpha
- */
- float get_alpha() const;
-
- /*!
- * \brief Returns the loop gain beta
- */
- float get_beta() const;
-
- /*!
- * \brief Returns the current clock rate
- */
- float get_clock_rate() const;
-
- /*******************************************************************
- *******************************************************************/
-
- bool check_topology(int ninputs, int noutputs);
-
- int general_work(int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
-
-#endif
diff --git a/gr-digital/include/digital_pn_correlator_cc.h b/gr-digital/include/digital_pn_correlator_cc.h
deleted file mode 100644
index 87cc2ff93c..0000000000
--- a/gr-digital/include/digital_pn_correlator_cc.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2007,2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_GR_PN_CORRELATOR_CC_H
-#define INCLUDED_GR_PN_CORRELATOR_CC_H
-
-#include <digital_api.h>
-#include <gr_sync_decimator.h>
-#include <gri_glfsr.h>
-
-class digital_pn_correlator_cc;
-typedef boost::shared_ptr<digital_pn_correlator_cc> digital_pn_correlator_cc_sptr;
-
-DIGITAL_API digital_pn_correlator_cc_sptr
-digital_make_pn_correlator_cc(int degree, int mask=0, int seed=1);
-/*!
- * \brief PN code sequential search correlator
- *
- * \ingroup sync_blk
- *
- * Receives complex baseband signal, outputs complex correlation
- * against reference PN code, one sample per PN code period. The PN
- * sequence is generated using a GLFSR.
- *
- * \param degree Degree of shift register must be in [1, 32]. If mask
- * is 0, the degree determines a default mask (see
- * digital_impl_glfsr.cc for the mapping).
- * \param repeat Set to repeat sequence.
- * \param mask Allows a user-defined bit mask for indexes of the shift
- * register to feed back.
- * \param seed Initial setting for values in shift register.
- */
-class DIGITAL_API digital_pn_correlator_cc : public gr_sync_decimator
-{
- friend DIGITAL_API digital_pn_correlator_cc_sptr
- digital_make_pn_correlator_cc(int degree, int mask, int seed);
-
- int d_len;
- float d_pn;
- gri_glfsr *d_reference;
-
- protected:
- digital_pn_correlator_cc(int degree, int mask, int seed);
-
- public:
- virtual int work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-
- ~digital_pn_correlator_cc();
-};
-
-#endif /* INCLUDED_GR_PN_CORRELATOR_CC_H */
diff --git a/gr-digital/include/digital_probe_density_b.h b/gr-digital/include/digital_probe_density_b.h
deleted file mode 100644
index 271ad2a072..0000000000
--- a/gr-digital/include/digital_probe_density_b.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2008,2012 Free Software Foundation, Inc.
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-#ifndef INCLUDED_GR_PROBE_DENSITY_B_H
-#define INCLUDED_GR_PROBE_DENSITY_B_H
-
-#include <digital_api.h>
-#include <gr_sync_block.h>
-
-class digital_probe_density_b;
-
-typedef boost::shared_ptr<digital_probe_density_b> digital_probe_density_b_sptr;
-
-DIGITAL_API digital_probe_density_b_sptr
-digital_make_probe_density_b(double alpha);
-
-/*!
- * This block maintains a running average of the input stream and
- * makes it available as an accessor function. The input stream
- * is type unsigned char.
- *
- * If you send this block a stream of unpacked bytes, it will tell
- * you what the bit density is.
- *
- * \param alpha Average filter constant
- *
- */
-
-class DIGITAL_API digital_probe_density_b : public gr_sync_block
-{
-private:
- friend DIGITAL_API digital_probe_density_b_sptr
- digital_make_probe_density_b(double alpha);
-
- double d_alpha;
- double d_beta;
- double d_density;
-
- digital_probe_density_b(double alpha);
-
-public:
- ~digital_probe_density_b();
-
- /*!
- * \brief Returns the current density value
- */
- double density() const { return d_density; }
-
- /*!
- * \brief Set the average filter constant
- */
- void set_alpha(double alpha);
-
- int work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
-
-#endif /* INCLUDED_GR_PROBE_DENSITY_B_H */
diff --git a/gr-digital/include/digital_probe_mpsk_snr_est_c.h b/gr-digital/include/digital_probe_mpsk_snr_est_c.h
deleted file mode 100644
index a78e904124..0000000000
--- a/gr-digital/include/digital_probe_mpsk_snr_est_c.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-#ifndef INCLUDED_DIGITAL_PROBE_MPSK_SNR_EST_C_H
-#define INCLUDED_DIGITAL_PROBE_MPSK_SNR_EST_C_H
-
-#include <digital_api.h>
-#include <gr_sync_block.h>
-#include <digital_impl_mpsk_snr_est.h>
-
-class digital_probe_mpsk_snr_est_c;
-typedef boost::shared_ptr<digital_probe_mpsk_snr_est_c> digital_probe_mpsk_snr_est_c_sptr;
-
-DIGITAL_API digital_probe_mpsk_snr_est_c_sptr
-digital_make_probe_mpsk_snr_est_c(snr_est_type_t type,
- int msg_nsamples=10000,
- double alpha=0.001);
-
-//! \brief A probe for computing SNR of a signal.
-/*! \ingroup snr_blk
- *
- * This is a probe block (a sink) that can be used to monitor and
- * retrieve estimations of the signal SNR. This probe is designed for
- * use with M-PSK signals especially. The type of estimator is
- * specified as the \p type parameter in the constructor. The
- * estimators tend to trade off performance for accuracy, although
- * experimentation should be done to figure out the right approach
- * for a given implementation. Further, the current set of estimators
- * are designed and proven theoretically under AWGN conditions; some
- * amount of error should be assumed and/or estimated for real
- * channel conditions.
- */
-class DIGITAL_API digital_probe_mpsk_snr_est_c : public gr_sync_block
-{
- private:
- snr_est_type_t d_type;
- int d_nsamples, d_count;
- double d_alpha;
- digital_impl_mpsk_snr_est *d_snr_est;
-
- //d_key is the message name, 'snr'
- pmt::pmt_t d_key;
-
- /*! Factory function returning shared pointer of this class
- *
- * Parameters:
- *
- * \param type: the type of estimator to use \ref ref_snr_est_types
- * "snr_est_type_t" for details about the available types.
- * \param msg_nsamples: [not implemented yet] after this many
- * samples, a message containing the SNR (key='snr') will be sent
- * \param alpha: the update rate of internal running average
- * calculations.
- */
- friend DIGITAL_API digital_probe_mpsk_snr_est_c_sptr
- digital_make_probe_mpsk_snr_est_c(snr_est_type_t type,
- int msg_nsamples,
- double alpha);
-
- //! Private constructor
- digital_probe_mpsk_snr_est_c(snr_est_type_t type,
- int msg_nsamples,
- double alpha);
-
-public:
-
- ~digital_probe_mpsk_snr_est_c();
-
- int work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-
- //! Return the estimated signal-to-noise ratio in decibels
- double snr();
-
- //! Return the type of estimator in use
- snr_est_type_t type() const;
-
- //! Return how many samples between SNR messages
- int msg_nsample() const;
-
- //! Get the running-average coefficient
- double alpha() const;
-
- //! Set type of estimator to use
- void set_type(snr_est_type_t t);
-
- //! Set the number of samples between SNR messages
- void set_msg_nsample(int n);
-
- //! Set the running-average coefficient
- void set_alpha(double alpha);
-};
-
-#endif /* INCLUDED_DIGITAL_PROBE_MPSK_SNR_EST_C_H */
diff --git a/gr-digital/include/digital_scrambler_bb.h b/gr-digital/include/digital_scrambler_bb.h
deleted file mode 100644
index cafb0e5f2c..0000000000
--- a/gr-digital/include/digital_scrambler_bb.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2008,2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-#ifndef INCLUDED_GR_SCRAMBLER_BB_H
-#define INCLUDED_GR_SCRAMBLER_BB_H
-
-#include <digital_api.h>
-#include <gr_sync_block.h>
-#include <analog/lfsr.h>
-
-class digital_scrambler_bb;
-typedef boost::shared_ptr<digital_scrambler_bb> digital_scrambler_bb_sptr;
-
-DIGITAL_API digital_scrambler_bb_sptr
-digital_make_scrambler_bb(int mask, int seed, int len);
-
-/*!
- * Scramble an input stream using an LFSR. This block works on the LSB only
- * of the input data stream, i.e., on an "unpacked binary" stream, and
- * produces the same format on its output.
- *
- * \param mask Polynomial mask for LFSR
- * \param seed Initial shift register contents
- * \param len Shift register length
- *
- * \ingroup coding_blk
- */
-
-class DIGITAL_API digital_scrambler_bb : public gr_sync_block
-{
- friend DIGITAL_API digital_scrambler_bb_sptr
- digital_make_scrambler_bb(int mask, int seed, int len);
-
- gr::analog::lfsr d_lfsr;
-
- digital_scrambler_bb(int mask, int seed, int len);
-
-public:
- int work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
-
-#endif /* INCLUDED_GR_SCRAMBLER_BB_H */
diff --git a/gr-digital/include/digital_simple_correlator.h b/gr-digital/include/digital_simple_correlator.h
deleted file mode 100644
index 716c6995ca..0000000000
--- a/gr-digital/include/digital_simple_correlator.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2013 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_GR_SIMPLE_CORRELATOR_H
-#define INCLUDED_GR_SIMPLE_CORRELATOR_H
-
-#include <digital_api.h>
-#include <gr_block.h>
-
-class digital_simple_correlator;
-typedef boost::shared_ptr<digital_simple_correlator> digital_simple_correlator_sptr;
-
-DIGITAL_API digital_simple_correlator_sptr digital_make_simple_correlator(int payload_bytesize);
-
-/*!
- * \brief inverse of simple_framer (more or less)
- * \ingroup sync_blk
- */
-class DIGITAL_API digital_simple_correlator : public gr_block
-{
- private:
- static const int OVERSAMPLE = 8;
- enum state_t { ST_LOOKING, ST_UNDER_THRESHOLD, ST_LOCKED };
-
- int d_payload_bytesize;
- state_t d_state;
- unsigned int d_osi; // over sample index [0,OVERSAMPLE-1]
- unsigned int d_transition_osi; // first index where Hamming dist < thresh
- unsigned int d_center_osi; // center of bit
- unsigned long long int d_shift_reg[OVERSAMPLE];
- int d_bblen; // length of bitbuf
- unsigned char *d_bitbuf; // demodulated bits
- unsigned char *d_pktbuf; // temp packet buf
- int d_bbi; // bitbuf index
-
- static const int AVG_PERIOD = 512; // must be power of 2 (for freq offset correction)
- int d_avbi;
- float d_avgbuf[AVG_PERIOD];
- float d_avg;
- float d_accum;
-
-#ifdef DEBUG_SIMPLE_CORRELATOR
- FILE *d_debug_fp; // binary log file
-#endif
-
- friend GR_CORE_API digital_simple_correlator_sptr
- digital_make_simple_correlator(int payload_bytesize);
- digital_simple_correlator(int payload_bytesize);
-
- inline int slice(float x)
- {
- return x >= d_avg ? 1 : 0;
- }
-
- void update_avg(float x);
-
- void enter_locked();
- void enter_under_threshold();
- void enter_looking();
-
- static int add_index(int a, int b)
- {
- int t = a + b;
- if(t >= OVERSAMPLE)
- t -= OVERSAMPLE;
- assert(t >= 0 && t < OVERSAMPLE);
- return t;
- }
-
- static int sub_index(int a, int b)
- {
- int t = a - b;
- if(t < 0)
- t += OVERSAMPLE;
- assert(t >= 0 && t < OVERSAMPLE);
- return t;
- }
-
- public:
- ~digital_simple_correlator();
-
- int general_work(int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
-
-#endif /* INCLUDED_GR_SIMPLE_CORRELATOR_H */
diff --git a/gr-digital/include/digital_simple_framer.h b/gr-digital/include/digital_simple_framer.h
deleted file mode 100644
index b622ae5dd4..0000000000
--- a/gr-digital/include/digital_simple_framer.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_GR_SIMPLE_FRAMER_H
-#define INCLUDED_GR_SIMPLE_FRAMER_H
-
-#include <digital_api.h>
-#include <gr_block.h>
-
-class digital_simple_framer;
-typedef boost::shared_ptr<digital_simple_framer> digital_simple_framer_sptr;
-
-DIGITAL_API digital_simple_framer_sptr digital_make_simple_framer(int payload_bytesize);
-
-/*!
- * \brief add sync field, seq number and command field to payload
- * \ingroup sync_blk
- *
- * Takes in enough samples to create a full output frame. The frame is
- * prepended with the GRSF_SYNC (defind in
- * digital_simple_framer_sync.h) and an 8-bit sequence number.
- *
- * \param payload_bytesize The size of the payload in bytes.
- */
-class DIGITAL_API digital_simple_framer : public gr_block
-{
- int d_seqno;
- int d_payload_bytesize;
- int d_input_block_size; // bytes
- int d_output_block_size; // bytes
-
- friend DIGITAL_API digital_simple_framer_sptr
- digital_make_simple_framer(int payload_bytesize);
- digital_simple_framer(int payload_bytesize);
-
- public:
- void forecast(int noutput_items,
- gr_vector_int &ninput_items_required);
-
- int general_work(int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
-
-
-#endif /* INCLUDED_GR_SIMPLE_FRAMER_H */
diff --git a/gr-digital/include/digital_simple_framer_sync.h b/gr-digital/include/digital_simple_framer_sync.h
deleted file mode 100644
index 4120035827..0000000000
--- a/gr-digital/include/digital_simple_framer_sync.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2005,2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_GR_SIMPLE_FRAMER_SYNC_H
-#define INCLUDED_GR_SIMPLE_FRAMER_SYNC_H
-
-/*!
- * \brief Here are a couple of maximum length sequences (m-sequences)
- * that were generated by the the "mseq" matlab/octave code downloaded
- * from: <a href="http://www.mathworks.com/matlabcentral/fileexchange/990">http://www.mathworks.com/matlabcentral/fileexchange/990</a>
- *
- * <pre>
- * 31-bit m-sequence:
- * 0110100100001010111011000111110
- * 0x690AEC76 (padded on right with a zero)
- *
- * 63-bit m-sequence:
- * 101011001101110110100100111000101111001010001100001000001111110
- * 0xACDDA4E2F28C20FC (padded on right with a zero)
- * </pre>
- */
-
-static const unsigned long long GRSF_SYNC = 0xacdda4e2f28c20fcULL;
-
-static const int GRSF_BITS_PER_BYTE = 8;
-static const int GRSF_SYNC_OVERHEAD = sizeof(GRSF_SYNC);
-static const int GRSF_PAYLOAD_OVERHEAD = 1; // 1 byte seqno
-static const int GRSF_TAIL_PAD = 1; // one byte trailing padding
-static const int GRSF_OVERHEAD = GRSF_SYNC_OVERHEAD + GRSF_PAYLOAD_OVERHEAD + GRSF_TAIL_PAD;
-
-
-#endif /* INCLUDED_GR_SIMPLE_FRAMER_SYNC_H */
diff --git a/gr-digital/lib/CMakeLists.txt b/gr-digital/lib/CMakeLists.txt
index 42340b6c2a..20a773a566 100644
--- a/gr-digital/lib/CMakeLists.txt
+++ b/gr-digital/lib/CMakeLists.txt
@@ -21,12 +21,14 @@
# Setup the include and linker paths
########################################################################
include_directories(
- ${CMAKE_CURRENT_BINARY_DIR}/../include
${GR_DIGITAL_INCLUDE_DIRS}
+ ${GR_BLOCKS_INCLUDE_DIRS}
${GR_ANALOG_INCLUDE_DIRS}
+ ${GR_FFT_INCLUDE_DIRS}
${GR_FILTER_INCLUDE_DIRS}
${GR_BLOCKS_INCLUDE_DIRS}
${GNURADIO_CORE_INCLUDE_DIRS}
+ ${VOLK_INCLUDE_DIRS}
${GRUEL_INCLUDE_DIRS}
${LOG4CPP_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
@@ -35,6 +37,11 @@ include_directories(
link_directories(${Boost_LIBRARY_DIRS})
link_directories(${LOG4CPP_LIBRARY_DIRS})
+if(ENABLE_GR_CTRLPORT)
+ ADD_DEFINITIONS(-DGR_CTRLPORT)
+ include_directories(${ICE_INCLUDE_DIR})
+endif(ENABLE_GR_CTRLPORT)
+
########################################################################
# generate helper scripts to expand templated files
########################################################################
@@ -53,9 +60,8 @@ if __name__ == '__main__':
root, inp = sys.argv[1:3]
for sig in sys.argv[3:]:
name = re.sub ('X+', sig, root)
- d = build_utils.standard_dict(name, sig, 'digital')
+ d = build_utils.standard_impl_dict2(name, sig, 'digital')
build_utils.expand_template(d, inp)
-
")
macro(expand_cc root)
@@ -65,10 +71,10 @@ macro(expand_cc root)
foreach(sig ${ARGN})
string(REGEX REPLACE "X+" ${sig} name ${root})
list(APPEND expanded_files_cc ${CMAKE_CURRENT_BINARY_DIR}/${name}.cc)
- list(APPEND expanded_files_h ${CMAKE_CURRENT_BINARY_DIR}/../include/${name}.h)
+ list(APPEND expanded_files_h ${CMAKE_CURRENT_BINARY_DIR}/${name}.h)
endforeach(sig)
- #create a command to generate the files
+ #create a command to generate the source files
add_custom_command(
OUTPUT ${expanded_files_cc}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.cc.t
@@ -76,6 +82,15 @@ macro(expand_cc root)
${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
${root} ${root}.cc.t ${ARGN}
)
+
+ #create a command to generate the header file
+ add_custom_command(
+ OUTPUT ${expanded_files_h}
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.h.t
+ COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B}
+ ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
+ ${root} ${root}.h.t ${ARGN}
+ )
#make source files depends on headers to force generation
set_source_files_properties(${expanded_files_cc}
@@ -84,78 +99,79 @@ macro(expand_cc root)
#install rules for the generated cc files
list(APPEND generated_sources ${expanded_files_cc})
+ list(APPEND generated_headers ${expanded_files_h})
endmacro(expand_cc)
+
########################################################################
# Invoke macro to generate various sources
########################################################################
-expand_cc(digital_chunks_to_symbols_XX bf bc sf sc if ic)
+expand_cc(chunks_to_symbols_XX_impl bf bc sf sc if ic)
########################################################################
# Setup library
########################################################################
-
-list(APPEND gr_digital_sources
+list(APPEND digital_sources
${generated_sources}
- digital_impl_glfsr.cc
- digital_impl_mpsk_snr_est.cc
- digital_additive_scrambler_bb.cc
- digital_binary_slicer_fb.cc
- digital_bytes_to_syms.cc
- digital_clock_recovery_mm_cc.cc
- digital_clock_recovery_mm_ff.cc
- digital_cma_equalizer_cc.cc
- digital_constellation.cc
- digital_constellation_receiver_cb.cc
- digital_constellation_decoder_cb.cc
- digital_correlate_access_code_bb.cc
- digital_correlate_access_code_tag_bb.cc
- digital_costas_loop_cc.cc
- digital_cpmmod_bc.cc
- digital_crc32.cc
- digital_descrambler_bb.cc
- digital_diff_decoder_bb.cc
- digital_diff_encoder_bb.cc
- digital_diff_phasor_cc.cc
- digital_fll_band_edge_cc.cc
- digital_framer_sink_1.cc
- digital_glfsr_source_b.cc
- digital_glfsr_source_f.cc
- digital_gmskmod_bc.cc
- digital_lms_dd_equalizer_cc.cc
- digital_kurtotic_equalizer_cc.cc
- digital_map_bb.cc
- digital_mpsk_receiver_cc.cc
- digital_mpsk_snr_est_cc.cc
- digital_ofdm_cyclic_prefixer.cc
- digital_ofdm_frame_acquisition.cc
- digital_ofdm_frame_sink.cc
- digital_ofdm_insert_preamble.cc
- digital_ofdm_mapper_bcv.cc
- digital_ofdm_sampler.cc
- digital_packet_sink.cc
- digital_pfb_clock_sync_ccf.cc
- digital_pfb_clock_sync_fff.cc
- digital_pn_correlator_cc.cc
- digital_probe_density_b.cc
- digital_probe_mpsk_snr_est_c.cc
- digital_scrambler_bb.cc
- digital_simple_framer.cc
- digital_ofdm_sync_sc_cfb.cc
- digital_ofdm_chanest_vcvc.cc
+ additive_scrambler_bb_impl.cc
+ binary_slicer_fb_impl.cc
+ clock_recovery_mm_cc_impl.cc
+ clock_recovery_mm_ff_impl.cc
+ cma_equalizer_cc_impl.cc
+ constellation.cc
+ constellation_decoder_cb_impl.cc
+ constellation_receiver_cb_impl.cc
+ correlate_access_code_bb_impl.cc
+ correlate_access_code_tag_bb_impl.cc
+ costas_loop_cc_impl.cc
+ cpmmod_bc_impl.cc
+ crc32.cc
+ descrambler_bb_impl.cc
+ diff_decoder_bb_impl.cc
+ diff_encoder_bb_impl.cc
+ diff_phasor_cc_impl.cc
digital_crc32_bb.cc
digital_ofdm_carrier_allocator_cvc.cc
+ digital_ofdm_chanest_vcvc.cc
+ digital_ofdm_cyclic_prefixer.cc
digital_ofdm_equalizer_base.cc
- digital_ofdm_equalizer_static.cc
digital_ofdm_equalizer_simpledfe.cc
+ digital_ofdm_equalizer_static.cc
+ digital_ofdm_sync_sc_cfb.cc
+ fll_band_edge_cc_impl.cc
+ framer_sink_1_impl.cc
+ glfsr.cc
+ glfsr_source_b_impl.cc
+ glfsr_source_f_impl.cc
+ header_payload_demux_impl.cc
+ kurtotic_equalizer_cc_impl.cc
+ lms_dd_equalizer_cc_impl.cc
+ map_bb_impl.cc
+ mpsk_receiver_cc_impl.cc
+ mpsk_snr_est.cc
+ mpsk_snr_est_cc_impl.cc
+ ofdm_cyclic_prefixer_impl.cc
+ ofdm_frame_acquisition_impl.cc
ofdm_frame_equalizer_vcvc_impl.cc
+ ofdm_frame_sink_impl.cc
+ ofdm_insert_preamble_impl.cc
+ ofdm_mapper_bcv_impl.cc
+ ofdm_sampler_impl.cc
ofdm_serializer_vcc_impl.cc
packet_header_default.cc
packet_header_ofdm.cc
packet_headergenerator_bb_impl.cc
packet_headerparser_b_impl.cc
+ packet_sink_impl.cc
+ pfb_clock_sync_ccf_impl.cc
+ pfb_clock_sync_fff_impl.cc
+ pn_correlator_cc_impl.cc
+ probe_density_b_impl.cc
+ probe_mpsk_snr_est_c_impl.cc
+ scrambler_bb_impl.cc
+ simple_correlator_impl.cc
+ simple_framer_impl.cc
header_payload_demux_impl.cc
- digital_simple_correlator.cc
)
#Add Windows DLL resource file if using MSVC
@@ -173,22 +189,26 @@ IF(MSVC)
ENDIF(MSVC)
list(APPEND digital_libs
+ volk
gnuradio-core
+ gnuradio-filter
gnuradio-blocks
gnuradio-analog
- gnuradio-filter
${Boost_LIBRARIES}
${LOG4CPP_LIBRARIES}
)
-add_library(gnuradio-digital SHARED ${gr_digital_sources})
+
+add_library(gnuradio-digital SHARED ${digital_sources})
target_link_libraries(gnuradio-digital ${digital_libs})
GR_LIBRARY_FOO(gnuradio-digital RUNTIME_COMPONENT "digital_runtime" DEVEL_COMPONENT "digital_devel")
-add_dependencies(gnuradio-digital
- digital_generated_includes
- digital_generated_swigs
- gnuradio-analog
- gnuradio-blocks
- gnuradio-filter
-)
+add_dependencies(
+ gnuradio-digital
+ digital_generated_includes
+ digital_generated_swigs
+ gnuradio-core
+ gnuradio-filter
+ gnuradio-analog
+ gnuradio-blocks
+)
diff --git a/gr-digital/lib/additive_scrambler_bb_impl.cc b/gr-digital/lib/additive_scrambler_bb_impl.cc
new file mode 100644
index 0000000000..8238f2d988
--- /dev/null
+++ b/gr-digital/lib/additive_scrambler_bb_impl.cc
@@ -0,0 +1,104 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2010,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "additive_scrambler_bb_impl.h"
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace digital {
+
+ additive_scrambler_bb::sptr
+ additive_scrambler_bb::make(int mask, int seed, int len, int count)
+ {
+ return gnuradio::get_initial_sptr(new additive_scrambler_bb_impl
+ (mask, seed, len, count));
+ }
+
+ additive_scrambler_bb_impl::additive_scrambler_bb_impl(int mask,
+ int seed,
+ int len,
+ int count)
+ : gr_sync_block("additive_scrambler_bb",
+ gr_make_io_signature(1, 1, sizeof(unsigned char)),
+ gr_make_io_signature(1, 1, sizeof(unsigned char))),
+ d_lfsr(mask, seed, len),
+ d_count(count),
+ d_bits(0), d_len(len), d_seed(seed)
+ {
+ }
+
+ additive_scrambler_bb_impl::~additive_scrambler_bb_impl()
+ {
+ }
+
+ int
+ additive_scrambler_bb_impl::mask() const
+ {
+ return d_lfsr.mask();
+ }
+
+ int
+ additive_scrambler_bb_impl::seed() const
+ {
+ return d_seed;
+ }
+
+ int
+ additive_scrambler_bb_impl::len() const
+ {
+ return d_len;
+ }
+
+ int
+ additive_scrambler_bb_impl::count() const
+ {
+ return d_count;
+ }
+
+ int
+ additive_scrambler_bb_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const unsigned char *in = (const unsigned char *)input_items[0];
+ unsigned char *out = (unsigned char *)output_items[0];
+
+ for(int i = 0; i < noutput_items; i++) {
+ out[i] = in[i]^d_lfsr.next_bit();
+ if(d_count > 0) {
+ if(++d_bits == d_count) {
+ d_lfsr.reset();
+ d_bits = 0;
+ }
+ }
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace digital */
+} /* namespace gr */
+
diff --git a/gr-digital/lib/additive_scrambler_bb_impl.h b/gr-digital/lib/additive_scrambler_bb_impl.h
new file mode 100644
index 0000000000..5a4c2f5025
--- /dev/null
+++ b/gr-digital/lib/additive_scrambler_bb_impl.h
@@ -0,0 +1,60 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2010,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_DIGITAL_ADDITIVE_SCRAMBLER_BB_IMPL_H
+#define INCLUDED_DIGITAL_ADDITIVE_SCRAMBLER_BB_IMPL_H
+
+#include <digital/additive_scrambler_bb.h>
+#include <digital/lfsr.h>
+
+namespace gr {
+ namespace digital {
+
+ class additive_scrambler_bb_impl
+ : public additive_scrambler_bb
+ {
+ private:
+ digital::lfsr d_lfsr;
+ int d_count;
+ int d_bits;
+ int d_len;
+ int d_seed;
+
+ public:
+ additive_scrambler_bb_impl(int mask, int seed,
+ int len, int count=0);
+ ~additive_scrambler_bb_impl();
+
+ int mask() const;
+ int seed() const;
+ int len() const;
+ int count() const;
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_DIGITAL_ADDITIVE_SCRAMBLER_BB_IMPL_H */
diff --git a/gr-digital/lib/digital_binary_slicer_fb.cc b/gr-digital/lib/binary_slicer_fb_impl.cc
index fcdb4291fb..f8a9cf22de 100644
--- a/gr-digital/lib/digital_binary_slicer_fb.cc
+++ b/gr-digital/lib/binary_slicer_fb_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2006,2010,2011 Free Software Foundation, Inc.
+ * Copyright 2006,2010-2012 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -24,36 +24,43 @@
#include "config.h"
#endif
-#include <digital_binary_slicer_fb.h>
+#include "binary_slicer_fb_impl.h"
#include <gr_io_signature.h>
#include <gr_math.h>
-#include <stdexcept>
-
-digital_binary_slicer_fb_sptr
-digital_make_binary_slicer_fb ()
-{
- return gnuradio::get_initial_sptr(new digital_binary_slicer_fb ());
-}
-
-digital_binary_slicer_fb::digital_binary_slicer_fb ()
- : gr_sync_block ("binary_slicer_fb",
- gr_make_io_signature (1, 1, sizeof (float)),
- gr_make_io_signature (1, 1, sizeof (unsigned char)))
-{
-}
-
-int
-digital_binary_slicer_fb::work (int noutput_items,
+
+namespace gr {
+ namespace digital {
+
+ binary_slicer_fb::sptr binary_slicer_fb::make()
+ {
+ return gnuradio::get_initial_sptr(new binary_slicer_fb_impl());
+ }
+
+ binary_slicer_fb_impl::binary_slicer_fb_impl()
+ : gr_sync_block("binary_slicer_fb",
+ gr_make_io_signature(1, 1, sizeof(float)),
+ gr_make_io_signature(1, 1, sizeof(unsigned char)))
+ {
+ }
+
+ binary_slicer_fb_impl::~binary_slicer_fb_impl()
+ {
+ }
+
+ int
+ binary_slicer_fb_impl::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
-{
- const float *in = (const float *) input_items[0];
- unsigned char *out = (unsigned char *) output_items[0];
-
+ {
+ const float *in = (const float *)input_items[0];
+ unsigned char *out = (unsigned char *)output_items[0];
- for (int i = 0; i < noutput_items; i++){
- out[i] = gr_binary_slicer(in[i]);
- }
+ for(int i = 0; i < noutput_items; i++) {
+ out[i] = gr_binary_slicer(in[i]);
+ }
- return noutput_items;
-}
+ return noutput_items;
+ }
+
+ } /* namespace digital */
+} /* namespace gr */
diff --git a/gr-digital/swig/digital_kurtotic_equalizer_cc.i b/gr-digital/lib/binary_slicer_fb_impl.h
index 67a9dc6fdc..7416d9cd52 100644
--- a/gr-digital/swig/digital_kurtotic_equalizer_cc.i
+++ b/gr-digital/lib/binary_slicer_fb_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2011 Free Software Foundation, Inc.
+ * Copyright 2006,2011,2012 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,21 +20,26 @@
* Boston, MA 02110-1301, USA.
*/
-GR_SWIG_BLOCK_MAGIC(digital,kurtotic_equalizer_cc)
+#ifndef INCLUDED_DIGITAL_BINARY_SLICER_FB_IMPL_H
+#define INCLUDED_DIGITAL_BINARY_SLICER_FB_IMPL_H
-// retrieve info on the base class, without generating wrappers since
-// the base class has a pure virual method.
-%import "gr_adaptive_fir_ccc.i"
+#include <digital/binary_slicer_fb.h>
-digital_kurtotic_equalizer_cc_sptr
-digital_make_kurtotic_equalizer_cc(int num_taps,
- float mu);
+namespace gr {
+ namespace digital {
-class digital_kurtotic_equalizer_cc : public gr_adaptive_fir_ccc
-{
-private:
- digital_kurtotic_equalizer_cc(int num_taps, float mu);
+ class binary_slicer_fb_impl : public binary_slicer_fb
+ {
+ public:
+ binary_slicer_fb_impl();
+ ~binary_slicer_fb_impl();
-public:
- void set_gain(float mu);
-};
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_DIGITAL_BINARY_SLICER_FB_IMPL_H */
diff --git a/gr-digital/lib/chunks_to_symbols_XX_impl.cc.t b/gr-digital/lib/chunks_to_symbols_XX_impl.cc.t
new file mode 100644
index 0000000000..39eca32db6
--- /dev/null
+++ b/gr-digital/lib/chunks_to_symbols_XX_impl.cc.t
@@ -0,0 +1,80 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2010,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+/* @WARNING@ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "@NAME@.h"
+#include <gr_io_signature.h>
+#include <assert.h>
+
+namespace gr {
+ namespace digital {
+
+ @BASE_NAME@::sptr
+ @BASE_NAME@::make(const std::vector<@O_TYPE@> &symbol_table, const int D)
+ {
+ return gnuradio::get_initial_sptr
+ (new @IMPL_NAME@(symbol_table, D));
+ }
+
+ @IMPL_NAME@::@IMPL_NAME@(const std::vector<@O_TYPE@> &symbol_table, const int D)
+ : gr_sync_interpolator("@BASE_NAME@",
+ gr_make_io_signature(1, -1, sizeof(@I_TYPE@)),
+ gr_make_io_signature(1, -1, sizeof(@O_TYPE@)),
+ D),
+ d_D(D), d_symbol_table(symbol_table)
+ {
+ }
+
+ @IMPL_NAME@::~@IMPL_NAME@()
+ {
+ }
+
+ int
+ @IMPL_NAME@::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ assert(noutput_items % d_D == 0);
+ assert(input_items.size() == output_items.size());
+ int nstreams = input_items.size();
+
+ for(int m = 0; m < nstreams; m++) {
+ const @I_TYPE@ *in = (@I_TYPE@*)input_items[m];
+ @O_TYPE@ *out = (@O_TYPE@*)output_items[m];
+
+ // per stream processing
+ for(int i = 0; i < noutput_items / d_D; i++) {
+ assert(((unsigned int)in[i]*d_D+d_D) <= d_symbol_table.size());
+ memcpy(out, &d_symbol_table[(unsigned int)in[i]*d_D], d_D*sizeof(@O_TYPE@));
+ out+=d_D;
+ }
+ }
+ return noutput_items;
+ }
+
+ } /* namespace digital */
+} /* namespace gr */
diff --git a/gr-digital/swig/digital_chunks_to_symbols_XX.i.t b/gr-digital/lib/chunks_to_symbols_XX_impl.h.t
index a80ba2af11..ea44c71ad4 100644
--- a/gr-digital/swig/digital_chunks_to_symbols_XX.i.t
+++ b/gr-digital/lib/chunks_to_symbols_XX_impl.h.t
@@ -20,19 +20,38 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
+/* @WARNING@ */
-GR_SWIG_BLOCK_MAGIC(digital,@BASE_NAME@);
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
-@SPTR_NAME@ digital_make_@BASE_NAME@
-(const std::vector<@O_TYPE@> &symbol_table, const int D = 1);
+#include <digital/@BASE_NAME@.h>
-class @NAME@ : public gr_sync_interpolator
-{
-private:
- @NAME@ (const std::vector<@O_TYPE@> &symbol_table, const int D = 1);
+namespace gr {
+ namespace digital {
-public:
- int D () const { return d_D; }
- std::vector<@O_TYPE@> symbol_table () const { return d_symbol_table; }
-};
+ class @IMPL_NAME@ : public @BASE_NAME@
+ {
+ private:
+ int d_D;
+ std::vector<@O_TYPE@> d_symbol_table;
+
+ public:
+ @IMPL_NAME@(const std::vector<@O_TYPE@> &symbol_table, const int D = 1);
+
+ ~@IMPL_NAME@();
+
+ int D() const { return d_D; }
+ std::vector<@O_TYPE@> symbol_table() const { return d_symbol_table; }
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ bool check_topology(int ninputs, int noutputs) { return ninputs == noutputs; }
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-digital/lib/clock_recovery_mm_cc_impl.cc b/gr-digital/lib/clock_recovery_mm_cc_impl.cc
new file mode 100644
index 0000000000..168d9f7772
--- /dev/null
+++ b/gr-digital/lib/clock_recovery_mm_cc_impl.cc
@@ -0,0 +1,214 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,2006,2010-2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "clock_recovery_mm_cc_impl.h"
+#include <gr_io_signature.h>
+#include <gr_prefs.h>
+#include <gr_math.h>
+#include <stdexcept>
+#include <iostream>
+
+namespace gr {
+ namespace digital {
+
+ static const int FUDGE = 16;
+
+ clock_recovery_mm_cc::sptr
+ clock_recovery_mm_cc::make(float omega, float gain_omega,
+ float mu, float gain_mu,
+ float omega_relative_limit)
+ {
+ return gnuradio::get_initial_sptr
+ (new clock_recovery_mm_cc_impl(omega, gain_omega,
+ mu, gain_mu,
+ omega_relative_limit));
+ }
+
+ clock_recovery_mm_cc_impl::clock_recovery_mm_cc_impl(float omega, float gain_omega,
+ float mu, float gain_mu,
+ float omega_relative_limit)
+ : gr_block("clock_recovery_mm_cc",
+ gr_make_io_signature(1, 1, sizeof(gr_complex)),
+ gr_make_io_signature2(1, 2, sizeof(gr_complex), sizeof(float))),
+ d_mu(mu), d_omega(omega), d_gain_omega(gain_omega),
+ d_omega_relative_limit(omega_relative_limit),
+ d_gain_mu(gain_mu), d_last_sample(0), d_interp(new filter::mmse_fir_interpolator_cc()),
+ d_verbose(gr_prefs::singleton()->get_bool("clock_recovery_mm_cc", "verbose", false)),
+ d_p_2T(0), d_p_1T(0), d_p_0T(0), d_c_2T(0), d_c_1T(0), d_c_0T(0)
+ {
+ if(omega <= 0.0)
+ throw std::out_of_range("clock rate must be > 0");
+ if(gain_mu < 0 || gain_omega < 0)
+ throw std::out_of_range("Gains must be non-negative");
+
+ set_omega(omega); // also sets min and max omega
+ set_relative_rate(1.0 / omega);
+ set_history(3); // ensure 2 extra input samples are available
+ }
+
+ clock_recovery_mm_cc_impl::~clock_recovery_mm_cc_impl()
+ {
+ delete d_interp;
+ }
+
+ void
+ clock_recovery_mm_cc_impl::forecast(int noutput_items,
+ gr_vector_int &ninput_items_required)
+ {
+ unsigned ninputs = ninput_items_required.size();
+ for(unsigned i=0; i < ninputs; i++)
+ ninput_items_required[i] =
+ (int)ceil((noutput_items * d_omega) + d_interp->ntaps()) + FUDGE;
+ }
+
+ gr_complex
+ clock_recovery_mm_cc_impl::slicer_0deg(gr_complex sample)
+ {
+ float real=0, imag=0;
+
+ if(sample.real() > 0)
+ real = 1;
+ if(sample.imag() > 0)
+ imag = 1;
+ return gr_complex(real,imag);
+ }
+
+ gr_complex
+ clock_recovery_mm_cc_impl::slicer_45deg(gr_complex sample)
+ {
+ float real= -1, imag = -1;
+ if(sample.real() > 0)
+ real=1;
+ if(sample.imag() > 0)
+ imag = 1;
+ return gr_complex(real,imag);
+ }
+
+ int
+ clock_recovery_mm_cc_impl::general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const gr_complex *in = (const gr_complex *)input_items[0];
+ gr_complex *out = (gr_complex *)output_items[0];
+ float *foptr = (float *)output_items[1];
+
+ bool write_foptr = output_items.size() >= 2;
+
+ int ii = 0; // input index
+ int oo = 0; // output index
+ int ni = ninput_items[0] - d_interp->ntaps() - FUDGE; // don't use more input than this
+
+ assert(d_mu >= 0.0);
+ assert(d_mu <= 1.0);
+
+ float mm_val = 0;
+ gr_complex u, x, y;
+
+ // This loop writes the error to the second output, if it exists
+ if(write_foptr) {
+ while(oo < noutput_items && ii < ni) {
+ d_p_2T = d_p_1T;
+ d_p_1T = d_p_0T;
+ d_p_0T = d_interp->interpolate(&in[ii], d_mu);
+
+ d_c_2T = d_c_1T;
+ d_c_1T = d_c_0T;
+ d_c_0T = slicer_0deg(d_p_0T);
+
+ x = (d_c_0T - d_c_2T) * conj(d_p_1T);
+ y = (d_p_0T - d_p_2T) * conj(d_c_1T);
+ u = y - x;
+ mm_val = u.real();
+ out[oo++] = d_p_0T;
+
+ // limit mm_val
+ mm_val = gr_branchless_clip(mm_val,4.0);
+ d_omega = d_omega + d_gain_omega * mm_val;
+ d_omega = d_omega_mid + gr_branchless_clip(d_omega-d_omega_mid, d_omega_relative_limit);
+
+ d_mu = d_mu + d_omega + d_gain_mu * mm_val;
+ ii += (int)floor(d_mu);
+ d_mu -= floor(d_mu);
+
+ // write the error signal to the second output
+ foptr[oo-1] = mm_val;
+
+ if(ii < 0) // clamp it. This should only happen with bogus input
+ ii = 0;
+ }
+ }
+ // This loop does not write to the second output (ugly, but faster)
+ else {
+ while(oo < noutput_items && ii < ni) {
+ d_p_2T = d_p_1T;
+ d_p_1T = d_p_0T;
+ d_p_0T = d_interp->interpolate(&in[ii], d_mu);
+
+ d_c_2T = d_c_1T;
+ d_c_1T = d_c_0T;
+ d_c_0T = slicer_0deg(d_p_0T);
+
+ x = (d_c_0T - d_c_2T) * conj(d_p_1T);
+ y = (d_p_0T - d_p_2T) * conj(d_c_1T);
+ u = y - x;
+ mm_val = u.real();
+ out[oo++] = d_p_0T;
+
+ // limit mm_val
+ mm_val = gr_branchless_clip(mm_val,1.0);
+
+ d_omega = d_omega + d_gain_omega * mm_val;
+ d_omega = d_omega_mid + gr_branchless_clip(d_omega-d_omega_mid, d_omega_relative_limit);
+
+ d_mu = d_mu + d_omega + d_gain_mu * mm_val;
+ ii += (int)floor(d_mu);
+ d_mu -= floor(d_mu);
+
+ if(d_verbose) {
+ std::cout << d_omega << "\t" << d_mu << std::endl;
+ }
+
+ if(ii < 0) // clamp it. This should only happen with bogus input
+ ii = 0;
+ }
+ }
+
+ if(ii > 0) {
+ if(ii > ninput_items[0]) {
+ std::cerr << "clock_recovery_mm_cc: ii > ninput_items[0] ("
+ << ii << " > " << ninput_items[0] << std::endl;
+ assert(0);
+ }
+ consume_each(ii);
+ }
+
+ return oo;
+ }
+
+ } /* namespace digital */
+} /* namespace gr */
diff --git a/gr-digital/lib/clock_recovery_mm_cc_impl.h b/gr-digital/lib/clock_recovery_mm_cc_impl.h
new file mode 100644
index 0000000000..fa62bd127f
--- /dev/null
+++ b/gr-digital/lib/clock_recovery_mm_cc_impl.h
@@ -0,0 +1,87 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2011,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_DIGITAL_CLOCK_RECOVERY_MM_CC_IMPL_H
+#define INCLUDED_DIGITAL_CLOCK_RECOVERY_MM_CC_IMPL_H
+
+#include <digital/clock_recovery_mm_cc.h>
+#include <filter/mmse_fir_interpolator_cc.h>
+
+namespace gr {
+ namespace digital {
+
+ class clock_recovery_mm_cc_impl : public clock_recovery_mm_cc
+ {
+ public:
+ clock_recovery_mm_cc_impl(float omega, float gain_omega,
+ float mu, float gain_mu,
+ float omega_relative_limi);
+ ~clock_recovery_mm_cc_impl();
+
+ void forecast(int noutput_items, gr_vector_int &ninput_items_required);
+ int general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ float mu() const { return d_mu;}
+ float omega() const { return d_omega;}
+ float gain_mu() const { return d_gain_mu;}
+ float gain_omega() const { return d_gain_omega;}
+
+ void set_verbose (bool verbose) { d_verbose = verbose; }
+ void set_gain_mu (float gain_mu) { d_gain_mu = gain_mu; }
+ void set_gain_omega (float gain_omega) { d_gain_omega = gain_omega; }
+ void set_mu (float mu) { d_mu = mu; }
+ void set_omega (float omega) {
+ d_omega = omega;
+ d_min_omega = omega*(1.0 - d_omega_relative_limit);
+ d_max_omega = omega*(1.0 + d_omega_relative_limit);
+ d_omega_mid = 0.5*(d_min_omega+d_max_omega);
+ }
+
+ private:
+ float d_mu; // fractional sample position [0.0, 1.0]
+ float d_omega; // nominal frequency
+ float d_gain_omega; // gain for adjusting omega
+ float d_min_omega; // minimum allowed omega
+ float d_max_omega; // maximum allowed omeg
+ float d_omega_relative_limit; // used to compute min and max omega
+ float d_omega_mid; // average omega
+ float d_gain_mu; // gain for adjusting mu
+
+ gr_complex d_last_sample;
+ filter::mmse_fir_interpolator_cc *d_interp;
+
+ bool d_verbose;
+
+ gr_complex d_p_2T, d_p_1T, d_p_0T;
+ gr_complex d_c_2T, d_c_1T, d_c_0T;
+
+ gr_complex slicer_0deg(gr_complex sample);
+ gr_complex slicer_45deg(gr_complex sample);
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_DIGITAL_CLOCK_RECOVERY_MM_CC_IMPL_H */
diff --git a/gr-digital/lib/clock_recovery_mm_ff_impl.cc b/gr-digital/lib/clock_recovery_mm_ff_impl.cc
new file mode 100644
index 0000000000..4ac3e40c5d
--- /dev/null
+++ b/gr-digital/lib/clock_recovery_mm_ff_impl.cc
@@ -0,0 +1,120 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2010-2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "clock_recovery_mm_ff_impl.h"
+#include <gr_io_signature.h>
+#include <gr_math.h>
+#include <stdexcept>
+
+namespace gr {
+ namespace digital {
+
+ clock_recovery_mm_ff::sptr
+ clock_recovery_mm_ff::make(float omega, float gain_omega,
+ float mu, float gain_mu,
+ float omega_relative_limit)
+ {
+ return gnuradio::get_initial_sptr
+ (new clock_recovery_mm_ff_impl(omega, gain_omega,
+ mu, gain_mu,
+ omega_relative_limit));
+ }
+
+ clock_recovery_mm_ff_impl::clock_recovery_mm_ff_impl(float omega, float gain_omega,
+ float mu, float gain_mu,
+ float omega_relative_limit)
+ : gr_block("clock_recovery_mm_ff",
+ gr_make_io_signature(1, 1, sizeof(float)),
+ gr_make_io_signature(1, 1, sizeof(float))),
+ d_mu(mu), d_gain_mu(gain_mu), d_gain_omega(gain_omega),
+ d_omega_relative_limit(omega_relative_limit),
+ d_last_sample(0), d_interp(new filter::mmse_fir_interpolator_ff())
+ {
+ if(omega < 1)
+ throw std::out_of_range("clock rate must be > 0");
+ if(gain_mu < 0 || gain_omega < 0)
+ throw std::out_of_range("Gains must be non-negative");
+
+ set_omega(omega); // also sets min and max omega
+ set_relative_rate (1.0 / omega);
+ }
+
+ clock_recovery_mm_ff_impl::~clock_recovery_mm_ff_impl()
+ {
+ delete d_interp;
+ }
+
+ void
+ clock_recovery_mm_ff_impl::forecast(int noutput_items,
+ gr_vector_int &ninput_items_required)
+ {
+ unsigned ninputs = ninput_items_required.size();
+ for(unsigned i=0; i < ninputs; i++)
+ ninput_items_required[i] =
+ (int) ceil((noutput_items * d_omega) + d_interp->ntaps());
+ }
+
+ static inline float
+ slice(float x)
+ {
+ return x < 0 ? -1.0F : 1.0F;
+ }
+
+ int
+ clock_recovery_mm_ff_impl::general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const float *in = (const float *)input_items[0];
+ float *out = (float *)output_items[0];
+
+ int ii = 0; // input index
+ int oo = 0; // output index
+ int ni = ninput_items[0] - d_interp->ntaps(); // don't use more input than this
+ float mm_val;
+
+ while(oo < noutput_items && ii < ni ) {
+ // produce output sample
+ out[oo] = d_interp->interpolate(&in[ii], d_mu);
+ mm_val = slice(d_last_sample) * out[oo] - slice(out[oo]) * d_last_sample;
+ d_last_sample = out[oo];
+
+ d_omega = d_omega + d_gain_omega * mm_val;
+ d_omega = d_omega_mid + gr_branchless_clip(d_omega-d_omega_mid, d_omega_relative_limit);
+ d_mu = d_mu + d_omega + d_gain_mu * mm_val;
+
+ ii += (int)floor(d_mu);
+ d_mu = d_mu - floor(d_mu);
+ oo++;
+ }
+
+ consume_each(ii);
+ return oo;
+ }
+
+ } /* namespace digital */
+} /* namespace gr */
diff --git a/gr-digital/lib/clock_recovery_mm_ff_impl.h b/gr-digital/lib/clock_recovery_mm_ff_impl.h
new file mode 100644
index 0000000000..920a05a496
--- /dev/null
+++ b/gr-digital/lib/clock_recovery_mm_ff_impl.h
@@ -0,0 +1,81 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2011,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_DIGITAL_CLOCK_RECOVERY_MM_FF_IMPL_H
+#define INCLUDED_DIGITAL_CLOCK_RECOVERY_MM_FF_IMPL_H
+
+#include <digital/clock_recovery_mm_ff.h>
+#include <filter/mmse_fir_interpolator_ff.h>
+
+namespace gr {
+ namespace digital {
+
+ class clock_recovery_mm_ff_impl : public clock_recovery_mm_ff
+ {
+ public:
+ clock_recovery_mm_ff_impl(float omega, float gain_omega,
+ float mu, float gain_mu,
+ float omega_relative_limi);
+ ~clock_recovery_mm_ff_impl();
+
+ void forecast(int noutput_items, gr_vector_int &ninput_items_required);
+ int general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ float mu() const { return d_mu;}
+ float omega() const { return d_omega;}
+ float gain_mu() const { return d_gain_mu;}
+ float gain_omega() const { return d_gain_omega;}
+
+ void set_verbose (bool verbose) { d_verbose = verbose; }
+ void set_gain_mu (float gain_mu) { d_gain_mu = gain_mu; }
+ void set_gain_omega (float gain_omega) { d_gain_omega = gain_omega; }
+ void set_mu (float mu) { d_mu = mu; }
+ void set_omega (float omega){
+ d_omega = omega;
+ d_min_omega = omega*(1.0 - d_omega_relative_limit);
+ d_max_omega = omega*(1.0 + d_omega_relative_limit);
+ d_omega_mid = 0.5*(d_min_omega+d_max_omega);
+ }
+
+ private:
+ float d_mu; // fractional sample position [0.0, 1.0]
+ float d_gain_mu; // gain for adjusting mu
+ float d_omega; // nominal frequency
+ float d_gain_omega; // gain for adjusting omega
+ float d_min_omega; // minimum allowed omega
+ float d_max_omega; // maximum allowed omeg
+ float d_omega_relative_limit; // used to compute min and max omega
+ float d_omega_mid; // average omega
+
+ float d_last_sample;
+ filter::mmse_fir_interpolator_ff *d_interp;
+
+ bool d_verbose;
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_DIGITAL_CLOCK_RECOVERY_MM_FF_IMPL_H */
diff --git a/gr-digital/lib/cma_equalizer_cc_impl.cc b/gr-digital/lib/cma_equalizer_cc_impl.cc
new file mode 100644
index 0000000000..e4e6c56466
--- /dev/null
+++ b/gr-digital/lib/cma_equalizer_cc_impl.cc
@@ -0,0 +1,131 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "cma_equalizer_cc_impl.h"
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace digital {
+
+ using namespace filter::kernel;
+
+ cma_equalizer_cc::sptr
+ cma_equalizer_cc::make(int num_taps, float modulus, float mu, int sps)
+ {
+ return gnuradio::get_initial_sptr
+ (new cma_equalizer_cc_impl(num_taps, modulus, mu, sps));
+ }
+
+ cma_equalizer_cc_impl::cma_equalizer_cc_impl(int num_taps, float modulus,
+ float mu, int sps)
+ : gr_sync_decimator("cma_equalizer_cc",
+ gr_make_io_signature(1, 1, sizeof(gr_complex)),
+ gr_make_io_signature(1, 1, sizeof(gr_complex)),
+ sps),
+ fir_filter_ccc(sps, std::vector<gr_complex>(num_taps, gr_complex(0,0))),
+ d_new_taps(num_taps, gr_complex(0,0)),
+ d_updated(false), d_error(gr_complex(0,0))
+ {
+ set_modulus(modulus);
+ set_gain(mu);
+ if(num_taps > 0)
+ d_new_taps[0] = 1.0;
+ fir_filter_ccc::set_taps(d_new_taps);
+
+ set_history(num_taps);
+ }
+
+ cma_equalizer_cc_impl::~cma_equalizer_cc_impl()
+ {
+ }
+
+ void
+ cma_equalizer_cc_impl::set_taps(const std::vector<gr_complex> &taps)
+ {
+ d_new_taps = taps;
+ d_updated = true;
+ }
+
+ std::vector<gr_complex>
+ cma_equalizer_cc_impl::taps() const
+ {
+ return d_taps;
+ }
+
+ gr_complex
+ cma_equalizer_cc_impl::error(const gr_complex &out)
+ {
+ gr_complex error = out*(norm(out) - d_modulus);
+ float re = gr_clip(error.real(), 1.0);
+ float im = gr_clip(error.imag(), 1.0);
+ return gr_complex(re, im);
+ }
+
+ void
+ cma_equalizer_cc_impl::update_tap(gr_complex &tap, const gr_complex &in)
+ {
+ // Hn+1 = Hn - mu*conj(Xn)*zn*(|zn|^2 - 1)
+ tap -= d_mu*conj(in)*d_error;
+ }
+
+ int
+ cma_equalizer_cc_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const gr_complex *in = (const gr_complex *)input_items[0];
+ gr_complex *out = (gr_complex *)output_items[0];
+
+ if(d_updated) {
+ d_taps = d_new_taps;
+ set_history(d_taps.size());
+ d_updated = false;
+ return 0; // history requirements may have changed.
+ }
+
+ int j = 0;
+ size_t k, l = d_taps.size();
+ for(int i = 0; i < noutput_items; i++) {
+ out[i] = filter(&in[j]);
+
+ // Adjust taps
+ d_error = error(out[i]);
+ for(k = 0; k < l; k++) {
+ // Update tap locally from error.
+ update_tap(d_taps[k], in[j+k]);
+
+ // Update aligned taps in filter object.
+ fir_filter_ccc::update_tap(d_taps[k], k);
+ }
+
+ j += decimation();
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace digital */
+} /* namespace gr */
diff --git a/gr-digital/lib/cma_equalizer_cc_impl.h b/gr-digital/lib/cma_equalizer_cc_impl.h
new file mode 100644
index 0000000000..553501bf46
--- /dev/null
+++ b/gr-digital/lib/cma_equalizer_cc_impl.h
@@ -0,0 +1,89 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_DIGITAL_CMA_EQUALIZER_CC_IMPL_H
+#define INCLUDED_DIGITAL_CMA_EQUALIZER_CC_IMPL_H
+
+#include <digital/cma_equalizer_cc.h>
+#include <filter/fir_filter.h>
+#include <gr_math.h>
+#include <stdexcept>
+
+namespace gr {
+ namespace digital {
+
+ class cma_equalizer_cc_impl
+ : public cma_equalizer_cc, filter::kernel::fir_filter_ccc
+ {
+ private:
+ std::vector<gr_complex> d_new_taps;
+ bool d_updated;
+ gr_complex d_error;
+
+ float d_modulus;
+ float d_mu;
+
+ protected:
+ gr_complex error(const gr_complex &out);
+ void update_tap(gr_complex &tap, const gr_complex &in);
+
+ public:
+ cma_equalizer_cc_impl(int num_taps, float modulus, float mu, int sps);
+ ~cma_equalizer_cc_impl();
+
+ void set_taps(const std::vector<gr_complex> &taps);
+ std::vector<gr_complex> taps() const;
+
+ float gain() const
+ {
+ return d_mu;
+ }
+
+ void set_gain(float mu)
+ {
+ if(mu < 0.0f || mu > 1.0f) {
+ throw std::out_of_range("cma_equalizer::set_gain: Gain value must be in [0,1]");
+ }
+ d_mu = mu;
+ }
+
+ float modulus() const
+ {
+ return d_modulus;
+ }
+
+ void set_modulus(float mod)
+ {
+ if(mod < 0)
+ throw std::out_of_range("cma_equalizer::set_modulus: Modulus value must be >= 0");
+ d_modulus = mod;
+ }
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_DIGITAL_CMA_EQUALIZER_CC_IMPL_H */
diff --git a/gr-digital/lib/constellation.cc b/gr-digital/lib/constellation.cc
new file mode 100644
index 0000000000..d249c493ad
--- /dev/null
+++ b/gr-digital/lib/constellation.cc
@@ -0,0 +1,669 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2010-2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_io_signature.h>
+#include <digital/constellation.h>
+#include <gr_math.h>
+#include <gr_complex.h>
+#include <math.h>
+#include <iostream>
+#include <stdlib.h>
+#include <float.h>
+#include <stdexcept>
+
+namespace gr {
+ namespace digital {
+
+#define M_TWOPI (2*M_PI)
+#define SQRT_TWO 0.707107
+
+ // Base Constellation Class
+ constellation::constellation(std::vector<gr_complex> constell,
+ std::vector<int> pre_diff_code,
+ unsigned int rotational_symmetry,
+ unsigned int dimensionality) :
+ d_constellation(constell),
+ d_pre_diff_code(pre_diff_code),
+ d_rotational_symmetry(rotational_symmetry),
+ d_dimensionality(dimensionality)
+ {
+ // Scale constellation points so that average magnitude is 1.
+ float summed_mag = 0;
+ unsigned int constsize = d_constellation.size();
+ for (unsigned int i=0; i<constsize; i++) {
+ gr_complex c = d_constellation[i];
+ summed_mag += sqrt(c.real()*c.real() + c.imag()*c.imag());
+ }
+ d_scalefactor = constsize/summed_mag;
+ for (unsigned int i=0; i<constsize; i++) {
+ d_constellation[i] = d_constellation[i]*d_scalefactor;
+ }
+ if(pre_diff_code.size() == 0)
+ d_apply_pre_diff_code = false;
+ else if(pre_diff_code.size() != constsize)
+ throw std::runtime_error("The constellation and pre-diff code must be of the same length.");
+ else
+ d_apply_pre_diff_code = true;
+ calc_arity();
+ }
+
+ constellation::constellation() :
+ d_apply_pre_diff_code(false),
+ d_rotational_symmetry(0),
+ d_dimensionality(1)
+ {
+ calc_arity();
+ }
+
+ constellation::~constellation()
+ {
+ }
+
+ //! Returns the constellation points for a symbol value
+ void
+ constellation::map_to_points(unsigned int value, gr_complex *points)
+ {
+ for(unsigned int i=0; i<d_dimensionality; i++)
+ points[i] = d_constellation[value*d_dimensionality + i];
+ }
+
+ std::vector<gr_complex>
+ constellation::map_to_points_v(unsigned int value)
+ {
+ std::vector<gr_complex> points_v;
+ points_v.resize(d_dimensionality);
+ map_to_points(value, &(points_v[0]));
+ return points_v;
+ }
+
+ float
+ constellation::get_distance(unsigned int index, const gr_complex *sample)
+ {
+ float dist = 0;
+ for(unsigned int i=0; i<d_dimensionality; i++) {
+ dist += norm(sample[i] - d_constellation[index*d_dimensionality + i]);
+ }
+ return dist;
+ }
+
+ unsigned int
+ constellation::get_closest_point(const gr_complex *sample)
+ {
+ unsigned int min_index = 0;
+ float min_euclid_dist;
+ float euclid_dist;
+
+ min_euclid_dist = get_distance(0, sample);
+ min_index = 0;
+ for(unsigned int j = 1; j < d_arity; j++){
+ euclid_dist = get_distance(j, sample);
+ if(euclid_dist < min_euclid_dist){
+ min_euclid_dist = euclid_dist;
+ min_index = j;
+ }
+ }
+ return min_index;
+ }
+
+ unsigned int
+ constellation::decision_maker_pe(const gr_complex *sample, float *phase_error)
+ {
+ unsigned int index = decision_maker(sample);
+ *phase_error = 0;
+ for(unsigned int d=0; d<d_dimensionality; d++)
+ *phase_error += -arg(sample[d]*conj(d_constellation[index+d]));
+ return index;
+ }
+
+ /*
+ unsigned int constellation::decision_maker_e(const gr_complex *sample, float *error)
+ {
+ unsigned int index = decision_maker(sample);
+ *error = 0;
+ for(unsigned int d=0; d<d_dimensionality; d++)
+ *error += sample[d]*conj(d_constellation[index+d]);
+ return index;
+ }
+ */
+
+ std::vector<gr_complex> constellation::s_points()
+ {
+ if(d_dimensionality != 1)
+ throw std::runtime_error("s_points only works for dimensionality 1 constellations.");
+ else
+ return d_constellation;
+ }
+
+ std::vector<std::vector<gr_complex> >
+ constellation::v_points()
+ {
+ std::vector<std::vector<gr_complex> > vv_const;
+ vv_const.resize(d_arity);
+ for(unsigned int p=0; p<d_arity; p++) {
+ std::vector<gr_complex> v_const;
+ v_const.resize(d_dimensionality);
+ for(unsigned int d=0; d<d_dimensionality; d++) {
+ v_const[d] = d_constellation[p*d_dimensionality+d];
+ }
+ vv_const[p] = v_const;
+ }
+ return vv_const;
+ }
+
+ void
+ constellation::calc_metric(const gr_complex *sample, float *metric,
+ trellis_metric_type_t type)
+ {
+ switch(type){
+ case TRELLIS_EUCLIDEAN:
+ calc_euclidean_metric(sample, metric);
+ break;
+ case TRELLIS_HARD_SYMBOL:
+ calc_hard_symbol_metric(sample, metric);
+ break;
+ case TRELLIS_HARD_BIT:
+ throw std::runtime_error("Invalid metric type (not yet implemented).");
+ break;
+ default:
+ throw std::runtime_error("Invalid metric type.");
+ }
+ }
+
+ void
+ constellation::calc_euclidean_metric(const gr_complex *sample, float *metric)
+ {
+ for(unsigned int o=0; o<d_arity; o++) {
+ metric[o] = get_distance(o, sample);
+ }
+ }
+
+ void
+ constellation::calc_hard_symbol_metric(const gr_complex *sample, float *metric)
+ {
+ float minm = FLT_MAX;
+ unsigned int minmi = 0;
+ for(unsigned int o=0; o<d_arity; o++) {
+ float dist = get_distance(o, sample);
+ if(dist < minm) {
+ minm = dist;
+ minmi = o;
+ }
+ }
+ for(unsigned int o=0; o<d_arity; o++) {
+ metric[o] = (o==minmi?0.0:1.0);
+ }
+ }
+
+ void
+ constellation::calc_arity()
+ {
+ if(d_constellation.size() % d_dimensionality != 0)
+ throw std::runtime_error("Constellation vector size must be a multiple of the dimensionality.");
+ d_arity = d_constellation.size()/d_dimensionality;
+ }
+
+ unsigned int
+ constellation::decision_maker_v(std::vector<gr_complex> sample)
+ {
+ assert(sample.size() == d_dimensionality);
+ return decision_maker(&(sample[0]));
+ }
+
+
+ /********************************************************************/
+
+
+ constellation_calcdist::sptr
+ constellation_calcdist::make(std::vector<gr_complex> constell,
+ std::vector<int> pre_diff_code,
+ unsigned int rotational_symmetry,
+ unsigned int dimensionality)
+ {
+ return constellation_calcdist::sptr(new constellation_calcdist
+ (constell, pre_diff_code,
+ rotational_symmetry, dimensionality));
+ }
+
+ constellation_calcdist::constellation_calcdist(std::vector<gr_complex> constell,
+ std::vector<int> pre_diff_code,
+ unsigned int rotational_symmetry,
+ unsigned int dimensionality)
+ : constellation(constell, pre_diff_code, rotational_symmetry, dimensionality)
+ {}
+
+ // Chooses points base on shortest distance.
+ // Inefficient.
+ unsigned int
+ constellation_calcdist::decision_maker(const gr_complex *sample)
+ {
+ return get_closest_point(sample);
+ }
+
+
+ /********************************************************************/
+
+
+ constellation_sector::constellation_sector(std::vector<gr_complex> constell,
+ std::vector<int> pre_diff_code,
+ unsigned int rotational_symmetry,
+ unsigned int dimensionality,
+ unsigned int n_sectors) :
+ constellation(constell, pre_diff_code, rotational_symmetry, dimensionality),
+ n_sectors(n_sectors)
+ {
+ }
+
+ constellation_sector::~constellation_sector()
+ {
+ }
+
+ unsigned int
+ constellation_sector::decision_maker(const gr_complex *sample)
+ {
+ unsigned int sector;
+ sector = get_sector(sample);
+ return sector_values[sector];
+ }
+
+ void
+ constellation_sector::find_sector_values()
+ {
+ unsigned int i;
+ sector_values.clear();
+ for(i=0; i<n_sectors; i++) {
+ sector_values.push_back(calc_sector_value(i));
+ }
+ }
+
+
+ /********************************************************************/
+
+
+ constellation_rect::sptr
+ constellation_rect::make(std::vector<gr_complex> constell,
+ std::vector<int> pre_diff_code,
+ unsigned int rotational_symmetry,
+ unsigned int real_sectors,
+ unsigned int imag_sectors,
+ float width_real_sectors,
+ float width_imag_sectors)
+ {
+ return constellation_rect::sptr(new constellation_rect
+ (constell, pre_diff_code,
+ rotational_symmetry,
+ real_sectors, imag_sectors,
+ width_real_sectors,
+ width_imag_sectors));
+ }
+
+ constellation_rect::constellation_rect(std::vector<gr_complex> constell,
+ std::vector<int> pre_diff_code,
+ unsigned int rotational_symmetry,
+ unsigned int real_sectors, unsigned int imag_sectors,
+ float width_real_sectors, float width_imag_sectors) :
+ constellation_sector(constell, pre_diff_code, rotational_symmetry,
+ 1, real_sectors * imag_sectors),
+ n_real_sectors(real_sectors), n_imag_sectors(imag_sectors),
+ d_width_real_sectors(width_real_sectors), d_width_imag_sectors(width_imag_sectors)
+ {
+ d_width_real_sectors *= d_scalefactor;
+ d_width_imag_sectors *= d_scalefactor;
+ find_sector_values();
+ }
+
+ constellation_rect::~constellation_rect()
+ {
+ }
+
+ unsigned int
+ constellation_rect::get_sector(const gr_complex *sample)
+ {
+ int real_sector, imag_sector;
+ unsigned int sector;
+
+ real_sector = int(real(*sample)/d_width_real_sectors + n_real_sectors/2.0);
+ if(real_sector < 0)
+ real_sector = 0;
+ if(real_sector >= (int)n_real_sectors)
+ real_sector = n_real_sectors-1;
+
+ imag_sector = int(imag(*sample)/d_width_imag_sectors + n_imag_sectors/2.0);
+ if(imag_sector < 0)
+ imag_sector = 0;
+ if(imag_sector >= (int)n_imag_sectors)
+ imag_sector = n_imag_sectors-1;
+
+ sector = real_sector * n_imag_sectors + imag_sector;
+ return sector;
+ }
+
+ unsigned int
+ constellation_rect::calc_sector_value(unsigned int sector)
+ {
+ unsigned int real_sector, imag_sector;
+ gr_complex sector_center;
+ unsigned int closest_point;
+ real_sector = float(sector)/n_imag_sectors;
+ imag_sector = sector - real_sector * n_imag_sectors;
+ sector_center = gr_complex((real_sector + 0.5 - n_real_sectors/2.0) * d_width_real_sectors,
+ (imag_sector + 0.5 - n_imag_sectors/2.0) * d_width_imag_sectors);
+ closest_point = get_closest_point(&sector_center);
+ return closest_point;
+ }
+
+
+ /********************************************************************/
+
+
+ constellation_expl_rect::sptr
+ constellation_expl_rect::make(std::vector<gr_complex> constellation,
+ std::vector<int> pre_diff_code,
+ unsigned int rotational_symmetry,
+ unsigned int real_sectors,
+ unsigned int imag_sectors,
+ float width_real_sectors,
+ float width_imag_sectors,
+ std::vector<unsigned int> sector_values)
+ {
+ return constellation_expl_rect::sptr
+ (new constellation_expl_rect(constellation, pre_diff_code,
+ rotational_symmetry,
+ real_sectors, imag_sectors,
+ width_real_sectors, width_imag_sectors,
+ sector_values));
+ }
+
+ constellation_expl_rect::constellation_expl_rect(std::vector<gr_complex> constellation,
+ std::vector<int> pre_diff_code,
+ unsigned int rotational_symmetry,
+ unsigned int real_sectors,
+ unsigned int imag_sectors,
+ float width_real_sectors,
+ float width_imag_sectors,
+ std::vector<unsigned int> sector_values)
+ : constellation_rect(constellation, pre_diff_code, rotational_symmetry,
+ real_sectors, imag_sectors, width_real_sectors, width_imag_sectors),
+ d_sector_values(sector_values)
+ {
+ }
+
+ constellation_expl_rect::~constellation_expl_rect()
+ {
+ }
+
+ /********************************************************************/
+
+
+ constellation_psk::sptr
+ constellation_psk::make(std::vector<gr_complex> constell,
+ std::vector<int> pre_diff_code,
+ unsigned int n_sectors)
+ {
+ return constellation_psk::sptr(new constellation_psk
+ (constell, pre_diff_code,
+ n_sectors));
+ }
+
+ constellation_psk::constellation_psk(std::vector<gr_complex> constell,
+ std::vector<int> pre_diff_code,
+ unsigned int n_sectors) :
+ constellation_sector(constell, pre_diff_code, constell.size(), 1, n_sectors)
+ {
+ find_sector_values();
+ }
+
+ constellation_psk::~constellation_psk()
+ {
+ }
+
+ unsigned int
+ constellation_psk::get_sector(const gr_complex *sample)
+ {
+ float phase = arg(*sample);
+ float width = M_TWOPI / n_sectors;
+ int sector = floor(phase/width + 0.5);
+ if(sector < 0)
+ sector += n_sectors;
+ return sector;
+ }
+
+ unsigned int
+ constellation_psk::calc_sector_value(unsigned int sector)
+ {
+ float phase = sector * M_TWOPI / n_sectors;
+ gr_complex sector_center = gr_complex(cos(phase), sin(phase));
+ unsigned int closest_point = get_closest_point(&sector_center);
+ return closest_point;
+ }
+
+
+ /********************************************************************/
+
+
+ constellation_bpsk::sptr
+ constellation_bpsk::make()
+ {
+ return constellation_bpsk::sptr(new constellation_bpsk());
+ }
+
+ constellation_bpsk::constellation_bpsk()
+ {
+ d_constellation.resize(2);
+ d_constellation[0] = gr_complex(-1, 0);
+ d_constellation[1] = gr_complex(1, 0);
+ d_rotational_symmetry = 2;
+ d_dimensionality = 1;
+ calc_arity();
+ }
+
+ constellation_bpsk::~constellation_bpsk()
+ {
+ }
+
+ unsigned int
+ constellation_bpsk::decision_maker(const gr_complex *sample)
+ {
+ return (real(*sample) > 0);
+ }
+
+
+ /********************************************************************/
+
+
+ constellation_qpsk::sptr
+ constellation_qpsk::make()
+ {
+ return constellation_qpsk::sptr(new constellation_qpsk());
+ }
+
+ constellation_qpsk::constellation_qpsk()
+ {
+ d_constellation.resize(4);
+ // Gray-coded
+ d_constellation[0] = gr_complex(-SQRT_TWO, -SQRT_TWO);
+ d_constellation[1] = gr_complex(SQRT_TWO, -SQRT_TWO);
+ d_constellation[2] = gr_complex(-SQRT_TWO, SQRT_TWO);
+ d_constellation[3] = gr_complex(SQRT_TWO, SQRT_TWO);
+
+ /*
+ d_constellation[0] = gr_complex(SQRT_TWO, SQRT_TWO);
+ d_constellation[1] = gr_complex(-SQRT_TWO, SQRT_TWO);
+ d_constellation[2] = gr_complex(SQRT_TWO, -SQRT_TWO);
+ d_constellation[3] = gr_complex(SQRT_TWO, -SQRT_TWO);
+ */
+
+ d_pre_diff_code.resize(4);
+ d_pre_diff_code[0] = 0x0;
+ d_pre_diff_code[1] = 0x2;
+ d_pre_diff_code[2] = 0x3;
+ d_pre_diff_code[3] = 0x1;
+
+ d_rotational_symmetry = 4;
+ d_dimensionality = 1;
+ calc_arity();
+ }
+
+ constellation_qpsk::~constellation_qpsk()
+ {
+ }
+
+ unsigned int
+ constellation_qpsk::decision_maker(const gr_complex *sample)
+ {
+ // Real component determines small bit.
+ // Imag component determines big bit.
+ return 2*(imag(*sample)>0) + (real(*sample)>0);
+
+ /*
+ bool a = real(*sample) > 0;
+ bool b = imag(*sample) > 0;
+ if(a) {
+ if(b)
+ return 0x0;
+ else
+ return 0x1;
+ }
+ else {
+ if(b)
+ return 0x2;
+ else
+ return 0x3;
+ }
+ */
+ }
+
+
+ /********************************************************************/
+
+
+ constellation_dqpsk::sptr
+ constellation_dqpsk::make()
+ {
+ return constellation_dqpsk::sptr(new constellation_dqpsk());
+ }
+
+ constellation_dqpsk::constellation_dqpsk()
+ {
+ // This constellation is not gray coded, which allows
+ // us to use differential encodings (through diff_encode and
+ // diff_decode) on the symbols.
+ d_constellation.resize(4);
+ d_constellation[0] = gr_complex(+SQRT_TWO, +SQRT_TWO);
+ d_constellation[1] = gr_complex(-SQRT_TWO, +SQRT_TWO);
+ d_constellation[2] = gr_complex(-SQRT_TWO, -SQRT_TWO);
+ d_constellation[3] = gr_complex(+SQRT_TWO, -SQRT_TWO);
+
+ // Use this mapping to convert to gray code before diff enc.
+ d_pre_diff_code.resize(4);
+ d_pre_diff_code[0] = 0x0;
+ d_pre_diff_code[1] = 0x1;
+ d_pre_diff_code[2] = 0x3;
+ d_pre_diff_code[3] = 0x2;
+ d_apply_pre_diff_code = true;
+
+ d_rotational_symmetry = 4;
+ d_dimensionality = 1;
+ calc_arity();
+ }
+
+ constellation_dqpsk::~constellation_dqpsk()
+ {
+ }
+
+ unsigned int
+ constellation_dqpsk::decision_maker(const gr_complex *sample)
+ {
+ // Slower deicison maker as we can't slice along one axis.
+ // Maybe there's a better way to do this, still.
+
+ bool a = real(*sample) > 0;
+ bool b = imag(*sample) > 0;
+ if(a) {
+ if(b)
+ return 0x0;
+ else
+ return 0x3;
+ }
+ else {
+ if(b)
+ return 0x1;
+ else
+ return 0x2;
+ }
+ }
+
+
+ /********************************************************************/
+
+
+ constellation_8psk::sptr
+ constellation_8psk::make()
+ {
+ return constellation_8psk::sptr(new constellation_8psk());
+ }
+
+ constellation_8psk::constellation_8psk()
+ {
+ float angle = M_PI/8.0;
+ d_constellation.resize(8);
+ // Gray-coded
+ d_constellation[0] = gr_complex(cos( 1*angle), sin( 1*angle));
+ d_constellation[1] = gr_complex(cos( 7*angle), sin( 7*angle));
+ d_constellation[2] = gr_complex(cos(15*angle), sin(15*angle));
+ d_constellation[3] = gr_complex(cos( 9*angle), sin( 9*angle));
+ d_constellation[4] = gr_complex(cos( 3*angle), sin( 3*angle));
+ d_constellation[5] = gr_complex(cos( 5*angle), sin( 5*angle));
+ d_constellation[6] = gr_complex(cos(13*angle), sin(13*angle));
+ d_constellation[7] = gr_complex(cos(11*angle), sin(11*angle));
+ d_rotational_symmetry = 8;
+ d_dimensionality = 1;
+ calc_arity();
+ }
+
+ constellation_8psk::~constellation_8psk()
+ {
+ }
+
+ unsigned int
+ constellation_8psk::decision_maker(const gr_complex *sample)
+ {
+ unsigned int ret = 0;
+
+ float re = sample->real();
+ float im = sample->imag();
+
+ if(fabsf(re) <= fabsf(im))
+ ret = 4;
+ if(re <= 0)
+ ret |= 1;
+ if(im <= 0)
+ ret |= 2;
+
+ return ret;
+ }
+
+ } /* namespace digital */
+} /* namespace gr */
diff --git a/gr-digital/lib/constellation_decoder_cb_impl.cc b/gr-digital/lib/constellation_decoder_cb_impl.cc
new file mode 100644
index 0000000000..e764ccc629
--- /dev/null
+++ b/gr-digital/lib/constellation_decoder_cb_impl.cc
@@ -0,0 +1,84 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "constellation_decoder_cb_impl.h"
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace digital {
+
+ constellation_decoder_cb::sptr
+ constellation_decoder_cb::make(constellation_sptr constellation)
+ {
+ return gnuradio::get_initial_sptr
+ (new constellation_decoder_cb_impl(constellation));
+ }
+
+ constellation_decoder_cb_impl::
+ constellation_decoder_cb_impl(constellation_sptr constellation)
+ : gr_block("constellation_decoder_cb",
+ gr_make_io_signature(1, 1, sizeof(gr_complex)),
+ gr_make_io_signature(1, 1, sizeof(unsigned char))),
+ d_constellation(constellation),
+ d_dim(constellation->dimensionality())
+ {
+ set_relative_rate(1.0 / ((double)d_dim));
+ }
+
+ constellation_decoder_cb_impl::~constellation_decoder_cb_impl()
+ {
+ }
+
+ void
+ constellation_decoder_cb_impl::forecast(int noutput_items,
+ gr_vector_int &ninput_items_required)
+ {
+ unsigned int input_required = noutput_items * d_dim;
+
+ unsigned ninputs = ninput_items_required.size();
+ for(unsigned int i = 0; i < ninputs; i++)
+ ninput_items_required[i] = input_required;
+ }
+
+ int
+ constellation_decoder_cb_impl::general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ gr_complex const *in = (const gr_complex*)input_items[0];
+ unsigned char *out = (unsigned char*)output_items[0];
+
+ for(int i = 0; i < noutput_items; i++) {
+ out[i] = d_constellation->decision_maker(&(in[i*d_dim]));
+ }
+
+ consume_each(noutput_items * d_dim);
+ return noutput_items;
+ }
+
+ } /* namespace digital */
+} /* namespace gr */
diff --git a/gr-digital/lib/constellation_decoder_cb_impl.h b/gr-digital/lib/constellation_decoder_cb_impl.h
new file mode 100644
index 0000000000..5972760507
--- /dev/null
+++ b/gr-digital/lib/constellation_decoder_cb_impl.h
@@ -0,0 +1,53 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_DIGITAL_CONSTELLATION_DECODER_CB_IMPL_H
+#define INCLUDED_DIGITAL_CONSTELLATION_DECODER_CB_IMPL_H
+
+#include <digital/constellation_decoder_cb.h>
+
+namespace gr {
+ namespace digital {
+
+ class constellation_decoder_cb_impl : public constellation_decoder_cb
+ {
+ private:
+ constellation_sptr d_constellation;
+ unsigned int d_dim;
+
+ public:
+ constellation_decoder_cb_impl(constellation_sptr constellation);
+ ~constellation_decoder_cb_impl();
+
+ void forecast(int noutput_items,
+ gr_vector_int &ninput_items_required);
+
+ int general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_DIGITAL_CONSTELLATION_DECODER_CB_IMPL_H */
diff --git a/gr-digital/lib/constellation_receiver_cb_impl.cc b/gr-digital/lib/constellation_receiver_cb_impl.cc
new file mode 100644
index 0000000000..30be24aab9
--- /dev/null
+++ b/gr-digital/lib/constellation_receiver_cb_impl.cc
@@ -0,0 +1,133 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "constellation_receiver_cb_impl.h"
+#include <gr_io_signature.h>
+#include <gr_prefs.h>
+#include <gr_math.h>
+#include <gr_expj.h>
+#include <stdexcept>
+
+namespace gr {
+ namespace digital {
+
+#define M_TWOPI (2*M_PI)
+#define VERBOSE_MM 0 // Used for debugging symbol timing loop
+#define VERBOSE_COSTAS 0 // Used for debugging phase and frequency tracking
+
+ constellation_receiver_cb::sptr
+ constellation_receiver_cb::make(constellation_sptr constell,
+ float loop_bw, float fmin, float fmax)
+ {
+ return gnuradio::get_initial_sptr
+ (new constellation_receiver_cb_impl(constell, loop_bw,
+ fmin, fmax));
+ }
+
+ static int ios[] = {sizeof(char), sizeof(float), sizeof(float), sizeof(float), sizeof(gr_complex)};
+ static std::vector<int> iosig(ios, ios+sizeof(ios)/sizeof(int));
+ constellation_receiver_cb_impl::constellation_receiver_cb_impl(constellation_sptr constellation,
+ float loop_bw, float fmin, float fmax)
+ : gr_block("constellation_receiver_cb",
+ gr_make_io_signature(1, 1, sizeof(gr_complex)),
+ gr_make_io_signaturev(1, 5, iosig)),
+ blocks::control_loop(loop_bw, fmax, fmin),
+ d_constellation(constellation),
+ d_current_const_point(0)
+ {
+ if(d_constellation->dimensionality() != 1)
+ throw std::runtime_error("This receiver only works with constellations of dimension 1.");
+ }
+
+ constellation_receiver_cb_impl::~constellation_receiver_cb_impl()
+ {
+ }
+
+ void
+ constellation_receiver_cb_impl::phase_error_tracking(float phase_error)
+ {
+ advance_loop(phase_error);
+ phase_wrap();
+ frequency_limit();
+
+#if VERBOSE_COSTAS
+ printf("cl: phase_error: %f phase: %f freq: %f sample: %f+j%f constellation: %f+j%f\n",
+ phase_error, d_phase, d_freq, sample.real(), sample.imag(),
+ d_constellation->points()[d_current_const_point].real(),
+ d_constellation->points()[d_current_const_point].imag());
+#endif
+ }
+
+ int
+ constellation_receiver_cb_impl::general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const gr_complex *in = (const gr_complex *)input_items[0];
+ unsigned char *out = (unsigned char *)output_items[0];
+
+ int i=0;
+
+ float phase_error;
+ unsigned int sym_value;
+ gr_complex sample, nco;
+
+ float *out_err = 0, *out_phase = 0, *out_freq = 0;
+ gr_complex *out_symbol;
+ if(output_items.size() == 5) {
+ out_err = (float*)output_items[1];
+ out_phase = (float*)output_items[2];
+ out_freq = (float*)output_items[3];
+ out_symbol = (gr_complex*)output_items[4];
+ }
+
+ while((i < noutput_items) && (i < ninput_items[0])) {
+ sample = in[i];
+ nco = gr_expj(d_phase); // get the NCO value for derotating the current sample
+ sample = nco*sample; // get the downconverted symbol
+
+ sym_value = d_constellation->decision_maker_pe(&sample, &phase_error);
+ phase_error_tracking(phase_error); // corrects phase and frequency offsets
+
+ out[i] = sym_value;
+
+ if(output_items.size() == 5) {
+ out_err[i] = phase_error;
+ out_phase[i] = d_phase;
+ out_freq[i] = d_freq;
+ out_symbol[i] = sample;
+ }
+ i++;
+ }
+
+ consume_each(i);
+ return i;
+ }
+
+ } /* namespace digital */
+} /* namespace gr */
+
diff --git a/gr-digital/lib/constellation_receiver_cb_impl.h b/gr-digital/lib/constellation_receiver_cb_impl.h
new file mode 100644
index 0000000000..763dabfde2
--- /dev/null
+++ b/gr-digital/lib/constellation_receiver_cb_impl.h
@@ -0,0 +1,70 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_DIGITAL_CONSTELLATION_RECEIVER_CB_IMPL_H
+#define INCLUDED_DIGITAL_CONSTELLATION_RECEIVER_CB_IMPL_H
+
+#include <digital/constellation_receiver_cb.h>
+#include <gruel/attributes.h>
+#include <gr_complex.h>
+#include <blocks/control_loop.h>
+
+namespace gr {
+ namespace digital {
+
+ class constellation_receiver_cb_impl
+ : public constellation_receiver_cb, blocks::control_loop
+ {
+ public:
+ constellation_receiver_cb_impl(constellation_sptr constell,
+ float loop_bw, float fmin, float fmax);
+
+ ~constellation_receiver_cb_impl();
+
+ int general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ protected:
+ void phase_error_tracking(float phase_error);
+
+ private:
+ unsigned int d_M;
+
+ constellation_sptr d_constellation;
+ unsigned int d_current_const_point;
+
+ //! delay line length.
+ static const unsigned int DLLEN = 8;
+
+ //! delay line plus some length for overflow protection
+ __GR_ATTR_ALIGNED(8) gr_complex d_dl[2*DLLEN];
+
+ //! index to delay line
+ unsigned int d_dl_idx;
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_DIGITAL_CONSTELLATION_RECEIVER_CB_IMPL_H */
diff --git a/gr-digital/lib/correlate_access_code_bb_impl.cc b/gr-digital/lib/correlate_access_code_bb_impl.cc
new file mode 100644
index 0000000000..0ada203c65
--- /dev/null
+++ b/gr-digital/lib/correlate_access_code_bb_impl.cc
@@ -0,0 +1,133 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2006,2010-2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "correlate_access_code_bb_impl.h"
+#include <gr_io_signature.h>
+#include <blocks/count_bits.h>
+#include <stdexcept>
+#include <cstdio>
+
+namespace gr {
+ namespace digital {
+
+#define VERBOSE 0
+
+ correlate_access_code_bb::sptr
+ correlate_access_code_bb::make(const std::string &access_code, int threshold)
+ {
+ return gnuradio::get_initial_sptr
+ (new correlate_access_code_bb_impl(access_code, threshold));
+ }
+
+ correlate_access_code_bb_impl::correlate_access_code_bb_impl(
+ const std::string &access_code, int threshold)
+ : gr_sync_block("correlate_access_code_bb",
+ gr_make_io_signature(1, 1, sizeof(char)),
+ gr_make_io_signature(1, 1, sizeof(char))),
+ d_data_reg(0), d_flag_reg(0), d_flag_bit(0), d_mask(0),
+ d_threshold(threshold)
+ {
+ if(!set_access_code(access_code)) {
+ throw std::out_of_range ("access_code is > 64 bits");
+ }
+ }
+
+ correlate_access_code_bb_impl::~correlate_access_code_bb_impl()
+ {
+ }
+
+ bool
+ correlate_access_code_bb_impl::set_access_code(
+ const std::string &access_code)
+ {
+ unsigned len = access_code.length(); // # of bytes in string
+ if(len > 64)
+ return false;
+
+ // set len top bits to 1.
+ d_mask = ((~0ULL) >> (64 - len)) << (64 - len);
+
+ d_flag_bit = 1LL << (64 - len); // Where we or-in new flag values.
+ // new data always goes in 0x0000000000000001
+ d_access_code = 0;
+ for(unsigned i=0; i < 64; i++){
+ d_access_code <<= 1;
+ if(i < len)
+ d_access_code |= access_code[i] & 1; // look at LSB only
+ }
+
+ return true;
+ }
+
+ int
+ correlate_access_code_bb_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const unsigned char *in = (const unsigned char*)input_items[0];
+ unsigned char *out = (unsigned char*)output_items[0];
+
+ for(int i = 0; i < noutput_items; i++) {
+ // compute output value
+ unsigned int t = 0;
+
+ t |= ((d_data_reg >> 63) & 0x1) << 0;
+ t |= ((d_flag_reg >> 63) & 0x1) << 1; // flag bit
+ out[i] = t;
+
+ // compute hamming distance between desired access code and current data
+ unsigned long long wrong_bits = 0;
+ unsigned int nwrong = d_threshold+1;
+ int new_flag = 0;
+
+ wrong_bits = (d_data_reg ^ d_access_code) & d_mask;
+ nwrong = gr::blocks::count_bits64(wrong_bits);
+
+ // test for access code with up to threshold errors
+ new_flag = (nwrong <= d_threshold);
+
+#if VERBOSE
+ if(new_flag) {
+ fprintf(stderr, "access code found: %llx\n", d_access_code);
+ }
+ else {
+ fprintf(stderr, "%llx ==> %llx\n", d_access_code, d_data_reg);
+ }
+#endif
+
+ // shift in new data and new flag
+ d_data_reg = (d_data_reg << 1) | (in[i] & 0x1);
+ d_flag_reg = (d_flag_reg << 1);
+ if(new_flag) {
+ d_flag_reg |= d_flag_bit;
+ }
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace digital */
+} /* namespace gr */
diff --git a/gr-digital/lib/correlate_access_code_bb_impl.h b/gr-digital/lib/correlate_access_code_bb_impl.h
new file mode 100644
index 0000000000..ad44b36400
--- /dev/null
+++ b/gr-digital/lib/correlate_access_code_bb_impl.h
@@ -0,0 +1,59 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,2006,2011,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_DIGITAL_CORRELATE_ACCESS_CODE_BB_IMPL_H
+#define INCLUDED_DIGITAL_CORRELATE_ACCESS_CODE_BB_IMPL_H
+
+#include <digital/correlate_access_code_bb.h>
+
+namespace gr {
+ namespace digital {
+
+ class correlate_access_code_bb_impl :
+ public correlate_access_code_bb
+ {
+ private:
+ unsigned long long d_access_code; // access code to locate start of packet
+ // access code is left justified in the word
+ unsigned long long d_data_reg; // used to look for access_code
+ unsigned long long d_flag_reg; // keep track of decisions
+ unsigned long long d_flag_bit; // mask containing 1 bit which is location of new flag
+ unsigned long long d_mask; // masks access_code bits (top N bits are set where
+ // N is the number of bits in the access code)
+ unsigned int d_threshold; // how many bits may be wrong in sync vector
+
+ public:
+ correlate_access_code_bb_impl(const std::string &access_code,
+ int threshold);
+ ~correlate_access_code_bb_impl();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ bool set_access_code(const std::string &access_code);
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_DIGITAL_CORRELATE_ACCESS_CODE_BB_IMPL_H */
diff --git a/gr-digital/lib/correlate_access_code_tag_bb_impl.cc b/gr-digital/lib/correlate_access_code_tag_bb_impl.cc
new file mode 100644
index 0000000000..8ac601bb9d
--- /dev/null
+++ b/gr-digital/lib/correlate_access_code_tag_bb_impl.cc
@@ -0,0 +1,136 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2006,2010-2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "correlate_access_code_tag_bb_impl.h"
+#include <gr_io_signature.h>
+#include <stdexcept>
+#include <blocks/count_bits.h>
+#include <cstdio>
+#include <iostream>
+
+namespace gr {
+ namespace digital {
+
+#define VERBOSE 0
+
+ correlate_access_code_tag_bb::sptr
+ correlate_access_code_tag_bb::make(const std::string &access_code,
+ int threshold,
+ const std::string &tag_name)
+ {
+ return gnuradio::get_initial_sptr
+ (new correlate_access_code_tag_bb_impl(access_code,
+ threshold, tag_name));
+ }
+
+
+ correlate_access_code_tag_bb_impl::correlate_access_code_tag_bb_impl(
+ const std::string &access_code, int threshold, const std::string &tag_name)
+ : gr_sync_block("correlate_access_code_tag_bb",
+ gr_make_io_signature(1, 1, sizeof(char)),
+ gr_make_io_signature(1, 1, sizeof(char))),
+ d_data_reg(0), d_mask(0),
+ d_threshold(threshold), d_len(0)
+ {
+ if(!set_access_code(access_code)) {
+ throw std::out_of_range ("access_code is > 64 bits");
+ }
+
+ std::stringstream str;
+ str << name() << unique_id();
+ d_me = pmt::string_to_symbol(str.str());
+ d_key = pmt::string_to_symbol(tag_name);
+ }
+
+ correlate_access_code_tag_bb_impl::~correlate_access_code_tag_bb_impl()
+ {
+ }
+
+ bool
+ correlate_access_code_tag_bb_impl::set_access_code(
+ const std::string &access_code)
+ {
+ d_len = access_code.length(); // # of bytes in string
+ if(d_len > 64)
+ return false;
+
+ // set len top bits to 1.
+ d_mask = ((~0ULL) >> (64 - d_len)) << (64 - d_len);
+
+ d_access_code = 0;
+ for(unsigned i=0; i < 64; i++){
+ d_access_code <<= 1;
+ if(i < d_len)
+ d_access_code |= access_code[i] & 1; // look at LSB only
+ }
+
+ return true;
+ }
+
+ int
+ correlate_access_code_tag_bb_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const unsigned char *in = (const unsigned char*)input_items[0];
+ unsigned char *out = (unsigned char*)output_items[0];
+
+ uint64_t abs_out_sample_cnt = nitems_written(0);
+
+ for(int i = 0; i < noutput_items; i++) {
+ out[i] = in[i];
+
+ // compute hamming distance between desired access code and current data
+ unsigned long long wrong_bits = 0;
+ unsigned int nwrong = d_threshold+1;
+ int new_flag = 0;
+
+ wrong_bits = (d_data_reg ^ d_access_code) & d_mask;
+ nwrong = gr::blocks::count_bits64(wrong_bits);
+
+ // test for access code with up to threshold errors
+ new_flag = (nwrong <= d_threshold);
+
+ // shift in new data and new flag
+ d_data_reg = (d_data_reg << 1) | (in[i] & 0x1);
+ if(new_flag) {
+ if(VERBOSE)
+ std::cerr << "writing tag at sample " << abs_out_sample_cnt + i << std::endl;
+ add_item_tag(0, //stream ID
+ abs_out_sample_cnt + i - 64 + d_len, //sample
+ d_key, //frame info
+ pmt::pmt_t(), //data (unused)
+ d_me //block src id
+ );
+ }
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace digital */
+} /* namespace gr */
+
diff --git a/gr-digital/lib/correlate_access_code_tag_bb_impl.h b/gr-digital/lib/correlate_access_code_tag_bb_impl.h
new file mode 100644
index 0000000000..17a016fc9c
--- /dev/null
+++ b/gr-digital/lib/correlate_access_code_tag_bb_impl.h
@@ -0,0 +1,61 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,2006,2011,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_DIGITAL_CORRELATE_ACCESS_CODE_TAG_BB_IMPL_H
+#define INCLUDED_DIGITAL_CORRELATE_ACCESS_CODE_TAG_BB_IMPL_H
+
+#include <digital/correlate_access_code_tag_bb.h>
+
+namespace gr {
+ namespace digital {
+
+ class correlate_access_code_tag_bb_impl :
+ public correlate_access_code_tag_bb
+ {
+ private:
+ unsigned long long d_access_code; // access code to locate start of packet
+ // access code is left justified in the word
+ unsigned long long d_data_reg; // used to look for access_code
+ unsigned long long d_mask; // masks access_code bits (top N bits are set where
+ // N is the number of bits in the access code)
+ unsigned int d_threshold; // how many bits may be wrong in sync vector
+ unsigned int d_len; // the length of the access code
+
+ pmt::pmt_t d_key, d_me; //d_key is the tag name, d_me is the block name + unique ID
+
+ public:
+ correlate_access_code_tag_bb_impl(const std::string &access_code,
+ int threshold,
+ const std::string &tag_name);
+ ~correlate_access_code_tag_bb_impl();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ bool set_access_code(const std::string &access_code);
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_DIGITAL_CORRELATE_ACCESS_CODE_TAG_BB_IMPL_H */
diff --git a/gr-digital/lib/costas_loop_cc_impl.cc b/gr-digital/lib/costas_loop_cc_impl.cc
new file mode 100644
index 0000000000..fcdd45045b
--- /dev/null
+++ b/gr-digital/lib/costas_loop_cc_impl.cc
@@ -0,0 +1,161 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,2010-2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "costas_loop_cc_impl.h"
+#include <gr_io_signature.h>
+#include <gr_expj.h>
+#include <gr_sincos.h>
+#include <gr_math.h>
+
+namespace gr {
+ namespace digital {
+
+ costas_loop_cc::sptr
+ costas_loop_cc::make(float loop_bw, int order)
+ {
+ return gnuradio::get_initial_sptr
+ (new costas_loop_cc_impl(loop_bw, order));
+ }
+
+ costas_loop_cc_impl::costas_loop_cc_impl(float loop_bw, int order)
+ : gr_sync_block("costas_loop_cc",
+ gr_make_io_signature(1, 1, sizeof(gr_complex)),
+ gr_make_io_signature2(1, 2, sizeof(gr_complex), sizeof(float))),
+ blocks::control_loop(loop_bw, 1.0, -1.0),
+ d_order(order), d_phase_detector(NULL)
+ {
+ // Set up the phase detector to use based on the constellation order
+ switch(d_order) {
+ case 2:
+ d_phase_detector = &costas_loop_cc_impl::phase_detector_2;
+ break;
+
+ case 4:
+ d_phase_detector = &costas_loop_cc_impl::phase_detector_4;
+ break;
+
+ case 8:
+ d_phase_detector = &costas_loop_cc_impl::phase_detector_8;
+ break;
+
+ default:
+ throw std::invalid_argument("order must be 2, 4, or 8");
+ break;
+ }
+ }
+
+ costas_loop_cc_impl::~costas_loop_cc_impl()
+ {
+ }
+
+ float
+ costas_loop_cc_impl::phase_detector_8(gr_complex sample) const
+ {
+ /* This technique splits the 8PSK constellation into 2 squashed
+ QPSK constellations, one when I is larger than Q and one
+ where Q is larger than I. The error is then calculated
+ proportionally to these squashed constellations by the const
+ K = sqrt(2)-1.
+
+ The signal magnitude must be > 1 or K will incorrectly bias
+ the error value.
+
+ Ref: Z. Huang, Z. Yi, M. Zhang, K. Wang, "8PSK demodulation for
+ new generation DVB-S2", IEEE Proc. Int. Conf. Communications,
+ Circuits and Systems, Vol. 2, pp. 1447 - 1450, 2004.
+ */
+
+ float K = (sqrt(2.0) - 1);
+ if(fabsf(sample.real()) >= fabsf(sample.imag())) {
+ return ((sample.real()>0 ? 1.0 : -1.0) * sample.imag() -
+ (sample.imag()>0 ? 1.0 : -1.0) * sample.real() * K);
+ }
+ else {
+ return ((sample.real()>0 ? 1.0 : -1.0) * sample.imag() * K -
+ (sample.imag()>0 ? 1.0 : -1.0) * sample.real());
+ }
+ }
+
+ float
+ costas_loop_cc_impl::phase_detector_4(gr_complex sample) const
+ {
+ return ((sample.real()>0 ? 1.0 : -1.0) * sample.imag() -
+ (sample.imag()>0 ? 1.0 : -1.0) * sample.real());
+ }
+
+ float
+ costas_loop_cc_impl::phase_detector_2(gr_complex sample) const
+ {
+ return (sample.real()*sample.imag());
+ }
+
+ int
+ costas_loop_cc_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const gr_complex *iptr = (gr_complex *) input_items[0];
+ gr_complex *optr = (gr_complex *) output_items[0];
+ float *foptr = (float *) output_items[1];
+
+ bool write_foptr = output_items.size() >= 2;
+
+ float error;
+ gr_complex nco_out;
+
+ if(write_foptr) {
+ for(int i = 0; i < noutput_items; i++) {
+ nco_out = gr_expj(-d_phase);
+ optr[i] = iptr[i] * nco_out;
+
+ error = (*this.*d_phase_detector)(optr[i]);
+ error = gr_branchless_clip(error, 1.0);
+
+ advance_loop(error);
+ phase_wrap();
+ frequency_limit();
+
+ foptr[i] = d_freq;
+ }
+ }
+ else {
+ for(int i = 0; i < noutput_items; i++) {
+ nco_out = gr_expj(-d_phase);
+ optr[i] = iptr[i] * nco_out;
+
+ error = (*this.*d_phase_detector)(optr[i]);
+ error = gr_branchless_clip(error, 1.0);
+
+ advance_loop(error);
+ phase_wrap();
+ frequency_limit();
+ }
+ }
+ return noutput_items;
+ }
+
+ } /* namespace digital */
+} /* namespace gr */
diff --git a/gr-digital/lib/costas_loop_cc_impl.h b/gr-digital/lib/costas_loop_cc_impl.h
new file mode 100644
index 0000000000..d9756ea2f1
--- /dev/null
+++ b/gr-digital/lib/costas_loop_cc_impl.h
@@ -0,0 +1,70 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,2011,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef INCLUDED_DIGITAL_COSTAS_LOOP_CC_IMPL_H
+#define INCLUDED_DIGITAL_COSTAS_LOOP_CC_IMPL_H
+
+#include <digital/costas_loop_cc.h>
+#include <blocks/control_loop.h>
+
+namespace gr {
+ namespace digital {
+
+ class costas_loop_cc_impl : public costas_loop_cc, blocks::control_loop
+ {
+ private:
+ int d_order;
+
+ /*! \brief the phase detector circuit for 8th-order PSK loops
+ * \param sample complex sample
+ * \return the phase error
+ */
+ float phase_detector_8(gr_complex sample) const; // for 8PSK
+
+ /*! \brief the phase detector circuit for fourth-order loops
+ * \param sample complex sample
+ * \return the phase error
+ */
+ float phase_detector_4(gr_complex sample) const; // for QPSK
+
+ /*! \brief the phase detector circuit for second-order loops
+ * \param sample a complex sample
+ * \return the phase error
+ */
+ float phase_detector_2(gr_complex sample) const; // for BPSK
+
+ float (costas_loop_cc_impl::*d_phase_detector)(gr_complex sample) const;
+
+ public:
+ costas_loop_cc_impl(float loop_bw, int order);
+ ~costas_loop_cc_impl();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_DIGITAL_COSTAS_LOOP_CC_IMPL_H */
diff --git a/gr-digital/lib/cpmmod_bc_impl.cc b/gr-digital/lib/cpmmod_bc_impl.cc
new file mode 100644
index 0000000000..763a4cc1e2
--- /dev/null
+++ b/gr-digital/lib/cpmmod_bc_impl.cc
@@ -0,0 +1,125 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2010,2012 Free Software Foundation, Inc.
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "cpmmod_bc_impl.h"
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace digital {
+
+ cpmmod_bc::sptr
+ cpmmod_bc::make(analog::cpm::cpm_type type, float h,
+ int samples_per_sym,
+ int L, double beta)
+ {
+ return gnuradio::get_initial_sptr
+ (new cpmmod_bc_impl("cpmmod_bc",
+ (analog::cpm::cpm_type)type,
+ h, samples_per_sym,
+ L, beta));
+ }
+
+ cpmmod_bc::sptr
+ cpmmod_bc::make_gmskmod_bc(int samples_per_sym,
+ int L, double beta)
+ {
+ return gnuradio::get_initial_sptr
+ (new cpmmod_bc_impl("gmskmod_bc",
+ analog::cpm::GAUSSIAN, 0.5,
+ samples_per_sym,
+ L, beta));
+ }
+
+ cpmmod_bc_impl::cpmmod_bc_impl(const std::string &name,
+ analog::cpm::cpm_type type, float h,
+ int samples_per_sym,
+ int L, double beta)
+ : gr_hier_block2(name,
+ gr_make_io_signature(1, 1, sizeof(char)),
+ gr_make_io_signature2(1, 1, sizeof(gr_complex), sizeof(float))),
+ d_type(type), d_index(h), d_sps(samples_per_sym), d_length(L), d_beta(beta),
+ d_taps(analog::cpm::phase_response(type, samples_per_sym, L, beta)),
+ d_char_to_float(blocks::char_to_float::make()),
+ d_pulse_shaper(filter::interp_fir_filter_fff::make(samples_per_sym, d_taps)),
+ d_fm(analog::frequency_modulator_fc::make(M_PI * h))
+ {
+ switch(type) {
+ case analog::cpm::LRC:
+ case analog::cpm::LSRC:
+ case analog::cpm::LREC:
+ case analog::cpm::TFM:
+ case analog::cpm::GAUSSIAN:
+ break;
+
+ default:
+ throw std::invalid_argument("cpmmod_bc_impl: invalid CPM type");
+ }
+
+ connect(self(), 0, d_char_to_float, 0);
+ connect(d_char_to_float, 0, d_pulse_shaper, 0);
+ connect(d_pulse_shaper, 0, d_fm, 0);
+ connect(d_fm, 0, self(), 0);
+ }
+
+ cpmmod_bc_impl::~cpmmod_bc_impl()
+ {
+ }
+
+ std::vector<float>
+ cpmmod_bc_impl::taps() const
+ {
+ return d_taps;
+ }
+
+ int
+ cpmmod_bc_impl::type() const
+ {
+ return d_type;
+ }
+
+ float
+ cpmmod_bc_impl::index() const
+ {
+ return d_index;
+ }
+
+ int
+ cpmmod_bc_impl::samples_per_sym() const
+ {
+ return d_sps;
+ }
+
+ int
+ cpmmod_bc_impl::length() const
+ {
+ return d_length;
+ }
+
+ double cpmmod_bc_impl::beta() const
+ {
+ return d_beta;
+ }
+
+ } /* namespace digital */
+} /* namespace gr */
diff --git a/gr-digital/lib/cpmmod_bc_impl.h b/gr-digital/lib/cpmmod_bc_impl.h
new file mode 100644
index 0000000000..9cfec4959e
--- /dev/null
+++ b/gr-digital/lib/cpmmod_bc_impl.h
@@ -0,0 +1,68 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2010,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_DIGITAL_CPMMOD_BC_IMPL_H
+#define INCLUDED_DIGITAL_CPMMOD_BC_IMPL_H
+
+#include <digital/cpmmod_bc.h>
+#include <blocks/char_to_float.h>
+#include <analog/frequency_modulator_fc.h>
+#include <filter/interp_fir_filter_fff.h>
+
+namespace gr {
+ namespace digital {
+
+ class cpmmod_bc_impl : public cpmmod_bc
+ {
+ private:
+ int d_type;
+ float d_index;
+ int d_sps;
+ int d_length;
+ double d_beta;
+
+ protected:
+ std::vector<float> d_taps;
+ gr::blocks::char_to_float::sptr d_char_to_float;
+ gr::filter::interp_fir_filter_fff::sptr d_pulse_shaper;
+ analog::frequency_modulator_fc::sptr d_fm;
+
+ public:
+ cpmmod_bc_impl(const std::string &name,
+ analog::cpm::cpm_type type, float h,
+ int samples_per_sym,
+ int L, double beta=0.3);
+ ~cpmmod_bc_impl();
+
+ std::vector<float> taps() const;
+ int type() const;
+ float index() const;
+ int samples_per_sym() const;
+ int length() const;
+ double beta() const;
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_DIGITAL_CPMMOD_BC_IMPL_H */
+
diff --git a/gr-digital/lib/crc32.cc b/gr-digital/lib/crc32.cc
new file mode 100644
index 0000000000..b203727114
--- /dev/null
+++ b/gr-digital/lib/crc32.cc
@@ -0,0 +1,136 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,2011,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+/*
+ * See also ISO 3309 [ISO-3309] or ITU-T V.42 [ITU-V42] for a formal specification.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <digital/crc32.h>
+
+namespace gr {
+ namespace digital {
+
+ // Automatically generated CRC function
+ // polynomial: 0x104C11DB7
+ unsigned int
+ update_crc32(unsigned int crc, const unsigned char *data, size_t len)
+ {
+ static const unsigned int table[256] = {
+ 0x00000000U,0x04C11DB7U,0x09823B6EU,0x0D4326D9U,
+ 0x130476DCU,0x17C56B6BU,0x1A864DB2U,0x1E475005U,
+ 0x2608EDB8U,0x22C9F00FU,0x2F8AD6D6U,0x2B4BCB61U,
+ 0x350C9B64U,0x31CD86D3U,0x3C8EA00AU,0x384FBDBDU,
+ 0x4C11DB70U,0x48D0C6C7U,0x4593E01EU,0x4152FDA9U,
+ 0x5F15ADACU,0x5BD4B01BU,0x569796C2U,0x52568B75U,
+ 0x6A1936C8U,0x6ED82B7FU,0x639B0DA6U,0x675A1011U,
+ 0x791D4014U,0x7DDC5DA3U,0x709F7B7AU,0x745E66CDU,
+ 0x9823B6E0U,0x9CE2AB57U,0x91A18D8EU,0x95609039U,
+ 0x8B27C03CU,0x8FE6DD8BU,0x82A5FB52U,0x8664E6E5U,
+ 0xBE2B5B58U,0xBAEA46EFU,0xB7A96036U,0xB3687D81U,
+ 0xAD2F2D84U,0xA9EE3033U,0xA4AD16EAU,0xA06C0B5DU,
+ 0xD4326D90U,0xD0F37027U,0xDDB056FEU,0xD9714B49U,
+ 0xC7361B4CU,0xC3F706FBU,0xCEB42022U,0xCA753D95U,
+ 0xF23A8028U,0xF6FB9D9FU,0xFBB8BB46U,0xFF79A6F1U,
+ 0xE13EF6F4U,0xE5FFEB43U,0xE8BCCD9AU,0xEC7DD02DU,
+ 0x34867077U,0x30476DC0U,0x3D044B19U,0x39C556AEU,
+ 0x278206ABU,0x23431B1CU,0x2E003DC5U,0x2AC12072U,
+ 0x128E9DCFU,0x164F8078U,0x1B0CA6A1U,0x1FCDBB16U,
+ 0x018AEB13U,0x054BF6A4U,0x0808D07DU,0x0CC9CDCAU,
+ 0x7897AB07U,0x7C56B6B0U,0x71159069U,0x75D48DDEU,
+ 0x6B93DDDBU,0x6F52C06CU,0x6211E6B5U,0x66D0FB02U,
+ 0x5E9F46BFU,0x5A5E5B08U,0x571D7DD1U,0x53DC6066U,
+ 0x4D9B3063U,0x495A2DD4U,0x44190B0DU,0x40D816BAU,
+ 0xACA5C697U,0xA864DB20U,0xA527FDF9U,0xA1E6E04EU,
+ 0xBFA1B04BU,0xBB60ADFCU,0xB6238B25U,0xB2E29692U,
+ 0x8AAD2B2FU,0x8E6C3698U,0x832F1041U,0x87EE0DF6U,
+ 0x99A95DF3U,0x9D684044U,0x902B669DU,0x94EA7B2AU,
+ 0xE0B41DE7U,0xE4750050U,0xE9362689U,0xEDF73B3EU,
+ 0xF3B06B3BU,0xF771768CU,0xFA325055U,0xFEF34DE2U,
+ 0xC6BCF05FU,0xC27DEDE8U,0xCF3ECB31U,0xCBFFD686U,
+ 0xD5B88683U,0xD1799B34U,0xDC3ABDEDU,0xD8FBA05AU,
+ 0x690CE0EEU,0x6DCDFD59U,0x608EDB80U,0x644FC637U,
+ 0x7A089632U,0x7EC98B85U,0x738AAD5CU,0x774BB0EBU,
+ 0x4F040D56U,0x4BC510E1U,0x46863638U,0x42472B8FU,
+ 0x5C007B8AU,0x58C1663DU,0x558240E4U,0x51435D53U,
+ 0x251D3B9EU,0x21DC2629U,0x2C9F00F0U,0x285E1D47U,
+ 0x36194D42U,0x32D850F5U,0x3F9B762CU,0x3B5A6B9BU,
+ 0x0315D626U,0x07D4CB91U,0x0A97ED48U,0x0E56F0FFU,
+ 0x1011A0FAU,0x14D0BD4DU,0x19939B94U,0x1D528623U,
+ 0xF12F560EU,0xF5EE4BB9U,0xF8AD6D60U,0xFC6C70D7U,
+ 0xE22B20D2U,0xE6EA3D65U,0xEBA91BBCU,0xEF68060BU,
+ 0xD727BBB6U,0xD3E6A601U,0xDEA580D8U,0xDA649D6FU,
+ 0xC423CD6AU,0xC0E2D0DDU,0xCDA1F604U,0xC960EBB3U,
+ 0xBD3E8D7EU,0xB9FF90C9U,0xB4BCB610U,0xB07DABA7U,
+ 0xAE3AFBA2U,0xAAFBE615U,0xA7B8C0CCU,0xA379DD7BU,
+ 0x9B3660C6U,0x9FF77D71U,0x92B45BA8U,0x9675461FU,
+ 0x8832161AU,0x8CF30BADU,0x81B02D74U,0x857130C3U,
+ 0x5D8A9099U,0x594B8D2EU,0x5408ABF7U,0x50C9B640U,
+ 0x4E8EE645U,0x4A4FFBF2U,0x470CDD2BU,0x43CDC09CU,
+ 0x7B827D21U,0x7F436096U,0x7200464FU,0x76C15BF8U,
+ 0x68860BFDU,0x6C47164AU,0x61043093U,0x65C52D24U,
+ 0x119B4BE9U,0x155A565EU,0x18197087U,0x1CD86D30U,
+ 0x029F3D35U,0x065E2082U,0x0B1D065BU,0x0FDC1BECU,
+ 0x3793A651U,0x3352BBE6U,0x3E119D3FU,0x3AD08088U,
+ 0x2497D08DU,0x2056CD3AU,0x2D15EBE3U,0x29D4F654U,
+ 0xC5A92679U,0xC1683BCEU,0xCC2B1D17U,0xC8EA00A0U,
+ 0xD6AD50A5U,0xD26C4D12U,0xDF2F6BCBU,0xDBEE767CU,
+ 0xE3A1CBC1U,0xE760D676U,0xEA23F0AFU,0xEEE2ED18U,
+ 0xF0A5BD1DU,0xF464A0AAU,0xF9278673U,0xFDE69BC4U,
+ 0x89B8FD09U,0x8D79E0BEU,0x803AC667U,0x84FBDBD0U,
+ 0x9ABC8BD5U,0x9E7D9662U,0x933EB0BBU,0x97FFAD0CU,
+ 0xAFB010B1U,0xAB710D06U,0xA6322BDFU,0xA2F33668U,
+ 0xBCB4666DU,0xB8757BDAU,0xB5365D03U,0xB1F740B4U,
+ };
+
+ while(len > 0)
+ {
+ crc = table[*data ^ ((crc >> 24) & 0xff)] ^ (crc << 8);
+ data++;
+ len--;
+ }
+ return crc;
+ }
+
+ unsigned int
+ update_crc32(unsigned int crc, const std::string s)
+ {
+ return update_crc32(crc, (const unsigned char *)s.data(), s.size());
+ }
+
+ unsigned int
+ crc32(const unsigned char *buf, size_t len)
+ {
+ return update_crc32(0xffffffff, buf, len) ^ 0xffffffff;
+ }
+
+ unsigned int
+ crc32(const std::string s)
+ {
+ return crc32((const unsigned char *) s.data(), s.size());
+ }
+
+ } /* namespace digital */
+} /* namespace gr */
diff --git a/gr-digital/lib/descrambler_bb_impl.cc b/gr-digital/lib/descrambler_bb_impl.cc
new file mode 100644
index 0000000000..8124df37ef
--- /dev/null
+++ b/gr-digital/lib/descrambler_bb_impl.cc
@@ -0,0 +1,68 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2010,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "descrambler_bb_impl.h"
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace digital {
+
+ descrambler_bb::sptr
+ descrambler_bb::make(int mask, int seed, int len)
+ {
+ return gnuradio::get_initial_sptr
+ (new descrambler_bb_impl(mask, seed, len));
+ }
+
+ descrambler_bb_impl::descrambler_bb_impl(int mask, int seed, int len)
+ : gr_sync_block("descrambler_bb",
+ gr_make_io_signature(1, 1, sizeof(unsigned char)),
+ gr_make_io_signature(1, 1, sizeof(unsigned char))),
+ d_lfsr(mask, seed, len)
+ {
+ }
+
+ descrambler_bb_impl::~descrambler_bb_impl()
+ {
+ }
+
+ int
+ descrambler_bb_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const unsigned char *in = (const unsigned char*)input_items[0];
+ unsigned char *out = (unsigned char*)output_items[0];
+
+ for(int i = 0; i < noutput_items; i++) {
+ out[i] = d_lfsr.next_bit_descramble(in[i]);
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace digital */
+} /* namespace gr */
diff --git a/gr-digital/swig/digital_scrambler_bb.i b/gr-digital/lib/descrambler_bb_impl.h
index ac9abef920..4f07b7c329 100644
--- a/gr-digital/swig/digital_scrambler_bb.i
+++ b/gr-digital/lib/descrambler_bb_impl.h
@@ -20,11 +20,30 @@
* Boston, MA 02110-1301, USA.
*/
-GR_SWIG_BLOCK_MAGIC(digital,scrambler_bb);
+#ifndef INCLUDED_GR_DESCRAMBLER_BB_IMPL_H
+#define INCLUDED_GR_DESCRAMBLER_BB_IMPL_H
-digital_scrambler_bb_sptr
-digital_make_scrambler_bb(int mask, int seed, int len);
+#include <digital/descrambler_bb.h>
+#include <digital/lfsr.h>
-class digital_scrambler_bb : public gr_sync_block
-{
-};
+namespace gr {
+ namespace digital {
+
+ class descrambler_bb_impl : public descrambler_bb
+ {
+ private:
+ digital::lfsr d_lfsr;
+
+ public:
+ descrambler_bb_impl(int mask, int seed, int len);
+ ~descrambler_bb_impl();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_DESCRAMBLER_BB_IMPL_H */
diff --git a/gr-digital/lib/diff_decoder_bb_impl.cc b/gr-digital/lib/diff_decoder_bb_impl.cc
new file mode 100644
index 0000000000..74c247a830
--- /dev/null
+++ b/gr-digital/lib/diff_decoder_bb_impl.cc
@@ -0,0 +1,71 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,2010,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "diff_decoder_bb_impl.h"
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace digital {
+ diff_decoder_bb::sptr
+ diff_decoder_bb::make(unsigned int modulus)
+ {
+ return gnuradio::get_initial_sptr
+ (new diff_decoder_bb_impl(modulus));
+ }
+
+ diff_decoder_bb_impl::diff_decoder_bb_impl(unsigned int modulus)
+ : gr_sync_block("diff_decoder_bb",
+ gr_make_io_signature(1, 1, sizeof(unsigned char)),
+ gr_make_io_signature(1, 1, sizeof(unsigned char))),
+ d_modulus(modulus)
+ {
+ set_history(2); // need to look at two inputs
+ }
+
+ diff_decoder_bb_impl::~diff_decoder_bb_impl()
+ {
+ }
+
+ int
+ diff_decoder_bb_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const unsigned char *in = (const unsigned char*)input_items[0];
+ unsigned char *out = (unsigned char*)output_items[0];
+ in += 1; // ensure that in[-1] is valid
+
+ unsigned modulus = d_modulus;
+
+ for(int i = 0; i < noutput_items; i++) {
+ out[i] = (in[i] - in[i-1]) % modulus;
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace digital */
+} /* namespace gr */
diff --git a/gr-digital/swig/digital_diff_phasor_cc.i b/gr-digital/lib/diff_decoder_bb_impl.h
index b1e20eb997..56a15ba128 100644
--- a/gr-digital/swig/digital_diff_phasor_cc.i
+++ b/gr-digital/lib/diff_decoder_bb_impl.h
@@ -20,11 +20,30 @@
* Boston, MA 02110-1301, USA.
*/
-GR_SWIG_BLOCK_MAGIC(digital,diff_phasor_cc)
+#ifndef INCLUDED_GR_DIFF_DECODER_BB_IMPL_H
+#define INCLUDED_GR_DIFF_DECODER_BB_IMPL_H
-digital_diff_phasor_cc_sptr
-digital_make_diff_phasor_cc();
+#include <digital/diff_decoder_bb.h>
+#include <gr_sync_block.h>
-class digital_diff_phasor_cc : public gr_sync_block
-{
-};
+namespace gr {
+ namespace digital {
+
+ class diff_decoder_bb_impl : public diff_decoder_bb
+ {
+ public:
+ diff_decoder_bb_impl(unsigned int modulus);
+ ~diff_decoder_bb_impl();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ private:
+ unsigned int d_modulus;
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_DIFF_DECODER_BB_IMPL_H */
diff --git a/gr-digital/lib/diff_encoder_bb_impl.cc b/gr-digital/lib/diff_encoder_bb_impl.cc
new file mode 100644
index 0000000000..411efe006c
--- /dev/null
+++ b/gr-digital/lib/diff_encoder_bb_impl.cc
@@ -0,0 +1,73 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,2010,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "diff_encoder_bb_impl.h"
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace digital {
+
+ diff_encoder_bb::sptr
+ diff_encoder_bb::make(unsigned int modulus)
+ {
+ return gnuradio::get_initial_sptr
+ (new diff_encoder_bb_impl(modulus));
+ }
+
+ diff_encoder_bb_impl::diff_encoder_bb_impl(unsigned int modulus)
+ : gr_sync_block("diff_encoder_bb",
+ gr_make_io_signature(1, 1, sizeof(unsigned char)),
+ gr_make_io_signature(1, 1, sizeof(unsigned char))),
+ d_last_out(0), d_modulus(modulus)
+ {
+ }
+
+ diff_encoder_bb_impl::~diff_encoder_bb_impl()
+ {
+ }
+
+ int
+ diff_encoder_bb_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const unsigned char *in = (const unsigned char*)input_items[0];
+ unsigned char *out = (unsigned char*)output_items[0];
+
+ unsigned last_out = d_last_out;
+ unsigned modulus = d_modulus;
+
+ for(int i = 0; i < noutput_items; i++) {
+ out[i] = (in[i] + last_out) % modulus;
+ last_out = out[i];
+ }
+
+ d_last_out = last_out;
+ return noutput_items;
+ }
+
+ } /* namespace digital */
+} /* namespace gr */
diff --git a/gr-digital/swig/digital_diff_encoder_bb.i b/gr-digital/lib/diff_encoder_bb_impl.h
index 45a4589bf1..e088d79f86 100644
--- a/gr-digital/swig/digital_diff_encoder_bb.i
+++ b/gr-digital/lib/diff_encoder_bb_impl.h
@@ -20,11 +20,30 @@
* Boston, MA 02110-1301, USA.
*/
-GR_SWIG_BLOCK_MAGIC(digital,diff_encoder_bb)
+#ifndef INCLUDED_GR_DIFF_ENCODER_BB_IMPL_H
+#define INCLUDED_GR_DIFF_ENCODER_BB_IMPL_H
-digital_diff_encoder_bb_sptr
-digital_make_diff_encoder_bb(unsigned int modulus);
+#include <digital/diff_encoder_bb.h>
-class digital_diff_encoder_bb : public gr_sync_block
-{
-};
+namespace gr {
+ namespace digital {
+
+ class diff_encoder_bb_impl : public diff_encoder_bb
+ {
+ public:
+ diff_encoder_bb_impl(unsigned int modulus);
+ ~diff_encoder_bb_impl();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ private:
+ unsigned int d_last_out;
+ unsigned int d_modulus;
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_DIFF_ENCODER_BB_IMPL_H */
diff --git a/gr-digital/lib/digital_diff_phasor_cc.cc b/gr-digital/lib/diff_phasor_cc_impl.cc
index 8313a4de89..0e7a108121 100644
--- a/gr-digital/lib/digital_diff_phasor_cc.cc
+++ b/gr-digital/lib/diff_phasor_cc_impl.cc
@@ -24,38 +24,46 @@
#include "config.h"
#endif
-#include <digital_diff_phasor_cc.h>
+#include "diff_phasor_cc_impl.h"
#include <gr_io_signature.h>
-digital_diff_phasor_cc_sptr
-digital_make_diff_phasor_cc ()
-{
- return gnuradio::get_initial_sptr(new digital_diff_phasor_cc());
-}
+namespace gr {
+ namespace digital {
-digital_diff_phasor_cc::digital_diff_phasor_cc ()
- : gr_sync_block ("diff_phasor_cc",
- gr_make_io_signature (1, 1, sizeof (gr_complex)),
- gr_make_io_signature (1, 1, sizeof (gr_complex)))
-{
- set_history(2);
-}
+ diff_phasor_cc::sptr
+ diff_phasor_cc::make()
+ {
+ return gnuradio::get_initial_sptr
+ (new diff_phasor_cc_impl());
+ }
+ diff_phasor_cc_impl::diff_phasor_cc_impl()
+ : gr_sync_block("diff_phasor_cc",
+ gr_make_io_signature(1, 1, sizeof(gr_complex)),
+ gr_make_io_signature(1, 1, sizeof(gr_complex)))
+ {
+ set_history(2);
+ }
-digital_diff_phasor_cc::~digital_diff_phasor_cc(){}
+ diff_phasor_cc_impl::~diff_phasor_cc_impl()
+ {
+ }
-int
-digital_diff_phasor_cc::work (int noutput_items,
+ int
+ diff_phasor_cc_impl::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
-{
- gr_complex const *in = (const gr_complex *) input_items[0];
- gr_complex *out = (gr_complex *) output_items[0];
- in += 1; // ensure that i - 1 is valid.
+ {
+ gr_complex const *in = (const gr_complex*)input_items[0];
+ gr_complex *out = (gr_complex*)output_items[0];
+ in += 1; // ensure that i - 1 is valid.
- for(int i = 0; i < noutput_items; i++) {
- out[i] = in[i] * conj(in[i-1]);
- }
+ for(int i = 0; i < noutput_items; i++) {
+ out[i] = in[i] * conj(in[i-1]);
+ }
- return noutput_items;
-}
+ return noutput_items;
+ }
+
+ } /* namespace digital */
+} /* namespace gr */
diff --git a/gr-digital/swig/digital_map_bb.i b/gr-digital/lib/diff_phasor_cc_impl.h
index 50117d4f58..844fc826d8 100644
--- a/gr-digital/swig/digital_map_bb.i
+++ b/gr-digital/lib/diff_phasor_cc_impl.h
@@ -20,12 +20,27 @@
* Boston, MA 02110-1301, USA.
*/
-GR_SWIG_BLOCK_MAGIC(digital,map_bb);
+#ifndef INCLUDED_GR_DIFF_PHASOR_CC_IMPL_H
+#define INCLUDED_GR_DIFF_PHASOR_CC_IMPL_H
-digital_map_bb_sptr
-digital_make_map_bb(const std::vector<int> &map);
+#include <digital/diff_phasor_cc.h>
+#include <gr_sync_block.h>
-class digital_map_bb : public gr_sync_block
-{
-};
+namespace gr {
+ namespace digital {
+ class diff_phasor_cc_impl : public diff_phasor_cc
+ {
+ public:
+ diff_phasor_cc_impl();
+ ~diff_phasor_cc_impl();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_DIFF_PHASOR_CC_IMPL_H */
diff --git a/gr-digital/lib/digital_additive_scrambler_bb.cc b/gr-digital/lib/digital_additive_scrambler_bb.cc
deleted file mode 100644
index a8affaa78f..0000000000
--- a/gr-digital/lib/digital_additive_scrambler_bb.cc
+++ /dev/null
@@ -1,69 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2008,2010,2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <digital_additive_scrambler_bb.h>
-#include <gr_io_signature.h>
-
-digital_additive_scrambler_bb_sptr
-digital_make_additive_scrambler_bb(int mask, int seed, int len, int count)
-{
- return gnuradio::get_initial_sptr(new digital_additive_scrambler_bb
- (mask, seed, len, count));
-}
-
-digital_additive_scrambler_bb::digital_additive_scrambler_bb(int mask,
- int seed,
- int len,
- int count)
- : gr_sync_block("additive_scrambler_bb",
- gr_make_io_signature (1, 1, sizeof (unsigned char)),
- gr_make_io_signature (1, 1, sizeof (unsigned char))),
- d_lfsr(mask, seed, len),
- d_count(count),
- d_bits(0)
-{
-}
-
-int
-digital_additive_scrambler_bb::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- const unsigned char *in = (const unsigned char *) input_items[0];
- unsigned char *out = (unsigned char *) output_items[0];
-
- for (int i = 0; i < noutput_items; i++) {
- out[i] = in[i]^d_lfsr.next_bit();
- if (d_count > 0) {
- if (++d_bits == d_count) {
- d_lfsr.reset();
- d_bits = 0;
- }
- }
- }
-
- return noutput_items;
-}
diff --git a/gr-digital/lib/digital_bytes_to_syms.cc b/gr-digital/lib/digital_bytes_to_syms.cc
deleted file mode 100644
index f8bd82d5b8..0000000000
--- a/gr-digital/lib/digital_bytes_to_syms.cc
+++ /dev/null
@@ -1,74 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2010,2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <digital_bytes_to_syms.h>
-#include <gr_io_signature.h>
-#include <assert.h>
-
-static const int BITS_PER_BYTE = 8;
-
-digital_bytes_to_syms_sptr
-digital_make_bytes_to_syms ()
-{
- return gnuradio::get_initial_sptr(new digital_bytes_to_syms ());
-}
-
-digital_bytes_to_syms::digital_bytes_to_syms ()
- : gr_sync_interpolator ("bytes_to_syms",
- gr_make_io_signature (1, 1, sizeof (unsigned char)),
- gr_make_io_signature (1, 1, sizeof (float)),
- BITS_PER_BYTE)
-{
-}
-
-int
-digital_bytes_to_syms::work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- const unsigned char *in = (unsigned char *) input_items[0];
- float *out = (float *) output_items[0];
-
- assert (noutput_items % BITS_PER_BYTE == 0);
-
- for (int i = 0; i < noutput_items / BITS_PER_BYTE; i++) {
- int x = in[i];
-
- *out++ = (((x >> 7) & 0x1) << 1) - 1;
- *out++ = (((x >> 6) & 0x1) << 1) - 1;
- *out++ = (((x >> 5) & 0x1) << 1) - 1;
- *out++ = (((x >> 4) & 0x1) << 1) - 1;
- *out++ = (((x >> 3) & 0x1) << 1) - 1;
- *out++ = (((x >> 2) & 0x1) << 1) - 1;
- *out++ = (((x >> 1) & 0x1) << 1) - 1;
- *out++ = (((x >> 0) & 0x1) << 1) - 1;
- }
-
- return noutput_items;
-}
-
-
-
diff --git a/gr-digital/lib/digital_chunks_to_symbols_XX.cc.t b/gr-digital/lib/digital_chunks_to_symbols_XX.cc.t
deleted file mode 100644
index 399a474a62..0000000000
--- a/gr-digital/lib/digital_chunks_to_symbols_XX.cc.t
+++ /dev/null
@@ -1,74 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2010,2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-// @WARNING@
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <@NAME@.h>
-#include <gr_io_signature.h>
-#include <assert.h>
-#include <iostream>
-#include <string.h>
-
-@SPTR_NAME@
-digital_make_@BASE_NAME@ (const std::vector<@O_TYPE@> &symbol_table, const int D)
-{
- return gnuradio::get_initial_sptr (new @NAME@ (symbol_table,D));
-}
-
-@NAME@::@NAME@ (const std::vector<@O_TYPE@> &symbol_table, const int D)
- : gr_sync_interpolator ("@BASE_NAME@",
- gr_make_io_signature (1, -1, sizeof (@I_TYPE@)),
- gr_make_io_signature (1, -1, sizeof (@O_TYPE@)),
- D),
- d_D (D),
- d_symbol_table (symbol_table)
-{
-}
-
-int
-@NAME@::work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- assert (noutput_items % d_D == 0);
- assert (input_items.size() == output_items.size());
- int nstreams = input_items.size();
-
- for (int m=0;m<nstreams;m++) {
- const @I_TYPE@ *in = (@I_TYPE@ *) input_items[m];
- @O_TYPE@ *out = (@O_TYPE@ *) output_items[m];
-
- // per stream processing
- for (int i = 0; i < noutput_items / d_D; i++){
- assert (((unsigned int)in[i]*d_D+d_D) <= d_symbol_table.size());
- memcpy(out, &d_symbol_table[(unsigned int)in[i]*d_D], d_D*sizeof(@O_TYPE@));
- out+=d_D;
- }
- // end of per stream processing
-
- }
- return noutput_items;
-}
diff --git a/gr-digital/lib/digital_clock_recovery_mm_cc.cc b/gr-digital/lib/digital_clock_recovery_mm_cc.cc
deleted file mode 100644
index 198eb4b890..0000000000
--- a/gr-digital/lib/digital_clock_recovery_mm_cc.cc
+++ /dev/null
@@ -1,217 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2005,2006,2010,2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gr_io_signature.h>
-#include <gr_prefs.h>
-#include <digital_clock_recovery_mm_cc.h>
-#include <gri_mmse_fir_interpolator_cc.h>
-#include <stdexcept>
-#include <cstdio>
-
-
-// Public constructor
-static const int FUDGE = 16;
-
-digital_clock_recovery_mm_cc_sptr
-digital_make_clock_recovery_mm_cc(float omega, float gain_omega,
- float mu, float gain_mu,
- float omega_relative_limit)
-{
- return gnuradio::get_initial_sptr(new digital_clock_recovery_mm_cc (omega,
- gain_omega,
- mu,
- gain_mu,
- omega_relative_limit));
-}
-
-digital_clock_recovery_mm_cc::digital_clock_recovery_mm_cc (float omega, float gain_omega,
- float mu, float gain_mu,
- float omega_relative_limit)
- : gr_block ("clock_recovery_mm_cc",
- gr_make_io_signature (1, 1, sizeof (gr_complex)),
- gr_make_io_signature2 (1, 2, sizeof (gr_complex), sizeof(float))),
- d_mu (mu), d_omega(omega), d_gain_omega(gain_omega),
- d_omega_relative_limit(omega_relative_limit),
- d_gain_mu(gain_mu), d_last_sample(0), d_interp(new gri_mmse_fir_interpolator_cc()),
- d_verbose(gr_prefs::singleton()->get_bool("clock_recovery_mm_cc", "verbose", false)),
- d_p_2T(0), d_p_1T(0), d_p_0T(0), d_c_2T(0), d_c_1T(0), d_c_0T(0)
-{
- if (omega <= 0.0)
- throw std::out_of_range ("clock rate must be > 0");
- if (gain_mu < 0 || gain_omega < 0)
- throw std::out_of_range ("Gains must be non-negative");
-
- set_omega(omega); // also sets min and max omega
- set_relative_rate (1.0 / omega);
- set_history(3); // ensure 2 extra input sample is available
-}
-
-digital_clock_recovery_mm_cc::~digital_clock_recovery_mm_cc ()
-{
- delete d_interp;
-}
-
-void
-digital_clock_recovery_mm_cc::forecast(int noutput_items, gr_vector_int &ninput_items_required)
-{
- unsigned ninputs = ninput_items_required.size();
- for (unsigned i=0; i < ninputs; i++)
- ninput_items_required[i] =
- (int) ceil((noutput_items * d_omega) + d_interp->ntaps()) + FUDGE;
-}
-
-gr_complex
-digital_clock_recovery_mm_cc::slicer_0deg (gr_complex sample)
-{
- float real=0, imag=0;
-
- if(sample.real() > 0)
- real = 1;
- if(sample.imag() > 0)
- imag = 1;
- return gr_complex(real,imag);
-}
-
-gr_complex
-digital_clock_recovery_mm_cc::slicer_45deg (gr_complex sample)
-{
- float real= -1, imag = -1;
- if(sample.real() > 0)
- real=1;
- if(sample.imag() > 0)
- imag = 1;
- return gr_complex(real,imag);
-}
-
-/*
- Modified Mueller and Muller clock recovery circuit
- Based:
- G. R. Danesfahani, T.G. Jeans, "Optimisation of modified Mueller and Muller
- algorithm," Electronics Letters, Vol. 31, no. 13, 22 June 1995, pp. 1032 - 1033.
-*/
-
-int
-digital_clock_recovery_mm_cc::general_work (int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- const gr_complex *in = (const gr_complex *) input_items[0];
- gr_complex *out = (gr_complex *) output_items[0];
- float *foptr = (float *) output_items[1];
-
- bool write_foptr = output_items.size() >= 2;
-
- int ii = 0; // input index
- int oo = 0; // output index
- int ni = ninput_items[0] - d_interp->ntaps() - FUDGE; // don't use more input than this
-
- assert(d_mu >= 0.0);
- assert(d_mu <= 1.0);
-
- float mm_val=0;
- gr_complex u, x, y;
-
- // This loop writes the error to the second output, if it exists
- if (write_foptr) {
- while(oo < noutput_items && ii < ni) {
- d_p_2T = d_p_1T;
- d_p_1T = d_p_0T;
- d_p_0T = d_interp->interpolate (&in[ii], d_mu);
-
- d_c_2T = d_c_1T;
- d_c_1T = d_c_0T;
- d_c_0T = slicer_0deg(d_p_0T);
-
- x = (d_c_0T - d_c_2T) * conj(d_p_1T);
- y = (d_p_0T - d_p_2T) * conj(d_c_1T);
- u = y - x;
- mm_val = u.real();
- out[oo++] = d_p_0T;
-
- // limit mm_val
- mm_val = gr_branchless_clip(mm_val,4.0);
- d_omega = d_omega + d_gain_omega * mm_val;
- d_omega = d_omega_mid + gr_branchless_clip(d_omega-d_omega_mid, d_omega_relative_limit); // make sure we don't walk away
-
- d_mu = d_mu + d_omega + d_gain_mu * mm_val;
- ii += (int)floor(d_mu);
- d_mu -= floor(d_mu);
-
- // write the error signal to the second output
- foptr[oo-1] = mm_val;
-
- if (ii < 0) // clamp it. This should only happen with bogus input
- ii = 0;
- }
- }
- // This loop does not write to the second output (ugly, but faster)
- else {
- while(oo < noutput_items && ii < ni) {
- d_p_2T = d_p_1T;
- d_p_1T = d_p_0T;
- d_p_0T = d_interp->interpolate (&in[ii], d_mu);
-
- d_c_2T = d_c_1T;
- d_c_1T = d_c_0T;
- d_c_0T = slicer_0deg(d_p_0T);
-
- x = (d_c_0T - d_c_2T) * conj(d_p_1T);
- y = (d_p_0T - d_p_2T) * conj(d_c_1T);
- u = y - x;
- mm_val = u.real();
- out[oo++] = d_p_0T;
-
- // limit mm_val
- mm_val = gr_branchless_clip(mm_val,1.0);
-
- d_omega = d_omega + d_gain_omega * mm_val;
- d_omega = d_omega_mid + gr_branchless_clip(d_omega-d_omega_mid, d_omega_relative_limit); // make sure we don't walk away
-
- d_mu = d_mu + d_omega + d_gain_mu * mm_val;
- ii += (int)floor(d_mu);
- d_mu -= floor(d_mu);
-
- if(d_verbose) {
- printf("%f\t%f\n", d_omega, d_mu);
- }
-
- if (ii < 0) // clamp it. This should only happen with bogus input
- ii = 0;
- }
- }
-
- if (ii > 0){
- if (ii > ninput_items[0]){
- fprintf(stderr, "gr_clock_recovery_mm_cc: ii > ninput_items[0] (%d > %d)\n",
- ii, ninput_items[0]);
- assert(0);
- }
- consume_each (ii);
- }
-
- return oo;
-}
diff --git a/gr-digital/lib/digital_clock_recovery_mm_ff.cc b/gr-digital/lib/digital_clock_recovery_mm_ff.cc
deleted file mode 100644
index 04057f0e94..0000000000
--- a/gr-digital/lib/digital_clock_recovery_mm_ff.cc
+++ /dev/null
@@ -1,139 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2010,2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gr_io_signature.h>
-#include <digital_clock_recovery_mm_ff.h>
-#include <gri_mmse_fir_interpolator.h>
-#include <stdexcept>
-
-#define DEBUG_CR_MM_FF 0 // must be defined as 0 or 1
-
-// Public constructor
-
-digital_clock_recovery_mm_ff_sptr
-digital_make_clock_recovery_mm_ff(float omega, float gain_omega,
- float mu, float gain_mu,
- float omega_relative_limit)
-{
- return gnuradio::get_initial_sptr(new digital_clock_recovery_mm_ff (omega,
- gain_omega,
- mu,
- gain_mu,
- omega_relative_limit));
-}
-
-digital_clock_recovery_mm_ff::digital_clock_recovery_mm_ff (float omega, float gain_omega,
- float mu, float gain_mu,
- float omega_relative_limit)
- : gr_block ("clock_recovery_mm_ff",
- gr_make_io_signature (1, 1, sizeof (float)),
- gr_make_io_signature (1, 1, sizeof (float))),
- d_mu (mu), d_gain_omega(gain_omega), d_gain_mu(gain_mu),
- d_last_sample(0), d_interp(new gri_mmse_fir_interpolator()),
- d_logfile(0), d_omega_relative_limit(omega_relative_limit)
-{
- if (omega < 1)
- throw std::out_of_range ("clock rate must be > 0");
- if (gain_mu < 0 || gain_omega < 0)
- throw std::out_of_range ("Gains must be non-negative");
-
- set_omega(omega); // also sets min and max omega
- set_relative_rate (1.0 / omega);
-
- if (DEBUG_CR_MM_FF)
- d_logfile = fopen("cr_mm_ff.dat", "wb");
-}
-
-digital_clock_recovery_mm_ff::~digital_clock_recovery_mm_ff ()
-{
- delete d_interp;
-
- if (DEBUG_CR_MM_FF && d_logfile){
- fclose(d_logfile);
- d_logfile = 0;
- }
-}
-
-void
-digital_clock_recovery_mm_ff::forecast(int noutput_items, gr_vector_int &ninput_items_required)
-{
- unsigned ninputs = ninput_items_required.size();
- for (unsigned i=0; i < ninputs; i++)
- ninput_items_required[i] =
- (int) ceil((noutput_items * d_omega) + d_interp->ntaps());
-}
-
-static inline float
-slice(float x)
-{
- return x < 0 ? -1.0F : 1.0F;
-}
-
-/*
- * This implements the Mueller and Müller (M&M) discrete-time error-tracking synchronizer.
- *
- * See "Digital Communication Receivers: Synchronization, Channel
- * Estimation and Signal Processing" by Heinrich Meyr, Marc Moeneclaey, & Stefan Fechtel.
- * ISBN 0-471-50275-8.
- */
-int
-digital_clock_recovery_mm_ff::general_work (int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- const float *in = (const float *) input_items[0];
- float *out = (float *) output_items[0];
-
- int ii = 0; // input index
- int oo = 0; // output index
- int ni = ninput_items[0] - d_interp->ntaps(); // don't use more input than this
- float mm_val;
-
- while (oo < noutput_items && ii < ni ){
-
- // produce output sample
- out[oo] = d_interp->interpolate (&in[ii], d_mu);
- mm_val = slice(d_last_sample) * out[oo] - slice(out[oo]) * d_last_sample;
- d_last_sample = out[oo];
-
- d_omega = d_omega + d_gain_omega * mm_val;
- d_omega = d_omega_mid + gr_branchless_clip(d_omega-d_omega_mid, d_omega_relative_limit); // make sure we don't walk away
- d_mu = d_mu + d_omega + d_gain_mu * mm_val;
-
- ii += (int) floor(d_mu);
- d_mu = d_mu - floor(d_mu);
- oo++;
-
- if (DEBUG_CR_MM_FF && d_logfile){
- fwrite(&d_omega, sizeof(d_omega), 1, d_logfile);
- }
- }
-
- consume_each (ii);
-
- return oo;
-}
diff --git a/gr-digital/lib/digital_cma_equalizer_cc.cc b/gr-digital/lib/digital_cma_equalizer_cc.cc
deleted file mode 100644
index c6c46c2d8c..0000000000
--- a/gr-digital/lib/digital_cma_equalizer_cc.cc
+++ /dev/null
@@ -1,46 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <digital_cma_equalizer_cc.h>
-#include <cstdio>
-
-digital_cma_equalizer_cc_sptr
-digital_make_cma_equalizer_cc(int num_taps, float modulus, float mu, int sps)
-{
- return gnuradio::get_initial_sptr(new digital_cma_equalizer_cc(num_taps, modulus,
- mu, sps));
-}
-
-digital_cma_equalizer_cc::digital_cma_equalizer_cc(int num_taps, float modulus,
- float mu, int sps)
- : gr_adaptive_fir_ccc("cma_equalizer_cc", sps,
- std::vector<gr_complex>(num_taps, gr_complex(0,0)))
-{
- set_modulus(modulus);
- set_gain(mu);
- if (num_taps > 0)
- d_taps[0] = 1.0;
-}
diff --git a/gr-digital/lib/digital_constellation.cc b/gr-digital/lib/digital_constellation.cc
deleted file mode 100644
index 0d4b88b047..0000000000
--- a/gr-digital/lib/digital_constellation.cc
+++ /dev/null
@@ -1,596 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2010, 2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gr_io_signature.h>
-#include <digital_constellation.h>
-#include <digital_metric_type.h>
-#include <gr_math.h>
-#include <gr_complex.h>
-#include <math.h>
-#include <iostream>
-#include <stdlib.h>
-#include <float.h>
-#include <stdexcept>
-
-#define M_TWOPI (2*M_PI)
-#define SQRT_TWO 0.707107
-
-// Base Constellation Class
-
-digital_constellation::digital_constellation (std::vector<gr_complex> constellation,
- std::vector<unsigned int> pre_diff_code,
- unsigned int rotational_symmetry,
- unsigned int dimensionality) :
- d_constellation(constellation),
- d_pre_diff_code(pre_diff_code),
- d_rotational_symmetry(rotational_symmetry),
- d_dimensionality(dimensionality)
-{
- // Scale constellation points so that average magnitude is 1.
- float summed_mag = 0;
- unsigned int constsize = d_constellation.size();
- for (unsigned int i=0; i<constsize; i++) {
- gr_complex c = d_constellation[i];
- summed_mag += sqrt(c.real()*c.real() + c.imag()*c.imag());
- }
- d_scalefactor = constsize/summed_mag;
- for (unsigned int i=0; i<constsize; i++) {
- d_constellation[i] = d_constellation[i]*d_scalefactor;
- }
- if (pre_diff_code.size() == 0)
- d_apply_pre_diff_code = false;
- else if (pre_diff_code.size() != constellation.size())
- throw std::runtime_error ("The constellation and pre-diff code must be of the same length.");
- else
- d_apply_pre_diff_code = true;
- calc_arity();
-}
-
-digital_constellation::digital_constellation () :
- d_apply_pre_diff_code(false),
- d_rotational_symmetry(0),
- d_dimensionality(1)
-{
- calc_arity();
-}
-
-//! Returns the constellation points for a symbol value
-void
-digital_constellation::map_to_points(unsigned int value, gr_complex *points)
-{
- for (unsigned int i=0; i<d_dimensionality; i++)
- points[i] = d_constellation[value*d_dimensionality + i];
-}
-
-std::vector<gr_complex>
-digital_constellation::map_to_points_v(unsigned int value)
-{
- std::vector<gr_complex> points_v;
- points_v.resize(d_dimensionality);
- map_to_points(value, &(points_v[0]));
- return points_v;
-}
-
-float
-digital_constellation::get_distance(unsigned int index, const gr_complex *sample)
-{
- float dist = 0;
- for (unsigned int i=0; i<d_dimensionality; i++) {
- dist += norm(sample[i] - d_constellation[index*d_dimensionality + i]);
- }
- return dist;
-}
-
-unsigned int
-digital_constellation::get_closest_point(const gr_complex *sample)
-{
- unsigned int min_index = 0;
- float min_euclid_dist;
- float euclid_dist;
-
- min_euclid_dist = get_distance(0, sample);
- min_index = 0;
- for (unsigned int j = 1; j < d_arity; j++){
- euclid_dist = get_distance(j, sample);
- if (euclid_dist < min_euclid_dist){
- min_euclid_dist = euclid_dist;
- min_index = j;
- }
- }
- return min_index;
-}
-
-unsigned int
-digital_constellation::decision_maker_pe(const gr_complex *sample, float *phase_error)
-{
- unsigned int index = decision_maker(sample);
- *phase_error = 0;
- for (unsigned int d=0; d<d_dimensionality; d++)
- *phase_error += -arg(sample[d]*conj(d_constellation[index+d]));
- return index;
-}
-
-/*
-unsigned int digital_constellation::decision_maker_e(const gr_complex *sample, float *error)
-{
- unsigned int index = decision_maker(sample);
- *error = 0;
- for (unsigned int d=0; d<d_dimensionality; d++)
- *error += sample[d]*conj(d_constellation[index+d]);
- return index;
-}
-*/
-
-std::vector<gr_complex> digital_constellation::s_points () {
- if (d_dimensionality != 1)
- throw std::runtime_error ("s_points only works for dimensionality 1 constellations.");
- else
- return d_constellation;
-}
-
-std::vector<std::vector<gr_complex> >
-digital_constellation::v_points ()
-{
- std::vector<std::vector<gr_complex> > vv_const;
- vv_const.resize(d_arity);
- for (unsigned int p=0; p<d_arity; p++) {
- std::vector<gr_complex> v_const;
- v_const.resize(d_dimensionality);
- for (unsigned int d=0; d<d_dimensionality; d++) {
- v_const[d] = d_constellation[p*d_dimensionality+d];
- }
- vv_const[p] = v_const;
- }
- return vv_const;
-}
-
-void
-digital_constellation::calc_metric(const gr_complex *sample, float *metric,
- trellis_metric_type_t type)
-{
- switch (type){
- case TRELLIS_EUCLIDEAN:
- calc_euclidean_metric(sample, metric);
- break;
- case TRELLIS_HARD_SYMBOL:
- calc_hard_symbol_metric(sample, metric);
- break;
- case TRELLIS_HARD_BIT:
- throw std::runtime_error ("Invalid metric type (not yet implemented).");
- break;
- default:
- throw std::runtime_error ("Invalid metric type.");
- }
-}
-
-void
-digital_constellation::calc_euclidean_metric(const gr_complex *sample, float *metric)
-{
- for (unsigned int o=0; o<d_arity; o++) {
- metric[o] = get_distance(o, sample);
- }
-}
-
-void
-digital_constellation::calc_hard_symbol_metric(const gr_complex *sample, float *metric)
-{
- float minm = FLT_MAX;
- unsigned int minmi = 0;
- for (unsigned int o=0; o<d_arity; o++) {
- float dist = get_distance(o, sample);
- if (dist < minm) {
- minm = dist;
- minmi = o;
- }
- }
- for(unsigned int o=0; o<d_arity; o++) {
- metric[o] = (o==minmi?0.0:1.0);
- }
-}
-
-void
-digital_constellation::calc_arity ()
-{
- if (d_constellation.size() % d_dimensionality != 0)
- throw std::runtime_error ("Constellation vector size must be a multiple of the dimensionality.");
- d_arity = d_constellation.size()/d_dimensionality;
-}
-
-unsigned int
-digital_constellation::decision_maker_v (std::vector<gr_complex> sample)
-{
- assert(sample.size() == d_dimensionality);
- return decision_maker (&(sample[0]));
-}
-
-digital_constellation_calcdist_sptr
-digital_make_constellation_calcdist(std::vector<gr_complex> constellation,
- std::vector<unsigned int> pre_diff_code,
- unsigned int rotational_symmetry,
- unsigned int dimensionality)
-{
- return digital_constellation_calcdist_sptr(new digital_constellation_calcdist
- (constellation, pre_diff_code,
- rotational_symmetry, dimensionality));
-}
-
-digital_constellation_calcdist::digital_constellation_calcdist(std::vector<gr_complex> constellation,
- std::vector<unsigned int> pre_diff_code,
- unsigned int rotational_symmetry,
- unsigned int dimensionality) :
- digital_constellation(constellation, pre_diff_code, rotational_symmetry, dimensionality)
-{}
-
-// Chooses points base on shortest distance.
-// Inefficient.
-unsigned int
-digital_constellation_calcdist::decision_maker(const gr_complex *sample)
-{
- return get_closest_point(sample);
-}
-
-digital_constellation_sector::digital_constellation_sector (std::vector<gr_complex> constellation,
- std::vector<unsigned int> pre_diff_code,
- unsigned int rotational_symmetry,
- unsigned int dimensionality,
- unsigned int n_sectors) :
- digital_constellation(constellation, pre_diff_code, rotational_symmetry, dimensionality),
- n_sectors(n_sectors)
-{
-}
-
-unsigned int
-digital_constellation_sector::decision_maker (const gr_complex *sample)
-{
- unsigned int sector;
- sector = get_sector(sample);
- return sector_values[sector];
-}
-
-void
-digital_constellation_sector::find_sector_values ()
-{
- unsigned int i;
- sector_values.clear();
- for (i=0; i<n_sectors; i++) {
- sector_values.push_back(calc_sector_value(i));
- }
-}
-
-digital_constellation_rect_sptr
-digital_make_constellation_rect(std::vector<gr_complex> constellation,
- std::vector<unsigned int> pre_diff_code,
- unsigned int rotational_symmetry,
- unsigned int real_sectors, unsigned int imag_sectors,
- float width_real_sectors, float width_imag_sectors)
-{
- return digital_constellation_rect_sptr(new digital_constellation_rect
- (constellation, pre_diff_code,
- rotational_symmetry,
- real_sectors, imag_sectors,
- width_real_sectors,
- width_imag_sectors));
- }
-
-digital_constellation_rect::digital_constellation_rect (std::vector<gr_complex> constellation,
- std::vector<unsigned int> pre_diff_code,
- unsigned int rotational_symmetry,
- unsigned int real_sectors, unsigned int imag_sectors,
- float width_real_sectors, float width_imag_sectors) :
- digital_constellation_sector(constellation, pre_diff_code, rotational_symmetry, 1, real_sectors * imag_sectors),
- n_real_sectors(real_sectors), n_imag_sectors(imag_sectors),
- d_width_real_sectors(width_real_sectors), d_width_imag_sectors(width_imag_sectors)
-{
- d_width_real_sectors *= d_scalefactor;
- d_width_imag_sectors *= d_scalefactor;
- find_sector_values();
-}
-
-unsigned int
-digital_constellation_rect::get_sector (const gr_complex *sample)
-{
- int real_sector, imag_sector;
- unsigned int sector;
-
- real_sector = int(real(*sample)/d_width_real_sectors + n_real_sectors/2.0);
- if(real_sector < 0)
- real_sector = 0;
- if(real_sector >= (int)n_real_sectors)
- real_sector = n_real_sectors-1;
-
- imag_sector = int(imag(*sample)/d_width_imag_sectors + n_imag_sectors/2.0);
- if(imag_sector < 0)
- imag_sector = 0;
- if(imag_sector >= (int)n_imag_sectors)
- imag_sector = n_imag_sectors-1;
-
- sector = real_sector * n_imag_sectors + imag_sector;
- return sector;
-}
-
-unsigned int
-digital_constellation_rect::calc_sector_value (unsigned int sector)
-{
- unsigned int real_sector, imag_sector;
- gr_complex sector_center;
- unsigned int closest_point;
- real_sector = float(sector)/n_imag_sectors;
- imag_sector = sector - real_sector * n_imag_sectors;
- sector_center = gr_complex((real_sector + 0.5 - n_real_sectors/2.0) * d_width_real_sectors,
- (imag_sector + 0.5 - n_imag_sectors/2.0) * d_width_imag_sectors);
- closest_point = get_closest_point(&sector_center);
- return closest_point;
-}
-
-digital_constellation_expl_rect_sptr
-digital_make_constellation_expl_rect(
- std::vector<gr_complex> constellation,
- std::vector<unsigned int> pre_diff_code,
- unsigned int rotational_symmetry,
- unsigned int real_sectors,
- unsigned int imag_sectors,
- float width_real_sectors,
- float width_imag_sectors,
- std::vector<unsigned int> sector_values
-)
-{
- return digital_constellation_expl_rect_sptr(
- new digital_constellation_expl_rect(
- constellation, pre_diff_code, rotational_symmetry, real_sectors, imag_sectors,
- width_real_sectors, width_imag_sectors, sector_values));
-}
-
-digital_constellation_expl_rect::digital_constellation_expl_rect (
- std::vector<gr_complex> constellation,
- std::vector<unsigned int> pre_diff_code,
- unsigned int rotational_symmetry,
- unsigned int real_sectors,
- unsigned int imag_sectors,
- float width_real_sectors,
- float width_imag_sectors,
- std::vector<unsigned int> sector_values
- ) : digital_constellation_rect(
- constellation, pre_diff_code, rotational_symmetry, real_sectors, imag_sectors,
- width_real_sectors, width_imag_sectors),
- d_sector_values(sector_values) {};
-
-digital_constellation_psk_sptr
-digital_make_constellation_psk(std::vector<gr_complex> constellation,
- std::vector<unsigned int> pre_diff_code,
- unsigned int n_sectors)
-{
- return digital_constellation_psk_sptr(new digital_constellation_psk
- (constellation, pre_diff_code,
- n_sectors));
-}
-
-digital_constellation_psk::digital_constellation_psk (std::vector<gr_complex> constellation,
- std::vector<unsigned int> pre_diff_code,
- unsigned int n_sectors) :
- digital_constellation_sector(constellation, pre_diff_code, constellation.size(), 1, n_sectors)
-{
- find_sector_values();
-}
-
-unsigned int
-digital_constellation_psk::get_sector (const gr_complex *sample)
-{
- float phase = arg(*sample);
- float width = M_TWOPI / n_sectors;
- int sector = floor(phase/width + 0.5);
- if (sector < 0)
- sector += n_sectors;
- return sector;
-}
-
-unsigned int
-digital_constellation_psk::calc_sector_value (unsigned int sector)
-{
- float phase = sector * M_TWOPI / n_sectors;
- gr_complex sector_center = gr_complex(cos(phase), sin(phase));
- unsigned int closest_point = get_closest_point(&sector_center);
- return closest_point;
-}
-
-
-digital_constellation_bpsk_sptr
-digital_make_constellation_bpsk()
-{
- return digital_constellation_bpsk_sptr(new digital_constellation_bpsk ());
-}
-
-digital_constellation_bpsk::digital_constellation_bpsk ()
-{
- d_constellation.resize(2);
- d_constellation[0] = gr_complex(-1, 0);
- d_constellation[1] = gr_complex(1, 0);
- d_rotational_symmetry = 2;
- d_dimensionality = 1;
- calc_arity();
-}
-
-unsigned int
-digital_constellation_bpsk::decision_maker(const gr_complex *sample)
-{
- return (real(*sample) > 0);
-}
-
-
-digital_constellation_qpsk_sptr
-digital_make_constellation_qpsk()
-{
- return digital_constellation_qpsk_sptr(new digital_constellation_qpsk ());
-}
-
-digital_constellation_qpsk::digital_constellation_qpsk ()
-{
- d_constellation.resize(4);
- // Gray-coded
- d_constellation[0] = gr_complex(-SQRT_TWO, -SQRT_TWO);
- d_constellation[1] = gr_complex(SQRT_TWO, -SQRT_TWO);
- d_constellation[2] = gr_complex(-SQRT_TWO, SQRT_TWO);
- d_constellation[3] = gr_complex(SQRT_TWO, SQRT_TWO);
-
- /*
- d_constellation[0] = gr_complex(SQRT_TWO, SQRT_TWO);
- d_constellation[1] = gr_complex(-SQRT_TWO, SQRT_TWO);
- d_constellation[2] = gr_complex(SQRT_TWO, -SQRT_TWO);
- d_constellation[3] = gr_complex(SQRT_TWO, -SQRT_TWO);
- */
-
- d_pre_diff_code.resize(4);
- d_pre_diff_code[0] = 0x0;
- d_pre_diff_code[1] = 0x2;
- d_pre_diff_code[2] = 0x3;
- d_pre_diff_code[3] = 0x1;
-
- d_rotational_symmetry = 4;
- d_dimensionality = 1;
- calc_arity();
-}
-
-unsigned int
-digital_constellation_qpsk::decision_maker(const gr_complex *sample)
-{
- // Real component determines small bit.
- // Imag component determines big bit.
- return 2*(imag(*sample)>0) + (real(*sample)>0);
-
- /*
- bool a = real(*sample) > 0;
- bool b = imag(*sample) > 0;
- if(a) {
- if(b)
- return 0x0;
- else
- return 0x1;
- }
- else {
- if(b)
- return 0x2;
- else
- return 0x3;
- }
- */
-}
-
-
-/********************************************************************/
-
-
-digital_constellation_dqpsk_sptr
-digital_make_constellation_dqpsk()
-{
- return digital_constellation_dqpsk_sptr(new digital_constellation_dqpsk ());
-}
-
-digital_constellation_dqpsk::digital_constellation_dqpsk ()
-{
- // This constellation is not gray coded, which allows
- // us to use differential encodings (through gr_diff_encode and
- // gr_diff_decode) on the symbols.
- d_constellation.resize(4);
- d_constellation[0] = gr_complex(+SQRT_TWO, +SQRT_TWO);
- d_constellation[1] = gr_complex(-SQRT_TWO, +SQRT_TWO);
- d_constellation[2] = gr_complex(-SQRT_TWO, -SQRT_TWO);
- d_constellation[3] = gr_complex(+SQRT_TWO, -SQRT_TWO);
-
- // Use this mapping to convert to gray code before diff enc.
- d_pre_diff_code.resize(4);
- d_pre_diff_code[0] = 0x0;
- d_pre_diff_code[1] = 0x1;
- d_pre_diff_code[2] = 0x3;
- d_pre_diff_code[3] = 0x2;
- d_apply_pre_diff_code = true;
-
- d_rotational_symmetry = 4;
- d_dimensionality = 1;
- calc_arity();
-}
-
-unsigned int
-digital_constellation_dqpsk::decision_maker(const gr_complex *sample)
-{
- // Slower deicison maker as we can't slice along one axis.
- // Maybe there's a better way to do this, still.
-
- bool a = real(*sample) > 0;
- bool b = imag(*sample) > 0;
- if(a) {
- if(b)
- return 0x0;
- else
- return 0x3;
- }
- else {
- if(b)
- return 0x1;
- else
- return 0x2;
- }
-}
-
-digital_constellation_8psk_sptr
-digital_make_constellation_8psk()
-{
- return digital_constellation_8psk_sptr(new digital_constellation_8psk ());
-}
-
-digital_constellation_8psk::digital_constellation_8psk ()
-{
- float angle = M_PI/8.0;
- d_constellation.resize(8);
- // Gray-coded
- d_constellation[0] = gr_complex(cos( 1*angle), sin( 1*angle));
- d_constellation[1] = gr_complex(cos( 7*angle), sin( 7*angle));
- d_constellation[2] = gr_complex(cos(15*angle), sin(15*angle));
- d_constellation[3] = gr_complex(cos( 9*angle), sin( 9*angle));
- d_constellation[4] = gr_complex(cos( 3*angle), sin( 3*angle));
- d_constellation[5] = gr_complex(cos( 5*angle), sin( 5*angle));
- d_constellation[6] = gr_complex(cos(13*angle), sin(13*angle));
- d_constellation[7] = gr_complex(cos(11*angle), sin(11*angle));
- d_rotational_symmetry = 8;
- d_dimensionality = 1;
- calc_arity();
-}
-
-unsigned int
-digital_constellation_8psk::decision_maker(const gr_complex *sample)
-{
- unsigned int ret = 0;
-
- float re = sample->real();
- float im = sample->imag();
-
- if(fabsf(re) <= fabsf(im))
- ret = 4;
- if(re <= 0)
- ret |= 1;
- if(im <= 0)
- ret |= 2;
-
- return ret;
-}
diff --git a/gr-digital/lib/digital_constellation_decoder_cb.cc b/gr-digital/lib/digital_constellation_decoder_cb.cc
deleted file mode 100644
index 4638790f61..0000000000
--- a/gr-digital/lib/digital_constellation_decoder_cb.cc
+++ /dev/null
@@ -1,77 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <digital_constellation_decoder_cb.h>
-#include <digital_constellation.h>
-#include <gr_io_signature.h>
-#include <iostream>
-
-digital_constellation_decoder_cb_sptr
-digital_make_constellation_decoder_cb (digital_constellation_sptr constellation)
-{
- return gnuradio::get_initial_sptr
- (new digital_constellation_decoder_cb(constellation));
-}
-
-digital_constellation_decoder_cb::
-digital_constellation_decoder_cb (digital_constellation_sptr constellation)
- : gr_block ("constellation_decoder_cb",
- gr_make_io_signature (1, 1, sizeof (gr_complex)),
- gr_make_io_signature (1, 1, sizeof (unsigned char))),
- d_constellation(constellation),
- d_dim(constellation->dimensionality())
-{
- set_relative_rate (1.0 / ((double) d_dim));
-}
-
-void
-digital_constellation_decoder_cb::forecast (int noutput_items,
- gr_vector_int &ninput_items_required)
-{
- unsigned int input_required = noutput_items * d_dim;
-
- unsigned ninputs = ninput_items_required.size();
- for (unsigned int i = 0; i < ninputs; i++)
- ninput_items_required[i] = input_required;
-}
-
-
-int
-digital_constellation_decoder_cb::general_work (int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- gr_complex const *in = (const gr_complex *) input_items[0];
- unsigned char *out = (unsigned char *) output_items[0];
-
- for(int i = 0; i < noutput_items; i++){
- out[i] = d_constellation->decision_maker(&(in[i*d_dim]));
- }
-
- consume_each (noutput_items * d_dim);
- return noutput_items;
-}
diff --git a/gr-digital/lib/digital_constellation_receiver_cb.cc b/gr-digital/lib/digital_constellation_receiver_cb.cc
deleted file mode 100644
index faaa760fd0..0000000000
--- a/gr-digital/lib/digital_constellation_receiver_cb.cc
+++ /dev/null
@@ -1,126 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gr_io_signature.h>
-#include <gr_prefs.h>
-#include <digital_constellation_receiver_cb.h>
-#include <stdexcept>
-#include <gr_math.h>
-#include <gr_expj.h>
-
-
-#define M_TWOPI (2*M_PI)
-#define VERBOSE_MM 0 // Used for debugging symbol timing loop
-#define VERBOSE_COSTAS 0 // Used for debugging phase and frequency tracking
-
-// Public constructor
-
-digital_constellation_receiver_cb_sptr
-digital_make_constellation_receiver_cb(digital_constellation_sptr constell,
- float loop_bw, float fmin, float fmax)
-{
- return gnuradio::get_initial_sptr(new digital_constellation_receiver_cb (constell,
- loop_bw,
- fmin, fmax));
-}
-
-static int ios[] = {sizeof(char), sizeof(float), sizeof(float), sizeof(float), sizeof(gr_complex)};
-static std::vector<int> iosig(ios, ios+sizeof(ios)/sizeof(int));
-digital_constellation_receiver_cb::digital_constellation_receiver_cb (digital_constellation_sptr constellation,
- float loop_bw, float fmin, float fmax)
- : gr_block ("constellation_receiver_cb",
- gr_make_io_signature (1, 1, sizeof (gr_complex)),
- gr_make_io_signaturev (1, 5, iosig)),
- gri_control_loop(loop_bw, fmax, fmin),
- d_constellation(constellation),
- d_current_const_point(0)
-{
- if (d_constellation->dimensionality() != 1)
- throw std::runtime_error ("This receiver only works with constellations of dimension 1.");
-}
-
-void
-digital_constellation_receiver_cb::phase_error_tracking(float phase_error)
-{
- advance_loop(phase_error);
- phase_wrap();
- frequency_limit();
-
-#if VERBOSE_COSTAS
- printf("cl: phase_error: %f phase: %f freq: %f sample: %f+j%f constellation: %f+j%f\n",
- phase_error, d_phase, d_freq, sample.real(), sample.imag(),
- d_constellation->points()[d_current_const_point].real(),
- d_constellation->points()[d_current_const_point].imag());
-#endif
-}
-
-int
-digital_constellation_receiver_cb::general_work (int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- const gr_complex *in = (const gr_complex *) input_items[0];
- unsigned char *out = (unsigned char *) output_items[0];
-
- int i=0;
-
- float phase_error;
- unsigned int sym_value;
- gr_complex sample, nco;
-
- float *out_err = 0, *out_phase = 0, *out_freq = 0;
- gr_complex *out_symbol;
- if(output_items.size() == 5) {
- out_err = (float *) output_items[1];
- out_phase = (float *) output_items[2];
- out_freq = (float *) output_items[3];
- out_symbol = (gr_complex*)output_items[4];
- }
-
- while((i < noutput_items) && (i < ninput_items[0])) {
- sample = in[i];
- nco = gr_expj(d_phase); // get the NCO value for derotating the current sample
- sample = nco*sample; // get the downconverted symbol
-
- sym_value = d_constellation->decision_maker_pe(&sample, &phase_error);
- phase_error_tracking(phase_error); // corrects phase and frequency offsets
-
- out[i] = sym_value;
-
- if(output_items.size() == 5) {
- out_err[i] = phase_error;
- out_phase[i] = d_phase;
- out_freq[i] = d_freq;
- out_symbol[i] = sample;
- }
- i++;
- }
-
- consume_each(i);
- return i;
-}
-
diff --git a/gr-digital/lib/digital_correlate_access_code_bb.cc b/gr-digital/lib/digital_correlate_access_code_bb.cc
deleted file mode 100644
index f21b57d92c..0000000000
--- a/gr-digital/lib/digital_correlate_access_code_bb.cc
+++ /dev/null
@@ -1,134 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2006,2010,2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <digital_correlate_access_code_bb.h>
-#include <gr_io_signature.h>
-#include <stdexcept>
-#include <gr_count_bits.h>
-#include <cstdio>
-
-
-#define VERBOSE 0
-
-
-digital_correlate_access_code_bb_sptr
-digital_make_correlate_access_code_bb (const std::string &access_code, int threshold)
-{
- return gnuradio::get_initial_sptr(new digital_correlate_access_code_bb
- (access_code, threshold));
-}
-
-
-digital_correlate_access_code_bb::digital_correlate_access_code_bb (
- const std::string &access_code, int threshold)
- : gr_sync_block ("correlate_access_code_bb",
- gr_make_io_signature (1, 1, sizeof(char)),
- gr_make_io_signature (1, 1, sizeof(char))),
- d_data_reg(0), d_flag_reg(0), d_flag_bit(0), d_mask(0),
- d_threshold(threshold)
-
-{
- if (!set_access_code(access_code)){
- fprintf(stderr, "digital_correlate_access_code_bb: access_code is > 64 bits\n");
- throw std::out_of_range ("access_code is > 64 bits");
- }
-}
-
-digital_correlate_access_code_bb::~digital_correlate_access_code_bb ()
-{
-}
-
-bool
-digital_correlate_access_code_bb::set_access_code(
- const std::string &access_code)
-{
- unsigned len = access_code.length(); // # of bytes in string
- if (len > 64)
- return false;
-
- // set len top bits to 1.
- d_mask = ((~0ULL) >> (64 - len)) << (64 - len);
-
- d_flag_bit = 1LL << (64 - len); // Where we or-in new flag values.
- // new data always goes in 0x0000000000000001
- d_access_code = 0;
- for (unsigned i=0; i < 64; i++){
- d_access_code <<= 1;
- if (i < len)
- d_access_code |= access_code[i] & 1; // look at LSB only
- }
-
- return true;
-}
-
-int
-digital_correlate_access_code_bb::work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- const unsigned char *in = (const unsigned char *) input_items[0];
- unsigned char *out = (unsigned char *) output_items[0];
-
- for (int i = 0; i < noutput_items; i++){
-
- // compute output value
- unsigned int t = 0;
-
- t |= ((d_data_reg >> 63) & 0x1) << 0;
- t |= ((d_flag_reg >> 63) & 0x1) << 1; // flag bit
- out[i] = t;
-
- // compute hamming distance between desired access code and current data
- unsigned long long wrong_bits = 0;
- unsigned int nwrong = d_threshold+1;
- int new_flag = 0;
-
- wrong_bits = (d_data_reg ^ d_access_code) & d_mask;
- nwrong = gr_count_bits64(wrong_bits);
-
- // test for access code with up to threshold errors
- new_flag = (nwrong <= d_threshold);
-
-#if VERBOSE
- if(new_flag) {
- fprintf(stderr, "access code found: %llx\n", d_access_code);
- }
- else {
- fprintf(stderr, "%llx ==> %llx\n", d_access_code, d_data_reg);
- }
-#endif
-
- // shift in new data and new flag
- d_data_reg = (d_data_reg << 1) | (in[i] & 0x1);
- d_flag_reg = (d_flag_reg << 1);
- if (new_flag) {
- d_flag_reg |= d_flag_bit;
- }
- }
-
- return noutput_items;
-}
-
diff --git a/gr-digital/lib/digital_correlate_access_code_tag_bb.cc b/gr-digital/lib/digital_correlate_access_code_tag_bb.cc
deleted file mode 100644
index 95f06534e3..0000000000
--- a/gr-digital/lib/digital_correlate_access_code_tag_bb.cc
+++ /dev/null
@@ -1,131 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2006,2010-2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <digital_correlate_access_code_tag_bb.h>
-#include <gr_io_signature.h>
-#include <stdexcept>
-#include <gr_count_bits.h>
-#include <cstdio>
-#include <iostream>
-
-#define VERBOSE 0
-
-
-digital_correlate_access_code_tag_bb_sptr
-digital_make_correlate_access_code_tag_bb (const std::string &access_code,
- int threshold,
- const std::string &tag_name)
-{
- return gnuradio::get_initial_sptr(new digital_correlate_access_code_tag_bb
- (access_code, threshold, tag_name));
-}
-
-
-digital_correlate_access_code_tag_bb::digital_correlate_access_code_tag_bb (
- const std::string &access_code, int threshold, const std::string &tag_name)
- : gr_sync_block ("correlate_access_code_tag_bb",
- gr_make_io_signature (1, 1, sizeof(char)),
- gr_make_io_signature (1, 1, sizeof(char))),
- d_data_reg(0), d_mask(0),
- d_threshold(threshold), d_len(0)
-{
- if (!set_access_code(access_code)) {
- fprintf(stderr, "digital_correlate_access_code_tag_bb: access_code is > 64 bits\n");
- throw std::out_of_range ("access_code is > 64 bits");
- }
-
- std::stringstream str;
- str << name() << unique_id();
- d_me = pmt::pmt_string_to_symbol(str.str());
- d_key = pmt::pmt_string_to_symbol(tag_name);
-}
-
-digital_correlate_access_code_tag_bb::~digital_correlate_access_code_tag_bb ()
-{
-}
-
-bool
-digital_correlate_access_code_tag_bb::set_access_code(
- const std::string &access_code)
-{
- d_len = access_code.length(); // # of bytes in string
- if (d_len > 64)
- return false;
-
- // set len top bits to 1.
- d_mask = ((~0ULL) >> (64 - d_len)) << (64 - d_len);
-
- d_access_code = 0;
- for (unsigned i=0; i < 64; i++){
- d_access_code <<= 1;
- if (i < d_len)
- d_access_code |= access_code[i] & 1; // look at LSB only
- }
-
- return true;
-}
-
-int
-digital_correlate_access_code_tag_bb::work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- const unsigned char *in = (const unsigned char *) input_items[0];
- unsigned char *out = (unsigned char *) output_items[0];
-
- uint64_t abs_out_sample_cnt = nitems_written(0);
-
- for (int i = 0; i < noutput_items; i++){
-
- out[i] = in[i];
-
- // compute hamming distance between desired access code and current data
- unsigned long long wrong_bits = 0;
- unsigned int nwrong = d_threshold+1;
- int new_flag = 0;
-
- wrong_bits = (d_data_reg ^ d_access_code) & d_mask;
- nwrong = gr_count_bits64(wrong_bits);
-
- // test for access code with up to threshold errors
- new_flag = (nwrong <= d_threshold);
-
- // shift in new data and new flag
- d_data_reg = (d_data_reg << 1) | (in[i] & 0x1);
- if (new_flag) {
- if(VERBOSE) std::cout << "writing tag at sample " << abs_out_sample_cnt + i << std::endl;
- add_item_tag(0, //stream ID
- abs_out_sample_cnt + i - 64 + d_len, //sample
- d_key, //frame info
- pmt::pmt_t(), //data (unused)
- d_me //block src id
- );
- }
- }
-
- return noutput_items;
-}
-
diff --git a/gr-digital/lib/digital_costas_loop_cc.cc b/gr-digital/lib/digital_costas_loop_cc.cc
deleted file mode 100644
index 370dc7e5c1..0000000000
--- a/gr-digital/lib/digital_costas_loop_cc.cc
+++ /dev/null
@@ -1,153 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2006,2010,2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <digital_costas_loop_cc.h>
-#include <gr_io_signature.h>
-#include <gr_expj.h>
-#include <gr_sincos.h>
-#include <gr_math.h>
-
-digital_costas_loop_cc_sptr
-digital_make_costas_loop_cc (float loop_bw, int order
- ) throw (std::invalid_argument)
-{
- return gnuradio::get_initial_sptr(new digital_costas_loop_cc
- (loop_bw, order));
-}
-
-digital_costas_loop_cc::digital_costas_loop_cc (float loop_bw, int order
- ) throw (std::invalid_argument)
- : gr_sync_block ("costas_loop_cc",
- gr_make_io_signature (1, 1, sizeof (gr_complex)),
- gr_make_io_signature2 (1, 2, sizeof (gr_complex), sizeof(float))),
- gri_control_loop(loop_bw, 1.0, -1.0),
- d_order(order), d_phase_detector(NULL)
-{
- // Set up the phase detector to use based on the constellation order
- switch(d_order) {
- case 2:
- d_phase_detector = &digital_costas_loop_cc::phase_detector_2;
- break;
-
- case 4:
- d_phase_detector = &digital_costas_loop_cc::phase_detector_4;
- break;
-
- case 8:
- d_phase_detector = &digital_costas_loop_cc::phase_detector_8;
- break;
-
- default:
- throw std::invalid_argument("order must be 2, 4, or 8");
- break;
- }
-}
-
-float
-digital_costas_loop_cc::phase_detector_8(gr_complex sample) const
-{
- /* This technique splits the 8PSK constellation into 2 squashed
- QPSK constellations, one when I is larger than Q and one where
- Q is larger than I. The error is then calculated proportionally
- to these squashed constellations by the const K = sqrt(2)-1.
-
- The signal magnitude must be > 1 or K will incorrectly bias
- the error value.
-
- Ref: Z. Huang, Z. Yi, M. Zhang, K. Wang, "8PSK demodulation for
- new generation DVB-S2", IEEE Proc. Int. Conf. Communications,
- Circuits and Systems, Vol. 2, pp. 1447 - 1450, 2004.
- */
-
- float K = (sqrt(2.0) - 1);
- if(fabsf(sample.real()) >= fabsf(sample.imag())) {
- return ((sample.real()>0 ? 1.0 : -1.0) * sample.imag() -
- (sample.imag()>0 ? 1.0 : -1.0) * sample.real() * K);
- }
- else {
- return ((sample.real()>0 ? 1.0 : -1.0) * sample.imag() * K -
- (sample.imag()>0 ? 1.0 : -1.0) * sample.real());
- }
-}
-
-float
-digital_costas_loop_cc::phase_detector_4(gr_complex sample) const
-{
-
- return ((sample.real()>0 ? 1.0 : -1.0) * sample.imag() -
- (sample.imag()>0 ? 1.0 : -1.0) * sample.real());
-}
-
-float
-digital_costas_loop_cc::phase_detector_2(gr_complex sample) const
-{
- return (sample.real()*sample.imag());
-}
-
-int
-digital_costas_loop_cc::work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- const gr_complex *iptr = (gr_complex *) input_items[0];
- gr_complex *optr = (gr_complex *) output_items[0];
- float *foptr = (float *) output_items[1];
-
- bool write_foptr = output_items.size() >= 2;
-
- float error;
- gr_complex nco_out;
-
- if (write_foptr) {
-
- for (int i = 0; i < noutput_items; i++){
- nco_out = gr_expj(-d_phase);
- optr[i] = iptr[i] * nco_out;
-
- error = (*this.*d_phase_detector)(optr[i]);
- error = gr_branchless_clip(error, 1.0);
-
- advance_loop(error);
- phase_wrap();
- frequency_limit();
-
- foptr[i] = d_freq;
- }
- } else {
- for (int i = 0; i < noutput_items; i++){
- nco_out = gr_expj(-d_phase);
- optr[i] = iptr[i] * nco_out;
-
- error = (*this.*d_phase_detector)(optr[i]);
- error = gr_branchless_clip(error, 1.0);
-
- advance_loop(error);
- phase_wrap();
- frequency_limit();
- }
- }
- return noutput_items;
-}
diff --git a/gr-digital/lib/digital_cpmmod_bc.cc b/gr-digital/lib/digital_cpmmod_bc.cc
deleted file mode 100644
index a95b604d14..0000000000
--- a/gr-digital/lib/digital_cpmmod_bc.cc
+++ /dev/null
@@ -1,69 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2010 Free Software Foundation, Inc.
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <digital_cpmmod_bc.h>
-#include <gr_io_signature.h>
-
-
-// Shared pointer constructor
-digital_cpmmod_bc_sptr
-digital_make_cpmmod_bc(int type, float h,
- unsigned samples_per_sym,
- unsigned L, double beta)
-{
- return gnuradio::get_initial_sptr(new digital_cpmmod_bc((gr_cpm::cpm_type)type,
- h, samples_per_sym,
- L, beta));
-}
-
-
-digital_cpmmod_bc::digital_cpmmod_bc(gr_cpm::cpm_type type, float h,
- unsigned samples_per_sym,
- unsigned L, double beta)
- : gr_hier_block2("digital_cpmmod_bc",
- gr_make_io_signature(1, 1, sizeof(char)),
- gr_make_io_signature2(1, 1, sizeof(gr_complex), sizeof(float))),
- d_taps(gr_cpm::phase_response(type, samples_per_sym, L, beta)),
- d_char_to_float(gr_make_char_to_float()),
- d_pulse_shaper(gr_make_interp_fir_filter_fff(samples_per_sym, d_taps)),
- d_fm(gr_make_frequency_modulator_fc(M_PI * h))
-{
- switch (type) {
- case gr_cpm::LRC:
- case gr_cpm::LSRC:
- case gr_cpm::LREC:
- case gr_cpm::TFM:
- case gr_cpm::GAUSSIAN:
- break;
-
- default:
- throw std::invalid_argument("invalid CPM type");
- }
-
- connect(self(), 0, d_char_to_float, 0);
- connect(d_char_to_float, 0, d_pulse_shaper, 0);
- connect(d_pulse_shaper, 0, d_fm, 0);
- connect(d_fm, 0, self(), 0);
-}
-
diff --git a/gr-digital/lib/digital_crc32.cc b/gr-digital/lib/digital_crc32.cc
deleted file mode 100644
index 8806d6e9c7..0000000000
--- a/gr-digital/lib/digital_crc32.cc
+++ /dev/null
@@ -1,130 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2005,2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-/*
- * See also ISO 3309 [ISO-3309] or ITU-T V.42 [ITU-V42] for a formal specification.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <digital_crc32.h>
-
-
-// Automatically generated CRC function
-// polynomial: 0x104C11DB7
-unsigned int
-digital_update_crc32(unsigned int crc, const unsigned char *data, size_t len)
-{
- static const unsigned int table[256] = {
- 0x00000000U,0x04C11DB7U,0x09823B6EU,0x0D4326D9U,
- 0x130476DCU,0x17C56B6BU,0x1A864DB2U,0x1E475005U,
- 0x2608EDB8U,0x22C9F00FU,0x2F8AD6D6U,0x2B4BCB61U,
- 0x350C9B64U,0x31CD86D3U,0x3C8EA00AU,0x384FBDBDU,
- 0x4C11DB70U,0x48D0C6C7U,0x4593E01EU,0x4152FDA9U,
- 0x5F15ADACU,0x5BD4B01BU,0x569796C2U,0x52568B75U,
- 0x6A1936C8U,0x6ED82B7FU,0x639B0DA6U,0x675A1011U,
- 0x791D4014U,0x7DDC5DA3U,0x709F7B7AU,0x745E66CDU,
- 0x9823B6E0U,0x9CE2AB57U,0x91A18D8EU,0x95609039U,
- 0x8B27C03CU,0x8FE6DD8BU,0x82A5FB52U,0x8664E6E5U,
- 0xBE2B5B58U,0xBAEA46EFU,0xB7A96036U,0xB3687D81U,
- 0xAD2F2D84U,0xA9EE3033U,0xA4AD16EAU,0xA06C0B5DU,
- 0xD4326D90U,0xD0F37027U,0xDDB056FEU,0xD9714B49U,
- 0xC7361B4CU,0xC3F706FBU,0xCEB42022U,0xCA753D95U,
- 0xF23A8028U,0xF6FB9D9FU,0xFBB8BB46U,0xFF79A6F1U,
- 0xE13EF6F4U,0xE5FFEB43U,0xE8BCCD9AU,0xEC7DD02DU,
- 0x34867077U,0x30476DC0U,0x3D044B19U,0x39C556AEU,
- 0x278206ABU,0x23431B1CU,0x2E003DC5U,0x2AC12072U,
- 0x128E9DCFU,0x164F8078U,0x1B0CA6A1U,0x1FCDBB16U,
- 0x018AEB13U,0x054BF6A4U,0x0808D07DU,0x0CC9CDCAU,
- 0x7897AB07U,0x7C56B6B0U,0x71159069U,0x75D48DDEU,
- 0x6B93DDDBU,0x6F52C06CU,0x6211E6B5U,0x66D0FB02U,
- 0x5E9F46BFU,0x5A5E5B08U,0x571D7DD1U,0x53DC6066U,
- 0x4D9B3063U,0x495A2DD4U,0x44190B0DU,0x40D816BAU,
- 0xACA5C697U,0xA864DB20U,0xA527FDF9U,0xA1E6E04EU,
- 0xBFA1B04BU,0xBB60ADFCU,0xB6238B25U,0xB2E29692U,
- 0x8AAD2B2FU,0x8E6C3698U,0x832F1041U,0x87EE0DF6U,
- 0x99A95DF3U,0x9D684044U,0x902B669DU,0x94EA7B2AU,
- 0xE0B41DE7U,0xE4750050U,0xE9362689U,0xEDF73B3EU,
- 0xF3B06B3BU,0xF771768CU,0xFA325055U,0xFEF34DE2U,
- 0xC6BCF05FU,0xC27DEDE8U,0xCF3ECB31U,0xCBFFD686U,
- 0xD5B88683U,0xD1799B34U,0xDC3ABDEDU,0xD8FBA05AU,
- 0x690CE0EEU,0x6DCDFD59U,0x608EDB80U,0x644FC637U,
- 0x7A089632U,0x7EC98B85U,0x738AAD5CU,0x774BB0EBU,
- 0x4F040D56U,0x4BC510E1U,0x46863638U,0x42472B8FU,
- 0x5C007B8AU,0x58C1663DU,0x558240E4U,0x51435D53U,
- 0x251D3B9EU,0x21DC2629U,0x2C9F00F0U,0x285E1D47U,
- 0x36194D42U,0x32D850F5U,0x3F9B762CU,0x3B5A6B9BU,
- 0x0315D626U,0x07D4CB91U,0x0A97ED48U,0x0E56F0FFU,
- 0x1011A0FAU,0x14D0BD4DU,0x19939B94U,0x1D528623U,
- 0xF12F560EU,0xF5EE4BB9U,0xF8AD6D60U,0xFC6C70D7U,
- 0xE22B20D2U,0xE6EA3D65U,0xEBA91BBCU,0xEF68060BU,
- 0xD727BBB6U,0xD3E6A601U,0xDEA580D8U,0xDA649D6FU,
- 0xC423CD6AU,0xC0E2D0DDU,0xCDA1F604U,0xC960EBB3U,
- 0xBD3E8D7EU,0xB9FF90C9U,0xB4BCB610U,0xB07DABA7U,
- 0xAE3AFBA2U,0xAAFBE615U,0xA7B8C0CCU,0xA379DD7BU,
- 0x9B3660C6U,0x9FF77D71U,0x92B45BA8U,0x9675461FU,
- 0x8832161AU,0x8CF30BADU,0x81B02D74U,0x857130C3U,
- 0x5D8A9099U,0x594B8D2EU,0x5408ABF7U,0x50C9B640U,
- 0x4E8EE645U,0x4A4FFBF2U,0x470CDD2BU,0x43CDC09CU,
- 0x7B827D21U,0x7F436096U,0x7200464FU,0x76C15BF8U,
- 0x68860BFDU,0x6C47164AU,0x61043093U,0x65C52D24U,
- 0x119B4BE9U,0x155A565EU,0x18197087U,0x1CD86D30U,
- 0x029F3D35U,0x065E2082U,0x0B1D065BU,0x0FDC1BECU,
- 0x3793A651U,0x3352BBE6U,0x3E119D3FU,0x3AD08088U,
- 0x2497D08DU,0x2056CD3AU,0x2D15EBE3U,0x29D4F654U,
- 0xC5A92679U,0xC1683BCEU,0xCC2B1D17U,0xC8EA00A0U,
- 0xD6AD50A5U,0xD26C4D12U,0xDF2F6BCBU,0xDBEE767CU,
- 0xE3A1CBC1U,0xE760D676U,0xEA23F0AFU,0xEEE2ED18U,
- 0xF0A5BD1DU,0xF464A0AAU,0xF9278673U,0xFDE69BC4U,
- 0x89B8FD09U,0x8D79E0BEU,0x803AC667U,0x84FBDBD0U,
- 0x9ABC8BD5U,0x9E7D9662U,0x933EB0BBU,0x97FFAD0CU,
- 0xAFB010B1U,0xAB710D06U,0xA6322BDFU,0xA2F33668U,
- 0xBCB4666DU,0xB8757BDAU,0xB5365D03U,0xB1F740B4U,
- };
-
- while (len > 0)
- {
- crc = table[*data ^ ((crc >> 24) & 0xff)] ^ (crc << 8);
- data++;
- len--;
- }
- return crc;
-}
-
-unsigned int
-digital_update_crc32(unsigned int crc, const std::string s)
-{
- return digital_update_crc32(crc, (const unsigned char *) s.data(), s.size());
-}
-
-unsigned int
-digital_crc32(const unsigned char *buf, size_t len)
-{
- return digital_update_crc32(0xffffffff, buf, len) ^ 0xffffffff;
-}
-
-unsigned int
-digital_crc32(const std::string s)
-{
- return digital_crc32((const unsigned char *) s.data(), s.size());
-}
diff --git a/gr-digital/lib/digital_crc32_bb.cc b/gr-digital/lib/digital_crc32_bb.cc
index 89d9e42151..40d313ba89 100644
--- a/gr-digital/lib/digital_crc32_bb.cc
+++ b/gr-digital/lib/digital_crc32_bb.cc
@@ -24,8 +24,8 @@
#endif
#include <gr_io_signature.h>
-#include <digital_crc32.h>
-#include "digital_crc32_bb.h"
+#include <digital/crc32.h>
+#include <digital_crc32_bb.h>
digital_crc32_bb_sptr
digital_make_crc32_bb (bool check, const std::string& lengthtagname)
@@ -74,13 +74,13 @@ digital_crc32_bb::work (int noutput_items,
unsigned int crc;
if (d_check) {
- crc = digital_crc32(in, packet_length-4);
+ crc = gr::digital::crc32(in, packet_length-4);
if (crc != *(unsigned int *)(in+packet_length-4)) { // Drop package
return 0;
}
memcpy((void *) out, (const void *) in, packet_length-4);
} else {
- crc = digital_crc32(in, packet_length);
+ crc = gr::digital::crc32(in, packet_length);
memcpy((void *) out, (const void *) in, packet_length);
memcpy((void *) (out + packet_length), &crc, 4); // FIXME big-endian/little-endian, this might be wrong
}
diff --git a/gr-digital/lib/digital_descrambler_bb.cc b/gr-digital/lib/digital_descrambler_bb.cc
deleted file mode 100644
index 68cba7145e..0000000000
--- a/gr-digital/lib/digital_descrambler_bb.cc
+++ /dev/null
@@ -1,56 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2008,2010,2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <digital_descrambler_bb.h>
-#include <gr_io_signature.h>
-
-digital_descrambler_bb_sptr
-digital_make_descrambler_bb(int mask, int seed, int len)
-{
- return gnuradio::get_initial_sptr(new digital_descrambler_bb(mask, seed, len));
-}
-
-digital_descrambler_bb::digital_descrambler_bb(int mask, int seed, int len)
- : gr_sync_block("descrambler_bb",
- gr_make_io_signature (1, 1, sizeof (unsigned char)),
- gr_make_io_signature (1, 1, sizeof (unsigned char))),
- d_lfsr(mask, seed, len)
-{
-}
-
-int
-digital_descrambler_bb::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- const unsigned char *in = (const unsigned char *) input_items[0];
- unsigned char *out = (unsigned char *) output_items[0];
-
- for (int i = 0; i < noutput_items; i++)
- out[i] = d_lfsr.next_bit_descramble(in[i]);
-
- return noutput_items;
-}
diff --git a/gr-digital/lib/digital_diff_decoder_bb.cc b/gr-digital/lib/digital_diff_decoder_bb.cc
deleted file mode 100644
index 7b8e8726ac..0000000000
--- a/gr-digital/lib/digital_diff_decoder_bb.cc
+++ /dev/null
@@ -1,61 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2006,2010,2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <digital_diff_decoder_bb.h>
-#include <gr_io_signature.h>
-
-digital_diff_decoder_bb_sptr
-digital_make_diff_decoder_bb (unsigned int modulus)
-{
- return gnuradio::get_initial_sptr(new digital_diff_decoder_bb(modulus));
-}
-
-digital_diff_decoder_bb::digital_diff_decoder_bb (unsigned int modulus)
- : gr_sync_block ("diff_decoder_bb",
- gr_make_io_signature (1, 1, sizeof (unsigned char)),
- gr_make_io_signature (1, 1, sizeof (unsigned char))),
- d_modulus(modulus)
-{
- set_history(2); // need to look at two inputs
-}
-
-int
-digital_diff_decoder_bb::work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- const unsigned char *in = (const unsigned char *) input_items[0];
- unsigned char *out = (unsigned char *) output_items[0];
- in += 1; // ensure that in[-1] is valid
-
- unsigned modulus = d_modulus;
-
- for (int i = 0; i < noutput_items; i++) {
- out[i] = (in[i] - in[i-1]) % modulus;
- }
-
- return noutput_items;
-}
diff --git a/gr-digital/lib/digital_diff_encoder_bb.cc b/gr-digital/lib/digital_diff_encoder_bb.cc
deleted file mode 100644
index bfbaba98fb..0000000000
--- a/gr-digital/lib/digital_diff_encoder_bb.cc
+++ /dev/null
@@ -1,62 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2006,2010,2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <digital_diff_encoder_bb.h>
-#include <gr_io_signature.h>
-
-digital_diff_encoder_bb_sptr
-digital_make_diff_encoder_bb (unsigned int modulus)
-{
- return gnuradio::get_initial_sptr(new digital_diff_encoder_bb(modulus));
-}
-
-digital_diff_encoder_bb::digital_diff_encoder_bb (unsigned int modulus)
- : gr_sync_block ("diff_encoder_bb",
- gr_make_io_signature (1, 1, sizeof (unsigned char)),
- gr_make_io_signature (1, 1, sizeof (unsigned char))),
- d_last_out(0), d_modulus(modulus)
-{
-}
-
-int
-digital_diff_encoder_bb::work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- const unsigned char *in = (const unsigned char *) input_items[0];
- unsigned char *out = (unsigned char *) output_items[0];
-
- unsigned last_out = d_last_out;
- unsigned modulus = d_modulus;
-
- for (int i = 0; i < noutput_items; i++) {
- out[i] = (in[i] + last_out) % modulus;
- last_out = out[i];
- }
-
- d_last_out = last_out;
- return noutput_items;
-}
diff --git a/gr-digital/lib/digital_fll_band_edge_cc.cc b/gr-digital/lib/digital_fll_band_edge_cc.cc
deleted file mode 100644
index f2cfb1020a..0000000000
--- a/gr-digital/lib/digital_fll_band_edge_cc.cc
+++ /dev/null
@@ -1,271 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2009-2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <digital_fll_band_edge_cc.h>
-#include <gr_io_signature.h>
-#include <gr_expj.h>
-#include <cstdio>
-
-#define M_TWOPI (2*M_PI)
-
-float sinc(float x)
-{
- if(x == 0)
- return 1;
- else
- return sin(M_PI*x)/(M_PI*x);
-}
-
-digital_fll_band_edge_cc_sptr
-digital_make_fll_band_edge_cc (float samps_per_sym, float rolloff,
- int filter_size, float bandwidth)
-{
- return gnuradio::get_initial_sptr(new digital_fll_band_edge_cc (samps_per_sym, rolloff,
- filter_size, bandwidth));
-}
-
-
-static int ios[] = {sizeof(gr_complex), sizeof(float), sizeof(float), sizeof(float)};
-static std::vector<int> iosig(ios, ios+sizeof(ios)/sizeof(int));
-digital_fll_band_edge_cc::digital_fll_band_edge_cc(float samps_per_sym, float rolloff,
- int filter_size, float bandwidth)
- : gr_sync_block("fll_band_edge_cc",
- gr_make_io_signature(1, 1, sizeof(gr_complex)),
- gr_make_io_signaturev(1, 4, iosig)),
- gri_control_loop(bandwidth, M_TWOPI*(2.0/samps_per_sym), -M_TWOPI*(2.0/samps_per_sym)),
- d_updated(false)
-{
- // Initialize samples per symbol
- if(samps_per_sym <= 0) {
- throw std::out_of_range("digital_fll_band_edge_cc: invalid number of sps. Must be > 0.");
- }
- d_sps = samps_per_sym;
-
- // Initialize rolloff factor
- if(rolloff < 0 || rolloff > 1.0) {
- throw std::out_of_range("digital_fll_band_edge_cc: invalid rolloff factor. Must be in [0,1].");
- }
- d_rolloff = rolloff;
-
- // Initialize filter length
- if(filter_size <= 0) {
- throw std::out_of_range("digital_fll_band_edge_cc: invalid filter size. Must be > 0.");
- }
- d_filter_size = filter_size;
-
- // Build the band edge filters
- design_filter(d_sps, d_rolloff, d_filter_size);
- d_output_hist.resize(filter_size,0);
-}
-
-digital_fll_band_edge_cc::~digital_fll_band_edge_cc()
-{
-}
-
-
-/*******************************************************************
- SET FUNCTIONS
-*******************************************************************/
-
-void
-digital_fll_band_edge_cc::set_samples_per_symbol(float sps)
-{
- if(sps <= 0) {
- throw std::out_of_range("digital_fll_band_edge_cc: invalid number of sps. Must be > 0.");
- }
- d_sps = sps;
- design_filter(d_sps, d_rolloff, d_filter_size);
-}
-
-void
-digital_fll_band_edge_cc::set_rolloff(float rolloff)
-{
- if(rolloff < 0 || rolloff > 1.0) {
- throw std::out_of_range("digital_fll_band_edge_cc: invalid rolloff factor. Must be in [0,1].");
- }
- d_rolloff = rolloff;
- design_filter(d_sps, d_rolloff, d_filter_size);
-}
-
-void
-digital_fll_band_edge_cc::set_filter_size(int filter_size)
-{
- if(filter_size <= 0) {
- throw std::out_of_range("digital_fll_band_edge_cc: invalid filter size. Must be > 0.");
- }
- d_filter_size = filter_size;
- design_filter(d_sps, d_rolloff, d_filter_size);
-}
-
-/*******************************************************************
- GET FUNCTIONS
-*******************************************************************/
-
-float
-digital_fll_band_edge_cc::get_samples_per_symbol() const
-{
- return d_sps;
-}
-
-float
-digital_fll_band_edge_cc::get_rolloff() const
-{
- return d_rolloff;
-}
-
-int
-digital_fll_band_edge_cc:: get_filter_size() const
-{
- return d_filter_size;
-}
-
-
-/*******************************************************************
-*******************************************************************/
-
-void
-digital_fll_band_edge_cc::design_filter(float samps_per_sym,
- float rolloff, int filter_size)
-{
- int M = rint(filter_size / samps_per_sym);
- float power = 0;
-
- // Create the baseband filter by adding two sincs together
- std::vector<float> bb_taps;
- for(int i = 0; i < filter_size; i++) {
- float k = -M + i*2.0/samps_per_sym;
- float tap = sinc(rolloff*k - 0.5) + sinc(rolloff*k + 0.5);
- power += tap;
-
- bb_taps.push_back(tap);
- }
-
- d_taps_lower.resize(filter_size);
- d_taps_upper.resize(filter_size);
-
- // Create the band edge filters by spinning the baseband
- // filter up and down to the right places in frequency.
- // Also, normalize the power in the filters
- int N = (bb_taps.size() - 1.0)/2.0;
- for(int i = 0; i < filter_size; i++) {
- float tap = bb_taps[i] / power;
-
- float k = (-N + (int)i)/(2.0*samps_per_sym);
-
- gr_complex t1 = tap * gr_expj(-M_TWOPI*(1+rolloff)*k);
- gr_complex t2 = tap * gr_expj(M_TWOPI*(1+rolloff)*k);
-
- d_taps_lower[filter_size-i-1] = t1;
- d_taps_upper[filter_size-i-1] = t2;
- }
-
- d_updated = true;
-
- // Set the history to ensure enough input items for each filter
- set_history(filter_size+1);
- d_filter_upper = gr_fir_util::create_gr_fir_ccc(d_taps_upper);
- d_filter_lower = gr_fir_util::create_gr_fir_ccc(d_taps_lower);
-}
-
-void
-digital_fll_band_edge_cc::print_taps()
-{
- unsigned int i;
-
- printf("Upper Band-edge: [");
- for(i = 0; i < d_taps_upper.size(); i++) {
- printf(" %.4e + %.4ej,", d_taps_upper[i].real(), d_taps_upper[i].imag());
- }
- printf("]\n\n");
-
- printf("Lower Band-edge: [");
- for(i = 0; i < d_taps_lower.size(); i++) {
- printf(" %.4e + %.4ej,", d_taps_lower[i].real(), d_taps_lower[i].imag());
- }
- printf("]\n\n");
-}
-
-int
-digital_fll_band_edge_cc::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- const gr_complex *in = (const gr_complex*)input_items[0];
- gr_complex *out = (gr_complex*)output_items[0];
-
- d_fllbuffer.reserve(d_filter_size+noutput_items);
-
- float *frq = NULL;
- float *phs = NULL;
- float *err = NULL;
- if(output_items.size() == 4) {
- frq = (float*)output_items[1];
- phs = (float*)output_items[2];
- err = (float*)output_items[3];
- }
-
- if(d_updated) {
- d_updated = false;
- return 0; // history requirements may have changed.
- }
-
- int i;
- float error;
- gr_complex nco_out;
- gr_complex out_upper, out_lower;
- gr_complex out_uppersse, out_lowersse;
- copy( d_output_hist.begin(), d_output_hist.end(), d_fllbuffer.begin());
-
- for(i = 0; i < noutput_items; i++) {
- nco_out = gr_expj(d_phase);
- d_fllbuffer[i+d_filter_size] = in[i] * nco_out;
- // Perform the dot product of the output with the filters
- out_upper = 0;
- out_lower = 0;
-
- out_upper = d_filter_lower->filter(&d_fllbuffer[i]);
- out_lower = d_filter_upper->filter(&d_fllbuffer[i]);
-
- error = norm(out_lower) - norm(out_upper);
-
- advance_loop(error);
- phase_wrap();
- frequency_limit();
-
- if(output_items.size() == 4) {
- frq[i] = d_freq;
- phs[i] = d_phase;
- err[i] = error;
- }
- }
-
- copy(d_fllbuffer.begin(), d_fllbuffer.begin()+noutput_items, out);
- copy(d_fllbuffer.begin()+noutput_items,
- d_fllbuffer.begin()+noutput_items+d_filter_size,
- d_output_hist.begin());
-
- return noutput_items;
-}
diff --git a/gr-digital/lib/digital_framer_sink_1.cc b/gr-digital/lib/digital_framer_sink_1.cc
deleted file mode 100644
index ba1c5bd50e..0000000000
--- a/gr-digital/lib/digital_framer_sink_1.cc
+++ /dev/null
@@ -1,192 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2006,2010,2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <digital_framer_sink_1.h>
-#include <gr_io_signature.h>
-#include <cstdio>
-#include <stdexcept>
-#include <string.h>
-
-#define VERBOSE 0
-
-inline void
-digital_framer_sink_1::enter_search()
-{
- if (VERBOSE)
- fprintf(stderr, "@ enter_search\n");
-
- d_state = STATE_SYNC_SEARCH;
-}
-
-inline void
-digital_framer_sink_1::enter_have_sync()
-{
- if (VERBOSE)
- fprintf(stderr, "@ enter_have_sync\n");
-
- d_state = STATE_HAVE_SYNC;
- d_header = 0;
- d_headerbitlen_cnt = 0;
-}
-
-inline void
-digital_framer_sink_1::enter_have_header(int payload_len,
- int whitener_offset)
-{
- if (VERBOSE)
- fprintf(stderr, "@ enter_have_header (payload_len = %d) (offset = %d)\n",
- payload_len, whitener_offset);
-
- d_state = STATE_HAVE_HEADER;
- d_packetlen = payload_len;
- d_packet_whitener_offset = whitener_offset;
- d_packetlen_cnt = 0;
- d_packet_byte = 0;
- d_packet_byte_index = 0;
-}
-
-digital_framer_sink_1_sptr
-digital_make_framer_sink_1(gr_msg_queue_sptr target_queue)
-{
- return gnuradio::get_initial_sptr(new digital_framer_sink_1(target_queue));
-}
-
-
-digital_framer_sink_1::digital_framer_sink_1(gr_msg_queue_sptr target_queue)
- : gr_sync_block ("framer_sink_1",
- gr_make_io_signature (1, 1, sizeof(unsigned char)),
- gr_make_io_signature (0, 0, 0)),
- d_target_queue(target_queue)
-{
- enter_search();
-}
-
-digital_framer_sink_1::~digital_framer_sink_1 ()
-{
-}
-
-int
-digital_framer_sink_1::work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- const unsigned char *in = (const unsigned char *) input_items[0];
- int count=0;
-
- if (VERBOSE)
- fprintf(stderr,">>> Entering state machine\n");
-
- while (count < noutput_items){
- switch(d_state) {
-
- case STATE_SYNC_SEARCH: // Look for flag indicating beginning of pkt
- if (VERBOSE)
- fprintf(stderr,"SYNC Search, noutput=%d\n", noutput_items);
-
- while (count < noutput_items) {
- if (in[count] & 0x2){ // Found it, set up for header decode
- enter_have_sync();
- break;
- }
- count++;
- }
- break;
-
- case STATE_HAVE_SYNC:
- if (VERBOSE)
- fprintf(stderr,"Header Search bitcnt=%d, header=0x%08x\n",
- d_headerbitlen_cnt, d_header);
-
- while (count < noutput_items) { // Shift bits one at a time into header
- d_header = (d_header << 1) | (in[count++] & 0x1);
- if (++d_headerbitlen_cnt == HEADERBITLEN) {
-
- if (VERBOSE)
- fprintf(stderr, "got header: 0x%08x\n", d_header);
-
- // we have a full header, check to see if it has been received properly
- if (header_ok()){
- int payload_len;
- int whitener_offset;
- header_payload(&payload_len, &whitener_offset);
- enter_have_header(payload_len, whitener_offset);
-
- if (d_packetlen == 0){ // check for zero-length payload
- // build a zero-length message
- // NOTE: passing header field as arg1 is not scalable
- gr_message_sptr msg =
- gr_make_message(0, d_packet_whitener_offset, 0, 0);
-
- d_target_queue->insert_tail(msg); // send it
- msg.reset(); // free it up
-
- enter_search();
- }
- }
- else
- enter_search(); // bad header
- break; // we're in a new state
- }
- }
- break;
-
- case STATE_HAVE_HEADER:
- if (VERBOSE)
- fprintf(stderr,"Packet Build\n");
-
- while (count < noutput_items) { // shift bits into bytes of packet one at a time
- d_packet_byte = (d_packet_byte << 1) | (in[count++] & 0x1);
- if (d_packet_byte_index++ == 7) { // byte is full so move to next byte
- d_packet[d_packetlen_cnt++] = d_packet_byte;
- d_packet_byte_index = 0;
-
- if (d_packetlen_cnt == d_packetlen){ // packet is filled
-
- // build a message
- // NOTE: passing header field as arg1 is not scalable
- gr_message_sptr msg =
- gr_make_message(0, d_packet_whitener_offset, 0, d_packetlen_cnt);
- memcpy(msg->msg(), d_packet, d_packetlen_cnt);
-
- d_target_queue->insert_tail(msg); // send it
- msg.reset(); // free it up
-
- enter_search();
- break;
- }
- }
- }
- break;
-
- default:
- assert(0);
-
- } // switch
-
- } // while
-
- return noutput_items;
-}
diff --git a/gr-digital/lib/digital_glfsr_source_b.cc b/gr-digital/lib/digital_glfsr_source_b.cc
deleted file mode 100644
index e557e475a8..0000000000
--- a/gr-digital/lib/digital_glfsr_source_b.cc
+++ /dev/null
@@ -1,86 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2007,2010,2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <digital_glfsr_source_b.h>
-#include <gri_glfsr.h>
-#include <gr_io_signature.h>
-#include <stdexcept>
-
-digital_glfsr_source_b_sptr
-digital_make_glfsr_source_b(int degree, bool repeat, int mask, int seed)
-{
- return gnuradio::get_initial_sptr(new digital_glfsr_source_b
- (degree, repeat, mask, seed));
-}
-
-digital_glfsr_source_b::digital_glfsr_source_b(int degree, bool repeat,
- int mask, int seed)
- : gr_sync_block ("glfsr_source_b",
- gr_make_io_signature (0, 0, 0),
- gr_make_io_signature (1, 1, sizeof(unsigned char))),
- d_repeat(repeat),
- d_index(0)
-{
- if (degree < 1 || degree > 32)
- throw std::runtime_error("digital_glfsr_source_b: degree must be between 1 and 32 inclusive");
- d_length = (unsigned int)((1ULL << degree)-1);
-
- if (mask == 0)
- mask = gri_glfsr::glfsr_mask(degree);
- d_glfsr = new gri_glfsr(mask, seed);
-}
-
-digital_glfsr_source_b::~digital_glfsr_source_b()
-{
- delete d_glfsr;
-}
-
-int
-digital_glfsr_source_b::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- char *out = (char *) output_items[0];
- if ((d_index > d_length) && d_repeat == false)
- return -1; /* once through the sequence */
-
- int i;
- for (i = 0; i < noutput_items; i++) {
- out[i] = d_glfsr->next_bit();
- d_index++;
- if (d_index > d_length && d_repeat == false)
- break;
- }
-
- return i;
-}
-
-int
-digital_glfsr_source_b::mask() const
-{
- return d_glfsr->mask();
-}
diff --git a/gr-digital/lib/digital_glfsr_source_f.cc b/gr-digital/lib/digital_glfsr_source_f.cc
deleted file mode 100644
index 5a7736ef8d..0000000000
--- a/gr-digital/lib/digital_glfsr_source_f.cc
+++ /dev/null
@@ -1,86 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2007,2010,2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <digital_glfsr_source_f.h>
-#include <gri_glfsr.h>
-#include <gr_io_signature.h>
-#include <stdexcept>
-
-digital_glfsr_source_f_sptr
-digital_make_glfsr_source_f(int degree, bool repeat, int mask, int seed)
-{
- return gnuradio::get_initial_sptr(new digital_glfsr_source_f
- (degree, repeat, mask, seed));
-}
-
-digital_glfsr_source_f::digital_glfsr_source_f(int degree, bool repeat,
- int mask, int seed)
- : gr_sync_block ("glfsr_source_f",
- gr_make_io_signature (0, 0, 0),
- gr_make_io_signature (1, 1, sizeof(float))),
- d_repeat(repeat),
- d_index(0)
-{
- if (degree < 1 || degree > 32)
- throw std::runtime_error("digital_glfsr_source_f: degree must be between 1 and 32 inclusive");
- d_length = (unsigned int)((1ULL << degree)-1);
-
- if (mask == 0)
- mask = gri_glfsr::glfsr_mask(degree);
- d_glfsr = new gri_glfsr(mask, seed);
-}
-
-digital_glfsr_source_f::~digital_glfsr_source_f()
-{
- delete d_glfsr;
-}
-
-int
-digital_glfsr_source_f::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- float *out = (float *) output_items[0];
- if ((d_index > d_length) && d_repeat == false)
- return -1; /* once through the sequence */
-
- int i;
- for (i = 0; i < noutput_items; i++) {
- out[i] = (float)d_glfsr->next_bit()*2.0-1.0;
- d_index++;
- if (d_index > d_length && d_repeat == false)
- break;
- }
-
- return i;
-}
-
-int
-digital_glfsr_source_f::mask() const
-{
- return d_glfsr->mask();
-}
diff --git a/gr-digital/lib/digital_gmskmod_bc.cc b/gr-digital/lib/digital_gmskmod_bc.cc
deleted file mode 100644
index e53e900370..0000000000
--- a/gr-digital/lib/digital_gmskmod_bc.cc
+++ /dev/null
@@ -1,44 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2010 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <digital_gmskmod_bc.h>
-#include <gr_io_signature.h>
-
-// Shared pointer constructor
-digital_gmskmod_bc_sptr
-digital_make_gmskmod_bc(unsigned samples_per_sym,
- double bt, unsigned L)
-{
- return gnuradio::get_initial_sptr(new digital_gmskmod_bc(samples_per_sym, bt, L));
-}
-
-
-digital_gmskmod_bc::digital_gmskmod_bc(unsigned samples_per_sym,
- double bt, unsigned L)
- : digital_cpmmod_bc(gr_cpm::GAUSSIAN, 0.5, samples_per_sym, L, bt)
-{
-}
-
diff --git a/gr-digital/lib/digital_impl_glfsr.cc b/gr-digital/lib/digital_impl_glfsr.cc
deleted file mode 100644
index 342980e535..0000000000
--- a/gr-digital/lib/digital_impl_glfsr.cc
+++ /dev/null
@@ -1,67 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2007,2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#include <digital_impl_glfsr.h>
-#include <stdexcept>
-
-static int s_polynomial_masks[] = {
- 0x00000000,
- 0x00000001, // x^1 + 1
- 0x00000003, // x^2 + x^1 + 1
- 0x00000005, // x^3 + x^1 + 1
- 0x00000009, // x^4 + x^1 + 1
- 0x00000012, // x^5 + x^2 + 1
- 0x00000021, // x^6 + x^1 + 1
- 0x00000041, // x^7 + x^1 + 1
- 0x0000008E, // x^8 + x^4 + x^3 + x^2 + 1
- 0x00000108, // x^9 + x^4 + 1
- 0x00000204, // x^10 + x^4 + 1
- 0x00000402, // x^11 + x^2 + 1
- 0x00000829, // x^12 + x^6 + x^4 + x^1 + 1
- 0x0000100D, // x^13 + x^4 + x^3 + x^1 + 1
- 0x00002015, // x^14 + x^5 + x^3 + x^1 + 1
- 0x00004001, // x^15 + x^1 + 1
- 0x00008016, // x^16 + x^5 + x^3 + x^2 + 1
- 0x00010004, // x^17 + x^3 + 1
- 0x00020013, // x^18 + x^5 + x^2 + x^1 + 1
- 0x00040013, // x^19 + x^5 + x^2 + x^1 + 1
- 0x00080004, // x^20 + x^3 + 1
- 0x00100002, // x^21 + x^2 + 1
- 0x00200001, // x^22 + x^1 + 1
- 0x00400010, // x^23 + x^5 + 1
- 0x0080000D, // x^24 + x^4 + x^3 + x^1 + 1
- 0x01000004, // x^25 + x^3 + 1
- 0x02000023, // x^26 + x^6 + x^2 + x^1 + 1
- 0x04000013, // x^27 + x^5 + x^2 + x^1 + 1
- 0x08000004, // x^28 + x^3 + 1
- 0x10000002, // x^29 + x^2 + 1
- 0x20000029, // x^30 + x^4 + x^1 + 1
- 0x40000004, // x^31 + x^3 + 1
- 0x80000057 // x^32 + x^7 + x^5 + x^3 + x^2 + x^1 + 1
-};
-
-int digital_impl_glfsr::glfsr_mask(int degree)
-{
- if (degree < 1 || degree > 32)
- throw std::runtime_error("digital_impl_glfsr::glfsr_mask(): degree must be between 1 and 32 inclusive");
- return s_polynomial_masks[degree];
-}
diff --git a/gr-digital/lib/digital_impl_mpsk_snr_est.cc b/gr-digital/lib/digital_impl_mpsk_snr_est.cc
deleted file mode 100644
index 38177083fc..0000000000
--- a/gr-digital/lib/digital_impl_mpsk_snr_est.cc
+++ /dev/null
@@ -1,256 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <digital_impl_mpsk_snr_est.h>
-#include <cstdio>
-
-digital_impl_mpsk_snr_est::digital_impl_mpsk_snr_est(double alpha)
-{
- set_alpha(alpha);
-}
-
-digital_impl_mpsk_snr_est::~digital_impl_mpsk_snr_est()
-{}
-
-void
-digital_impl_mpsk_snr_est::set_alpha(double alpha)
-{
- d_alpha = alpha;
- d_beta = 1.0-alpha;
-}
-
-double
-digital_impl_mpsk_snr_est::alpha() const
-{
- return d_alpha;
-}
-
-int
-digital_impl_mpsk_snr_est::update(int noutput_items,
- const gr_complex *in)
-{
- throw std::runtime_error("digital_impl_mpsk_snr_est: Unimplemented");
-}
-
-double
-digital_impl_mpsk_snr_est::snr()
-{
- throw std::runtime_error("digital_impl_mpsk_snr_est: Unimplemented");
-}
-
-
-/********************************************************************/
-
-
-digital_impl_mpsk_snr_est_simple::digital_impl_mpsk_snr_est_simple(
- double alpha) :
- digital_impl_mpsk_snr_est(alpha)
-{
- d_y1 = 0;
- d_y2 = 0;
-}
-
-int
-digital_impl_mpsk_snr_est_simple::update(
- int noutput_items,
- const gr_complex *in)
-{
- for (int i = 0; i < noutput_items; i++){
- double y1 = abs(in[i]);
- d_y1 = d_alpha*y1 + d_beta*d_y1;
-
- double y2 = real(in[i]*in[i]);
- d_y2 = d_alpha*y2 + d_beta*d_y2;
- }
- return noutput_items;
-}
-
-double
-digital_impl_mpsk_snr_est_simple::snr()
-{
- double y1_2 = d_y1*d_y1;
- double y3 = y1_2 - d_y2 + 1e-20;
- return 10.0*log10(y1_2/y3);
-}
-
-
-/********************************************************************/
-
-
-digital_impl_mpsk_snr_est_skew::digital_impl_mpsk_snr_est_skew(
- double alpha) :
- digital_impl_mpsk_snr_est(alpha)
-{
- d_y1 = 0;
- d_y2 = 0;
- d_y3 = 0;
-}
-
-
-int
-digital_impl_mpsk_snr_est_skew::update(
- int noutput_items,
- const gr_complex *in)
-{
- for (int i = 0; i < noutput_items; i++){
- double y1 = abs(in[i]);
- d_y1 = d_alpha*y1 + d_beta*d_y1;
-
- double y2 = real(in[i]*in[i]);
- d_y2 = d_alpha*y2 + d_beta*d_y2;
-
- // online algorithm for calculating skewness
- // See:
- // http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Higher-order_statistics
- double d = abs(in[i]) - d_y1;
- double d_i = d / (i+1);
- double y3 = (d*d_i*i)*d_i*(i-1) - 3.0*d_i*d_y2;
- d_y3 = d_alpha*y3 + d_beta*d_y3;
- }
- return noutput_items;
-}
-
-double
-digital_impl_mpsk_snr_est_skew::snr()
-{
- double y3 = d_y3*d_y3 / (d_y2*d_y2*d_y2);
- double y1_2 = d_y1*d_y1;
- double x = y1_2 - d_y2;
- return 10.0*log10(y1_2 / (x + y3*y1_2));
-}
-
-
-/********************************************************************/
-
-
-digital_impl_mpsk_snr_est_m2m4::digital_impl_mpsk_snr_est_m2m4(
- double alpha) :
- digital_impl_mpsk_snr_est(alpha)
-{
- d_y1 = 0;
- d_y2 = 0;
-}
-
-int
-digital_impl_mpsk_snr_est_m2m4::update(
- int noutput_items,
- const gr_complex *in)
-{
- for (int i = 0; i < noutput_items; i++){
- double y1 = abs(in[i])*abs(in[i]);
- d_y1 = d_alpha*y1 + d_beta*d_y1;
-
- double y2 = abs(in[i])*abs(in[i])*abs(in[i])*abs(in[i]);
- d_y2 = d_alpha*y2 + d_beta*d_y2;
- }
- return noutput_items;
-}
-
-double
-digital_impl_mpsk_snr_est_m2m4::snr()
-{
- double y1_2 = d_y1*d_y1;
- return 10.0*log10(2.0*sqrt(2*y1_2 - d_y2) /
- (d_y1 - sqrt(2*y1_2 - d_y2)));
-}
-
-
-/********************************************************************/
-
-
-digital_impl_snr_est_m2m4::digital_impl_snr_est_m2m4(
- double alpha, double ka, double kw) :
- digital_impl_mpsk_snr_est(alpha)
-{
- d_y1 = 0;
- d_y2 = 0;
- d_ka = ka;
- d_kw = kw;
-}
-
-int
-digital_impl_snr_est_m2m4::update(
- int noutput_items,
- const gr_complex *in)
-{
- for (int i = 0; i < noutput_items; i++) {
- double y1 = abs(in[i])*abs(in[i]);
- d_y1 = d_alpha*y1 + d_beta*d_y1;
-
- double y2 = abs(in[i])*abs(in[i])*abs(in[i])*abs(in[i]);
- d_y2 = d_alpha*y2 + d_beta*d_y2;
- }
- return noutput_items;
-}
-
-double
-digital_impl_snr_est_m2m4::snr()
-{
- double M2 = d_y1;
- double M4 = d_y2;
- double s = M2*(d_kw - 2) +
- sqrt((4.0-d_ka*d_kw)*M2*M2 + M4*(d_ka+d_kw-4.0)) /
- (d_ka + d_kw - 4.0);
- double n = M2 - s;
-
- return 10.0*log10(s / n);
-}
-
-
-/********************************************************************/
-
-
-digital_impl_mpsk_snr_est_svr::digital_impl_mpsk_snr_est_svr(
- double alpha) :
- digital_impl_mpsk_snr_est(alpha)
-{
- d_y1 = 0;
- d_y2 = 0;
-}
-
-int
-digital_impl_mpsk_snr_est_svr::update(
- int noutput_items,
- const gr_complex *in)
-{
- for (int i = 0; i < noutput_items; i++){
- double x = abs(in[i]);
- double x1 = abs(in[i-1]);
- double y1 = (x*x)*(x1*x1);
- d_y1 = d_alpha*y1 + d_beta*d_y1;
-
- double y2 = x*x*x*x;
- d_y2 = d_alpha*y2 + d_beta*d_y2;
- }
- return noutput_items;
-}
-
-double
-digital_impl_mpsk_snr_est_svr::snr()
-{
- double x = d_y1 / (d_y2 - d_y1);
- return 10.0*log10(2.*((x-1) + sqrt(x*(x-1))));
-}
diff --git a/gr-digital/lib/digital_kurtotic_equalizer_cc.cc b/gr-digital/lib/digital_kurtotic_equalizer_cc.cc
deleted file mode 100644
index c95b560216..0000000000
--- a/gr-digital/lib/digital_kurtotic_equalizer_cc.cc
+++ /dev/null
@@ -1,51 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <digital_kurtotic_equalizer_cc.h>
-
-digital_kurtotic_equalizer_cc_sptr
-digital_make_kurtotic_equalizer_cc(int num_taps, float mu)
-{
- return gnuradio::get_initial_sptr(new digital_kurtotic_equalizer_cc(num_taps, mu));
-}
-
-digital_kurtotic_equalizer_cc::digital_kurtotic_equalizer_cc(int num_taps, float mu)
- : gr_adaptive_fir_ccc("kurtotic_equalizer_cc", 1, std::vector<gr_complex>(num_taps))
-{
- set_gain(mu);
- if (num_taps > 0)
- d_taps[0] = 1.0;
-
- d_alpha_p = 0.01;
- d_alpha_q = 0.01;
- d_alpha_m = 0.01;
-
- d_p = 0.0f;
- d_m = 0.0f;
- d_q = gr_complex(0,0);
- d_u = gr_complex(0,0);
-}
-
diff --git a/gr-digital/lib/digital_lms_dd_equalizer_cc.cc b/gr-digital/lib/digital_lms_dd_equalizer_cc.cc
deleted file mode 100644
index e2c2f16f28..0000000000
--- a/gr-digital/lib/digital_lms_dd_equalizer_cc.cc
+++ /dev/null
@@ -1,85 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <digital_lms_dd_equalizer_cc.h>
-#include <gr_io_signature.h>
-#include <gr_misc.h>
-#include <iostream>
-
-digital_lms_dd_equalizer_cc_sptr
-digital_make_lms_dd_equalizer_cc(int num_taps, float mu, int sps,
- digital_constellation_sptr cnst)
-{
- return gnuradio::get_initial_sptr(new digital_lms_dd_equalizer_cc(num_taps, mu,
- sps, cnst));
-}
-
-digital_lms_dd_equalizer_cc::digital_lms_dd_equalizer_cc(int num_taps, float mu,
- int sps,
- digital_constellation_sptr cnst)
- : gr_adaptive_fir_ccc("lms_dd_equalizer_cc", sps,
- std::vector<gr_complex>(num_taps, gr_complex(0,0))),
- d_taps(num_taps), d_cnst(cnst)
-{
- set_gain(mu);
- if (num_taps > 0)
- d_taps[num_taps/2] = 1.0;
-}
-
-
-
-
-/*
-int
-digital_lms_dd_equalizer_cc::work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- const gr_complex *in = (const gr_complex *) input_items[0];
- gr_complex *out = (gr_complex *) output_items[0];
-
- gr_complex acc, decision, error;
-
- for(int i = 0; i < noutput_items; i++) {
- acc = 0;
-
- // Compute output
- for (size_t j=0; j < d_taps.size(); j++)
- acc += in[i+j] * conj(d_taps[j]);
-
- d_cnst->map_to_points(d_cnst->decision_maker(&acc), &decision);
- error = decision - acc;
-
- // Update taps
- for (size_t j=0; j < d_taps.size(); j++)
- d_taps[j] += d_mu * conj(error) * in[i+j];
-
- out[i] = acc;
- }
-
- return noutput_items;
-}
-*/
diff --git a/gr-digital/lib/digital_map_bb.cc b/gr-digital/lib/digital_map_bb.cc
deleted file mode 100644
index 1d8444a405..0000000000
--- a/gr-digital/lib/digital_map_bb.cc
+++ /dev/null
@@ -1,61 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2006,2007,2010,2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <digital_map_bb.h>
-#include <gr_io_signature.h>
-
-digital_map_bb_sptr
-digital_make_map_bb (const std::vector<int> &map)
-{
- return gnuradio::get_initial_sptr(new digital_map_bb (map));
-}
-
-digital_map_bb::digital_map_bb (const std::vector<int> &map)
- : gr_sync_block ("map_bb",
- gr_make_io_signature (1, 1, sizeof (unsigned char)),
- gr_make_io_signature (1, 1, sizeof (unsigned char)))
-{
- for (int i = 0; i < 0x100; i++)
- d_map[i] = i;
-
- unsigned int size = std::min((size_t) 0x100, map.size());
- for (unsigned int i = 0; i < size; i++)
- d_map[i] = map[i];
-}
-
-int
-digital_map_bb::work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- const unsigned char *in = (const unsigned char *) input_items[0];
- unsigned char *out = (unsigned char *) output_items[0];
-
- for (int i = 0; i < noutput_items; i++)
- out[i] = d_map[in[i]];
-
- return noutput_items;
-}
diff --git a/gr-digital/lib/digital_mpsk_receiver_cc.cc b/gr-digital/lib/digital_mpsk_receiver_cc.cc
deleted file mode 100644
index 6d2bab8a4e..0000000000
--- a/gr-digital/lib/digital_mpsk_receiver_cc.cc
+++ /dev/null
@@ -1,329 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2005,2006,2007,2010,2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gr_io_signature.h>
-#include <gr_prefs.h>
-#include <digital_mpsk_receiver_cc.h>
-#include <stdexcept>
-#include <gr_math.h>
-#include <gr_expj.h>
-#include <gri_mmse_fir_interpolator_cc.h>
-
-
-#define M_TWOPI (2*M_PI)
-#define VERBOSE_MM 0 // Used for debugging symbol timing loop
-#define VERBOSE_COSTAS 0 // Used for debugging phase and frequency tracking
-
-// Public constructor
-
-digital_mpsk_receiver_cc_sptr
-digital_make_mpsk_receiver_cc(unsigned int M, float theta,
- float loop_bw,
- float fmin, float fmax,
- float mu, float gain_mu,
- float omega, float gain_omega, float omega_rel)
-{
- return gnuradio::get_initial_sptr(new digital_mpsk_receiver_cc (M, theta,
- loop_bw,
- fmin, fmax,
- mu, gain_mu,
- omega, gain_omega,
- omega_rel));
-}
-
-digital_mpsk_receiver_cc::digital_mpsk_receiver_cc (unsigned int M, float theta,
- float loop_bw,
- float fmin, float fmax,
- float mu, float gain_mu,
- float omega, float gain_omega,
- float omega_rel)
- : gr_block ("mpsk_receiver_cc",
- gr_make_io_signature (1, 1, sizeof (gr_complex)),
- gr_make_io_signature (1, 1, sizeof (gr_complex))),
- gri_control_loop(loop_bw, fmax, fmin),
- d_M(M), d_theta(theta),
- d_current_const_point(0),
- d_mu(mu), d_gain_mu(gain_mu), d_gain_omega(gain_omega),
- d_omega_rel(omega_rel), d_max_omega(0), d_min_omega(0),
- d_p_2T(0), d_p_1T(0), d_p_0T(0), d_c_2T(0), d_c_1T(0), d_c_0T(0)
-{
- d_interp = new gri_mmse_fir_interpolator_cc();
- d_dl_idx = 0;
-
- set_omega(omega);
-
- if (omega <= 0.0)
- throw std::out_of_range ("clock rate must be > 0");
- if (gain_mu < 0 || gain_omega < 0)
- throw std::out_of_range ("Gains must be non-negative");
-
- assert(d_interp->ntaps() <= DLLEN);
-
- // zero double length delay line.
- for (unsigned int i = 0; i < 2 * DLLEN; i++)
- d_dl[i] = gr_complex(0.0,0.0);
-
- set_modulation_order(d_M);
-}
-
-digital_mpsk_receiver_cc::~digital_mpsk_receiver_cc ()
-{
- delete d_interp;
-}
-
-void
-digital_mpsk_receiver_cc::set_modulation_order(unsigned int M)
-{
- // build the constellation vector from M
- make_constellation();
-
- // Select a phase detector and a decision maker for the modulation order
- switch(d_M) {
- case 2: // optimized algorithms for BPSK
- d_phase_error_detector = &digital_mpsk_receiver_cc::phase_error_detector_bpsk; //bpsk;
- d_decision = &digital_mpsk_receiver_cc::decision_bpsk;
- break;
-
- case 4: // optimized algorithms for QPSK
- d_phase_error_detector = &digital_mpsk_receiver_cc::phase_error_detector_qpsk; //qpsk;
- d_decision = &digital_mpsk_receiver_cc::decision_qpsk;
- break;
-
- default: // generic algorithms for any M (power of 2?) but not pretty
- d_phase_error_detector = &digital_mpsk_receiver_cc::phase_error_detector_generic;
- d_decision = &digital_mpsk_receiver_cc::decision_generic;
- break;
- }
-}
-
-void
-digital_mpsk_receiver_cc::set_gain_omega_rel(float omega_rel)
-{
- d_omega_rel = omega_rel;
- set_omega(d_omega);
-}
-
-void
-digital_mpsk_receiver_cc::forecast(int noutput_items, gr_vector_int &ninput_items_required)
-{
- unsigned ninputs = ninput_items_required.size();
- for (unsigned i=0; i < ninputs; i++)
- ninput_items_required[i] = (int) ceil((noutput_items * d_omega) + d_interp->ntaps());
-}
-
-// FIXME add these back in an test difference in performance
-float
-digital_mpsk_receiver_cc::phase_error_detector_qpsk(gr_complex sample) const
-{
- float phase_error = 0;
- if(fabsf(sample.real()) > fabsf(sample.imag())) {
- if(sample.real() > 0)
- phase_error = -sample.imag();
- else
- phase_error = sample.imag();
- }
- else {
- if(sample.imag() > 0)
- phase_error = sample.real();
- else
- phase_error = -sample.real();
- }
-
- return phase_error;
-}
-
-float
-digital_mpsk_receiver_cc::phase_error_detector_bpsk(gr_complex sample) const
-{
- return -(sample.real()*sample.imag());
-}
-
-float digital_mpsk_receiver_cc::phase_error_detector_generic(gr_complex sample) const
-{
- //return gr_fast_atan2f(sample*conj(d_constellation[d_current_const_point]));
- return -arg(sample*conj(d_constellation[d_current_const_point]));
-}
-
-unsigned int
-digital_mpsk_receiver_cc::decision_bpsk(gr_complex sample) const
-{
- return (gr_branchless_binary_slicer(sample.real()) ^ 1);
- //return gr_binary_slicer(sample.real()) ^ 1;
-}
-
-unsigned int
-digital_mpsk_receiver_cc::decision_qpsk(gr_complex sample) const
-{
- unsigned int index;
-
- //index = gr_branchless_quad_0deg_slicer(sample);
- index = gr_quad_0deg_slicer(sample);
- return index;
-}
-
-unsigned int
-digital_mpsk_receiver_cc::decision_generic(gr_complex sample) const
-{
- unsigned int min_m = 0;
- float min_s = 65535;
-
- // Develop all possible constellation points and find the one that minimizes
- // the Euclidean distance (error) with the sample
- for(unsigned int m=0; m < d_M; m++) {
- gr_complex diff = norm(d_constellation[m] - sample);
-
- if(fabs(diff.real()) < min_s) {
- min_s = fabs(diff.real());
- min_m = m;
- }
- }
- // Return the index of the constellation point that minimizes the error
- return min_m;
-}
-
-
-void
-digital_mpsk_receiver_cc::make_constellation()
-{
- for(unsigned int m=0; m < d_M; m++) {
- d_constellation.push_back(gr_expj((M_TWOPI/d_M)*m));
- }
-}
-
-void
-digital_mpsk_receiver_cc::mm_sampler(const gr_complex symbol)
-{
- gr_complex sample, nco;
-
- d_mu--; // skip a number of symbols between sampling
- d_phase += d_freq; // increment the phase based on the frequency of the rotation
-
- // Keep phase clamped and not walk to infinity
- while(d_phase > M_TWOPI)
- d_phase -= M_TWOPI;
- while(d_phase < -M_TWOPI)
- d_phase += M_TWOPI;
-
- nco = gr_expj(d_phase+d_theta); // get the NCO value for derotating the current sample
- sample = nco*symbol; // get the downconverted symbol
-
- // Fill up the delay line for the interpolator
- d_dl[d_dl_idx] = sample;
- d_dl[(d_dl_idx + DLLEN)] = sample; // put this in the second half of the buffer for overflows
- d_dl_idx = (d_dl_idx+1) % DLLEN; // Keep the delay line index in bounds
-}
-
-void
-digital_mpsk_receiver_cc::mm_error_tracking(gr_complex sample)
-{
- gr_complex u, x, y;
- float mm_error = 0;
-
- // Make sample timing corrections
-
- // set the delayed samples
- d_p_2T = d_p_1T;
- d_p_1T = d_p_0T;
- d_p_0T = sample;
- d_c_2T = d_c_1T;
- d_c_1T = d_c_0T;
-
- d_current_const_point = (*this.*d_decision)(d_p_0T); // make a decision on the sample value
- d_c_0T = d_constellation[d_current_const_point];
-
- x = (d_c_0T - d_c_2T) * conj(d_p_1T);
- y = (d_p_0T - d_p_2T) * conj(d_c_1T);
- u = y - x;
- mm_error = u.real(); // the error signal is in the real part
- mm_error = gr_branchless_clip(mm_error, 1.0); // limit mm_val
-
- d_omega = d_omega + d_gain_omega * mm_error; // update omega based on loop error
- d_omega = d_omega_mid + gr_branchless_clip(d_omega-d_omega_mid, d_omega_rel); // make sure we don't walk away
-
- d_mu += d_omega + d_gain_mu * mm_error; // update mu based on loop error
-
-#if VERBOSE_MM
- printf("mm: mu: %f omega: %f mm_error: %f sample: %f+j%f constellation: %f+j%f\n",
- d_mu, d_omega, mm_error, sample.real(), sample.imag(),
- d_constellation[d_current_const_point].real(), d_constellation[d_current_const_point].imag());
-#endif
-}
-
-
-void
-digital_mpsk_receiver_cc::phase_error_tracking(gr_complex sample)
-{
- float phase_error = 0;
-
- // Make phase and frequency corrections based on sampled value
- phase_error = (*this.*d_phase_error_detector)(sample);
-
- advance_loop(phase_error);
- phase_wrap();
- frequency_limit();
-
-#if VERBOSE_COSTAS
- printf("cl: phase_error: %f phase: %f freq: %f sample: %f+j%f constellation: %f+j%f\n",
- phase_error, d_phase, d_freq, sample.real(), sample.imag(),
- d_constellation[d_current_const_point].real(), d_constellation[d_current_const_point].imag());
-#endif
-}
-
-int
-digital_mpsk_receiver_cc::general_work (int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- const gr_complex *in = (const gr_complex *) input_items[0];
- gr_complex *out = (gr_complex *) output_items[0];
-
- int i=0, o=0;
-
- while((o < noutput_items) && (i < ninput_items[0])) {
- while((d_mu > 1) && (i < ninput_items[0])) {
- mm_sampler(in[i]); // puts symbols into a buffer and adjusts d_mu
- i++;
- }
-
- if(i < ninput_items[0]) {
- gr_complex interp_sample = d_interp->interpolate(&d_dl[d_dl_idx], d_mu);
-
- mm_error_tracking(interp_sample); // corrects M&M sample time
- phase_error_tracking(interp_sample); // corrects phase and frequency offsets
-
- out[o++] = interp_sample;
- }
- }
-
- #if 0
- printf("ninput_items: %d noutput_items: %d consuming: %d returning: %d\n",
- ninput_items[0], noutput_items, i, o);
- #endif
-
- consume_each(i);
- return o;
-}
diff --git a/gr-digital/lib/digital_mpsk_snr_est_cc.cc b/gr-digital/lib/digital_mpsk_snr_est_cc.cc
deleted file mode 100644
index b5a60f0d38..0000000000
--- a/gr-digital/lib/digital_mpsk_snr_est_cc.cc
+++ /dev/null
@@ -1,186 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <digital_mpsk_snr_est_cc.h>
-#include <gr_io_signature.h>
-#include <cstdio>
-
-digital_mpsk_snr_est_cc_sptr
-digital_make_mpsk_snr_est_cc(snr_est_type_t type,
- int tag_nsamples,
- double alpha)
-{
- return gnuradio::get_initial_sptr(new digital_mpsk_snr_est_cc(
- type, tag_nsamples, alpha));
-}
-
-digital_mpsk_snr_est_cc::digital_mpsk_snr_est_cc(snr_est_type_t type,
- int tag_nsamples,
- double alpha)
- : gr_sync_block ("mpsk_snr_est_cc",
- gr_make_io_signature(1, 1, sizeof(gr_complex)),
- gr_make_io_signature(1, 1, sizeof(gr_complex)))
-{
- d_snr_est = NULL;
-
- d_type = type;
- d_nsamples = tag_nsamples;
- d_count = 0;
- set_alpha(alpha);
-
- set_type(type);
-
- // at least 1 estimator has to look back
- set_history(2);
-
- std::stringstream str;
- str << name() << unique_id();
- d_me = pmt::pmt_string_to_symbol(str.str());
- d_key = pmt::pmt_string_to_symbol("snr");
-}
-
-digital_mpsk_snr_est_cc::~digital_mpsk_snr_est_cc()
-{
- if(d_snr_est)
- delete d_snr_est;
-}
-
-int
-digital_mpsk_snr_est_cc::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- // This is a pass-through block; copy input to output
- memcpy(output_items[0], input_items[0],
- noutput_items * sizeof(gr_complex));
-
- const gr_complex *in = (const gr_complex*)input_items[0];
-
- // Update, calculate, and issue an SNR tag every d_nsamples
- int index = 0, x = 0;
- int64_t nwritten = nitems_written(0);
- while(index + (d_nsamples-d_count) <= noutput_items) {
- x = d_nsamples - d_count;
- nwritten += x;
-
- // Update the SNR estimate registers from the current input
- d_snr_est->update(x, &in[index]);
-
- // Issue a tag with the SNR data
- pmt::pmt_t pmt_snr = pmt::pmt_from_double(d_snr_est->snr());
- add_item_tag(0, // stream ID
- nwritten, // tag's sample number
- d_key, // snr key
- pmt_snr, // SNR
- d_me); // block src id
-
- index += x;
- d_count = 0;
- }
-
- // Keep track of remaining items and update estimators
- x = noutput_items - index;
- d_count += x;
- d_snr_est->update(x, &in[index]);
-
- return noutput_items;
-}
-
-double
-digital_mpsk_snr_est_cc::snr()
-{
- if(d_snr_est)
- return d_snr_est->snr();
- else
- throw std::runtime_error("digital_mpsk_snr_est_cc:: No SNR estimator defined.\n");
-}
-
-snr_est_type_t
-digital_mpsk_snr_est_cc::type() const
-{
- return d_type;
-}
-
-int
-digital_mpsk_snr_est_cc::tag_nsample() const
-{
- return d_nsamples;
-}
-
-double
-digital_mpsk_snr_est_cc::alpha() const
-{
- return d_alpha;
-}
-
-void
-digital_mpsk_snr_est_cc::set_type(snr_est_type_t t)
-{
- d_type = t;
-
- if(d_snr_est)
- delete d_snr_est;
-
- switch (d_type) {
- case(SNR_EST_SIMPLE):
- d_snr_est = new digital_impl_mpsk_snr_est_simple(d_alpha);
- break;
- case(SNR_EST_SKEW):
- d_snr_est = new digital_impl_mpsk_snr_est_skew(d_alpha);
- break;
- case(SNR_EST_M2M4):
- d_snr_est = new digital_impl_mpsk_snr_est_m2m4(d_alpha);
- break;
- case(SNR_EST_SVR):
- d_snr_est = new digital_impl_mpsk_snr_est_svr(d_alpha);
- break;
- default:
- throw std::invalid_argument("digital_mpsk_snr_est_cc: unknown type specified.\n");
- }
-}
-
-void
-digital_mpsk_snr_est_cc::set_tag_nsample(int n)
-{
- if(n > 0) {
- d_nsamples = n;
- d_count = 0; // reset state
- }
- else
- throw std::invalid_argument("digital_mpsk_snr_est_cc: tag_nsamples can't be <= 0\n");
-}
-
-void
-digital_mpsk_snr_est_cc::set_alpha(double alpha)
-{
- if((alpha >= 0) && (alpha <= 1.0)) {
- d_alpha = alpha;
- if(d_snr_est)
- d_snr_est->set_alpha(d_alpha);
- }
- else
- throw std::invalid_argument("digital_mpsk_snr_est_cc: alpha must be in [0,1]\n");
-}
diff --git a/gr-digital/lib/digital_ofdm_chanest_vcvc.cc b/gr-digital/lib/digital_ofdm_chanest_vcvc.cc
index f38017e00b..a484594577 100644
--- a/gr-digital/lib/digital_ofdm_chanest_vcvc.cc
+++ b/gr-digital/lib/digital_ofdm_chanest_vcvc.cc
@@ -268,11 +268,11 @@ digital_ofdm_chanest_vcvc::general_work (int noutput_items,
}
this->add_item_tag(0, this->nitems_written(0) + i*d_n_data_syms,
- pmt::pmt_string_to_symbol("ofdm_sync_carr_offset"),
- pmt::pmt_from_long(carr_offset));
+ pmt::string_to_symbol("ofdm_sync_carr_offset"),
+ pmt::from_long(carr_offset));
this->add_item_tag(0, this->nitems_written(0) + i*d_n_data_syms,
- pmt::pmt_string_to_symbol("ofdm_sync_chan_taps"),
- pmt::pmt_init_c32vector(d_fft_len, chan_taps));
+ pmt::string_to_symbol("ofdm_sync_chan_taps"),
+ pmt::init_c32vector(d_fft_len, chan_taps));
}
consume_each(n_frames * framesize);
diff --git a/gr-digital/lib/digital_ofdm_equalizer_simpledfe.cc b/gr-digital/lib/digital_ofdm_equalizer_simpledfe.cc
index 9abab8c1dd..c6a05b9da8 100644
--- a/gr-digital/lib/digital_ofdm_equalizer_simpledfe.cc
+++ b/gr-digital/lib/digital_ofdm_equalizer_simpledfe.cc
@@ -28,7 +28,7 @@
digital_ofdm_equalizer_simpledfe_sptr
digital_make_ofdm_equalizer_simpledfe(
int fft_len,
- const digital_constellation_sptr &constellation,
+ const gr::digital::constellation_sptr &constellation,
const std::vector<std::vector<int> > &occupied_carriers,
const std::vector<std::vector<int> > &pilot_carriers,
const std::vector<std::vector<gr_complex> > &pilot_symbols,
@@ -49,7 +49,7 @@ digital_make_ofdm_equalizer_simpledfe(
digital_ofdm_equalizer_simpledfe::digital_ofdm_equalizer_simpledfe(
int fft_len,
- const digital_constellation_sptr &constellation,
+ const gr::digital::constellation_sptr &constellation,
const std::vector<std::vector<int> > &occupied_carriers,
const std::vector<std::vector<int> > &pilot_carriers,
const std::vector<std::vector<gr_complex> > &pilot_symbols,
diff --git a/gr-digital/lib/digital_ofdm_frame_acquisition.cc b/gr-digital/lib/digital_ofdm_frame_acquisition.cc
deleted file mode 100644
index 93b58aeca5..0000000000
--- a/gr-digital/lib/digital_ofdm_frame_acquisition.cc
+++ /dev/null
@@ -1,210 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2006-2008,2010,2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <digital_ofdm_frame_acquisition.h>
-#include <gr_io_signature.h>
-#include <gr_expj.h>
-#include <gr_math.h>
-#include <cstdio>
-
-#define VERBOSE 0
-#define M_TWOPI (2*M_PI)
-#define MAX_NUM_SYMBOLS 1000
-
-digital_ofdm_frame_acquisition_sptr
-digital_make_ofdm_frame_acquisition (unsigned int occupied_carriers,
- unsigned int fft_length,
- unsigned int cplen,
- const std::vector<gr_complex> &known_symbol,
- unsigned int max_fft_shift_len)
-{
- return gnuradio::get_initial_sptr(new digital_ofdm_frame_acquisition (occupied_carriers, fft_length, cplen,
- known_symbol, max_fft_shift_len));
-}
-
-digital_ofdm_frame_acquisition::digital_ofdm_frame_acquisition (unsigned occupied_carriers,
- unsigned int fft_length,
- unsigned int cplen,
- const std::vector<gr_complex> &known_symbol,
- unsigned int max_fft_shift_len)
- : gr_block ("ofdm_frame_acquisition",
- gr_make_io_signature2 (2, 2, sizeof(gr_complex)*fft_length, sizeof(char)*fft_length),
- gr_make_io_signature2 (2, 2, sizeof(gr_complex)*occupied_carriers, sizeof(char))),
- d_occupied_carriers(occupied_carriers),
- d_fft_length(fft_length),
- d_cplen(cplen),
- d_freq_shift_len(max_fft_shift_len),
- d_known_symbol(known_symbol),
- d_coarse_freq(0),
- d_phase_count(0)
-{
- d_symbol_phase_diff.resize(d_fft_length);
- d_known_phase_diff.resize(d_occupied_carriers);
- d_hestimate.resize(d_occupied_carriers);
-
- unsigned int i = 0, j = 0;
-
- std::fill(d_known_phase_diff.begin(), d_known_phase_diff.end(), 0);
- for(i = 0; i < d_known_symbol.size()-2; i+=2) {
- d_known_phase_diff[i] = norm(d_known_symbol[i] - d_known_symbol[i+2]);
- }
-
- d_phase_lut = new gr_complex[(2*d_freq_shift_len+1) * MAX_NUM_SYMBOLS];
- for(i = 0; i <= 2*d_freq_shift_len; i++) {
- for(j = 0; j < MAX_NUM_SYMBOLS; j++) {
- d_phase_lut[j + i*MAX_NUM_SYMBOLS] = gr_expj(-M_TWOPI*d_cplen/d_fft_length*(i-d_freq_shift_len)*j);
- }
- }
-}
-
-digital_ofdm_frame_acquisition::~digital_ofdm_frame_acquisition(void)
-{
- delete [] d_phase_lut;
-}
-
-void
-digital_ofdm_frame_acquisition::forecast (int noutput_items, gr_vector_int &ninput_items_required)
-{
- unsigned ninputs = ninput_items_required.size ();
- for (unsigned i = 0; i < ninputs; i++)
- ninput_items_required[i] = 1;
-}
-
-gr_complex
-digital_ofdm_frame_acquisition::coarse_freq_comp(int freq_delta, int symbol_count)
-{
- // return gr_complex(cos(-M_TWOPI*freq_delta*d_cplen/d_fft_length*symbol_count),
- // sin(-M_TWOPI*freq_delta*d_cplen/d_fft_length*symbol_count));
-
- return gr_expj(-M_TWOPI*freq_delta*d_cplen/d_fft_length*symbol_count);
-
- //return d_phase_lut[MAX_NUM_SYMBOLS * (d_freq_shift_len + freq_delta) + symbol_count];
-}
-
-void
-digital_ofdm_frame_acquisition::correlate(const gr_complex *symbol, int zeros_on_left)
-{
- unsigned int i,j;
-
- std::fill(d_symbol_phase_diff.begin(), d_symbol_phase_diff.end(), 0);
- for(i = 0; i < d_fft_length-2; i++) {
- d_symbol_phase_diff[i] = norm(symbol[i] - symbol[i+2]);
- }
-
- // sweep through all possible/allowed frequency offsets and select the best
- int index = 0;
- float max = 0, sum=0;
- for(i = zeros_on_left - d_freq_shift_len; i < zeros_on_left + d_freq_shift_len; i++) {
- sum = 0;
- for(j = 0; j < d_occupied_carriers; j++) {
- sum += (d_known_phase_diff[j] * d_symbol_phase_diff[i+j]);
- }
- if(sum > max) {
- max = sum;
- index = i;
- }
- }
-
- // set the coarse frequency offset relative to the edge of the occupied tones
- d_coarse_freq = index - zeros_on_left;
-}
-
-void
-digital_ofdm_frame_acquisition::calculate_equalizer(const gr_complex *symbol, int zeros_on_left)
-{
- unsigned int i=0;
-
- // Set first tap of equalizer
- d_hestimate[0] = d_known_symbol[0] /
- (coarse_freq_comp(d_coarse_freq,1)*symbol[zeros_on_left+d_coarse_freq]);
-
- // set every even tap based on known symbol
- // linearly interpolate between set carriers to set zero-filled carriers
- // FIXME: is this the best way to set this?
- for(i = 2; i < d_occupied_carriers; i+=2) {
- d_hestimate[i] = d_known_symbol[i] /
- (coarse_freq_comp(d_coarse_freq,1)*(symbol[i+zeros_on_left+d_coarse_freq]));
- d_hestimate[i-1] = (d_hestimate[i] + d_hestimate[i-2]) / gr_complex(2.0, 0.0);
- }
-
- // with even number of carriers; last equalizer tap is wrong
- if(!(d_occupied_carriers & 1)) {
- d_hestimate[d_occupied_carriers-1] = d_hestimate[d_occupied_carriers-2];
- }
-
- if(VERBOSE) {
- fprintf(stderr, "Equalizer setting:\n");
- for(i = 0; i < d_occupied_carriers; i++) {
- gr_complex sym = coarse_freq_comp(d_coarse_freq,1)*symbol[i+zeros_on_left+d_coarse_freq];
- gr_complex output = sym * d_hestimate[i];
- fprintf(stderr, "sym: %+.4f + j%+.4f ks: %+.4f + j%+.4f eq: %+.4f + j%+.4f ==> %+.4f + j%+.4f\n",
- sym .real(), sym.imag(),
- d_known_symbol[i].real(), d_known_symbol[i].imag(),
- d_hestimate[i].real(), d_hestimate[i].imag(),
- output.real(), output.imag());
- }
- fprintf(stderr, "\n");
- }
-}
-
-int
-digital_ofdm_frame_acquisition::general_work(int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- const gr_complex *symbol = (const gr_complex *)input_items[0];
- const char *signal_in = (const char *)input_items[1];
-
- gr_complex *out = (gr_complex *) output_items[0];
- char *signal_out = (char *) output_items[1];
-
- int unoccupied_carriers = d_fft_length - d_occupied_carriers;
- int zeros_on_left = (int)ceil(unoccupied_carriers/2.0);
-
- if(signal_in[0]) {
- d_phase_count = 1;
- correlate(symbol, zeros_on_left);
- calculate_equalizer(symbol, zeros_on_left);
- signal_out[0] = 1;
- }
- else {
- signal_out[0] = 0;
- }
-
- for(unsigned int i = 0; i < d_occupied_carriers; i++) {
- out[i] = d_hestimate[i]*coarse_freq_comp(d_coarse_freq,d_phase_count)
- *symbol[i+zeros_on_left+d_coarse_freq];
- }
-
- d_phase_count++;
- if(d_phase_count == MAX_NUM_SYMBOLS) {
- d_phase_count = 1;
- }
-
- consume_each(1);
- return 1;
-}
diff --git a/gr-digital/lib/digital_ofdm_frame_sink.cc b/gr-digital/lib/digital_ofdm_frame_sink.cc
deleted file mode 100644
index f8fb1bbb1d..0000000000
--- a/gr-digital/lib/digital_ofdm_frame_sink.cc
+++ /dev/null
@@ -1,405 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2007,2008,2010,2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <digital_ofdm_frame_sink.h>
-#include <gr_io_signature.h>
-#include <gr_expj.h>
-#include <gr_math.h>
-#include <math.h>
-#include <cstdio>
-#include <stdexcept>
-#include <iostream>
-#include <string.h>
-
-#define VERBOSE 0
-
-inline void
-digital_ofdm_frame_sink::enter_search()
-{
- if (VERBOSE)
- fprintf(stderr, "@ enter_search\n");
-
- d_state = STATE_SYNC_SEARCH;
-
-}
-
-inline void
-digital_ofdm_frame_sink::enter_have_sync()
-{
- if (VERBOSE)
- fprintf(stderr, "@ enter_have_sync\n");
-
- d_state = STATE_HAVE_SYNC;
-
- // clear state of demapper
- d_byte_offset = 0;
- d_partial_byte = 0;
-
- d_header = 0;
- d_headerbytelen_cnt = 0;
-
- // Resetting PLL
- d_freq = 0.0;
- d_phase = 0.0;
- fill(d_dfe.begin(), d_dfe.end(), gr_complex(1.0,0.0));
-}
-
-inline void
-digital_ofdm_frame_sink::enter_have_header()
-{
- d_state = STATE_HAVE_HEADER;
-
- // header consists of two 16-bit shorts in network byte order
- // payload length is lower 12 bits
- // whitener offset is upper 4 bits
- d_packetlen = (d_header >> 16) & 0x0fff;
- d_packet_whitener_offset = (d_header >> 28) & 0x000f;
- d_packetlen_cnt = 0;
-
- if (VERBOSE)
- fprintf(stderr, "@ enter_have_header (payload_len = %d) (offset = %d)\n",
- d_packetlen, d_packet_whitener_offset);
-}
-
-
-unsigned char digital_ofdm_frame_sink::slicer(const gr_complex x)
-{
- unsigned int table_size = d_sym_value_out.size();
- unsigned int min_index = 0;
- float min_euclid_dist = norm(x - d_sym_position[0]);
- float euclid_dist = 0;
-
- for (unsigned int j = 1; j < table_size; j++){
- euclid_dist = norm(x - d_sym_position[j]);
- if (euclid_dist < min_euclid_dist){
- min_euclid_dist = euclid_dist;
- min_index = j;
- }
- }
- return d_sym_value_out[min_index];
-}
-
-unsigned int digital_ofdm_frame_sink::demapper(const gr_complex *in,
- unsigned char *out)
-{
- unsigned int i=0, bytes_produced=0;
- gr_complex carrier;
-
- carrier=gr_expj(d_phase);
-
- gr_complex accum_error = 0.0;
- //while(i < d_occupied_carriers) {
- while(i < d_subcarrier_map.size()) {
- if(d_nresid > 0) {
- d_partial_byte |= d_resid;
- d_byte_offset += d_nresid;
- d_nresid = 0;
- d_resid = 0;
- }
-
- //while((d_byte_offset < 8) && (i < d_occupied_carriers)) {
- while((d_byte_offset < 8) && (i < d_subcarrier_map.size())) {
- //gr_complex sigrot = in[i]*carrier*d_dfe[i];
- gr_complex sigrot = in[d_subcarrier_map[i]]*carrier*d_dfe[i];
-
- if(d_derotated_output != NULL){
- d_derotated_output[i] = sigrot;
- }
-
- unsigned char bits = slicer(sigrot);
-
- gr_complex closest_sym = d_sym_position[bits];
-
- accum_error += sigrot * conj(closest_sym);
-
- // FIX THE FOLLOWING STATEMENT
- if (norm(sigrot)> 0.001) d_dfe[i] += d_eq_gain*(closest_sym/sigrot-d_dfe[i]);
-
- i++;
-
- if((8 - d_byte_offset) >= d_nbits) {
- d_partial_byte |= bits << (d_byte_offset);
- d_byte_offset += d_nbits;
- }
- else {
- d_nresid = d_nbits-(8-d_byte_offset);
- int mask = ((1<<(8-d_byte_offset))-1);
- d_partial_byte |= (bits & mask) << d_byte_offset;
- d_resid = bits >> (8-d_byte_offset);
- d_byte_offset += (d_nbits - d_nresid);
- }
- //printf("demod symbol: %.4f + j%.4f bits: %x partial_byte: %x byte_offset: %d resid: %x nresid: %d\n",
- // in[i-1].real(), in[i-1].imag(), bits, d_partial_byte, d_byte_offset, d_resid, d_nresid);
- }
-
- if(d_byte_offset == 8) {
- //printf("demod byte: %x \n\n", d_partial_byte);
- out[bytes_produced++] = d_partial_byte;
- d_byte_offset = 0;
- d_partial_byte = 0;
- }
- }
- //std::cerr << "accum_error " << accum_error << std::endl;
-
- float angle = arg(accum_error);
-
- d_freq = d_freq - d_freq_gain*angle;
- d_phase = d_phase + d_freq - d_phase_gain*angle;
- if (d_phase >= 2*M_PI) d_phase -= 2*M_PI;
- if (d_phase <0) d_phase += 2*M_PI;
-
- //if(VERBOSE)
- // std::cerr << angle << "\t" << d_freq << "\t" << d_phase << "\t" << std::endl;
-
- return bytes_produced;
-}
-
-
-digital_ofdm_frame_sink_sptr
-digital_make_ofdm_frame_sink(const std::vector<gr_complex> &sym_position,
- const std::vector<unsigned char> &sym_value_out,
- gr_msg_queue_sptr target_queue, unsigned int occupied_carriers,
- float phase_gain, float freq_gain)
-{
- return gnuradio::get_initial_sptr(new digital_ofdm_frame_sink(sym_position, sym_value_out,
- target_queue, occupied_carriers,
- phase_gain, freq_gain));
-}
-
-
-digital_ofdm_frame_sink::digital_ofdm_frame_sink(const std::vector<gr_complex> &sym_position,
- const std::vector<unsigned char> &sym_value_out,
- gr_msg_queue_sptr target_queue, unsigned int occupied_carriers,
- float phase_gain, float freq_gain)
- : gr_sync_block ("ofdm_frame_sink",
- gr_make_io_signature2 (2, 2, sizeof(gr_complex)*occupied_carriers, sizeof(char)),
- gr_make_io_signature (1, 1, sizeof(gr_complex)*occupied_carriers)),
- d_target_queue(target_queue), d_occupied_carriers(occupied_carriers),
- d_byte_offset(0), d_partial_byte(0),
- d_resid(0), d_nresid(0),d_phase(0),d_freq(0),d_phase_gain(phase_gain),d_freq_gain(freq_gain),
- d_eq_gain(0.05)
-{
- std::string carriers = "FE7F";
-
- // A bit hacky to fill out carriers to occupied_carriers length
- int diff = (d_occupied_carriers - 4*carriers.length());
- while(diff > 7) {
- carriers.insert(0, "f");
- carriers.insert(carriers.length(), "f");
- diff -= 8;
- }
-
- // if there's extras left to be processed
- // divide remaining to put on either side of current map
- // all of this is done to stick with the concept of a carrier map string that
- // can be later passed by the user, even though it'd be cleaner to just do this
- // on the carrier map itself
- int diff_left=0;
- int diff_right=0;
-
- // dictionary to convert from integers to ascii hex representation
- char abc[16] = {'0', '1', '2', '3', '4', '5', '6', '7',
- '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
- if(diff > 0) {
- char c[2] = {0,0};
-
- diff_left = (int)ceil((float)diff/2.0f); // number of carriers to put on the left side
- c[0] = abc[(1 << diff_left) - 1]; // convert to bits and move to ASCI integer
- carriers.insert(0, c);
-
- diff_right = diff - diff_left; // number of carriers to put on the right side
- c[0] = abc[0xF^((1 << diff_right) - 1)]; // convert to bits and move to ASCI integer
- carriers.insert(carriers.length(), c);
- }
-
- // It seemed like such a good idea at the time...
- // because we are only dealing with the occupied_carriers
- // at this point, the diff_left in the following compensates
- // for any offset from the 0th carrier introduced
- unsigned int i,j,k;
- for(i = 0; i < (d_occupied_carriers/4)+diff_left; i++) {
- char c = carriers[i];
- for(j = 0; j < 4; j++) {
- k = (strtol(&c, NULL, 16) >> (3-j)) & 0x1;
- if(k) {
- d_subcarrier_map.push_back(4*i + j - diff_left);
- }
- }
- }
-
- // make sure we stay in the limit currently imposed by the occupied_carriers
- if(d_subcarrier_map.size() > d_occupied_carriers) {
- throw std::invalid_argument("digital_ofdm_mapper_bcv: subcarriers allocated exceeds size of occupied carriers");
- }
-
- d_bytes_out = new unsigned char[d_occupied_carriers];
- d_dfe.resize(occupied_carriers);
- fill(d_dfe.begin(), d_dfe.end(), gr_complex(1.0,0.0));
-
- set_sym_value_out(sym_position, sym_value_out);
-
- enter_search();
-}
-
-digital_ofdm_frame_sink::~digital_ofdm_frame_sink ()
-{
- delete [] d_bytes_out;
-}
-
-bool
-digital_ofdm_frame_sink::set_sym_value_out(const std::vector<gr_complex> &sym_position,
- const std::vector<unsigned char> &sym_value_out)
-{
- if (sym_position.size() != sym_value_out.size())
- return false;
-
- if (sym_position.size()<1)
- return false;
-
- d_sym_position = sym_position;
- d_sym_value_out = sym_value_out;
- d_nbits = (unsigned long)ceil(log10(float(d_sym_value_out.size())) / log10(2.0));
-
- return true;
-}
-
-
-int
-digital_ofdm_frame_sink::work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- const gr_complex *in = (const gr_complex *) input_items[0];
- const char *sig = (const char *) input_items[1];
- unsigned int j = 0;
- unsigned int bytes=0;
-
- // If the output is connected, send it the derotated symbols
- if(output_items.size() >= 1)
- d_derotated_output = (gr_complex *)output_items[0];
- else
- d_derotated_output = NULL;
-
- if (VERBOSE)
- fprintf(stderr,">>> Entering state machine\n");
-
- switch(d_state) {
-
- case STATE_SYNC_SEARCH: // Look for flag indicating beginning of pkt
- if (VERBOSE)
- fprintf(stderr,"SYNC Search, noutput=%d\n", noutput_items);
-
- if (sig[0]) { // Found it, set up for header decode
- enter_have_sync();
- }
- break;
-
- case STATE_HAVE_SYNC:
- // only demod after getting the preamble signal; otherwise, the
- // equalizer taps will screw with the PLL performance
- bytes = demapper(&in[0], d_bytes_out);
-
- if (VERBOSE) {
- if(sig[0])
- printf("ERROR -- Found SYNC in HAVE_SYNC\n");
- fprintf(stderr,"Header Search bitcnt=%d, header=0x%08x\n",
- d_headerbytelen_cnt, d_header);
- }
-
- j = 0;
- while(j < bytes) {
- d_header = (d_header << 8) | (d_bytes_out[j] & 0xFF);
- j++;
-
- if (++d_headerbytelen_cnt == HEADERBYTELEN) {
-
- if (VERBOSE)
- fprintf(stderr, "got header: 0x%08x\n", d_header);
-
- // we have a full header, check to see if it has been received properly
- if (header_ok()){
- enter_have_header();
-
- if (VERBOSE)
- printf("\nPacket Length: %d\n", d_packetlen);
-
- while((j < bytes) && (d_packetlen_cnt < d_packetlen)) {
- d_packet[d_packetlen_cnt++] = d_bytes_out[j++];
- }
-
- if(d_packetlen_cnt == d_packetlen) {
- gr_message_sptr msg =
- gr_make_message(0, d_packet_whitener_offset, 0, d_packetlen);
- memcpy(msg->msg(), d_packet, d_packetlen_cnt);
- d_target_queue->insert_tail(msg); // send it
- msg.reset(); // free it up
-
- enter_search();
- }
- }
- else {
- enter_search(); // bad header
- }
- }
- }
- break;
-
- case STATE_HAVE_HEADER:
- bytes = demapper(&in[0], d_bytes_out);
-
- if (VERBOSE) {
- if(sig[0])
- printf("ERROR -- Found SYNC in HAVE_HEADER at %d, length of %d\n", d_packetlen_cnt, d_packetlen);
- fprintf(stderr,"Packet Build\n");
- }
-
- j = 0;
- while(j < bytes) {
- d_packet[d_packetlen_cnt++] = d_bytes_out[j++];
-
- if (d_packetlen_cnt == d_packetlen){ // packet is filled
- // build a message
- // NOTE: passing header field as arg1 is not scalable
- gr_message_sptr msg =
- gr_make_message(0, d_packet_whitener_offset, 0, d_packetlen_cnt);
- memcpy(msg->msg(), d_packet, d_packetlen_cnt);
-
- d_target_queue->insert_tail(msg); // send it
- msg.reset(); // free it up
-
- enter_search();
- break;
- }
- }
- break;
-
- default:
- assert(0);
-
- } // switch
-
- return 1;
-}
diff --git a/gr-digital/lib/digital_ofdm_insert_preamble.cc b/gr-digital/lib/digital_ofdm_insert_preamble.cc
deleted file mode 100644
index 72b9e82a82..0000000000
--- a/gr-digital/lib/digital_ofdm_insert_preamble.cc
+++ /dev/null
@@ -1,194 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2007,2010-2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <digital_ofdm_insert_preamble.h>
-#include <gr_io_signature.h>
-#include <stdexcept>
-#include <iostream>
-#include <string.h>
-
-digital_ofdm_insert_preamble_sptr
-digital_make_ofdm_insert_preamble(int fft_length,
- const std::vector<std::vector<gr_complex> > &preamble)
-{
- return gnuradio::get_initial_sptr(new digital_ofdm_insert_preamble(fft_length,
- preamble));
-}
-
-digital_ofdm_insert_preamble::digital_ofdm_insert_preamble
- (int fft_length,
- const std::vector<std::vector<gr_complex> > &preamble)
- : gr_block("ofdm_insert_preamble",
- gr_make_io_signature2(1, 2,
- sizeof(gr_complex)*fft_length,
- sizeof(char)),
- gr_make_io_signature2(1, 2,
- sizeof(gr_complex)*fft_length,
- sizeof(char))),
- d_fft_length(fft_length),
- d_preamble(preamble),
- d_state(ST_IDLE),
- d_nsymbols_output(0),
- d_pending_flag(0)
-{
- // sanity check preamble symbols
- for(size_t i = 0; i < d_preamble.size(); i++) {
- if(d_preamble[i].size() != (size_t) d_fft_length)
- throw std::invalid_argument("digital_ofdm_insert_preamble: invalid length for preamble symbol");
- }
-
- enter_idle();
-}
-
-
-digital_ofdm_insert_preamble::~digital_ofdm_insert_preamble()
-{
-}
-
-void digital_ofdm_insert_preamble::forecast (int noutput_items, gr_vector_int &ninput_items_required)
-{
- ninput_items_required[0] = noutput_items;
-}
-
-int
-digital_ofdm_insert_preamble::general_work(int noutput_items,
- gr_vector_int &ninput_items_v,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- int ninput_items = ninput_items_v.size()==2?std::min(ninput_items_v[0], ninput_items_v[1]):ninput_items_v[0];
- const gr_complex *in_sym = (const gr_complex *) input_items[0];
- const unsigned char *in_flag = 0;
- if (input_items.size() == 2)
- in_flag = (const unsigned char *) input_items[1];
-
- gr_complex *out_sym = (gr_complex *) output_items[0];
- unsigned char *out_flag = 0;
- if (output_items.size() == 2)
- out_flag = (unsigned char *) output_items[1];
-
-
- int no = 0; // number items output
- int ni = 0; // number items read from input
-
-
-#define write_out_flag() \
- do { if (out_flag) \
- out_flag[no] = d_pending_flag; \
- d_pending_flag = 0; \
- } while(0)
-
-
- while (no < noutput_items && ni < ninput_items){
- switch(d_state){
- case ST_IDLE:
- if (in_flag && in_flag[ni] & 0x1) // this is first symbol of new payload
- enter_preamble();
- else
- ni++; // eat one input symbol
- break;
-
- case ST_PREAMBLE:
- assert(!in_flag || in_flag[ni] & 0x1);
- if (d_nsymbols_output >= (int) d_preamble.size()){
- // we've output all the preamble
- enter_first_payload();
- }
- else {
- memcpy(&out_sym[no * d_fft_length],
- &d_preamble[d_nsymbols_output][0],
- d_fft_length*sizeof(gr_complex));
-
- write_out_flag();
- no++;
- d_nsymbols_output++;
- }
- break;
-
- case ST_FIRST_PAYLOAD:
- // copy first payload symbol from input to output
- memcpy(&out_sym[no * d_fft_length],
- &in_sym[ni * d_fft_length],
- d_fft_length * sizeof(gr_complex));
-
- write_out_flag();
- no++;
- ni++;
- enter_payload();
- break;
-
- case ST_PAYLOAD:
- if (in_flag && in_flag[ni] & 0x1){ // this is first symbol of a new payload
- enter_preamble();
- break;
- }
-
- // copy a symbol from input to output
- memcpy(&out_sym[no * d_fft_length],
- &in_sym[ni * d_fft_length],
- d_fft_length * sizeof(gr_complex));
-
- write_out_flag();
- no++;
- ni++;
- break;
-
- default:
- std::cerr << "digital_ofdm_insert_preamble: (can't happen) invalid state, resetting\n";
- enter_idle();
- }
- }
-
- consume_each(ni);
- return no;
-}
-
-void
-digital_ofdm_insert_preamble::enter_idle()
-{
- d_state = ST_IDLE;
- d_nsymbols_output = 0;
- d_pending_flag = 0;
-}
-
-void
-digital_ofdm_insert_preamble::enter_preamble()
-{
- d_state = ST_PREAMBLE;
- d_nsymbols_output = 0;
- d_pending_flag = 1;
-}
-
-void
-digital_ofdm_insert_preamble::enter_first_payload()
-{
- d_state = ST_FIRST_PAYLOAD;
-}
-
-void
-digital_ofdm_insert_preamble::enter_payload()
-{
- d_state = ST_PAYLOAD;
-}
diff --git a/gr-digital/lib/digital_ofdm_mapper_bcv.cc b/gr-digital/lib/digital_ofdm_mapper_bcv.cc
deleted file mode 100644
index cf3d08703a..0000000000
--- a/gr-digital/lib/digital_ofdm_mapper_bcv.cc
+++ /dev/null
@@ -1,241 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2006-2008,2010,2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <digital_ofdm_mapper_bcv.h>
-#include <gr_io_signature.h>
-#include <stdexcept>
-#include <string.h>
-
-digital_ofdm_mapper_bcv_sptr
-digital_make_ofdm_mapper_bcv (const std::vector<gr_complex> &constellation, unsigned int msgq_limit,
- unsigned int occupied_carriers, unsigned int fft_length)
-{
- return gnuradio::get_initial_sptr(new digital_ofdm_mapper_bcv (constellation, msgq_limit,
- occupied_carriers, fft_length));
-}
-
-// Consumes 1 packet and produces as many OFDM symbols of fft_length to hold the full packet
-digital_ofdm_mapper_bcv::digital_ofdm_mapper_bcv (const std::vector<gr_complex> &constellation, unsigned int msgq_limit,
- unsigned int occupied_carriers, unsigned int fft_length)
- : gr_sync_block ("ofdm_mapper_bcv",
- gr_make_io_signature (0, 0, 0),
- gr_make_io_signature2 (1, 2, sizeof(gr_complex)*fft_length, sizeof(char))),
- d_constellation(constellation),
- d_msgq(gr_make_msg_queue(msgq_limit)), d_msg_offset(0), d_eof(false),
- d_occupied_carriers(occupied_carriers),
- d_fft_length(fft_length),
- d_bit_offset(0),
- d_pending_flag(0),
- d_resid(0),
- d_nresid(0)
-{
- if (!(d_occupied_carriers <= d_fft_length))
- throw std::invalid_argument("digital_ofdm_mapper_bcv: occupied carriers must be <= fft_length");
-
- // this is not the final form of this solution since we still use the occupied_tones concept,
- // which would get us into trouble if the number of carriers we seek is greater than the occupied carriers.
- // Eventually, we will get rid of the occupied_carriers concept.
- std::string carriers = "FE7F";
-
- // A bit hacky to fill out carriers to occupied_carriers length
- int diff = (d_occupied_carriers - 4*carriers.length());
- while(diff > 7) {
- carriers.insert(0, "f");
- carriers.insert(carriers.length(), "f");
- diff -= 8;
- }
-
- // if there's extras left to be processed
- // divide remaining to put on either side of current map
- // all of this is done to stick with the concept of a carrier map string that
- // can be later passed by the user, even though it'd be cleaner to just do this
- // on the carrier map itself
- int diff_left=0;
- int diff_right=0;
-
- // dictionary to convert from integers to ascii hex representation
- char abc[16] = {'0', '1', '2', '3', '4', '5', '6', '7',
- '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
- if(diff > 0) {
- char c[2] = {0,0};
-
- diff_left = (int)ceil((float)diff/2.0f); // number of carriers to put on the left side
- c[0] = abc[(1 << diff_left) - 1]; // convert to bits and move to ASCI integer
- carriers.insert(0, c);
-
- diff_right = diff - diff_left; // number of carriers to put on the right side
- c[0] = abc[0xF^((1 << diff_right) - 1)]; // convert to bits and move to ASCI integer
- carriers.insert(carriers.length(), c);
- }
-
- // find out how many zeros to pad on the sides; the difference between the fft length and the subcarrier
- // mapping size in chunks of four. This is the number to pack on the left and this number plus any
- // residual nulls (if odd) will be packed on the right.
- diff = (d_fft_length/4 - carriers.length())/2;
-
- unsigned int i,j,k;
- for(i = 0; i < carriers.length(); i++) {
- char c = carriers[i]; // get the current hex character from the string
- for(j = 0; j < 4; j++) { // walk through all four bits
- k = (strtol(&c, NULL, 16) >> (3-j)) & 0x1; // convert to int and extract next bit
- if(k) { // if bit is a 1,
- d_subcarrier_map.push_back(4*(i+diff) + j); // use this subcarrier
- }
- }
- }
-
- // make sure we stay in the limit currently imposed by the occupied_carriers
- if(d_subcarrier_map.size() > d_occupied_carriers) {
- throw std::invalid_argument("digital_ofdm_mapper_bcv: subcarriers allocated exceeds size of occupied carriers");
- }
-
- d_nbits = (unsigned long)ceil(log10(float(d_constellation.size())) / log10(2.0));
-}
-
-digital_ofdm_mapper_bcv::~digital_ofdm_mapper_bcv(void)
-{
-}
-
-int digital_ofdm_mapper_bcv::randsym()
-{
- return (rand() % d_constellation.size());
-}
-
-int
-digital_ofdm_mapper_bcv::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- gr_complex *out = (gr_complex *)output_items[0];
-
- unsigned int i=0;
-
- //printf("OFDM BPSK Mapper: ninput_items: %d noutput_items: %d\n", ninput_items[0], noutput_items);
-
- if(d_eof) {
- return -1;
- }
-
- if(!d_msg) {
- d_msg = d_msgq->delete_head(); // block, waiting for a message
- d_msg_offset = 0;
- d_bit_offset = 0;
- d_pending_flag = 1; // new packet, write start of packet flag
-
- if((d_msg->length() == 0) && (d_msg->type() == 1)) {
- d_msg.reset();
- return -1; // We're done; no more messages coming.
- }
- }
-
- char *out_flag = 0;
- if(output_items.size() == 2)
- out_flag = (char *) output_items[1];
-
-
- // Build a single symbol:
- // Initialize all bins to 0 to set unused carriers
- memset(out, 0, d_fft_length*sizeof(gr_complex));
-
- i = 0;
- unsigned char bits = 0;
- //while((d_msg_offset < d_msg->length()) && (i < d_occupied_carriers)) {
- while((d_msg_offset < d_msg->length()) && (i < d_subcarrier_map.size())) {
-
- // need new data to process
- if(d_bit_offset == 0) {
- d_msgbytes = d_msg->msg()[d_msg_offset];
- //printf("mod message byte: %x\n", d_msgbytes);
- }
-
- if(d_nresid > 0) {
- // take the residual bits, fill out nbits with info from the new byte, and put them in the symbol
- d_resid |= (((1 << d_nresid)-1) & d_msgbytes) << (d_nbits - d_nresid);
- bits = d_resid;
-
- out[d_subcarrier_map[i]] = d_constellation[bits];
- i++;
-
- d_bit_offset += d_nresid;
- d_nresid = 0;
- d_resid = 0;
- //printf("mod bit(r): %x resid: %x nresid: %d bit_offset: %d\n",
- // bits, d_resid, d_nresid, d_bit_offset);
- }
- else {
- if((8 - d_bit_offset) >= d_nbits) { // test to make sure we can fit nbits
- // take the nbits number of bits at a time from the byte to add to the symbol
- bits = ((1 << d_nbits)-1) & (d_msgbytes >> d_bit_offset);
- d_bit_offset += d_nbits;
-
- out[d_subcarrier_map[i]] = d_constellation[bits];
- i++;
- }
- else { // if we can't fit nbits, store them for the next
- // saves d_nresid bits of this message where d_nresid < d_nbits
- unsigned int extra = 8-d_bit_offset;
- d_resid = ((1 << extra)-1) & (d_msgbytes >> d_bit_offset);
- d_bit_offset += extra;
- d_nresid = d_nbits - extra;
- }
-
- }
-
- if(d_bit_offset == 8) {
- d_bit_offset = 0;
- d_msg_offset++;
- }
- }
-
- // Ran out of data to put in symbol
- if (d_msg_offset == d_msg->length()) {
- if(d_nresid > 0) {
- d_resid |= 0x00;
- bits = d_resid;
- d_nresid = 0;
- d_resid = 0;
- }
-
- //while(i < d_occupied_carriers) { // finish filling out the symbol
- while(i < d_subcarrier_map.size()) { // finish filling out the symbol
- out[d_subcarrier_map[i]] = d_constellation[randsym()];
-
- i++;
- }
-
- if (d_msg->type() == 1) // type == 1 sets EOF
- d_eof = true;
- d_msg.reset(); // finished packet, free message
- assert(d_bit_offset == 0);
- }
-
- if (out_flag)
- out_flag[0] = d_pending_flag;
- d_pending_flag = 0;
-
- return 1; // produced symbol
-}
diff --git a/gr-digital/lib/digital_ofdm_sampler.cc b/gr-digital/lib/digital_ofdm_sampler.cc
deleted file mode 100644
index cab8c2ba93..0000000000
--- a/gr-digital/lib/digital_ofdm_sampler.cc
+++ /dev/null
@@ -1,133 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2007,2008,2010,2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <digital_ofdm_sampler.h>
-#include <gr_io_signature.h>
-#include <gr_expj.h>
-#include <cstdio>
-
-digital_ofdm_sampler_sptr
-digital_make_ofdm_sampler (unsigned int fft_length,
- unsigned int symbol_length,
- unsigned int timeout)
-{
- return gnuradio::get_initial_sptr(new digital_ofdm_sampler (fft_length, symbol_length, timeout));
-}
-
-digital_ofdm_sampler::digital_ofdm_sampler (unsigned int fft_length,
- unsigned int symbol_length,
- unsigned int timeout)
- : gr_block ("ofdm_sampler",
- gr_make_io_signature2 (2, 2, sizeof (gr_complex), sizeof(char)),
- gr_make_io_signature2 (2, 2, sizeof (gr_complex)*fft_length, sizeof(char)*fft_length)),
- d_state(STATE_NO_SIG), d_timeout_max(timeout), d_fft_length(fft_length), d_symbol_length(symbol_length)
-{
- set_relative_rate(1.0/(double) fft_length); // buffer allocator hint
-}
-
-void
-digital_ofdm_sampler::forecast (int noutput_items, gr_vector_int &ninput_items_required)
-{
- // FIXME do we need more
- //int nreqd = (noutput_items-1) * d_symbol_length + d_fft_length;
- int nreqd = d_symbol_length + d_fft_length;
- unsigned ninputs = ninput_items_required.size ();
- for (unsigned i = 0; i < ninputs; i++)
- ninput_items_required[i] = nreqd;
-}
-
-
-int
-digital_ofdm_sampler::general_work (int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- const gr_complex *iptr = (const gr_complex *) input_items[0];
- const char *trigger = (const char *) input_items[1];
-
- gr_complex *optr = (gr_complex *) output_items[0];
- char *outsig = (char *) output_items[1];
-
- //FIXME: we only process a single OFDM symbol at a time; after the preamble, we can
- // process a few at a time as long as we always look out for the next preamble.
-
- unsigned int index=d_fft_length; // start one fft length into the input so we can always look back this far
-
- outsig[0] = 0; // set output to no signal by default
-
- // Search for a preamble trigger signal during the next symbol length
- while((d_state != STATE_PREAMBLE) && (index <= (d_symbol_length+d_fft_length))) {
- if(trigger[index]) {
- outsig[0] = 1; // tell the next block there is a preamble coming
- d_state = STATE_PREAMBLE;
- }
- else
- index++;
- }
-
- unsigned int i, pos, ret;
- switch(d_state) {
- case(STATE_PREAMBLE):
- // When we found a preamble trigger, get it and set the symbol boundary here
- for(i = (index - d_fft_length + 1); i <= index; i++) {
- *optr++ = iptr[i];
- }
-
- d_timeout = d_timeout_max; // tell the system to expect at least this many symbols for a frame
- d_state = STATE_FRAME;
- consume_each(index - d_fft_length + 1); // consume up to one fft_length away to keep the history
- ret = 1;
- break;
-
- case(STATE_FRAME):
- // use this state when we have processed a preamble and are getting the rest of the frames
- //FIXME: we could also have a power squelch system here to enter STATE_NO_SIG if no power is received
-
- // skip over fft length history and cyclic prefix
- pos = d_symbol_length; // keeps track of where we are in the input buffer
- while(pos < d_symbol_length + d_fft_length) {
- *optr++ = iptr[pos++];
- }
-
- if(d_timeout-- == 0) {
- printf("TIMEOUT\n");
- d_state = STATE_NO_SIG;
- }
-
- consume_each(d_symbol_length); // jump up by 1 fft length and the cyclic prefix length
- ret = 1;
- break;
-
- case(STATE_NO_SIG):
- default:
- consume_each(index-d_fft_length); // consume everything we've gone through so far leaving the fft length history
- ret = 0;
- break;
- }
-
- return ret;
-}
diff --git a/gr-digital/lib/digital_ofdm_sync_sc_cfb.cc b/gr-digital/lib/digital_ofdm_sync_sc_cfb.cc
index a3ebd549cb..dbb8571c28 100644
--- a/gr-digital/lib/digital_ofdm_sync_sc_cfb.cc
+++ b/gr-digital/lib/digital_ofdm_sync_sc_cfb.cc
@@ -26,17 +26,17 @@
#include <gr_io_signature.h>
#include "digital_ofdm_sync_sc_cfb.h"
-#include <gr_delay.h>
+#include <analog/plateau_detector_fb.h>
+#include <blocks/complex_to_arg.h>
+#include <blocks/complex_to_mag_squared.h>
#include <blocks/conjugate_cc.h>
+#include <blocks/delay.h>
+#include <blocks/divide_ff.h>
#include <blocks/multiply_cc.h>
+#include <blocks/multiply_ff.h>
+#include <blocks/sample_and_hold_ff.h>
#include <filter/fir_filter_ccf.h>
-#include <blocks/complex_to_mag_squared.h>
#include <filter/fir_filter_fff.h>
-#include <blocks/multiply_ff.h>
-#include <blocks/divide_ff.h>
-#include <blocks/complex_to_arg.h>
-#include <analog/plateau_detector_fb.h>
-#include <gr_sample_and_hold_ff.h>
// Define this to add a third output for debugging
//#define SYNC_ADD_DEBUG_OUTPUT
@@ -58,7 +58,7 @@ digital_ofdm_sync_sc_cfb::digital_ofdm_sync_sc_cfb (int fft_len, int cp_len)
#endif
{
std::vector<float> ma_taps(fft_len/2, 1.0);
- gr_delay_sptr delay(gr_make_delay(sizeof(gr_complex), fft_len/2));
+ gr::blocks::delay::sptr delay(gr::blocks::delay::make(sizeof(gr_complex), fft_len/2));
gr::blocks::conjugate_cc::sptr delay_conjugate(gr::blocks::conjugate_cc::make());
gr::blocks::multiply_cc::sptr delay_corr(gr::blocks::multiply_cc::make());
gr::filter::fir_filter_ccf::sptr delay_ma(gr::filter::fir_filter_ccf::make(1, std::vector<float>(fft_len/2, 1.0)));
@@ -70,7 +70,7 @@ digital_ofdm_sync_sc_cfb::digital_ofdm_sync_sc_cfb (int fft_len, int cp_len)
gr::blocks::multiply_ff::sptr normalizer_square(gr::blocks::multiply_ff::make());
gr::blocks::complex_to_arg::sptr peak_to_angle(gr::blocks::complex_to_arg::make());
- gr_sample_and_hold_ff_sptr sample_and_hold(gr_make_sample_and_hold_ff());
+ gr::blocks::sample_and_hold_ff::sptr sample_and_hold(gr::blocks::sample_and_hold_ff::make());
gr::analog::plateau_detector_fb::sptr plateau_detector(gr::analog::plateau_detector_fb::make(cp_len));
diff --git a/gr-digital/lib/digital_packet_sink.cc b/gr-digital/lib/digital_packet_sink.cc
deleted file mode 100644
index 92521376fd..0000000000
--- a/gr-digital/lib/digital_packet_sink.cc
+++ /dev/null
@@ -1,207 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2010,2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <digital_packet_sink.h>
-#include <gr_io_signature.h>
-#include <cstdio>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <stdexcept>
-#include <gr_count_bits.h>
-#include <string.h>
-
-#define VERBOSE 0
-
-static const int DEFAULT_THRESHOLD = 12; // detect access code with up to DEFAULT_THRESHOLD bits wrong
-
-inline void
-digital_packet_sink::enter_search()
-{
- if (VERBOSE)
- fprintf(stderr, "@ enter_search\n");
-
- d_state = STATE_SYNC_SEARCH;
- d_shift_reg = 0;
-}
-
-inline void
-digital_packet_sink::enter_have_sync()
-{
- if (VERBOSE)
- fprintf(stderr, "@ enter_have_sync\n");
-
- d_state = STATE_HAVE_SYNC;
- d_header = 0;
- d_headerbitlen_cnt = 0;
-}
-
-inline void
-digital_packet_sink::enter_have_header(int payload_len)
-{
- if (VERBOSE)
- fprintf(stderr, "@ enter_have_header (payload_len = %d)\n", payload_len);
-
- d_state = STATE_HAVE_HEADER;
- d_packetlen = payload_len;
- d_packetlen_cnt = 0;
- d_packet_byte = 0;
- d_packet_byte_index = 0;
-}
-
-digital_packet_sink_sptr
-digital_make_packet_sink (const std::vector<unsigned char>& sync_vector,
- gr_msg_queue_sptr target_queue, int threshold)
-{
- return gnuradio::get_initial_sptr(new digital_packet_sink (sync_vector, target_queue, threshold));
-}
-
-
-digital_packet_sink::digital_packet_sink (const std::vector<unsigned char>& sync_vector,
- gr_msg_queue_sptr target_queue, int threshold)
- : gr_sync_block ("packet_sink",
- gr_make_io_signature (1, 1, sizeof(float)),
- gr_make_io_signature (0, 0, 0)),
- d_target_queue(target_queue), d_threshold(threshold == -1 ? DEFAULT_THRESHOLD : threshold)
-{
- d_sync_vector = 0;
- for(int i=0;i<8;i++){
- d_sync_vector <<= 8;
- d_sync_vector |= sync_vector[i];
- }
-
- enter_search();
-}
-
-digital_packet_sink::~digital_packet_sink ()
-{
-}
-
-int
-digital_packet_sink::work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- float *inbuf = (float *) input_items[0];
- int count=0;
-
- if (VERBOSE)
- fprintf(stderr,">>> Entering state machine\n"),fflush(stderr);
-
- while (count<noutput_items) {
- switch(d_state) {
-
- case STATE_SYNC_SEARCH: // Look for sync vector
- if (VERBOSE)
- fprintf(stderr,"SYNC Search, noutput=%d\n",noutput_items),fflush(stderr);
-
- while (count < noutput_items) {
- if(slice(inbuf[count++]))
- d_shift_reg = (d_shift_reg << 1) | 1;
- else
- d_shift_reg = d_shift_reg << 1;
-
- // Compute popcnt of putative sync vector
- if(gr_count_bits64 (d_shift_reg ^ d_sync_vector) <= d_threshold) {
- // Found it, set up for header decode
- enter_have_sync();
- break;
- }
- }
- break;
-
- case STATE_HAVE_SYNC:
- if (VERBOSE)
- fprintf(stderr,"Header Search bitcnt=%d, header=0x%08x\n", d_headerbitlen_cnt, d_header),
- fflush(stderr);
-
- while (count < noutput_items) { // Shift bits one at a time into header
- if(slice(inbuf[count++]))
- d_header = (d_header << 1) | 1;
- else
- d_header = d_header << 1;
-
- if (++d_headerbitlen_cnt == HEADERBITLEN) {
-
- if (VERBOSE)
- fprintf(stderr, "got header: 0x%08x\n", d_header);
-
- // we have a full header, check to see if it has been received properly
- if (header_ok()){
- int payload_len = header_payload_len();
- if (payload_len <= MAX_PKT_LEN) // reasonable?
- enter_have_header(payload_len); // yes.
- else
- enter_search(); // no.
- }
- else
- enter_search(); // no.
- break; // we're in a new state
- }
- }
- break;
-
- case STATE_HAVE_HEADER:
- if (VERBOSE)
- fprintf(stderr,"Packet Build\n"),fflush(stderr);
-
- while (count < noutput_items) { // shift bits into bytes of packet one at a time
- if(slice(inbuf[count++]))
- d_packet_byte = (d_packet_byte << 1) | 1;
- else
- d_packet_byte = d_packet_byte << 1;
-
- if (d_packet_byte_index++ == 7) { // byte is full so move to next byte
- d_packet[d_packetlen_cnt++] = d_packet_byte;
- d_packet_byte_index = 0;
-
- if (d_packetlen_cnt == d_packetlen){ // packet is filled
-
- // build a message
- gr_message_sptr msg = gr_make_message(0, 0, 0, d_packetlen_cnt);
- memcpy(msg->msg(), d_packet, d_packetlen_cnt);
-
- d_target_queue->insert_tail(msg); // send it
- msg.reset(); // free it up
-
- enter_search();
- break;
- }
- }
- }
- break;
-
- default:
- assert(0);
-
- } // switch
-
- } // while
-
- return noutput_items;
-}
-
diff --git a/gr-digital/lib/digital_pfb_clock_sync_ccf.cc b/gr-digital/lib/digital_pfb_clock_sync_ccf.cc
deleted file mode 100644
index 1a2d5970ba..0000000000
--- a/gr-digital/lib/digital_pfb_clock_sync_ccf.cc
+++ /dev/null
@@ -1,440 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2009-2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <cstdio>
-#include <cmath>
-
-#include <digital_pfb_clock_sync_ccf.h>
-#include <gr_fir_ccf.h>
-#include <gr_fir_util.h>
-#include <gr_io_signature.h>
-#include <gr_math.h>
-
-digital_pfb_clock_sync_ccf_sptr
-digital_make_pfb_clock_sync_ccf(double sps, float loop_bw,
- const std::vector<float> &taps,
- unsigned int filter_size,
- float init_phase,
- float max_rate_deviation,
- int osps)
-{
- return gnuradio::get_initial_sptr(new digital_pfb_clock_sync_ccf
- (sps, loop_bw, taps,
- filter_size,
- init_phase,
- max_rate_deviation,
- osps));
-}
-
-static int ios[] = {sizeof(gr_complex), sizeof(float), sizeof(float), sizeof(float)};
-static std::vector<int> iosig(ios, ios+sizeof(ios)/sizeof(int));
-digital_pfb_clock_sync_ccf::digital_pfb_clock_sync_ccf (double sps, float loop_bw,
- const std::vector<float> &taps,
- unsigned int filter_size,
- float init_phase,
- float max_rate_deviation,
- int osps)
- : gr_block ("pfb_clock_sync_ccf",
- gr_make_io_signature (1, 1, sizeof(gr_complex)),
- gr_make_io_signaturev (1, 4, iosig)),
- d_updated (false), d_nfilters(filter_size),
- d_max_dev(max_rate_deviation),
- d_osps(osps), d_error(0), d_out_idx(0)
-{
- d_nfilters = filter_size;
- d_sps = floor(sps);
-
- // Set the damping factor for a critically damped system
- d_damping = sqrtf(2.0f)/2.0f;
-
- // Set the bandwidth, which will then call update_gains()
- set_loop_bandwidth(loop_bw);
-
- // Store the last filter between calls to work
- // The accumulator keeps track of overflow to increment the stride correctly.
- // set it here to the fractional difference based on the initial phaes
- d_k = init_phase;
- d_rate = (sps-floor(sps))*(double)d_nfilters;
- d_rate_i = (int)floor(d_rate);
- d_rate_f = d_rate - (float)d_rate_i;
- d_filtnum = (int)floor(d_k);
-
- d_filters = std::vector<gr_fir_ccf*>(d_nfilters);
- d_diff_filters = std::vector<gr_fir_ccf*>(d_nfilters);
-
- // Create an FIR filter for each channel and zero out the taps
- std::vector<float> vtaps(0, d_nfilters);
- for(int i = 0; i < d_nfilters; i++) {
- d_filters[i] = gr_fir_util::create_gr_fir_ccf(vtaps);
- d_diff_filters[i] = gr_fir_util::create_gr_fir_ccf(vtaps);
- }
-
- // Now, actually set the filters' taps
- std::vector<float> dtaps;
- create_diff_taps(taps, dtaps);
- set_taps(taps, d_taps, d_filters);
- set_taps(dtaps, d_dtaps, d_diff_filters);
-}
-
-digital_pfb_clock_sync_ccf::~digital_pfb_clock_sync_ccf ()
-{
- for(int i = 0; i < d_nfilters; i++) {
- delete d_filters[i];
- delete d_diff_filters[i];
- }
-}
-
-bool
-digital_pfb_clock_sync_ccf::check_topology(int ninputs, int noutputs)
-{
- return noutputs == 1 || noutputs == 4;
-}
-
-
-
-/*******************************************************************
- SET FUNCTIONS
-*******************************************************************/
-
-
-void
-digital_pfb_clock_sync_ccf::set_loop_bandwidth(float bw)
-{
- if(bw < 0) {
- throw std::out_of_range ("digital_pfb_clock_sync_cc: invalid bandwidth. Must be >= 0.");
- }
-
- d_loop_bw = bw;
- update_gains();
-}
-
-void
-digital_pfb_clock_sync_ccf::set_damping_factor(float df)
-{
- if(df < 0 || df > 1.0) {
- throw std::out_of_range ("digital_pfb_clock_sync_cc: invalid damping factor. Must be in [0,1].");
- }
-
- d_damping = df;
- update_gains();
-}
-
-void
-digital_pfb_clock_sync_ccf::set_alpha(float alpha)
-{
- if(alpha < 0 || alpha > 1.0) {
- throw std::out_of_range ("digital_pfb_clock_sync_cc: invalid alpha. Must be in [0,1].");
- }
- d_alpha = alpha;
-}
-
-void
-digital_pfb_clock_sync_ccf::set_beta(float beta)
-{
- if(beta < 0 || beta > 1.0) {
- throw std::out_of_range ("digital_pfb_clock_sync_cc: invalid beta. Must be in [0,1].");
- }
- d_beta = beta;
-}
-
-/*******************************************************************
- GET FUNCTIONS
-*******************************************************************/
-
-
-float
-digital_pfb_clock_sync_ccf::get_loop_bandwidth() const
-{
- return d_loop_bw;
-}
-
-float
-digital_pfb_clock_sync_ccf::get_damping_factor() const
-{
- return d_damping;
-}
-
-float
-digital_pfb_clock_sync_ccf::get_alpha() const
-{
- return d_alpha;
-}
-
-float
-digital_pfb_clock_sync_ccf::get_beta() const
-{
- return d_beta;
-}
-
-float
-digital_pfb_clock_sync_ccf::get_clock_rate() const
-{
- return d_rate_f;
-}
-
-/*******************************************************************
-*******************************************************************/
-
-void
-digital_pfb_clock_sync_ccf::update_gains()
-{
- float denom = (1.0 + 2.0*d_damping*d_loop_bw + d_loop_bw*d_loop_bw);
- d_alpha = (4*d_damping*d_loop_bw) / denom;
- d_beta = (4*d_loop_bw*d_loop_bw) / denom;
-}
-
-
-void
-digital_pfb_clock_sync_ccf::set_taps (const std::vector<float> &newtaps,
- std::vector< std::vector<float> > &ourtaps,
- std::vector<gr_fir_ccf*> &ourfilter)
-{
- int i,j;
-
- unsigned int ntaps = newtaps.size();
- d_taps_per_filter = (unsigned int)ceil((double)ntaps/(double)d_nfilters);
-
- // Create d_numchan vectors to store each channel's taps
- ourtaps.resize(d_nfilters);
-
- // Make a vector of the taps plus fill it out with 0's to fill
- // each polyphase filter with exactly d_taps_per_filter
- std::vector<float> tmp_taps;
- tmp_taps = newtaps;
- while((float)(tmp_taps.size()) < d_nfilters*d_taps_per_filter) {
- tmp_taps.push_back(0.0);
- }
-
- // Partition the filter
- for(i = 0; i < d_nfilters; i++) {
- // Each channel uses all d_taps_per_filter with 0's if not enough taps to fill out
- ourtaps[i] = std::vector<float>(d_taps_per_filter, 0);
- for(j = 0; j < d_taps_per_filter; j++) {
- ourtaps[i][j] = tmp_taps[i + j*d_nfilters];
- }
-
- // Build a filter for each channel and add it's taps to it
- ourfilter[i]->set_taps(ourtaps[i]);
- }
-
- // Set the history to ensure enough input items for each filter
- set_history (d_taps_per_filter + d_sps);
-
- // Make sure there is enough output space for d_osps outputs/input.
- set_output_multiple(d_osps);
-
- d_updated = true;
-}
-
-void
-digital_pfb_clock_sync_ccf::create_diff_taps(const std::vector<float> &newtaps,
- std::vector<float> &difftaps)
-{
- std::vector<float> diff_filter(3);
- diff_filter[0] = -1;
- diff_filter[1] = 0;
- diff_filter[2] = 1;
-
- float pwr = 0;
- difftaps.push_back(0);
- for(unsigned int i = 0; i < newtaps.size()-2; i++) {
- float tap = 0;
- for(int j = 0; j < 3; j++) {
- tap += diff_filter[j]*newtaps[i+j];
- pwr += fabsf(tap);
- }
- difftaps.push_back(tap);
- }
- difftaps.push_back(0);
-
- for(unsigned int i = 0; i < difftaps.size(); i++) {
- difftaps[i] *= pwr;
- }
-}
-
-std::string
-digital_pfb_clock_sync_ccf::get_taps_as_string()
-{
- int i, j;
- std::stringstream str;
- str.precision(4);
- str.setf(std::ios::scientific);
-
- str << "[ ";
- for(i = 0; i < d_nfilters; i++) {
- str << "[" << d_taps[i][0] << ", ";
- for(j = 1; j < d_taps_per_filter-1; j++) {
- str << d_taps[i][j] << ", ";
- }
- str << d_taps[i][j] << "],";
- }
- str << " ]" << std::endl;
-
- return str.str();
-}
-
-std::string
-digital_pfb_clock_sync_ccf::get_diff_taps_as_string()
-{
- int i, j;
- std::stringstream str;
- str.precision(4);
- str.setf(std::ios::scientific);
-
- str << "[ ";
- for(i = 0; i < d_nfilters; i++) {
- str << "[" << d_dtaps[i][0] << ", ";
- for(j = 1; j < d_taps_per_filter-1; j++) {
- str << d_dtaps[i][j] << ", ";
- }
- str << d_dtaps[i][j] << "],";
- }
- str << " ]" << std::endl;
-
- return str.str();
-}
-
-std::vector< std::vector<float> >
-digital_pfb_clock_sync_ccf::get_taps()
-{
- return d_taps;
-}
-
-std::vector< std::vector<float> >
-digital_pfb_clock_sync_ccf::get_diff_taps()
-{
- return d_dtaps;
-}
-
-std::vector<float>
-digital_pfb_clock_sync_ccf::get_channel_taps(int channel)
-{
- std::vector<float> taps;
- for(int i = 0; i < d_taps_per_filter; i++) {
- taps.push_back(d_taps[channel][i]);
- }
- return taps;
-}
-
-std::vector<float>
-digital_pfb_clock_sync_ccf::get_diff_channel_taps(int channel)
-{
- std::vector<float> taps;
- for(int i = 0; i < d_taps_per_filter; i++) {
- taps.push_back(d_dtaps[channel][i]);
- }
- return taps;
-}
-
-
-int
-digital_pfb_clock_sync_ccf::general_work(int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- gr_complex *in = (gr_complex *) input_items[0];
- gr_complex *out = (gr_complex *) output_items[0];
-
- float *err = NULL, *outrate = NULL, *outk = NULL;
- if(output_items.size() == 4) {
- err = (float *) output_items[1];
- outrate = (float*)output_items[2];
- outk = (float*)output_items[3];
- }
-
- if (d_updated) {
- d_updated = false;
- return 0; // history requirements may have changed.
- }
-
- // We need this many to process one output
- int nrequired = ninput_items[0] - d_taps_per_filter - d_osps;
-
- int i = 0, count = 0;
- float error_r, error_i;
-
- // produce output as long as we can and there are enough input samples
- while((i < noutput_items) && (count < nrequired)) {
- while(d_out_idx < d_osps) {
- d_filtnum = (int)floor(d_k);
-
- // Keep the current filter number in [0, d_nfilters]
- // If we've run beyond the last filter, wrap around and go to next sample
- // If we've go below 0, wrap around and go to previous sample
- while(d_filtnum >= d_nfilters) {
- d_k -= d_nfilters;
- d_filtnum -= d_nfilters;
- count += 1;
- }
- while(d_filtnum < 0) {
- d_k += d_nfilters;
- d_filtnum += d_nfilters;
- count -= 1;
- }
-
- out[i+d_out_idx] = d_filters[d_filtnum]->filter(&in[count+d_out_idx]);
- d_k = d_k + d_rate_i + d_rate_f; // update phase
- d_out_idx++;
-
- if(output_items.size() == 4) {
- err[i] = d_error;
- outrate[i] = d_rate_f;
- outk[i] = d_k;
- }
-
- // We've run out of output items we can create; return now.
- if(i+d_out_idx >= noutput_items) {
- consume_each(count);
- return i;
- }
- }
-
- // reset here; if we didn't complete a full osps samples last time,
- // the early return would take care of it.
- d_out_idx = 0;
-
- // Update the phase and rate estimates for this symbol
- gr_complex diff = d_diff_filters[d_filtnum]->filter(&in[count]);
- error_r = out[i].real() * diff.real();
- error_i = out[i].imag() * diff.imag();
- d_error = (error_i + error_r) / 2.0; // average error from I&Q channel
-
- // Run the control loop to update the current phase (k) and
- // tracking rate estimates based on the error value
- d_rate_f = d_rate_f + d_beta*d_error;
- d_k = d_k + d_alpha*d_error;
-
- // Keep our rate within a good range
- d_rate_f = gr_branchless_clip(d_rate_f, d_max_dev);
-
- i+=d_osps;
- count += (int)floor(d_sps);
- }
-
- consume_each(count);
- return i;
-}
diff --git a/gr-digital/lib/digital_pfb_clock_sync_fff.cc b/gr-digital/lib/digital_pfb_clock_sync_fff.cc
deleted file mode 100644
index 0e7d2a52da..0000000000
--- a/gr-digital/lib/digital_pfb_clock_sync_fff.cc
+++ /dev/null
@@ -1,434 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2009,2010,2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <cstdio>
-#include <cmath>
-
-#include <digital_pfb_clock_sync_fff.h>
-#include <gr_fir_fff.h>
-#include <gr_fir_util.h>
-#include <gr_io_signature.h>
-#include <gr_math.h>
-
-digital_pfb_clock_sync_fff_sptr
-digital_make_pfb_clock_sync_fff(double sps, float gain,
- const std::vector<float> &taps,
- unsigned int filter_size,
- float init_phase,
- float max_rate_deviation,
- int osps)
-{
- return gnuradio::get_initial_sptr(new digital_pfb_clock_sync_fff
- (sps, gain, taps,
- filter_size,
- init_phase,
- max_rate_deviation,
- osps));
-}
-
-static int ios[] = {sizeof(float), sizeof(float), sizeof(float), sizeof(float)};
-static std::vector<int> iosig(ios, ios+sizeof(ios)/sizeof(int));
-digital_pfb_clock_sync_fff::digital_pfb_clock_sync_fff (double sps, float loop_bw,
- const std::vector<float> &taps,
- unsigned int filter_size,
- float init_phase,
- float max_rate_deviation,
- int osps)
- : gr_block ("pfb_clock_sync_fff",
- gr_make_io_signature (1, 1, sizeof(float)),
- gr_make_io_signaturev (1, 4, iosig)),
- d_updated (false), d_nfilters(filter_size),
- d_max_dev(max_rate_deviation),
- d_osps(osps), d_error(0), d_out_idx(0)
-{
- d_nfilters = filter_size;
- d_sps = floor(sps);
-
- // Set the damping factor for a critically damped system
- d_damping = sqrtf(2.0f)/2.0f;
-
- // Set the bandwidth, which will then call update_gains()
- set_loop_bandwidth(loop_bw);
-
- // Store the last filter between calls to work
- // The accumulator keeps track of overflow to increment the stride correctly.
- // set it here to the fractional difference based on the initial phaes
- d_k = init_phase;
- d_rate = (sps-floor(sps))*(double)d_nfilters;
- d_rate_i = (int)floor(d_rate);
- d_rate_f = d_rate - (float)d_rate_i;
- d_filtnum = (int)floor(d_k);
-
- d_filters = std::vector<gr_fir_fff*>(d_nfilters);
- d_diff_filters = std::vector<gr_fir_fff*>(d_nfilters);
-
- // Create an FIR filter for each channel and zero out the taps
- std::vector<float> vtaps(0, d_nfilters);
- for(int i = 0; i < d_nfilters; i++) {
- d_filters[i] = gr_fir_util::create_gr_fir_fff(vtaps);
- d_diff_filters[i] = gr_fir_util::create_gr_fir_fff(vtaps);
- }
-
- // Now, actually set the filters' taps
- std::vector<float> dtaps;
- create_diff_taps(taps, dtaps);
- set_taps(taps, d_taps, d_filters);
- set_taps(dtaps, d_dtaps, d_diff_filters);
-}
-
-digital_pfb_clock_sync_fff::~digital_pfb_clock_sync_fff ()
-{
- for(int i = 0; i < d_nfilters; i++) {
- delete d_filters[i];
- delete d_diff_filters[i];
- }
-}
-
-bool
-digital_pfb_clock_sync_fff::check_topology(int ninputs, int noutputs)
-{
- return noutputs == 1 || noutputs == 4;
-}
-
-/*******************************************************************
- SET FUNCTIONS
-*******************************************************************/
-
-
-void
-digital_pfb_clock_sync_fff::set_loop_bandwidth(float bw)
-{
- if(bw < 0) {
- throw std::out_of_range ("digital_pfb_clock_sync_fff: invalid bandwidth. Must be >= 0.");
- }
-
- d_loop_bw = bw;
- update_gains();
-}
-
-void
-digital_pfb_clock_sync_fff::set_damping_factor(float df)
-{
- if(df < 0 || df > 1.0) {
- throw std::out_of_range ("digital_pfb_clock_sync_fff: invalid damping factor. Must be in [0,1].");
- }
-
- d_damping = df;
- update_gains();
-}
-
-void
-digital_pfb_clock_sync_fff::set_alpha(float alpha)
-{
- if(alpha < 0 || alpha > 1.0) {
- throw std::out_of_range ("digital_pfb_clock_sync_fff: invalid alpha. Must be in [0,1].");
- }
- d_alpha = alpha;
-}
-
-void
-digital_pfb_clock_sync_fff::set_beta(float beta)
-{
- if(beta < 0 || beta > 1.0) {
- throw std::out_of_range ("digital_pfb_clock_sync_fff: invalid beta. Must be in [0,1].");
- }
- d_beta = beta;
-}
-
-/*******************************************************************
- GET FUNCTIONS
-*******************************************************************/
-
-
-float
-digital_pfb_clock_sync_fff::get_loop_bandwidth() const
-{
- return d_loop_bw;
-}
-
-float
-digital_pfb_clock_sync_fff::get_damping_factor() const
-{
- return d_damping;
-}
-
-float
-digital_pfb_clock_sync_fff::get_alpha() const
-{
- return d_alpha;
-}
-
-float
-digital_pfb_clock_sync_fff::get_beta() const
-{
- return d_beta;
-}
-
-float
-digital_pfb_clock_sync_fff::get_clock_rate() const
-{
- return d_rate_f;
-}
-
-/*******************************************************************
-*******************************************************************/
-
-void
-digital_pfb_clock_sync_fff::update_gains()
-{
- float denom = (1.0 + 2.0*d_damping*d_loop_bw + d_loop_bw*d_loop_bw);
- d_alpha = (4*d_damping*d_loop_bw) / denom;
- d_beta = (4*d_loop_bw*d_loop_bw) / denom;
-}
-
-
-void
-digital_pfb_clock_sync_fff::set_taps (const std::vector<float> &newtaps,
- std::vector< std::vector<float> > &ourtaps,
- std::vector<gr_fir_fff*> &ourfilter)
-{
- int i,j;
-
- unsigned int ntaps = newtaps.size();
- d_taps_per_filter = (unsigned int)ceil((double)ntaps/(double)d_nfilters);
-
- // Create d_numchan vectors to store each channel's taps
- ourtaps.resize(d_nfilters);
-
- // Make a vector of the taps plus fill it out with 0's to fill
- // each polyphase filter with exactly d_taps_per_filter
- std::vector<float> tmp_taps;
- tmp_taps = newtaps;
- while((float)(tmp_taps.size()) < d_nfilters*d_taps_per_filter) {
- tmp_taps.push_back(0.0);
- }
-
- // Partition the filter
- for(i = 0; i < d_nfilters; i++) {
- // Each channel uses all d_taps_per_filter with 0's if not enough taps to fill out
- ourtaps[i] = std::vector<float>(d_taps_per_filter, 0);
- for(j = 0; j < d_taps_per_filter; j++) {
- ourtaps[i][j] = tmp_taps[i + j*d_nfilters];
- }
-
- // Build a filter for each channel and add it's taps to it
- ourfilter[i]->set_taps(ourtaps[i]);
- }
-
- // Set the history to ensure enough input items for each filter
- set_history (d_taps_per_filter + d_sps);
-
- // Make sure there is enough output space for d_osps outputs/input.
- set_output_multiple(d_osps);
-
- d_updated = true;
-}
-
-void
-digital_pfb_clock_sync_fff::create_diff_taps(const std::vector<float> &newtaps,
- std::vector<float> &difftaps)
-{
- std::vector<float> diff_filter(3);
- diff_filter[0] = -1;
- diff_filter[1] = 0;
- diff_filter[2] = 1;
-
- float pwr = 0;
- difftaps.push_back(0);
- for(unsigned int i = 0; i < newtaps.size()-2; i++) {
- float tap = 0;
- for(int j = 0; j < 3; j++) {
- tap += diff_filter[j]*newtaps[i+j];
- pwr += fabsf(tap);
- }
- difftaps.push_back(tap);
- }
- difftaps.push_back(0);
-
- for(unsigned int i = 0; i < difftaps.size(); i++) {
- difftaps[i] *= pwr;
- }
-}
-
-std::string
-digital_pfb_clock_sync_fff::get_taps_as_string()
-{
- int i, j;
- std::stringstream str;
- str.precision(4);
- str.setf(std::ios::scientific);
-
- str << "[ ";
- for(i = 0; i < d_nfilters; i++) {
- str << "[" << d_taps[i][0] << ", ";
- for(j = 1; j < d_taps_per_filter-1; j++) {
- str << d_taps[i][j] << ", ";
- }
- str << d_taps[i][j] << "],";
- }
- str << " ]" << std::endl;
-
- return str.str();
-}
-
-std::string
-digital_pfb_clock_sync_fff::get_diff_taps_as_string()
-{
- int i, j;
- std::stringstream str;
- str.precision(4);
- str.setf(std::ios::scientific);
-
- str << "[ ";
- for(i = 0; i < d_nfilters; i++) {
- str << "[" << d_dtaps[i][0] << ", ";
- for(j = 1; j < d_taps_per_filter-1; j++) {
- str << d_dtaps[i][j] << ", ";
- }
- str << d_dtaps[i][j] << "],";
- }
- str << " ]" << std::endl;
-
- return str.str();
-}
-
-std::vector< std::vector<float> >
-digital_pfb_clock_sync_fff::get_taps()
-{
- return d_taps;
-}
-
-std::vector< std::vector<float> >
-digital_pfb_clock_sync_fff::get_diff_taps()
-{
- return d_dtaps;
-}
-
-std::vector<float>
-digital_pfb_clock_sync_fff::get_channel_taps(int channel)
-{
- std::vector<float> taps;
- for(int i = 0; i < d_taps_per_filter; i++) {
- taps.push_back(d_taps[channel][i]);
- }
- return taps;
-}
-
-std::vector<float>
-digital_pfb_clock_sync_fff::get_diff_channel_taps(int channel)
-{
- std::vector<float> taps;
- for(int i = 0; i < d_taps_per_filter; i++) {
- taps.push_back(d_dtaps[channel][i]);
- }
- return taps;
-}
-
-int
-digital_pfb_clock_sync_fff::general_work(int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- float *in = (float *) input_items[0];
- float *out = (float *) output_items[0];
-
- float *err = NULL, *outrate = NULL, *outk = NULL;
- if(output_items.size() == 4) {
- err = (float *) output_items[1];
- outrate = (float*)output_items[2];
- outk = (float*)output_items[3];
- }
-
- if (d_updated) {
- d_updated = false;
- return 0; // history requirements may have changed.
- }
-
- // We need this many to process one output
- int nrequired = ninput_items[0] - d_taps_per_filter - d_osps;
-
- int i = 0, count = 0;
-
- // produce output as long as we can and there are enough input samples
- while((i < noutput_items) && (count < nrequired)) {
- while(d_out_idx < d_osps) {
- d_filtnum = (int)floor(d_k);
-
- // Keep the current filter number in [0, d_nfilters]
- // If we've run beyond the last filter, wrap around and go to next sample
- // If we've go below 0, wrap around and go to previous sample
- while(d_filtnum >= d_nfilters) {
- d_k -= d_nfilters;
- d_filtnum -= d_nfilters;
- count += 1;
- }
- while(d_filtnum < 0) {
- d_k += d_nfilters;
- d_filtnum += d_nfilters;
- count -= 1;
- }
-
- out[i+d_out_idx] = d_filters[d_filtnum]->filter(&in[count+d_out_idx]);
- d_k = d_k + d_rate_i + d_rate_f; // update phase
- d_out_idx++;
-
- if(output_items.size() == 4) {
- err[i] = d_error;
- outrate[i] = d_rate_f;
- outk[i] = d_k;
- }
-
- // We've run out of output items we can create; return now.
- if(i+d_out_idx >= noutput_items) {
- consume_each(count);
- return i;
- }
- }
-
- // reset here; if we didn't complete a full osps samples last time,
- // the early return would take care of it.
- d_out_idx = 0;
-
- // Update the phase and rate estimates for this symbol
- float diff = d_diff_filters[d_filtnum]->filter(&in[count]);
- d_error = out[i] * diff;
-
- // Run the control loop to update the current phase (k) and
- // tracking rate estimates based on the error value
- d_rate_f = d_rate_f + d_beta*d_error;
- d_k = d_k + d_alpha*d_error;
-
- // Keep our rate within a good range
- d_rate_f = gr_branchless_clip(d_rate_f, d_max_dev);
-
- i+=d_osps;
- count += (int)floor(d_sps);
- }
-
- consume_each(count);
- return i;
-}
diff --git a/gr-digital/lib/digital_pn_correlator_cc.cc b/gr-digital/lib/digital_pn_correlator_cc.cc
deleted file mode 100644
index 43a3ddbd1f..0000000000
--- a/gr-digital/lib/digital_pn_correlator_cc.cc
+++ /dev/null
@@ -1,80 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2007,2010,2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <digital_pn_correlator_cc.h>
-#include <gr_io_signature.h>
-
-digital_pn_correlator_cc_sptr
-digital_make_pn_correlator_cc(int degree, int mask, int seed)
-{
- return gnuradio::get_initial_sptr(new digital_pn_correlator_cc
- (degree, mask, seed));
-}
-
-digital_pn_correlator_cc::digital_pn_correlator_cc(int degree,
- int mask,
- int seed)
- : gr_sync_decimator ("pn_correlator_cc",
- gr_make_io_signature (1, 1, sizeof(gr_complex)),
- gr_make_io_signature (1, 1, sizeof(gr_complex)),
- (unsigned int)((1ULL << degree)-1)) // PN code length
-{
- d_len = (unsigned int)((1ULL << degree)-1);
- if (mask == 0)
- mask = gri_glfsr::glfsr_mask(degree);
- d_reference = new gri_glfsr(mask, seed);
- for (int i = 0; i < d_len; i++) // initialize to last value in sequence
- d_pn = 2.0*d_reference->next_bit()-1.0;
-}
-
-digital_pn_correlator_cc::~digital_pn_correlator_cc()
-{
- delete d_reference;
-}
-
-int
-digital_pn_correlator_cc::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- const gr_complex *in = (const gr_complex *) input_items[0];
- gr_complex *out = (gr_complex *) output_items[0];
- gr_complex sum;
-
- for (int i = 0; i < noutput_items; i++) {
- sum = 0.0;
-
- for (int j = 0; j < d_len; j++) {
- if (j != 0) // retard PN generator one sample per period
- d_pn = 2.0*d_reference->next_bit()-1.0; // no conditionals
- sum += *in++ * d_pn;
- }
-
- *out++ = sum*gr_complex(1.0/d_len, 0.0);
- }
-
- return noutput_items;
-}
diff --git a/gr-digital/lib/digital_probe_density_b.cc b/gr-digital/lib/digital_probe_density_b.cc
deleted file mode 100644
index 6b83d2ddb7..0000000000
--- a/gr-digital/lib/digital_probe_density_b.cc
+++ /dev/null
@@ -1,68 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2008,2010,2012 Free Software Foundation, Inc.
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <digital_probe_density_b.h>
-#include <gr_io_signature.h>
-#include <stdexcept>
-#include <iostream>
-
-digital_probe_density_b_sptr
-digital_make_probe_density_b(double alpha)
-{
- return gnuradio::get_initial_sptr(new digital_probe_density_b(alpha));
-}
-
-digital_probe_density_b::digital_probe_density_b(double alpha)
- : gr_sync_block("density_b",
- gr_make_io_signature(1, 1, sizeof(char)),
- gr_make_io_signature(0, 0, 0))
-{
- set_alpha(alpha);
- d_density = 1.0;
-}
-
-digital_probe_density_b::~digital_probe_density_b()
-{
-}
-
-int
-digital_probe_density_b::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- const char *in = (const char *)input_items[0];
-
- for (int i = 0; i < noutput_items; i++)
- d_density = d_alpha*(double)in[i] + d_beta*d_density;
-
- return noutput_items;
-}
-
-void
-digital_probe_density_b::set_alpha(double alpha)
-{
- d_alpha = alpha;
- d_beta = 1.0-d_alpha;
-}
-
diff --git a/gr-digital/lib/digital_probe_mpsk_snr_est_c.cc b/gr-digital/lib/digital_probe_mpsk_snr_est_c.cc
deleted file mode 100644
index 5cdfea96d1..0000000000
--- a/gr-digital/lib/digital_probe_mpsk_snr_est_c.cc
+++ /dev/null
@@ -1,152 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <digital_probe_mpsk_snr_est_c.h>
-#include <gr_io_signature.h>
-#include <cstdio>
-
-digital_probe_mpsk_snr_est_c_sptr
-digital_make_probe_mpsk_snr_est_c(snr_est_type_t type,
- int msg_nsamples,
- double alpha)
-{
- return gnuradio::get_initial_sptr(
- new digital_probe_mpsk_snr_est_c(type, msg_nsamples, alpha));
-}
-
-digital_probe_mpsk_snr_est_c::digital_probe_mpsk_snr_est_c(
- snr_est_type_t type,
- int msg_nsamples,
- double alpha)
- : gr_sync_block ("probe_mpsk_snr_est_c",
- gr_make_io_signature(1, 1, sizeof(gr_complex)),
- gr_make_io_signature(0, 0, 0))
-{
- d_snr_est = NULL;
-
- d_type = type;
- d_nsamples = msg_nsamples;
- d_count = 0;
- set_alpha(alpha);
-
- set_type(type);
-
- // at least 1 estimator has to look back
- set_history(2);
-
- d_key = pmt::pmt_string_to_symbol("snr");
-}
-
-digital_probe_mpsk_snr_est_c::~digital_probe_mpsk_snr_est_c()
-{
- if(d_snr_est)
- delete d_snr_est;
-}
-
-int
-digital_probe_mpsk_snr_est_c::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- const gr_complex *in = (const gr_complex*)input_items[0];
- return d_snr_est->update(noutput_items, in);
-}
-
-double
-digital_probe_mpsk_snr_est_c::snr()
-{
- if(d_snr_est)
- return d_snr_est->snr();
- else
- throw std::runtime_error("digital_probe_mpsk_snr_est_c:: No SNR estimator defined.\n");
-}
-
-snr_est_type_t
-digital_probe_mpsk_snr_est_c::type() const
-{
- return d_type;
-}
-
-int
-digital_probe_mpsk_snr_est_c::msg_nsample() const
-{
- return d_nsamples;
-}
-
-double
-digital_probe_mpsk_snr_est_c::alpha() const
-{
- return d_alpha;
-}
-
-void
-digital_probe_mpsk_snr_est_c::set_type(snr_est_type_t t)
-{
- d_type = t;
-
- if(d_snr_est)
- delete d_snr_est;
-
- switch (d_type) {
- case(SNR_EST_SIMPLE):
- d_snr_est = new digital_impl_mpsk_snr_est_simple(d_alpha);
- break;
- case(SNR_EST_SKEW):
- d_snr_est = new digital_impl_mpsk_snr_est_skew(d_alpha);
- break;
- case(SNR_EST_M2M4):
- d_snr_est = new digital_impl_mpsk_snr_est_m2m4(d_alpha);
- break;
- case(SNR_EST_SVR):
- d_snr_est = new digital_impl_mpsk_snr_est_svr(d_alpha);
- break;
- default:
- throw std::invalid_argument("digital_probe_mpsk_snr_est_c: unknown type specified.\n");
- }
-}
-
-void
-digital_probe_mpsk_snr_est_c::set_msg_nsample(int n)
-{
- if(n > 0) {
- d_nsamples = n;
- d_count = 0; // reset state
- }
- else
- throw std::invalid_argument("digital_probe_mpsk_snr_est_c: msg_nsamples can't be <= 0\n");
-}
-
-void
-digital_probe_mpsk_snr_est_c::set_alpha(double alpha)
-{
- if((alpha >= 0) && (alpha <= 1.0)) {
- d_alpha = alpha;
- if(d_snr_est)
- d_snr_est->set_alpha(d_alpha);
- }
- else
- throw std::invalid_argument("digital_probe_mpsk_snr_est_c: alpha must be in [0,1]\n");
-}
diff --git a/gr-digital/lib/digital_scrambler_bb.cc b/gr-digital/lib/digital_scrambler_bb.cc
deleted file mode 100644
index c81b09d8c3..0000000000
--- a/gr-digital/lib/digital_scrambler_bb.cc
+++ /dev/null
@@ -1,57 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2008,2010,2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <digital_scrambler_bb.h>
-#include <gr_io_signature.h>
-
-digital_scrambler_bb_sptr
-digital_make_scrambler_bb(int mask, int seed, int len)
-{
- return gnuradio::get_initial_sptr(new digital_scrambler_bb
- (mask, seed, len));
-}
-
-digital_scrambler_bb::digital_scrambler_bb(int mask, int seed, int len)
- : gr_sync_block("scrambler_bb",
- gr_make_io_signature (1, 1, sizeof (unsigned char)),
- gr_make_io_signature (1, 1, sizeof (unsigned char))),
- d_lfsr(mask, seed, len)
-{
-}
-
-int
-digital_scrambler_bb::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- const unsigned char *in = (const unsigned char *) input_items[0];
- unsigned char *out = (unsigned char *) output_items[0];
-
- for (int i = 0; i < noutput_items; i++)
- out[i] = d_lfsr.next_bit_scramble(in[i]);
-
- return noutput_items;
-}
diff --git a/gr-digital/lib/digital_simple_correlator.cc b/gr-digital/lib/digital_simple_correlator.cc
deleted file mode 100644
index 37ef2f1e5f..0000000000
--- a/gr-digital/lib/digital_simple_correlator.cc
+++ /dev/null
@@ -1,231 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2010,2013 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <digital_simple_correlator.h>
-#include <digital_simple_framer_sync.h>
-#include <gr_io_signature.h>
-#include <gr_count_bits.h>
-#include <assert.h>
-#include <stdexcept>
-#include <string.h>
-#include <cstdio>
-
-static const int THRESHOLD = 3;
-
-digital_simple_correlator_sptr
-digital_make_simple_correlator(int payload_bytesize)
-{
- return gnuradio::get_initial_sptr
- (new digital_simple_correlator(payload_bytesize));
-}
-
-digital_simple_correlator::digital_simple_correlator(int payload_bytesize)
- : gr_block("simple_correlator",
- gr_make_io_signature(1, 1, sizeof(float)),
- gr_make_io_signature(1, 1, sizeof(unsigned char))),
- d_payload_bytesize(payload_bytesize),
- d_state(ST_LOOKING), d_osi(0),
- d_bblen((payload_bytesize + GRSF_PAYLOAD_OVERHEAD) * GRSF_BITS_PER_BYTE),
- d_bitbuf(new unsigned char[d_bblen]),
- d_pktbuf(new unsigned char[d_bblen/GRSF_BITS_PER_BYTE]),
- d_bbi(0)
-{
- d_avbi = 0;
- d_accum = 0.0;
- d_avg = 0.0;
- for(int i = 0; i < AVG_PERIOD; i++)
- d_avgbuf[i] = 0.0;
-
-#ifdef DEBUG_SIMPLE_CORRELATOR
- d_debug_fp = fopen("corr.log", "w");
-#endif
- enter_looking();
-}
-
-digital_simple_correlator::~digital_simple_correlator()
-{
-#ifdef DEBUG_SIMPLE_CORRELATOR
- fclose(d_debug_fp);
-#endif
- delete [] d_bitbuf;
- delete [] d_pktbuf;
-}
-
-void
-digital_simple_correlator::enter_looking()
-{
- fflush(stdout);
- // fprintf(stderr, ">>> enter_looking\n");
- d_state = ST_LOOKING;
- for(int i = 0; i < OVERSAMPLE; i++)
- d_shift_reg[i] = 0;
- d_osi = 0;
-
- d_avbi = 0;
- d_avg = d_avg * 0.5;
- d_accum = 0;
- for(int i = 0; i < AVG_PERIOD; i++)
- d_avgbuf[i] = 0.0;
-}
-
-void
-digital_simple_correlator::enter_under_threshold()
-{
- fflush(stdout);
- // fprintf(stderr, ">>> enter_under_threshold\n");
- d_state = ST_UNDER_THRESHOLD;
- d_transition_osi = d_osi;
-}
-
-void
-digital_simple_correlator::enter_locked()
-{
- d_state = ST_LOCKED;
- int delta = sub_index(d_osi, d_transition_osi);
- d_center_osi = add_index(d_transition_osi, delta/2);
- //d_center_osi = add_index(d_center_osi, 3); // FIXME
- d_bbi = 0;
- fflush(stdout);
- // fprintf(stderr, ">>> enter_locked d_center_osi = %d\n", d_center_osi);
-
- d_avg = std::max(-1.0, std::min(1.0, d_accum * (1.0/AVG_PERIOD)));
- // fprintf(stderr, ">>> enter_locked d_avg = %g\n", d_avg);
-}
-
-static void
-packit(unsigned char *pktbuf, const unsigned char *bitbuf, int bitcount)
-{
- for(int i = 0; i < bitcount; i += 8) {
- int t = bitbuf[i+0] & 0x1;
- t = (t << 1) | (bitbuf[i+1] & 0x1);
- t = (t << 1) | (bitbuf[i+2] & 0x1);
- t = (t << 1) | (bitbuf[i+3] & 0x1);
- t = (t << 1) | (bitbuf[i+4] & 0x1);
- t = (t << 1) | (bitbuf[i+5] & 0x1);
- t = (t << 1) | (bitbuf[i+6] & 0x1);
- t = (t << 1) | (bitbuf[i+7] & 0x1);
- *pktbuf++ = t;
- }
-}
-
-void
-digital_simple_correlator::update_avg(float x)
-{
- d_accum -= d_avgbuf[d_avbi];
- d_avgbuf[d_avbi] = x;
- d_accum += x;
- d_avbi = (d_avbi + 1) & (AVG_PERIOD-1);
-}
-
-int
-digital_simple_correlator::general_work(int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- const float *in = (const float*)input_items[0];
- unsigned char *out = (unsigned char*)output_items[0];
-
- int n = 0;
- int nin = ninput_items[0];
- int decision;
- int hamming_dist;
-
-#ifdef DEBUG_SIMPLE_CORRELATOR
- struct debug_data {
- float raw_data;
- float sampled;
- float enter_locked;
- } debug_data;
-#endif
-
- while(n < nin) {
-
-#ifdef DEBUG_SIMPLE_CORRELATOR
- debug_data.raw_data = in[n];
- debug_data.sampled = 0.0;
- debug_data.enter_locked = 0.0;
-#endif
-
- switch(d_state) {
- case ST_LOCKED:
- if(d_osi == d_center_osi) {
-
-#ifdef DEBUG_SIMPLE_CORRELATOR
- debug_data.sampled = 1.0;
-#endif
- decision = slice(in[n]);
-
- d_bitbuf[d_bbi] = decision;
- d_bbi++;
- if(d_bbi >= d_bblen) {
- // printf("got whole packet\n");
- packit(d_pktbuf, d_bitbuf, d_bbi);
- //printf("seqno %3d\n", d_pktbuf[0]);
- memcpy(out, &d_pktbuf[GRSF_PAYLOAD_OVERHEAD], d_payload_bytesize);
- enter_looking();
- consume_each(n + 1);
- return d_payload_bytesize;
- }
- }
- break;
-
- case ST_LOOKING:
- case ST_UNDER_THRESHOLD:
- update_avg(in[n]);
- decision = slice(in[n]);
-
- d_shift_reg[d_osi] = (d_shift_reg[d_osi] << 1) | decision;
- hamming_dist = gr_count_bits64(d_shift_reg[d_osi] ^ GRSF_SYNC);
- //fprintf(stderr, "%2d %d\n", hamming_dist, d_osi);
-
- if(d_state == ST_LOOKING && hamming_dist <= THRESHOLD) {
- // We're seeing a good PN code, remember location
- enter_under_threshold();
- }
- else if(d_state == ST_UNDER_THRESHOLD && hamming_dist > THRESHOLD) {
- // no longer seeing good PN code, compute center of goodness
- enter_locked();
-#ifdef DEBUG_SIMPLE_CORRELATOR
- debug_data.enter_locked = 1.0;
-#endif
- }
- break;
- default:
- assert(0);
- }
-
-#ifdef DEBUG_SIMPLE_CORRELATOR
- fwrite(&debug_data, sizeof(debug_data), 1, d_debug_fp);
-#endif
-
- d_osi = add_index(d_osi, 1);
- n++;
- }
-
- consume_each(n);
- return 0;
-}
diff --git a/gr-digital/lib/digital_simple_framer.cc b/gr-digital/lib/digital_simple_framer.cc
deleted file mode 100644
index 5c194543ca..0000000000
--- a/gr-digital/lib/digital_simple_framer.cc
+++ /dev/null
@@ -1,102 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2010,2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <digital_simple_framer.h>
-#include <digital_simple_framer_sync.h>
-#include <gr_io_signature.h>
-#include <assert.h>
-#include <stdexcept>
-#include <string.h>
-
-
-digital_simple_framer_sptr
-digital_make_simple_framer (int payload_bytesize)
-{
- return gnuradio::get_initial_sptr(new digital_simple_framer
- (payload_bytesize));
-}
-
-digital_simple_framer::digital_simple_framer (int payload_bytesize)
- : gr_block ("simple_framer",
- gr_make_io_signature (1, 1, sizeof (unsigned char)),
- gr_make_io_signature (1, 1, sizeof (unsigned char))),
- d_seqno (0), d_payload_bytesize (payload_bytesize),
- d_input_block_size (payload_bytesize),
- d_output_block_size (payload_bytesize + GRSF_OVERHEAD)
-{
- set_output_multiple (d_output_block_size);
-}
-
-void
-digital_simple_framer::forecast (int noutput_items, gr_vector_int &ninput_items_required)
-{
- assert (noutput_items % d_output_block_size == 0);
-
- int nblocks = noutput_items / d_output_block_size;
- int input_required = nblocks * d_input_block_size;
-
- unsigned ninputs = ninput_items_required.size();
- for (unsigned int i = 0; i < ninputs; i++)
- ninput_items_required[i] = input_required;
-}
-
-int
-digital_simple_framer::general_work (int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- const unsigned char *in = (const unsigned char *) input_items[0];
- unsigned char *out = (unsigned char *) output_items[0];
-
- int n = 0;
- int nblocks = 0;
-
- memset (out, 0x55, noutput_items);
-
- while (n < noutput_items) {
- out[0] = (GRSF_SYNC >> 56) & 0xff;
- out[1] = (GRSF_SYNC >> 48) & 0xff;
- out[2] = (GRSF_SYNC >> 40) & 0xff;
- out[3] = (GRSF_SYNC >> 32) & 0xff;
- out[4] = (GRSF_SYNC >> 24) & 0xff;
- out[5] = (GRSF_SYNC >> 16) & 0xff;
- out[6] = (GRSF_SYNC >> 8) & 0xff;
- out[7] = (GRSF_SYNC >> 0) & 0xff;
- out[8] = d_seqno++;
-
- memcpy (&out[9], in, d_input_block_size);
- in += d_input_block_size;
- out += d_output_block_size;
- n += d_output_block_size;
- nblocks++;
- }
-
- assert (n == noutput_items);
-
- consume_each (nblocks * d_input_block_size);
- return n;
-}
diff --git a/gr-digital/lib/fll_band_edge_cc_impl.cc b/gr-digital/lib/fll_band_edge_cc_impl.cc
new file mode 100644
index 0000000000..c438b813f4
--- /dev/null
+++ b/gr-digital/lib/fll_band_edge_cc_impl.cc
@@ -0,0 +1,276 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009-2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "fll_band_edge_cc_impl.h"
+#include <gr_io_signature.h>
+#include <gr_expj.h>
+#include <cstdio>
+
+namespace gr {
+ namespace digital {
+
+#define M_TWOPI (2*M_PI)
+
+ float sinc(float x)
+ {
+ if(x == 0)
+ return 1;
+ else
+ return sin(M_PI*x)/(M_PI*x);
+ }
+
+ fll_band_edge_cc::sptr
+ fll_band_edge_cc::make(float samps_per_sym, float rolloff,
+ int filter_size, float bandwidth)
+ {
+ return gnuradio::get_initial_sptr
+ (new fll_band_edge_cc_impl(samps_per_sym, rolloff,
+ filter_size, bandwidth));
+ }
+
+ static int ios[] = {sizeof(gr_complex), sizeof(float), sizeof(float), sizeof(float)};
+ static std::vector<int> iosig(ios, ios+sizeof(ios)/sizeof(int));
+ fll_band_edge_cc_impl::fll_band_edge_cc_impl(float samps_per_sym, float rolloff,
+ int filter_size, float bandwidth)
+ : gr_sync_block("fll_band_edge_cc",
+ gr_make_io_signature(1, 1, sizeof(gr_complex)),
+ gr_make_io_signaturev(1, 4, iosig)),
+ blocks::control_loop(bandwidth, M_TWOPI*(2.0/samps_per_sym),
+ -M_TWOPI*(2.0/samps_per_sym)),
+ d_updated(false)
+ {
+ // Initialize samples per symbol
+ if(samps_per_sym <= 0) {
+ throw std::out_of_range("fll_band_edge_cc: invalid number of sps. Must be > 0.");
+ }
+ d_sps = samps_per_sym;
+
+ // Initialize rolloff factor
+ if(rolloff < 0 || rolloff > 1.0) {
+ throw std::out_of_range("fll_band_edge_cc: invalid rolloff factor. Must be in [0,1].");
+ }
+ d_rolloff = rolloff;
+
+ // Initialize filter length
+ if(filter_size <= 0) {
+ throw std::out_of_range("fll_band_edge_cc: invalid filter size. Must be > 0.");
+ }
+ d_filter_size = filter_size;
+
+ // Build the band edge filters
+ design_filter(d_sps, d_rolloff, d_filter_size);
+ d_output_hist.resize(filter_size,0);
+ }
+
+ fll_band_edge_cc_impl::~fll_band_edge_cc_impl()
+ {
+ }
+
+ /*******************************************************************
+ SET FUNCTIONS
+ *******************************************************************/
+
+ void
+ fll_band_edge_cc_impl::set_samples_per_symbol(float sps)
+ {
+ if(sps <= 0) {
+ throw std::out_of_range("fll_band_edge_cc: invalid number of sps. Must be > 0.");
+ }
+ d_sps = sps;
+ design_filter(d_sps, d_rolloff, d_filter_size);
+ }
+
+ void
+ fll_band_edge_cc_impl::set_rolloff(float rolloff)
+ {
+ if(rolloff < 0 || rolloff > 1.0) {
+ throw std::out_of_range("fll_band_edge_cc: invalid rolloff factor. Must be in [0,1].");
+ }
+ d_rolloff = rolloff;
+ design_filter(d_sps, d_rolloff, d_filter_size);
+ }
+
+ void
+ fll_band_edge_cc_impl::set_filter_size(int filter_size)
+ {
+ if(filter_size <= 0) {
+ throw std::out_of_range("fll_band_edge_cc: invalid filter size. Must be > 0.");
+ }
+ d_filter_size = filter_size;
+ design_filter(d_sps, d_rolloff, d_filter_size);
+ }
+
+ /*******************************************************************
+ GET FUNCTIONS
+ *******************************************************************/
+
+ float
+ fll_band_edge_cc_impl::samples_per_symbol() const
+ {
+ return d_sps;
+ }
+
+ float
+ fll_band_edge_cc_impl::rolloff() const
+ {
+ return d_rolloff;
+ }
+
+ int
+ fll_band_edge_cc_impl::filter_size() const
+ {
+ return d_filter_size;
+ }
+
+ /*******************************************************************
+ *******************************************************************/
+
+ void
+ fll_band_edge_cc_impl::design_filter(float samps_per_sym,
+ float rolloff, int filter_size)
+ {
+ int M = rint(filter_size / samps_per_sym);
+ float power = 0;
+
+ // Create the baseband filter by adding two sincs together
+ std::vector<float> bb_taps;
+ for(int i = 0; i < filter_size; i++) {
+ float k = -M + i*2.0/samps_per_sym;
+ float tap = sinc(rolloff*k - 0.5) + sinc(rolloff*k + 0.5);
+ power += tap;
+
+ bb_taps.push_back(tap);
+ }
+
+ d_taps_lower.resize(filter_size);
+ d_taps_upper.resize(filter_size);
+
+ // Create the band edge filters by spinning the baseband
+ // filter up and down to the right places in frequency.
+ // Also, normalize the power in the filters
+ int N = (bb_taps.size() - 1.0)/2.0;
+ for(int i = 0; i < filter_size; i++) {
+ float tap = bb_taps[i] / power;
+
+ float k = (-N + (int)i)/(2.0*samps_per_sym);
+
+ gr_complex t1 = tap * gr_expj(-M_TWOPI*(1+rolloff)*k);
+ gr_complex t2 = tap * gr_expj(M_TWOPI*(1+rolloff)*k);
+
+ d_taps_lower[filter_size-i-1] = t1;
+ d_taps_upper[filter_size-i-1] = t2;
+ }
+
+ d_updated = true;
+
+ // Set the history to ensure enough input items for each filter
+ set_history(filter_size+1);
+ d_filter_upper = new gr::filter::kernel::fir_filter_ccc(1, d_taps_upper);
+ d_filter_lower = new gr::filter::kernel::fir_filter_ccc(1, d_taps_lower);
+ }
+
+ void
+ fll_band_edge_cc_impl::print_taps()
+ {
+ unsigned int i;
+
+ printf("Upper Band-edge: [");
+ for(i = 0; i < d_taps_upper.size(); i++) {
+ printf(" %.4e + %.4ej,", d_taps_upper[i].real(), d_taps_upper[i].imag());
+ }
+ printf("]\n\n");
+
+ printf("Lower Band-edge: [");
+ for(i = 0; i < d_taps_lower.size(); i++) {
+ printf(" %.4e + %.4ej,", d_taps_lower[i].real(), d_taps_lower[i].imag());
+ }
+ printf("]\n\n");
+ }
+
+ int
+ fll_band_edge_cc_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const gr_complex *in = (const gr_complex*)input_items[0];
+ gr_complex *out = (gr_complex*)output_items[0];
+
+ d_fllbuffer.reserve(d_filter_size+noutput_items);
+
+ float *frq = NULL;
+ float *phs = NULL;
+ float *err = NULL;
+ if(output_items.size() == 4) {
+ frq = (float*)output_items[1];
+ phs = (float*)output_items[2];
+ err = (float*)output_items[3];
+ }
+
+ if(d_updated) {
+ d_updated = false;
+ return 0; // history requirements may have changed.
+ }
+
+ int i;
+ float error;
+ gr_complex nco_out;
+ gr_complex out_upper, out_lower;
+ gr_complex out_uppersse, out_lowersse;
+ copy(d_output_hist.begin(), d_output_hist.end(), d_fllbuffer.begin());
+
+ for(i = 0; i < noutput_items; i++) {
+ nco_out = gr_expj(d_phase);
+ d_fllbuffer[i+d_filter_size] = in[i] * nco_out;
+ // Perform the dot product of the output with the filters
+ out_upper = 0;
+ out_lower = 0;
+
+ out_upper = d_filter_lower->filter(&d_fllbuffer[i]);
+ out_lower = d_filter_upper->filter(&d_fllbuffer[i]);
+
+ error = norm(out_lower) - norm(out_upper);
+
+ advance_loop(error);
+ phase_wrap();
+ frequency_limit();
+
+ if(output_items.size() == 4) {
+ frq[i] = d_freq;
+ phs[i] = d_phase;
+ err[i] = error;
+ }
+ }
+
+ copy(d_fllbuffer.begin(), d_fllbuffer.begin()+noutput_items, out);
+ copy(d_fllbuffer.begin()+noutput_items,
+ d_fllbuffer.begin()+noutput_items+d_filter_size,
+ d_output_hist.begin());
+
+ return noutput_items;
+ }
+
+ } /* namespace digital */
+} /* namespace gr */
diff --git a/gr-digital/lib/fll_band_edge_cc_impl.h b/gr-digital/lib/fll_band_edge_cc_impl.h
new file mode 100644
index 0000000000..9eb3e6e7ae
--- /dev/null
+++ b/gr-digital/lib/fll_band_edge_cc_impl.h
@@ -0,0 +1,82 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009,2011,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_DIGITAL_FLL_BAND_EDGE_CC_IMPL_H
+#define INCLUDED_DIGITAL_FLL_BAND_EDGE_CC_IMPL_H
+
+#include <digital/fll_band_edge_cc.h>
+#include <blocks/control_loop.h>
+#include <filter/fir_filter.h>
+
+namespace gr {
+ namespace digital {
+
+ class fll_band_edge_cc_impl :
+ public fll_band_edge_cc
+ {
+ private:
+ float d_sps;
+ float d_rolloff;
+ int d_filter_size;
+
+ std::vector<gr_complex> d_taps_lower;
+ std::vector<gr_complex> d_taps_upper;
+ bool d_updated;
+ std::vector<gr_complex> d_output_hist;
+ std::vector<gr_complex> d_fllbuffer;
+ gr::filter::kernel::fir_filter_ccc* d_filter_lower;
+ gr::filter::kernel::fir_filter_ccc* d_filter_upper;
+
+ /*!
+ * Design the band-edge filter based on the number of samples
+ * per symbol, filter rolloff factor, and the filter size
+ *
+ * \param samps_per_sym (float) Number of samples per symbol of signal
+ * \param rolloff (float) Rolloff factor of signal
+ * \param filter_size (int) Size (in taps) of the filter
+ */
+ void design_filter(float samps_per_sym, float rolloff, int filter_size);
+
+ public:
+ fll_band_edge_cc_impl(float samps_per_sym, float rolloff,
+ int filter_size, float bandwidth);
+ ~fll_band_edge_cc_impl();
+
+ void set_samples_per_symbol(float sps);
+ void set_rolloff(float rolloff);
+ void set_filter_size(int filter_size);
+
+ float samples_per_symbol() const;
+ float rolloff() const;
+ int filter_size() const;
+
+ void print_taps();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_DIGITAL_FLL_BAND_EDGE_CC_IMPL_H */
diff --git a/gr-digital/lib/framer_sink_1_impl.cc b/gr-digital/lib/framer_sink_1_impl.cc
new file mode 100644
index 0000000000..1dda5ca50c
--- /dev/null
+++ b/gr-digital/lib/framer_sink_1_impl.cc
@@ -0,0 +1,195 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2006,2010,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "framer_sink_1_impl.h"
+#include <gr_io_signature.h>
+#include <cstdio>
+#include <string>
+
+namespace gr {
+ namespace digital {
+
+#define VERBOSE 0
+
+ inline void
+ framer_sink_1_impl::enter_search()
+ {
+ if(VERBOSE)
+ fprintf(stderr, "@ enter_search\n");
+
+ d_state = STATE_SYNC_SEARCH;
+ }
+
+ inline void
+ framer_sink_1_impl::enter_have_sync()
+ {
+ if (VERBOSE)
+ fprintf(stderr, "@ enter_have_sync\n");
+
+ d_state = STATE_HAVE_SYNC;
+ d_header = 0;
+ d_headerbitlen_cnt = 0;
+ }
+
+ inline void
+ framer_sink_1_impl::enter_have_header(int payload_len,
+ int whitener_offset)
+ {
+ if(VERBOSE)
+ fprintf(stderr, "@ enter_have_header (payload_len = %d) (offset = %d)\n",
+ payload_len, whitener_offset);
+
+ d_state = STATE_HAVE_HEADER;
+ d_packetlen = payload_len;
+ d_packet_whitener_offset = whitener_offset;
+ d_packetlen_cnt = 0;
+ d_packet_byte = 0;
+ d_packet_byte_index = 0;
+ }
+
+ framer_sink_1::sptr
+ framer_sink_1::make(gr_msg_queue_sptr target_queue)
+ {
+ return gnuradio::get_initial_sptr
+ (new framer_sink_1_impl(target_queue));
+ }
+
+ framer_sink_1_impl::framer_sink_1_impl(gr_msg_queue_sptr target_queue)
+ : gr_sync_block("framer_sink_1",
+ gr_make_io_signature(1, 1, sizeof(unsigned char)),
+ gr_make_io_signature(0, 0, 0)),
+ d_target_queue(target_queue)
+ {
+ enter_search();
+ }
+
+ framer_sink_1_impl::~framer_sink_1_impl()
+ {
+ }
+
+ int
+ framer_sink_1_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const unsigned char *in = (const unsigned char *) input_items[0];
+ int count=0;
+
+ if(VERBOSE)
+ fprintf(stderr,">>> Entering state machine\n");
+
+ while(count < noutput_items){
+ switch(d_state) {
+
+ case STATE_SYNC_SEARCH: // Look for flag indicating beginning of pkt
+ if(VERBOSE)
+ fprintf(stderr,"SYNC Search, noutput=%d\n", noutput_items);
+
+ while(count < noutput_items) {
+ if(in[count] & 0x2){ // Found it, set up for header decode
+ enter_have_sync();
+ break;
+ }
+ count++;
+ }
+ break;
+
+ case STATE_HAVE_SYNC:
+ if(VERBOSE)
+ fprintf(stderr,"Header Search bitcnt=%d, header=0x%08x\n",
+ d_headerbitlen_cnt, d_header);
+
+ while(count < noutput_items) { // Shift bits one at a time into header
+ d_header = (d_header << 1) | (in[count++] & 0x1);
+ if(++d_headerbitlen_cnt == HEADERBITLEN) {
+
+ if(VERBOSE)
+ fprintf(stderr, "got header: 0x%08x\n", d_header);
+
+ // we have a full header, check to see if it has been received properly
+ if(header_ok()) {
+ int payload_len;
+ int whitener_offset;
+ header_payload(&payload_len, &whitener_offset);
+ enter_have_header(payload_len, whitener_offset);
+
+ if(d_packetlen == 0) { // check for zero-length payload
+ // build a zero-length message
+ // NOTE: passing header field as arg1 is not scalable
+ gr_message_sptr msg =
+ gr_make_message(0, d_packet_whitener_offset, 0, 0);
+
+ d_target_queue->insert_tail(msg); // send it
+ msg.reset(); // free it up
+
+ enter_search();
+ }
+ }
+ else
+ enter_search(); // bad header
+ break; // we're in a new state
+ }
+ }
+ break;
+
+ case STATE_HAVE_HEADER:
+ if(VERBOSE)
+ fprintf(stderr,"Packet Build\n");
+
+ while(count < noutput_items) { // shift bits into bytes of packet one at a time
+ d_packet_byte = (d_packet_byte << 1) | (in[count++] & 0x1);
+ if(d_packet_byte_index++ == 7) { // byte is full so move to next byte
+ d_packet[d_packetlen_cnt++] = d_packet_byte;
+ d_packet_byte_index = 0;
+
+ if(d_packetlen_cnt == d_packetlen) { // packet is filled
+ // build a message
+ // NOTE: passing header field as arg1 is not scalable
+ gr_message_sptr msg =
+ gr_make_message(0, d_packet_whitener_offset, 0, d_packetlen_cnt);
+ memcpy(msg->msg(), d_packet, d_packetlen_cnt);
+
+ d_target_queue->insert_tail(msg); // send it
+ msg.reset(); // free it up
+
+ enter_search();
+ break;
+ }
+ }
+ }
+ break;
+
+ default:
+ assert(0);
+ } // switch
+
+ } // while
+
+ return noutput_items;
+ }
+
+ } /* namespace digital */
+} /* namespace gr */
diff --git a/gr-digital/lib/framer_sink_1_impl.h b/gr-digital/lib/framer_sink_1_impl.h
new file mode 100644
index 0000000000..ff2839acbf
--- /dev/null
+++ b/gr-digital/lib/framer_sink_1_impl.h
@@ -0,0 +1,83 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,2006,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_FRAMER_SINK_1_IMPL_H
+#define INCLUDED_GR_FRAMER_SINK_1_IMPL_H
+
+#include <digital/framer_sink_1.h>
+
+namespace gr {
+ namespace digital {
+
+ class framer_sink_1_impl : public framer_sink_1
+ {
+ private:
+ enum state_t {STATE_SYNC_SEARCH, STATE_HAVE_SYNC, STATE_HAVE_HEADER};
+
+ static const int MAX_PKT_LEN = 4096;
+ static const int HEADERBITLEN = 32;
+
+ gr_msg_queue_sptr d_target_queue; // where to send the packet when received
+ state_t d_state;
+ unsigned int d_header; // header bits
+ int d_headerbitlen_cnt; // how many so far
+
+ unsigned char d_packet[MAX_PKT_LEN]; // assembled payload
+ unsigned char d_packet_byte; // byte being assembled
+ int d_packet_byte_index; // which bit of d_packet_byte we're working on
+ int d_packetlen; // length of packet
+ int d_packet_whitener_offset; // offset into whitener string to use
+ int d_packetlen_cnt; // how many so far
+
+ protected:
+ void enter_search();
+ void enter_have_sync();
+ void enter_have_header(int payload_len, int whitener_offset);
+
+ bool header_ok()
+ {
+ // confirm that two copies of header info are identical
+ return ((d_header >> 16) ^ (d_header & 0xffff)) == 0;
+ }
+
+ void header_payload(int *len, int *offset)
+ {
+ // header consists of two 16-bit shorts in network byte order
+ // payload length is lower 12 bits
+ // whitener offset is upper 4 bits
+ *len = (d_header >> 16) & 0x0fff;
+ *offset = (d_header >> 28) & 0x000f;
+ }
+
+ public:
+ framer_sink_1_impl(gr_msg_queue_sptr target_queue);
+ ~framer_sink_1_impl();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_FRAMER_SINK_1_IMPL_H */
diff --git a/gr-digital/lib/glfsr.cc b/gr-digital/lib/glfsr.cc
new file mode 100644
index 0000000000..5c9d22af88
--- /dev/null
+++ b/gr-digital/lib/glfsr.cc
@@ -0,0 +1,77 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <digital/glfsr.h>
+#include <stdexcept>
+
+namespace gr {
+ namespace digital {
+
+ static int s_polynomial_masks[] = {
+ 0x00000000,
+ 0x00000001, // x^1 + 1
+ 0x00000003, // x^2 + x^1 + 1
+ 0x00000005, // x^3 + x^1 + 1
+ 0x00000009, // x^4 + x^1 + 1
+ 0x00000012, // x^5 + x^2 + 1
+ 0x00000021, // x^6 + x^1 + 1
+ 0x00000041, // x^7 + x^1 + 1
+ 0x0000008E, // x^8 + x^4 + x^3 + x^2 + 1
+ 0x00000108, // x^9 + x^4 + 1
+ 0x00000204, // x^10 + x^4 + 1
+ 0x00000402, // x^11 + x^2 + 1
+ 0x00000829, // x^12 + x^6 + x^4 + x^1 + 1
+ 0x0000100D, // x^13 + x^4 + x^3 + x^1 + 1
+ 0x00002015, // x^14 + x^5 + x^3 + x^1 + 1
+ 0x00004001, // x^15 + x^1 + 1
+ 0x00008016, // x^16 + x^5 + x^3 + x^2 + 1
+ 0x00010004, // x^17 + x^3 + 1
+ 0x00020013, // x^18 + x^5 + x^2 + x^1 + 1
+ 0x00040013, // x^19 + x^5 + x^2 + x^1 + 1
+ 0x00080004, // x^20 + x^3 + 1
+ 0x00100002, // x^21 + x^2 + 1
+ 0x00200001, // x^22 + x^1 + 1
+ 0x00400010, // x^23 + x^5 + 1
+ 0x0080000D, // x^24 + x^4 + x^3 + x^1 + 1
+ 0x01000004, // x^25 + x^3 + 1
+ 0x02000023, // x^26 + x^6 + x^2 + x^1 + 1
+ 0x04000013, // x^27 + x^5 + x^2 + x^1 + 1
+ 0x08000004, // x^28 + x^3 + 1
+ 0x10000002, // x^29 + x^2 + 1
+ 0x20000029, // x^30 + x^4 + x^1 + 1
+ 0x40000004, // x^31 + x^3 + 1
+ 0x80000057 // x^32 + x^7 + x^5 + x^3 + x^2 + x^1 + 1
+ };
+
+ glfsr::~glfsr()
+ {
+ }
+
+ int glfsr::glfsr_mask(int degree)
+ {
+ if(degree < 1 || degree > 32)
+ throw std::runtime_error("glfsr::glfsr_mask(): degree must be between 1 and 32 inclusive");
+ return s_polynomial_masks[degree];
+ }
+
+ } /* namespace digital */
+} /* namespace gr */
diff --git a/gr-digital/lib/glfsr_source_b_impl.cc b/gr-digital/lib/glfsr_source_b_impl.cc
new file mode 100644
index 0000000000..e4171d80e7
--- /dev/null
+++ b/gr-digital/lib/glfsr_source_b_impl.cc
@@ -0,0 +1,89 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,2010,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "glfsr_source_b_impl.h"
+#include <gr_io_signature.h>
+#include <stdexcept>
+
+namespace gr {
+ namespace digital {
+
+ glfsr_source_b::sptr
+ glfsr_source_b::make(int degree, bool repeat, int mask, int seed)
+ {
+ return gnuradio::get_initial_sptr
+ (new glfsr_source_b_impl(degree, repeat, mask, seed));
+ }
+
+ glfsr_source_b_impl::glfsr_source_b_impl(int degree, bool repeat,
+ int mask, int seed)
+ : gr_sync_block("glfsr_source_b",
+ gr_make_io_signature(0, 0, 0),
+ gr_make_io_signature(1, 1, sizeof(unsigned char))),
+ d_repeat(repeat), d_index(0)
+ {
+ if(degree < 1 || degree > 32)
+ throw std::runtime_error("glfsr_source_b_impl: degree must be between 1 and 32 inclusive");
+ d_length = (unsigned int)((1ULL << degree)-1);
+
+ if(mask == 0)
+ mask = glfsr::glfsr_mask(degree);
+ d_glfsr = new glfsr(mask, seed);
+ }
+
+ glfsr_source_b_impl::~glfsr_source_b_impl()
+ {
+ delete d_glfsr;
+ }
+
+ int
+ glfsr_source_b_impl::mask() const
+ {
+ return d_glfsr->mask();
+ }
+
+ int
+ glfsr_source_b_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ char *out = (char*)output_items[0];
+ if((d_index > d_length) && d_repeat == false)
+ return -1; /* once through the sequence */
+
+ int i;
+ for(i = 0; i < noutput_items; i++) {
+ out[i] = d_glfsr->next_bit();
+ d_index++;
+ if(d_index > d_length && d_repeat == false)
+ break;
+ }
+
+ return i;
+ }
+
+ } /* namespace digital */
+} /* namespace gr */
diff --git a/gr-digital/swig/digital_pn_correlator_cc.i b/gr-digital/lib/glfsr_source_b_impl.h
index 11ccf12c2f..f52cfa0f20 100644
--- a/gr-digital/swig/digital_pn_correlator_cc.i
+++ b/gr-digital/lib/glfsr_source_b_impl.h
@@ -20,13 +20,38 @@
* Boston, MA 02110-1301, USA.
*/
-GR_SWIG_BLOCK_MAGIC(digital,pn_correlator_cc)
+#ifndef INCLUDED_GR_GLFSR_SOURCE_B_IMPL_H
+#define INCLUDED_GR_GLFSR_SOURCE_B_IMPL_H
-digital_pn_correlator_cc_sptr
-digital_make_pn_correlator_cc(int degree, int mask=0, int seed=1);
+#include <digital/glfsr_source_b.h>
+#include <digital/glfsr.h>
-class digital_pn_correlator_cc : public gr_sync_decimator
-{
- protected:
- digital_pn_correlator_cc();
-};
+namespace gr {
+ namespace digital {
+
+ class glfsr_source_b_impl : public glfsr_source_b
+ {
+ private:
+ glfsr *d_glfsr;
+
+ bool d_repeat;
+ unsigned int d_index;
+ unsigned int d_length;
+
+ public:
+ glfsr_source_b_impl(int degree, bool repeat=true,
+ int mask=0, int seed=1);
+ ~glfsr_source_b_impl();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ unsigned int period() const { return d_length; }
+ int mask() const;
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_GLFSR_SOURCE_B_IMPL_H */
diff --git a/gr-digital/lib/glfsr_source_f_impl.cc b/gr-digital/lib/glfsr_source_f_impl.cc
new file mode 100644
index 0000000000..1e0ee2d85e
--- /dev/null
+++ b/gr-digital/lib/glfsr_source_f_impl.cc
@@ -0,0 +1,90 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,2010,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "glfsr_source_f_impl.h"
+#include <gr_io_signature.h>
+#include <stdexcept>
+
+namespace gr {
+ namespace digital {
+
+ glfsr_source_f::sptr
+ glfsr_source_f::make(int degree, bool repeat, int mask, int seed)
+ {
+ return gnuradio::get_initial_sptr
+ (new glfsr_source_f_impl(degree, repeat, mask, seed));
+ }
+
+ glfsr_source_f_impl::glfsr_source_f_impl(int degree, bool repeat,
+ int mask, int seed)
+ : gr_sync_block("glfsr_source_f",
+ gr_make_io_signature(0, 0, 0),
+ gr_make_io_signature(1, 1, sizeof(float))),
+ d_repeat(repeat), d_index(0)
+ {
+ if(degree < 1 || degree > 32)
+ throw std::runtime_error("glfsr_source_f_impl: degree must be between 1 and 32 inclusive");
+ d_length = (unsigned int)((1ULL << degree)-1);
+
+ if(mask == 0)
+ mask = glfsr::glfsr_mask(degree);
+ d_glfsr = new glfsr(mask, seed);
+ }
+
+ glfsr_source_f_impl::~glfsr_source_f_impl()
+ {
+ delete d_glfsr;
+ }
+
+ int
+ glfsr_source_f_impl::mask() const
+ {
+ return d_glfsr->mask();
+ }
+
+ int
+ glfsr_source_f_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ float *out = (float *) output_items[0];
+ if((d_index > d_length) && d_repeat == false)
+ return -1; /* once through the sequence */
+
+ int i;
+ for(i = 0; i < noutput_items; i++) {
+ out[i] = (float)d_glfsr->next_bit()*2.0-1.0;
+ d_index++;
+ if(d_index > d_length && d_repeat == false)
+ break;
+ }
+
+ return i;
+ }
+
+ } /* namespace digital */
+} /* namespace gr */
diff --git a/gr-digital/include/digital_impl_glfsr.h b/gr-digital/lib/glfsr_source_f_impl.h
index 3aadf7cf2f..4168016097 100644
--- a/gr-digital/include/digital_impl_glfsr.h
+++ b/gr-digital/lib/glfsr_source_f_impl.h
@@ -20,38 +20,38 @@
* Boston, MA 02110-1301, USA.
*/
-#ifndef INCLUDED_DIGITAL_IMPL_GLFSR_H
-#define INCLUDED_DIGITAL_IMPL_GLFSR_H
+#ifndef INCLUDED_GR_GLFSR_SOURCE_F_IMPL_H
+#define INCLUDED_GR_GLFSR_SOURCE_F_IMPL_H
-#include <digital_api.h>
+#include <digital/glfsr_source_f.h>
+#include <digital/glfsr.h>
-/*!
- * \brief Galois Linear Feedback Shift Register using specified polynomial mask
- * \ingroup misc
- *
- * Generates a maximal length pseudo-random sequence of length 2^degree-1
- */
+namespace gr {
+ namespace digital {
+
+ class glfsr_source_f_impl : public glfsr_source_f
+ {
+ private:
+ glfsr *d_glfsr;
-class DIGITAL_API digital_impl_glfsr
-{
- private:
- int d_shift_register;
- int d_mask;
+ bool d_repeat;
+ unsigned int d_index;
+ unsigned int d_length;
- public:
+ public:
+ glfsr_source_f_impl(int degree, bool repeat=true,
+ int mask=0, int seed=1);
+ ~glfsr_source_f_impl();
- digital_impl_glfsr(int mask, int seed) { d_shift_register = seed; d_mask = mask; }
- static int glfsr_mask(int degree);
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
- unsigned char next_bit() {
- unsigned char bit = d_shift_register & 1;
- d_shift_register >>= 1;
- if (bit)
- d_shift_register ^= d_mask;
- return bit;
- }
+ unsigned int period() const { return d_length; }
+ int mask() const;
+ };
- int mask() const { return d_mask; }
-};
+ } /* namespace digital */
+} /* namespace gr */
-#endif /* INCLUDED_DIGITAL_IMPL_GLFSR_H */
+#endif /* INCLUDED_GR_GLFSR_SOURCE_F_IMPL_H */
diff --git a/gr-digital/lib/header_payload_demux_impl.cc b/gr-digital/lib/header_payload_demux_impl.cc
index f79678e903..a2e81c5b8e 100644
--- a/gr-digital/lib/header_payload_demux_impl.cc
+++ b/gr-digital/lib/header_payload_demux_impl.cc
@@ -76,8 +76,8 @@ namespace gr {
d_header_len(header_len),
d_items_per_symbol(items_per_symbol),
d_gi(guard_interval),
- d_len_tag_key(pmt::pmt_string_to_symbol(length_tag_key)),
- d_trigger_tag_key(pmt::pmt_string_to_symbol(trigger_tag_key)),
+ d_len_tag_key(pmt::string_to_symbol(length_tag_key)),
+ d_trigger_tag_key(pmt::string_to_symbol(trigger_tag_key)),
d_output_symbols(output_symbols),
d_itemsize(itemsize),
d_uses_trigger_tag(!trigger_tag_key.empty()),
@@ -223,23 +223,23 @@ namespace gr {
header_payload_demux_impl::parse_header_data_msg()
{
pmt::pmt_t msg(delete_head_blocking(msg_port_id));
- if (pmt::pmt_is_integer(msg)) {
- d_remaining_symbols = pmt::pmt_to_long(msg);
+ if (pmt::is_integer(msg)) {
+ d_remaining_symbols = pmt::to_long(msg);
add_item_tag(1, nitems_written(1), d_len_tag_key, msg);
- } else if (pmt::pmt_is_dict(msg)) {
- pmt::pmt_t dict_items(pmt::pmt_dict_items(msg));
- while (!pmt::pmt_is_null(dict_items)) {
- pmt::pmt_t this_item(pmt::pmt_car(dict_items));
- add_item_tag(1, nitems_written(1), pmt::pmt_car(this_item), pmt::pmt_cdr(this_item));
- if (pmt::pmt_equal(pmt::pmt_car(this_item), d_len_tag_key)) {
- d_remaining_symbols = pmt::pmt_to_long(pmt::pmt_cdr(this_item));
+ } else if (pmt::is_dict(msg)) {
+ pmt::pmt_t dict_items(pmt::dict_items(msg));
+ while (!pmt::is_null(dict_items)) {
+ pmt::pmt_t this_item(pmt::car(dict_items));
+ add_item_tag(1, nitems_written(1), pmt::car(this_item), pmt::cdr(this_item));
+ if (pmt::equal(pmt::car(this_item), d_len_tag_key)) {
+ d_remaining_symbols = pmt::to_long(pmt::cdr(this_item));
}
- dict_items = pmt::pmt_cdr(dict_items);
+ dict_items = pmt::cdr(dict_items);
}
if (d_remaining_symbols == -1) {
throw std::runtime_error("no length tag passed from header data");
}
- } else if (pmt::pmt_is_null(msg)) { // Blocking call was interrupted
+ } else if (pmt::is_null(msg)) { // Blocking call was interrupted
return false;
} else {
throw std::runtime_error("Received illegal header data");
diff --git a/gr-digital/lib/kurtotic_equalizer_cc_impl.cc b/gr-digital/lib/kurtotic_equalizer_cc_impl.cc
new file mode 100644
index 0000000000..c3be3b5d06
--- /dev/null
+++ b/gr-digital/lib/kurtotic_equalizer_cc_impl.cc
@@ -0,0 +1,97 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "kurtotic_equalizer_cc_impl.h"
+#include <gr_io_signature.h>
+#include <volk/volk.h>
+
+namespace gr {
+ namespace digital {
+
+ kurtotic_equalizer_cc::sptr
+ kurtotic_equalizer_cc::make(int num_taps, float mu)
+ {
+ return gnuradio::get_initial_sptr
+ (new kurtotic_equalizer_cc_impl(num_taps, mu));
+ }
+
+ kurtotic_equalizer_cc_impl::kurtotic_equalizer_cc_impl(int num_taps, float mu)
+ : gr_sync_decimator("kurtotic_equalizer_cc",
+ gr_make_io_signature(1, 1, sizeof(gr_complex)),
+ gr_make_io_signature(1, 1, sizeof(gr_complex)),
+ 1),
+ filter::kernel::fir_filter_ccc(1, std::vector<gr_complex>(num_taps, gr_complex(0,0)))
+ {
+ set_gain(mu);
+ if(num_taps > 0)
+ d_taps[0] = 1.0;
+ set_taps(d_taps);
+
+ d_alpha_p = 0.01;
+ d_alpha_q = 0.01;
+ d_alpha_m = 0.01;
+
+ d_p = 0.0f;
+ d_m = 0.0f;
+ d_q = gr_complex(0,0);
+ d_u = gr_complex(0,0);
+
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(gr_complex);
+ set_alignment(std::max(1,alignment_multiple));
+ set_history(num_taps+1);
+ }
+
+ kurtotic_equalizer_cc_impl::~kurtotic_equalizer_cc_impl()
+ {
+ }
+
+ int
+ kurtotic_equalizer_cc_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ gr_complex *in = (gr_complex *)input_items[0];
+ gr_complex *out = (gr_complex *)output_items[0];
+
+ int j = 0, k, l = d_taps.size();
+ for(int i = 0; i < noutput_items; i++) {
+ out[i] = filter(&in[j]);
+
+ // Adjust taps
+ d_error = error(out[i]);
+ for(k = 0; k < l; k++) {
+ update_tap(d_taps[l-k-1], in[j+k]);
+ }
+
+ j += decimation();
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace digital */
+} /* namespace gr */
diff --git a/gr-digital/lib/kurtotic_equalizer_cc_impl.h b/gr-digital/lib/kurtotic_equalizer_cc_impl.h
new file mode 100644
index 0000000000..0f2ff23808
--- /dev/null
+++ b/gr-digital/lib/kurtotic_equalizer_cc_impl.h
@@ -0,0 +1,108 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_DIGITAL_KURTOTIC_EQUALIZER_CC_IMPL_H
+#define INCLUDED_DIGITAL_KURTOTIC_EQUALIZER_CC_IMPL_H
+
+#include <digital/kurtotic_equalizer_cc.h>
+#include <filter/fir_filter.h>
+#include <gr_math.h>
+#include <stdexcept>
+
+namespace gr {
+ namespace digital {
+
+ class kurtotic_equalizer_cc_impl
+ : public kurtotic_equalizer_cc, filter::kernel::fir_filter_ccc
+ {
+ private:
+ std::vector<gr_complex> d_new_taps;
+ bool d_updated;
+ gr_complex d_error;
+
+ float d_mu;
+ float d_p, d_m;
+ gr_complex d_q, d_u;
+ float d_alpha_p, d_alpha_q, d_alpha_m;
+
+ gr_complex sign(gr_complex x)
+ {
+ float re = (float)(x.real() >= 0.0f);
+ float im = (float)(x.imag() >= 0.0f);
+ return gr_complex(re, im);
+ }
+
+ protected:
+ virtual gr_complex error(const gr_complex &out)
+ {
+ // p = E[|z|^2]
+ // q = E[z^2]
+ // m = E[|z|^4]
+ // u = E[kurtosis(z)]
+
+ float nrm = norm(out);
+ gr_complex cnj = conj(out);
+ float epsilon_f = 1e-12;
+ gr_complex epsilon_c = gr_complex(1e-12, 1e-12);
+
+ d_p = (1-d_alpha_p)*d_p + (d_alpha_p)*nrm + epsilon_f;
+ d_q = (1-d_alpha_q)*d_q + (d_alpha_q)*out*out + epsilon_c;
+ d_m = (1-d_alpha_m)*d_m + (d_alpha_m)*nrm*nrm + epsilon_f;
+ d_u = d_m - 2.0f*(d_p*d_p) - d_q*d_q;
+
+ gr_complex F = (1.0f / (d_p*d_p*d_p)) *
+ (sign(d_u) * (nrm*cnj - 2.0f*d_p*cnj - conj(d_q)*out) -
+ abs(d_u)*cnj);
+
+ float re = gr_clip(F.real(), 1.0);
+ float im = gr_clip(F.imag(), 1.0);
+ return gr_complex(re, im);
+ }
+
+ virtual void update_tap(gr_complex &tap, const gr_complex &in)
+ {
+ tap += d_mu*in*d_error;
+ }
+
+ public:
+ kurtotic_equalizer_cc_impl(int num_taps, float mu);
+ ~kurtotic_equalizer_cc_impl();
+
+ float gain() const { return d_mu; }
+
+ void set_gain(float mu)
+ {
+ if(mu < 0)
+ throw std::out_of_range("kurtotic_equalizer_cc_impl::set_gain: Gain value must be >= 0");
+ d_mu = mu;
+ }
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_DIGITAL_KURTOTIC_EQUALIZER_CC_IMPL_H */
+
diff --git a/gr-digital/lib/lms_dd_equalizer_cc_impl.cc b/gr-digital/lib/lms_dd_equalizer_cc_impl.cc
new file mode 100644
index 0000000000..15008ca8e7
--- /dev/null
+++ b/gr-digital/lib/lms_dd_equalizer_cc_impl.cc
@@ -0,0 +1,137 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "lms_dd_equalizer_cc_impl.h"
+#include <gr_io_signature.h>
+#include <gr_misc.h>
+#include <volk/volk.h>
+
+namespace gr {
+ namespace digital {
+
+ using namespace filter::kernel;
+
+ lms_dd_equalizer_cc::sptr
+ lms_dd_equalizer_cc::make(int num_taps, float mu, int sps,
+ constellation_sptr cnst)
+ {
+ return gnuradio::get_initial_sptr
+ (new lms_dd_equalizer_cc_impl(num_taps, mu, sps, cnst));
+ }
+
+ lms_dd_equalizer_cc_impl::lms_dd_equalizer_cc_impl(int num_taps, float mu,
+ int sps,
+ constellation_sptr cnst)
+ : gr_sync_decimator("lms_dd_equalizer_cc",
+ gr_make_io_signature(1, 1, sizeof(gr_complex)),
+ gr_make_io_signature(1, 1, sizeof(gr_complex)),
+ sps),
+ fir_filter_ccc(sps, std::vector<gr_complex>(num_taps, gr_complex(0,0))),
+ d_new_taps(num_taps, gr_complex(0,0)),
+ d_updated(false), d_cnst(cnst)
+ {
+ set_gain(mu);
+ if(num_taps > 0)
+ d_new_taps[0] = 1.0;
+ fir_filter_ccc::set_taps(d_new_taps);
+
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(gr_complex);
+ set_alignment(std::max(1,alignment_multiple));
+
+ set_history(num_taps);
+ }
+
+ lms_dd_equalizer_cc_impl::~lms_dd_equalizer_cc_impl()
+ {
+ }
+
+ void
+ lms_dd_equalizer_cc_impl::set_taps(const std::vector<gr_complex> &taps)
+ {
+ d_new_taps = taps;
+ d_updated = true;
+ }
+
+ std::vector<gr_complex>
+ lms_dd_equalizer_cc_impl::taps() const
+ {
+ return d_taps;
+ }
+
+ gr_complex
+ lms_dd_equalizer_cc_impl::error(const gr_complex &out)
+ {
+ gr_complex decision, error;
+ d_cnst->map_to_points(d_cnst->decision_maker(&out), &decision);
+ error = decision - out;
+ return error;
+ }
+
+ void
+ lms_dd_equalizer_cc_impl::update_tap(gr_complex &tap, const gr_complex &in)
+ {
+ tap += d_mu*conj(in)*d_error;
+ }
+
+ int
+ lms_dd_equalizer_cc_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const gr_complex *in = (const gr_complex *)input_items[0];
+ gr_complex *out = (gr_complex *)output_items[0];
+
+ if(d_updated) {
+ d_taps = d_new_taps;
+ set_history(d_taps.size());
+ d_updated = false;
+ return 0; // history requirements may have changed.
+ }
+
+ int j = 0;
+ size_t k, l = d_taps.size();
+ for(int i = 0; i < noutput_items; i++) {
+ out[i] = filter(&in[j]);
+
+ // Adjust taps
+ d_error = error(out[i]);
+ for(k = 0; k < l; k++) {
+ // Update tap locally from error.
+ update_tap(d_taps[k], in[j+k]);
+
+ // Update aligned taps in filter object.
+ fir_filter_ccc::update_tap(d_taps[k], k);
+ }
+
+ j += decimation();
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace digital */
+} /* namespace gr */
diff --git a/gr-digital/lib/lms_dd_equalizer_cc_impl.h b/gr-digital/lib/lms_dd_equalizer_cc_impl.h
new file mode 100644
index 0000000000..ca6ba4d84c
--- /dev/null
+++ b/gr-digital/lib/lms_dd_equalizer_cc_impl.h
@@ -0,0 +1,80 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_DIGITAL_LMS_DD_EQUALIZER_CC_IMPL_H
+#define INCLUDED_DIGITAL_LMS_DD_EQUALIZER_CC_IMPL_H
+
+#include <digital/lms_dd_equalizer_cc.h>
+#include <filter/fir_filter.h>
+#include <stdexcept>
+
+namespace gr {
+ namespace digital {
+
+ class lms_dd_equalizer_cc_impl
+ : public lms_dd_equalizer_cc, filter::kernel::fir_filter_ccc
+ {
+ private:
+ std::vector<gr_complex> d_new_taps;
+ bool d_updated;
+ gr_complex d_error;
+
+ float d_mu;
+ constellation_sptr d_cnst;
+
+ protected:
+ gr_complex error(const gr_complex &out);
+ void update_tap(gr_complex &tap, const gr_complex &in);
+
+ public:
+ lms_dd_equalizer_cc_impl(int num_taps,
+ float mu, int sps,
+ constellation_sptr cnst);
+ ~lms_dd_equalizer_cc_impl();
+
+ void set_taps(const std::vector<gr_complex> &taps);
+ std::vector<gr_complex> taps() const;
+
+ float gain() const
+ {
+ return d_mu;
+ }
+
+ void set_gain(float mu)
+ {
+ if(mu < 0.0f || mu > 1.0f) {
+ throw std::out_of_range("lms_dd_equalizer_impl::set_mu: Gain value must in [0, 1]");
+ }
+ else {
+ d_mu = mu;
+ }
+ }
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_DIGITAL_LMS_DD_EQUALIZER_CC_IMPL_H */
diff --git a/gr-digital/lib/map_bb_impl.cc b/gr-digital/lib/map_bb_impl.cc
new file mode 100644
index 0000000000..3a06394ec4
--- /dev/null
+++ b/gr-digital/lib/map_bb_impl.cc
@@ -0,0 +1,90 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,2007,2010,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "map_bb_impl.h"
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace digital {
+
+ map_bb::sptr
+ map_bb::make(const std::vector<int> &map)
+ {
+ return gnuradio::get_initial_sptr(new map_bb_impl(map));
+ }
+
+ map_bb_impl::map_bb_impl(const std::vector<int> &map)
+ : gr_sync_block("map_bb",
+ gr_make_io_signature(1, 1, sizeof(unsigned char)),
+ gr_make_io_signature(1, 1, sizeof(unsigned char)))
+ {
+ set_map(map);
+ }
+
+ map_bb_impl::~map_bb_impl()
+ {
+ }
+
+ void
+ map_bb_impl::set_map(const std::vector<int> &map)
+ {
+ gruel::scoped_lock guard(d_mutex);
+
+ for(int i = 0; i < 0x100; i++)
+ d_map[i] = i;
+
+ unsigned int size = std::min((size_t)0x100, map.size());
+ for(unsigned int i = 0; i < size; i++)
+ d_map[i] = map[i];
+ }
+
+ std::vector<int>
+ map_bb_impl::map() const
+ {
+ std::vector<int> m;
+ for(unsigned i = 0; i < 0x100; i++)
+ m[i] = d_map[i];
+ return m;
+ }
+
+ int
+ map_bb_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ gruel::scoped_lock guard(d_mutex);
+
+ const unsigned char *in = (const unsigned char*)input_items[0];
+ unsigned char *out = (unsigned char*)output_items[0];
+
+ for(int i = 0; i < noutput_items; i++)
+ out[i] = d_map[in[i]];
+
+ return noutput_items;
+ }
+
+ } /* namespace digital */
+} /* namespace gr */
diff --git a/gr-digital/swig/digital_diff_decoder_bb.i b/gr-digital/lib/map_bb_impl.h
index f9741c771f..bce2b9b1b3 100644
--- a/gr-digital/swig/digital_diff_decoder_bb.i
+++ b/gr-digital/lib/map_bb_impl.h
@@ -20,11 +20,34 @@
* Boston, MA 02110-1301, USA.
*/
-GR_SWIG_BLOCK_MAGIC(digital,diff_decoder_bb)
+#ifndef INCLUDED_GR_MAP_BB_IMPL_H
+#define INCLUDED_GR_MAP_BB_IMPL_H
-digital_diff_decoder_bb_sptr
-digital_make_diff_decoder_bb(unsigned int modulus);
+#include <digital/map_bb.h>
+#include <gruel/thread.h>
-class digital_diff_decoder_bb : public gr_sync_block
-{
-};
+namespace gr {
+ namespace digital {
+
+ class map_bb_impl : public map_bb
+ {
+ private:
+ unsigned char d_map[0x100];
+ gruel::mutex d_mutex;
+
+ public:
+ map_bb_impl(const std::vector<int> &map);
+ ~map_bb_impl();
+
+ void set_map(const std::vector<int> &map);
+ std::vector<int> map() const;
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_MAP_BB_IMPL_H */
diff --git a/gr-digital/lib/mpsk_receiver_cc_impl.cc b/gr-digital/lib/mpsk_receiver_cc_impl.cc
new file mode 100644
index 0000000000..ea11b7cdaa
--- /dev/null
+++ b/gr-digital/lib/mpsk_receiver_cc_impl.cc
@@ -0,0 +1,331 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005-2007,2010-2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "mpsk_receiver_cc_impl.h"
+#include <gr_io_signature.h>
+#include <gr_prefs.h>
+#include <gr_math.h>
+#include <gr_expj.h>
+#include <stdexcept>
+
+namespace gr {
+ namespace digital {
+
+#define M_TWOPI (2*M_PI)
+#define VERBOSE_MM 0 // Used for debugging symbol timing loop
+#define VERBOSE_COSTAS 0 // Used for debugging phase and frequency tracking
+
+ mpsk_receiver_cc::sptr
+ mpsk_receiver_cc::make(unsigned int M, float theta,
+ float loop_bw,
+ float fmin, float fmax,
+ float mu, float gain_mu,
+ float omega, float gain_omega, float omega_rel)
+ {
+ return gnuradio::get_initial_sptr
+ (new mpsk_receiver_cc_impl(M, theta,
+ loop_bw,
+ fmin, fmax,
+ mu, gain_mu,
+ omega, gain_omega,
+ omega_rel));
+ }
+
+ mpsk_receiver_cc_impl::mpsk_receiver_cc_impl(unsigned int M, float theta,
+ float loop_bw,
+ float fmin, float fmax,
+ float mu, float gain_mu,
+ float omega, float gain_omega,
+ float omega_rel)
+ : gr_block("mpsk_receiver_cc",
+ gr_make_io_signature(1, 1, sizeof(gr_complex)),
+ gr_make_io_signature(1, 1, sizeof(gr_complex))),
+ blocks::control_loop(loop_bw, fmax, fmin),
+ d_M(M), d_theta(theta),
+ d_current_const_point(0),
+ d_mu(mu), d_gain_mu(gain_mu), d_gain_omega(gain_omega),
+ d_omega_rel(omega_rel), d_max_omega(0), d_min_omega(0),
+ d_p_2T(0), d_p_1T(0), d_p_0T(0), d_c_2T(0), d_c_1T(0), d_c_0T(0)
+ {
+ d_interp = new gr::filter::mmse_fir_interpolator_cc();
+ d_dl_idx = 0;
+
+ set_omega(omega);
+
+ if(omega <= 0.0)
+ throw std::out_of_range("clock rate must be > 0");
+ if(gain_mu < 0 || gain_omega < 0)
+ throw std::out_of_range("Gains must be non-negative");
+
+ assert(d_interp->ntaps() <= DLLEN);
+
+ // zero double length delay line.
+ for(unsigned int i = 0; i < 2 * DLLEN; i++)
+ d_dl[i] = gr_complex(0.0,0.0);
+
+ set_modulation_order(d_M);
+ }
+
+ mpsk_receiver_cc_impl::~mpsk_receiver_cc_impl()
+ {
+ delete d_interp;
+ }
+
+ void
+ mpsk_receiver_cc_impl::set_modulation_order(unsigned int M)
+ {
+ // build the constellation vector from M
+ make_constellation();
+
+ // Select a phase detector and a decision maker for the modulation order
+ switch(d_M) {
+ case 2: // optimized algorithms for BPSK
+ d_phase_error_detector = &mpsk_receiver_cc_impl::phase_error_detector_bpsk; //bpsk;
+ d_decision = &mpsk_receiver_cc_impl::decision_bpsk;
+ break;
+
+ case 4: // optimized algorithms for QPSK
+ d_phase_error_detector = &mpsk_receiver_cc_impl::phase_error_detector_qpsk; //qpsk;
+ d_decision = &mpsk_receiver_cc_impl::decision_qpsk;
+ break;
+
+ default: // generic algorithms for any M (power of 2?) but not pretty
+ d_phase_error_detector = &mpsk_receiver_cc_impl::phase_error_detector_generic;
+ d_decision = &mpsk_receiver_cc_impl::decision_generic;
+ break;
+ }
+ }
+
+ void
+ mpsk_receiver_cc_impl::set_gain_omega_rel(float omega_rel)
+ {
+ d_omega_rel = omega_rel;
+ set_omega(d_omega);
+ }
+
+ void
+ mpsk_receiver_cc_impl::forecast(int noutput_items, gr_vector_int &ninput_items_required)
+ {
+ unsigned ninputs = ninput_items_required.size();
+ for(unsigned i=0; i < ninputs; i++)
+ ninput_items_required[i] = (int) ceil((noutput_items * d_omega) + d_interp->ntaps());
+ }
+
+ // FIXME add these back in an test difference in performance
+ float
+ mpsk_receiver_cc_impl::phase_error_detector_qpsk(gr_complex sample) const
+ {
+ float phase_error = 0;
+ if(fabsf(sample.real()) > fabsf(sample.imag())) {
+ if(sample.real() > 0)
+ phase_error = -sample.imag();
+ else
+ phase_error = sample.imag();
+ }
+ else {
+ if(sample.imag() > 0)
+ phase_error = sample.real();
+ else
+ phase_error = -sample.real();
+ }
+
+ return phase_error;
+ }
+
+ float
+ mpsk_receiver_cc_impl::phase_error_detector_bpsk(gr_complex sample) const
+ {
+ return -(sample.real()*sample.imag());
+ }
+
+ float mpsk_receiver_cc_impl::phase_error_detector_generic(gr_complex sample) const
+ {
+ //return gr_fast_atan2f(sample*conj(d_constellation[d_current_const_point]));
+ return -arg(sample*conj(d_constellation[d_current_const_point]));
+ }
+
+ unsigned int
+ mpsk_receiver_cc_impl::decision_bpsk(gr_complex sample) const
+ {
+ return (gr_branchless_binary_slicer(sample.real()) ^ 1);
+ //return gr_binary_slicer(sample.real()) ^ 1;
+ }
+
+ unsigned int
+ mpsk_receiver_cc_impl::decision_qpsk(gr_complex sample) const
+ {
+ unsigned int index;
+
+ //index = gr_branchless_quad_0deg_slicer(sample);
+ index = gr_quad_0deg_slicer(sample);
+ return index;
+ }
+
+ unsigned int
+ mpsk_receiver_cc_impl::decision_generic(gr_complex sample) const
+ {
+ unsigned int min_m = 0;
+ float min_s = 65535;
+
+ // Develop all possible constellation points and find the one that minimizes
+ // the Euclidean distance (error) with the sample
+ for(unsigned int m = 0; m < d_M; m++) {
+ gr_complex diff = norm(d_constellation[m] - sample);
+
+ if(fabs(diff.real()) < min_s) {
+ min_s = fabs(diff.real());
+ min_m = m;
+ }
+ }
+ // Return the index of the constellation point that minimizes the error
+ return min_m;
+ }
+
+ void
+ mpsk_receiver_cc_impl::make_constellation()
+ {
+ for(unsigned int m = 0; m < d_M; m++) {
+ d_constellation.push_back(gr_expj((M_TWOPI/d_M)*m));
+ }
+ }
+
+ void
+ mpsk_receiver_cc_impl::mm_sampler(const gr_complex symbol)
+ {
+ gr_complex sample, nco;
+
+ d_mu--; // skip a number of symbols between sampling
+ d_phase += d_freq; // increment the phase based on the frequency of the rotation
+
+ // Keep phase clamped and not walk to infinity
+ while(d_phase > M_TWOPI)
+ d_phase -= M_TWOPI;
+ while(d_phase < -M_TWOPI)
+ d_phase += M_TWOPI;
+
+ nco = gr_expj(d_phase+d_theta); // get the NCO value for derotating the current sample
+ sample = nco*symbol; // get the downconverted symbol
+
+ // Fill up the delay line for the interpolator
+ d_dl[d_dl_idx] = sample;
+ d_dl[(d_dl_idx + DLLEN)] = sample; // put this in the second half of the buffer for overflows
+ d_dl_idx = (d_dl_idx+1) % DLLEN; // Keep the delay line index in bounds
+ }
+
+ void
+ mpsk_receiver_cc_impl::mm_error_tracking(gr_complex sample)
+ {
+ gr_complex u, x, y;
+ float mm_error = 0;
+
+ // Make sample timing corrections
+
+ // set the delayed samples
+ d_p_2T = d_p_1T;
+ d_p_1T = d_p_0T;
+ d_p_0T = sample;
+ d_c_2T = d_c_1T;
+ d_c_1T = d_c_0T;
+
+ d_current_const_point = (*this.*d_decision)(d_p_0T); // make a decision on the sample value
+ d_c_0T = d_constellation[d_current_const_point];
+
+ x = (d_c_0T - d_c_2T) * conj(d_p_1T);
+ y = (d_p_0T - d_p_2T) * conj(d_c_1T);
+ u = y - x;
+ mm_error = u.real(); // the error signal is in the real part
+ mm_error = gr_branchless_clip(mm_error, 1.0); // limit mm_val
+
+ d_omega = d_omega + d_gain_omega * mm_error; // update omega based on loop error
+ d_omega = d_omega_mid + gr_branchless_clip(d_omega-d_omega_mid, d_omega_rel); // make sure we don't walk away
+
+ d_mu += d_omega + d_gain_mu * mm_error; // update mu based on loop error
+
+#if VERBOSE_MM
+ printf("mm: mu: %f omega: %f mm_error: %f sample: %f+j%f constellation: %f+j%f\n",
+ d_mu, d_omega, mm_error, sample.real(), sample.imag(),
+ d_constellation[d_current_const_point].real(), d_constellation[d_current_const_point].imag());
+#endif
+ }
+
+
+ void
+ mpsk_receiver_cc_impl::phase_error_tracking(gr_complex sample)
+ {
+ float phase_error = 0;
+
+ // Make phase and frequency corrections based on sampled value
+ phase_error = (*this.*d_phase_error_detector)(sample);
+
+ advance_loop(phase_error);
+ phase_wrap();
+ frequency_limit();
+
+#if VERBOSE_COSTAS
+ printf("cl: phase_error: %f phase: %f freq: %f sample: %f+j%f constellation: %f+j%f\n",
+ phase_error, d_phase, d_freq, sample.real(), sample.imag(),
+ d_constellation[d_current_const_point].real(), d_constellation[d_current_const_point].imag());
+#endif
+}
+
+ int
+ mpsk_receiver_cc_impl::general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const gr_complex *in = (const gr_complex*)input_items[0];
+ gr_complex *out = (gr_complex*)output_items[0];
+
+ int i=0, o=0;
+
+ while((o < noutput_items) && (i < ninput_items[0])) {
+ while((d_mu > 1) && (i < ninput_items[0])) {
+ mm_sampler(in[i]); // puts symbols into a buffer and adjusts d_mu
+ i++;
+ }
+
+ if(i < ninput_items[0]) {
+ gr_complex interp_sample = d_interp->interpolate(&d_dl[d_dl_idx], d_mu);
+
+ mm_error_tracking(interp_sample); // corrects M&M sample time
+ phase_error_tracking(interp_sample); // corrects phase and frequency offsets
+
+ out[o++] = interp_sample;
+ }
+ }
+
+#if 0
+ printf("ninput_items: %d noutput_items: %d consuming: %d returning: %d\n",
+ ninput_items[0], noutput_items, i, o);
+#endif
+
+ consume_each(i);
+ return o;
+ }
+
+ } /* namespace digital */
+} /* namespace gr */
diff --git a/gr-digital/lib/mpsk_receiver_cc_impl.h b/gr-digital/lib/mpsk_receiver_cc_impl.h
new file mode 100644
index 0000000000..099dd424a3
--- /dev/null
+++ b/gr-digital/lib/mpsk_receiver_cc_impl.h
@@ -0,0 +1,244 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2007,2011,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_DIGITAL_MPSK_RECEIVER_CC_IMPL_H
+#define INCLUDED_DIGITAL_MPSK_RECEIVER_CC_IMPL_H
+
+#include <digital/mpsk_receiver_cc.h>
+#include <gruel/attributes.h>
+#include <blocks/control_loop.h>
+#include <gr_complex.h>
+#include <fstream>
+#include <filter/mmse_fir_interpolator_cc.h>
+
+namespace gr {
+ namespace digital {
+
+ class mpsk_receiver_cc_impl
+ : public mpsk_receiver_cc, public blocks::control_loop
+ {
+ public:
+ mpsk_receiver_cc_impl(unsigned int M, float theta,
+ float loop_bw,
+ float fmin, float fmax,
+ float mu, float gain_mu,
+ float omega, float gain_omega, float omega_rel);
+ ~mpsk_receiver_cc_impl();
+
+ void forecast(int noutput_items, gr_vector_int &ninput_items_required);
+ int general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ //! Returns the modulation order (M) currently set
+ float modulation_order() const { return d_M; }
+
+ //! Returns current value of theta
+ float theta() const { return d_theta; }
+
+ //! Returns current value of mu
+ float mu() const { return d_mu; }
+
+ //! Returns current value of omega
+ float omega() const { return d_omega; }
+
+ //! Returns mu gain factor
+ float gain_mu() const { return d_gain_mu; }
+
+ //! Returns omega gain factor
+ float gain_omega() const { return d_gain_omega; }
+
+ //! Returns the relative omega limit
+ float gain_omega_rel() const {return d_omega_rel; }
+
+ //! Sets the modulation order (M) currently
+ void set_modulation_order(unsigned int M);
+
+ //! Sets value of theta
+ void set_theta(float theta) { d_theta = theta; }
+
+ //! Sets value of mu
+ void set_mu(float mu) { d_mu = mu; }
+
+ //! Sets value of omega and its min and max values
+ void set_omega(float omega) {
+ d_omega = omega;
+ d_min_omega = omega*(1.0 - d_omega_rel);
+ d_max_omega = omega*(1.0 + d_omega_rel);
+ d_omega_mid = 0.5*(d_min_omega+d_max_omega);
+ }
+
+ //! Sets value for mu gain factor
+ void set_gain_mu(float gain_mu) { d_gain_mu = gain_mu; }
+
+ //! Sets value for omega gain factor
+ void set_gain_omega(float gain_omega) { d_gain_omega = gain_omega; }
+
+ //! Sets the relative omega limit and resets omega min/max values
+ void set_gain_omega_rel(float omega_rel);
+
+ protected:
+ void make_constellation();
+ void mm_sampler(const gr_complex symbol);
+ void mm_error_tracking(gr_complex sample);
+ void phase_error_tracking(gr_complex sample);
+
+ /*!
+ * \brief Phase error detector for MPSK modulations.
+ *
+ * \param sample the I&Q sample from which to determine the phase error
+ *
+ * This function determines the phase error for any MPSK signal
+ * by creating a set of PSK constellation points and doing a
+ * brute-force search to see which point minimizes the Euclidean
+ * distance. This point is then used to derotate the sample to
+ * the real-axis and a atan (using the fast approximation
+ * function) to determine the phase difference between the
+ * incoming sample and the real constellation point
+ *
+ * This should be cleaned up and made more efficient.
+ *
+ * \returns the approximated phase error.
+ */
+ float phase_error_detector_generic(gr_complex sample) const;
+
+ /*!
+ * \brief Phase error detector for BPSK modulation.
+ *
+ * \param sample the I&Q sample from which to determine the phase error
+ *
+ * This function determines the phase error using a simple BPSK
+ * phase error detector by multiplying the real and imaginary (the
+ * error signal) components together. As the imaginary part goes to
+ * 0, so does this error.
+ *
+ * \returns the approximated phase error.
+ */
+ float phase_error_detector_bpsk(gr_complex sample) const;
+
+ /*!
+ * \brief Phase error detector for QPSK modulation.
+ *
+ * \param sample the I&Q sample from which to determine the phase error
+ *
+ * This function determines the phase error using the limiter
+ * approach in a standard 4th order Costas loop
+ *
+ * \returns the approximated phase error.
+ */
+ float phase_error_detector_qpsk(gr_complex sample) const;
+
+ /*!
+ * \brief Decision maker for a generic MPSK constellation.
+ *
+ * \param sample the baseband I&Q sample from which to make the decision
+ *
+ * This decision maker is a generic implementation that does a
+ * brute-force search for the constellation point that minimizes
+ * the error between it and the incoming signal.
+ *
+ * \returns the index to d_constellation that minimizes the error/
+ */
+ unsigned int decision_generic(gr_complex sample) const;
+
+ /*!
+ * \brief Decision maker for BPSK constellation.
+ *
+ * \param sample the baseband I&Q sample from which to make the decision
+ *
+ * This decision maker is a simple slicer function that makes a
+ * decision on the symbol based on its placement on the real
+ * axis of greater than 0 or less than 0; the quadrature
+ * component is always 0.
+ *
+ * \returns the index to d_constellation that minimizes the error/
+ */
+ unsigned int decision_bpsk(gr_complex sample) const;
+
+ /*!
+ * \brief Decision maker for QPSK constellation.
+ *
+ * \param sample the baseband I&Q sample from which to make the decision
+ *
+ * This decision maker is a simple slicer function that makes a
+ * decision on the symbol based on its placement versus both
+ * axes and returns which quadrant the symbol is in.
+ *
+ * \returns the index to d_constellation that minimizes the error/
+ */
+ unsigned int decision_qpsk(gr_complex sample) const;
+
+ private:
+ unsigned int d_M;
+ float d_theta;
+
+ /*!
+ * \brief Decision maker function pointer
+ *
+ * \param sample the baseband I&Q sample from which to make the decision
+ *
+ * This is a function pointer that is set in the constructor to
+ * point to the proper decision function for the specified
+ * constellation order.
+ *
+ * \return index into d_constellation point that is the closest to the recieved sample
+ */
+ unsigned int (mpsk_receiver_cc_impl::*d_decision)(gr_complex sample) const;
+
+ std::vector<gr_complex> d_constellation;
+ unsigned int d_current_const_point;
+
+ // Members related to symbol timing
+ float d_mu, d_gain_mu;
+ float d_omega, d_gain_omega, d_omega_rel, d_max_omega, d_min_omega, d_omega_mid;
+ gr_complex d_p_2T, d_p_1T, d_p_0T;
+ gr_complex d_c_2T, d_c_1T, d_c_0T;
+
+ /*!
+ * \brief Phase error detector function pointer
+ *
+ * \param sample the I&Q sample from which to determine the phase error
+ *
+ * This is a function pointer that is set in the constructor to
+ * point to the proper phase error detector function for the
+ * specified constellation order.
+ */
+ float (mpsk_receiver_cc_impl::*d_phase_error_detector)(gr_complex sample) const;
+
+ //! get interpolated value
+ gr::filter::mmse_fir_interpolator_cc *d_interp;
+
+ //! delay line length.
+ static const unsigned int DLLEN = 8;
+
+ //! delay line plus some length for overflow protection
+ __GR_ATTR_ALIGNED(8) gr_complex d_dl[2*DLLEN];
+
+ //! index to delay line
+ unsigned int d_dl_idx;
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_DIGITAL_MPSK_RECEIVER_CC_IMPL_H */
diff --git a/gr-digital/lib/mpsk_snr_est.cc b/gr-digital/lib/mpsk_snr_est.cc
new file mode 100644
index 0000000000..1457a1a918
--- /dev/null
+++ b/gr-digital/lib/mpsk_snr_est.cc
@@ -0,0 +1,252 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <digital/mpsk_snr_est.h>
+#include <stdexcept>
+#include <cstdio>
+
+namespace gr {
+ namespace digital {
+
+ mpsk_snr_est::mpsk_snr_est(double alpha)
+ {
+ set_alpha(alpha);
+ }
+
+ mpsk_snr_est::~mpsk_snr_est()
+ {}
+
+ void
+ mpsk_snr_est::set_alpha(double alpha)
+ {
+ d_alpha = alpha;
+ d_beta = 1.0-alpha;
+ }
+
+ double
+ mpsk_snr_est::alpha() const
+ {
+ return d_alpha;
+ }
+
+ int
+ mpsk_snr_est::update(int noutput_items,
+ const gr_complex *input)
+ {
+ throw std::runtime_error("mpsk_snr_est: Unimplemented");
+ }
+
+ double
+ mpsk_snr_est::snr()
+ {
+ throw std::runtime_error("mpsk_snr_est: Unimplemented");
+ }
+
+
+ /*****************************************************************/
+
+
+ mpsk_snr_est_simple::mpsk_snr_est_simple(double alpha) :
+ mpsk_snr_est(alpha)
+ {
+ d_y1 = 0;
+ d_y2 = 0;
+ }
+
+ int
+ mpsk_snr_est_simple::update(int noutput_items,
+ const gr_complex *input)
+ {
+ for(int i = 0; i < noutput_items; i++) {
+ double y1 = abs(input[i]);
+ d_y1 = d_alpha*y1 + d_beta*d_y1;
+
+ double y2 = real(input[i]*input[i]);
+ d_y2 = d_alpha*y2 + d_beta*d_y2;
+ }
+ return noutput_items;
+ }
+
+ double
+ mpsk_snr_est_simple::snr()
+ {
+ double y1_2 = d_y1*d_y1;
+ double y3 = y1_2 - d_y2 + 1e-20;
+ return 10.0*log10(y1_2/y3);
+ }
+
+
+ /*****************************************************************/
+
+
+ mpsk_snr_est_skew::mpsk_snr_est_skew(double alpha) :
+ mpsk_snr_est(alpha)
+ {
+ d_y1 = 0;
+ d_y2 = 0;
+ d_y3 = 0;
+ }
+
+ int
+ mpsk_snr_est_skew::update(int noutput_items,
+ const gr_complex *input)
+ {
+ for(int i = 0; i < noutput_items; i++) {
+ double y1 = abs(input[i]);
+ d_y1 = d_alpha*y1 + d_beta*d_y1;
+
+ double y2 = real(input[i]*input[i]);
+ d_y2 = d_alpha*y2 + d_beta*d_y2;
+
+ // online algorithm for calculating skewness
+ // See:
+ // http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Higher-order_statistics
+ double d = abs(input[i]) - d_y1;
+ double d_i = d / (i+1);
+ double y3 = (d*d_i*i)*d_i*(i-1) - 3.0*d_i*d_y2;
+ d_y3 = d_alpha*y3 + d_beta*d_y3;
+ }
+ return noutput_items;
+ }
+
+ double
+ mpsk_snr_est_skew::snr()
+ {
+ double y3 = d_y3*d_y3 / (d_y2*d_y2*d_y2);
+ double y1_2 = d_y1*d_y1;
+ double x = y1_2 - d_y2;
+ return 10.0*log10(y1_2 / (x + y3*y1_2));
+ }
+
+
+ /*****************************************************************/
+
+
+ mpsk_snr_est_m2m4::mpsk_snr_est_m2m4(double alpha) :
+ mpsk_snr_est(alpha)
+ {
+ d_y1 = 0;
+ d_y2 = 0;
+ }
+
+ int
+ mpsk_snr_est_m2m4::update(int noutput_items,
+ const gr_complex *input)
+ {
+ for(int i = 0; i < noutput_items; i++) {
+ double y1 = abs(input[i])*abs(input[i]);
+ d_y1 = d_alpha*y1 + d_beta*d_y1;
+
+ double y2 = abs(input[i])*abs(input[i])*abs(input[i])*abs(input[i]);
+ d_y2 = d_alpha*y2 + d_beta*d_y2;
+ }
+ return noutput_items;
+ }
+
+ double
+ mpsk_snr_est_m2m4::snr()
+ {
+ double y1_2 = d_y1*d_y1;
+ return 10.0*log10(2.0*sqrt(2*y1_2 - d_y2) /
+ (d_y1 - sqrt(2*y1_2 - d_y2)));
+ }
+
+
+ /*****************************************************************/
+
+
+ snr_est_m2m4::snr_est_m2m4(double alpha, double ka, double kw) :
+ mpsk_snr_est(alpha)
+ {
+ d_y1 = 0;
+ d_y2 = 0;
+ d_ka = ka;
+ d_kw = kw;
+ }
+
+ int
+ snr_est_m2m4::update(int noutput_items,
+ const gr_complex *input)
+ {
+ for(int i = 0; i < noutput_items; i++) {
+ double y1 = abs(input[i])*abs(input[i]);
+ d_y1 = d_alpha*y1 + d_beta*d_y1;
+
+ double y2 = abs(input[i])*abs(input[i])*abs(input[i])*abs(input[i]);
+ d_y2 = d_alpha*y2 + d_beta*d_y2;
+ }
+ return noutput_items;
+ }
+
+ double
+ snr_est_m2m4::snr()
+ {
+ double M2 = d_y1;
+ double M4 = d_y2;
+ double s = M2*(d_kw - 2) +
+ sqrt((4.0-d_ka*d_kw)*M2*M2 + M4*(d_ka+d_kw-4.0)) /
+ (d_ka + d_kw - 4.0);
+ double n = M2 - s;
+
+ return 10.0*log10(s / n);
+ }
+
+
+ /*****************************************************************/
+
+
+ mpsk_snr_est_svr::mpsk_snr_est_svr(double alpha) :
+ mpsk_snr_est(alpha)
+ {
+ d_y1 = 0;
+ d_y2 = 0;
+ }
+
+ int
+ mpsk_snr_est_svr::update(int noutput_items,
+ const gr_complex *input)
+ {
+ for(int i = 0; i < noutput_items; i++) {
+ double x = abs(input[i]);
+ double x1 = abs(input[i-1]);
+ double y1 = (x*x)*(x1*x1);
+ d_y1 = d_alpha*y1 + d_beta*d_y1;
+
+ double y2 = x*x*x*x;
+ d_y2 = d_alpha*y2 + d_beta*d_y2;
+ }
+ return noutput_items;
+ }
+
+ double
+ mpsk_snr_est_svr::snr()
+ {
+ double x = d_y1 / (d_y2 - d_y1);
+ return 10.0*log10(2.*((x-1) + sqrt(x*(x-1))));
+ }
+
+ } /* namespace digital */
+} /* namespace gr */
diff --git a/gr-digital/lib/mpsk_snr_est_cc_impl.cc b/gr-digital/lib/mpsk_snr_est_cc_impl.cc
new file mode 100644
index 0000000000..621c41b9f0
--- /dev/null
+++ b/gr-digital/lib/mpsk_snr_est_cc_impl.cc
@@ -0,0 +1,192 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "mpsk_snr_est_cc_impl.h"
+#include <gr_io_signature.h>
+#include <cstdio>
+
+namespace gr {
+ namespace digital {
+
+ mpsk_snr_est_cc::sptr
+ mpsk_snr_est_cc::make(snr_est_type_t type,
+ int tag_nsamples,
+ double alpha)
+ {
+ return gnuradio::get_initial_sptr
+ (new mpsk_snr_est_cc_impl(type, tag_nsamples, alpha));
+ }
+
+ mpsk_snr_est_cc_impl::mpsk_snr_est_cc_impl(snr_est_type_t type,
+ int tag_nsamples,
+ double alpha)
+ : gr_sync_block("mpsk_snr_est_cc",
+ gr_make_io_signature(1, 1, sizeof(gr_complex)),
+ gr_make_io_signature(1, 1, sizeof(gr_complex)))
+ {
+ d_snr_est = NULL;
+
+ d_type = type;
+ d_nsamples = tag_nsamples;
+ d_count = 0;
+ set_alpha(alpha);
+
+ set_type(type);
+
+ // at least 1 estimator has to look back
+ set_history(2);
+
+ std::stringstream str;
+ str << name() << unique_id();
+ d_me = pmt::string_to_symbol(str.str());
+ d_key = pmt::string_to_symbol("snr");
+ }
+
+ mpsk_snr_est_cc_impl::~mpsk_snr_est_cc_impl()
+ {
+ if(d_snr_est)
+ delete d_snr_est;
+ }
+
+ int
+ mpsk_snr_est_cc_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ // This is a pass-through block; copy input to output
+ memcpy(output_items[0], input_items[0],
+ noutput_items * sizeof(gr_complex));
+
+ const gr_complex *in = (const gr_complex*)input_items[0];
+
+ // Update, calculate, and issue an SNR tag every d_nsamples
+ int index = 0, x = 0;
+ int64_t nwritten = nitems_written(0);
+ while(index + (d_nsamples-d_count) <= noutput_items) {
+ x = d_nsamples - d_count;
+ nwritten += x;
+
+ // Update the SNR estimate registers from the current input
+ d_snr_est->update(x, &in[index]);
+
+ // Issue a tag with the SNR data
+ pmt::pmt_t pmt_snr = pmt::from_double(d_snr_est->snr());
+ add_item_tag(0, // stream ID
+ nwritten, // tag's sample number
+ d_key, // snr key
+ pmt_snr, // SNR
+ d_me); // block src id
+
+ index += x;
+ d_count = 0;
+ }
+
+ // Keep track of remaining items and update estimators
+ x = noutput_items - index;
+ d_count += x;
+ d_snr_est->update(x, &in[index]);
+
+ return noutput_items;
+ }
+
+ double
+ mpsk_snr_est_cc_impl::snr()
+ {
+ if(d_snr_est)
+ return d_snr_est->snr();
+ else
+ throw std::runtime_error("mpsk_snr_est_cc_impl:: No SNR estimator defined.\n");
+ }
+
+ snr_est_type_t
+ mpsk_snr_est_cc_impl::type() const
+ {
+ return d_type;
+ }
+
+ int
+ mpsk_snr_est_cc_impl::tag_nsample() const
+ {
+ return d_nsamples;
+ }
+
+ double
+ mpsk_snr_est_cc_impl::alpha() const
+ {
+ return d_alpha;
+ }
+
+ void
+ mpsk_snr_est_cc_impl::set_type(snr_est_type_t t)
+ {
+ d_type = t;
+
+ if(d_snr_est)
+ delete d_snr_est;
+
+ switch(d_type) {
+ case(SNR_EST_SIMPLE):
+ d_snr_est = new mpsk_snr_est_simple(d_alpha);
+ break;
+ case(SNR_EST_SKEW):
+ d_snr_est = new mpsk_snr_est_skew(d_alpha);
+ break;
+ case(SNR_EST_M2M4):
+ d_snr_est = new mpsk_snr_est_m2m4(d_alpha);
+ break;
+ case(SNR_EST_SVR):
+ d_snr_est = new mpsk_snr_est_svr(d_alpha);
+ break;
+ default:
+ throw std::invalid_argument("mpsk_snr_est_cc_impl: unknown type specified.\n");
+ }
+ }
+
+ void
+ mpsk_snr_est_cc_impl::set_tag_nsample(int n)
+ {
+ if(n > 0) {
+ d_nsamples = n;
+ d_count = 0; // reset state
+ }
+ else
+ throw std::invalid_argument("mpsk_snr_est_cc_impl: tag_nsamples can't be <= 0\n");
+ }
+
+ void
+ mpsk_snr_est_cc_impl::set_alpha(double alpha)
+ {
+ if((alpha >= 0) && (alpha <= 1.0)) {
+ d_alpha = alpha;
+ if(d_snr_est)
+ d_snr_est->set_alpha(d_alpha);
+ }
+ else
+ throw std::invalid_argument("mpsk_snr_est_cc_impl: alpha must be in [0,1]\n");
+ }
+
+ } /* namespace digital */
+} /* namespace gr */
diff --git a/gr-digital/lib/mpsk_snr_est_cc_impl.h b/gr-digital/lib/mpsk_snr_est_cc_impl.h
new file mode 100644
index 0000000000..530d223aec
--- /dev/null
+++ b/gr-digital/lib/mpsk_snr_est_cc_impl.h
@@ -0,0 +1,79 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_DIGITAL_MPSK_SNR_EST_CC_IMPL_H
+#define INCLUDED_DIGITAL_MPSK_SNR_EST_CC_IMPL_H
+
+#include <digital/api.h>
+#include <digital/mpsk_snr_est_cc.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace digital {
+
+ class mpsk_snr_est_cc_impl : public mpsk_snr_est_cc
+ {
+ private:
+ snr_est_type_t d_type;
+ int d_nsamples, d_count;
+ double d_alpha;
+ mpsk_snr_est *d_snr_est;
+
+ //d_key is the tag name, 'snr', d_me is the block name + unique ID
+ pmt::pmt_t d_key, d_me;
+
+ public:
+ mpsk_snr_est_cc_impl(snr_est_type_t type,
+ int tag_nsamples=10000,
+ double alpha=0.001);
+ ~mpsk_snr_est_cc_impl();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ //! Return the estimated signal-to-noise ratio in decibels
+ double snr();
+
+ //! Return the type of estimator in use
+ snr_est_type_t type() const;
+
+ //! Return how many samples between SNR tags
+ int tag_nsample() const;
+
+ //! Get the running-average coefficient
+ double alpha() const;
+
+ //! Set type of estimator to use
+ void set_type(snr_est_type_t t);
+
+ //! Set the number of samples between SNR tags
+ void set_tag_nsample(int n);
+
+ //! Set the running-average coefficient
+ void set_alpha(double alpha);
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_DIGITAL_MPSK_SNR_EST_CC_IMPL_H */
diff --git a/gr-digital/lib/ofdm_cyclic_prefixer_impl.cc b/gr-digital/lib/ofdm_cyclic_prefixer_impl.cc
new file mode 100644
index 0000000000..67cfba615f
--- /dev/null
+++ b/gr-digital/lib/ofdm_cyclic_prefixer_impl.cc
@@ -0,0 +1,79 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2006,2010-2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "ofdm_cyclic_prefixer_impl.h"
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace digital {
+
+ ofdm_cyclic_prefixer::sptr
+ ofdm_cyclic_prefixer::make(size_t input_size, size_t output_size)
+ {
+ return gnuradio::get_initial_sptr
+ (new ofdm_cyclic_prefixer_impl(input_size, output_size));
+ }
+
+ ofdm_cyclic_prefixer_impl::ofdm_cyclic_prefixer_impl(size_t input_size,
+ size_t output_size)
+ : gr_sync_interpolator("ofdm_cyclic_prefixer",
+ gr_make_io_signature(1, 1, input_size*sizeof(gr_complex)),
+ gr_make_io_signature(1, 1, sizeof(gr_complex)),
+ output_size),
+ d_input_size(input_size),
+ d_output_size(output_size)
+ {
+ }
+
+ ofdm_cyclic_prefixer_impl::~ofdm_cyclic_prefixer_impl()
+ {
+ }
+
+ int
+ ofdm_cyclic_prefixer_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ gr_complex *in = (gr_complex*)input_items[0];
+ gr_complex *out = (gr_complex*)output_items[0];
+ size_t cp_size = d_output_size - d_input_size;
+ unsigned int i=0, j=0;
+
+ j = cp_size;
+ for(i=0; i < d_input_size; i++,j++) {
+ out[j] = in[i];
+ }
+
+ j = d_input_size - cp_size;
+ for(i=0; i < cp_size; i++, j++) {
+ out[i] = in[j];
+ }
+
+ return d_output_size;
+ }
+
+ } /* namespace digital */
+} /* namespace gr */
diff --git a/gr-digital/swig/digital_lms_dd_equalizer_cc.i b/gr-digital/lib/ofdm_cyclic_prefixer_impl.h
index bd5c6ae29d..20f0489d7c 100644
--- a/gr-digital/swig/digital_lms_dd_equalizer_cc.i
+++ b/gr-digital/lib/ofdm_cyclic_prefixer_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2011 Free Software Foundation, Inc.
+ * Copyright 2004-2006,2011,2012 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,27 +20,30 @@
* Boston, MA 02110-1301, USA.
*/
+#ifndef INCLUDED_DIGITAL_OFDM_CYCLIC_PREFIXER_IMPL_H
+#define INCLUDED_DIGITAL_OFDM_CYCLIC_PREFIXER_IMPL_H
-GR_SWIG_BLOCK_MAGIC(digital,lms_dd_equalizer_cc)
+#include <digital/ofdm_cyclic_prefixer.h>
-// retrieve info on the base class, without generating wrappers since
-// the base class has a pure virual method.
-%import "gr_adaptive_fir_ccc.i"
+namespace gr {
+ namespace digital {
+
+ class ofdm_cyclic_prefixer_impl : public ofdm_cyclic_prefixer
+ {
+ private:
+ size_t d_input_size;
+ size_t d_output_size;
+ public:
+ ofdm_cyclic_prefixer_impl(size_t input_size, size_t output_size);
+ ~ofdm_cyclic_prefixer_impl();
-digital_lms_dd_equalizer_cc_sptr
-digital_make_lms_dd_equalizer_cc (int num_taps,
- float mu, int sps,
- digital_constellation_sptr cnst);
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
-class digital_lms_dd_equalizer_cc : public gr_sync_block
-{
-private:
- digital_lms_dd_equalizer_cc (int num_taps,
- float mu, int sps,
- digital_constellation_sptr cnst);
+ } /* namespace digital */
+} /* namespace gr */
-public:
- float get_gain();
- void set_gain(float mu);
-};
+#endif /* INCLUDED_DIGITAL_OFDM_CYCLIC_PREFIXER_IMPL_H */
diff --git a/gr-digital/lib/ofdm_frame_acquisition_impl.cc b/gr-digital/lib/ofdm_frame_acquisition_impl.cc
new file mode 100644
index 0000000000..1f45338d8f
--- /dev/null
+++ b/gr-digital/lib/ofdm_frame_acquisition_impl.cc
@@ -0,0 +1,217 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006-2008,2010,2011 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "ofdm_frame_acquisition_impl.h"
+#include <gr_io_signature.h>
+#include <gr_expj.h>
+#include <gr_math.h>
+#include <cstdio>
+
+namespace gr {
+ namespace digital {
+
+#define VERBOSE 0
+#define M_TWOPI (2*M_PI)
+#define MAX_NUM_SYMBOLS 1000
+
+ ofdm_frame_acquisition::sptr
+ ofdm_frame_acquisition::make(unsigned int occupied_carriers,
+ unsigned int fft_length,
+ unsigned int cplen,
+ const std::vector<gr_complex> &known_symbol,
+ unsigned int max_fft_shift_len)
+ {
+ return gnuradio::get_initial_sptr
+ (new ofdm_frame_acquisition_impl(occupied_carriers, fft_length, cplen,
+ known_symbol, max_fft_shift_len));
+ }
+
+ ofdm_frame_acquisition_impl::ofdm_frame_acquisition_impl(unsigned occupied_carriers,
+ unsigned int fft_length,
+ unsigned int cplen,
+ const std::vector<gr_complex> &known_symbol,
+ unsigned int max_fft_shift_len)
+ : gr_block("ofdm_frame_acquisition",
+ gr_make_io_signature2(2, 2, sizeof(gr_complex)*fft_length, sizeof(char)*fft_length),
+ gr_make_io_signature2(2, 2, sizeof(gr_complex)*occupied_carriers, sizeof(char))),
+ d_occupied_carriers(occupied_carriers),
+ d_fft_length(fft_length),
+ d_cplen(cplen),
+ d_freq_shift_len(max_fft_shift_len),
+ d_known_symbol(known_symbol),
+ d_coarse_freq(0),
+ d_phase_count(0)
+ {
+ d_symbol_phase_diff.resize(d_fft_length);
+ d_known_phase_diff.resize(d_occupied_carriers);
+ d_hestimate.resize(d_occupied_carriers);
+
+ unsigned int i = 0, j = 0;
+
+ std::fill(d_known_phase_diff.begin(), d_known_phase_diff.end(), 0);
+ for(i = 0; i < d_known_symbol.size()-2; i+=2) {
+ d_known_phase_diff[i] = norm(d_known_symbol[i] - d_known_symbol[i+2]);
+ }
+
+ d_phase_lut = new gr_complex[(2*d_freq_shift_len+1) * MAX_NUM_SYMBOLS];
+ for(i = 0; i <= 2*d_freq_shift_len; i++) {
+ for(j = 0; j < MAX_NUM_SYMBOLS; j++) {
+ d_phase_lut[j + i*MAX_NUM_SYMBOLS] = gr_expj(-M_TWOPI*d_cplen/d_fft_length*(i-d_freq_shift_len)*j);
+ }
+ }
+ }
+
+ ofdm_frame_acquisition_impl::~ofdm_frame_acquisition_impl()
+ {
+ delete [] d_phase_lut;
+ }
+
+ void
+ ofdm_frame_acquisition_impl::forecast(int noutput_items, gr_vector_int &ninput_items_required)
+ {
+ unsigned ninputs = ninput_items_required.size();
+ for(unsigned i = 0; i < ninputs; i++)
+ ninput_items_required[i] = 1;
+ }
+
+ gr_complex
+ ofdm_frame_acquisition_impl::coarse_freq_comp(int freq_delta, int symbol_count)
+ {
+ // return gr_complex(cos(-M_TWOPI*freq_delta*d_cplen/d_fft_length*symbol_count),
+ // sin(-M_TWOPI*freq_delta*d_cplen/d_fft_length*symbol_count));
+
+ return gr_expj(-M_TWOPI*freq_delta*d_cplen/d_fft_length*symbol_count);
+
+ //return d_phase_lut[MAX_NUM_SYMBOLS * (d_freq_shift_len + freq_delta) + symbol_count];
+ }
+
+ void
+ ofdm_frame_acquisition_impl::correlate(const gr_complex *symbol, int zeros_on_left)
+ {
+ unsigned int i,j;
+
+ std::fill(d_symbol_phase_diff.begin(), d_symbol_phase_diff.end(), 0);
+ for(i = 0; i < d_fft_length-2; i++) {
+ d_symbol_phase_diff[i] = norm(symbol[i] - symbol[i+2]);
+ }
+
+ // sweep through all possible/allowed frequency offsets and select the best
+ int index = 0;
+ float max = 0, sum=0;
+ for(i = zeros_on_left - d_freq_shift_len; i < zeros_on_left + d_freq_shift_len; i++) {
+ sum = 0;
+ for(j = 0; j < d_occupied_carriers; j++) {
+ sum += (d_known_phase_diff[j] * d_symbol_phase_diff[i+j]);
+ }
+ if(sum > max) {
+ max = sum;
+ index = i;
+ }
+ }
+
+ // set the coarse frequency offset relative to the edge of the occupied tones
+ d_coarse_freq = index - zeros_on_left;
+ }
+
+ void
+ ofdm_frame_acquisition_impl::calculate_equalizer(const gr_complex *symbol, int zeros_on_left)
+ {
+ unsigned int i=0;
+
+ // Set first tap of equalizer
+ d_hestimate[0] = d_known_symbol[0] /
+ (coarse_freq_comp(d_coarse_freq,1)*symbol[zeros_on_left+d_coarse_freq]);
+
+ // set every even tap based on known symbol
+ // linearly interpolate between set carriers to set zero-filled carriers
+ // FIXME: is this the best way to set this?
+ for(i = 2; i < d_occupied_carriers; i+=2) {
+ d_hestimate[i] = d_known_symbol[i] /
+ (coarse_freq_comp(d_coarse_freq,1)*(symbol[i+zeros_on_left+d_coarse_freq]));
+ d_hestimate[i-1] = (d_hestimate[i] + d_hestimate[i-2]) / gr_complex(2.0, 0.0);
+ }
+
+ // with even number of carriers; last equalizer tap is wrong
+ if(!(d_occupied_carriers & 1)) {
+ d_hestimate[d_occupied_carriers-1] = d_hestimate[d_occupied_carriers-2];
+ }
+
+ if(VERBOSE) {
+ fprintf(stderr, "Equalizer setting:\n");
+ for(i = 0; i < d_occupied_carriers; i++) {
+ gr_complex sym = coarse_freq_comp(d_coarse_freq,1)*symbol[i+zeros_on_left+d_coarse_freq];
+ gr_complex output = sym * d_hestimate[i];
+ fprintf(stderr, "sym: %+.4f + j%+.4f ks: %+.4f + j%+.4f eq: %+.4f + j%+.4f ==> %+.4f + j%+.4f\n",
+ sym .real(), sym.imag(),
+ d_known_symbol[i].real(), d_known_symbol[i].imag(),
+ d_hestimate[i].real(), d_hestimate[i].imag(),
+ output.real(), output.imag());
+ }
+ fprintf(stderr, "\n");
+ }
+ }
+
+ int
+ ofdm_frame_acquisition_impl::general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const gr_complex *symbol = (const gr_complex *)input_items[0];
+ const char *signal_in = (const char *)input_items[1];
+
+ gr_complex *out = (gr_complex *) output_items[0];
+ char *signal_out = (char *) output_items[1];
+
+ int unoccupied_carriers = d_fft_length - d_occupied_carriers;
+ int zeros_on_left = (int)ceil(unoccupied_carriers/2.0);
+
+ if(signal_in[0]) {
+ d_phase_count = 1;
+ correlate(symbol, zeros_on_left);
+ calculate_equalizer(symbol, zeros_on_left);
+ signal_out[0] = 1;
+ }
+ else {
+ signal_out[0] = 0;
+ }
+
+ for(unsigned int i = 0; i < d_occupied_carriers; i++) {
+ out[i] = d_hestimate[i]*coarse_freq_comp(d_coarse_freq,d_phase_count)
+ *symbol[i+zeros_on_left+d_coarse_freq];
+ }
+
+ d_phase_count++;
+ if(d_phase_count == MAX_NUM_SYMBOLS) {
+ d_phase_count = 1;
+ }
+
+ consume_each(1);
+ return 1;
+ }
+
+ } /* namespace digital */
+} /* namespace gr */
diff --git a/gr-digital/lib/ofdm_frame_acquisition_impl.h b/gr-digital/lib/ofdm_frame_acquisition_impl.h
new file mode 100644
index 0000000000..867d86736f
--- /dev/null
+++ b/gr-digital/lib/ofdm_frame_acquisition_impl.h
@@ -0,0 +1,76 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,2007,2011,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_DIGITAL_OFDM_FRAME_ACQUISITION_IMPL_H
+#define INCLUDED_DIGITAL_OFDM_FRAME_ACQUISITION_IMPL_H
+
+#include <digital/ofdm_frame_acquisition.h>
+
+namespace gr {
+ namespace digital {
+
+ class ofdm_frame_acquisition_impl : public ofdm_frame_acquisition
+ {
+ private:
+ unsigned char slicer(gr_complex x);
+ void correlate(const gr_complex *symbol, int zeros_on_left);
+ void calculate_equalizer(const gr_complex *symbol, int zeros_on_left);
+ gr_complex coarse_freq_comp(int freq_delta, int count);
+
+ unsigned int d_occupied_carriers; // !< \brief number of subcarriers with data
+ unsigned int d_fft_length; // !< \brief length of FFT vector
+ unsigned int d_cplen; // !< \brief length of cyclic prefix in samples
+ unsigned int d_freq_shift_len; // !< \brief number of surrounding bins to look at for correlation
+ std::vector<gr_complex> d_known_symbol; // !< \brief known symbols at start of frame
+ std::vector<float> d_known_phase_diff; // !< \brief factor used in correlation from known symbol
+ std::vector<float> d_symbol_phase_diff; // !< \brief factor used in correlation from received symbol
+ std::vector<gr_complex> d_hestimate; // !< channel estimate
+ int d_coarse_freq; // !< \brief search distance in number of bins
+ unsigned int d_phase_count; // !< \brief accumulator for coarse freq correction
+ float d_snr_est; // !< an estimation of the signal to noise ratio
+
+ gr_complex *d_phase_lut; // !< look-up table for coarse frequency compensation
+
+ void forecast(int noutput_items, gr_vector_int &ninput_items_required);
+
+ public:
+ ofdm_frame_acquisition_impl(unsigned int occupied_carriers, unsigned int fft_length,
+ unsigned int cplen,
+ const std::vector<gr_complex> &known_symbol,
+ unsigned int max_fft_shift_len=4);
+ ~ofdm_frame_acquisition_impl();
+
+ /*!
+ * \brief Return an estimate of the SNR of the channel
+ */
+ float snr() { return d_snr_est; }
+
+ int general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_DIGITAL_OFDM_FRAME_ACQUISITION_IMPL_H */
diff --git a/gr-digital/lib/ofdm_frame_equalizer_vcvc_impl.cc b/gr-digital/lib/ofdm_frame_equalizer_vcvc_impl.cc
index e9391658b6..49235db5bb 100644
--- a/gr-digital/lib/ofdm_frame_equalizer_vcvc_impl.cc
+++ b/gr-digital/lib/ofdm_frame_equalizer_vcvc_impl.cc
@@ -64,8 +64,8 @@ namespace gr {
std::vector<gr_tag_t> tags;
get_tags_in_range(tags, 0, nitems_read(0), nitems_read(0)+1);
for (unsigned i = 0; i < tags.size(); i++) {
- if (pmt::pmt_symbol_to_string(tags[i].key) == "ofdm_sync_chan_taps") {
- d_channel_state = pmt::pmt_c32vector_elements(tags[i].value);
+ if (pmt::symbol_to_string(tags[i].key) == "ofdm_sync_chan_taps") {
+ d_channel_state = pmt::c32vector_elements(tags[i].value);
remove_item_tag(0, tags[i]);
}
}
@@ -77,8 +77,8 @@ namespace gr {
d_eq->get_channel_state(d_channel_state);
if (d_propagate_channel_state) {
add_item_tag(0, nitems_written(0),
- pmt::pmt_string_to_symbol("ofdm_sync_chan_taps"),
- pmt::pmt_init_c32vector(d_fft_len, d_channel_state));
+ pmt::string_to_symbol("ofdm_sync_chan_taps"),
+ pmt::init_c32vector(d_fft_len, d_channel_state));
}
return ninput_items[0];
diff --git a/gr-digital/lib/ofdm_frame_sink_impl.cc b/gr-digital/lib/ofdm_frame_sink_impl.cc
new file mode 100644
index 0000000000..d2f00d3a45
--- /dev/null
+++ b/gr-digital/lib/ofdm_frame_sink_impl.cc
@@ -0,0 +1,413 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,2008,2010-2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "ofdm_frame_sink_impl.h"
+#include <gr_io_signature.h>
+#include <gr_expj.h>
+#include <gr_math.h>
+#include <cmath>
+#include <cstdio>
+#include <stdexcept>
+#include <iostream>
+#include <string>
+
+namespace gr {
+ namespace digital {
+
+#define VERBOSE 0
+
+ inline void
+ ofdm_frame_sink_impl::enter_search()
+ {
+ if(VERBOSE)
+ fprintf(stderr, "@ enter_search\n");
+
+ d_state = STATE_SYNC_SEARCH;
+ }
+
+ inline void
+ ofdm_frame_sink_impl::enter_have_sync()
+ {
+ if(VERBOSE)
+ fprintf(stderr, "@ enter_have_sync\n");
+
+ d_state = STATE_HAVE_SYNC;
+
+ // clear state of demapper
+ d_byte_offset = 0;
+ d_partial_byte = 0;
+
+ d_header = 0;
+ d_headerbytelen_cnt = 0;
+
+ // Resetting PLL
+ d_freq = 0.0;
+ d_phase = 0.0;
+ fill(d_dfe.begin(), d_dfe.end(), gr_complex(1.0,0.0));
+ }
+
+ inline void
+ ofdm_frame_sink_impl::enter_have_header()
+ {
+ d_state = STATE_HAVE_HEADER;
+
+ // header consists of two 16-bit shorts in network byte order
+ // payload length is lower 12 bits
+ // whitener offset is upper 4 bits
+ d_packetlen = (d_header >> 16) & 0x0fff;
+ d_packet_whitener_offset = (d_header >> 28) & 0x000f;
+ d_packetlen_cnt = 0;
+
+ if(VERBOSE)
+ fprintf(stderr, "@ enter_have_header (payload_len = %d) (offset = %d)\n",
+ d_packetlen, d_packet_whitener_offset);
+ }
+
+ char
+ ofdm_frame_sink_impl::slicer(const gr_complex x)
+ {
+ unsigned int table_size = d_sym_value_out.size();
+ unsigned int min_index = 0;
+ float min_euclid_dist = norm(x - d_sym_position[0]);
+ float euclid_dist = 0;
+
+ for(unsigned int j = 1; j < table_size; j++){
+ euclid_dist = norm(x - d_sym_position[j]);
+ if(euclid_dist < min_euclid_dist){
+ min_euclid_dist = euclid_dist;
+ min_index = j;
+ }
+ }
+ return d_sym_value_out[min_index];
+ }
+
+ unsigned int ofdm_frame_sink_impl::demapper(const gr_complex *in,
+ char *out)
+ {
+ unsigned int i=0, bytes_produced=0;
+ gr_complex carrier;
+
+ carrier = gr_expj(d_phase);
+
+ gr_complex accum_error = 0.0;
+ //while(i < d_occupied_carriers) {
+ while(i < d_subcarrier_map.size()) {
+ if(d_nresid > 0) {
+ d_partial_byte |= d_resid;
+ d_byte_offset += d_nresid;
+ d_nresid = 0;
+ d_resid = 0;
+ }
+
+ //while((d_byte_offset < 8) && (i < d_occupied_carriers)) {
+ while((d_byte_offset < 8) && (i < d_subcarrier_map.size())) {
+ //gr_complex sigrot = in[i]*carrier*d_dfe[i];
+ gr_complex sigrot = in[d_subcarrier_map[i]]*carrier*d_dfe[i];
+
+ if(d_derotated_output != NULL){
+ d_derotated_output[i] = sigrot;
+ }
+
+ char bits = slicer(sigrot);
+
+ gr_complex closest_sym = d_sym_position[bits];
+
+ accum_error += sigrot * conj(closest_sym);
+
+ // FIX THE FOLLOWING STATEMENT
+ if(norm(sigrot)> 0.001)
+ d_dfe[i] += d_eq_gain*(closest_sym/sigrot-d_dfe[i]);
+
+ i++;
+
+ if((8 - d_byte_offset) >= d_nbits) {
+ d_partial_byte |= bits << (d_byte_offset);
+ d_byte_offset += d_nbits;
+ }
+ else {
+ d_nresid = d_nbits-(8-d_byte_offset);
+ int mask = ((1<<(8-d_byte_offset))-1);
+ d_partial_byte |= (bits & mask) << d_byte_offset;
+ d_resid = bits >> (8-d_byte_offset);
+ d_byte_offset += (d_nbits - d_nresid);
+ }
+ //printf("demod symbol: %.4f + j%.4f bits: %x partial_byte: %x byte_offset: %d resid: %x nresid: %d\n",
+ // in[i-1].real(), in[i-1].imag(), bits, d_partial_byte, d_byte_offset, d_resid, d_nresid);
+ }
+
+ if(d_byte_offset == 8) {
+ //printf("demod byte: %x \n\n", d_partial_byte);
+ out[bytes_produced++] = d_partial_byte;
+ d_byte_offset = 0;
+ d_partial_byte = 0;
+ }
+ }
+ //std::cerr << "accum_error " << accum_error << std::endl;
+
+ float angle = arg(accum_error);
+
+ d_freq = d_freq - d_freq_gain*angle;
+ d_phase = d_phase + d_freq - d_phase_gain*angle;
+ if(d_phase >= 2*M_PI)
+ d_phase -= 2*M_PI;
+ if(d_phase <0)
+ d_phase += 2*M_PI;
+
+ //if(VERBOSE)
+ // std::cerr << angle << "\t" << d_freq << "\t" << d_phase << "\t" << std::endl;
+
+ return bytes_produced;
+ }
+
+
+ ofdm_frame_sink::sptr
+ ofdm_frame_sink::make(const std::vector<gr_complex> &sym_position,
+ const std::vector<char> &sym_value_out,
+ gr_msg_queue_sptr target_queue,
+ int occupied_carriers,
+ float phase_gain, float freq_gain)
+ {
+ return gnuradio::get_initial_sptr
+ (new ofdm_frame_sink_impl(sym_position, sym_value_out,
+ target_queue, occupied_carriers,
+ phase_gain, freq_gain));
+ }
+
+ ofdm_frame_sink_impl::ofdm_frame_sink_impl(const std::vector<gr_complex> &sym_position,
+ const std::vector<char> &sym_value_out,
+ gr_msg_queue_sptr target_queue,
+ int occupied_carriers,
+ float phase_gain, float freq_gain)
+ : gr_sync_block("ofdm_frame_sink",
+ gr_make_io_signature2(2, 2, sizeof(gr_complex)*occupied_carriers, sizeof(char)),
+ gr_make_io_signature(1, 1, sizeof(gr_complex)*occupied_carriers)),
+ d_target_queue(target_queue), d_occupied_carriers(occupied_carriers),
+ d_byte_offset(0), d_partial_byte(0),
+ d_resid(0), d_nresid(0),d_phase(0),d_freq(0),
+ d_phase_gain(phase_gain),d_freq_gain(freq_gain),
+ d_eq_gain(0.05)
+ {
+ std::string carriers = "FE7F";
+
+ // A bit hacky to fill out carriers to occupied_carriers length
+ int diff = (d_occupied_carriers - 4*carriers.length());
+ while(diff > 7) {
+ carriers.insert(0, "f");
+ carriers.insert(carriers.length(), "f");
+ diff -= 8;
+ }
+
+ // if there's extras left to be processed
+ // divide remaining to put on either side of current map
+ // all of this is done to stick with the concept of a carrier map string that
+ // can be later passed by the user, even though it'd be cleaner to just do this
+ // on the carrier map itself
+ int diff_left=0;
+ int diff_right=0;
+
+ // dictionary to convert from integers to ascii hex representation
+ char abc[16] = {'0', '1', '2', '3', '4', '5', '6', '7',
+ '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
+ if(diff > 0) {
+ char c[2] = {0,0};
+
+ diff_left = (int)ceil((float)diff/2.0f); // number of carriers to put on the left side
+ c[0] = abc[(1 << diff_left) - 1]; // convert to bits and move to ASCI integer
+ carriers.insert(0, c);
+
+ diff_right = diff - diff_left; // number of carriers to put on the right side
+ c[0] = abc[0xF^((1 << diff_right) - 1)]; // convert to bits and move to ASCI integer
+ carriers.insert(carriers.length(), c);
+ }
+
+ // It seemed like such a good idea at the time...
+ // because we are only dealing with the occupied_carriers
+ // at this point, the diff_left in the following compensates
+ // for any offset from the 0th carrier introduced
+ int i;
+ unsigned int j,k;
+ for(i = 0; i < (d_occupied_carriers/4)+diff_left; i++) {
+ char c = carriers[i];
+ for(j = 0; j < 4; j++) {
+ k = (strtol(&c, NULL, 16) >> (3-j)) & 0x1;
+ if(k) {
+ d_subcarrier_map.push_back(4*i + j - diff_left);
+ }
+ }
+ }
+
+ // make sure we stay in the limit currently imposed by the occupied_carriers
+ if(d_subcarrier_map.size() > (size_t)d_occupied_carriers) {
+ throw std::invalid_argument("ofdm_frame_sink_impl: subcarriers allocated exceeds size of occupied carriers");
+ }
+
+ d_bytes_out = new char[d_occupied_carriers];
+ d_dfe.resize(occupied_carriers);
+ fill(d_dfe.begin(), d_dfe.end(), gr_complex(1.0,0.0));
+
+ set_sym_value_out(sym_position, sym_value_out);
+
+ enter_search();
+ }
+
+ ofdm_frame_sink_impl::~ofdm_frame_sink_impl()
+ {
+ delete [] d_bytes_out;
+ }
+
+ bool
+ ofdm_frame_sink_impl::set_sym_value_out(const std::vector<gr_complex> &sym_position,
+ const std::vector<char> &sym_value_out)
+ {
+ if(sym_position.size() != sym_value_out.size())
+ return false;
+
+ if(sym_position.size()<1)
+ return false;
+
+ d_sym_position = sym_position;
+ d_sym_value_out = sym_value_out;
+ d_nbits = (unsigned long)ceil(log10(float(d_sym_value_out.size())) / log10(2.0));
+
+ return true;
+ }
+
+ int
+ ofdm_frame_sink_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const gr_complex *in = (const gr_complex*)input_items[0];
+ const char *sig = (const char*)input_items[1];
+ unsigned int j = 0;
+ unsigned int bytes=0;
+
+ // If the output is connected, send it the derotated symbols
+ if(output_items.size() >= 1)
+ d_derotated_output = (gr_complex *)output_items[0];
+ else
+ d_derotated_output = NULL;
+
+ if(VERBOSE)
+ fprintf(stderr,">>> Entering state machine\n");
+
+ switch(d_state) {
+ case STATE_SYNC_SEARCH: // Look for flag indicating beginning of pkt
+ if(VERBOSE)
+ fprintf(stderr,"SYNC Search, noutput=%d\n", noutput_items);
+
+ if(sig[0]) { // Found it, set up for header decode
+ enter_have_sync();
+ }
+ break;
+
+ case STATE_HAVE_SYNC:
+ // only demod after getting the preamble signal; otherwise, the
+ // equalizer taps will screw with the PLL performance
+ bytes = demapper(&in[0], d_bytes_out);
+
+ if(VERBOSE) {
+ if(sig[0])
+ printf("ERROR -- Found SYNC in HAVE_SYNC\n");
+ fprintf(stderr,"Header Search bitcnt=%d, header=0x%08x\n",
+ d_headerbytelen_cnt, d_header);
+ }
+
+ j = 0;
+ while(j < bytes) {
+ d_header = (d_header << 8) | (d_bytes_out[j] & 0xFF);
+ j++;
+
+ if(++d_headerbytelen_cnt == HEADERBYTELEN) {
+ if(VERBOSE)
+ fprintf(stderr, "got header: 0x%08x\n", d_header);
+
+ // we have a full header, check to see if it has been received properly
+ if(header_ok()) {
+ enter_have_header();
+
+ if(VERBOSE)
+ printf("\nPacket Length: %d\n", d_packetlen);
+
+ while((j < bytes) && (d_packetlen_cnt < d_packetlen)) {
+ d_packet[d_packetlen_cnt++] = d_bytes_out[j++];
+ }
+
+ if(d_packetlen_cnt == d_packetlen) {
+ gr_message_sptr msg =
+ gr_make_message(0, d_packet_whitener_offset, 0, d_packetlen);
+ memcpy(msg->msg(), d_packet, d_packetlen_cnt);
+ d_target_queue->insert_tail(msg); // send it
+ msg.reset(); // free it up
+
+ enter_search();
+ }
+ }
+ else {
+ enter_search(); // bad header
+ }
+ }
+ }
+ break;
+
+ case STATE_HAVE_HEADER:
+ bytes = demapper(&in[0], d_bytes_out);
+
+ if(VERBOSE) {
+ if(sig[0])
+ printf("ERROR -- Found SYNC in HAVE_HEADER at %d, length of %d\n", d_packetlen_cnt, d_packetlen);
+ fprintf(stderr,"Packet Build\n");
+ }
+
+ j = 0;
+ while(j < bytes) {
+ d_packet[d_packetlen_cnt++] = d_bytes_out[j++];
+
+ if (d_packetlen_cnt == d_packetlen){ // packet is filled
+ // build a message
+ // NOTE: passing header field as arg1 is not scalable
+ gr_message_sptr msg =
+ gr_make_message(0, d_packet_whitener_offset, 0, d_packetlen_cnt);
+ memcpy(msg->msg(), d_packet, d_packetlen_cnt);
+
+ d_target_queue->insert_tail(msg); // send it
+ msg.reset(); // free it up
+
+ enter_search();
+ break;
+ }
+ }
+ break;
+
+ default:
+ assert(0);
+ } // switch
+
+ return 1;
+ }
+
+ } /* namespace digital */
+} /* namespace gr */
diff --git a/gr-digital/lib/ofdm_frame_sink_impl.h b/gr-digital/lib/ofdm_frame_sink_impl.h
new file mode 100644
index 0000000000..49d5d6b5c0
--- /dev/null
+++ b/gr-digital/lib/ofdm_frame_sink_impl.h
@@ -0,0 +1,106 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,2011,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_DIGITAL_OFDM_FRAME_SINK_IMPL_H
+#define INCLUDED_DIGITAL_OFDM_FRAME_SINK_IMPL_H
+
+#include <digital/ofdm_frame_sink.h>
+
+namespace gr {
+ namespace digital {
+
+ class ofdm_frame_sink_impl : public ofdm_frame_sink
+ {
+ private:
+ enum state_t {STATE_SYNC_SEARCH, STATE_HAVE_SYNC, STATE_HAVE_HEADER};
+
+ static const int MAX_PKT_LEN = 4096;
+ static const int HEADERBYTELEN = 4;
+
+ gr_msg_queue_sptr d_target_queue; // where to send the packet when received
+ state_t d_state;
+ unsigned int d_header; // header bits
+ int d_headerbytelen_cnt; // how many so far
+
+ char *d_bytes_out; // hold the current bytes produced by the demapper
+
+ int d_occupied_carriers;
+ unsigned int d_byte_offset;
+ unsigned int d_partial_byte;
+
+ char d_packet[MAX_PKT_LEN]; // assembled payload
+ int d_packetlen; // length of packet
+ int d_packet_whitener_offset; // offset into whitener string to use
+ int d_packetlen_cnt; // how many so far
+
+ gr_complex * d_derotated_output; // Pointer to output stream to send deroated symbols out
+
+ std::vector<gr_complex> d_sym_position;
+ std::vector<char> d_sym_value_out;
+ std::vector<gr_complex> d_dfe;
+ unsigned int d_nbits;
+
+ char d_resid;
+ unsigned int d_nresid;
+ float d_phase;
+ float d_freq;
+ float d_phase_gain;
+ float d_freq_gain;
+ float d_eq_gain;
+
+ std::vector<int> d_subcarrier_map;
+
+ protected:
+ void enter_search();
+ void enter_have_sync();
+ void enter_have_header();
+
+ bool header_ok()
+ {
+ // confirm that two copies of header info are identical
+ return ((d_header >> 16) ^ (d_header & 0xffff)) == 0;
+ }
+
+ char slicer(const gr_complex x);
+ unsigned int demapper(const gr_complex *in,
+ char *out);
+
+ bool set_sym_value_out(const std::vector<gr_complex> &sym_position,
+ const std::vector<char> &sym_value_out);
+
+ public:
+ ofdm_frame_sink_impl(const std::vector<gr_complex> &sym_position,
+ const std::vector<char> &sym_value_out,
+ gr_msg_queue_sptr target_queue,
+ int occupied_tones,
+ float phase_gain=0.25, float freq_gain=0.25*0.25/4);
+ ~ofdm_frame_sink_impl();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_OFDM_FRAME_SINK_IMPL_H */
diff --git a/gr-digital/lib/ofdm_insert_preamble_impl.cc b/gr-digital/lib/ofdm_insert_preamble_impl.cc
new file mode 100644
index 0000000000..100e69e22c
--- /dev/null
+++ b/gr-digital/lib/ofdm_insert_preamble_impl.cc
@@ -0,0 +1,201 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,2010-2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "ofdm_insert_preamble_impl.h"
+#include <gr_io_signature.h>
+#include <stdexcept>
+#include <iostream>
+#include <string>
+
+namespace gr {
+ namespace digital {
+
+ ofdm_insert_preamble::sptr
+ ofdm_insert_preamble::make(int fft_length,
+ const std::vector<std::vector<gr_complex> > &preamble)
+ {
+ return gnuradio::get_initial_sptr
+ (new ofdm_insert_preamble_impl(fft_length, preamble));
+ }
+
+ ofdm_insert_preamble_impl::ofdm_insert_preamble_impl(int fft_length,
+ const std::vector<std::vector<gr_complex> > &preamble)
+ : gr_block("ofdm_insert_preamble",
+ gr_make_io_signature2(1, 2,
+ sizeof(gr_complex)*fft_length,
+ sizeof(char)),
+ gr_make_io_signature2(1, 2,
+ sizeof(gr_complex)*fft_length,
+ sizeof(char))),
+ d_fft_length(fft_length),
+ d_state(ST_IDLE),
+ d_nsymbols_output(0),
+ d_pending_flag(0),
+ d_preamble(preamble)
+ {
+ // sanity check preamble symbols
+ for(size_t i = 0; i < d_preamble.size(); i++) {
+ if(d_preamble[i].size() != (size_t) d_fft_length)
+ throw std::invalid_argument("ofdm_insert_preamble_impl: invalid length for preamble symbol");
+ }
+
+ enter_idle();
+ }
+
+
+ ofdm_insert_preamble_impl::~ofdm_insert_preamble_impl()
+ {
+ }
+
+ void
+ ofdm_insert_preamble_impl::forecast(int noutput_items, gr_vector_int &ninput_items_required)
+ {
+ ninput_items_required[0] = noutput_items;
+ }
+
+ int
+ ofdm_insert_preamble_impl::general_work(int noutput_items,
+ gr_vector_int &ninput_items_v,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ int ninput_items = ninput_items_v.size() == 2 ?
+ std::min(ninput_items_v[0], ninput_items_v[1]) : ninput_items_v[0];
+
+ const gr_complex *in_sym = (const gr_complex *)input_items[0];
+ const unsigned char *in_flag = 0;
+
+ if(input_items.size() == 2)
+ in_flag = (const unsigned char*)input_items[1];
+
+ gr_complex *out_sym = (gr_complex*)output_items[0];
+ unsigned char *out_flag = 0;
+ if(output_items.size() == 2)
+ out_flag = (unsigned char*)output_items[1];
+
+ int no = 0; // number items output
+ int ni = 0; // number items read from input
+
+#define write_out_flag() \
+ do { \
+ if(out_flag) \
+ out_flag[no] = d_pending_flag; \
+ d_pending_flag = 0; \
+ } while(0)
+
+ while(no < noutput_items && ni < ninput_items) {
+ switch(d_state) {
+ case ST_IDLE:
+ if(in_flag && in_flag[ni] & 0x1) // this is first symbol of new payload
+ enter_preamble();
+ else
+ ni++; // eat one input symbol
+ break;
+
+ case ST_PREAMBLE:
+ assert(!in_flag || in_flag[ni] & 0x1);
+ if(d_nsymbols_output >= (int) d_preamble.size()) {
+ // we've output all the preamble
+ enter_first_payload();
+ }
+ else {
+ memcpy(&out_sym[no * d_fft_length],
+ &d_preamble[d_nsymbols_output][0],
+ d_fft_length*sizeof(gr_complex));
+
+ write_out_flag();
+ no++;
+ d_nsymbols_output++;
+ }
+ break;
+
+ case ST_FIRST_PAYLOAD:
+ // copy first payload symbol from input to output
+ memcpy(&out_sym[no * d_fft_length],
+ &in_sym[ni * d_fft_length],
+ d_fft_length * sizeof(gr_complex));
+
+ write_out_flag();
+ no++;
+ ni++;
+ enter_payload();
+ break;
+
+ case ST_PAYLOAD:
+ if(in_flag && in_flag[ni] & 0x1) { // this is first symbol of a new payload
+ enter_preamble();
+ break;
+ }
+
+ // copy a symbol from input to output
+ memcpy(&out_sym[no * d_fft_length],
+ &in_sym[ni * d_fft_length],
+ d_fft_length * sizeof(gr_complex));
+
+ write_out_flag();
+ no++;
+ ni++;
+ break;
+
+ default:
+ std::cerr << "ofdm_insert_preamble_impl: (can't happen) invalid state, resetting\n";
+ enter_idle();
+ }
+ }
+
+ consume_each(ni);
+ return no;
+ }
+
+ void
+ ofdm_insert_preamble_impl::enter_idle()
+ {
+ d_state = ST_IDLE;
+ d_nsymbols_output = 0;
+ d_pending_flag = 0;
+ }
+
+ void
+ ofdm_insert_preamble_impl::enter_preamble()
+ {
+ d_state = ST_PREAMBLE;
+ d_nsymbols_output = 0;
+ d_pending_flag = 1;
+ }
+
+ void
+ ofdm_insert_preamble_impl::enter_first_payload()
+ {
+ d_state = ST_FIRST_PAYLOAD;
+ }
+
+ void
+ ofdm_insert_preamble_impl::enter_payload()
+ {
+ d_state = ST_PAYLOAD;
+ }
+
+ } /* namespace digital */
+} /* namespace gr */
diff --git a/gr-digital/lib/ofdm_insert_preamble_impl.h b/gr-digital/lib/ofdm_insert_preamble_impl.h
new file mode 100644
index 0000000000..cd47810daf
--- /dev/null
+++ b/gr-digital/lib/ofdm_insert_preamble_impl.h
@@ -0,0 +1,67 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,2011,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef INCLUDED_DIGITAL_OFDM_INSERT_PREAMBLE_IMPL_H
+#define INCLUDED_DIGITAL_OFDM_INSERT_PREAMBLE_IMPL_H
+
+#include <digital/ofdm_insert_preamble.h>
+
+namespace gr {
+ namespace digital {
+
+ class ofdm_insert_preamble_impl : public ofdm_insert_preamble
+ {
+ private:
+ enum state_t {
+ ST_IDLE,
+ ST_PREAMBLE,
+ ST_FIRST_PAYLOAD,
+ ST_PAYLOAD
+ };
+
+ int d_fft_length;
+ state_t d_state;
+ int d_nsymbols_output;
+ int d_pending_flag;
+ const std::vector<std::vector<gr_complex> > d_preamble;
+
+ void enter_idle();
+ void enter_first_payload();
+ void enter_payload();
+
+ public:
+ ofdm_insert_preamble_impl(int fft_length,
+ const std::vector<std::vector<gr_complex> > &preamble);
+ ~ofdm_insert_preamble_impl();
+
+ void enter_preamble();
+
+ int general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ void forecast(int noutput_items, gr_vector_int &ninput_items_required);
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_DIGITAL_OFDM_INSERT_PREAMBLE_IMPL_H */
diff --git a/gr-digital/lib/ofdm_mapper_bcv_impl.cc b/gr-digital/lib/ofdm_mapper_bcv_impl.cc
new file mode 100644
index 0000000000..5b5359d7b9
--- /dev/null
+++ b/gr-digital/lib/ofdm_mapper_bcv_impl.cc
@@ -0,0 +1,252 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006-2008,2010-2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "ofdm_mapper_bcv_impl.h"
+#include <gr_io_signature.h>
+#include <stdexcept>
+#include <string>
+
+namespace gr {
+ namespace digital {
+
+ ofdm_mapper_bcv::sptr
+ ofdm_mapper_bcv::make(const std::vector<gr_complex> &constellation,
+ unsigned int msgq_limit,
+ unsigned int occupied_carriers,
+ unsigned int fft_length)
+ {
+ return gnuradio::get_initial_sptr
+ (new ofdm_mapper_bcv_impl(constellation, msgq_limit,
+ occupied_carriers, fft_length));
+ }
+
+ // Consumes 1 packet and produces as many OFDM symbols of
+ // fft_length to hold the full packet
+ ofdm_mapper_bcv_impl::ofdm_mapper_bcv_impl(const std::vector<gr_complex> &constellation,
+ unsigned int msgq_limit,
+ unsigned int occupied_carriers,
+ unsigned int fft_length)
+ : gr_sync_block("ofdm_mapper_bcv",
+ gr_make_io_signature(0, 0, 0),
+ gr_make_io_signature2(1, 2, sizeof(gr_complex)*fft_length, sizeof(char))),
+ d_constellation(constellation),
+ d_msgq(gr_make_msg_queue(msgq_limit)), d_msg_offset(0), d_eof(false),
+ d_occupied_carriers(occupied_carriers),
+ d_fft_length(fft_length),
+ d_bit_offset(0),
+ d_pending_flag(0),
+ d_resid(0),
+ d_nresid(0)
+ {
+ if(!(d_occupied_carriers <= d_fft_length))
+ throw std::invalid_argument("ofdm_mapper_bcv_impl: occupied carriers must be <= fft_length");
+
+ // this is not the final form of this solution since we still
+ // use the occupied_tones concept, which would get us into
+ // trouble if the number of carriers we seek is greater than the
+ // occupied carriers.
+ // Eventually, we will get rid of the occupied_carriers concept.
+ std::string carriers = "FE7F";
+
+ // A bit hacky to fill out carriers to occupied_carriers length
+ int diff = (d_occupied_carriers - 4*carriers.length());
+ while(diff > 7) {
+ carriers.insert(0, "f");
+ carriers.insert(carriers.length(), "f");
+ diff -= 8;
+ }
+
+ // if there's extras left to be processed divide remaining to
+ // put on either side of current map all of this is done to
+ // stick with the concept of a carrier map string that can be
+ // later passed by the user, even though it'd be cleaner to just
+ // do this on the carrier map itself
+ int diff_left=0;
+ int diff_right=0;
+
+ // dictionary to convert from integers to ascii hex representation
+ char abc[16] = {'0', '1', '2', '3', '4', '5', '6', '7',
+ '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
+ if(diff > 0) {
+ char c[2] = {0,0};
+
+ diff_left = (int)ceil((float)diff/2.0f); // number of carriers to put on the left side
+ c[0] = abc[(1 << diff_left) - 1]; // convert to bits and move to ASCI integer
+ carriers.insert(0, c);
+
+ diff_right = diff - diff_left; // number of carriers to put on the right side
+ c[0] = abc[0xF^((1 << diff_right) - 1)]; // convert to bits and move to ASCI integer
+ carriers.insert(carriers.length(), c);
+ }
+
+ // find out how many zeros to pad on the sides; the difference between the fft length and the subcarrier
+ // mapping size in chunks of four. This is the number to pack on the left and this number plus any
+ // residual nulls (if odd) will be packed on the right.
+ diff = (d_fft_length/4 - carriers.length())/2;
+
+ unsigned int i,j,k;
+ for(i = 0; i < carriers.length(); i++) {
+ char c = carriers[i]; // get the current hex character from the string
+ for(j = 0; j < 4; j++) { // walk through all four bits
+ k = (strtol(&c, NULL, 16) >> (3-j)) & 0x1; // convert to int and extract next bit
+ if(k) { // if bit is a 1,
+ d_subcarrier_map.push_back(4*(i+diff) + j); // use this subcarrier
+ }
+ }
+ }
+
+ // make sure we stay in the limit currently imposed by the occupied_carriers
+ if(d_subcarrier_map.size() > d_occupied_carriers) {
+ throw std::invalid_argument("ofdm_mapper_bcv_impl: subcarriers allocated exceeds size of occupied carriers");
+ }
+
+ d_nbits = (unsigned long)ceil(log10(float(d_constellation.size())) / log10(2.0));
+ }
+
+ ofdm_mapper_bcv_impl::~ofdm_mapper_bcv_impl()
+ {
+ }
+
+ int ofdm_mapper_bcv_impl::randsym()
+ {
+ return (rand() % d_constellation.size());
+ }
+
+ int
+ ofdm_mapper_bcv_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ gr_complex *out = (gr_complex *)output_items[0];
+
+ unsigned int i=0;
+
+ //printf("OFDM BPSK Mapper: ninput_items: %d noutput_items: %d\n", ninput_items[0], noutput_items);
+
+ if(d_eof) {
+ return -1;
+ }
+
+ if(!d_msg) {
+ d_msg = d_msgq->delete_head(); // block, waiting for a message
+ d_msg_offset = 0;
+ d_bit_offset = 0;
+ d_pending_flag = 1; // new packet, write start of packet flag
+
+ if((d_msg->length() == 0) && (d_msg->type() == 1)) {
+ d_msg.reset();
+ return -1; // We're done; no more messages coming.
+ }
+ }
+
+ char *out_flag = 0;
+ if(output_items.size() == 2)
+ out_flag = (char *) output_items[1];
+
+
+ // Build a single symbol:
+ // Initialize all bins to 0 to set unused carriers
+ memset(out, 0, d_fft_length*sizeof(gr_complex));
+
+ i = 0;
+ unsigned char bits = 0;
+ //while((d_msg_offset < d_msg->length()) && (i < d_occupied_carriers)) {
+ while((d_msg_offset < d_msg->length()) && (i < d_subcarrier_map.size())) {
+
+ // need new data to process
+ if(d_bit_offset == 0) {
+ d_msgbytes = d_msg->msg()[d_msg_offset];
+ //printf("mod message byte: %x\n", d_msgbytes);
+ }
+
+ if(d_nresid > 0) {
+ // take the residual bits, fill out nbits with info from the new byte, and put them in the symbol
+ d_resid |= (((1 << d_nresid)-1) & d_msgbytes) << (d_nbits - d_nresid);
+ bits = d_resid;
+
+ out[d_subcarrier_map[i]] = d_constellation[bits];
+ i++;
+
+ d_bit_offset += d_nresid;
+ d_nresid = 0;
+ d_resid = 0;
+ //printf("mod bit(r): %x resid: %x nresid: %d bit_offset: %d\n",
+ // bits, d_resid, d_nresid, d_bit_offset);
+ }
+ else {
+ if((8 - d_bit_offset) >= d_nbits) { // test to make sure we can fit nbits
+ // take the nbits number of bits at a time from the byte to add to the symbol
+ bits = ((1 << d_nbits)-1) & (d_msgbytes >> d_bit_offset);
+ d_bit_offset += d_nbits;
+
+ out[d_subcarrier_map[i]] = d_constellation[bits];
+ i++;
+ }
+ else { // if we can't fit nbits, store them for the next
+ // saves d_nresid bits of this message where d_nresid < d_nbits
+ unsigned int extra = 8-d_bit_offset;
+ d_resid = ((1 << extra)-1) & (d_msgbytes >> d_bit_offset);
+ d_bit_offset += extra;
+ d_nresid = d_nbits - extra;
+ }
+ }
+
+ if(d_bit_offset == 8) {
+ d_bit_offset = 0;
+ d_msg_offset++;
+ }
+ }
+
+ // Ran out of data to put in symbol
+ if (d_msg_offset == d_msg->length()) {
+ if(d_nresid > 0) {
+ d_resid |= 0x00;
+ bits = d_resid;
+ d_nresid = 0;
+ d_resid = 0;
+ }
+
+ //while(i < d_occupied_carriers) { // finish filling out the symbol
+ while(i < d_subcarrier_map.size()) { // finish filling out the symbol
+ out[d_subcarrier_map[i]] = d_constellation[randsym()];
+ i++;
+ }
+
+ if(d_msg->type() == 1) // type == 1 sets EOF
+ d_eof = true;
+ d_msg.reset(); // finished packet, free message
+ assert(d_bit_offset == 0);
+ }
+
+ if(out_flag)
+ out_flag[0] = d_pending_flag;
+ d_pending_flag = 0;
+
+ return 1; // produced symbol
+ }
+
+ } /* namespace digital */
+} /* namespace gr */
diff --git a/gr-digital/lib/ofdm_mapper_bcv_impl.h b/gr-digital/lib/ofdm_mapper_bcv_impl.h
new file mode 100644
index 0000000000..6459ed73d8
--- /dev/null
+++ b/gr-digital/lib/ofdm_mapper_bcv_impl.h
@@ -0,0 +1,74 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,2007,2011,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_DIGITAL_OFDM_MAPPER_BCV_IMPL_H
+#define INCLUDED_DIGITAL_OFDM_MAPPER_BCV_IMPL_H
+
+#include <digital/ofdm_mapper_bcv.h>
+#include <gr_message.h>
+#include <vector>
+
+namespace gr {
+ namespace digital {
+
+ class ofdm_mapper_bcv_impl : public ofdm_mapper_bcv
+ {
+ private:
+ std::vector<gr_complex> d_constellation;
+ gr_msg_queue_sptr d_msgq;
+ gr_message_sptr d_msg;
+ unsigned d_msg_offset;
+ bool d_eof;
+
+ unsigned int d_occupied_carriers;
+ unsigned int d_fft_length;
+ unsigned int d_bit_offset;
+ int d_pending_flag;
+
+ unsigned long d_nbits;
+ unsigned char d_msgbytes;
+
+ unsigned char d_resid;
+ unsigned int d_nresid;
+
+ std::vector<int> d_subcarrier_map;
+
+ int randsym();
+
+ public:
+ ofdm_mapper_bcv_impl(const std::vector<gr_complex> &constellation,
+ unsigned msgq_limit,
+ unsigned occupied_carriers,
+ unsigned int fft_length);
+ ~ofdm_mapper_bcv_impl(void);
+
+ gr_msg_queue_sptr msgq() const { return d_msgq; }
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_DIGITAL_OFDM_MAPPER_BCV_IMPL_H */
diff --git a/gr-digital/lib/ofdm_sampler_impl.cc b/gr-digital/lib/ofdm_sampler_impl.cc
new file mode 100644
index 0000000000..0724b7cf26
--- /dev/null
+++ b/gr-digital/lib/ofdm_sampler_impl.cc
@@ -0,0 +1,144 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,2008,2010-2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "ofdm_sampler_impl.h"
+#include <gr_io_signature.h>
+#include <gr_expj.h>
+#include <cstdio>
+
+namespace gr {
+ namespace digital {
+
+ ofdm_sampler::sptr
+ ofdm_sampler::make(unsigned int fft_length,
+ unsigned int symbol_length,
+ unsigned int timeout)
+ {
+ return gnuradio::get_initial_sptr
+ (new ofdm_sampler_impl(fft_length, symbol_length, timeout));
+ }
+
+ ofdm_sampler_impl::ofdm_sampler_impl(unsigned int fft_length,
+ unsigned int symbol_length,
+ unsigned int timeout)
+ : gr_block("ofdm_sampler",
+ gr_make_io_signature2(2, 2, sizeof(gr_complex), sizeof(char)),
+ gr_make_io_signature2(2, 2, sizeof(gr_complex)*fft_length, sizeof(char)*fft_length)),
+ d_state(STATE_NO_SIG), d_timeout_max(timeout),
+ d_fft_length(fft_length), d_symbol_length(symbol_length)
+ {
+ set_relative_rate(1.0/(double) fft_length); // buffer allocator hint
+ }
+
+ ofdm_sampler_impl::~ofdm_sampler_impl()
+ {
+ }
+
+ void
+ ofdm_sampler_impl::forecast(int noutput_items, gr_vector_int &ninput_items_required)
+ {
+ // FIXME do we need more
+ //int nreqd = (noutput_items-1) * d_symbol_length + d_fft_length;
+ int nreqd = d_symbol_length + d_fft_length;
+ unsigned ninputs = ninput_items_required.size();
+ for(unsigned i = 0; i < ninputs; i++)
+ ninput_items_required[i] = nreqd;
+ }
+
+ int
+ ofdm_sampler_impl::general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const gr_complex *iptr = (const gr_complex*)input_items[0];
+ const char *trigger = (const char*)input_items[1];
+
+ gr_complex *optr = (gr_complex*)output_items[0];
+ char *outsig = (char*)output_items[1];
+
+ //FIXME: we only process a single OFDM symbol at a time; after the preamble, we can
+ // process a few at a time as long as we always look out for the next preamble.
+
+ unsigned int index = d_fft_length; // start one fft length into the input so we can always look back this far
+
+ outsig[0] = 0; // set output to no signal by default
+
+ // Search for a preamble trigger signal during the next symbol length
+ while((d_state != STATE_PREAMBLE) && (index <= (d_symbol_length+d_fft_length))) {
+ if(trigger[index]) {
+ outsig[0] = 1; // tell the next block there is a preamble coming
+ d_state = STATE_PREAMBLE;
+ }
+ else
+ index++;
+ }
+
+ unsigned int i, pos, ret;
+ switch(d_state) {
+ case(STATE_PREAMBLE):
+ // When we found a preamble trigger, get it and set the symbol boundary here
+ for(i = (index - d_fft_length + 1); i <= index; i++) {
+ *optr++ = iptr[i];
+ }
+
+ d_timeout = d_timeout_max; // tell the system to expect at least this many symbols for a frame
+ d_state = STATE_FRAME;
+ consume_each(index - d_fft_length + 1); // consume up to one fft_length away to keep the history
+ ret = 1;
+ break;
+
+ case(STATE_FRAME):
+ // use this state when we have processed a preamble and are getting the rest of the frames
+ //FIXME: we could also have a power squelch system here to enter STATE_NO_SIG if no power is received
+
+ // skip over fft length history and cyclic prefix
+ pos = d_symbol_length; // keeps track of where we are in the input buffer
+ while(pos < d_symbol_length + d_fft_length) {
+ *optr++ = iptr[pos++];
+ }
+
+ if(d_timeout-- == 0) {
+ printf("TIMEOUT\n");
+ d_state = STATE_NO_SIG;
+ }
+
+ consume_each(d_symbol_length); // jump up by 1 fft length and the cyclic prefix length
+ ret = 1;
+ break;
+
+ case(STATE_NO_SIG):
+ default:
+ consume_each(index-d_fft_length); // consume everything we've gone through so far leaving the fft length history
+ ret = 0;
+ break;
+ }
+
+ return ret;
+ }
+
+ } /* namespace digital */
+} /* namespace gr */
diff --git a/gr-digital/lib/ofdm_sampler_impl.h b/gr-digital/lib/ofdm_sampler_impl.h
new file mode 100644
index 0000000000..369447465f
--- /dev/null
+++ b/gr-digital/lib/ofdm_sampler_impl.h
@@ -0,0 +1,60 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,2011,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_DIGITAL_OFDM_SAMPLER_IMPL_H
+#define INCLUDED_DIGITAL_OFDM_SAMPLER_IMPL_H
+
+#include <digital/ofdm_sampler.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace digital {
+
+ class ofdm_sampler_impl : public ofdm_sampler
+ {
+ private:
+ enum state_t {STATE_NO_SIG, STATE_PREAMBLE, STATE_FRAME};
+
+ state_t d_state;
+ unsigned int d_timeout_max;
+ unsigned int d_timeout;
+ unsigned int d_fft_length;
+ unsigned int d_symbol_length;
+
+ public:
+ ofdm_sampler_impl(unsigned int fft_length,
+ unsigned int symbol_length,
+ unsigned int timeout=1000);
+ ~ofdm_sampler_impl();
+
+ void forecast(int noutput_items, gr_vector_int &ninput_items_required);
+
+ int general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_DIGITAL_OFDM_SAMPLER_IMPL_H */
diff --git a/gr-digital/lib/ofdm_serializer_vcc_impl.cc b/gr-digital/lib/ofdm_serializer_vcc_impl.cc
index 2fdb9bd0e8..9c41daae77 100644
--- a/gr-digital/lib/ofdm_serializer_vcc_impl.cc
+++ b/gr-digital/lib/ofdm_serializer_vcc_impl.cc
@@ -81,8 +81,8 @@ namespace gr {
len_tag_key),
d_fft_len(fft_len),
d_occupied_carriers(occupied_carriers),
- d_packet_len_tag_key(pmt::pmt_string_to_symbol(packet_len_tag_key)),
- d_out_len_tag_key(pmt::pmt_string_to_symbol((packet_len_tag_key.empty() ? len_tag_key : packet_len_tag_key))),
+ d_packet_len_tag_key(pmt::string_to_symbol(packet_len_tag_key)),
+ d_out_len_tag_key(pmt::string_to_symbol((packet_len_tag_key.empty() ? len_tag_key : packet_len_tag_key))),
d_symbols_skipped(symbols_skipped % occupied_carriers.size()),
d_curr_set(symbols_skipped % occupied_carriers.size()),
d_symbols_per_set(0)
@@ -127,7 +127,7 @@ namespace gr {
{
add_item_tag(0, nitems_written(0),
d_out_len_tag_key,
- pmt::pmt_from_long(n_produced)
+ pmt::from_long(n_produced)
);
}
@@ -148,11 +148,11 @@ namespace gr {
if (!d_length_tag_key_str.empty()) {
get_tags_in_range(tags, 0, nitems_read(0), nitems_read(0)+1);
for (unsigned i = 0; i < tags.size(); i++) {
- if (pmt::pmt_symbol_to_string(tags[i].key) == "ofdm_sync_carr_offset") {
- carr_offset = pmt::pmt_to_long(tags[i].value);
+ if (pmt::symbol_to_string(tags[i].key) == "ofdm_sync_carr_offset") {
+ carr_offset = pmt::to_long(tags[i].value);
}
if (tags[i].key == d_packet_len_tag_key) {
- packet_length = pmt::pmt_to_long(tags[i].value);
+ packet_length = pmt::to_long(tags[i].value);
remove_item_tag(0, tags[i]);
}
}
diff --git a/gr-digital/lib/packet_header_default.cc b/gr-digital/lib/packet_header_default.cc
index dac57512d3..8906985331 100644
--- a/gr-digital/lib/packet_header_default.cc
+++ b/gr-digital/lib/packet_header_default.cc
@@ -45,8 +45,8 @@ namespace gr {
const std::string &num_tag_key,
int bits_per_byte)
: d_header_len(header_len),
- d_len_tag_key(pmt::pmt_string_to_symbol(len_tag_key)),
- d_num_tag_key(pmt::pmt_string_to_symbol(num_tag_key)),
+ d_len_tag_key(pmt::string_to_symbol(len_tag_key)),
+ d_num_tag_key(pmt::string_to_symbol(num_tag_key)),
d_bits_per_byte(bits_per_byte),
d_header_number(0)
{
@@ -101,7 +101,7 @@ namespace gr {
header_len |= (((int) in[k]) & d_mask) << i;
}
tag.key = d_len_tag_key;
- tag.value = pmt::pmt_from_long(header_len);
+ tag.value = pmt::from_long(header_len);
tags.push_back(tag);
if (k >= d_header_len) {
return true;
@@ -110,7 +110,7 @@ namespace gr {
header_num |= (((int) in[k]) & d_mask) << i;
}
tag.key = d_num_tag_key;
- tag.value = pmt::pmt_from_long(header_num);
+ tag.value = pmt::from_long(header_num);
tags.push_back(tag);
if (k >= d_header_len) {
return true;
diff --git a/gr-digital/lib/packet_header_ofdm.cc b/gr-digital/lib/packet_header_ofdm.cc
index db190c13bb..ed3d3586cb 100644
--- a/gr-digital/lib/packet_header_ofdm.cc
+++ b/gr-digital/lib/packet_header_ofdm.cc
@@ -66,7 +66,7 @@ namespace gr {
len_tag_key,
num_tag_key,
bits_per_sym),
- d_frame_len_tag_key(pmt::pmt_string_to_symbol(frame_len_tag_key)),
+ d_frame_len_tag_key(pmt::string_to_symbol(frame_len_tag_key)),
d_occupied_carriers(occupied_carriers),
d_syms_per_set(0)
{
@@ -89,8 +89,8 @@ namespace gr {
}
int packet_len = 0; // # of OFDM symbols
for (unsigned i = 0; i < tags.size(); i++) {
- if (pmt::pmt_equal(tags[i].key, d_len_tag_key)) {
- packet_len = pmt::pmt_to_long(tags[i].value);
+ if (pmt::equal(tags[i].key, d_len_tag_key)) {
+ packet_len = pmt::to_long(tags[i].value);
break;
}
}
@@ -104,7 +104,7 @@ namespace gr {
}
gr_tag_t tag;
tag.key = d_frame_len_tag_key;
- tag.value = pmt::pmt_from_long(frame_len);
+ tag.value = pmt::from_long(frame_len);
tags.push_back(tag);
return true;
diff --git a/gr-digital/lib/packet_headergenerator_bb_impl.cc b/gr-digital/lib/packet_headergenerator_bb_impl.cc
index 2698977728..bcfaf6b63d 100644
--- a/gr-digital/lib/packet_headergenerator_bb_impl.cc
+++ b/gr-digital/lib/packet_headergenerator_bb_impl.cc
@@ -55,11 +55,11 @@ namespace gr {
: gr_tagged_stream_block("packet_headergenerator_bb_impl",
gr_make_io_signature(1, 1, sizeof (char)),
gr_make_io_signature(1, 1, sizeof (char)),
- pmt::pmt_symbol_to_string(header_formatter->len_tag_key())),
+ pmt::symbol_to_string(header_formatter->len_tag_key())),
d_formatter(header_formatter),
d_input_size(1),
d_header_len(header_formatter->header_len()),
- d_len_tag_value(pmt::pmt_from_long(d_header_len))
+ d_len_tag_value(pmt::from_long(d_header_len))
{
set_output_multiple(d_header_len);
// This is the worst case rate, because we don't know the true value, of course
diff --git a/gr-digital/lib/packet_headerparser_b_impl.cc b/gr-digital/lib/packet_headerparser_b_impl.cc
index 65883f5515..825cfa3d86 100644
--- a/gr-digital/lib/packet_headerparser_b_impl.cc
+++ b/gr-digital/lib/packet_headerparser_b_impl.cc
@@ -75,9 +75,9 @@ namespace gr {
if (!d_header_formatter->header_parser(in, tags)) {
message_port_pub(msg_port_id, pmt::PMT_F);
} else {
- pmt::pmt_t dict(pmt::pmt_make_dict());
+ pmt::pmt_t dict(pmt::make_dict());
for (unsigned i = 0; i < tags.size(); i++) {
- pmt::pmt_dict_add(dict, tags[i].key, tags[i].value);
+ pmt::dict_add(dict, tags[i].key, tags[i].value);
}
message_port_pub(msg_port_id, dict);
}
diff --git a/gr-digital/lib/packet_sink_impl.cc b/gr-digital/lib/packet_sink_impl.cc
new file mode 100644
index 0000000000..1d79b3d717
--- /dev/null
+++ b/gr-digital/lib/packet_sink_impl.cc
@@ -0,0 +1,209 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2010,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "packet_sink_impl.h"
+#include <gr_io_signature.h>
+#include <cstdio>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdexcept>
+#include <blocks/count_bits.h>
+#include <string.h>
+
+namespace gr {
+ namespace digital {
+
+#define VERBOSE 0
+
+// detect access code with up to DEFAULT_THRESHOLD bits wrong
+static const int DEFAULT_THRESHOLD = 12;
+
+ inline void
+ packet_sink_impl::enter_search()
+ {
+ if(VERBOSE)
+ fprintf(stderr, "@ enter_search\n");
+
+ d_state = STATE_SYNC_SEARCH;
+ d_shift_reg = 0;
+ }
+
+ inline void
+ packet_sink_impl::enter_have_sync()
+ {
+ if(VERBOSE)
+ fprintf(stderr, "@ enter_have_sync\n");
+
+ d_state = STATE_HAVE_SYNC;
+ d_header = 0;
+ d_headerbitlen_cnt = 0;
+ }
+
+ inline void
+ packet_sink_impl::enter_have_header(int payload_len)
+ {
+ if(VERBOSE)
+ fprintf(stderr, "@ enter_have_header (payload_len = %d)\n", payload_len);
+
+ d_state = STATE_HAVE_HEADER;
+ d_packetlen = payload_len;
+ d_packetlen_cnt = 0;
+ d_packet_byte = 0;
+ d_packet_byte_index = 0;
+ }
+
+ packet_sink::sptr
+ packet_sink::make(const std::vector<unsigned char>& sync_vector,
+ gr_msg_queue_sptr target_queue, int threshold)
+ {
+ return gnuradio::get_initial_sptr
+ (new packet_sink_impl(sync_vector, target_queue, threshold));
+ }
+
+ packet_sink_impl::packet_sink_impl(const std::vector<unsigned char>& sync_vector,
+ gr_msg_queue_sptr target_queue, int threshold)
+ : gr_sync_block("packet_sink",
+ gr_make_io_signature(1, 1, sizeof(float)),
+ gr_make_io_signature(0, 0, 0)),
+ d_target_queue(target_queue), d_threshold(threshold == -1 ? DEFAULT_THRESHOLD : threshold)
+ {
+ d_sync_vector = 0;
+ for(int i=0;i<8;i++){
+ d_sync_vector <<= 8;
+ d_sync_vector |= sync_vector[i];
+ }
+
+ enter_search();
+ }
+
+ packet_sink_impl::~packet_sink_impl()
+ {
+ }
+
+ int
+ packet_sink_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ float *inbuf = (float*)input_items[0];
+ int count=0;
+
+ if(VERBOSE)
+ fprintf(stderr, ">>> Entering state machine\n"), fflush(stderr);
+
+ while(count<noutput_items) {
+ switch(d_state) {
+
+ case STATE_SYNC_SEARCH: // Look for sync vector
+ if(VERBOSE)
+ fprintf(stderr, "SYNC Search, noutput=%d\n",noutput_items), fflush(stderr);
+
+ while(count < noutput_items) {
+ if(slice(inbuf[count++]))
+ d_shift_reg = (d_shift_reg << 1) | 1;
+ else
+ d_shift_reg = d_shift_reg << 1;
+
+ // Compute popcnt of putative sync vector
+ if(gr::blocks::count_bits64(d_shift_reg ^ d_sync_vector) <= d_threshold) {
+ // Found it, set up for header decode
+ enter_have_sync();
+ break;
+ }
+ }
+ break;
+
+ case STATE_HAVE_SYNC:
+ if(VERBOSE)
+ fprintf(stderr, "Header Search bitcnt=%d, header=0x%08x\n", d_headerbitlen_cnt, d_header),
+ fflush(stderr);
+
+ while(count < noutput_items) { // Shift bits one at a time into header
+ if(slice(inbuf[count++]))
+ d_header = (d_header << 1) | 1;
+ else
+ d_header = d_header << 1;
+
+ if(++d_headerbitlen_cnt == HEADERBITLEN) {
+ if(VERBOSE)
+ fprintf(stderr, "got header: 0x%08x\n", d_header);
+
+ // we have a full header, check to see if it has been received properly
+ if(header_ok()) {
+ int payload_len = header_payload_len();
+ if(payload_len <= MAX_PKT_LEN) // reasonable?
+ enter_have_header(payload_len); // yes.
+ else
+ enter_search(); // no.
+ }
+ else
+ enter_search(); // no.
+ break; // we're in a new state
+ }
+ }
+ break;
+
+ case STATE_HAVE_HEADER:
+ if(VERBOSE)
+ fprintf(stderr,"Packet Build\n"),fflush(stderr);
+
+ while(count < noutput_items) { // shift bits into bytes of packet one at a time
+ if(slice(inbuf[count++]))
+ d_packet_byte = (d_packet_byte << 1) | 1;
+ else
+ d_packet_byte = d_packet_byte << 1;
+
+ if(d_packet_byte_index++ == 7) { // byte is full so move to next byte
+ d_packet[d_packetlen_cnt++] = d_packet_byte;
+ d_packet_byte_index = 0;
+
+ if(d_packetlen_cnt == d_packetlen) { // packet is filled
+ // build a message
+ gr_message_sptr msg = gr_make_message(0, 0, 0, d_packetlen_cnt);
+ memcpy(msg->msg(), d_packet, d_packetlen_cnt);
+
+ d_target_queue->insert_tail(msg); // send it
+ msg.reset(); // free it up
+
+ enter_search();
+ break;
+ }
+ }
+ }
+ break;
+
+ default:
+ assert(0);
+ } // switch
+ } // while
+
+ return noutput_items;
+ }
+
+ } /* namespace digital */
+} /* namespace gr */
diff --git a/gr-digital/lib/packet_sink_impl.h b/gr-digital/lib/packet_sink_impl.h
new file mode 100644
index 0000000000..a63db7a142
--- /dev/null
+++ b/gr-digital/lib/packet_sink_impl.h
@@ -0,0 +1,96 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_PACKET_SINK_IMPL_H
+#define INCLUDED_GR_PACKET_SINK_IMPL_H
+
+#include <digital/packet_sink.h>
+
+namespace gr {
+ namespace digital {
+
+ class packet_sink_impl : public packet_sink
+ {
+ private:
+ enum state_t {STATE_SYNC_SEARCH, STATE_HAVE_SYNC, STATE_HAVE_HEADER};
+
+ static const int MAX_PKT_LEN = 4096;
+ static const int HEADERBITLEN = 32;
+
+ gr_msg_queue_sptr d_target_queue; // where to send the packet when received
+ unsigned long long d_sync_vector; // access code to locate start of packet
+ unsigned int d_threshold; // how many bits may be wrong in sync vector
+
+ state_t d_state;
+
+ unsigned long long d_shift_reg; // used to look for sync_vector
+
+ unsigned int d_header; // header bits
+ int d_headerbitlen_cnt;// how many so far
+
+ unsigned char d_packet[MAX_PKT_LEN]; // assembled payload
+ unsigned char d_packet_byte; // byte being assembled
+ int d_packet_byte_index; // which bit of d_packet_byte we're working on
+ int d_packetlen; // length of packet
+ int d_packetlen_cnt; // how many so far
+
+ protected:
+ void enter_search();
+ void enter_have_sync();
+ void enter_have_header(int payload_len);
+
+ int slice(float x) { return x > 0 ? 1 : 0; }
+
+ bool header_ok()
+ {
+ // confirm that two copies of header info are identical
+ return ((d_header >> 16) ^ (d_header & 0xffff)) == 0;
+ }
+
+ int header_payload_len()
+ {
+ // header consists of two 16-bit shorts in network byte order
+ int t = (d_header >> 16) & 0xffff;
+ return t;
+ }
+
+ public:
+ packet_sink_impl(const std::vector<unsigned char>& sync_vector,
+ gr_msg_queue_sptr target_queue,
+ int threshold=-1);
+ ~packet_sink_impl();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ //! return true if we detect carrier
+ bool carrier_sensed() const
+ {
+ return d_state != STATE_SYNC_SEARCH;
+ }
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_PACKET_SINK_IMPL_H */
diff --git a/gr-digital/lib/pfb_clock_sync_ccf_impl.cc b/gr-digital/lib/pfb_clock_sync_ccf_impl.cc
new file mode 100644
index 0000000000..3c4a0e8ad4
--- /dev/null
+++ b/gr-digital/lib/pfb_clock_sync_ccf_impl.cc
@@ -0,0 +1,505 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009-2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <cstdio>
+#include <cmath>
+
+#include "pfb_clock_sync_ccf_impl.h"
+#include <gr_io_signature.h>
+#include <gr_math.h>
+
+namespace gr {
+ namespace digital {
+
+ pfb_clock_sync_ccf::sptr
+ pfb_clock_sync_ccf::make(double sps, float loop_bw,
+ const std::vector<float> &taps,
+ unsigned int filter_size,
+ float init_phase,
+ float max_rate_deviation,
+ int osps)
+ {
+ return gnuradio::get_initial_sptr
+ (new pfb_clock_sync_ccf_impl(sps, loop_bw, taps,
+ filter_size,
+ init_phase,
+ max_rate_deviation,
+ osps));
+ }
+
+ static int ios[] = {sizeof(gr_complex), sizeof(float), sizeof(float), sizeof(float)};
+ static std::vector<int> iosig(ios, ios+sizeof(ios)/sizeof(int));
+ pfb_clock_sync_ccf_impl::pfb_clock_sync_ccf_impl(double sps, float loop_bw,
+ const std::vector<float> &taps,
+ unsigned int filter_size,
+ float init_phase,
+ float max_rate_deviation,
+ int osps)
+ : gr_block("pfb_clock_sync_ccf",
+ gr_make_io_signature(1, 1, sizeof(gr_complex)),
+ gr_make_io_signaturev(1, 4, iosig)),
+ d_updated(false), d_nfilters(filter_size),
+ d_max_dev(max_rate_deviation),
+ d_osps(osps), d_error(0), d_out_idx(0)
+ {
+ d_nfilters = filter_size;
+ d_sps = floor(sps);
+
+ // Set the damping factor for a critically damped system
+ d_damping = sqrtf(2.0f)/2.0f;
+
+ // Set the bandwidth, which will then call update_gains()
+ set_loop_bandwidth(loop_bw);
+
+ // Store the last filter between calls to work
+ // The accumulator keeps track of overflow to increment the stride correctly.
+ // set it here to the fractional difference based on the initial phaes
+ d_k = init_phase;
+ d_rate = (sps-floor(sps))*(double)d_nfilters;
+ d_rate_i = (int)floor(d_rate);
+ d_rate_f = d_rate - (float)d_rate_i;
+ d_filtnum = (int)floor(d_k);
+
+ d_filters = std::vector<kernel::fir_filter_ccf*>(d_nfilters);
+ d_diff_filters = std::vector<kernel::fir_filter_ccf*>(d_nfilters);
+
+ // Create an FIR filter for each channel and zero out the taps
+ std::vector<float> vtaps(0, d_nfilters);
+ for(int i = 0; i < d_nfilters; i++) {
+ d_filters[i] = new kernel::fir_filter_ccf(1, vtaps);
+ d_diff_filters[i] = new kernel::fir_filter_ccf(1, vtaps);
+ }
+
+ // Now, actually set the filters' taps
+ std::vector<float> dtaps;
+ create_diff_taps(taps, dtaps);
+ set_taps(taps, d_taps, d_filters);
+ set_taps(dtaps, d_dtaps, d_diff_filters);
+ }
+
+ pfb_clock_sync_ccf_impl::~pfb_clock_sync_ccf_impl()
+ {
+ for(int i = 0; i < d_nfilters; i++) {
+ delete d_filters[i];
+ delete d_diff_filters[i];
+ }
+ }
+
+ bool
+ pfb_clock_sync_ccf_impl::check_topology(int ninputs, int noutputs)
+ {
+ return noutputs == 1 || noutputs == 4;
+ }
+
+
+ /*******************************************************************
+ SET FUNCTIONS
+ *******************************************************************/
+
+ void
+ pfb_clock_sync_ccf_impl::set_loop_bandwidth(float bw)
+ {
+ if(bw < 0) {
+ throw std::out_of_range("pfb_clock_sync_ccf: invalid bandwidth. Must be >= 0.");
+ }
+
+ d_loop_bw = bw;
+ update_gains();
+ }
+
+ void
+ pfb_clock_sync_ccf_impl::set_damping_factor(float df)
+ {
+ if(df < 0 || df > 1.0) {
+ throw std::out_of_range("pfb_clock_sync_ccf: invalid damping factor. Must be in [0,1].");
+ }
+
+ d_damping = df;
+ update_gains();
+ }
+
+ void
+ pfb_clock_sync_ccf_impl::set_alpha(float alpha)
+ {
+ if(alpha < 0 || alpha > 1.0) {
+ throw std::out_of_range("pfb_clock_sync_ccf: invalid alpha. Must be in [0,1].");
+ }
+ d_alpha = alpha;
+ }
+
+ void
+ pfb_clock_sync_ccf_impl::set_beta(float beta)
+ {
+ if(beta < 0 || beta > 1.0) {
+ throw std::out_of_range("pfb_clock_sync_ccf: invalid beta. Must be in [0,1].");
+ }
+ d_beta = beta;
+ }
+
+ /*******************************************************************
+ GET FUNCTIONS
+ *******************************************************************/
+
+ float
+ pfb_clock_sync_ccf_impl::loop_bandwidth() const
+ {
+ return d_loop_bw;
+ }
+
+ float
+ pfb_clock_sync_ccf_impl::damping_factor() const
+ {
+ return d_damping;
+ }
+
+ float
+ pfb_clock_sync_ccf_impl::alpha() const
+ {
+ return d_alpha;
+ }
+
+ float
+ pfb_clock_sync_ccf_impl::beta() const
+ {
+ return d_beta;
+ }
+
+ float
+ pfb_clock_sync_ccf_impl::clock_rate() const
+ {
+ return d_rate_f;
+ }
+
+ float
+ pfb_clock_sync_ccf_impl::error() const
+ {
+ return d_error;
+ }
+
+ float
+ pfb_clock_sync_ccf_impl::rate() const
+ {
+ return d_rate_f;
+ }
+
+ float
+ pfb_clock_sync_ccf_impl::phase() const
+ {
+ return d_k;
+ }
+
+ /*******************************************************************
+ *******************************************************************/
+
+ void
+ pfb_clock_sync_ccf_impl::update_gains()
+ {
+ float denom = (1.0 + 2.0*d_damping*d_loop_bw + d_loop_bw*d_loop_bw);
+ d_alpha = (4*d_damping*d_loop_bw) / denom;
+ d_beta = (4*d_loop_bw*d_loop_bw) / denom;
+ }
+
+ void
+ pfb_clock_sync_ccf_impl::set_taps(const std::vector<float> &newtaps,
+ std::vector< std::vector<float> > &ourtaps,
+ std::vector<kernel::fir_filter_ccf*> &ourfilter)
+ {
+ int i,j;
+
+ unsigned int ntaps = newtaps.size();
+ d_taps_per_filter = (unsigned int)ceil((double)ntaps/(double)d_nfilters);
+
+ // Create d_numchan vectors to store each channel's taps
+ ourtaps.resize(d_nfilters);
+
+ // Make a vector of the taps plus fill it out with 0's to fill
+ // each polyphase filter with exactly d_taps_per_filter
+ std::vector<float> tmp_taps;
+ tmp_taps = newtaps;
+ while((float)(tmp_taps.size()) < d_nfilters*d_taps_per_filter) {
+ tmp_taps.push_back(0.0);
+ }
+
+ // Partition the filter
+ for(i = 0; i < d_nfilters; i++) {
+ // Each channel uses all d_taps_per_filter with 0's if not enough taps to fill out
+ ourtaps[i] = std::vector<float>(d_taps_per_filter, 0);
+ for(j = 0; j < d_taps_per_filter; j++) {
+ ourtaps[i][j] = tmp_taps[i + j*d_nfilters];
+ }
+
+ // Build a filter for each channel and add it's taps to it
+ ourfilter[i]->set_taps(ourtaps[i]);
+ }
+
+ // Set the history to ensure enough input items for each filter
+ set_history(d_taps_per_filter + d_sps);
+
+ // Make sure there is enough output space for d_osps outputs/input.
+ set_output_multiple(d_osps);
+
+ d_updated = true;
+ }
+
+ void
+ pfb_clock_sync_ccf_impl::create_diff_taps(const std::vector<float> &newtaps,
+ std::vector<float> &difftaps)
+ {
+ std::vector<float> diff_filter(3);
+ diff_filter[0] = -1;
+ diff_filter[1] = 0;
+ diff_filter[2] = 1;
+
+ float pwr = 0;
+ difftaps.push_back(0);
+ for(unsigned int i = 0; i < newtaps.size()-2; i++) {
+ float tap = 0;
+ for(int j = 0; j < 3; j++) {
+ tap += diff_filter[j]*newtaps[i+j];
+ pwr += fabsf(tap);
+ }
+ difftaps.push_back(tap);
+ }
+ difftaps.push_back(0);
+
+ for(unsigned int i = 0; i < difftaps.size(); i++) {
+ difftaps[i] *= pwr;
+ }
+ }
+
+ std::string
+ pfb_clock_sync_ccf_impl::taps_as_string() const
+ {
+ int i, j;
+ std::stringstream str;
+ str.precision(4);
+ str.setf(std::ios::scientific);
+
+ str << "[ ";
+ for(i = 0; i < d_nfilters; i++) {
+ str << "[" << d_taps[i][0] << ", ";
+ for(j = 1; j < d_taps_per_filter-1; j++) {
+ str << d_taps[i][j] << ", ";
+ }
+ str << d_taps[i][j] << "],";
+ }
+ str << " ]" << std::endl;
+
+ return str.str();
+ }
+
+ std::string
+ pfb_clock_sync_ccf_impl::diff_taps_as_string() const
+ {
+ int i, j;
+ std::stringstream str;
+ str.precision(4);
+ str.setf(std::ios::scientific);
+
+ str << "[ ";
+ for(i = 0; i < d_nfilters; i++) {
+ str << "[" << d_dtaps[i][0] << ", ";
+ for(j = 1; j < d_taps_per_filter-1; j++) {
+ str << d_dtaps[i][j] << ", ";
+ }
+ str << d_dtaps[i][j] << "],";
+ }
+ str << " ]" << std::endl;
+
+ return str.str();
+ }
+
+ std::vector< std::vector<float> >
+ pfb_clock_sync_ccf_impl::taps() const
+ {
+ return d_taps;
+ }
+
+ std::vector< std::vector<float> >
+ pfb_clock_sync_ccf_impl::diff_taps() const
+ {
+ return d_dtaps;
+ }
+
+ std::vector<float>
+ pfb_clock_sync_ccf_impl::channel_taps(int channel) const
+ {
+ std::vector<float> taps;
+ for(int i = 0; i < d_taps_per_filter; i++) {
+ taps.push_back(d_taps[channel][i]);
+ }
+ return taps;
+ }
+
+ std::vector<float>
+ pfb_clock_sync_ccf_impl::diff_channel_taps(int channel) const
+ {
+ std::vector<float> taps;
+ for(int i = 0; i < d_taps_per_filter; i++) {
+ taps.push_back(d_dtaps[channel][i]);
+ }
+ return taps;
+ }
+
+ int
+ pfb_clock_sync_ccf_impl::general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ gr_complex *in = (gr_complex *) input_items[0];
+ gr_complex *out = (gr_complex *) output_items[0];
+
+ float *err = NULL, *outrate = NULL, *outk = NULL;
+ if(output_items.size() == 4) {
+ err = (float *) output_items[1];
+ outrate = (float*)output_items[2];
+ outk = (float*)output_items[3];
+ }
+
+ if(d_updated) {
+ d_updated = false;
+ return 0; // history requirements may have changed.
+ }
+
+ // We need this many to process one output
+ int nrequired = ninput_items[0] - d_taps_per_filter - d_osps;
+
+ int i = 0, count = 0;
+ float error_r, error_i;
+
+ // produce output as long as we can and there are enough input samples
+ while((i < noutput_items) && (count < nrequired)) {
+ while(d_out_idx < d_osps) {
+ d_filtnum = (int)floor(d_k);
+
+ // Keep the current filter number in [0, d_nfilters]
+ // If we've run beyond the last filter, wrap around and go to next sample
+ // If we've go below 0, wrap around and go to previous sample
+ while(d_filtnum >= d_nfilters) {
+ d_k -= d_nfilters;
+ d_filtnum -= d_nfilters;
+ count += 1;
+ }
+ while(d_filtnum < 0) {
+ d_k += d_nfilters;
+ d_filtnum += d_nfilters;
+ count -= 1;
+ }
+
+ out[i+d_out_idx] = d_filters[d_filtnum]->filter(&in[count+d_out_idx]);
+ d_k = d_k + d_rate_i + d_rate_f; // update phase
+ d_out_idx++;
+
+ if(output_items.size() == 4) {
+ err[i] = d_error;
+ outrate[i] = d_rate_f;
+ outk[i] = d_k;
+ }
+
+ // We've run out of output items we can create; return now.
+ if(i+d_out_idx >= noutput_items) {
+ consume_each(count);
+ return i;
+ }
+ }
+
+ // reset here; if we didn't complete a full osps samples last time,
+ // the early return would take care of it.
+ d_out_idx = 0;
+
+ // Update the phase and rate estimates for this symbol
+ gr_complex diff = d_diff_filters[d_filtnum]->filter(&in[count]);
+ error_r = out[i].real() * diff.real();
+ error_i = out[i].imag() * diff.imag();
+ d_error = (error_i + error_r) / 2.0; // average error from I&Q channel
+
+ // Run the control loop to update the current phase (k) and
+ // tracking rate estimates based on the error value
+ d_rate_f = d_rate_f + d_beta*d_error;
+ d_k = d_k + d_alpha*d_error;
+
+ // Keep our rate within a good range
+ d_rate_f = gr_branchless_clip(d_rate_f, d_max_dev);
+
+ i+=d_osps;
+ count += (int)floor(d_sps);
+ }
+
+ consume_each(count);
+ return i;
+ }
+
+ void
+ pfb_clock_sync_ccf_impl::setup_rpc()
+ {
+#ifdef GR_CTRLPORT
+ // Getters
+ add_rpc_variable(
+ rpcbasic_sptr(new rpcbasic_register_get<pfb_clock_sync_ccf, float>(
+ alias(), "error",
+ &pfb_clock_sync_ccf::error,
+ pmt::mp(-2.0f), pmt::mp(2.0f), pmt::mp(0.0f),
+ "", "Error signal of loop", RPC_PRIVLVL_MIN,
+ DISPTIME | DISPOPTSTRIP)));
+
+ add_rpc_variable(
+ rpcbasic_sptr(new rpcbasic_register_get<pfb_clock_sync_ccf, float>(
+ alias(), "rate",
+ &pfb_clock_sync_ccf::rate,
+ pmt::mp(-2.0f), pmt::mp(2.0f), pmt::mp(0.0f),
+ "", "Rate change of phase", RPC_PRIVLVL_MIN,
+ DISPTIME | DISPOPTSTRIP)));
+
+ add_rpc_variable(
+ rpcbasic_sptr(new rpcbasic_register_get<pfb_clock_sync_ccf, float>(
+ alias(), "phase",
+ &pfb_clock_sync_ccf::phase,
+ pmt::mp(0), pmt::mp((int)d_nfilters), pmt::mp(0),
+ "", "Current filter phase arm", RPC_PRIVLVL_MIN,
+ DISPTIME | DISPOPTSTRIP)));
+
+ add_rpc_variable(
+ rpcbasic_sptr(new rpcbasic_register_get<pfb_clock_sync_ccf, float>(
+ alias(), "loop bw",
+ &pfb_clock_sync_ccf::loop_bandwidth,
+ pmt::mp(0.0f), pmt::mp(1.0f), pmt::mp(0.0f),
+ "", "Loop bandwidth",
+ RPC_PRIVLVL_MIN, DISPNULL)));
+
+ // Setters
+ add_rpc_variable(
+ rpcbasic_sptr(new rpcbasic_register_set<pfb_clock_sync_ccf, float>(
+ alias(), "loop bw",
+ &pfb_clock_sync_ccf::set_loop_bandwidth,
+ pmt::mp(0.0f), pmt::mp(1.0f), pmt::mp(0.0f),
+ "", "Loop bandwidth",
+ RPC_PRIVLVL_MIN, DISPNULL)));
+#endif /* GR_CTRLPORT */
+ }
+
+ } /* namespace digital */
+} /* namespace gr */
diff --git a/gr-digital/lib/pfb_clock_sync_ccf_impl.h b/gr-digital/lib/pfb_clock_sync_ccf_impl.h
new file mode 100644
index 0000000000..c7fdc9183e
--- /dev/null
+++ b/gr-digital/lib/pfb_clock_sync_ccf_impl.h
@@ -0,0 +1,121 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009,2010,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_DIGITAL_PFB_CLOCK_SYNC_CCF_IMPL_H
+#define INCLUDED_DIGITAL_PFB_CLOCK_SYNC_CCF_IMPL_H
+
+#include <digital/pfb_clock_sync_ccf.h>
+
+using namespace gr::filter;
+
+namespace gr {
+ namespace digital {
+
+ class pfb_clock_sync_ccf_impl : public pfb_clock_sync_ccf
+ {
+ private:
+ bool d_updated;
+ double d_sps;
+ double d_sample_num;
+ float d_loop_bw;
+ float d_damping;
+ float d_alpha;
+ float d_beta;
+
+ int d_nfilters;
+ int d_taps_per_filter;
+ std::vector<kernel::fir_filter_ccf*> d_filters;
+ std::vector<kernel::fir_filter_ccf*> d_diff_filters;
+ std::vector< std::vector<float> > d_taps;
+ std::vector< std::vector<float> > d_dtaps;
+
+ float d_k;
+ float d_rate;
+ float d_rate_i;
+ float d_rate_f;
+ float d_max_dev;
+ int d_filtnum;
+ int d_osps;
+ float d_error;
+ int d_out_idx;
+
+ void create_diff_taps(const std::vector<float> &newtaps,
+ std::vector<float> &difftaps);
+
+ public:
+ pfb_clock_sync_ccf_impl(double sps, float loop_bw,
+ const std::vector<float> &taps,
+ unsigned int filter_size=32,
+ float init_phase=0,
+ float max_rate_deviation=1.5,
+ int osps=1);
+ ~pfb_clock_sync_ccf_impl();
+
+ void setup_rpc();
+
+ void update_gains();
+
+ void set_taps(const std::vector<float> &taps,
+ std::vector< std::vector<float> > &ourtaps,
+ std::vector<kernel::fir_filter_ccf*> &ourfilter);
+
+ std::vector< std::vector<float> > taps() const;
+ std::vector< std::vector<float> > diff_taps() const;
+ std::vector<float> channel_taps(int channel) const;
+ std::vector<float> diff_channel_taps(int channel) const;
+ std::string taps_as_string() const;
+ std::string diff_taps_as_string() const;
+
+ void set_loop_bandwidth(float bw);
+ void set_damping_factor(float df);
+ void set_alpha(float alpha);
+ void set_beta(float beta);
+ void set_max_rate_deviation(float m)
+ {
+ d_max_dev = m;
+ }
+
+ float loop_bandwidth() const;
+ float damping_factor() const;
+ float alpha() const;
+ float beta() const;
+ float clock_rate() const;
+
+ float error() const;
+ float rate() const;
+ float phase() const;
+
+ /*******************************************************************
+ *******************************************************************/
+
+ bool check_topology(int ninputs, int noutputs);
+
+ int general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_DIGITAL_PFB_CLOCK_SYNC_CCF_IMPL_H */
diff --git a/gr-digital/lib/pfb_clock_sync_fff_impl.cc b/gr-digital/lib/pfb_clock_sync_fff_impl.cc
new file mode 100644
index 0000000000..fb60192324
--- /dev/null
+++ b/gr-digital/lib/pfb_clock_sync_fff_impl.cc
@@ -0,0 +1,435 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009,2010,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <cstdio>
+#include <cmath>
+
+#include "pfb_clock_sync_fff_impl.h"
+#include <gr_io_signature.h>
+#include <gr_math.h>
+
+namespace gr {
+ namespace digital {
+
+ pfb_clock_sync_fff::sptr
+ pfb_clock_sync_fff::make(double sps, float gain,
+ const std::vector<float> &taps,
+ unsigned int filter_size,
+ float init_phase,
+ float max_rate_deviation,
+ int osps)
+ {
+ return gnuradio::get_initial_sptr
+ (new pfb_clock_sync_fff_impl(sps, gain, taps,
+ filter_size,
+ init_phase,
+ max_rate_deviation,
+ osps));
+ }
+
+ static int ios[] = {sizeof(float), sizeof(float), sizeof(float), sizeof(float)};
+ static std::vector<int> iosig(ios, ios+sizeof(ios)/sizeof(int));
+ pfb_clock_sync_fff_impl::pfb_clock_sync_fff_impl(double sps, float loop_bw,
+ const std::vector<float> &taps,
+ unsigned int filter_size,
+ float init_phase,
+ float max_rate_deviation,
+ int osps)
+ : gr_block("pfb_clock_sync_fff",
+ gr_make_io_signature(1, 1, sizeof(float)),
+ gr_make_io_signaturev(1, 4, iosig)),
+ d_updated(false), d_nfilters(filter_size),
+ d_max_dev(max_rate_deviation),
+ d_osps(osps), d_error(0), d_out_idx(0)
+ {
+ d_nfilters = filter_size;
+ d_sps = floor(sps);
+
+ // Set the damping factor for a critically damped system
+ d_damping = sqrtf(2.0f)/2.0f;
+
+ // Set the bandwidth, which will then call update_gains()
+ set_loop_bandwidth(loop_bw);
+
+ // Store the last filter between calls to work
+ // The accumulator keeps track of overflow to increment the stride correctly.
+ // set it here to the fractional difference based on the initial phaes
+ d_k = init_phase;
+ d_rate = (sps-floor(sps))*(double)d_nfilters;
+ d_rate_i = (int)floor(d_rate);
+ d_rate_f = d_rate - (float)d_rate_i;
+ d_filtnum = (int)floor(d_k);
+
+ d_filters = std::vector<kernel::fir_filter_fff*>(d_nfilters);
+ d_diff_filters = std::vector<kernel::fir_filter_fff*>(d_nfilters);
+
+ // Create an FIR filter for each channel and zero out the taps
+ std::vector<float> vtaps(0, d_nfilters);
+ for(int i = 0; i < d_nfilters; i++) {
+ d_filters[i] = new kernel::fir_filter_fff(1, vtaps);
+ d_diff_filters[i] = new kernel::fir_filter_fff(1, vtaps);
+ }
+
+ // Now, actually set the filters' taps
+ std::vector<float> dtaps;
+ create_diff_taps(taps, dtaps);
+ set_taps(taps, d_taps, d_filters);
+ set_taps(dtaps, d_dtaps, d_diff_filters);
+ }
+
+ pfb_clock_sync_fff_impl::~pfb_clock_sync_fff_impl()
+ {
+ for(int i = 0; i < d_nfilters; i++) {
+ delete d_filters[i];
+ delete d_diff_filters[i];
+ }
+ }
+
+ bool
+ pfb_clock_sync_fff_impl::check_topology(int ninputs, int noutputs)
+ {
+ return noutputs == 1 || noutputs == 4;
+ }
+
+ /*******************************************************************
+ SET FUNCTIONS
+ *******************************************************************/
+
+ void
+ pfb_clock_sync_fff_impl::set_loop_bandwidth(float bw)
+ {
+ if(bw < 0) {
+ throw std::out_of_range("pfb_clock_sync_fff_impl: invalid bandwidth. Must be >= 0.");
+ }
+
+ d_loop_bw = bw;
+ update_gains();
+ }
+
+ void
+ pfb_clock_sync_fff_impl::set_damping_factor(float df)
+ {
+ if(df < 0 || df > 1.0) {
+ throw std::out_of_range("pfb_clock_sync_fff_impl: invalid damping factor. Must be in [0,1].");
+ }
+
+ d_damping = df;
+ update_gains();
+ }
+
+ void
+ pfb_clock_sync_fff_impl::set_alpha(float alpha)
+ {
+ if(alpha < 0 || alpha > 1.0) {
+ throw std::out_of_range("pfb_clock_sync_fff_impl: invalid alpha. Must be in [0,1].");
+ }
+ d_alpha = alpha;
+ }
+
+ void
+ pfb_clock_sync_fff_impl::set_beta(float beta)
+ {
+ if(beta < 0 || beta > 1.0) {
+ throw std::out_of_range("pfb_clock_sync_fff_impl: invalid beta. Must be in [0,1].");
+ }
+ d_beta = beta;
+ }
+
+ /*******************************************************************
+ GET FUNCTIONS
+ *******************************************************************/
+
+ float
+ pfb_clock_sync_fff_impl::loop_bandwidth() const
+ {
+ return d_loop_bw;
+ }
+
+ float
+ pfb_clock_sync_fff_impl::damping_factor() const
+ {
+ return d_damping;
+ }
+
+ float
+ pfb_clock_sync_fff_impl::alpha() const
+ {
+ return d_alpha;
+ }
+
+ float
+ pfb_clock_sync_fff_impl::beta() const
+ {
+ return d_beta;
+ }
+
+ float
+ pfb_clock_sync_fff_impl::clock_rate() const
+ {
+ return d_rate_f;
+ }
+
+ /*******************************************************************
+ *******************************************************************/
+
+ void
+ pfb_clock_sync_fff_impl::update_gains()
+ {
+ float denom = (1.0 + 2.0*d_damping*d_loop_bw + d_loop_bw*d_loop_bw);
+ d_alpha = (4*d_damping*d_loop_bw) / denom;
+ d_beta = (4*d_loop_bw*d_loop_bw) / denom;
+ }
+
+ void
+ pfb_clock_sync_fff_impl::set_taps(const std::vector<float> &newtaps,
+ std::vector< std::vector<float> > &ourtaps,
+ std::vector<kernel::fir_filter_fff*> &ourfilter)
+ {
+ int i,j;
+
+ unsigned int ntaps = newtaps.size();
+ d_taps_per_filter = (unsigned int)ceil((double)ntaps/(double)d_nfilters);
+
+ // Create d_numchan vectors to store each channel's taps
+ ourtaps.resize(d_nfilters);
+
+ // Make a vector of the taps plus fill it out with 0's to fill
+ // each polyphase filter with exactly d_taps_per_filter
+ std::vector<float> tmp_taps;
+ tmp_taps = newtaps;
+ while((float)(tmp_taps.size()) < d_nfilters*d_taps_per_filter) {
+ tmp_taps.push_back(0.0);
+ }
+
+ // Partition the filter
+ for(i = 0; i < d_nfilters; i++) {
+ // Each channel uses all d_taps_per_filter with 0's if not enough taps to fill out
+ ourtaps[i] = std::vector<float>(d_taps_per_filter, 0);
+ for(j = 0; j < d_taps_per_filter; j++) {
+ ourtaps[i][j] = tmp_taps[i + j*d_nfilters];
+ }
+
+ // Build a filter for each channel and add it's taps to it
+ ourfilter[i]->set_taps(ourtaps[i]);
+ }
+
+ // Set the history to ensure enough input items for each filter
+ set_history(d_taps_per_filter + d_sps);
+
+ // Make sure there is enough output space for d_osps outputs/input.
+ set_output_multiple(d_osps);
+
+ d_updated = true;
+ }
+
+ void
+ pfb_clock_sync_fff_impl::create_diff_taps(const std::vector<float> &newtaps,
+ std::vector<float> &difftaps)
+ {
+ std::vector<float> diff_filter(3);
+ diff_filter[0] = -1;
+ diff_filter[1] = 0;
+ diff_filter[2] = 1;
+
+ float pwr = 0;
+ difftaps.push_back(0);
+ for(unsigned int i = 0; i < newtaps.size()-2; i++) {
+ float tap = 0;
+ for(int j = 0; j < 3; j++) {
+ tap += diff_filter[j]*newtaps[i+j];
+ pwr += fabsf(tap);
+ }
+ difftaps.push_back(tap);
+ }
+ difftaps.push_back(0);
+
+ for(unsigned int i = 0; i < difftaps.size(); i++) {
+ difftaps[i] *= pwr;
+ }
+ }
+
+ std::string
+ pfb_clock_sync_fff_impl::taps_as_string() const
+ {
+ int i, j;
+ std::stringstream str;
+ str.precision(4);
+ str.setf(std::ios::scientific);
+
+ str << "[ ";
+ for(i = 0; i < d_nfilters; i++) {
+ str << "[" << d_taps[i][0] << ", ";
+ for(j = 1; j < d_taps_per_filter-1; j++) {
+ str << d_taps[i][j] << ", ";
+ }
+ str << d_taps[i][j] << "],";
+ }
+ str << " ]" << std::endl;
+
+ return str.str();
+ }
+
+ std::string
+ pfb_clock_sync_fff_impl::diff_taps_as_string() const
+ {
+ int i, j;
+ std::stringstream str;
+ str.precision(4);
+ str.setf(std::ios::scientific);
+
+ str << "[ ";
+ for(i = 0; i < d_nfilters; i++) {
+ str << "[" << d_dtaps[i][0] << ", ";
+ for(j = 1; j < d_taps_per_filter-1; j++) {
+ str << d_dtaps[i][j] << ", ";
+ }
+ str << d_dtaps[i][j] << "],";
+ }
+ str << " ]" << std::endl;
+
+ return str.str();
+ }
+
+ std::vector< std::vector<float> >
+ pfb_clock_sync_fff_impl::taps() const
+ {
+ return d_taps;
+ }
+
+ std::vector< std::vector<float> >
+ pfb_clock_sync_fff_impl::diff_taps() const
+ {
+ return d_dtaps;
+ }
+
+ std::vector<float>
+ pfb_clock_sync_fff_impl::channel_taps(int channel) const
+ {
+ std::vector<float> taps;
+ for(int i = 0; i < d_taps_per_filter; i++) {
+ taps.push_back(d_taps[channel][i]);
+ }
+ return taps;
+ }
+
+ std::vector<float>
+ pfb_clock_sync_fff_impl::diff_channel_taps(int channel) const
+ {
+ std::vector<float> taps;
+ for(int i = 0; i < d_taps_per_filter; i++) {
+ taps.push_back(d_dtaps[channel][i]);
+ }
+ return taps;
+ }
+
+ int
+ pfb_clock_sync_fff_impl::general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ float *in = (float *) input_items[0];
+ float *out = (float *) output_items[0];
+
+ float *err = NULL, *outrate = NULL, *outk = NULL;
+ if(output_items.size() == 4) {
+ err = (float *) output_items[1];
+ outrate = (float*)output_items[2];
+ outk = (float*)output_items[3];
+ }
+
+ if(d_updated) {
+ d_updated = false;
+ return 0; // history requirements may have changed.
+ }
+
+ // We need this many to process one output
+ int nrequired = ninput_items[0] - d_taps_per_filter - d_osps;
+
+ int i = 0, count = 0;
+
+ // produce output as long as we can and there are enough input samples
+ while((i < noutput_items) && (count < nrequired)) {
+ while(d_out_idx < d_osps) {
+ d_filtnum = (int)floor(d_k);
+
+ // Keep the current filter number in [0, d_nfilters]
+ // If we've run beyond the last filter, wrap around and go to next sample
+ // If we've go below 0, wrap around and go to previous sample
+ while(d_filtnum >= d_nfilters) {
+ d_k -= d_nfilters;
+ d_filtnum -= d_nfilters;
+ count += 1;
+ }
+ while(d_filtnum < 0) {
+ d_k += d_nfilters;
+ d_filtnum += d_nfilters;
+ count -= 1;
+ }
+
+ out[i+d_out_idx] = d_filters[d_filtnum]->filter(&in[count+d_out_idx]);
+ d_k = d_k + d_rate_i + d_rate_f; // update phase
+ d_out_idx++;
+
+ if(output_items.size() == 4) {
+ err[i] = d_error;
+ outrate[i] = d_rate_f;
+ outk[i] = d_k;
+ }
+
+ // We've run out of output items we can create; return now.
+ if(i+d_out_idx >= noutput_items) {
+ consume_each(count);
+ return i;
+ }
+ }
+
+ // reset here; if we didn't complete a full osps samples last time,
+ // the early return would take care of it.
+ d_out_idx = 0;
+
+ // Update the phase and rate estimates for this symbol
+ float diff = d_diff_filters[d_filtnum]->filter(&in[count]);
+ d_error = out[i] * diff;
+
+ // Run the control loop to update the current phase (k) and
+ // tracking rate estimates based on the error value
+ d_rate_f = d_rate_f + d_beta*d_error;
+ d_k = d_k + d_alpha*d_error;
+
+ // Keep our rate within a good range
+ d_rate_f = gr_branchless_clip(d_rate_f, d_max_dev);
+
+ i+=d_osps;
+ count += (int)floor(d_sps);
+ }
+
+ consume_each(count);
+ return i;
+ }
+
+ } /* namespace digital */
+} /* namespace gr */
diff --git a/gr-digital/lib/pfb_clock_sync_fff_impl.h b/gr-digital/lib/pfb_clock_sync_fff_impl.h
new file mode 100644
index 0000000000..2ade1e646f
--- /dev/null
+++ b/gr-digital/lib/pfb_clock_sync_fff_impl.h
@@ -0,0 +1,112 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009,2010,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_DIGITAL_PFB_CLOCK_SYNC_FFF_IMPL_H
+#define INCLUDED_DIGITAL_PFB_CLOCK_SYNC_FFF_IMPL_H
+
+#include <digital/pfb_clock_sync_fff.h>
+
+using namespace gr::filter;
+
+namespace gr {
+ namespace digital {
+
+ class pfb_clock_sync_fff_impl : public pfb_clock_sync_fff
+ {
+ private:
+ bool d_updated;
+ double d_sps;
+ double d_sample_num;
+ float d_loop_bw;
+ float d_damping;
+ float d_alpha;
+ float d_beta;
+
+ int d_nfilters;
+ int d_taps_per_filter;
+ std::vector<kernel::fir_filter_fff*> d_filters;
+ std::vector<kernel::fir_filter_fff*> d_diff_filters;
+ std::vector< std::vector<float> > d_taps;
+ std::vector< std::vector<float> > d_dtaps;
+
+ float d_k;
+ float d_rate;
+ float d_rate_i;
+ float d_rate_f;
+ float d_max_dev;
+ int d_filtnum;
+ int d_osps;
+ float d_error;
+ int d_out_idx;
+
+ void create_diff_taps(const std::vector<float> &newtaps,
+ std::vector<float> &difftaps);
+
+ public:
+ pfb_clock_sync_fff_impl(double sps, float gain,
+ const std::vector<float> &taps,
+ unsigned int filter_size=32,
+ float init_phase=0,
+ float max_rate_deviation=1.5,
+ int osps=1);
+ ~pfb_clock_sync_fff_impl();
+
+ void update_gains();
+
+ void set_taps(const std::vector<float> &taps,
+ std::vector< std::vector<float> > &ourtaps,
+ std::vector<kernel::fir_filter_fff*> &ourfilter);
+
+ std::vector< std::vector<float> > taps() const;
+ std::vector< std::vector<float> > diff_taps() const;
+ std::vector<float> channel_taps(int channel) const;
+ std::vector<float> diff_channel_taps(int channel) const;
+ std::string taps_as_string() const;
+ std::string diff_taps_as_string() const;
+
+ void set_loop_bandwidth(float bw);
+ void set_damping_factor(float df);
+ void set_alpha(float alpha);
+ void set_beta(float beta);
+ void set_max_rate_deviation(float m)
+ {
+ d_max_dev = m;
+ }
+
+ float loop_bandwidth() const;
+ float damping_factor() const;
+ float alpha() const;
+ float beta() const;
+ float clock_rate() const;
+
+ bool check_topology(int ninputs, int noutputs);
+
+ int general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_DIGITAL_PFB_CLOCK_SYNC_FFF_IMPL_H */
diff --git a/gr-digital/lib/pn_correlator_cc_impl.cc b/gr-digital/lib/pn_correlator_cc_impl.cc
new file mode 100644
index 0000000000..da0bdbefe9
--- /dev/null
+++ b/gr-digital/lib/pn_correlator_cc_impl.cc
@@ -0,0 +1,86 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,2010,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "pn_correlator_cc_impl.h"
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace digital {
+
+ pn_correlator_cc::sptr
+ pn_correlator_cc::make(int degree, int mask, int seed)
+ {
+ return gnuradio::get_initial_sptr
+ (new pn_correlator_cc_impl(degree, mask, seed));
+ }
+
+ pn_correlator_cc_impl::pn_correlator_cc_impl(int degree,
+ int mask,
+ int seed)
+ : gr_sync_decimator("pn_correlator_cc",
+ gr_make_io_signature(1, 1, sizeof(gr_complex)),
+ gr_make_io_signature(1, 1, sizeof(gr_complex)),
+ (unsigned int)((1ULL << degree)-1)) // PN code length
+ {
+ d_len = (unsigned int)((1ULL << degree)-1);
+ if(mask == 0)
+ mask = glfsr::glfsr_mask(degree);
+ d_reference = new glfsr(mask, seed);
+ for(int i = 0; i < d_len; i++) // initialize to last value in sequence
+ d_pn = 2.0*d_reference->next_bit()-1.0;
+ }
+
+ pn_correlator_cc_impl::~pn_correlator_cc_impl()
+ {
+ delete d_reference;
+ }
+
+ int
+ pn_correlator_cc_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const gr_complex *in = (const gr_complex*)input_items[0];
+ gr_complex *out = (gr_complex*)output_items[0];
+ gr_complex sum;
+
+ for(int i = 0; i < noutput_items; i++) {
+ sum = 0.0;
+
+ for(int j = 0; j < d_len; j++) {
+ if(j != 0) // retard PN generator one sample per period
+ d_pn = 2.0*d_reference->next_bit()-1.0; // no conditionals
+ sum += *in++ * d_pn;
+ }
+
+ *out++ = sum*gr_complex(1.0/d_len, 0.0);
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace digital */
+} /* namespace gr */
diff --git a/gr-digital/swig/digital_glfsr_source_f.i b/gr-digital/lib/pn_correlator_cc_impl.h
index 4d94d8cd49..bea9a30505 100644
--- a/gr-digital/swig/digital_glfsr_source_f.i
+++ b/gr-digital/lib/pn_correlator_cc_impl.h
@@ -20,16 +20,32 @@
* Boston, MA 02110-1301, USA.
*/
-GR_SWIG_BLOCK_MAGIC(digital,glfsr_source_f);
+#ifndef INCLUDED_GR_PN_CORRELATOR_CC_IMPL_H
+#define INCLUDED_GR_PN_CORRELATOR_CC_IMPL_H
-digital_glfsr_source_f_sptr
-digital_make_glfsr_source_f(int degree, bool repeat=true,
- int mask=0, int seed=1)
- throw (std::runtime_error);
+#include <digital/pn_correlator_cc.h>
+#include <digital/glfsr.h>
-class digital_glfsr_source_f : public gr_sync_block
-{
-public:
- unsigned int period() const;
- int mask() const;
-};
+namespace gr {
+ namespace digital {
+
+ class pn_correlator_cc_impl : public pn_correlator_cc
+ {
+ private:
+ int d_len;
+ float d_pn;
+ glfsr *d_reference;
+
+ public:
+ pn_correlator_cc_impl(int degree, int mask=0, int seed=1);
+ ~pn_correlator_cc_impl();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_PN_CORRELATOR_CC_IMPL_H */
diff --git a/gr-digital/lib/probe_density_b_impl.cc b/gr-digital/lib/probe_density_b_impl.cc
new file mode 100644
index 0000000000..532930ad1b
--- /dev/null
+++ b/gr-digital/lib/probe_density_b_impl.cc
@@ -0,0 +1,73 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2010,2012 Free Software Foundation, Inc.
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "probe_density_b_impl.h"
+#include <gr_io_signature.h>
+#include <iostream>
+
+namespace gr {
+ namespace digital {
+
+ probe_density_b::sptr
+ probe_density_b::make(double alpha)
+ {
+ return gnuradio::get_initial_sptr
+ (new probe_density_b_impl(alpha));
+ }
+
+ probe_density_b_impl::probe_density_b_impl(double alpha)
+ : gr_sync_block("density_b",
+ gr_make_io_signature(1, 1, sizeof(char)),
+ gr_make_io_signature(0, 0, 0))
+ {
+ set_alpha(alpha);
+ d_density = 1.0;
+ }
+
+ probe_density_b_impl::~probe_density_b_impl()
+ {
+ }
+
+ void
+ probe_density_b_impl::set_alpha(double alpha)
+ {
+ d_alpha = alpha;
+ d_beta = 1.0-d_alpha;
+ }
+
+ int
+ probe_density_b_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const char *in = (const char *)input_items[0];
+
+ for(int i = 0; i < noutput_items; i++)
+ d_density = d_alpha*(double)in[i] + d_beta*d_density;
+
+ return noutput_items;
+ }
+
+ } /* namespace digital */
+} /* namespace gr */
diff --git a/gr-digital/lib/probe_density_b_impl.h b/gr-digital/lib/probe_density_b_impl.h
new file mode 100644
index 0000000000..e792403dc5
--- /dev/null
+++ b/gr-digital/lib/probe_density_b_impl.h
@@ -0,0 +1,58 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2012 Free Software Foundation, Inc.
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_PROBE_DENSITY_B_IMPL_H
+#define INCLUDED_GR_PROBE_DENSITY_B_IMPL_H
+
+#include <digital/probe_density_b.h>
+
+namespace gr {
+ namespace digital {
+
+ class probe_density_b_impl : public probe_density_b
+ {
+ private:
+ double d_alpha;
+ double d_beta;
+ double d_density;
+
+ public:
+ probe_density_b_impl(double alpha);
+ ~probe_density_b_impl();
+
+ /*!
+ * \brief Returns the current density value
+ */
+ double density() const { return d_density; }
+
+ /*!
+ * \brief Set the average filter constant
+ */
+ void set_alpha(double alpha);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_PROBE_DENSITY_B_IMPL_H */
diff --git a/gr-digital/lib/probe_mpsk_snr_est_c_impl.cc b/gr-digital/lib/probe_mpsk_snr_est_c_impl.cc
new file mode 100644
index 0000000000..fb71bdc110
--- /dev/null
+++ b/gr-digital/lib/probe_mpsk_snr_est_c_impl.cc
@@ -0,0 +1,157 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "probe_mpsk_snr_est_c_impl.h"
+#include <gr_io_signature.h>
+#include <cstdio>
+
+namespace gr {
+ namespace digital {
+
+ probe_mpsk_snr_est_c::sptr
+ probe_mpsk_snr_est_c::make(snr_est_type_t type,
+ int msg_nsamples,
+ double alpha)
+ {
+ return gnuradio::get_initial_sptr
+ (new probe_mpsk_snr_est_c_impl(type, msg_nsamples, alpha));
+ }
+
+ probe_mpsk_snr_est_c_impl::probe_mpsk_snr_est_c_impl(snr_est_type_t type,
+ int msg_nsamples,
+ double alpha)
+ : gr_sync_block("probe_mpsk_snr_est_c",
+ gr_make_io_signature(1, 1, sizeof(gr_complex)),
+ gr_make_io_signature(0, 0, 0))
+ {
+ d_snr_est = NULL;
+
+ d_type = type;
+ d_nsamples = msg_nsamples;
+ d_count = 0;
+ set_alpha(alpha);
+
+ set_type(type);
+
+ // at least 1 estimator has to look back
+ set_history(2);
+
+ d_key = pmt::string_to_symbol("snr");
+ }
+
+ probe_mpsk_snr_est_c_impl::~probe_mpsk_snr_est_c_impl()
+ {
+ if(d_snr_est)
+ delete d_snr_est;
+ }
+
+ int
+ probe_mpsk_snr_est_c_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const gr_complex *in = (const gr_complex*)input_items[0];
+ return d_snr_est->update(noutput_items, in);
+ }
+
+ double
+ probe_mpsk_snr_est_c_impl::snr()
+ {
+ if(d_snr_est)
+ return d_snr_est->snr();
+ else
+ throw std::runtime_error("probe_mpsk_snr_est_c_impl:: No SNR estimator defined.\n");
+ }
+
+ snr_est_type_t
+ probe_mpsk_snr_est_c_impl::type() const
+ {
+ return d_type;
+ }
+
+ int
+ probe_mpsk_snr_est_c_impl::msg_nsample() const
+ {
+ return d_nsamples;
+ }
+
+ double
+ probe_mpsk_snr_est_c_impl::alpha() const
+ {
+ return d_alpha;
+ }
+
+ void
+ probe_mpsk_snr_est_c_impl::set_type(snr_est_type_t t)
+ {
+ d_type = t;
+
+ if(d_snr_est)
+ delete d_snr_est;
+
+ switch (d_type) {
+ case(SNR_EST_SIMPLE):
+ d_snr_est = new mpsk_snr_est_simple(d_alpha);
+ break;
+ case(SNR_EST_SKEW):
+ d_snr_est = new mpsk_snr_est_skew(d_alpha);
+ break;
+ case(SNR_EST_M2M4):
+ d_snr_est = new mpsk_snr_est_m2m4(d_alpha);
+ break;
+ case(SNR_EST_SVR):
+ d_snr_est = new mpsk_snr_est_svr(d_alpha);
+ break;
+ default:
+ throw std::invalid_argument("probe_mpsk_snr_est_c_impl: unknown type specified.\n");
+ }
+ }
+
+ void
+ probe_mpsk_snr_est_c_impl::set_msg_nsample(int n)
+ {
+ if(n > 0) {
+ d_nsamples = n;
+ d_count = 0; // reset state
+ }
+ else
+ throw std::invalid_argument("probe_mpsk_snr_est_c_impl: msg_nsamples can't be <= 0\n");
+ }
+
+ void
+ probe_mpsk_snr_est_c_impl::set_alpha(double alpha)
+ {
+ if((alpha >= 0) && (alpha <= 1.0)) {
+ d_alpha = alpha;
+ if(d_snr_est)
+ d_snr_est->set_alpha(d_alpha);
+ }
+ else
+ throw std::invalid_argument("probe_mpsk_snr_est_c_impl: alpha must be in [0,1]\n");
+ }
+
+ } /* namespace digital */
+} /* namespace gr */
diff --git a/gr-digital/lib/probe_mpsk_snr_est_c_impl.h b/gr-digital/lib/probe_mpsk_snr_est_c_impl.h
new file mode 100644
index 0000000000..90da85d21b
--- /dev/null
+++ b/gr-digital/lib/probe_mpsk_snr_est_c_impl.h
@@ -0,0 +1,78 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_DIGITAL_PROBE_MPSK_SNR_EST_C_IMPL_H
+#define INCLUDED_DIGITAL_PROBE_MPSK_SNR_EST_C_IMPL_H
+
+#include <digital/probe_mpsk_snr_est_c.h>
+
+namespace gr {
+ namespace digital {
+
+ class probe_mpsk_snr_est_c_impl : public probe_mpsk_snr_est_c
+ {
+ private:
+ snr_est_type_t d_type;
+ int d_nsamples, d_count;
+ double d_alpha;
+ mpsk_snr_est *d_snr_est;
+
+ //d_key is the message name, 'snr'
+ pmt::pmt_t d_key;
+
+ public:
+ probe_mpsk_snr_est_c_impl(snr_est_type_t type,
+ int msg_nsamples=10000,
+ double alpha=0.001);
+
+ ~probe_mpsk_snr_est_c_impl();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ //! Return the estimated signal-to-noise ratio in decibels
+ double snr();
+
+ //! Return the type of estimator in use
+ snr_est_type_t type() const;
+
+ //! Return how many samples between SNR messages
+ int msg_nsample() const;
+
+ //! Get the running-average coefficient
+ double alpha() const;
+
+ //! Set type of estimator to use
+ void set_type(snr_est_type_t t);
+
+ //! Set the number of samples between SNR messages
+ void set_msg_nsample(int n);
+
+ //! Set the running-average coefficient
+ void set_alpha(double alpha);
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_DIGITAL_PROBE_MPSK_SNR_EST_C_IMPL_H */
diff --git a/gr-digital/lib/scrambler_bb_impl.cc b/gr-digital/lib/scrambler_bb_impl.cc
new file mode 100644
index 0000000000..d656fe2430
--- /dev/null
+++ b/gr-digital/lib/scrambler_bb_impl.cc
@@ -0,0 +1,68 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2010,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "scrambler_bb_impl.h"
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace digital {
+
+ scrambler_bb::sptr
+ scrambler_bb::make(int mask, int seed, int len)
+ {
+ return gnuradio::get_initial_sptr
+ (new scrambler_bb_impl(mask, seed, len));
+ }
+
+ scrambler_bb_impl::scrambler_bb_impl(int mask, int seed, int len)
+ : gr_sync_block("scrambler_bb",
+ gr_make_io_signature(1, 1, sizeof(unsigned char)),
+ gr_make_io_signature(1, 1, sizeof(unsigned char))),
+ d_lfsr(mask, seed, len)
+ {
+ }
+
+ scrambler_bb_impl::~scrambler_bb_impl()
+ {
+ }
+
+ int
+ scrambler_bb_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const unsigned char *in = (const unsigned char*)input_items[0];
+ unsigned char *out = (unsigned char*)output_items[0];
+
+ for(int i = 0; i < noutput_items; i++) {
+ out[i] = d_lfsr.next_bit_scramble(in[i]);
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace digital */
+} /* namespace gr */
diff --git a/gr-digital/swig/digital_descrambler_bb.i b/gr-digital/lib/scrambler_bb_impl.h
index 59de806fba..8525e7ef5c 100644
--- a/gr-digital/swig/digital_descrambler_bb.i
+++ b/gr-digital/lib/scrambler_bb_impl.h
@@ -20,11 +20,31 @@
* Boston, MA 02110-1301, USA.
*/
-GR_SWIG_BLOCK_MAGIC(digital,descrambler_bb);
+#ifndef INCLUDED_GR_SCRAMBLER_BB_IMPL_H
+#define INCLUDED_GR_SCRAMBLER_BB_IMPL_H
-digital_descrambler_bb_sptr
-digital_make_descrambler_bb(int mask, int seed, int len);
+#include <digital/scrambler_bb.h>
+#include <gr_sync_block.h>
+#include <digital/lfsr.h>
-class digital_descrambler_bb : public gr_sync_block
-{
-};
+namespace gr {
+ namespace digital {
+
+ class scrambler_bb_impl : public scrambler_bb
+ {
+ private:
+ digital::lfsr d_lfsr;
+
+ public:
+ scrambler_bb_impl(int mask, int seed, int len);
+ ~scrambler_bb_impl();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_SCRAMBLER_BB_IMPL_H */
diff --git a/gr-digital/lib/simple_correlator_impl.cc b/gr-digital/lib/simple_correlator_impl.cc
new file mode 100644
index 0000000000..6b35b4cf0d
--- /dev/null
+++ b/gr-digital/lib/simple_correlator_impl.cc
@@ -0,0 +1,237 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2010,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "simple_correlator_impl.h"
+#include <digital/simple_framer_sync.h>
+#include <gr_io_signature.h>
+#include <blocks/count_bits.h>
+#include <assert.h>
+#include <stdexcept>
+#include <string.h>
+#include <cstdio>
+
+namespace gr {
+ namespace digital {
+
+ static const int THRESHOLD = 3;
+
+ simple_correlator::sptr
+ simple_correlator::make(int payload_bytesize)
+ {
+ return gnuradio::get_initial_sptr
+ (new simple_correlator_impl(payload_bytesize));
+ }
+
+ simple_correlator_impl::simple_correlator_impl(int payload_bytesize)
+ : gr_block("simple_correlator",
+ gr_make_io_signature(1, 1, sizeof(float)),
+ gr_make_io_signature(1, 1, sizeof(unsigned char))),
+ d_payload_bytesize(payload_bytesize),
+ d_state(ST_LOOKING), d_osi(0),
+ d_bblen((payload_bytesize + GRSF_PAYLOAD_OVERHEAD) * GRSF_BITS_PER_BYTE),
+ d_bitbuf(new unsigned char[d_bblen]),
+ d_pktbuf(new unsigned char[d_bblen/GRSF_BITS_PER_BYTE]),
+ d_bbi(0)
+ {
+ d_avbi = 0;
+ d_accum = 0.0;
+ d_avg = 0.0;
+ for(int i = 0; i < AVG_PERIOD; i++)
+ d_avgbuf[i] = 0.0;
+
+#ifdef DEBUG_SIMPLE_CORRELATOR
+ d_debug_fp = fopen("corr.log", "w");
+#endif
+ enter_looking();
+ }
+
+ simple_correlator_impl::~simple_correlator_impl()
+ {
+#ifdef DEBUG_SIMPLE_CORRELATOR
+ fclose(d_debug_fp);
+#endif
+ delete [] d_bitbuf;
+ delete [] d_pktbuf;
+ }
+
+ void
+ simple_correlator_impl::enter_looking()
+ {
+ fflush(stdout);
+ // fprintf(stderr, ">>> enter_looking\n");
+ d_state = ST_LOOKING;
+ for(int i = 0; i < OVERSAMPLE; i++)
+ d_shift_reg[i] = 0;
+ d_osi = 0;
+
+ d_avbi = 0;
+ d_avg = d_avg * 0.5;
+ d_accum = 0;
+ for(int i = 0; i < AVG_PERIOD; i++)
+ d_avgbuf[i] = 0.0;
+ }
+
+ void
+ simple_correlator_impl::enter_under_threshold()
+ {
+ fflush(stdout);
+ // fprintf(stderr, ">>> enter_under_threshold\n");
+ d_state = ST_UNDER_THRESHOLD;
+ d_transition_osi = d_osi;
+ }
+
+ void
+ simple_correlator_impl::enter_locked()
+ {
+ d_state = ST_LOCKED;
+ int delta = sub_index(d_osi, d_transition_osi);
+ d_center_osi = add_index(d_transition_osi, delta/2);
+ //d_center_osi = add_index(d_center_osi, 3); // FIXME
+ d_bbi = 0;
+ fflush(stdout);
+ // fprintf(stderr, ">>> enter_locked d_center_osi = %d\n", d_center_osi);
+
+ d_avg = std::max(-1.0, std::min(1.0, d_accum * (1.0/AVG_PERIOD)));
+ // fprintf(stderr, ">>> enter_locked d_avg = %g\n", d_avg);
+ }
+
+ static void
+ packit(unsigned char *pktbuf, const unsigned char *bitbuf, int bitcount)
+ {
+ for(int i = 0; i < bitcount; i += 8) {
+ int t = bitbuf[i+0] & 0x1;
+ t = (t << 1) | (bitbuf[i+1] & 0x1);
+ t = (t << 1) | (bitbuf[i+2] & 0x1);
+ t = (t << 1) | (bitbuf[i+3] & 0x1);
+ t = (t << 1) | (bitbuf[i+4] & 0x1);
+ t = (t << 1) | (bitbuf[i+5] & 0x1);
+ t = (t << 1) | (bitbuf[i+6] & 0x1);
+ t = (t << 1) | (bitbuf[i+7] & 0x1);
+ *pktbuf++ = t;
+ }
+ }
+
+ void
+ simple_correlator_impl::update_avg(float x)
+ {
+ d_accum -= d_avgbuf[d_avbi];
+ d_avgbuf[d_avbi] = x;
+ d_accum += x;
+ d_avbi = (d_avbi + 1) & (AVG_PERIOD-1);
+ }
+
+ int
+ simple_correlator_impl::general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const float *in = (const float*)input_items[0];
+ unsigned char *out = (unsigned char*)output_items[0];
+
+ int n = 0;
+ int nin = ninput_items[0];
+ int decision;
+ int hamming_dist;
+
+#ifdef DEBUG_SIMPLE_CORRELATOR
+ struct debug_data {
+ float raw_data;
+ float sampled;
+ float enter_locked;
+ } debug_data;
+#endif
+
+ while(n < nin) {
+
+#ifdef DEBUG_SIMPLE_CORRELATOR
+ debug_data.raw_data = in[n];
+ debug_data.sampled = 0.0;
+ debug_data.enter_locked = 0.0;
+#endif
+
+ switch(d_state) {
+ case ST_LOCKED:
+ if(d_osi == d_center_osi) {
+
+#ifdef DEBUG_SIMPLE_CORRELATOR
+ debug_data.sampled = 1.0;
+#endif
+ decision = slice(in[n]);
+
+ d_bitbuf[d_bbi] = decision;
+ d_bbi++;
+ if(d_bbi >= d_bblen) {
+ // printf("got whole packet\n");
+ packit(d_pktbuf, d_bitbuf, d_bbi);
+ //printf("seqno %3d\n", d_pktbuf[0]);
+ memcpy(out, &d_pktbuf[GRSF_PAYLOAD_OVERHEAD], d_payload_bytesize);
+ enter_looking();
+ consume_each(n + 1);
+ return d_payload_bytesize;
+ }
+ }
+ break;
+
+ case ST_LOOKING:
+ case ST_UNDER_THRESHOLD:
+ update_avg(in[n]);
+ decision = slice(in[n]);
+ d_shift_reg[d_osi] = (d_shift_reg[d_osi] << 1) | decision;
+
+ hamming_dist = gr::blocks::count_bits64(d_shift_reg[d_osi] ^ GRSF_SYNC);
+ // printf("%2d %d\n", hamming_dist, d_osi);
+
+ if(d_state == ST_LOOKING && hamming_dist <= THRESHOLD) {
+ // We're seeing a good PN code, remember location
+ enter_under_threshold();
+ }
+ else if(d_state == ST_UNDER_THRESHOLD && hamming_dist > THRESHOLD) {
+ // no longer seeing good PN code, compute center of goodness
+ enter_locked();
+#ifdef DEBUG_SIMPLE_CORRELATOR
+ debug_data.enter_locked = 1.0;
+#endif
+ }
+ break;
+ default:
+ assert(0);
+ }
+
+#ifdef DEBUG_SIMPLE_CORRELATOR
+ fwrite(&debug_data, sizeof(debug_data), 1, d_debug_fp);
+#endif
+
+ d_osi = add_index(d_osi, 1);
+ n++;
+ }
+
+ consume_each(n);
+ return 0;
+ }
+
+ } /* namespace digital */
+} /* namespace gr */
diff --git a/gr-digital/lib/simple_correlator_impl.h b/gr-digital/lib/simple_correlator_impl.h
new file mode 100644
index 0000000000..fe324131fd
--- /dev/null
+++ b/gr-digital/lib/simple_correlator_impl.h
@@ -0,0 +1,102 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_SIMPLE_CORRELATOR_IMPL_H
+#define INCLUDED_GR_SIMPLE_CORRELATOR_IMPL_H
+
+#include <digital/simple_correlator.h>
+
+//#define DEBUG_SIMPLE_CORRELATOR
+
+namespace gr {
+ namespace digital {
+
+ class simple_correlator_impl : public simple_correlator
+ {
+ private:
+ static const int OVERSAMPLE = 8;
+ enum state_t { ST_LOOKING, ST_UNDER_THRESHOLD, ST_LOCKED };
+
+ int d_payload_bytesize;
+ state_t d_state;
+ unsigned int d_osi; // over sample index [0,OVERSAMPLE-1]
+ unsigned int d_transition_osi; // first index where Hamming dist < thresh
+ unsigned int d_center_osi; // center of bit
+ unsigned long long int d_shift_reg[OVERSAMPLE];
+ int d_bblen; // length of bitbuf
+ unsigned char *d_bitbuf; // demodulated bits
+ unsigned char *d_pktbuf; // temp packet buf
+ int d_bbi; // bitbuf index
+
+ static const int AVG_PERIOD = 512; // must be power of 2 (for freq offset correction)
+ int d_avbi;
+ float d_avgbuf[AVG_PERIOD];
+ float d_avg;
+ float d_accum;
+
+#ifdef DEBUG_SIMPLE_CORRELATOR
+ FILE *d_debug_fp; // binary log file
+#endif
+
+ inline int slice (float x)
+ {
+ return x >= d_avg ? 1 : 0;
+ }
+
+ void update_avg(float x);
+
+ void enter_locked ();
+ void enter_under_threshold ();
+ void enter_looking ();
+
+ static int add_index (int a, int b)
+ {
+ int t = a + b;
+ if(t >= OVERSAMPLE)
+ t -= OVERSAMPLE;
+ assert(t >= 0 && t < OVERSAMPLE);
+ return t;
+ }
+
+ static int sub_index (int a, int b)
+ {
+ int t = a - b;
+ if(t < 0)
+ t += OVERSAMPLE;
+ assert(t >= 0 && t < OVERSAMPLE);
+ return t;
+ }
+
+ public:
+ simple_correlator_impl(int payload_bytesize);
+ ~simple_correlator_impl();
+
+ int general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_SIMPLE_CORRELATOR_IMPL_H */
diff --git a/gr-digital/lib/simple_framer_impl.cc b/gr-digital/lib/simple_framer_impl.cc
new file mode 100644
index 0000000000..ff7e3ab614
--- /dev/null
+++ b/gr-digital/lib/simple_framer_impl.cc
@@ -0,0 +1,110 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2010,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "simple_framer_impl.h"
+#include <digital/simple_framer_sync.h>
+#include <gr_io_signature.h>
+#include <assert.h>
+#include <string>
+
+namespace gr {
+ namespace digital {
+
+ simple_framer::sptr
+ simple_framer::make(int payload_bytesize)
+ {
+ return gnuradio::get_initial_sptr
+ (new simple_framer_impl(payload_bytesize));
+ }
+
+ simple_framer_impl::simple_framer_impl(int payload_bytesize)
+ : gr_block("simple_framer",
+ gr_make_io_signature(1, 1, sizeof(unsigned char)),
+ gr_make_io_signature(1, 1, sizeof(unsigned char))),
+ d_seqno (0), d_payload_bytesize (payload_bytesize),
+ d_input_block_size (payload_bytesize),
+ d_output_block_size (payload_bytesize + GRSF_OVERHEAD)
+ {
+ set_output_multiple(d_output_block_size);
+ }
+
+ simple_framer_impl::~simple_framer_impl()
+ {
+ }
+
+ void
+ simple_framer_impl::forecast(int noutput_items, gr_vector_int &ninput_items_required)
+ {
+ assert(noutput_items % d_output_block_size == 0);
+
+ int nblocks = noutput_items / d_output_block_size;
+ int input_required = nblocks * d_input_block_size;
+
+ unsigned ninputs = ninput_items_required.size();
+ for(unsigned int i = 0; i < ninputs; i++)
+ ninput_items_required[i] = input_required;
+ }
+
+ int
+ simple_framer_impl::general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const unsigned char *in = (const unsigned char*)input_items[0];
+ unsigned char *out = (unsigned char*)output_items[0];
+
+ int n = 0;
+ int nblocks = 0;
+
+ memset(out, 0x55, noutput_items);
+
+ while(n < noutput_items) {
+ out[0] = (GRSF_SYNC >> 56) & 0xff;
+ out[1] = (GRSF_SYNC >> 48) & 0xff;
+ out[2] = (GRSF_SYNC >> 40) & 0xff;
+ out[3] = (GRSF_SYNC >> 32) & 0xff;
+ out[4] = (GRSF_SYNC >> 24) & 0xff;
+ out[5] = (GRSF_SYNC >> 16) & 0xff;
+ out[6] = (GRSF_SYNC >> 8) & 0xff;
+ out[7] = (GRSF_SYNC >> 0) & 0xff;
+ out[8] = d_seqno++;
+
+ memcpy(&out[9], in, d_input_block_size);
+ in += d_input_block_size;
+ out += d_output_block_size;
+ n += d_output_block_size;
+ nblocks++;
+ }
+
+ assert(n == noutput_items);
+
+ consume_each(nblocks * d_input_block_size);
+ return n;
+ }
+
+ } /* namespace digital */
+} /* namespace gr */
diff --git a/gr-digital/swig/digital_simple_framer.i b/gr-digital/lib/simple_framer_impl.h
index a376317c5c..fe967eb26a 100644
--- a/gr-digital/swig/digital_simple_framer.i
+++ b/gr-digital/lib/simple_framer_impl.h
@@ -20,11 +20,36 @@
* Boston, MA 02110-1301, USA.
*/
-GR_SWIG_BLOCK_MAGIC(digital,simple_framer);
+#ifndef INCLUDED_GR_SIMPLE_FRAMER_IMPL_H
+#define INCLUDED_GR_SIMPLE_FRAMER_IMPL_H
-digital_simple_framer_sptr
-digital_make_simple_framer(int payload_bytesize);
+#include <digital/simple_framer.h>
-class digital_simple_framer : public gr_block
-{
-};
+namespace gr {
+ namespace digital {
+
+ class simple_framer_impl : public simple_framer
+ {
+ private:
+ int d_seqno;
+ int d_payload_bytesize;
+ int d_input_block_size; // bytes
+ int d_output_block_size; // bytes
+
+ public:
+ simple_framer_impl(int payload_bytesize);
+ ~simple_framer_impl();
+
+ void forecast(int noutput_items,
+ gr_vector_int &ninput_items_required);
+
+ int general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_SIMPLE_FRAMER_IMPL_H */
diff --git a/gr-digital/python/CMakeLists.txt b/gr-digital/python/CMakeLists.txt
index f820736c2f..7846345970 100644
--- a/gr-digital/python/CMakeLists.txt
+++ b/gr-digital/python/CMakeLists.txt
@@ -69,14 +69,16 @@ if(ENABLE_TESTING)
list(APPEND GR_TEST_PYTHON_DIRS
${CMAKE_BINARY_DIR}/gr-digital/python
${CMAKE_BINARY_DIR}/gr-digital/swig
- ${CMAKE_BINARY_DIR}/gr-fft/python
- ${CMAKE_BINARY_DIR}/gr-fft/swig
- ${CMAKE_BINARY_DIR}/gr-blocks/python
- ${CMAKE_BINARY_DIR}/gr-blocks/swig
+ ${CMAKE_BINARY_DIR}/gr-filter/python
+ ${CMAKE_BINARY_DIR}/gr-filter/swig
${CMAKE_BINARY_DIR}/gr-analog/python
${CMAKE_BINARY_DIR}/gr-analog/swig
+ ${CMAKE_BINARY_DIR}/gr-blocks/python
+ ${CMAKE_BINARY_DIR}/gr-blocks/swig
+ ${CMAKE_BINARY_DIR}/gr-fft/python
+ ${CMAKE_BINARY_DIR}/gr-fft/swig
)
-list(APPEND GR_TEST_TARGET_DEPS gnuradio-digital gnuradio-filter gnuradio-fft)
+list(APPEND GR_TEST_TARGET_DEPS gnuradio-digital gnuradio-filter gnuradio-fft gnuradio-analog gnuradio-blocks)
include(GrTest)
file(GLOB py_qa_test_files "qa_*.py")
diff --git a/gr-digital/python/__init__.py b/gr-digital/python/__init__.py
index 1c7958f178..6bbe8160e8 100644
--- a/gr-digital/python/__init__.py
+++ b/gr-digital/python/__init__.py
@@ -19,8 +19,7 @@
#
'''
-This is the gr-digital package. It contains all of the blocks,
-utilities, and examples for doing digital modulation and demodulation.
+Blocks and utilities for digital modulation and demodulation.
'''
# The presence of this file turns this directory into a Python package
@@ -28,6 +27,7 @@ utilities, and examples for doing digital modulation and demodulation.
from digital_swig import *
from psk import *
from qam import *
+from qamlike import *
from bpsk import *
from qpsk import *
from gmsk import *
diff --git a/gr-digital/python/bpsk.py b/gr-digital/python/bpsk.py
index 0d8f05c4c1..57cf2534f4 100644
--- a/gr-digital/python/bpsk.py
+++ b/gr-digital/python/bpsk.py
@@ -28,21 +28,15 @@ from cmath import exp
from gnuradio import gr
from gnuradio.digital.generic_mod_demod import generic_mod, generic_demod
+from gnuradio.digital.generic_mod_demod import shared_mod_args, shared_demod_args
import digital_swig
import modulation_utils
-# Default number of points in constellation.
-_def_constellation_points = 2
-# Whether differential coding is used.
-_def_differential = False
-
# /////////////////////////////////////////////////////////////////////////////
# BPSK constellation
# /////////////////////////////////////////////////////////////////////////////
-def bpsk_constellation(m=_def_constellation_points):
- if m != _def_constellation_points:
- raise ValueError("BPSK can only have 2 constellation points.")
+def bpsk_constellation():
return digital_swig.constellation_bpsk()
# /////////////////////////////////////////////////////////////////////////////
@@ -50,115 +44,102 @@ def bpsk_constellation(m=_def_constellation_points):
# /////////////////////////////////////////////////////////////////////////////
class bpsk_mod(generic_mod):
+ """
+ Hierarchical block for RRC-filtered BPSK modulation.
+
+ The input is a byte stream (unsigned char) and the
+ output is the complex modulated signal at baseband.
+
+
+ Args:
+ mod_code: Argument is not used. It exists purely to simplify generation of the block in grc.
+ differential: Whether to use differential encoding (boolean).
+ """
+ # See generic_mod for additional arguments
+ __doc__ += shared_mod_args
+
+ def __init__(self, mod_code=None, differential=False, *args, **kwargs):
- def __init__(self, constellation_points=_def_constellation_points,
- differential=False, *args, **kwargs):
-
- """
- Hierarchical block for RRC-filtered BPSK modulation.
-
- The input is a byte stream (unsigned char) and the
- output is the complex modulated signal at baseband.
-
- See generic_mod block for list of parameters.
- """
-
- constellation_points = _def_constellation_points
constellation = digital_swig.constellation_bpsk()
- if constellation_points != 2:
- raise ValueError('Number of constellation points must be 2 for BPSK.')
super(bpsk_mod, self).__init__(constellation=constellation,
differential=differential, *args, **kwargs)
-
+
+
# /////////////////////////////////////////////////////////////////////////////
# BPSK demodulator
#
# /////////////////////////////////////////////////////////////////////////////
class bpsk_demod(generic_demod):
-
- def __init__(self, constellation_points=_def_constellation_points,
- differential=False, *args, **kwargs):
-
- """
- Hierarchical block for RRC-filtered BPSK modulation.
-
- The input is a byte stream (unsigned char) and the
- output is the complex modulated signal at baseband.
-
- See generic_demod block for list of parameters.
- """
-
- constellation_points = _def_constellation_points
+ """
+ Hierarchical block for RRC-filtered BPSK modulation.
+
+ The input is a byte stream (unsigned char) and the
+ output is the complex modulated signal at baseband.
+
+ Args:
+ mod_code: Argument is not used. It exists purely to simplify generation of the block in grc.
+ differential: whether to use differential encoding (boolean)
+ """
+ # See generic_demod for additional arguments
+ __doc__ += shared_demod_args
+
+ def __init__(self, mod_code=None, differential=False, *args, **kwargs):
constellation = digital_swig.constellation_bpsk()
- if constellation_points != 2:
- raise ValueError('Number of constellation points must be 2 for BPSK.')
super(bpsk_demod, self).__init__(constellation=constellation,
differential=differential, *args, **kwargs)
-
+#bpsk_demod.__doc__ += shared_demod_args
# /////////////////////////////////////////////////////////////////////////////
# DBPSK constellation
# /////////////////////////////////////////////////////////////////////////////
-def dbpsk_constellation(m=_def_constellation_points):
- if m != _def_constellation_points:
- raise ValueError("DBPSK can only have 2 constellation points.")
+def dbpsk_constellation():
return digital_swig.constellation_dbpsk()
# /////////////////////////////////////////////////////////////////////////////
# DBPSK modulator
# /////////////////////////////////////////////////////////////////////////////
-class dbpsk_mod(generic_mod):
-
- def __init__(self, constellation_points=_def_constellation_points,
- differential=True, *args, **kwargs):
-
- """
- Hierarchical block for RRC-filtered DBPSK modulation.
+class dbpsk_mod(bpsk_mod):
+ """
+ Hierarchical block for RRC-filtered DBPSK modulation.
+
+ The input is a byte stream (unsigned char) and the
+ output is the complex modulated signal at baseband.
+
+ Args:
+ mod_code: Argument is not used. It exists purely to simplify generation of the block in grc.
+ """
+ # See generic_mod for additional arguments
+ __doc__ += shared_mod_args
- The input is a byte stream (unsigned char) and the
- output is the complex modulated signal at baseband.
+ def __init__(self, mod_code=None, *args, **kwargs):
- See generic_mod block for list of parameters.
- """
-
- constellation_points = _def_constellation_points
- constellation = digital_swig.constellation_bpsk()
- if constellation_points != 2:
- raise ValueError('Number of constellation points must be 2 for DBPSK.')
- super(dbpsk_mod, self).__init__(constellation=constellation,
- differential=True,
- *args, **kwargs)
+ super(dbpsk_mod, self).__init__(*args, **kwargs)
# /////////////////////////////////////////////////////////////////////////////
# DBPSK demodulator
#
# /////////////////////////////////////////////////////////////////////////////
-class dbpsk_demod(generic_demod):
-
- def __init__(self, constellation_points=_def_constellation_points,
- differential=True, *args, **kwargs):
-
- """
- Hierarchical block for RRC-filtered DBPSK modulation.
-
- The input is a byte stream (unsigned char) and the
- output is the complex modulated signal at baseband.
-
- See generic_demod block for list of parameters.
- """
-
- constellation_points = _def_constellation_points
- constellation = digital_swig.constellation_bpsk()
- if constellation_points != 2:
- raise ValueError('Number of constellation points must be 2 for DBPSK.')
- super(dbpsk_demod, self).__init__(constellation=constellation,
- differential=True,
- *args, **kwargs)
+class dbpsk_demod(bpsk_demod):
+ """
+ Hierarchical block for RRC-filtered DBPSK modulation.
+
+ The input is a byte stream (unsigned char) and the
+ output is the complex modulated signal at baseband.
+
+ Args:
+ mod_code: Argument is not used. It exists purely to simplify generation of the block in grc.
+ """
+ # See generic_demod for additional arguments
+ __doc__ += shared_demod_args
+
+ def __init__(self, mod_code=None, *args, **kwargs):
+
+ super(dbpsk_demod, self).__init__(*args, **kwargs)
#
# Add these to the mod/demod registry
diff --git a/gr-digital/python/cpm.py b/gr-digital/python/cpm.py
index 05032336d4..b27fb098f5 100644
--- a/gr-digital/python/cpm.py
+++ b/gr-digital/python/cpm.py
@@ -24,7 +24,9 @@
# See gnuradio-examples/python/digital for examples
-from gnuradio import gr, blks2
+from gnuradio import gr, filter
+from gnuradio import analog
+from gnuradio import blocks
from math import pi
import numpy
@@ -49,6 +51,31 @@ _def_log = False
# /////////////////////////////////////////////////////////////////////////////
class cpm_mod(gr.hier_block2):
+ """
+ Hierarchical block for Continuous Phase modulation.
+
+ The input is a byte stream (unsigned char) representing packed
+ bits and the output is the complex modulated signal at baseband.
+
+ See Proakis for definition of generic CPM signals:
+ s(t)=exp(j phi(t))
+ phi(t)= 2 pi h int_0^t f(t') dt'
+ f(t)=sum_k a_k g(t-kT)
+ (normalizing assumption: int_0^infty g(t) dt = 1/2)
+
+ Args:
+ samples_per_symbol: samples per baud >= 2 (integer)
+ bits_per_symbol: bits per symbol (integer)
+ h_numerator: numerator of modulation index (integer)
+ h_denominator: denominator of modulation index (numerator and denominator must be relative primes) (integer)
+ cpm_type: supported types are: 0=CPFSK, 1=GMSK, 2=RC, 3=GENERAL (integer)
+ bt: bandwidth symbol time product for GMSK (float)
+ symbols_per_pulse: shaping pulse duration in symbols (integer)
+ generic_taps: define a generic CPM pulse shape (sum = samples_per_symbol/2) (list/array of floats)
+ verbose: Print information about modulator? (boolean)
+ debug: Print modulation data to files? (boolean)
+ """
+
def __init__(self,
samples_per_symbol=_def_samples_per_symbol,
bits_per_symbol=_def_bits_per_symbol,
@@ -60,42 +87,6 @@ class cpm_mod(gr.hier_block2):
generic_taps=_def_generic_taps,
verbose=_def_verbose,
log=_def_log):
- """
- Hierarchical block for Continuous Phase
- modulation.
-
- The input is a byte stream (unsigned char)
- representing packed bits and the
- output is the complex modulated signal at baseband.
-
- See Proakis for definition of generic CPM signals:
- s(t)=exp(j phi(t))
- phi(t)= 2 pi h int_0^t f(t') dt'
- f(t)=sum_k a_k g(t-kT)
- (normalizing assumption: int_0^infty g(t) dt = 1/2)
-
- @param samples_per_symbol: samples per baud >= 2
- @type samples_per_symbol: integer
- @param bits_per_symbol: bits per symbol
- @type bits_per_symbol: integer
- @param h_numerator: numerator of modulation index
- @type h_numerator: integer
- @param h_denominator: denominator of modulation index (numerator and denominator must be relative primes)
- @type h_denominator: integer
- @param cpm_type: supported types are: 0=CPFSK, 1=GMSK, 2=RC, 3=GENERAL
- @type cpm_type: integer
- @param bt: bandwidth symbol time product for GMSK
- @type bt: float
- @param symbols_per_pulse: shaping pulse duration in symbols
- @type symbols_per_pulse: integer
- @param generic_taps: define a generic CPM pulse shape (sum = samples_per_symbol/2)
- @type generic_taps: array of floats
-
- @param verbose: Print information about modulator?
- @type verbose: bool
- @param debug: Print modulation data to files?
- @type debug: bool
- """
gr.hier_block2.__init__(self, "cpm_mod",
gr.io_signature(1, 1, gr.sizeof_char), # Input signature
@@ -127,17 +118,17 @@ class cpm_mod(gr.hier_block2):
sensitivity = 2 * pi * h_numerator / h_denominator / samples_per_symbol
# Unpack Bytes into bits_per_symbol groups
- self.B2s = gr.packed_to_unpacked_bb(bits_per_symbol,gr.GR_MSB_FIRST)
+ self.B2s = blocks.packed_to_unpacked_bb(bits_per_symbol,gr.GR_MSB_FIRST)
# Turn it into symmetric PAM data.
- self.pam = gr.chunks_to_symbols_bf(self.sym_alphabet,1)
+ self.pam = digital_swig.chunks_to_symbols_bf(self.sym_alphabet,1)
# Generate pulse (sum of taps = samples_per_symbol/2)
if cpm_type == 0: # CPFSK
self.taps= (1.0/self._symbols_per_pulse/2,) * self.ntaps
elif cpm_type == 1: # GMSK
- gaussian_taps = gr.firdes.gaussian(
+ gaussian_taps = filter.firdes.gaussian(
1.0/2, # gain
samples_per_symbol, # symbol_rate
bt, # bandwidth * symbol time
@@ -153,10 +144,10 @@ class cpm_mod(gr.hier_block2):
else:
raise TypeError, ("cpm_type must be an integer in {0,1,2,3}, is %r" % (cpm_type,))
- self.filter = blks2.pfb_arb_resampler_fff(samples_per_symbol, self.taps)
+ self.filter = filter.pfb.arb_resampler_fff(samples_per_symbol, self.taps)
# FM modulation
- self.fmmod = gr.frequency_modulator_fc(sensitivity)
+ self.fmmod = analog.frequency_modulator_fc(sensitivity)
if verbose:
self._print_verbage()
@@ -205,13 +196,13 @@ class cpm_mod(gr.hier_block2):
def _setup_logging(self):
print "Modulation logging turned on."
self.connect(self.B2s,
- gr.file_sink(gr.sizeof_float, "symbols.dat"))
+ blocks.file_sink(gr.sizeof_float, "symbols.dat"))
self.connect(self.pam,
- gr.file_sink(gr.sizeof_float, "pam.dat"))
+ blocks.file_sink(gr.sizeof_float, "pam.dat"))
self.connect(self.filter,
- gr.file_sink(gr.sizeof_float, "filter.dat"))
+ blocks.file_sink(gr.sizeof_float, "filter.dat"))
self.connect(self.fmmod,
- gr.file_sink(gr.sizeof_gr_complex, "fmmod.dat"))
+ blocks.file_sink(gr.sizeof_gr_complex, "fmmod.dat"))
def add_options(parser):
diff --git a/gr-digital/python/crc.py b/gr-digital/python/crc.py
index 198ab059f5..e228faaa98 100644
--- a/gr-digital/python/crc.py
+++ b/gr-digital/python/crc.py
@@ -20,11 +20,11 @@
#
from gnuradio import gru
-import digital_swig
+import digital_swig as digital
import struct
def gen_and_append_crc32(s):
- crc = digital_swig.crc32(s)
+ crc = digital.crc32(s)
return s + struct.pack(">I", gru.hexint(crc) & 0xFFFFFFFF)
def check_crc32(s):
@@ -32,7 +32,7 @@ def check_crc32(s):
return (False, '')
msg = s[:-4]
#print "msg = '%s'" % (msg,)
- actual = digital_swig.crc32(msg)
+ actual = digital.crc32(msg)
(expected,) = struct.unpack(">I", s[-4:])
# print "actual =", hex(actual), "expected =", hex(expected)
return (actual == expected, msg)
diff --git a/gr-digital/python/digital_voice.py.real b/gr-digital/python/digital_voice.py.real
new file mode 100644
index 0000000000..4a2ef7721f
--- /dev/null
+++ b/gr-digital/python/digital_voice.py.real
@@ -0,0 +1,103 @@
+#!/usr/bin/env python
+#
+# Copyright 2005 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+"""
+Digital voice Tx and Rx using GSM 13kbit vocoder and GMSK.
+
+Runs channel at 32kbit/sec. Currently uses fake channel coding,
+but there's room for a rate 1/2 coder.
+"""
+
+from gnuradio import gr, gru
+from gnuradio import blocks
+from gnuradio.blksimpl.gmsk import gmsk_mod, gmsk_demod
+
+from gnuradio.vocoder import gsm_full_rate
+
+# Size of gsm full rate speech encoder output packet in bytes
+
+GSM_FRAME_SIZE = 33
+
+# Size of packet in bytes that we send to GMSK modulator:
+#
+# Target: 256kS/sec air rate.
+#
+# 256kS 1 sym 1 bit 1 byte 0.020 sec 80 bytes
+# ---- * ----- * ----- * ------ * --------- = --------
+# sec 8 S 1 sym 8 bits frame frame
+#
+# gr_simple_framer add 10 bytes of overhead.
+
+AIR_FRAME_SIZE = 70
+
+
+class digital_voice_tx(gr.hier_block):
+ """
+ Hierarchical block for digital voice tranmission.
+
+ The input is 8kS/sec floating point audio in the range [-1,+1]
+ The output is 256kS/sec GMSK modulated complex baseband signal in the range [-1,+1].
+ """
+ def __init__(self, fg):
+ samples_per_symbol = 8
+ symbol_rate = 32000
+ bt = 0.3 # Gaussian filter bandwidth * symbol time
+
+ src_scale = blocks.multiply_const_ff(32767)
+ f2s = blocks.float_to_short()
+ voice_coder = gsm_full_rate.encode_sp()
+
+ channel_coder = gr.fake_channel_encoder_pp(GSM_FRAME_SIZE, AIR_FRAME_SIZE)
+ p2s = gr.parallel_to_serial(gr.sizeof_char, AIR_FRAME_SIZE)
+
+ mod = gmsk_mod(fg, sps=samples_per_symbol,
+ symbol_rate=symbol_rate, bt=bt,
+ p_size=AIR_FRAME_SIZE)
+
+ fg.connect(src_scale, f2s, voice_coder, channel_coder, p2s, mod)
+ gr.hier_block.__init__(self, fg, src_scale, mod)
+
+
+class digital_voice_rx(gr.hier_block):
+ """
+ Hierarchical block for digital voice reception.
+
+ The input is 256kS/sec GMSK modulated complex baseband signal.
+ The output is 8kS/sec floating point audio in the range [-1,+1]
+ """
+ def __init__(self, fg):
+ samples_per_symbol = 8
+ symbol_rate = 32000
+
+ demod = gmsk_demod(fg, sps=samples_per_symbol,
+ symbol_rate=symbol_rate,
+ p_size=AIR_FRAME_SIZE)
+
+ s2p = gr.serial_to_parallel(gr.sizeof_char, AIR_FRAME_SIZE)
+ channel_decoder = gr.fake_channel_decoder_pp(AIR_FRAME_SIZE, GSM_FRAME_SIZE)
+
+ voice_decoder = gsm_full_rate.decode_ps()
+ s2f = blocks.short_to_float ()
+ sink_scale = blocks.multiply_const_ff(1.0/32767.)
+
+ fg.connect(demod, s2p, channel_decoder, voice_decoder, s2f, sink_scale)
+ gr.hier_block.__init__(self, fg, demod, sink_scale)
diff --git a/gr-digital/python/generic_mod_demod.py b/gr-digital/python/generic_mod_demod.py
index a6c4f3445a..b812fe1c37 100644
--- a/gr-digital/python/generic_mod_demod.py
+++ b/gr-digital/python/generic_mod_demod.py
@@ -31,6 +31,21 @@ from utils import mod_codes
import digital_swig as digital
import math
+try:
+ from gnuradio import blocks
+except ImportError:
+ import blocks_swig as blocks
+
+try:
+ from gnuradio import filter
+except ImportError:
+ import filter_swig as filter
+
+try:
+ from gnuradio import analog
+except ImportError:
+ import analog_swig as analog
+
# default values (used in __init__ and add_options)
_def_samples_per_symbol = 2
_def_excess_bw = 0.35
@@ -74,42 +89,40 @@ def add_common_options(parser):
# /////////////////////////////////////////////////////////////////////////////
class generic_mod(gr.hier_block2):
+ """
+ Hierarchical block for RRC-filtered differential generic modulation.
+
+ The input is a byte stream (unsigned char) and the
+ output is the complex modulated signal at baseband.
+
+ Args:
+ constellation: determines the modulation type (gnuradio.digital.digital_constellation)
+ samples_per_symbol: samples per baud >= 2 (float)
+ differential: whether to use differential encoding (boolean)
+ pre_diff_code: whether to use apply a pre-differential mapping (boolean)
+ excess_bw: Root-raised cosine filter excess bandwidth (float)
+ verbose: Print information about modulator? (boolean)
+ log: Log modulation data to files? (boolean)
+ """
def __init__(self, constellation,
- samples_per_symbol=_def_samples_per_symbol,
differential=_def_differential,
+ samples_per_symbol=_def_samples_per_symbol,
+ pre_diff_code=True,
excess_bw=_def_excess_bw,
- gray_coded=True,
verbose=_def_verbose,
log=_def_log):
- """
- Hierarchical block for RRC-filtered differential generic modulation.
-
- The input is a byte stream (unsigned char) and the
- output is the complex modulated signal at baseband.
-
- @param constellation: determines the modulation type
- @type constellation: gnuradio.digital.gr_constellation
- @param samples_per_symbol: samples per baud >= 2
- @type samples_per_symbol: float
- @param excess_bw: Root-raised cosine filter excess bandwidth
- @type excess_bw: float
- @param gray_coded: turn gray coding on/off
- @type gray_coded: bool
- @param verbose: Print information about modulator?
- @type verbose: bool
- @param log: Log modulation data to files?
- @type log: bool
- """
gr.hier_block2.__init__(self, "generic_mod",
gr.io_signature(1, 1, gr.sizeof_char), # Input signature
gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature
- self._constellation = constellation.base()
+ self._constellation = constellation
self._samples_per_symbol = samples_per_symbol
self._excess_bw = excess_bw
self._differential = differential
+ # Only apply a predifferential coding if the constellation also supports it.
+ self.pre_diff_code = pre_diff_code and self._constellation.apply_pre_diff_code()
if self._samples_per_symbol < 2:
raise TypeError, ("sbp must be >= 2, is %f" % self._samples_per_symbol)
@@ -118,9 +131,9 @@ class generic_mod(gr.hier_block2):
# turn bytes into k-bit vectors
self.bytes2chunks = \
- gr.packed_to_unpacked_bb(self.bits_per_symbol(), gr.GR_MSB_FIRST)
+ blocks.packed_to_unpacked_bb(self.bits_per_symbol(), gr.GR_MSB_FIRST)
- if gray_coded == True:
+ if self.pre_diff_code:
self.symbol_mapper = digital.map_bb(self._constellation.pre_diff_code())
if differential:
@@ -131,23 +144,23 @@ class generic_mod(gr.hier_block2):
# pulse shaping filter
nfilts = 32
ntaps = nfilts * 11 * int(self._samples_per_symbol) # make nfilts filters of ntaps each
- self.rrc_taps = gr.firdes.root_raised_cosine(
+ self.rrc_taps = filter.firdes.root_raised_cosine(
nfilts, # gain
nfilts, # sampling rate based on 32 filters in resampler
1.0, # symbol rate
self._excess_bw, # excess bandwidth (roll-off factor)
ntaps)
- self.rrc_filter = gr.pfb_arb_resampler_ccf(self._samples_per_symbol,
- self.rrc_taps)
+ self.rrc_filter = filter.pfb_arb_resampler_ccf(self._samples_per_symbol,
+ self.rrc_taps)
# Connect
- blocks = [self, self.bytes2chunks]
- if gray_coded == True:
- blocks.append(self.symbol_mapper)
+ self._blocks = [self, self.bytes2chunks]
+ if self.pre_diff_code:
+ self._blocks.append(self.symbol_mapper)
if differential:
- blocks.append(self.diffenc)
- blocks += [self.chunks2symbols, self.rrc_filter, self]
- self.connect(*blocks)
+ self._blocks.append(self.diffenc)
+ self._blocks += [self.chunks2symbols, self.rrc_filter, self]
+ self.connect(*self._blocks)
if verbose:
self._print_verbage()
@@ -185,17 +198,17 @@ class generic_mod(gr.hier_block2):
def _setup_logging(self):
print "Modulation logging turned on."
self.connect(self.bytes2chunks,
- gr.file_sink(gr.sizeof_char, "tx_bytes2chunks.8b"))
- if self._constellation.apply_pre_diff_code():
+ blocks.file_sink(gr.sizeof_char, "tx_bytes2chunks.8b"))
+ if self.pre_diff_code:
self.connect(self.symbol_mapper,
- gr.file_sink(gr.sizeof_char, "tx_symbol_mapper.8b"))
+ blocks.file_sink(gr.sizeof_char, "tx_symbol_mapper.8b"))
if self._differential:
self.connect(self.diffenc,
- gr.file_sink(gr.sizeof_char, "tx_diffenc.8b"))
+ blocks.file_sink(gr.sizeof_char, "tx_diffenc.8b"))
self.connect(self.chunks2symbols,
- gr.file_sink(gr.sizeof_gr_complex, "tx_chunks2symbols.32fc"))
+ blocks.file_sink(gr.sizeof_gr_complex, "tx_chunks2symbols.32fc"))
self.connect(self.rrc_filter,
- gr.file_sink(gr.sizeof_gr_complex, "tx_rrc_filter.32fc"))
+ blocks.file_sink(gr.sizeof_gr_complex, "tx_rrc_filter.32fc"))
# /////////////////////////////////////////////////////////////////////////////
@@ -206,48 +219,41 @@ class generic_mod(gr.hier_block2):
# /////////////////////////////////////////////////////////////////////////////
class generic_demod(gr.hier_block2):
+ """
+ Hierarchical block for RRC-filtered differential generic demodulation.
+
+ The input is the complex modulated signal at baseband.
+ The output is a stream of bits packed 1 bit per byte (LSB)
+
+ Args:
+ constellation: determines the modulation type (gnuradio.digital.digital_constellation)
+ samples_per_symbol: samples per baud >= 2 (float)
+ differential: whether to use differential encoding (boolean)
+ pre_diff_code: whether to use apply a pre-differential mapping (boolean)
+ excess_bw: Root-raised cosine filter excess bandwidth (float)
+ freq_bw: loop filter lock-in bandwidth (float)
+ timing_bw: timing recovery loop lock-in bandwidth (float)
+ phase_bw: phase recovery loop bandwidth (float)
+ verbose: Print information about modulator? (boolean)
+ log: Log modulation data to files? (boolean)
+ """
def __init__(self, constellation,
- samples_per_symbol=_def_samples_per_symbol,
differential=_def_differential,
+ samples_per_symbol=_def_samples_per_symbol,
+ pre_diff_code=True,
excess_bw=_def_excess_bw,
- gray_coded=True,
freq_bw=_def_freq_bw,
timing_bw=_def_timing_bw,
phase_bw=_def_phase_bw,
verbose=_def_verbose,
log=_def_log):
- """
- Hierarchical block for RRC-filtered differential generic demodulation.
-
- The input is the complex modulated signal at baseband.
- The output is a stream of bits packed 1 bit per byte (LSB)
-
- @param constellation: determines the modulation type
- @type constellation: gnuradio.digital.gr_constellation
- @param samples_per_symbol: samples per symbol >= 2
- @type samples_per_symbol: float
- @param excess_bw: Root-raised cosine filter excess bandwidth
- @type excess_bw: float
- @param gray_coded: turn gray coding on/off
- @type gray_coded: bool
- @param freq_bw: loop filter lock-in bandwidth
- @type freq_bw: float
- @param timing_bw: timing recovery loop lock-in bandwidth
- @type timing_bw: float
- @param phase_bw: phase recovery loop bandwidth
- @type phase_bw: float
- @param verbose: Print information about modulator?
- @type verbose: bool
- @param debug: Print modualtion data to files?
- @type debug: bool
- """
gr.hier_block2.__init__(self, "generic_demod",
gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
gr.io_signature(1, 1, gr.sizeof_char)) # Output signature
- self._constellation = constellation.base()
+ self._constellation = constellation
self._samples_per_symbol = samples_per_symbol
self._excess_bw = excess_bw
self._phase_bw = phase_bw
@@ -259,13 +265,16 @@ class generic_demod(gr.hier_block2):
if self._samples_per_symbol < 2:
raise TypeError, ("sbp must be >= 2, is %d" % self._samples_per_symbol)
+ # Only apply a predifferential coding if the constellation also supports it.
+ self.pre_diff_code = pre_diff_code and self._constellation.apply_pre_diff_code()
+
arity = pow(2,self.bits_per_symbol())
nfilts = 32
ntaps = 11 * int(self._samples_per_symbol*nfilts)
# Automatic gain control
- self.agc = gr.agc2_cc(0.6e-1, 1e-3, 1, 1, 100)
+ self.agc = analog.agc2_cc(0.6e-1, 1e-3, 1, 1, 100)
# Frequency correction
fll_ntaps = 55
@@ -273,8 +282,8 @@ class generic_demod(gr.hier_block2):
fll_ntaps, self._freq_bw)
# symbol timing recovery with RRC data filter
- taps = gr.firdes.root_raised_cosine(nfilts, nfilts*self._samples_per_symbol,
- 1.0, self._excess_bw, ntaps)
+ taps = filter.firdes.root_raised_cosine(nfilts, nfilts*self._samples_per_symbol,
+ 1.0, self._excess_bw, ntaps)
self.time_recov = digital.pfb_clock_sync_ccf(self._samples_per_symbol,
self._timing_bw, taps,
nfilts, nfilts//2, self._timing_max_dev)
@@ -282,19 +291,19 @@ class generic_demod(gr.hier_block2):
fmin = -0.25
fmax = 0.25
self.receiver = digital.constellation_receiver_cb(
- self._constellation, self._phase_bw,
+ self._constellation.base(), self._phase_bw,
fmin, fmax)
# Do differential decoding based on phase change of symbols
if differential:
self.diffdec = digital.diff_decoder_bb(arity)
- if gray_coded:
+ if self.pre_diff_code:
self.symbol_mapper = digital.map_bb(
mod_codes.invert_code(self._constellation.pre_diff_code()))
# unpack the k bit vector into a stream of bits
- self.unpack = gr.unpack_k_bits_bb(self.bits_per_symbol())
+ self.unpack = blocks.unpack_k_bits_bb(self.bits_per_symbol())
if verbose:
self._print_verbage()
@@ -303,14 +312,14 @@ class generic_demod(gr.hier_block2):
self._setup_logging()
# Connect and Initialize base class
- blocks = [self, self.agc, self.freq_recov,
- self.time_recov, self.receiver]
+ self._blocks = [self, self.agc, self.freq_recov,
+ self.time_recov, self.receiver]
if differential:
- blocks.append(self.diffdec)
- if self._constellation.apply_pre_diff_code():
- blocks.append(self.symbol_mapper)
- blocks += [self.unpack, self]
- self.connect(*blocks)
+ self._blocks.append(self.diffdec)
+ if self.pre_diff_code:
+ self._blocks.append(self.symbol_mapper)
+ self._blocks += [self.unpack, self]
+ self.connect(*self._blocks)
def samples_per_symbol(self):
return self._samples_per_symbol
@@ -329,39 +338,39 @@ class generic_demod(gr.hier_block2):
def _setup_logging(self):
print "Modulation logging turned on."
self.connect(self.agc,
- gr.file_sink(gr.sizeof_gr_complex, "rx_agc.32fc"))
+ blocks.file_sink(gr.sizeof_gr_complex, "rx_agc.32fc"))
self.connect((self.freq_recov, 0),
- gr.file_sink(gr.sizeof_gr_complex, "rx_freq_recov.32fc"))
+ blocks.file_sink(gr.sizeof_gr_complex, "rx_freq_recov.32fc"))
self.connect((self.freq_recov, 1),
- gr.file_sink(gr.sizeof_float, "rx_freq_recov_freq.32f"))
+ blocks.file_sink(gr.sizeof_float, "rx_freq_recov_freq.32f"))
self.connect((self.freq_recov, 2),
- gr.file_sink(gr.sizeof_float, "rx_freq_recov_phase.32f"))
+ blocks.file_sink(gr.sizeof_float, "rx_freq_recov_phase.32f"))
self.connect((self.freq_recov, 3),
- gr.file_sink(gr.sizeof_float, "rx_freq_recov_error.32f"))
+ blocks.file_sink(gr.sizeof_float, "rx_freq_recov_error.32f"))
self.connect((self.time_recov, 0),
- gr.file_sink(gr.sizeof_gr_complex, "rx_time_recov.32fc"))
+ blocks.file_sink(gr.sizeof_gr_complex, "rx_time_recov.32fc"))
self.connect((self.time_recov, 1),
- gr.file_sink(gr.sizeof_float, "rx_time_recov_error.32f"))
+ blocks.file_sink(gr.sizeof_float, "rx_time_recov_error.32f"))
self.connect((self.time_recov, 2),
- gr.file_sink(gr.sizeof_float, "rx_time_recov_rate.32f"))
+ blocks.file_sink(gr.sizeof_float, "rx_time_recov_rate.32f"))
self.connect((self.time_recov, 3),
- gr.file_sink(gr.sizeof_float, "rx_time_recov_phase.32f"))
+ blocks.file_sink(gr.sizeof_float, "rx_time_recov_phase.32f"))
self.connect((self.receiver, 0),
- gr.file_sink(gr.sizeof_char, "rx_receiver.8b"))
+ blocks.file_sink(gr.sizeof_char, "rx_receiver.8b"))
self.connect((self.receiver, 1),
- gr.file_sink(gr.sizeof_float, "rx_receiver_error.32f"))
+ blocks.file_sink(gr.sizeof_float, "rx_receiver_error.32f"))
self.connect((self.receiver, 2),
- gr.file_sink(gr.sizeof_float, "rx_receiver_phase.32f"))
+ blocks.file_sink(gr.sizeof_float, "rx_receiver_phase.32f"))
self.connect((self.receiver, 3),
- gr.file_sink(gr.sizeof_float, "rx_receiver_freq.32f"))
+ blocks.file_sink(gr.sizeof_float, "rx_receiver_freq.32f"))
if self._differential:
self.connect(self.diffdec,
- gr.file_sink(gr.sizeof_char, "rx_diffdec.8b"))
- if self._constellation.apply_pre_diff_code():
+ blocks.file_sink(gr.sizeof_char, "rx_diffdec.8b"))
+ if self.pre_diff_code:
self.connect(self.symbol_mapper,
- gr.file_sink(gr.sizeof_char, "rx_symbol_mapper.8b"))
+ blocks.file_sink(gr.sizeof_char, "rx_symbol_mapper.8b"))
self.connect(self.unpack,
- gr.file_sink(gr.sizeof_char, "rx_unpack.8b"))
+ blocks.file_sink(gr.sizeof_char, "rx_unpack.8b"))
def add_options(parser):
"""
@@ -385,3 +394,17 @@ class generic_demod(gr.hier_block2):
return extract_kwargs_from_options_for_class(cls, options)
extract_kwargs_from_options=classmethod(extract_kwargs_from_options)
+shared_demod_args = """ samples_per_symbol: samples per baud >= 2 (float)
+ excess_bw: Root-raised cosine filter excess bandwidth (float)
+ freq_bw: loop filter lock-in bandwidth (float)
+ timing_bw: timing recovery loop lock-in bandwidth (float)
+ phase_bw: phase recovery loop bandwidth (float)
+ verbose: Print information about modulator? (boolean)
+ log: Log modulation data to files? (boolean)
+"""
+
+shared_mod_args = """ samples_per_symbol: samples per baud >= 2 (float)
+ excess_bw: Root-raised cosine filter excess bandwidth (float)
+ verbose: Print information about modulator? (boolean)
+ log: Log modulation data to files? (boolean)
+"""
diff --git a/gr-digital/python/gfsk.py b/gr-digital/python/gfsk.py
index c85fdf0e00..54c94b88fd 100644
--- a/gr-digital/python/gfsk.py
+++ b/gr-digital/python/gfsk.py
@@ -2,7 +2,7 @@
# GFSK modulation and demodulation.
#
#
-# Copyright 2005,2006,2007 Free Software Foundation, Inc.
+# Copyright 2005-2007,2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -25,6 +25,8 @@
# See gnuradio-examples/python/digital for examples
from gnuradio import gr
+from gnuradio import analog
+from gnuradio import blocks
import modulation_utils
import digital_swig as digital
from math import pi
@@ -32,6 +34,11 @@ import numpy
from pprint import pprint
import inspect
+try:
+ from gnuradio import filter
+except ImportError:
+ import filter_swig as filter
+
# default values (used in __init__ and add_options)
_def_samples_per_symbol = 2
_def_sensitivity = 1
@@ -68,14 +75,11 @@ class gfsk_mod(gr.hier_block2):
The input is a byte stream (unsigned char) and the
output is the complex modulated signal at baseband.
- @param samples_per_symbol: samples per baud >= 2
- @type samples_per_symbol: integer
- @param bt: Gaussian filter bandwidth * symbol time
- @type bt: float
- @param verbose: Print information about modulator?
- @type verbose: bool
- @param debug: Print modualtion data to files?
- @type debug: bool
+ Args:
+ samples_per_symbol: samples per baud >= 2 (integer)
+ bt: Gaussian filter bandwidth * symbol time (float)
+ verbose: Print information about modulator? (bool)
+ debug: Print modualtion data to files? (bool)
"""
gr.hier_block2.__init__(self, "gfsk_mod",
@@ -94,11 +98,13 @@ class gfsk_mod(gr.hier_block2):
#sensitivity = (pi / 2) / samples_per_symbol # phase change per bit = pi / 2
# Turn it into NRZ data.
- self.nrz = gr.bytes_to_syms()
+ #self.nrz = digital.bytes_to_syms()
+ self.unpack = blocks.packed_to_unpacked_bb(1, gr.GR_MSB_FIRST)
+ self.nrz = digital.chunks_to_symbols_bf([-1, 1])
# Form Gaussian filter
# Generate Gaussian response (Needs to be convolved with window below).
- self.gaussian_taps = gr.firdes.gaussian(
+ self.gaussian_taps = filter.firdes.gaussian(
1.0, # gain
samples_per_symbol, # symbol_rate
bt, # bandwidth * symbol time
@@ -107,13 +113,13 @@ class gfsk_mod(gr.hier_block2):
self.sqwave = (1,) * samples_per_symbol # rectangular window
self.taps = numpy.convolve(numpy.array(self.gaussian_taps),numpy.array(self.sqwave))
- self.gaussian_filter = gr.interp_fir_filter_fff(samples_per_symbol, self.taps)
+ self.gaussian_filter = filter.interp_fir_filter_fff(samples_per_symbol, self.taps)
# FM modulation
- self.fmmod = gr.frequency_modulator_fc(sensitivity)
+ self.fmmod = frequency.frequency_modulator_fc(sensitivity)
# small amount of output attenuation to prevent clipping USRP sink
- self.amp = gr.multiply_const_cc(0.999)
+ self.amp = blocks.multiply_const_cc(0.999)
if verbose:
self._print_verbage()
@@ -122,7 +128,7 @@ class gfsk_mod(gr.hier_block2):
self._setup_logging()
# Connect & Initialize base class
- self.connect(self, self.nrz, self.gaussian_filter, self.fmmod, self.amp, self)
+ self.connect(self, self.unpack, self.nrz, self.gaussian_filter, self.fmmod, self.amp, self)
def samples_per_symbol(self):
return self._samples_per_symbol
@@ -140,11 +146,11 @@ class gfsk_mod(gr.hier_block2):
def _setup_logging(self):
print "Modulation logging turned on."
self.connect(self.nrz,
- gr.file_sink(gr.sizeof_float, "nrz.dat"))
+ blocks.file_sink(gr.sizeof_float, "nrz.dat"))
self.connect(self.gaussian_filter,
- gr.file_sink(gr.sizeof_float, "gaussian_filter.dat"))
+ blocks.file_sink(gr.sizeof_float, "gaussian_filter.dat"))
self.connect(self.fmmod,
- gr.file_sink(gr.sizeof_gr_complex, "fmmod.dat"))
+ blocks.file_sink(gr.sizeof_gr_complex, "fmmod.dat"))
def add_options(parser):
@@ -188,23 +194,19 @@ class gfsk_demod(gr.hier_block2):
The input is the complex modulated signal at baseband.
The output is a stream of bits packed 1 bit per byte (the LSB)
- @param samples_per_symbol: samples per baud
- @type samples_per_symbol: integer
- @param verbose: Print information about modulator?
- @type verbose: bool
- @param log: Print modualtion data to files?
- @type log: bool
+ Args:
+ samples_per_symbol: samples per baud (integer)
+ verbose: Print information about modulator? (bool)
+ log: Print modualtion data to files? (bool)
Clock recovery parameters. These all have reasonble defaults.
- @param gain_mu: controls rate of mu adjustment
- @type gain_mu: float
- @param mu: fractional delay [0.0, 1.0]
- @type mu: float
- @param omega_relative_limit: sets max variation in omega
- @type omega_relative_limit: float, typically 0.000200 (200 ppm)
- @param freq_error: bit rate error as a fraction
- @param float
+ Args:
+ gain_mu: controls rate of mu adjustment (float)
+ mu: fractional delay [0.0, 1.0] (float)
+ omega_relative_limit: sets max variation in omega (float, typically 0.000200 (200 ppm))
+ freq_error: bit rate error as a fraction
+ float:
"""
gr.hier_block2.__init__(self, "gfsk_demod",
@@ -230,7 +232,7 @@ class gfsk_demod(gr.hier_block2):
# Demodulate FM
#sensitivity = (pi / 2) / samples_per_symbol
- self.fmdemod = gr.quadrature_demod_cf(1.0 / sensitivity)
+ self.fmdemod = analog.quadrature_demod_cf(1.0 / sensitivity)
# the clock recovery block tracks the symbol clock and resamples as needed.
# the output of the block is a stream of soft symbols (float)
@@ -270,11 +272,11 @@ class gfsk_demod(gr.hier_block2):
def _setup_logging(self):
print "Demodulation logging turned on."
self.connect(self.fmdemod,
- gr.file_sink(gr.sizeof_float, "fmdemod.dat"))
+ blocks.file_sink(gr.sizeof_float, "fmdemod.dat"))
self.connect(self.clock_recovery,
- gr.file_sink(gr.sizeof_float, "clock_recovery.dat"))
+ blocks.file_sink(gr.sizeof_float, "clock_recovery.dat"))
self.connect(self.slicer,
- gr.file_sink(gr.sizeof_char, "slicer.dat"))
+ blocks.file_sink(gr.sizeof_char, "slicer.dat"))
def add_options(parser):
"""
diff --git a/gr-digital/python/gmsk.py b/gr-digital/python/gmsk.py
index 2c9be056c2..055fc6002b 100644
--- a/gr-digital/python/gmsk.py
+++ b/gr-digital/python/gmsk.py
@@ -2,7 +2,7 @@
# GMSK modulation and demodulation.
#
#
-# Copyright 2005,2006,2007 Free Software Foundation, Inc.
+# Copyright 2005-2007,2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -25,6 +25,8 @@
# See gnuradio-examples/python/digital for examples
from gnuradio import gr
+from gnuradio import blocks
+from gnuradio import analog
import modulation_utils
import digital_swig as digital
from math import pi
@@ -32,6 +34,12 @@ import numpy
from pprint import pprint
import inspect
+try:
+ from gnuradio import filter
+except ImportError:
+ import filter_swig as filter
+
+
# default values (used in __init__ and add_options)
_def_samples_per_symbol = 2
_def_bt = 0.35
@@ -53,28 +61,25 @@ _def_omega_relative_limit = 0.005
# /////////////////////////////////////////////////////////////////////////////
class gmsk_mod(gr.hier_block2):
+ """
+ Hierarchical block for Gaussian Minimum Shift Key (GMSK)
+ modulation.
+
+ The input is a byte stream (unsigned char) and the
+ output is the complex modulated signal at baseband.
+
+ Args:
+ samples_per_symbol: samples per baud >= 2 (integer)
+ bt: Gaussian filter bandwidth * symbol time (float)
+ verbose: Print information about modulator? (boolean)
+ debug: Print modulation data to files? (boolean)
+ """
def __init__(self,
samples_per_symbol=_def_samples_per_symbol,
bt=_def_bt,
verbose=_def_verbose,
log=_def_log):
- """
- Hierarchical block for Gaussian Minimum Shift Key (GMSK)
- modulation.
-
- The input is a byte stream (unsigned char) and the
- output is the complex modulated signal at baseband.
-
- @param samples_per_symbol: samples per baud >= 2
- @type samples_per_symbol: integer
- @param bt: Gaussian filter bandwidth * symbol time
- @type bt: float
- @param verbose: Print information about modulator?
- @type verbose: bool
- @param debug: Print modualtion data to files?
- @type debug: bool
- """
gr.hier_block2.__init__(self, "gmsk_mod",
gr.io_signature(1, 1, gr.sizeof_char), # Input signature
@@ -92,11 +97,13 @@ class gmsk_mod(gr.hier_block2):
sensitivity = (pi / 2) / samples_per_symbol # phase change per bit = pi / 2
# Turn it into NRZ data.
- self.nrz = gr.bytes_to_syms()
+ #self.nrz = digital.bytes_to_syms()
+ self.unpack = blocks.packed_to_unpacked_bb(1, gr.GR_MSB_FIRST)
+ self.nrz = digital.chunks_to_symbols_bf([-1, 1], 1)
# Form Gaussian filter
# Generate Gaussian response (Needs to be convolved with window below).
- self.gaussian_taps = gr.firdes.gaussian(
+ self.gaussian_taps = filter.firdes.gaussian(
1, # gain
samples_per_symbol, # symbol_rate
bt, # bandwidth * symbol time
@@ -105,10 +112,10 @@ class gmsk_mod(gr.hier_block2):
self.sqwave = (1,) * samples_per_symbol # rectangular window
self.taps = numpy.convolve(numpy.array(self.gaussian_taps),numpy.array(self.sqwave))
- self.gaussian_filter = gr.interp_fir_filter_fff(samples_per_symbol, self.taps)
+ self.gaussian_filter = filter.interp_fir_filter_fff(samples_per_symbol, self.taps)
# FM modulation
- self.fmmod = gr.frequency_modulator_fc(sensitivity)
+ self.fmmod = analog.frequency_modulator_fc(sensitivity)
if verbose:
self._print_verbage()
@@ -117,7 +124,7 @@ class gmsk_mod(gr.hier_block2):
self._setup_logging()
# Connect & Initialize base class
- self.connect(self, self.nrz, self.gaussian_filter, self.fmmod, self)
+ self.connect(self, self.unpack, self.nrz, self.gaussian_filter, self.fmmod, self)
def samples_per_symbol(self):
return self._samples_per_symbol
@@ -135,11 +142,11 @@ class gmsk_mod(gr.hier_block2):
def _setup_logging(self):
print "Modulation logging turned on."
self.connect(self.nrz,
- gr.file_sink(gr.sizeof_float, "nrz.dat"))
+ blocks.file_sink(gr.sizeof_float, "nrz.dat"))
self.connect(self.gaussian_filter,
- gr.file_sink(gr.sizeof_float, "gaussian_filter.dat"))
+ blocks.file_sink(gr.sizeof_float, "gaussian_filter.dat"))
self.connect(self.fmmod,
- gr.file_sink(gr.sizeof_gr_complex, "fmmod.dat"))
+ blocks.file_sink(gr.sizeof_gr_complex, "fmmod.dat"))
def add_options(parser):
@@ -166,7 +173,23 @@ class gmsk_mod(gr.hier_block2):
# /////////////////////////////////////////////////////////////////////////////
class gmsk_demod(gr.hier_block2):
-
+ """
+ Hierarchical block for Gaussian Minimum Shift Key (GMSK)
+ demodulation.
+
+ The input is the complex modulated signal at baseband.
+ The output is a stream of bits packed 1 bit per byte (the LSB)
+
+ Args:
+ samples_per_symbol: samples per baud (integer)
+ verbose: Print information about modulator? (boolean)
+ log: Print modualtion data to files? (boolean)
+ gain_mu: controls rate of mu adjustment (float)
+ mu: fractional delay [0.0, 1.0] (float)
+ omega_relative_limit: sets max variation in omega (float)
+ freq_error: bit rate error as a fraction (float)
+ """
+
def __init__(self,
samples_per_symbol=_def_samples_per_symbol,
gain_mu=_def_gain_mu,
@@ -175,31 +198,6 @@ class gmsk_demod(gr.hier_block2):
freq_error=_def_freq_error,
verbose=_def_verbose,
log=_def_log):
- """
- Hierarchical block for Gaussian Minimum Shift Key (GMSK)
- demodulation.
-
- The input is the complex modulated signal at baseband.
- The output is a stream of bits packed 1 bit per byte (the LSB)
-
- @param samples_per_symbol: samples per baud
- @type samples_per_symbol: integer
- @param verbose: Print information about modulator?
- @type verbose: bool
- @param log: Print modualtion data to files?
- @type log: bool
-
- Clock recovery parameters. These all have reasonble defaults.
-
- @param gain_mu: controls rate of mu adjustment
- @type gain_mu: float
- @param mu: fractional delay [0.0, 1.0]
- @type mu: float
- @param omega_relative_limit: sets max variation in omega
- @type omega_relative_limit: float, typically 0.000200 (200 ppm)
- @param freq_error: bit rate error as a fraction
- @param float
- """
gr.hier_block2.__init__(self, "gmsk_demod",
gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
@@ -224,7 +222,7 @@ class gmsk_demod(gr.hier_block2):
# Demodulate FM
sensitivity = (pi / 2) / samples_per_symbol
- self.fmdemod = gr.quadrature_demod_cf(1.0 / sensitivity)
+ self.fmdemod = analog.quadrature_demod_cf(1.0 / sensitivity)
# the clock recovery block tracks the symbol clock and resamples as needed.
# the output of the block is a stream of soft symbols (float)
@@ -264,11 +262,11 @@ class gmsk_demod(gr.hier_block2):
def _setup_logging(self):
print "Demodulation logging turned on."
self.connect(self.fmdemod,
- gr.file_sink(gr.sizeof_float, "fmdemod.dat"))
+ blocks.file_sink(gr.sizeof_float, "fmdemod.dat"))
self.connect(self.clock_recovery,
- gr.file_sink(gr.sizeof_float, "clock_recovery.dat"))
+ blocks.file_sink(gr.sizeof_float, "clock_recovery.dat"))
self.connect(self.slicer,
- gr.file_sink(gr.sizeof_char, "slicer.dat"))
+ blocks.file_sink(gr.sizeof_char, "slicer.dat"))
def add_options(parser):
"""
diff --git a/gr-digital/python/modulation_utils.py b/gr-digital/python/modulation_utils.py
index cb3a9812d4..d499094d05 100644
--- a/gr-digital/python/modulation_utils.py
+++ b/gr-digital/python/modulation_utils.py
@@ -74,11 +74,10 @@ def extract_kwargs_from_options(function, excluded_args, options):
but in that case the default provided in the __init__ argument
list will be used since there is no kwargs entry.)
- @param function: the function whose parameter list will be examined
- @param excluded_args: function arguments that are NOT to be added to the dictionary
- @type excluded_args: sequence of strings
- @param options: result of command argument parsing
- @type options: optparse.Values
+ Args:
+ function: the function whose parameter list will be examined
+ excluded_args: function arguments that are NOT to be added to the dictionary (sequence of strings)
+ options: result of command argument parsing (optparse.Values)
"""
# Try this in C++ ;)
diff --git a/gr-digital/python/ofdm.py b/gr-digital/python/ofdm.py
index 9f57920efc..bf129675ab 100644
--- a/gr-digital/python/ofdm.py
+++ b/gr-digital/python/ofdm.py
@@ -21,8 +21,9 @@
#
import math
-from gnuradio import gr
-import digital_swig
+from gnuradio import gr, fft
+from gnuradio import blocks
+import digital_swig as digital
import ofdm_packet_utils
from ofdm_receiver import ofdm_receiver
import gnuradio.gr.gr_threading as _threading
@@ -46,10 +47,10 @@ class ofdm_mod(gr.hier_block2):
Packets to be sent are enqueued by calling send_pkt.
The output is the complex modulated signal at baseband.
- @param options: pass modulation options from higher layers (fft length, occupied tones, etc.)
- @param msgq_limit: maximum number of messages in message queue
- @type msgq_limit: int
- @param pad_for_usrp: If true, packets are padded such that they end up a multiple of 128 samples
+ Args:
+ options: pass modulation options from higher layers (fft length, occupied tones, etc.)
+ msgq_limit: maximum number of messages in message queue (int)
+ pad_for_usrp: If true, packets are padded such that they end up a multiple of 128 samples
"""
gr.hier_block2.__init__(self, "ofdm_mod",
@@ -97,17 +98,17 @@ class ofdm_mod(gr.hier_block2):
constel = qam.qam_constellation(arity)
rotated_const = map(lambda pt: pt * rot, constel.points())
#print rotated_const
- self._pkt_input = digital_swig.ofdm_mapper_bcv(rotated_const,
- msgq_limit,
- options.occupied_tones,
- options.fft_length)
+ self._pkt_input = digital.ofdm_mapper_bcv(rotated_const,
+ msgq_limit,
+ options.occupied_tones,
+ options.fft_length)
- self.preambles = digital_swig.ofdm_insert_preamble(self._fft_length,
- padded_preambles)
- self.ifft = gr.fft_vcc(self._fft_length, False, win, True)
- self.cp_adder = digital_swig.ofdm_cyclic_prefixer(self._fft_length,
- symbol_length)
- self.scale = gr.multiply_const_cc(1.0 / math.sqrt(self._fft_length))
+ self.preambles = digital.ofdm_insert_preamble(self._fft_length,
+ padded_preambles)
+ self.ifft = fft.fft_vcc(self._fft_length, False, win, True)
+ self.cp_adder = digital.ofdm_cyclic_prefixer(self._fft_length,
+ symbol_length)
+ self.scale = blocks.multiply_const_cc(1.0 / math.sqrt(self._fft_length))
self.connect((self._pkt_input, 0), (self.preambles, 0))
self.connect((self._pkt_input, 1), (self.preambles, 1))
@@ -117,21 +118,21 @@ class ofdm_mod(gr.hier_block2):
self._print_verbage()
if options.log:
- self.connect(self._pkt_input, gr.file_sink(gr.sizeof_gr_complex*options.fft_length,
+ self.connect(self._pkt_input, blocks.file_sink(gr.sizeof_gr_complex*options.fft_length,
"ofdm_mapper_c.dat"))
- self.connect(self.preambles, gr.file_sink(gr.sizeof_gr_complex*options.fft_length,
+ self.connect(self.preambles, blocks.file_sink(gr.sizeof_gr_complex*options.fft_length,
"ofdm_preambles.dat"))
- self.connect(self.ifft, gr.file_sink(gr.sizeof_gr_complex*options.fft_length,
+ self.connect(self.ifft, blocks.file_sink(gr.sizeof_gr_complex*options.fft_length,
"ofdm_ifft_c.dat"))
- self.connect(self.cp_adder, gr.file_sink(gr.sizeof_gr_complex,
+ self.connect(self.cp_adder, blocks.file_sink(gr.sizeof_gr_complex,
"ofdm_cp_adder_c.dat"))
def send_pkt(self, payload='', eof=False):
"""
Send the payload.
- @param payload: data to send
- @type payload: string
+ Args:
+ payload: data to send (string)
"""
if eof:
msg = gr.message(1) # tell self._pkt_input we're not sending any more packets
@@ -188,9 +189,9 @@ class ofdm_demod(gr.hier_block2):
The input is the complex modulated signal at baseband.
Demodulated packets are sent to the handler.
- @param options: pass modulation options from higher layers (fft length, occupied tones, etc.)
- @param callback: function of two args: ok, payload
- @type callback: ok: bool; payload: string
+ Args:
+ options: pass modulation options from higher layers (fft length, occupied tones, etc.)
+ callback: function of two args: ok, payload (ok: bool; payload: string)
"""
gr.hier_block2.__init__(self, "ofdm_demod",
gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
@@ -240,10 +241,10 @@ class ofdm_demod(gr.hier_block2):
phgain = 0.25
frgain = phgain*phgain / 4.0
- self.ofdm_demod = digital_swig.ofdm_frame_sink(rotated_const, range(arity),
- self._rcvd_pktq,
- self._occupied_tones,
- phgain, frgain)
+ self.ofdm_demod = digital.ofdm_frame_sink(rotated_const, range(arity),
+ self._rcvd_pktq,
+ self._occupied_tones,
+ phgain, frgain)
self.connect(self, self.ofdm_recv)
self.connect((self.ofdm_recv, 0), (self.ofdm_demod, 0))
@@ -255,7 +256,7 @@ class ofdm_demod(gr.hier_block2):
if options.log:
self.connect(self.ofdm_demod,
- gr.file_sink(gr.sizeof_gr_complex*self._occupied_tones,
+ blocks.file_sink(gr.sizeof_gr_complex*self._occupied_tones,
"ofdm_frame_sink_c.dat"))
else:
self.connect(self.ofdm_demod,
diff --git a/gr-digital/python/ofdm_packet_utils.py b/gr-digital/python/ofdm_packet_utils.py
index d0000e6db5..c49dfe4f8e 100644
--- a/gr-digital/python/ofdm_packet_utils.py
+++ b/gr-digital/python/ofdm_packet_utils.py
@@ -101,14 +101,12 @@ def make_packet(payload, samples_per_symbol, bits_per_symbol,
"""
Build a packet, given access code, payload, and whitener offset
- @param payload: packet payload, len [0, 4096]
- @param samples_per_symbol: samples per symbol (needed for padding calculation)
- @type samples_per_symbol: int
- @param bits_per_symbol: (needed for padding calculation)
- @type bits_per_symbol: int
- @param whitener_offset offset into whitener string to use [0-16)
- @param whitening: Turn whitener on or off
- @type whitening: bool
+ Args:
+ payload: packet payload, len [0, 4096]
+ samples_per_symbol: samples per symbol (needed for padding calculation) (int)
+ bits_per_symbol: (needed for padding calculation) (int)
+ whitener_offset: offset into whitener string to use [0-16)
+ whitening: Turn whitener on or off (bool)
Packet will have access code at the beginning, followed by length, payload
and finally CRC-32.
@@ -150,13 +148,13 @@ def _npadding_bytes(pkt_byte_len, samples_per_symbol, bits_per_symbol):
we want to pad so that after modulation the resulting packet
is a multiple of 128 samples.
- @param ptk_byte_len: len in bytes of packet, not including padding.
- @param samples_per_symbol: samples per bit (1 bit / symbolwidth GMSK)
- @type samples_per_symbol: int
- @param bits_per_symbol: bits per symbol (log2(modulation order))
- @type bits_per_symbol: int
+ Args:
+ ptk_byte_len: len in bytes of packet, not including padding.
+ samples_per_symbol: samples per bit (1 bit / symbolwidth GMSK) (int)
+ bits_per_symbol: bits per symbol (log2(modulation order)) (int)
- @returns number of bytes of padding to append.
+ Returns:
+ number of bytes of padding to append.
"""
modulus = 128
byte_modulus = gru.lcm(modulus/8, samples_per_symbol) * bits_per_symbol / samples_per_symbol
@@ -170,10 +168,10 @@ def unmake_packet(whitened_payload_with_crc, whitener_offset=0, dewhitening=1):
"""
Return (ok, payload)
- @param whitened_payload_with_crc: string
- @param whitener_offset offset into whitener string to use [0-16)
- @param dewhitening: Turn whitener on or off
- @type dewhitening: bool
+ Args:
+ whitened_payload_with_crc: string
+ whitener_offset: offset into whitener string to use [0-16)
+ dewhitening: Turn whitener on or off (bool)
"""
if dewhitening:
diff --git a/gr-digital/python/ofdm_receiver.py b/gr-digital/python/ofdm_receiver.py
index 9d4d6e559d..4fbf76251a 100644
--- a/gr-digital/python/ofdm_receiver.py
+++ b/gr-digital/python/ofdm_receiver.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2006, 2007, 2008 Free Software Foundation, Inc.
+# Copyright 2006-2008 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -23,13 +23,21 @@
import math
from numpy import fft
from gnuradio import gr
+from gnuradio import analog
+from gnuradio import blocks
+from gnuradio import filter
-import digital_swig
+import digital_swig as digital
from ofdm_sync_pn import ofdm_sync_pn
from ofdm_sync_fixed import ofdm_sync_fixed
from ofdm_sync_pnac import ofdm_sync_pnac
from ofdm_sync_ml import ofdm_sync_ml
+try:
+ from gnuradio import filter
+except ImportError:
+ import filter_swig as filter
+
class ofdm_receiver(gr.hier_block2):
"""
Performs receiver synchronization on OFDM symbols.
@@ -47,18 +55,13 @@ class ofdm_receiver(gr.hier_block2):
The input is the complex modulated signal at baseband.
Synchronized packets are sent back to the demodulator.
- @param fft_length: total number of subcarriers
- @type fft_length: int
- @param cp_length: length of cyclic prefix as specified in subcarriers (<= fft_length)
- @type cp_length: int
- @param occupied_tones: number of subcarriers used for data
- @type occupied_tones: int
- @param snr: estimated signal to noise ratio used to guide cyclic prefix synchronizer
- @type snr: float
- @param ks: known symbols used as preambles to each packet
- @type ks: list of lists
- @param logging: turn file logging on or off
- @type logging: bool
+ Args:
+ fft_length: total number of subcarriers (int)
+ cp_length: length of cyclic prefix as specified in subcarriers (<= fft_length) (int)
+ occupied_tones: number of subcarriers used for data (int)
+ snr: estimated signal to noise ratio used to guide cyclic prefix synchronizer (float)
+ ks: known symbols used as preambles to each packet (list of lists)
+ logging: turn file logging on or off (bool)
"""
gr.hier_block2.__init__(self, "ofdm_receiver",
@@ -67,12 +70,12 @@ class ofdm_receiver(gr.hier_block2):
bw = (float(occupied_tones) / float(fft_length)) / 2.0
tb = bw*0.08
- chan_coeffs = gr.firdes.low_pass (1.0, # gain
- 1.0, # sampling rate
- bw+tb, # midpoint of trans. band
- tb, # width of trans. band
- gr.firdes.WIN_HAMMING) # filter type
- self.chan_filt = gr.fft_filter_ccc(1, chan_coeffs)
+ chan_coeffs = filter.firdes.low_pass (1.0, # gain
+ 1.0, # sampling rate
+ bw+tb, # midpoint of trans. band
+ tb, # width of trans. band
+ filter.firdes.WIN_HAMMING) # filter type
+ self.chan_filt = filter.fft_filter_ccc(1, chan_coeffs)
win = [1 for i in range(fft_length)]
@@ -107,7 +110,7 @@ class ofdm_receiver(gr.hier_block2):
# for testing only; do not user over the air
# remove filter and filter delay for this
elif SYNC == "fixed":
- self.chan_filt = gr.multiply_const_cc(1.0)
+ self.chan_filt = blocks.multiply_const_cc(1.0)
nsymbols = 18 # enter the number of symbols per packet
freq_offset = 0.0 # if you use a frequency offset, enter it here
nco_sensitivity = -2.0/fft_length # correct for fine frequency
@@ -119,11 +122,11 @@ class ofdm_receiver(gr.hier_block2):
# Set up blocks
- self.nco = gr.frequency_modulator_fc(nco_sensitivity) # generate a signal proportional to frequency error of sync block
- self.sigmix = gr.multiply_cc()
- self.sampler = digital_swig.ofdm_sampler(fft_length, fft_length+cp_length)
- self.fft_demod = gr.fft_vcc(fft_length, True, win, True)
- self.ofdm_frame_acq = digital_swig.ofdm_frame_acquisition(occupied_tones,
+ self.nco = analog.frequency_modulator_fc(nco_sensitivity) # generate a signal proportional to frequency error of sync block
+ self.sigmix = blocks.multiply_cc()
+ self.sampler = digital.ofdm_sampler(fft_length, fft_length+cp_length)
+ self.fft_demod = fft.fft_vcc(fft_length, True, win, True)
+ self.ofdm_frame_acq = digital.ofdm_frame_acquisition(occupied_tones,
fft_length,
cp_length, ks[0])
@@ -141,11 +144,11 @@ class ofdm_receiver(gr.hier_block2):
self.connect((self.ofdm_frame_acq,1), (self,1)) # frame and symbol timing, and equalization
if logging:
- self.connect(self.chan_filt, gr.file_sink(gr.sizeof_gr_complex, "ofdm_receiver-chan_filt_c.dat"))
- self.connect(self.fft_demod, gr.file_sink(gr.sizeof_gr_complex*fft_length, "ofdm_receiver-fft_out_c.dat"))
+ self.connect(self.chan_filt, blocks.file_sink(gr.sizeof_gr_complex, "ofdm_receiver-chan_filt_c.dat"))
+ self.connect(self.fft_demod, blocks.file_sink(gr.sizeof_gr_complex*fft_length, "ofdm_receiver-fft_out_c.dat"))
self.connect(self.ofdm_frame_acq,
- gr.file_sink(gr.sizeof_gr_complex*occupied_tones, "ofdm_receiver-frame_acq_c.dat"))
- self.connect((self.ofdm_frame_acq,1), gr.file_sink(1, "ofdm_receiver-found_corr_b.dat"))
- self.connect(self.sampler, gr.file_sink(gr.sizeof_gr_complex*fft_length, "ofdm_receiver-sampler_c.dat"))
- self.connect(self.sigmix, gr.file_sink(gr.sizeof_gr_complex, "ofdm_receiver-sigmix_c.dat"))
- self.connect(self.nco, gr.file_sink(gr.sizeof_gr_complex, "ofdm_receiver-nco_c.dat"))
+ blocks.file_sink(gr.sizeof_gr_complex*occupied_tones, "ofdm_receiver-frame_acq_c.dat"))
+ self.connect((self.ofdm_frame_acq,1), blocks.file_sink(1, "ofdm_receiver-found_corr_b.dat"))
+ self.connect(self.sampler, blocks.file_sink(gr.sizeof_gr_complex*fft_length, "ofdm_receiver-sampler_c.dat"))
+ self.connect(self.sigmix, blocks.file_sink(gr.sizeof_gr_complex, "ofdm_receiver-sigmix_c.dat"))
+ self.connect(self.nco, blocks.file_sink(gr.sizeof_gr_complex, "ofdm_receiver-nco_c.dat"))
diff --git a/gr-digital/python/ofdm_sync_fixed.py b/gr-digital/python/ofdm_sync_fixed.py
index 9bac789bf6..bd64964651 100644
--- a/gr-digital/python/ofdm_sync_fixed.py
+++ b/gr-digital/python/ofdm_sync_fixed.py
@@ -22,6 +22,7 @@
import math
from gnuradio import gr
+from gnuradio import blocks
class ofdm_sync_fixed(gr.hier_block2):
def __init__(self, fft_length, cp_length, nsymbols, freq_offset, logging=False):
@@ -46,5 +47,5 @@ class ofdm_sync_fixed(gr.hier_block2):
self.connect(self.peak_trigger, (self,1))
if logging:
- self.connect(self.peak_trigger, gr.file_sink(gr.sizeof_char, "ofdm_sync_fixed-peaks_b.dat"))
+ self.connect(self.peak_trigger, blocks.file_sink(gr.sizeof_char, "ofdm_sync_fixed-peaks_b.dat"))
diff --git a/gr-digital/python/ofdm_sync_ml.py b/gr-digital/python/ofdm_sync_ml.py
index 7c75d7f1d4..3afd647098 100644
--- a/gr-digital/python/ofdm_sync_ml.py
+++ b/gr-digital/python/ofdm_sync_ml.py
@@ -23,6 +23,16 @@
import math
from gnuradio import gr
+try:
+ from gnuradio import filter
+except ImportError:
+ import filter_swig as filter
+
+try:
+ from gnuradio import blocks
+except ImportError:
+ import blocks_swig as blocks
+
class ofdm_sync_ml(gr.hier_block2):
def __init__(self, fft_length, cp_length, snr, kstime, logging):
''' Maximum Likelihood OFDM synchronizer:
@@ -35,7 +45,7 @@ class ofdm_sync_ml(gr.hier_block2):
gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
gr.io_signature2(2, 2, gr.sizeof_float, gr.sizeof_char)) # Output signature
- self.input = gr.add_const_cc(0)
+ self.input = blocks.add_const_cc(0)
SNR = 10.0**(snr/10.0)
rho = SNR / (SNR + 1.0)
@@ -48,16 +58,16 @@ class ofdm_sync_ml(gr.hier_block2):
self.connect(self, self.input)
# Create a delay line
- self.delay = gr.delay(gr.sizeof_gr_complex, fft_length)
+ self.delay = blocks.delay(gr.sizeof_gr_complex, fft_length)
self.connect(self.input, self.delay)
# magnitude squared blocks
- self.magsqrd1 = gr.complex_to_mag_squared()
- self.magsqrd2 = gr.complex_to_mag_squared()
- self.adder = gr.add_ff()
+ self.magsqrd1 = blocks.complex_to_mag_squared()
+ self.magsqrd2 = blocks.complex_to_mag_squared()
+ self.adder = blocks.add_ff()
moving_sum_taps = [rho/2 for i in range(cp_length)]
- self.moving_sum_filter = gr.fir_filter_fff(1,moving_sum_taps)
+ self.moving_sum_filter = filter.fir_filter_fff(1,moving_sum_taps)
self.connect(self.input,self.magsqrd1)
self.connect(self.delay,self.magsqrd2)
@@ -67,29 +77,29 @@ class ofdm_sync_ml(gr.hier_block2):
# Correlation from ML Sync
- self.conjg = gr.conjugate_cc();
- self.mixer = gr.multiply_cc();
+ self.conjg = blocks.conjugate_cc();
+ self.mixer = blocks.multiply_cc();
movingsum2_taps = [1.0 for i in range(cp_length)]
- self.movingsum2 = gr.fir_filter_ccf(1,movingsum2_taps)
+ self.movingsum2 = filter.fir_filter_ccf(1,movingsum2_taps)
# Correlator data handler
- self.c2mag = gr.complex_to_mag()
- self.angle = gr.complex_to_arg()
+ self.c2mag = blocks.complex_to_mag()
+ self.angle = blocks.complex_to_arg()
self.connect(self.input,(self.mixer,1))
self.connect(self.delay,self.conjg,(self.mixer,0))
self.connect(self.mixer,self.movingsum2,self.c2mag)
self.connect(self.movingsum2,self.angle)
# ML Sync output arg, need to find maximum point of this
- self.diff = gr.sub_ff()
+ self.diff = blocks.sub_ff()
self.connect(self.c2mag,(self.diff,0))
self.connect(self.moving_sum_filter,(self.diff,1))
#ML measurements input to sampler block and detect
- self.f2c = gr.float_to_complex()
- self.pk_detect = gr.peak_detector_fb(0.2, 0.25, 30, 0.0005)
- self.sample_and_hold = gr.sample_and_hold_ff()
+ self.f2c = blocks.float_to_complex()
+ self.pk_detect = blocks.peak_detector_fb(0.2, 0.25, 30, 0.0005)
+ self.sample_and_hold = blocks.sample_and_hold_ff()
# use the sync loop values to set the sampler and the NCO
# self.diff = theta
@@ -115,9 +125,9 @@ class ofdm_sync_ml(gr.hier_block2):
# to readjust the timing in the middle of the packet or we ruin the equalizer settings.
kstime = [k.conjugate() for k in kstime]
kstime.reverse()
- self.kscorr = gr.fir_filter_ccc(1, kstime)
- self.corrmag = gr.complex_to_mag_squared()
- self.div = gr.divide_ff()
+ self.kscorr = filter.fir_filter_ccc(1, kstime)
+ self.corrmag = blocks.complex_to_mag_squared()
+ self.div = blocks.divide_ff()
# The output signature of the correlation has a few spikes because the rest of the
# system uses the repeated preamble symbol. It needs to work that generically if
@@ -125,10 +135,10 @@ class ofdm_sync_ml(gr.hier_block2):
# The output theta of the correlator above is multiplied with this correlation to
# identify the proper peak and remove other products in this cross-correlation
self.threshold_factor = 0.1
- self.slice = gr.threshold_ff(self.threshold_factor, self.threshold_factor, 0)
- self.f2b = gr.float_to_char()
- self.b2f = gr.char_to_float()
- self.mul = gr.multiply_ff()
+ self.slice = blocks.threshold_ff(self.threshold_factor, self.threshold_factor, 0)
+ self.f2b = blocks.float_to_char()
+ self.b2f = blocks.char_to_float()
+ self.mul = blocks.multiply_ff()
# Normalize the power of the corr output by the energy. This is not really needed
# and could be removed for performance, but it makes for a cleaner signal.
@@ -148,18 +158,18 @@ class ofdm_sync_ml(gr.hier_block2):
if logging:
- self.connect(self.moving_sum_filter, gr.file_sink(gr.sizeof_float, "ofdm_sync_ml-energy_f.dat"))
- self.connect(self.diff, gr.file_sink(gr.sizeof_float, "ofdm_sync_ml-theta_f.dat"))
- self.connect(self.angle, gr.file_sink(gr.sizeof_float, "ofdm_sync_ml-epsilon_f.dat"))
- self.connect(self.corrmag, gr.file_sink(gr.sizeof_float, "ofdm_sync_ml-corrmag_f.dat"))
- self.connect(self.kscorr, gr.file_sink(gr.sizeof_gr_complex, "ofdm_sync_ml-kscorr_c.dat"))
- self.connect(self.div, gr.file_sink(gr.sizeof_float, "ofdm_sync_ml-div_f.dat"))
- self.connect(self.mul, gr.file_sink(gr.sizeof_float, "ofdm_sync_ml-mul_f.dat"))
- self.connect(self.slice, gr.file_sink(gr.sizeof_float, "ofdm_sync_ml-slice_f.dat"))
- self.connect(self.pk_detect, gr.file_sink(gr.sizeof_char, "ofdm_sync_ml-peaks_b.dat"))
+ self.connect(self.moving_sum_filter, blocks.file_sink(gr.sizeof_float, "ofdm_sync_ml-energy_f.dat"))
+ self.connect(self.diff, blocks.file_sink(gr.sizeof_float, "ofdm_sync_ml-theta_f.dat"))
+ self.connect(self.angle, blocks.file_sink(gr.sizeof_float, "ofdm_sync_ml-epsilon_f.dat"))
+ self.connect(self.corrmag, blocks.file_sink(gr.sizeof_float, "ofdm_sync_ml-corrmag_f.dat"))
+ self.connect(self.kscorr, blocks.file_sink(gr.sizeof_gr_complex, "ofdm_sync_ml-kscorr_c.dat"))
+ self.connect(self.div, blocks.file_sink(gr.sizeof_float, "ofdm_sync_ml-div_f.dat"))
+ self.connect(self.mul, blocks.file_sink(gr.sizeof_float, "ofdm_sync_ml-mul_f.dat"))
+ self.connect(self.slice, blocks.file_sink(gr.sizeof_float, "ofdm_sync_ml-slice_f.dat"))
+ self.connect(self.pk_detect, blocks.file_sink(gr.sizeof_char, "ofdm_sync_ml-peaks_b.dat"))
if use_dpll:
- self.connect(self.dpll, gr.file_sink(gr.sizeof_char, "ofdm_sync_ml-dpll_b.dat"))
+ self.connect(self.dpll, blocks.file_sink(gr.sizeof_char, "ofdm_sync_ml-dpll_b.dat"))
- self.connect(self.sample_and_hold, gr.file_sink(gr.sizeof_float, "ofdm_sync_ml-sample_and_hold_f.dat"))
- self.connect(self.input, gr.file_sink(gr.sizeof_gr_complex, "ofdm_sync_ml-input_c.dat"))
+ self.connect(self.sample_and_hold, blocks.file_sink(gr.sizeof_float, "ofdm_sync_ml-sample_and_hold_f.dat"))
+ self.connect(self.input, blocks.file_sink(gr.sizeof_gr_complex, "ofdm_sync_ml-input_c.dat"))
diff --git a/gr-digital/python/ofdm_sync_pn.py b/gr-digital/python/ofdm_sync_pn.py
index 05b1de2e19..4c6a30f802 100644
--- a/gr-digital/python/ofdm_sync_pn.py
+++ b/gr-digital/python/ofdm_sync_pn.py
@@ -24,6 +24,16 @@ import math
from numpy import fft
from gnuradio import gr
+try:
+ from gnuradio import filter
+except ImportError:
+ import filter_swig as filter
+
+try:
+ from gnuradio import blocks
+except ImportError:
+ import blocks_swig as blocks
+
class ofdm_sync_pn(gr.hier_block2):
def __init__(self, fft_length, cp_length, logging=False):
"""
@@ -37,47 +47,47 @@ class ofdm_sync_pn(gr.hier_block2):
gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
gr.io_signature2(2, 2, gr.sizeof_float, gr.sizeof_char)) # Output signature
- self.input = gr.add_const_cc(0)
+ self.input = blocks.add_const_cc(0)
# PN Sync
# Create a delay line
- self.delay = gr.delay(gr.sizeof_gr_complex, fft_length/2)
+ self.delay = blocks.delay(gr.sizeof_gr_complex, fft_length/2)
# Correlation from ML Sync
- self.conjg = gr.conjugate_cc();
- self.corr = gr.multiply_cc();
+ self.conjg = blocks.conjugate_cc();
+ self.corr = blocks.multiply_cc();
# Create a moving sum filter for the corr output
if 1:
moving_sum_taps = [1.0 for i in range(fft_length//2)]
- self.moving_sum_filter = gr.fir_filter_ccf(1,moving_sum_taps)
+ self.moving_sum_filter = filter.fir_filter_ccf(1,moving_sum_taps)
else:
moving_sum_taps = [complex(1.0,0.0) for i in range(fft_length//2)]
- self.moving_sum_filter = gr.fft_filter_ccc(1,moving_sum_taps)
+ self.moving_sum_filter = filter.fft_filter_ccc(1,moving_sum_taps)
# Create a moving sum filter for the input
- self.inputmag2 = gr.complex_to_mag_squared()
+ self.inputmag2 = blocks.complex_to_mag_squared()
movingsum2_taps = [1.0 for i in range(fft_length//2)]
if 1:
- self.inputmovingsum = gr.fir_filter_fff(1,movingsum2_taps)
+ self.inputmovingsum = filter.fir_filter_fff(1,movingsum2_taps)
else:
- self.inputmovingsum = gr.fft_filter_fff(1,movingsum2_taps)
+ self.inputmovingsum = filter.fft_filter_fff(1,movingsum2_taps)
- self.square = gr.multiply_ff()
- self.normalize = gr.divide_ff()
+ self.square = blocks.multiply_ff()
+ self.normalize = blocks.divide_ff()
# Get magnitude (peaks) and angle (phase/freq error)
- self.c2mag = gr.complex_to_mag_squared()
- self.angle = gr.complex_to_arg()
+ self.c2mag = blocks.complex_to_mag_squared()
+ self.angle = blocks.complex_to_arg()
- self.sample_and_hold = gr.sample_and_hold_ff()
+ self.sample_and_hold = blocks.sample_and_hold_ff()
#ML measurements input to sampler block and detect
- self.sub1 = gr.add_const_ff(-1)
- self.pk_detect = gr.peak_detector_fb(0.20, 0.20, 30, 0.001)
- #self.pk_detect = gr.peak_detector2_fb(9)
+ self.sub1 = blocks.add_const_ff(-1)
+ self.pk_detect = blocks.peak_detector_fb(0.20, 0.20, 30, 0.001)
+ #self.pk_detect = blocks.peak_detector2_fb(9)
self.connect(self, self.input)
@@ -100,7 +110,7 @@ class ofdm_sync_pn(gr.hier_block2):
# Create a moving sum filter for the corr output
matched_filter_taps = [1.0/cp_length for i in range(cp_length)]
- self.matched_filter = gr.fir_filter_fff(1,matched_filter_taps)
+ self.matched_filter = filter.fir_filter_fff(1,matched_filter_taps)
self.connect(self.normalize, self.matched_filter)
self.connect(self.matched_filter, self.sub1, self.pk_detect)
@@ -114,10 +124,10 @@ class ofdm_sync_pn(gr.hier_block2):
self.connect(self.pk_detect, (self,1))
if logging:
- self.connect(self.matched_filter, gr.file_sink(gr.sizeof_float, "ofdm_sync_pn-mf_f.dat"))
- self.connect(self.normalize, gr.file_sink(gr.sizeof_float, "ofdm_sync_pn-theta_f.dat"))
- self.connect(self.angle, gr.file_sink(gr.sizeof_float, "ofdm_sync_pn-epsilon_f.dat"))
- self.connect(self.pk_detect, gr.file_sink(gr.sizeof_char, "ofdm_sync_pn-peaks_b.dat"))
- self.connect(self.sample_and_hold, gr.file_sink(gr.sizeof_float, "ofdm_sync_pn-sample_and_hold_f.dat"))
- self.connect(self.input, gr.file_sink(gr.sizeof_gr_complex, "ofdm_sync_pn-input_c.dat"))
+ self.connect(self.matched_filter, blocks.file_sink(gr.sizeof_float, "ofdm_sync_pn-mf_f.dat"))
+ self.connect(self.normalize, blocks.file_sink(gr.sizeof_float, "ofdm_sync_pn-theta_f.dat"))
+ self.connect(self.angle, blocks.file_sink(gr.sizeof_float, "ofdm_sync_pn-epsilon_f.dat"))
+ self.connect(self.pk_detect, blocks.file_sink(gr.sizeof_char, "ofdm_sync_pn-peaks_b.dat"))
+ self.connect(self.sample_and_hold, blocks.file_sink(gr.sizeof_float, "ofdm_sync_pn-sample_and_hold_f.dat"))
+ self.connect(self.input, blocks.file_sink(gr.sizeof_gr_complex, "ofdm_sync_pn-input_c.dat"))
diff --git a/gr-digital/python/ofdm_sync_pnac.py b/gr-digital/python/ofdm_sync_pnac.py
index 10a1259641..ee7c82927a 100644
--- a/gr-digital/python/ofdm_sync_pnac.py
+++ b/gr-digital/python/ofdm_sync_pnac.py
@@ -24,6 +24,16 @@ import math
from numpy import fft
from gnuradio import gr
+try:
+ from gnuradio import filter
+except ImportError:
+ import filter_swig as filter
+
+try:
+ from gnuradio import blocks
+except ImportError:
+ import blocks_swig as blocks
+
class ofdm_sync_pnac(gr.hier_block2):
def __init__(self, fft_length, cp_length, kstime, logging=False):
"""
@@ -50,7 +60,7 @@ class ofdm_sync_pnac(gr.hier_block2):
gr.io_signature2(2, 2, gr.sizeof_float, gr.sizeof_char)) # Output signature
- self.input = gr.add_const_cc(0)
+ self.input = blocks.add_const_cc(0)
symbol_length = fft_length + cp_length
@@ -59,30 +69,30 @@ class ofdm_sync_pnac(gr.hier_block2):
# cross-correlate with the known symbol
kstime = [k.conjugate() for k in kstime[0:fft_length//2]]
kstime.reverse()
- self.crosscorr_filter = gr.fir_filter_ccc(1, kstime)
+ self.crosscorr_filter = filter.fir_filter_ccc(1, kstime)
# Create a delay line
- self.delay = gr.delay(gr.sizeof_gr_complex, fft_length/2)
+ self.delay = blocks.delay(gr.sizeof_gr_complex, fft_length/2)
# Correlation from ML Sync
- self.conjg = gr.conjugate_cc();
- self.corr = gr.multiply_cc();
+ self.conjg = blocks.conjugate_cc();
+ self.corr = blocks.multiply_cc();
# Create a moving sum filter for the input
- self.mag = gr.complex_to_mag_squared()
+ self.mag = blocks.complex_to_mag_squared()
movingsum_taps = (fft_length//1)*[1.0,]
- self.power = gr.fir_filter_fff(1,movingsum_taps)
+ self.power = filter.fir_filter_fff(1,movingsum_taps)
# Get magnitude (peaks) and angle (phase/freq error)
- self.c2mag = gr.complex_to_mag_squared()
- self.angle = gr.complex_to_arg()
- self.compare = gr.sub_ff()
+ self.c2mag = blocks.complex_to_mag_squared()
+ self.angle = blocks.complex_to_arg()
+ self.compare = blocks.sub_ff()
- self.sample_and_hold = gr.sample_and_hold_ff()
+ self.sample_and_hold = blocks.sample_and_hold_ff()
#ML measurements input to sampler block and detect
- self.threshold = gr.threshold_ff(0,0,0) # threshold detection might need to be tweaked
- self.peaks = gr.float_to_char()
+ self.threshold = blocks.threshold_ff(0,0,0) # threshold detection might need to be tweaked
+ self.peaks = blocksx.float_to_char()
self.connect(self, self.input)
@@ -115,11 +125,11 @@ class ofdm_sync_pnac(gr.hier_block2):
self.connect(self.peaks, (self,1))
if logging:
- self.connect(self.compare, gr.file_sink(gr.sizeof_float, "ofdm_sync_pnac-compare_f.dat"))
- self.connect(self.c2mag, gr.file_sink(gr.sizeof_float, "ofdm_sync_pnac-theta_f.dat"))
- self.connect(self.power, gr.file_sink(gr.sizeof_float, "ofdm_sync_pnac-inputpower_f.dat"))
- self.connect(self.angle, gr.file_sink(gr.sizeof_float, "ofdm_sync_pnac-epsilon_f.dat"))
- self.connect(self.threshold, gr.file_sink(gr.sizeof_float, "ofdm_sync_pnac-threshold_f.dat"))
- self.connect(self.peaks, gr.file_sink(gr.sizeof_char, "ofdm_sync_pnac-peaks_b.dat"))
- self.connect(self.sample_and_hold, gr.file_sink(gr.sizeof_float, "ofdm_sync_pnac-sample_and_hold_f.dat"))
- self.connect(self.input, gr.file_sink(gr.sizeof_gr_complex, "ofdm_sync_pnac-input_c.dat"))
+ self.connect(self.compare, blocks.file_sink(gr.sizeof_float, "ofdm_sync_pnac-compare_f.dat"))
+ self.connect(self.c2mag, blocks.file_sink(gr.sizeof_float, "ofdm_sync_pnac-theta_f.dat"))
+ self.connect(self.power, blocks.file_sink(gr.sizeof_float, "ofdm_sync_pnac-inputpower_f.dat"))
+ self.connect(self.angle, blocks.file_sink(gr.sizeof_float, "ofdm_sync_pnac-epsilon_f.dat"))
+ self.connect(self.threshold, blocks.file_sink(gr.sizeof_float, "ofdm_sync_pnac-threshold_f.dat"))
+ self.connect(self.peaks, blocks.file_sink(gr.sizeof_char, "ofdm_sync_pnac-peaks_b.dat"))
+ self.connect(self.sample_and_hold, blocks.file_sink(gr.sizeof_float, "ofdm_sync_pnac-sample_and_hold_f.dat"))
+ self.connect(self.input, blocks.file_sink(gr.sizeof_gr_complex, "ofdm_sync_pnac-input_c.dat"))
diff --git a/gr-digital/python/packet_utils.py b/gr-digital/python/packet_utils.py
index 2e216ff50e..2929758ef0 100644
--- a/gr-digital/python/packet_utils.py
+++ b/gr-digital/python/packet_utils.py
@@ -107,13 +107,12 @@ def make_packet(payload, samples_per_symbol, bits_per_symbol,
"""
Build a packet, given access code, payload, and whitener offset
- @param payload: packet payload, len [0, 4096]
- @param samples_per_symbol: samples per symbol (needed for padding calculation)
- @type samples_per_symbol: int
- @param bits_per_symbol: (needed for padding calculation)
- @type bits_per_symbol: int
- @param access_code: string of ascii 0's and 1's
- @param whitener_offset offset into whitener string to use [0-16)
+ Args:
+ payload: packet payload, len [0, 4096]
+ samples_per_symbol: samples per symbol (needed for padding calculation) (int)
+ bits_per_symbol: (needed for padding calculation) (int)
+ access_code: string of ascii 0's and 1's
+ whitener_offset: offset into whitener string to use [0-16)
Packet will have access code at the beginning, followed by length, payload
and finally CRC-32.
@@ -156,13 +155,13 @@ def _npadding_bytes(pkt_byte_len, samples_per_symbol, bits_per_symbol):
we want to pad so that after modulation the resulting packet
is a multiple of 128 samples.
- @param ptk_byte_len: len in bytes of packet, not including padding.
- @param samples_per_symbol: samples per bit (1 bit / symbolwidth GMSK)
- @type samples_per_symbol: int
- @param bits_per_symbol: bits per symbol (log2(modulation order))
- @type bits_per_symbol: int
+ Args:
+ ptk_byte_len: len in bytes of packet, not including padding.
+ samples_per_symbol: samples per bit (1 bit / symbolwidth GMSK) (int)
+ bits_per_symbol: bits per symbol (log2(modulation order)) (int)
- @returns number of bytes of padding to append.
+ Returns:
+ number of bytes of padding to append.
"""
modulus = 128
byte_modulus = gru.lcm(modulus/8, samples_per_symbol) * bits_per_symbol / samples_per_symbol
@@ -176,7 +175,8 @@ def unmake_packet(whitened_payload_with_crc, whitener_offset=0, dewhitening=True
"""
Return (ok, payload)
- @param whitened_payload_with_crc: string
+ Args:
+ whitened_payload_with_crc: string
"""
if dewhitening:
diff --git a/gr-digital/python/pkt.py b/gr-digital/python/pkt.py
index 8650bdbb02..434548906e 100644
--- a/gr-digital/python/pkt.py
+++ b/gr-digital/python/pkt.py
@@ -23,8 +23,12 @@ from math import pi
from gnuradio import gr
import gnuradio.gr.gr_threading as _threading
import packet_utils
-import digital_swig
+import digital_swig as digital
+try:
+ from gnuradio import blocks
+except ImportError:
+ import blocks_swig as blocks
# /////////////////////////////////////////////////////////////////////////////
# mod/demod with packets as i/o
@@ -44,14 +48,12 @@ class mod_pkts(gr.hier_block2):
Packets to be sent are enqueued by calling send_pkt.
The output is the complex modulated signal at baseband.
- @param modulator: instance of modulator class (gr_block or hier_block2)
- @type modulator: complex baseband out
- @param access_code: AKA sync vector
- @type access_code: string of 1's and 0's between 1 and 64 long
- @param msgq_limit: maximum number of messages in message queue
- @type msgq_limit: int
- @param pad_for_usrp: If true, packets are padded such that they end up a multiple of 128 samples
- @param use_whitener_offset: If true, start of whitener XOR string is incremented each packet
+ Args:
+ modulator: instance of modulator class (gr_block or hier_block2) (complex baseband out)
+ access_code: AKA sync vector (string of 1's and 0's between 1 and 64 long)
+ msgq_limit: maximum number of messages in message queue (int)
+ pad_for_usrp: If true, packets are padded such that they end up a multiple of 128 samples
+ use_whitener_offset: If true, start of whitener XOR string is incremented each packet
See gmsk_mod for remaining parameters
"""
@@ -72,15 +74,15 @@ class mod_pkts(gr.hier_block2):
self._access_code = access_code
# accepts messages from the outside world
- self._pkt_input = gr.message_source(gr.sizeof_char, msgq_limit)
+ self._pkt_input = blocks.message_source(gr.sizeof_char, msgq_limit)
self.connect(self._pkt_input, self._modulator, self)
def send_pkt(self, payload='', eof=False):
"""
Send the payload.
- @param payload: data to send
- @type payload: string
+ Args:
+ payload: data to send (string)
"""
if eof:
msg = gr.message(1) # tell self._pkt_input we're not sending any more packets
@@ -116,14 +118,11 @@ class demod_pkts(gr.hier_block2):
The input is the complex modulated signal at baseband.
Demodulated packets are sent to the handler.
- @param demodulator: instance of demodulator class (gr_block or hier_block2)
- @type demodulator: complex baseband in
- @param access_code: AKA sync vector
- @type access_code: string of 1's and 0's
- @param callback: function of two args: ok, payload
- @type callback: ok: bool; payload: string
- @param threshold: detect access_code with up to threshold bits wrong (-1 -> use default)
- @type threshold: int
+ Args:
+ demodulator: instance of demodulator class (gr_block or hier_block2) (complex baseband in)
+ access_code: AKA sync vector (string of 1's and 0's)
+ callback: function of two args: ok, payload (ok: bool; payload: string)
+ threshold: detect access_code with up to threshold bits wrong (-1 -> use default) (int)
"""
gr.hier_block2.__init__(self, "demod_pkts",
@@ -141,9 +140,9 @@ class demod_pkts(gr.hier_block2):
threshold = 12 # FIXME raise exception
self._rcvd_pktq = gr.msg_queue() # holds packets from the PHY
- self.correlator = digital_swig.correlate_access_code_bb(access_code, threshold)
+ self.correlator = digital.correlate_access_code_bb(access_code, threshold)
- self.framer_sink = gr.framer_sink_1(self._rcvd_pktq)
+ self.framer_sink = digital.framer_sink_1(self._rcvd_pktq)
self.connect(self, self._demodulator, self.correlator, self.framer_sink)
self._watcher = _queue_watcher_thread(self._rcvd_pktq, callback)
diff --git a/gr-digital/python/psk.py b/gr-digital/python/psk.py
index 58f6787f0c..1816ffb4ba 100644
--- a/gr-digital/python/psk.py
+++ b/gr-digital/python/psk.py
@@ -30,22 +30,29 @@ import digital_swig
import modulation_utils
from utils import mod_codes, gray_code
from generic_mod_demod import generic_mod, generic_demod
+from generic_mod_demod import shared_mod_args, shared_demod_args
# Default number of points in constellation.
_def_constellation_points = 4
# The default encoding (e.g. gray-code, set-partition)
_def_mod_code = mod_codes.GRAY_CODE
+# Default use of differential encoding
+_def_differential = True
-def create_encodings(mod_code, arity):
+def create_encodings(mod_code, arity, differential):
post_diff_code = None
if mod_code not in mod_codes.codes:
raise ValueError('That modulation code does not exist.')
if mod_code == mod_codes.GRAY_CODE:
- pre_diff_code = gray_code.gray_code(arity)
- elif mod_code == mod_codes.SET_PARTITION_CODE:
- pre_diff_code = set_partition_code.set_partition_code(arity)
+ if differential:
+ pre_diff_code = gray_code.gray_code(arity)
+ post_diff_code = None
+ else:
+ pre_diff_code = []
+ post_diff_code = gray_code.gray_code(arity)
elif mod_code == mod_codes.NO_CODE:
pre_diff_code = []
+ post_diff_code = None
else:
raise ValueError('That modulation code is not implemented for this constellation.')
return (pre_diff_code, post_diff_code)
@@ -54,7 +61,8 @@ def create_encodings(mod_code, arity):
# PSK constellation
# /////////////////////////////////////////////////////////////////////////////
-def psk_constellation(m=_def_constellation_points, mod_code=_def_mod_code):
+def psk_constellation(m=_def_constellation_points, mod_code=_def_mod_code,
+ differential=_def_differential):
"""
Creates a PSK constellation object.
"""
@@ -62,7 +70,7 @@ def psk_constellation(m=_def_constellation_points, mod_code=_def_mod_code):
if (k != int(k)):
raise StandardError('Number of constellation points must be a power of two.')
points = [exp(2*pi*(0+1j)*i/m) for i in range(0,m)]
- pre_diff_code, post_diff_code = create_encodings(mod_code, m)
+ pre_diff_code, post_diff_code = create_encodings(mod_code, m, differential)
if post_diff_code is not None:
inverse_post_diff_code = mod_codes.invert_code(post_diff_code)
points = [points[x] for x in inverse_post_diff_code]
@@ -74,22 +82,26 @@ def psk_constellation(m=_def_constellation_points, mod_code=_def_mod_code):
# /////////////////////////////////////////////////////////////////////////////
class psk_mod(generic_mod):
+ """
+ Hierarchical block for RRC-filtered PSK modulation.
+
+ The input is a byte stream (unsigned char) and the
+ output is the complex modulated signal at baseband.
+
+ Args:
+ constellation_points: Number of constellation points (must be a power of two) (integer).
+ mod_code: Whether to use a gray_code (digital.mod_codes.GRAY_CODE) or not (digital.mod_codes.NO_CODE).
+ differential: Whether to use differential encoding (boolean).
+ """
+ # See generic_mod for additional arguments
+ __doc__ += shared_mod_args
def __init__(self, constellation_points=_def_constellation_points,
mod_code=_def_mod_code,
+ differential=_def_differential,
*args, **kwargs):
-
- """
- Hierarchical block for RRC-filtered PSK modulation.
-
- The input is a byte stream (unsigned char) and the
- output is the complex modulated signal at baseband.
-
- See generic_mod block for list of parameters.
- """
-
- constellation = psk_constellation(constellation_points, mod_code)
- super(psk_mod, self).__init__(constellation, *args, **kwargs)
+ constellation = psk_constellation(constellation_points, mod_code, differential)
+ super(psk_mod, self).__init__(constellation, differential, *args, **kwargs)
# /////////////////////////////////////////////////////////////////////////////
# PSK demodulator
@@ -98,21 +110,25 @@ class psk_mod(generic_mod):
class psk_demod(generic_demod):
+ """
+ Hierarchical block for RRC-filtered PSK modulation.
+
+ The input is a byte stream (unsigned char) and the
+ output is the complex modulated signal at baseband.
+
+ Args:
+ constellation_points: Number of constellation points (must be a power of two) (integer).
+ mod_code: Whether to use a gray_code (digital.mod_codes.GRAY_CODE) or not (digital.mod_codes.NO_CODE).
+ differential: Whether to use differential encoding (boolean).
+ """
+ # See generic_mod for additional arguments
+ __doc__ += shared_mod_args
def __init__(self, constellation_points=_def_constellation_points,
mod_code=_def_mod_code,
+ differential=_def_differential,
*args, **kwargs):
-
- """
- Hierarchical block for RRC-filtered PSK modulation.
-
- The input is a byte stream (unsigned char) and the
- output is the complex modulated signal at baseband.
-
- See generic_demod block for list of parameters.
- """
-
- constellation = psk_constellation(constellation_points, mod_code)
- super(psk_demod, self).__init__(constellation, *args, **kwargs)
+ constellation = psk_constellation(constellation_points, mod_code, differential)
+ super(psk_demod, self).__init__(constellation, differential, *args, **kwargs)
#
# Add these to the mod/demod registry
diff --git a/gr-digital/python/qa_binary_slicer_fb.py b/gr-digital/python/qa_binary_slicer_fb.py
index 60d92c5d19..22f7da73ff 100755
--- a/gr-digital/python/qa_binary_slicer_fb.py
+++ b/gr-digital/python/qa_binary_slicer_fb.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2011 Free Software Foundation, Inc.
+# Copyright 2011,2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -21,33 +21,33 @@
#
from gnuradio import gr, gr_unittest
-import digital_swig
+import digital_swig as digital
import math, random
-class test_binary_slicer_fb (gr_unittest.TestCase):
+class test_binary_slicer_fb(gr_unittest.TestCase):
- def setUp (self):
- self.tb = gr.top_block ()
+ def setUp(self):
+ self.tb = gr.top_block()
- def tearDown (self):
+ def tearDown(self):
self.tb = None
- def test_binary_slicer_fb (self):
+ def test_binary_slicer_fb(self):
expected_result = ( 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1)
src_data = (-1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1)
src_data = [s + (1 - random.random()) for s in src_data] # add some noise
- src = gr.vector_source_f (src_data)
- op = digital_swig.binary_slicer_fb ()
- dst = gr.vector_sink_b ()
+ src = gr.vector_source_f(src_data)
+ op = digital.binary_slicer_fb()
+ dst = gr.vector_sink_b()
- self.tb.connect (src, op)
- self.tb.connect (op, dst)
- self.tb.run () # run the graph and wait for it to finish
+ self.tb.connect(src, op)
+ self.tb.connect(op, dst)
+ self.tb.run() # run the graph and wait for it to finish
- actual_result = dst.data () # fetch the contents of the sink
+ actual_result = dst.data() # fetch the contents of the sink
#print "actual result", actual_result
#print "expected result", expected_result
- self.assertFloatTuplesAlmostEqual (expected_result, actual_result)
+ self.assertFloatTuplesAlmostEqual(expected_result, actual_result)
if __name__ == '__main__':
diff --git a/gr-digital/python/qa_chunks_to_symbols.py b/gr-digital/python/qa_chunks_to_symbols.py
index 63af10d8ff..5ffe425132 100755
--- a/gr-digital/python/qa_chunks_to_symbols.py
+++ b/gr-digital/python/qa_chunks_to_symbols.py
@@ -25,10 +25,10 @@ import digital_swig as digital
class test_chunks_to_symbols(gr_unittest.TestCase):
- def setUp (self):
- self.tb = gr.top_block ()
+ def setUp(self):
+ self.tb = gr.top_block()
- def tearDown (self):
+ def tearDown(self):
self.tb = None
def test_bc_001(self):
diff --git a/gr-digital/python/qa_clock_recovery_mm.py b/gr-digital/python/qa_clock_recovery_mm.py
index f4c345b034..e904cf4c21 100755
--- a/gr-digital/python/qa_clock_recovery_mm.py
+++ b/gr-digital/python/qa_clock_recovery_mm.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2011 Free Software Foundation, Inc.
+# Copyright 2011,2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -21,18 +21,18 @@
#
from gnuradio import gr, gr_unittest
-import digital_swig
+import digital_swig as digital
import random, cmath
class test_clock_recovery_mm(gr_unittest.TestCase):
- def setUp (self):
- self.tb = gr.top_block ()
+ def setUp(self):
+ self.tb = gr.top_block()
- def tearDown (self):
+ def tearDown(self):
self.tb = None
- def test01 (self):
+ def test01(self):
# Test complex/complex version
omega = 2
gain_omega = 0.001
@@ -40,9 +40,9 @@ class test_clock_recovery_mm(gr_unittest.TestCase):
gain_mu = 0.01
omega_rel_lim = 0.001
- self.test = digital_swig.clock_recovery_mm_cc(omega, gain_omega,
- mu, gain_mu,
- omega_rel_lim)
+ self.test = digital.clock_recovery_mm_cc(omega, gain_omega,
+ mu, gain_mu,
+ omega_rel_lim)
data = 100*[complex(1, 1),]
self.src = gr.vector_source_c(data, False)
@@ -64,10 +64,10 @@ class test_clock_recovery_mm(gr_unittest.TestCase):
#print expected_result
#print dst_data
- self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 5)
+ self.assertComplexTuplesAlmostEqual(expected_result, dst_data, 5)
- def test02 (self):
+ def test02(self):
# Test float/float version
omega = 2
gain_omega = 0.01
@@ -75,9 +75,9 @@ class test_clock_recovery_mm(gr_unittest.TestCase):
gain_mu = 0.01
omega_rel_lim = 0.001
- self.test = digital_swig.clock_recovery_mm_ff(omega, gain_omega,
- mu, gain_mu,
- omega_rel_lim)
+ self.test = digital.clock_recovery_mm_ff(omega, gain_omega,
+ mu, gain_mu,
+ omega_rel_lim)
data = 100*[1,]
self.src = gr.vector_source_f(data, False)
@@ -99,10 +99,10 @@ class test_clock_recovery_mm(gr_unittest.TestCase):
#print expected_result
#print dst_data
- self.assertFloatTuplesAlmostEqual (expected_result, dst_data, 5)
+ self.assertFloatTuplesAlmostEqual(expected_result, dst_data, 5)
- def test03 (self):
+ def test03(self):
# Test complex/complex version with varying input
omega = 2
gain_omega = 0.01
@@ -110,9 +110,9 @@ class test_clock_recovery_mm(gr_unittest.TestCase):
gain_mu = 0.1
omega_rel_lim = 0.0001
- self.test = digital_swig.clock_recovery_mm_cc(omega, gain_omega,
- mu, gain_mu,
- omega_rel_lim)
+ self.test = digital.clock_recovery_mm_cc(omega, gain_omega,
+ mu, gain_mu,
+ omega_rel_lim)
data = 1000*[complex(1, 1), complex(1, 1), complex(-1, -1), complex(-1, -1)]
self.src = gr.vector_source_c(data, False)
@@ -134,10 +134,10 @@ class test_clock_recovery_mm(gr_unittest.TestCase):
#print expected_result
#print dst_data
- self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 1)
+ self.assertComplexTuplesAlmostEqual(expected_result, dst_data, 1)
- def test04 (self):
+ def test04(self):
# Test float/float version
omega = 2
gain_omega = 0.01
@@ -145,9 +145,9 @@ class test_clock_recovery_mm(gr_unittest.TestCase):
gain_mu = 0.1
omega_rel_lim = 0.001
- self.test = digital_swig.clock_recovery_mm_ff(omega, gain_omega,
- mu, gain_mu,
- omega_rel_lim)
+ self.test = digital.clock_recovery_mm_ff(omega, gain_omega,
+ mu, gain_mu,
+ omega_rel_lim)
data = 1000*[1, 1, -1, -1]
self.src = gr.vector_source_f(data, False)
@@ -169,7 +169,7 @@ class test_clock_recovery_mm(gr_unittest.TestCase):
#print expected_result
#print dst_data
- self.assertFloatTuplesAlmostEqual (expected_result, dst_data, 1)
+ self.assertFloatTuplesAlmostEqual(expected_result, dst_data, 1)
if __name__ == '__main__':
diff --git a/gr-digital/python/qa_cma_equalizer.py b/gr-digital/python/qa_cma_equalizer.py
index 75fb0f05ed..f71e199189 100755
--- a/gr-digital/python/qa_cma_equalizer.py
+++ b/gr-digital/python/qa_cma_equalizer.py
@@ -21,7 +21,7 @@
#
from gnuradio import gr, gr_unittest
-import digital_swig
+import digital_swig as digital
class test_cma_equalizer_fir(gr_unittest.TestCase):
@@ -33,7 +33,7 @@ class test_cma_equalizer_fir(gr_unittest.TestCase):
def transform(self, src_data):
SRC = gr.vector_source_c(src_data, False)
- EQU = digital_swig.cma_equalizer_cc(4, 1.0, .001, 1)
+ EQU = digital.cma_equalizer_cc(4, 1.0, .001, 1)
DST = gr.vector_sink_c()
self.tb.connect(SRC, EQU, DST)
self.tb.run()
@@ -44,7 +44,9 @@ class test_cma_equalizer_fir(gr_unittest.TestCase):
src_data = (1+0j, 0+1j, -1+0j, 0-1j)*1000
expected_data = src_data
result = self.transform(src_data)
- self.assertComplexTuplesAlmostEqual(expected_data, result)
+
+ N = -500
+ self.assertComplexTuplesAlmostEqual(expected_data[N:], result[N:])
if __name__ == "__main__":
gr_unittest.run(test_cma_equalizer_fir, "test_cma_equalizer_fir.xml")
diff --git a/gr-digital/python/qa_constellation.py b/gr-digital/python/qa_constellation.py
index ddd8c71e64..a593c3ea3e 100755
--- a/gr-digital/python/qa_constellation.py
+++ b/gr-digital/python/qa_constellation.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2011 Free Software Foundation, Inc.
+# Copyright 2011,2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -23,9 +23,10 @@
import random
from cmath import exp, pi, log
-from gnuradio import gr, gr_unittest, blks2
+from gnuradio import gr, gr_unittest
from utils import mod_codes
-import digital_swig
+import digital_swig as digital
+import blocks_swig as blocks
# import from local folder
import psk
@@ -51,7 +52,7 @@ def twod_constell():
(-1+0j), (0-1j))
rot_sym = 2
dim = 2
- return digital_swig.constellation_calcdist(points, [], rot_sym, dim)
+ return digital.constellation_calcdist(points, [], rot_sym, dim)
def threed_constell():
oned_points = ((1+0j), (0+1j), (-1+0j), (0-1j))
@@ -63,7 +64,7 @@ def threed_constell():
points += [oned_points[ia], oned_points[ib], oned_points[ic]]
rot_sym = 4
dim = 3
- return digital_swig.constellation_calcdist(points, [], rot_sym, dim)
+ return digital.constellation_calcdist(points, [], rot_sym, dim)
# A list of tuples for constellation testing. The contents of the
# tuples are (constructor, poss_args, differential, diff_argname).
@@ -74,15 +75,25 @@ easy_constellation_info = (
{'m': (2, 4, 8, 16, ),
'mod_code': tested_mod_codes, },
True, None),
+ (psk.psk_constellation,
+ {'m': (2, 4, 8, 16, 32, 64),
+ 'mod_code': tested_mod_codes,
+ 'differential': (False,)},
+ False, None),
(qam.qam_constellation,
{'constellation_points': (4,),
'mod_code': tested_mod_codes,
'large_ampls_to_corners': [False],},
True, None),
- (digital_swig.constellation_bpsk, {}, True, None),
- (digital_swig.constellation_qpsk, {}, False, None),
- (digital_swig.constellation_dqpsk, {}, True, None),
- (digital_swig.constellation_8psk, {}, False, None),
+ (qam.qam_constellation,
+ {'constellation_points': (4, 16, 64),
+ 'mod_code': tested_mod_codes,
+ 'differential': (False,)},
+ False, None),
+ (digital.constellation_bpsk, {}, True, None),
+ (digital.constellation_qpsk, {}, False, None),
+ (digital.constellation_dqpsk, {}, True, None),
+ (digital.constellation_8psk, {}, False, None),
(twod_constell, {}, True, None),
(threed_constell, {}, True, None),
)
@@ -150,7 +161,7 @@ def tested_constellations(easy=True, medium=True, difficult=True):
break
-class test_constellation (gr_unittest.TestCase):
+class test_constellation(gr_unittest.TestCase):
src_length = 256
@@ -178,7 +189,7 @@ class test_constellation (gr_unittest.TestCase):
data = dst.data()
# Don't worry about cut off data for now.
first = constellation.bits_per_symbol()
- self.assertEqual (self.src_data[first:len(data)], data[first:])
+ self.assertEqual(self.src_data[first:len(data)], data[first:])
class mod_demod(gr.hier_block2):
@@ -200,40 +211,39 @@ class mod_demod(gr.hier_block2):
self.blocks = [self]
# We expect a stream of unpacked bits.
# First step is to pack them.
- self.blocks.append(
- gr.unpacked_to_packed_bb(1, gr.GR_MSB_FIRST))
+ self.blocks.append(blocks.unpacked_to_packed_bb(1, gr.GR_MSB_FIRST))
# Second step we unpack them such that we have k bits in each byte where
# each constellation symbol hold k bits.
self.blocks.append(
- gr.packed_to_unpacked_bb(self.constellation.bits_per_symbol(),
- gr.GR_MSB_FIRST))
+ blocks.packed_to_unpacked_bb(self.constellation.bits_per_symbol(),
+ gr.GR_MSB_FIRST))
# Apply any pre-differential coding
# Gray-coding is done here if we're also using differential coding.
if self.constellation.apply_pre_diff_code():
- self.blocks.append(gr.map_bb(self.constellation.pre_diff_code()))
+ self.blocks.append(digital.map_bb(self.constellation.pre_diff_code()))
# Differential encoding.
if self.differential:
- self.blocks.append(gr.diff_encoder_bb(arity))
+ self.blocks.append(digital.diff_encoder_bb(arity))
# Convert to constellation symbols.
- self.blocks.append(gr.chunks_to_symbols_bc(self.constellation.points(),
- self.constellation.dimensionality()))
+ self.blocks.append(digital.chunks_to_symbols_bc(self.constellation.points(),
+ self.constellation.dimensionality()))
# CHANNEL
# Channel just consists of a rotation to check differential coding.
if rotation is not None:
- self.blocks.append(gr.multiply_const_cc(rotation))
+ self.blocks.append(blocks.multiply_const_cc(rotation))
# RX
# Convert the constellation symbols back to binary values.
- self.blocks.append(digital_swig.constellation_decoder_cb(self.constellation.base()))
+ self.blocks.append(digital.constellation_decoder_cb(self.constellation.base()))
# Differential decoding.
if self.differential:
- self.blocks.append(gr.diff_decoder_bb(arity))
+ self.blocks.append(digital.diff_decoder_bb(arity))
# Decode any pre-differential coding.
if self.constellation.apply_pre_diff_code():
- self.blocks.append(gr.map_bb(
+ self.blocks.append(digital.map_bb(
mod_codes.invert_code(self.constellation.pre_diff_code())))
# unpack the k bit vector into a stream of bits
- self.blocks.append(gr.unpack_k_bits_bb(
+ self.blocks.append(blocks.unpack_k_bits_bb(
self.constellation.bits_per_symbol()))
# connect to block output
check_index = len(self.blocks)
@@ -241,7 +251,6 @@ class mod_demod(gr.hier_block2):
self.blocks.append(self)
self.connect(*self.blocks)
-
if __name__ == '__main__':
gr_unittest.run(test_constellation, "test_constellation.xml")
diff --git a/gr-digital/python/qa_constellation_decoder_cb.py b/gr-digital/python/qa_constellation_decoder_cb.py
index 5401a07fc0..6a93b6e743 100755
--- a/gr-digital/python/qa_constellation_decoder_cb.py
+++ b/gr-digital/python/qa_constellation_decoder_cb.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2004,2007,2010,2011 Free Software Foundation, Inc.
+# Copyright 2004,2007,2010-2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -21,54 +21,54 @@
#
from gnuradio import gr, gr_unittest
-import digital_swig
+import digital_swig as digital
import math
-class test_constellation_decoder (gr_unittest.TestCase):
+class test_constellation_decoder(gr_unittest.TestCase):
- def setUp (self):
- self.tb = gr.top_block ()
+ def setUp(self):
+ self.tb = gr.top_block()
- def tearDown (self):
+ def tearDown(self):
self.tb = None
- def test_constellation_decoder_cb_bpsk (self):
- cnst = digital_swig.constellation_bpsk()
+ def test_constellation_decoder_cb_bpsk(self):
+ cnst = digital.constellation_bpsk()
src_data = (0.5 + 0.5j, 0.1 - 1.2j, -0.8 - 0.1j, -0.45 + 0.8j,
0.8 + 1.0j, -0.5 + 0.1j, 0.1 - 1.2j)
expected_result = ( 1, 1, 0, 0,
1, 0, 1)
- src = gr.vector_source_c (src_data)
- op = digital_swig.constellation_decoder_cb (cnst.base())
- dst = gr.vector_sink_b ()
+ src = gr.vector_source_c(src_data)
+ op = digital.constellation_decoder_cb(cnst.base())
+ dst = gr.vector_sink_b()
- self.tb.connect (src, op)
- self.tb.connect (op, dst)
- self.tb.run () # run the graph and wait for it to finish
+ self.tb.connect(src, op)
+ self.tb.connect(op, dst)
+ self.tb.run() # run the graph and wait for it to finish
- actual_result = dst.data () # fetch the contents of the sink
+ actual_result = dst.data() # fetch the contents of the sink
#print "actual result", actual_result
#print "expected result", expected_result
- self.assertFloatTuplesAlmostEqual (expected_result, actual_result)
+ self.assertFloatTuplesAlmostEqual(expected_result, actual_result)
- def test_constellation_decoder_cb_qpsk (self):
- cnst = digital_swig.constellation_qpsk()
+ def _test_constellation_decoder_cb_qpsk(self):
+ cnst = digital.constellation_qpsk()
src_data = (0.5 + 0.5j, 0.1 - 1.2j, -0.8 - 0.1j, -0.45 + 0.8j,
0.8 + 1.0j, -0.5 + 0.1j, 0.1 - 1.2j)
expected_result = ( 3, 1, 0, 2,
3, 2, 1)
- src = gr.vector_source_c (src_data)
- op = digital_swig.constellation_decoder_cb (cnst.base())
- dst = gr.vector_sink_b ()
+ src = gr.vector_source_c(src_data)
+ op = digital_swig.constellation_decoder_cb(cnst.base())
+ dst = gr.vector_sink_b()
- self.tb.connect (src, op)
- self.tb.connect (op, dst)
- self.tb.run () # run the graph and wait for it to finish
+ self.tb.connect(src, op)
+ self.tb.connect(op, dst)
+ self.tb.run() # run the graph and wait for it to finish
- actual_result = dst.data () # fetch the contents of the sink
+ actual_result = dst.data() # fetch the contents of the sink
#print "actual result", actual_result
#print "expected result", expected_result
- self.assertFloatTuplesAlmostEqual (expected_result, actual_result)
+ self.assertFloatTuplesAlmostEqual(expected_result, actual_result)
if __name__ == '__main__':
diff --git a/gr-digital/python/qa_constellation_receiver.py b/gr-digital/python/qa_constellation_receiver.py
index 37e56b4cf7..bc44220ea9 100755
--- a/gr-digital/python/qa_constellation_receiver.py
+++ b/gr-digital/python/qa_constellation_receiver.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2011 Free Software Foundation, Inc.
+# Copyright 2011,2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -22,9 +22,12 @@
import random
-from gnuradio import gr, blks2, gr_unittest
+from gnuradio import gr, gr_unittest
from utils import mod_codes, alignment
-import digital_swig, packet_utils
+import packet_utils
+import filter_swig as filter
+import analog_swig as analog
+import blocks_swig as blocks
from generic_mod_demod import generic_mod, generic_demod
from qa_constellation import tested_constellations, twod_constell
@@ -37,7 +40,7 @@ SEED = 1239
# TESTING PARAMETERS
# The number of symbols to test with.
# We need this many to let the frequency recovery block converge.
-DATA_LENGTH = 2000
+DATA_LENGTH = 1000
# Test fails if fraction of output that is correct is less than this.
EASY_REQ_CORRECT = 0.9
# For constellations that aren't expected to work so well.
@@ -52,8 +55,30 @@ TIMING_OFFSET = 1.0
FREQ_BW = 2*math.pi/100.0
PHASE_BW = 2*math.pi/100.0
+class channel_model(gr.hier_block2):
+ def __init__(self, noise_voltage, freq, timing):
+ gr.hier_block2.__init__(self, "channel_model",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex),
+ gr.io_signature(1, 1, gr.sizeof_gr_complex))
+
-class test_constellation_receiver (gr_unittest.TestCase):
+ timing_offset = filter.fractional_interpolator_cc(0, timing)
+ noise_adder = blocks.add_cc()
+ noise = analog.noise_source_c(analog.GR_GAUSSIAN,
+ noise_voltage, 0)
+ freq_offset = analog.sig_source_c(1, analog.GR_SIN_WAVE,
+ freq, 1.0, 0.0)
+ mixer_offset = blocks.multiply_cc();
+
+ self.connect(self, timing_offset)
+ self.connect(timing_offset, (mixer_offset,0))
+ self.connect(freq_offset, (mixer_offset,1))
+ self.connect(mixer_offset, (noise_adder,1))
+ self.connect(noise, (noise_adder,0))
+ self.connect(noise_adder, self)
+
+
+class test_constellation_receiver(gr_unittest.TestCase):
# We ignore the first half of the output data since often it takes
# a while for the receiver to lock on.
@@ -109,18 +134,20 @@ class test_constellation_receiver (gr_unittest.TestCase):
self.assertTrue(correct > req_correct)
-class rec_test_tb (gr.top_block):
+class rec_test_tb(gr.top_block):
"""
Takes a constellation an runs a generic modulation, channel,
and generic demodulation.
"""
def __init__(self, constellation, differential,
- data_length=None, src_data=None):
+ data_length=None, src_data=None, freq_offset=True):
"""
- constellation -- a constellation object
- differential -- whether differential encoding is used
- data_length -- the number of bits of data to use
- src_data -- a list of the bits to use
+ Args:
+ constellation: a constellation object
+ differential: whether differential encoding is used
+ data_length: the number of bits of data to use
+ src_data: a list of the bits to use
+ freq_offset: whether to use a frequency offset in the channel
"""
super(rec_test_tb, self).__init__()
# Transmission Blocks
@@ -128,15 +155,22 @@ class rec_test_tb (gr.top_block):
self.src_data = tuple([rndm.randint(0,1) for i in range(0, data_length)])
else:
self.src_data = src_data
- packer = gr.unpacked_to_packed_bb(1, gr.GR_MSB_FIRST)
+ packer = blocks.unpacked_to_packed_bb(1, gr.GR_MSB_FIRST)
src = gr.vector_source_b(self.src_data)
mod = generic_mod(constellation, differential=differential)
# Channel
- channel = gr.channel_model(NOISE_VOLTAGE, FREQUENCY_OFFSET, TIMING_OFFSET)
+ if freq_offset:
+ channel = channel_model(NOISE_VOLTAGE, FREQUENCY_OFFSET, TIMING_OFFSET)
+ else:
+ channel = channel_model(NOISE_VOLTAGE, 0, TIMING_OFFSET)
# Receiver Blocks
- demod = generic_demod(constellation, differential=differential,
- freq_bw=FREQ_BW,
- phase_bw=PHASE_BW)
+ if freq_offset:
+ demod = generic_demod(constellation, differential=differential,
+ freq_bw=FREQ_BW,
+ phase_bw=PHASE_BW)
+ else:
+ demod = generic_demod(constellation, differential=differential,
+ freq_bw=0, phase_bw=0)
self.dst = gr.vector_sink_b()
self.connect(src, packer, mod, channel, demod, self.dst)
diff --git a/gr-digital/python/qa_correlate_access_code.py b/gr-digital/python/qa_correlate_access_code.py
index 96246dcfb9..5a5f2209f7 100755
--- a/gr-digital/python/qa_correlate_access_code.py
+++ b/gr-digital/python/qa_correlate_access_code.py
@@ -52,13 +52,13 @@ class test_correlate_access_code(gr_unittest.TestCase):
# 0 0 0 1 0 0 0 1
src_data = (1, 0, 1, 1, 1, 1, 0, 1, 1) + pad + (0,) * 7
expected_result = pad + (1, 0, 1, 1, 3, 1, 0, 1, 1, 2) + (0,) * 6
- src = gr.vector_source_b (src_data)
+ src = gr.vector_source_b(src_data)
op = digital.correlate_access_code_bb("1011", 0)
- dst = gr.vector_sink_b ()
- self.tb.connect (src, op, dst)
- self.tb.run ()
- result_data = dst.data ()
- self.assertEqual (expected_result, result_data)
+ dst = gr.vector_sink_b()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertEqual(expected_result, result_data)
def test_002(self):
@@ -69,13 +69,13 @@ class test_correlate_access_code(gr_unittest.TestCase):
#print access_code
src_data = code + (1, 0, 1, 1) + pad
expected_result = pad + code + (3, 0, 1, 1)
- src = gr.vector_source_b (src_data)
+ src = gr.vector_source_b(src_data)
op = digital.correlate_access_code_bb(access_code, 0)
- dst = gr.vector_sink_b ()
- self.tb.connect (src, op, dst)
- self.tb.run ()
- result_data = dst.data ()
- self.assertEqual (expected_result, result_data)
+ dst = gr.vector_sink_b()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertEqual(expected_result, result_data)
def test_003(self):
code = tuple(string_to_1_0_list(default_access_code))
@@ -85,14 +85,13 @@ class test_correlate_access_code(gr_unittest.TestCase):
#print access_code
src_data = code + (1, 0, 1, 1) + pad
expected_result = code + (1, 0, 1, 1) + pad
- src = gr.vector_source_b (src_data)
+ src = gr.vector_source_b(src_data)
op = digital.correlate_access_code_tag_bb(access_code, 0, "test")
- dst = gr.vector_sink_b ()
- self.tb.connect (src, op, dst)
- self.tb.run ()
- result_data = dst.data ()
- self.assertEqual (expected_result, result_data)
-
+ dst = gr.vector_sink_b()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertEqual(expected_result, result_data)
if __name__ == '__main__':
gr_unittest.run(test_correlate_access_code, "test_correlate_access_code.xml")
diff --git a/gr-digital/python/qa_costas_loop_cc.py b/gr-digital/python/qa_costas_loop_cc.py
index 75fdbc2f84..365eda736a 100755
--- a/gr-digital/python/qa_costas_loop_cc.py
+++ b/gr-digital/python/qa_costas_loop_cc.py
@@ -21,22 +21,23 @@
#
from gnuradio import gr, gr_unittest
-import digital_swig, psk
+import digital_swig as digital
+import psk
import random, cmath
class test_costas_loop_cc(gr_unittest.TestCase):
- def setUp (self):
- self.tb = gr.top_block ()
+ def setUp(self):
+ self.tb = gr.top_block()
- def tearDown (self):
+ def tearDown(self):
self.tb = None
- def test01 (self):
+ def test01(self):
# test basic functionality by setting all gains to 0
natfreq = 0.0
order = 2
- self.test = digital_swig.costas_loop_cc(natfreq, order)
+ self.test = digital.costas_loop_cc(natfreq, order)
data = 100*[complex(1,0),]
self.src = gr.vector_source_c(data, False)
@@ -47,13 +48,13 @@ class test_costas_loop_cc(gr_unittest.TestCase):
expected_result = data
dst_data = self.snk.data()
- self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 5)
+ self.assertComplexTuplesAlmostEqual(expected_result, dst_data, 5)
- def test02 (self):
+ def test02(self):
# Make sure it doesn't diverge given perfect data
natfreq = 0.25
order = 2
- self.test = digital_swig.costas_loop_cc(natfreq, order)
+ self.test = digital.costas_loop_cc(natfreq, order)
data = [complex(2*random.randint(0,1)-1, 0) for i in xrange(100)]
self.src = gr.vector_source_c(data, False)
@@ -65,13 +66,13 @@ class test_costas_loop_cc(gr_unittest.TestCase):
expected_result = data
dst_data = self.snk.data()
- self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 5)
+ self.assertComplexTuplesAlmostEqual(expected_result, dst_data, 5)
- def test03 (self):
+ def test03(self):
# BPSK Convergence test with static rotation
natfreq = 0.25
order = 2
- self.test = digital_swig.costas_loop_cc(natfreq, order)
+ self.test = digital.costas_loop_cc(natfreq, order)
rot = cmath.exp(0.2j) # some small rotation
data = [complex(2*random.randint(0,1)-1, 0) for i in xrange(100)]
@@ -90,13 +91,13 @@ class test_costas_loop_cc(gr_unittest.TestCase):
# generously compare results; the loop will converge near to, but
# not exactly on, the target data
- self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 2)
+ self.assertComplexTuplesAlmostEqual(expected_result, dst_data, 2)
- def test04 (self):
+ def test04(self):
# QPSK Convergence test with static rotation
natfreq = 0.25
order = 4
- self.test = digital_swig.costas_loop_cc(natfreq, order)
+ self.test = digital.costas_loop_cc(natfreq, order)
rot = cmath.exp(0.2j) # some small rotation
data = [complex(2*random.randint(0,1)-1, 2*random.randint(0,1)-1)
@@ -116,13 +117,13 @@ class test_costas_loop_cc(gr_unittest.TestCase):
# generously compare results; the loop will converge near to, but
# not exactly on, the target data
- self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 2)
+ self.assertComplexTuplesAlmostEqual(expected_result, dst_data, 2)
- def test05 (self):
+ def test05(self):
# 8PSK Convergence test with static rotation
natfreq = 0.25
order = 8
- self.test = digital_swig.costas_loop_cc(natfreq, order)
+ self.test = digital.costas_loop_cc(natfreq, order)
rot = cmath.exp(-cmath.pi/8.0j) # rotate to match Costas rotation
const = psk.psk_constellation(order)
@@ -145,7 +146,7 @@ class test_costas_loop_cc(gr_unittest.TestCase):
# generously compare results; the loop will converge near to, but
# not exactly on, the target data
- self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 2)
+ self.assertComplexTuplesAlmostEqual(expected_result, dst_data, 2)
if __name__ == '__main__':
gr_unittest.run(test_costas_loop_cc, "test_costas_loop_cc.xml")
diff --git a/gr-digital/python/qa_cpm.py b/gr-digital/python/qa_cpm.py
index 12a84c76c2..070e69a982 100755
--- a/gr-digital/python/qa_cpm.py
+++ b/gr-digital/python/qa_cpm.py
@@ -21,15 +21,17 @@
#
from gnuradio import gr, gr_unittest
-import digital_swig
+import digital_swig as digital
+import analog_swig as analog
+import blocks_swig as blocks
import numpy
class test_cpm(gr_unittest.TestCase):
- def setUp (self):
- self.tb = gr.top_block ()
+ def setUp(self):
+ self.tb = gr.top_block()
- def tearDown (self):
+ def tearDown(self):
self.tb = None
def do_check_phase_shift(self, type, name):
@@ -37,8 +39,8 @@ class test_cpm(gr_unittest.TestCase):
L = 1
in_bits = (1,) * 20
src = gr.vector_source_b(in_bits, False)
- cpm = digital_swig.cpmmod_bc(type, 0.5, sps, L)
- arg = gr.complex_to_arg()
+ cpm = digital.cpmmod_bc(type, 0.5, sps, L)
+ arg = blocks.complex_to_arg()
sink = gr.vector_sink_f()
self.tb.connect(src, cpm, arg, sink)
@@ -51,16 +53,16 @@ class test_cpm(gr_unittest.TestCase):
msg="Phase shift was not correct for CPM method " + name)
def test_001_lrec(self):
- self.do_check_phase_shift(gr.cpm.LRC, 'LREC')
+ self.do_check_phase_shift(analog.cpm.LRC, 'LREC')
def test_001_lrc(self):
- self.do_check_phase_shift(gr.cpm.LRC, 'LRC')
+ self.do_check_phase_shift(analog.cpm.LRC, 'LRC')
def test_001_lsrc(self):
- self.do_check_phase_shift(gr.cpm.LSRC, 'LSRC')
+ self.do_check_phase_shift(analog.cpm.LSRC, 'LSRC')
def test_001_ltfm(self):
- self.do_check_phase_shift(gr.cpm.TFM, 'TFM')
+ self.do_check_phase_shift(analog.cpm.TFM, 'TFM')
def test_001_lgmsk(self):
sps = 2
@@ -68,8 +70,8 @@ class test_cpm(gr_unittest.TestCase):
bt = 0.3
in_bits = (1,) * 20
src = gr.vector_source_b(in_bits, False)
- gmsk = digital_swig.gmskmod_bc(sps, bt, L)
- arg = gr.complex_to_arg()
+ gmsk = digital.gmskmod_bc(sps, L, bt)
+ arg = blocks.complex_to_arg()
sink = gr.vector_sink_f()
self.tb.connect(src, gmsk, arg, sink)
@@ -82,7 +84,7 @@ class test_cpm(gr_unittest.TestCase):
msg="Phase shift was not correct for GMSK")
def test_phase_response(self):
- phase_response = gr.cpm.phase_response(gr.cpm.LREC, 2, 4)
+ phase_response = analog.cpm.phase_response(analog.cpm.LREC, 2, 4)
self.assertAlmostEqual(numpy.sum(phase_response), 1)
diff --git a/gr-digital/python/qa_crc32.py b/gr-digital/python/qa_crc32.py
index f86813f3f3..cd4006b1d3 100755
--- a/gr-digital/python/qa_crc32.py
+++ b/gr-digital/python/qa_crc32.py
@@ -21,40 +21,40 @@
#
from gnuradio import gr, gr_unittest
-import digital_swig
+import digital_swig as digital
import random, cmath
class test_crc32(gr_unittest.TestCase):
- def setUp (self):
- self.tb = gr.top_block ()
+ def setUp(self):
+ self.tb = gr.top_block()
- def tearDown (self):
+ def tearDown(self):
self.tb = None
- def test01 (self):
+ def test01(self):
data = 100*"0"
expected_result = 2943744955
- result = digital_swig.crc32(data)
+ result = digital.crc32(data)
#print hex(result)
- self.assertEqual (expected_result, result)
+ self.assertEqual(expected_result, result)
- def test02 (self):
+ def test02(self):
data = 100*"1"
expected_result = 2326594156
- result = digital_swig.crc32(data)
+ result = digital.crc32(data)
#print hex(result)
- self.assertEqual (expected_result, result)
+ self.assertEqual(expected_result, result)
- def test03 (self):
+ def test03(self):
data = 10*"0123456789"
expected_result = 3774345973
- result = digital_swig.crc32(data)
+ result = digital.crc32(data)
#print hex(result)
- self.assertEqual (expected_result, result)
+ self.assertEqual(expected_result, result)
if __name__ == '__main__':
gr_unittest.run(test_crc32, "test_crc32.xml")
diff --git a/gr-digital/python/qa_crc32_bb.py b/gr-digital/python/qa_crc32_bb.py
index d63b5e1222..4574b9dca7 100755
--- a/gr-digital/python/qa_crc32_bb.py
+++ b/gr-digital/python/qa_crc32_bb.py
@@ -20,6 +20,7 @@
#
from gnuradio import gr, gr_unittest
+import blocks_swig as blocks
import digital_swig as digital
try: import pmt
except: from gruel import pmt
@@ -38,8 +39,8 @@ class qa_crc32_bb (gr_unittest.TestCase):
tag_name = "len"
tag = gr.gr_tag_t()
tag.offset = 0
- tag.key = pmt.pmt_string_to_symbol(tag_name)
- tag.value = pmt.pmt_from_long(len(data))
+ tag.key = pmt.string_to_symbol(tag_name)
+ tag.value = pmt.from_long(len(data))
src = gr.vector_source_b(data, False, 1, (tag,))
crc = digital.crc32_bb(False, tag_name)
sink = gr.vector_sink_b()
@@ -55,8 +56,8 @@ class qa_crc32_bb (gr_unittest.TestCase):
tag_name = "len"
tag = gr.gr_tag_t()
tag.offset = 0
- tag.key = pmt.pmt_string_to_symbol(tag_name)
- tag.value = pmt.pmt_from_long(len(data))
+ tag.key = pmt.string_to_symbol(tag_name)
+ tag.value = pmt.from_long(len(data))
src = gr.vector_source_b(data, False, 1, (tag,))
crc = digital.crc32_bb(False, tag_name)
crc_check = digital.crc32_bb(True, tag_name)
@@ -72,24 +73,24 @@ class qa_crc32_bb (gr_unittest.TestCase):
packets = range(pack_len*2)
tag1 = gr.gr_tag_t()
tag1.offset = 0
- tag1.key = pmt.pmt_string_to_symbol(tag_name)
- tag1.value = pmt.pmt_from_long(pack_len)
+ tag1.key = pmt.string_to_symbol(tag_name)
+ tag1.value = pmt.from_long(pack_len)
tag2 = gr.gr_tag_t()
tag2.offset = pack_len
- tag2.key = pmt.pmt_string_to_symbol(tag_name)
- tag2.value = pmt.pmt_from_long(pack_len)
+ tag2.key = pmt.string_to_symbol(tag_name)
+ tag2.value = pmt.from_long(pack_len)
testtag1 = gr.gr_tag_t()
testtag1.offset = 1
- testtag1.key = pmt.pmt_string_to_symbol("tag1")
- testtag1.value = pmt.pmt_from_long(0)
+ testtag1.key = pmt.string_to_symbol("tag1")
+ testtag1.value = pmt.from_long(0)
testtag2 = gr.gr_tag_t()
testtag2.offset = pack_len
- testtag2.key = pmt.pmt_string_to_symbol("tag2")
- testtag2.value = pmt.pmt_from_long(0)
+ testtag2.key = pmt.string_to_symbol("tag2")
+ testtag2.value = pmt.from_long(0)
testtag3 = gr.gr_tag_t()
testtag3.offset = len(packets)-1
- testtag3.key = pmt.pmt_string_to_symbol("tag3")
- testtag3.value = pmt.pmt_from_long(0)
+ testtag3.key = pmt.string_to_symbol("tag3")
+ testtag3.value = pmt.from_long(0)
src = gr.vector_source_b(packets, False, 1, (tag1, tag2, testtag1, testtag2, testtag3))
crc = digital.crc32_bb(False, tag_name)
sink = gr.vector_sink_b()
@@ -99,7 +100,7 @@ class qa_crc32_bb (gr_unittest.TestCase):
correct_offsets = {'tag1': 1, 'tag2': 12, 'tag3': 19}
tags_found = {'tag1': False, 'tag2': False, 'tag3': False}
for tag in sink.tags():
- key = pmt.pmt_symbol_to_string(tag.key)
+ key = pmt.symbol_to_string(tag.key)
if key in correct_offsets.keys():
tags_found[key] = True
self.assertEqual(correct_offsets[key], tag.offset)
@@ -114,12 +115,12 @@ class qa_crc32_bb (gr_unittest.TestCase):
tag_name = "len"
tag = gr.gr_tag_t()
tag.offset = 0
- tag.key = pmt.pmt_string_to_symbol(tag_name)
- tag.value = pmt.pmt_from_long(len(data))
+ tag.key = pmt.string_to_symbol(tag_name)
+ tag.value = pmt.from_long(len(data))
src = gr.vector_source_b(data, False, 1, (tag,))
crc = digital.crc32_bb(False, tag_name)
crc_check = digital.crc32_bb(True, tag_name)
- corruptor = gr.add_const_bb(1)
+ corruptor = blocks.add_const_bb(1)
sink = gr.vector_sink_b()
self.tb.connect(src, crc, corruptor, crc_check, sink)
self.tb.run()
@@ -132,18 +133,18 @@ class qa_crc32_bb (gr_unittest.TestCase):
tag_name = "len"
tag = gr.gr_tag_t()
tag.offset = 0
- tag.key = pmt.pmt_string_to_symbol(tag_name)
- tag.value = pmt.pmt_from_long(len(data))
+ tag.key = pmt.string_to_symbol(tag_name)
+ tag.value = pmt.from_long(len(data))
testtag = gr.gr_tag_t()
testtag.offset = len(data)-1
- testtag.key = pmt.pmt_string_to_symbol('tag1')
- testtag.value = pmt.pmt_from_long(0)
+ testtag.key = pmt.string_to_symbol('tag1')
+ testtag.value = pmt.from_long(0)
src = gr.vector_source_b(data, False, 1, (tag, testtag))
crc_check = digital.crc32_bb(True, tag_name)
sink = gr.vector_sink_b()
self.tb.connect(src, crc_check, sink)
self.tb.run()
- self.assertEqual([len(data)-5,], [tag.offset for tag in sink.tags() if pmt.pmt_symbol_to_string(tag.key) == 'tag1'])
+ self.assertEqual([len(data)-5,], [tag.offset for tag in sink.tags() if pmt.symbol_to_string(tag.key) == 'tag1'])
if __name__ == '__main__':
gr_unittest.run(qa_crc32_bb, "qa_crc32_bb.xml")
diff --git a/gr-digital/python/qa_diff_encoder.py b/gr-digital/python/qa_diff_encoder.py
index e4f5470af5..c28f4dbdf8 100755
--- a/gr-digital/python/qa_diff_encoder.py
+++ b/gr-digital/python/qa_diff_encoder.py
@@ -32,12 +32,12 @@ def make_random_int_tuple(L, min, max):
return tuple(result)
-class test_diff_encoder (gr_unittest.TestCase):
+class test_diff_encoder(gr_unittest.TestCase):
- def setUp (self):
- self.tb = gr.top_block ()
+ def setUp(self):
+ self.tb = gr.top_block()
- def tearDown (self):
+ def tearDown(self):
self.tb = None
def test_diff_encdec_000(self):
diff --git a/gr-digital/python/qa_diff_phasor_cc.py b/gr-digital/python/qa_diff_phasor_cc.py
index 3e7617fe47..833158d0a8 100755
--- a/gr-digital/python/qa_diff_phasor_cc.py
+++ b/gr-digital/python/qa_diff_phasor_cc.py
@@ -24,25 +24,25 @@ from gnuradio import gr, gr_unittest
import digital_swig as digital
import math
-class test_diff_phasor (gr_unittest.TestCase):
+class test_diff_phasor(gr_unittest.TestCase):
- def setUp (self):
- self.tb = gr.top_block ()
+ def setUp(self):
+ self.tb = gr.top_block()
- def tearDown (self):
+ def tearDown(self):
self.tb = None
- def test_diff_phasor_cc (self):
+ def test_diff_phasor_cc(self):
src_data = (0+0j, 1+0j, -1+0j, 3+4j, -3-4j, -3+4j)
expected_result = (0+0j, 0+0j, -1+0j, -3-4j, -25+0j, -7-24j)
- src = gr.vector_source_c (src_data)
- op = digital.diff_phasor_cc ()
- dst = gr.vector_sink_c ()
- self.tb.connect (src, op)
- self.tb.connect (op, dst)
- self.tb.run () # run the graph and wait for it to finish
- actual_result = dst.data () # fetch the contents of the sink
- self.assertComplexTuplesAlmostEqual (expected_result, actual_result)
+ src = gr.vector_source_c(src_data)
+ op = digital.diff_phasor_cc()
+ dst = gr.vector_sink_c()
+ self.tb.connect(src, op)
+ self.tb.connect(op, dst)
+ self.tb.run() # run the graph and wait for it to finish
+ actual_result = dst.data() # fetch the contents of the sink
+ self.assertComplexTuplesAlmostEqual(expected_result, actual_result)
if __name__ == '__main__':
gr_unittest.run(test_diff_phasor, "test_diff_phasor.xml")
diff --git a/gr-digital/python/qa_digital.py b/gr-digital/python/qa_digital.py
index 97e35da568..6f54f14208 100755
--- a/gr-digital/python/qa_digital.py
+++ b/gr-digital/python/qa_digital.py
@@ -21,14 +21,14 @@
#
from gnuradio import gr, gr_unittest
-import digital_swig
+import digital_swig as digital
class test_digital(gr_unittest.TestCase):
- def setUp (self):
- self.tb = gr.top_block ()
+ def setUp(self):
+ self.tb = gr.top_block()
- def tearDown (self):
+ def tearDown(self):
self.tb = None
if __name__ == '__main__':
diff --git a/gr-digital/python/qa_fll_band_edge.py b/gr-digital/python/qa_fll_band_edge.py
index 9e4ca079b7..0f6bad984e 100755
--- a/gr-digital/python/qa_fll_band_edge.py
+++ b/gr-digital/python/qa_fll_band_edge.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2011 Free Software Foundation, Inc.
+# Copyright 2011,2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -21,25 +21,28 @@
#
from gnuradio import gr, gr_unittest
-import digital_swig
+import digital_swig as digital
+import filter_swig as filter
+import blocks_swig as blocks
+import analog_swig as analog
import random, math
class test_fll_band_edge_cc(gr_unittest.TestCase):
- def setUp (self):
- self.tb = gr.top_block ()
+ def setUp(self):
+ self.tb = gr.top_block()
- def tearDown (self):
+ def tearDown(self):
self.tb = None
- def test01 (self):
+ def test01(self):
sps = 4
rolloff = 0.35
bw = 2*math.pi/100.0
ntaps = 45
# Create pulse shape filter
- rrc_taps = gr.firdes.root_raised_cosine(
+ rrc_taps = filter.firdes.root_raised_cosine(
sps, sps, 1.0, rolloff, ntaps)
# The frequency offset to correct
@@ -49,14 +52,14 @@ class test_fll_band_edge_cc(gr_unittest.TestCase):
random.seed(0)
data = [2.0*random.randint(0, 2) - 1.0 for i in xrange(200)]
self.src = gr.vector_source_c(data, False)
- self.rrc = gr.interp_fir_filter_ccf(sps, rrc_taps)
+ self.rrc = filter.interp_fir_filter_ccf(sps, rrc_taps)
# Mix symbols with a complex sinusoid to spin them
- self.nco = gr.sig_source_c(1, gr.GR_SIN_WAVE, foffset, 1)
- self.mix = gr.multiply_cc()
+ self.nco = analog.sig_source_c(1, analog.GR_SIN_WAVE, foffset, 1)
+ self.mix = blocks.multiply_cc()
# FLL will despin the symbols to an arbitrary phase
- self.fll = digital_swig.fll_band_edge_cc(sps, rolloff, ntaps, bw)
+ self.fll = digital.fll_band_edge_cc(sps, rolloff, ntaps, bw)
# Create sinks for all outputs of the FLL
# we will only care about the freq and error outputs
@@ -78,7 +81,7 @@ class test_fll_band_edge_cc(gr_unittest.TestCase):
dst_data = self.vsnk_frq.data()[N:]
expected_result = len(dst_data)* [-0.20,]
- self.assertFloatTuplesAlmostEqual (expected_result, dst_data, 4)
+ self.assertFloatTuplesAlmostEqual(expected_result, dst_data, 4)
if __name__ == '__main__':
gr_unittest.run(test_fll_band_edge_cc, "test_fll_band_edge_cc.xml")
diff --git a/gr-digital/python/qa_framer_sink.py b/gr-digital/python/qa_framer_sink.py
index bccc86dc78..e717e6ae05 100755
--- a/gr-digital/python/qa_framer_sink.py
+++ b/gr-digital/python/qa_framer_sink.py
@@ -63,11 +63,11 @@ class test_framker_sink(gr_unittest.TestCase):
self.tb.connect(src, correlator, framer_sink)
self.tb.connect(correlator, vsnk)
- self.tb.run ()
+ self.tb.run()
result_data = rcvd_pktq.delete_head()
result_data = result_data.to_string()
- self.assertEqual (expected_data, result_data)
+ self.assertEqual(expected_data, result_data)
def test_002(self):
@@ -87,11 +87,11 @@ class test_framker_sink(gr_unittest.TestCase):
self.tb.connect(src, correlator, framer_sink)
self.tb.connect(correlator, vsnk)
- self.tb.run ()
+ self.tb.run()
result_data = rcvd_pktq.delete_head()
result_data = result_data.to_string()
- self.assertEqual (expected_data, result_data)
+ self.assertEqual(expected_data, result_data)
if __name__ == '__main__':
gr_unittest.run(test_framker_sink, "test_framker_sink.xml")
diff --git a/gr-digital/python/qa_glfsr_source.py b/gr-digital/python/qa_glfsr_source.py
index 157520d7f8..c5adab3023 100755
--- a/gr-digital/python/qa_glfsr_source.py
+++ b/gr-digital/python/qa_glfsr_source.py
@@ -25,10 +25,10 @@ import digital_swig as digital
class test_glfsr_source(gr_unittest.TestCase):
- def setUp (self):
- self.tb = gr.top_block ()
+ def setUp(self):
+ self.tb = gr.top_block()
- def tearDown (self):
+ def tearDown(self):
self.tb = None
def test_000_make_b(self):
@@ -38,9 +38,9 @@ class test_glfsr_source(gr_unittest.TestCase):
def test_001_degree_b(self):
self.assertRaises(RuntimeError,
- lambda: gr.glfsr_source_b(0))
+ lambda: digital.glfsr_source_b(0))
self.assertRaises(RuntimeError,
- lambda: gr.glfsr_source_b(33))
+ lambda: digital.glfsr_source_b(33))
def test_002_correlation_b(self):
for degree in range(1,11): # Higher degrees take too long to correlate
@@ -65,9 +65,9 @@ class test_glfsr_source(gr_unittest.TestCase):
def test_004_degree_f(self):
self.assertRaises(RuntimeError,
- lambda: gr.glfsr_source_f(0))
+ lambda: digital.glfsr_source_f(0))
self.assertRaises(RuntimeError,
- lambda: gr.glfsr_source_f(33))
+ lambda: digital.glfsr_source_f(33))
def test_005_correlation_f(self):
for degree in range(1,11): # Higher degrees take too long to correlate
src = digital.glfsr_source_f(degree, False)
diff --git a/gr-digital/python/qa_header_payload_demux.py b/gr-digital/python/qa_header_payload_demux.py
index 15b3eadcf8..4073f24ace 100755
--- a/gr-digital/python/qa_header_payload_demux.py
+++ b/gr-digital/python/qa_header_payload_demux.py
@@ -50,7 +50,7 @@ class qa_header_payload_demux (gr_unittest.TestCase):
hpd = digital.header_payload_demux(
len(header), 1, 0, "frame_len", "detect", False, gr.sizeof_float
)
- self.assertEqual(pmt.pmt_length(hpd.message_ports_in()), 1)
+ self.assertEqual(pmt.length(hpd.message_ports_in()), 1)
header_sink = gr.vector_sink_f()
payload_sink = gr.vector_sink_f()
@@ -61,8 +61,8 @@ class qa_header_payload_demux (gr_unittest.TestCase):
self.tb.start()
time.sleep(.2) # Need this, otherwise, the next message is ignored
hpd.to_basic_block()._post(
- pmt.pmt_intern('header_data'),
- pmt.pmt_from_long(len(payload))
+ pmt.intern('header_data'),
+ pmt.from_long(len(payload))
)
while len(payload_sink.data()) < len(payload):
time.sleep(.2)
diff --git a/gr-digital/python/qa_bytes_to_syms.py b/gr-digital/python/qa_lfsr.py
index 75475a95b2..d70c466ca7 100755
--- a/gr-digital/python/qa_bytes_to_syms.py
+++ b/gr-digital/python/qa_lfsr.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2004,2007,2010,2012 Free Software Foundation, Inc.
+# Copyright 2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -24,28 +24,26 @@ from gnuradio import gr, gr_unittest
import digital_swig as digital
import math
-class test_bytes_to_syms (gr_unittest.TestCase):
- def setUp (self):
- self.tb = gr.top_block ()
+class test_lfsr(gr_unittest.TestCase):
- def tearDown (self):
- self.tb = None
+ def setUp(self):
+ pass
- def test_bytes_to_syms_001 (self):
- src_data = (0x01, 0x80, 0x03)
- expected_result = (-1, -1, -1, -1, -1, -1, -1, +1,
- +1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, +1, +1)
- src = gr.vector_source_b (src_data)
- op = digital.bytes_to_syms ()
- dst = gr.vector_sink_f ()
- self.tb.connect (src, op)
- self.tb.connect (op, dst)
- self.tb.run ()
- result_data = dst.data ()
- self.assertEqual (expected_result, result_data)
+ def tearDown(self):
+ pass
+
+ def test_lfsr_001(self):
+ reglen = 8
+ l = digital.lfsr(1, 1, reglen)
+
+ result_data = []
+ for i in xrange(4*(reglen+1)):
+ result_data.append(l.next_bit())
+
+ expected_result = 4*([1,] + reglen*[0,])
+ self.assertFloatTuplesAlmostEqual(expected_result, result_data, 5)
if __name__ == '__main__':
- gr_unittest.run(test_bytes_to_syms, "test_bytes_to_syms.xml")
+ gr_unittest.run(test_lfsr, "test_lfsr.xml")
diff --git a/gr-digital/python/qa_lms_equalizer.py b/gr-digital/python/qa_lms_equalizer.py
index 025c785aa4..9ba90a89ab 100755
--- a/gr-digital/python/qa_lms_equalizer.py
+++ b/gr-digital/python/qa_lms_equalizer.py
@@ -21,7 +21,7 @@
#
from gnuradio import gr, gr_unittest
-import digital_swig
+import digital_swig as digital
class test_lms_dd_equalizer(gr_unittest.TestCase):
@@ -33,7 +33,7 @@ class test_lms_dd_equalizer(gr_unittest.TestCase):
def transform(self, src_data, gain, const):
SRC = gr.vector_source_c(src_data, False)
- EQU = digital_swig.lms_dd_equalizer_cc(4, gain, 1, const.base())
+ EQU = digital.lms_dd_equalizer_cc(4, gain, 1, const.base())
DST = gr.vector_sink_c()
self.tb.connect(SRC, EQU, DST)
self.tb.run()
@@ -41,13 +41,15 @@ class test_lms_dd_equalizer(gr_unittest.TestCase):
def test_001_identity(self):
# Constant modulus signal so no adjustments
- const = digital_swig.constellation_qpsk()
+ const = digital.constellation_qpsk()
src_data = const.points()*1000
N = 100 # settling time
expected_data = src_data[N:]
result = self.transform(src_data, 0.1, const)[N:]
- self.assertComplexTuplesAlmostEqual(expected_data, result, 5)
+
+ N = -500
+ self.assertComplexTuplesAlmostEqual(expected_data[N:], result[N:], 5)
if __name__ == "__main__":
gr_unittest.run(test_lms_dd_equalizer, "test_lms_dd_equalizer.xml")
diff --git a/gr-digital/python/qa_map.py b/gr-digital/python/qa_map.py
index 3ad99a2c12..0fd7c479a1 100755
--- a/gr-digital/python/qa_map.py
+++ b/gr-digital/python/qa_map.py
@@ -34,14 +34,14 @@ class test_map(gr_unittest.TestCase):
def helper(self, symbols):
src_data = [0, 1, 2, 3, 0, 1, 2, 3]
expected_data = map(lambda x: symbols[x], src_data)
- src = gr.vector_source_b (src_data)
+ src = gr.vector_source_b(src_data)
op = digital.map_bb(symbols)
- dst = gr.vector_sink_b ()
- self.tb.connect (src, op, dst)
- self.tb.run ()
+ dst = gr.vector_sink_b()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
result_data = list(dst.data())
- self.assertEqual (expected_data, result_data)
+ self.assertEqual(expected_data, result_data)
def test_001(self):
symbols = [0, 0, 0, 0]
diff --git a/gr-digital/python/qa_mpsk_receiver.py b/gr-digital/python/qa_mpsk_receiver.py
index e1f16ee671..bde8895e76 100755
--- a/gr-digital/python/qa_mpsk_receiver.py
+++ b/gr-digital/python/qa_mpsk_receiver.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2011 Free Software Foundation, Inc.
+# Copyright 2011,2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -21,101 +21,128 @@
#
from gnuradio import gr, gr_unittest
-import digital_swig
-import random, cmath
+import digital_swig as digital
+import filter_swig as filter
+import random, cmath, time
class test_mpsk_receiver(gr_unittest.TestCase):
- def setUp (self):
- self.tb = gr.top_block ()
+ def setUp(self):
+ self.tb = gr.top_block()
- def tearDown (self):
+ def tearDown(self):
self.tb = None
- def test01 (self):
+ def test01(self):
# Test BPSK sync
M = 2
theta = 0
loop_bw = cmath.pi/100.0
fmin = -0.5
fmax = 0.5
- mu = 0.25
+ mu = 0.5
gain_mu = 0.01
omega = 2
gain_omega = 0.001
omega_rel = 0.001
- self.test = digital_swig.mpsk_receiver_cc(M, theta, loop_bw,
- fmin, fmax, mu, gain_mu,
- omega, gain_omega,
- omega_rel)
+ self.test = digital.mpsk_receiver_cc(M, theta, loop_bw,
+ fmin, fmax, mu, gain_mu,
+ omega, gain_omega,
+ omega_rel)
- data = 1000*[complex(1,0), complex(1,0), complex(-1,0), complex(-1,0)]
+ data = 10000*[complex(1,0), complex(-1,0)]
+ #data = [2*random.randint(0,1)-1 for x in xrange(10000)]
self.src = gr.vector_source_c(data, False)
self.snk = gr.vector_sink_c()
- self.tb.connect(self.src, self.test, self.snk)
+ # pulse shaping interpolation filter
+ nfilts = 32
+ excess_bw = 0.35
+ ntaps = 11 * int(omega*nfilts)
+ rrc_taps0 = filter.firdes.root_raised_cosine(
+ nfilts, nfilts, 1.0, excess_bw, ntaps)
+ rrc_taps1 = filter.firdes.root_raised_cosine(
+ 1, omega, 1.0, excess_bw, 11*omega)
+ self.rrc0 = filter.pfb_arb_resampler_ccf(omega, rrc_taps0)
+ self.rrc1 = filter.fir_filter_ccf(1, rrc_taps1)
+
+ self.tb.connect(self.src, self.rrc0, self.rrc1, self.test, self.snk)
self.tb.run()
- expected_result = 1000*[complex(-0.5,0), complex(0.5,0)]
+ expected_result = [0.5*d for d in data]
dst_data = self.snk.data()
# Only compare last Ncmp samples
- Ncmp = 100
+ Ncmp = 1000
len_e = len(expected_result)
len_d = len(dst_data)
- expected_result = expected_result[len_e - Ncmp:]
+ expected_result = expected_result[len_e - Ncmp-1:-1]
dst_data = dst_data[len_d - Ncmp:]
-
+
#for e,d in zip(expected_result, dst_data):
- # print e, d
+ # print "{0:+.02f} {1:+.02f}".format(e, d)
- self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 1)
+ self.assertComplexTuplesAlmostEqual(expected_result, dst_data, 1)
- def test02 (self):
+ def test02(self):
# Test QPSK sync
M = 4
theta = 0
- loop_bw = 2*cmath.pi/100.0
+ loop_bw = cmath.pi/100.0
fmin = -0.5
fmax = 0.5
- mu = 0.25
+ mu = 0.5
gain_mu = 0.01
omega = 2
gain_omega = 0.001
omega_rel = 0.001
- self.test = digital_swig.mpsk_receiver_cc(M, theta, loop_bw,
- fmin, fmax, mu, gain_mu,
- omega, gain_omega,
- omega_rel)
+ self.test = digital.mpsk_receiver_cc(M, theta, loop_bw,
+ fmin, fmax, mu, gain_mu,
+ omega, gain_omega,
+ omega_rel)
- data = 1000*[complex( 0.707, 0.707), complex( 0.707, 0.707),
- complex(-0.707, 0.707), complex(-0.707, 0.707),
- complex(-0.707, -0.707), complex(-0.707, -0.707),
- complex( 0.707, -0.707), complex( 0.707, -0.707)]
+ data = 10000*[complex( 0.707, 0.707),
+ complex(-0.707, 0.707),
+ complex(-0.707, -0.707),
+ complex( 0.707, -0.707)]
+ data = [0.5*d for d in data]
self.src = gr.vector_source_c(data, False)
self.snk = gr.vector_sink_c()
- self.tb.connect(self.src, self.test, self.snk)
+ # pulse shaping interpolation filter
+ nfilts = 32
+ excess_bw = 0.35
+ ntaps = 11 * int(omega*nfilts)
+ rrc_taps0 = filter.firdes.root_raised_cosine(
+ nfilts, nfilts, 1.0, excess_bw, ntaps)
+ rrc_taps1 = filter.firdes.root_raised_cosine(
+ 1, omega, 1.0, excess_bw, 11*omega)
+ self.rrc0 = filter.pfb_arb_resampler_ccf(omega, rrc_taps0)
+ self.rrc1 = filter.fir_filter_ccf(1, rrc_taps1)
+
+ self.tb.connect(self.src, self.rrc0, self.rrc1, self.test, self.snk)
self.tb.run()
- expected_result = 1000*[complex(0, -1.0), complex(1.0, 0),
- complex(0, 1.0), complex(-1.0, 0)]
- dst_data = self.snk.data()
+ expected_result = 10000*[complex(-0.5, +0.0), complex(+0.0, -0.5),
+ complex(+0.5, +0.0), complex(+0.0, +0.5)]
+
+ # get data after a settling period
+ dst_data = self.snk.data()[200:]
# Only compare last Ncmp samples
- Ncmp = 100
+ Ncmp = 1000
len_e = len(expected_result)
len_d = len(dst_data)
- expected_result = expected_result[len_e - Ncmp:]
+ expected_result = expected_result[len_e - Ncmp - 1:-1]
dst_data = dst_data[len_d - Ncmp:]
#for e,d in zip(expected_result, dst_data):
- # print e, d
+ # print "{0:+.02f} {1:+.02f}".format(e, d)
- self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 1)
+ self.assertComplexTuplesAlmostEqual(expected_result, dst_data, 1)
if __name__ == '__main__':
gr_unittest.run(test_mpsk_receiver, "test_mpsk_receiver.xml")
diff --git a/gr-digital/python/qa_mpsk_snr_est.py b/gr-digital/python/qa_mpsk_snr_est.py
index d392567bfd..c976bf21a8 100755
--- a/gr-digital/python/qa_mpsk_snr_est.py
+++ b/gr-digital/python/qa_mpsk_snr_est.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2011 Free Software Foundation, Inc.
+# Copyright 2011,2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -29,94 +29,93 @@ def get_cplx():
def get_n_cplx():
return complex(random.random()-0.5, random.random()-0.5)
-class test_mpsk_snr_est (gr_unittest.TestCase):
- def setUp (self):
- self.tb = gr.top_block ()
+class test_mpsk_snr_est(gr_unittest.TestCase):
+ def setUp(self):
+ self.tb = gr.top_block()
random.seed(0) # make repeatable
N = 10000
self._noise = [get_n_cplx() for i in xrange(N)]
self._bits = [get_cplx() for i in xrange(N)]
- def tearDown (self):
+ def tearDown(self):
self.tb = None
- def mpsk_snr_est_setup (self, op):
+ def mpsk_snr_est_setup(self, op):
result = []
for i in xrange(1,6):
src_data = [b+(i*n) for b,n in zip(self._bits, self._noise)]
- src = gr.vector_source_c (src_data)
- dst = gr.null_sink (gr.sizeof_gr_complex)
+ src = gr.vector_source_c(src_data)
+ dst = gr.null_sink(gr.sizeof_gr_complex)
- tb = gr.top_block ()
- tb.connect (src, op)
- tb.connect (op, dst)
- tb.run () # run the graph and wait for it to finish
+ tb = gr.top_block()
+ tb.connect(src, op)
+ tb.connect(op, dst)
+ tb.run() # run the graph and wait for it to finish
result.append(op.snr())
return result
- def test_mpsk_snr_est_simple (self):
+ def test_mpsk_snr_est_simple(self):
expected_result = [11.48, 5.91, 3.30, 2.08, 1.46]
N = 10000
alpha = 0.001
- op = digital.mpsk_snr_est_cc (digital.SNR_EST_SIMPLE, N, alpha)
+ op = digital.mpsk_snr_est_cc(digital.SNR_EST_SIMPLE, N, alpha)
actual_result = self.mpsk_snr_est_setup(op)
- self.assertFloatTuplesAlmostEqual (expected_result, actual_result, 2)
+ self.assertFloatTuplesAlmostEqual(expected_result, actual_result, 2)
- def test_mpsk_snr_est_skew (self):
+ def test_mpsk_snr_est_skew(self):
expected_result = [11.48, 5.91, 3.30, 2.08, 1.46]
N = 10000
alpha = 0.001
- op = digital.mpsk_snr_est_cc (digital.SNR_EST_SKEW, N, alpha)
+ op = digital.mpsk_snr_est_cc(digital.SNR_EST_SKEW, N, alpha)
actual_result = self.mpsk_snr_est_setup(op)
- self.assertFloatTuplesAlmostEqual (expected_result, actual_result, 2)
+ self.assertFloatTuplesAlmostEqual(expected_result, actual_result, 2)
- def test_mpsk_snr_est_m2m4 (self):
+ def test_mpsk_snr_est_m2m4(self):
expected_result = [11.02, 6.20, 4.98, 5.16, 5.66]
N = 10000
alpha = 0.001
- op = digital.mpsk_snr_est_cc (digital.SNR_EST_M2M4, N, alpha)
+ op = digital.mpsk_snr_est_cc(digital.SNR_EST_M2M4, N, alpha)
actual_result = self.mpsk_snr_est_setup(op)
- self.assertFloatTuplesAlmostEqual (expected_result, actual_result, 2)
+ self.assertFloatTuplesAlmostEqual(expected_result, actual_result, 2)
- def test_mpsk_snr_est_svn (self):
+ def test_mpsk_snr_est_svn(self):
expected_result = [10.90, 6.00, 4.76, 4.97, 5.49]
N = 10000
alpha = 0.001
- op = digital.mpsk_snr_est_cc (digital.SNR_EST_SVR, N, alpha)
+ op = digital.mpsk_snr_est_cc(digital.SNR_EST_SVR, N, alpha)
actual_result = self.mpsk_snr_est_setup(op)
- self.assertFloatTuplesAlmostEqual (expected_result, actual_result, 2)
+ self.assertFloatTuplesAlmostEqual(expected_result, actual_result, 2)
- def test_probe_mpsk_snr_est_m2m4 (self):
+ def test_probe_mpsk_snr_est_m2m4(self):
expected_result = [11.02, 6.20, 4.98, 5.16, 5.66]
actual_result = []
for i in xrange(1,6):
src_data = [b+(i*n) for b,n in zip(self._bits, self._noise)]
- src = gr.vector_source_c (src_data)
+ src = gr.vector_source_c(src_data)
N = 10000
alpha = 0.001
- op = digital.probe_mpsk_snr_est_c (digital.SNR_EST_M2M4, N, alpha)
+ op = digital.probe_mpsk_snr_est_c(digital.SNR_EST_M2M4, N, alpha)
- tb = gr.top_block ()
- tb.connect (src, op)
- tb.run () # run the graph and wait for it to finish
+ tb = gr.top_block()
+ tb.connect(src, op)
+ tb.run() # run the graph and wait for it to finish
actual_result.append(op.snr())
- self.assertFloatTuplesAlmostEqual (expected_result, actual_result, 2)
-
+ self.assertFloatTuplesAlmostEqual(expected_result, actual_result, 2)
if __name__ == '__main__':
# Test various SNR estimators; we're not using a Gaussian
diff --git a/gr-digital/python/qa_ofdm_carrier_allocator_cvc.py b/gr-digital/python/qa_ofdm_carrier_allocator_cvc.py
index 1b013865f4..2105727e04 100755
--- a/gr-digital/python/qa_ofdm_carrier_allocator_cvc.py
+++ b/gr-digital/python/qa_ofdm_carrier_allocator_cvc.py
@@ -45,8 +45,8 @@ class qa_digital_carrier_allocator_cvc (gr_unittest.TestCase):
tag_name = "len"
tag = gr.gr_tag_t()
tag.offset = 0
- tag.key = pmt.pmt_string_to_symbol(tag_name)
- tag.value = pmt.pmt_from_long(len(tx_symbols))
+ tag.key = pmt.string_to_symbol(tag_name)
+ tag.value = pmt.from_long(len(tx_symbols))
src = gr.vector_source_c(tx_symbols, False, 1, (tag,))
alloc = digital.ofdm_carrier_allocator_cvc(fft_len,
occupied_carriers,
@@ -71,8 +71,8 @@ class qa_digital_carrier_allocator_cvc (gr_unittest.TestCase):
tag_name = "len"
tag = gr.gr_tag_t()
tag.offset = 0
- tag.key = pmt.pmt_string_to_symbol(tag_name)
- tag.value = pmt.pmt_from_long(len(tx_symbols))
+ tag.key = pmt.string_to_symbol(tag_name)
+ tag.value = pmt.from_long(len(tx_symbols))
src = gr.vector_source_c(tx_symbols, False, 1, (tag,))
alloc = digital.ofdm_carrier_allocator_cvc(fft_len,
occupied_carriers,
@@ -104,28 +104,28 @@ class qa_digital_carrier_allocator_cvc (gr_unittest.TestCase):
tag_name = "len"
tag1 = gr.gr_tag_t()
tag1.offset = 0
- tag1.key = pmt.pmt_string_to_symbol(tag_name)
- tag1.value = pmt.pmt_from_long(len(tx_symbols))
+ tag1.key = pmt.string_to_symbol(tag_name)
+ tag1.value = pmt.from_long(len(tx_symbols))
tag2 = gr.gr_tag_t()
tag2.offset = len(tx_symbols)
- tag2.key = pmt.pmt_string_to_symbol(tag_name)
- tag2.value = pmt.pmt_from_long(len(tx_symbols))
+ tag2.key = pmt.string_to_symbol(tag_name)
+ tag2.value = pmt.from_long(len(tx_symbols))
testtag1 = gr.gr_tag_t()
testtag1.offset = 0
- testtag1.key = pmt.pmt_string_to_symbol('tag1')
- testtag1.value = pmt.pmt_from_long(0)
+ testtag1.key = pmt.string_to_symbol('tag1')
+ testtag1.value = pmt.from_long(0)
testtag2 = gr.gr_tag_t()
testtag2.offset = 7 # On the 2nd OFDM symbol
- testtag2.key = pmt.pmt_string_to_symbol('tag2')
- testtag2.value = pmt.pmt_from_long(0)
+ testtag2.key = pmt.string_to_symbol('tag2')
+ testtag2.value = pmt.from_long(0)
testtag3 = gr.gr_tag_t()
testtag3.offset = len(tx_symbols)+1 # First OFDM symbol of packet 2
- testtag3.key = pmt.pmt_string_to_symbol('tag3')
- testtag3.value = pmt.pmt_from_long(0)
+ testtag3.key = pmt.string_to_symbol('tag3')
+ testtag3.value = pmt.from_long(0)
testtag4 = gr.gr_tag_t()
testtag4.offset = 2*len(tx_symbols)-1 # Last OFDM symbol of packet 2
- testtag4.key = pmt.pmt_string_to_symbol('tag4')
- testtag4.value = pmt.pmt_from_long(0)
+ testtag4.key = pmt.string_to_symbol('tag4')
+ testtag4.value = pmt.from_long(0)
src = gr.vector_source_c(tx_symbols * 2, False, 1, (tag1, tag2, testtag1, testtag2, testtag3, testtag4))
alloc = digital.ofdm_carrier_allocator_cvc(fft_len,
occupied_carriers,
@@ -139,13 +139,13 @@ class qa_digital_carrier_allocator_cvc (gr_unittest.TestCase):
tags_found = {'tag1': False, 'tag2': False, 'tag3': False, 'tag4': False}
correct_offsets = {'tag1': 0, 'tag2': 1, 'tag3': 3, 'tag4': 5}
for tag in sink.tags():
- key = pmt.pmt_symbol_to_string(tag.key)
+ key = pmt.symbol_to_string(tag.key)
if key in tags_found.keys():
tags_found[key] = True
self.assertEqual(correct_offsets[key], tag.offset)
if key == tag_name:
self.assertTrue(tag.offset == 0 or tag.offset == 3)
- self.assertTrue(pmt.pmt_to_long(tag.value) == 3)
+ self.assertTrue(pmt.to_long(tag.value) == 3)
self.assertTrue(all(tags_found.values()))
diff --git a/gr-digital/python/qa_ofdm_chanest_vcvc.py b/gr-digital/python/qa_ofdm_chanest_vcvc.py
index c78f8fccfc..c7c0d83a84 100755
--- a/gr-digital/python/qa_ofdm_chanest_vcvc.py
+++ b/gr-digital/python/qa_ofdm_chanest_vcvc.py
@@ -22,6 +22,8 @@
from gnuradio import gr, gr_unittest
try: import pmt
except: from gruel import pmt
+import blocks_swig as blocks
+import analog_swig as analog
import digital_swig as digital
import sys
import numpy
@@ -62,12 +64,12 @@ class qa_ofdm_sync_eqinit_vcvc (gr_unittest.TestCase):
shift_tuple(data_symbol, carr_offset)
tag1 = gr.gr_tag_t()
tag1.offset = 0
- tag1.key = pmt.pmt_string_to_symbol("test_tag_1")
- tag1.value = pmt.pmt_from_long(23)
+ tag1.key = pmt.string_to_symbol("test_tag_1")
+ tag1.value = pmt.from_long(23)
tag2 = gr.gr_tag_t()
tag2.offset = 2
- tag2.key = pmt.pmt_string_to_symbol("test_tag_2")
- tag2.value = pmt.pmt_from_long(42)
+ tag2.key = pmt.string_to_symbol("test_tag_2")
+ tag2.value = pmt.from_long(42)
src = gr.vector_source_c(tx_data, False, fft_len, (tag1, tag2))
chanest = digital.ofdm_chanest_vcvc(sync_symbol1, sync_symbol2, 1)
sink = gr.vector_sink_c(fft_len)
@@ -81,14 +83,14 @@ class qa_ofdm_sync_eqinit_vcvc (gr_unittest.TestCase):
'test_tag_2': False
}
for tag in tags:
- if pmt.pmt_symbol_to_string(tag.key) == 'ofdm_sync_carr_offset':
- carr_offset_hat = pmt.pmt_to_long(tag.value)
- self.assertEqual(pmt.pmt_to_long(tag.value), carr_offset)
- if pmt.pmt_symbol_to_string(tag.key) == 'test_tag_1':
+ if pmt.symbol_to_string(tag.key) == 'ofdm_sync_carr_offset':
+ carr_offset_hat = pmt.to_long(tag.value)
+ self.assertEqual(pmt.to_long(tag.value), carr_offset)
+ if pmt.symbol_to_string(tag.key) == 'test_tag_1':
self.assertEqual(tag.offset, 0)
- if pmt.pmt_symbol_to_string(tag.key) == 'test_tag_2':
+ if pmt.symbol_to_string(tag.key) == 'test_tag_2':
self.assertEqual(tag.offset, 0)
- detected_tags[pmt.pmt_symbol_to_string(tag.key)] = True
+ detected_tags[pmt.symbol_to_string(tag.key)] = True
self.assertTrue(all(detected_tags.values()))
def test_002_offset_1sym (self):
@@ -111,9 +113,9 @@ class qa_ofdm_sync_eqinit_vcvc (gr_unittest.TestCase):
self.assertEqual(shift_tuple(sink.data(), -carr_offset), data_symbol)
tags = sink.tags()
for tag in tags:
- if pmt.pmt_symbol_to_string(tag.key) == 'ofdm_sync_carr_offset':
- carr_offset_hat = pmt.pmt_to_long(tag.value)
- self.assertEqual(pmt.pmt_to_long(tag.value), carr_offset)
+ if pmt.symbol_to_string(tag.key) == 'ofdm_sync_carr_offset':
+ carr_offset_hat = pmt.to_long(tag.value)
+ self.assertEqual(pmt.to_long(tag.value), carr_offset)
def test_003_channel_no_carroffset (self):
""" Add a channel, check if it's correctly estimated """
@@ -125,7 +127,7 @@ class qa_ofdm_sync_eqinit_vcvc (gr_unittest.TestCase):
tx_data = sync_symbol1 + sync_symbol2 + data_symbol
channel = (0, 0, 0, 2, -2, 2, 3j, 2, 0, 2, 2, 2, 2, 3, 0, 0)
src = gr.vector_source_c(tx_data, False, fft_len)
- chan = gr.multiply_const_vcc(channel)
+ chan = blocks.multiply_const_vcc(channel)
chanest = digital.ofdm_chanest_vcvc(sync_symbol1, sync_symbol2, 1)
sink = gr.vector_sink_c(fft_len)
self.tb.connect(src, chan, chanest, sink)
@@ -133,10 +135,10 @@ class qa_ofdm_sync_eqinit_vcvc (gr_unittest.TestCase):
tags = sink.tags()
self.assertEqual(shift_tuple(sink.data(), -carr_offset), tuple(numpy.multiply(data_symbol, channel)))
for tag in tags:
- if pmt.pmt_symbol_to_string(tag.key) == 'ofdm_sync_carr_offset':
- self.assertEqual(pmt.pmt_to_long(tag.value), carr_offset)
- if pmt.pmt_symbol_to_string(tag.key) == 'ofdm_sync_chan_taps':
- self.assertEqual(pmt.pmt_c32vector_elements(tag.value), channel)
+ if pmt.symbol_to_string(tag.key) == 'ofdm_sync_carr_offset':
+ self.assertEqual(pmt.to_long(tag.value), carr_offset)
+ if pmt.symbol_to_string(tag.key) == 'ofdm_sync_chan_taps':
+ self.assertEqual(pmt.c32vector_elements(tag.value), channel)
def test_004_channel_no_carroffset_1sym (self):
""" Add a channel, check if it's correctly estimated.
@@ -148,17 +150,17 @@ class qa_ofdm_sync_eqinit_vcvc (gr_unittest.TestCase):
tx_data = sync_symbol + data_symbol
channel = (0, 0, 0, 2, 2, 2, 2.5, 3, 2.5, 2, 2.5, 3, 2, 1, 1, 0)
src = gr.vector_source_c(tx_data, False, fft_len)
- chan = gr.multiply_const_vcc(channel)
+ chan = blocks.multiply_const_vcc(channel)
chanest = digital.ofdm_chanest_vcvc(sync_symbol, (), 1)
sink = gr.vector_sink_c(fft_len)
self.tb.connect(src, chan, chanest, sink)
self.tb.run()
tags = sink.tags()
for tag in tags:
- if pmt.pmt_symbol_to_string(tag.key) == 'ofdm_sync_carr_offset':
- self.assertEqual(pmt.pmt_to_long(tag.value), carr_offset)
- if pmt.pmt_symbol_to_string(tag.key) == 'ofdm_sync_chan_taps':
- self.assertEqual(pmt.pmt_c32vector_elements(tag.value), channel)
+ if pmt.symbol_to_string(tag.key) == 'ofdm_sync_carr_offset':
+ self.assertEqual(pmt.to_long(tag.value), carr_offset)
+ if pmt.symbol_to_string(tag.key) == 'ofdm_sync_chan_taps':
+ self.assertEqual(pmt.c32vector_elements(tag.value), channel)
def test_005_both_1sym_force (self):
""" Add a channel, check if it's correctly estimated.
@@ -171,17 +173,17 @@ class qa_ofdm_sync_eqinit_vcvc (gr_unittest.TestCase):
tx_data = sync_symbol + data_symbol
channel = (0, 0, 0, 2, 2, 2, 2.5, 3, 2.5, 2, 2.5, 3, 2, 1, 1, 0)
src = gr.vector_source_c(tx_data, False, fft_len)
- chan = gr.multiply_const_vcc(channel)
+ chan = blocks.multiply_const_vcc(channel)
chanest = digital.ofdm_chanest_vcvc(sync_symbol, ref_symbol, 1)
sink = gr.vector_sink_c(fft_len)
self.tb.connect(src, chan, chanest, sink)
self.tb.run()
tags = sink.tags()
for tag in tags:
- if pmt.pmt_symbol_to_string(tag.key) == 'ofdm_sync_carr_offset':
- self.assertEqual(pmt.pmt_to_long(tag.value), carr_offset)
- if pmt.pmt_symbol_to_string(tag.key) == 'ofdm_sync_chan_taps':
- self.assertEqual(pmt.pmt_c32vector_elements(tag.value), channel)
+ if pmt.symbol_to_string(tag.key) == 'ofdm_sync_carr_offset':
+ self.assertEqual(pmt.to_long(tag.value), carr_offset)
+ if pmt.symbol_to_string(tag.key) == 'ofdm_sync_chan_taps':
+ self.assertEqual(pmt.c32vector_elements(tag.value), channel)
def test_006_channel_and_carroffset (self):
""" Add a channel, check if it's correctly estimated """
@@ -198,7 +200,7 @@ class qa_ofdm_sync_eqinit_vcvc (gr_unittest.TestCase):
shift_tuple(data_symbol, carr_offset)
channel = range(fft_len)
src = gr.vector_source_c(tx_data, False, fft_len)
- chan = gr.multiply_const_vcc(channel)
+ chan = blocks.multiply_const_vcc(channel)
chanest = digital.ofdm_chanest_vcvc(sync_symbol1, sync_symbol2, 1)
sink = gr.vector_sink_c(fft_len)
self.tb.connect(src, chan, chanest, sink)
@@ -206,10 +208,10 @@ class qa_ofdm_sync_eqinit_vcvc (gr_unittest.TestCase):
tags = sink.tags()
chan_est = None
for tag in tags:
- if pmt.pmt_symbol_to_string(tag.key) == 'ofdm_sync_carr_offset':
- self.assertEqual(pmt.pmt_to_long(tag.value), carr_offset)
- if pmt.pmt_symbol_to_string(tag.key) == 'ofdm_sync_chan_taps':
- chan_est = pmt.pmt_c32vector_elements(tag.value)
+ if pmt.symbol_to_string(tag.key) == 'ofdm_sync_carr_offset':
+ self.assertEqual(pmt.to_long(tag.value), carr_offset)
+ if pmt.symbol_to_string(tag.key) == 'ofdm_sync_chan_taps':
+ chan_est = pmt.c32vector_elements(tag.value)
for i in range(fft_len):
if shift_tuple(sync_symbol2, carr_offset)[i]: # Only here the channel can be estimated
self.assertEqual(chan_est[i], channel[i])
@@ -235,24 +237,24 @@ class qa_ofdm_sync_eqinit_vcvc (gr_unittest.TestCase):
shift_tuple(data_sym, carr_offset)
channel = [rand_range(min_chan_ampl, max_chan_ampl) * numpy.exp(1j * rand_range(0, 2 * numpy.pi)) for x in range(fft_len)]
src = gr.vector_source_c(tx_data, False, fft_len)
- chan = gr.multiply_const_vcc(channel)
- noise = gr.noise_source_c(gr.GR_GAUSSIAN, wgn_amplitude)
- add = gr.add_cc(fft_len)
+ chan = blocks.multiply_const_vcc(channel)
+ noise = analog.noise_source_c(analog.GR_GAUSSIAN, wgn_amplitude)
+ add = blocks.add_cc(fft_len)
chanest = digital.ofdm_chanest_vcvc(sync_sym1, sync_sym2, 1)
sink = gr.vector_sink_c(fft_len)
top_block.connect(src, chan, (add, 0), chanest, sink)
- top_block.connect(noise, gr.stream_to_vector(gr.sizeof_gr_complex, fft_len), (add, 1))
+ top_block.connect(noise, blocks.stream_to_vector(gr.sizeof_gr_complex, fft_len), (add, 1))
top_block.run()
channel_est = None
carr_offset_hat = 0
rx_sym_est = [0,] * fft_len
tags = sink.tags()
for tag in tags:
- if pmt.pmt_symbol_to_string(tag.key) == 'ofdm_sync_carr_offset':
- carr_offset_hat = pmt.pmt_to_long(tag.value)
+ if pmt.symbol_to_string(tag.key) == 'ofdm_sync_carr_offset':
+ carr_offset_hat = pmt.to_long(tag.value)
self.assertEqual(carr_offset, carr_offset_hat)
- if pmt.pmt_symbol_to_string(tag.key) == 'ofdm_sync_chan_taps':
- channel_est = pmt.pmt_c32vector_elements(tag.value)
+ if pmt.symbol_to_string(tag.key) == 'ofdm_sync_chan_taps':
+ channel_est = pmt.c32vector_elements(tag.value)
shifted_carrier_mask = shift_tuple(carrier_mask, carr_offset)
for i in range(fft_len):
if shifted_carrier_mask[i] and channel_est[i]:
diff --git a/gr-digital/python/qa_ofdm_cyclic_prefixer.py b/gr-digital/python/qa_ofdm_cyclic_prefixer.py
index 838e992d02..003e987e95 100755
--- a/gr-digital/python/qa_ofdm_cyclic_prefixer.py
+++ b/gr-digital/python/qa_ofdm_cyclic_prefixer.py
@@ -69,12 +69,12 @@ class test_ofdm_cyclic_prefixer (gr_unittest.TestCase):
7.0/2+1.0/2, 8, 1, 2, 3, 4, 5, 6, 7, 8, 1.0/2)
tag = gr.gr_tag_t()
tag.offset = 0
- tag.key = pmt.pmt_string_to_symbol(tag_name)
- tag.value = pmt.pmt_from_long(2)
+ tag.key = pmt.string_to_symbol(tag_name)
+ tag.value = pmt.from_long(2)
tag2 = gr.gr_tag_t()
tag2.offset = 1
- tag2.key = pmt.pmt_string_to_symbol("random_tag")
- tag2.value = pmt.pmt_from_long(42)
+ tag2.key = pmt.string_to_symbol("random_tag")
+ tag2.value = pmt.from_long(42)
src = gr.vector_source_c(range(1, fft_len+1) * 2, False, fft_len, (tag, tag2))
cp = digital.ofdm_cyclic_prefixer(fft_len, fft_len + cp_len, 2, tag_name)
sink = gr.vector_sink_c()
diff --git a/gr-digital/python/qa_ofdm_frame_equalizer_vcvc.py b/gr-digital/python/qa_ofdm_frame_equalizer_vcvc.py
index 6f44fd00fb..9faface03f 100755
--- a/gr-digital/python/qa_ofdm_frame_equalizer_vcvc.py
+++ b/gr-digital/python/qa_ofdm_frame_equalizer_vcvc.py
@@ -42,12 +42,12 @@ class qa_ofdm_frame_equalizer_vcvc (gr_unittest.TestCase):
tx_data = (1,) * fft_len * n_syms
len_tag = gr.gr_tag_t()
len_tag.offset = 0
- len_tag.key = pmt.pmt_string_to_symbol(len_tag_key)
- len_tag.value = pmt.pmt_from_long(n_syms)
+ len_tag.key = pmt.string_to_symbol(len_tag_key)
+ len_tag.value = pmt.from_long(n_syms)
chan_tag = gr.gr_tag_t()
chan_tag.offset = 0
- chan_tag.key = pmt.pmt_string_to_symbol("ofdm_sync_chan_taps")
- chan_tag.value = pmt.pmt_init_c32vector(fft_len, (1,) * fft_len)
+ chan_tag.key = pmt.string_to_symbol("ofdm_sync_chan_taps")
+ chan_tag.value = pmt.init_c32vector(fft_len, (1,) * fft_len)
src = gr.vector_source_c(tx_data, False, fft_len, (len_tag, chan_tag))
eq = digital.ofdm_frame_equalizer_vcvc(equalizer.base(), len_tag_key)
sink = gr.vector_sink_c(fft_len)
@@ -56,8 +56,8 @@ class qa_ofdm_frame_equalizer_vcvc (gr_unittest.TestCase):
# Check data
self.assertEqual(tx_data, sink.data())
for tag in sink.tags():
- self.assertEqual(pmt.pmt_symbol_to_string(tag.key), len_tag_key)
- self.assertEqual(pmt.pmt_to_long(tag.value), n_syms)
+ self.assertEqual(pmt.symbol_to_string(tag.key), len_tag_key)
+ self.assertEqual(pmt.to_long(tag.value), n_syms)
def test_002_static (self):
fft_len = 8
@@ -87,12 +87,12 @@ class qa_ofdm_frame_equalizer_vcvc (gr_unittest.TestCase):
len_tag_key = "frame_len"
len_tag = gr.gr_tag_t()
len_tag.offset = 0
- len_tag.key = pmt.pmt_string_to_symbol(len_tag_key)
- len_tag.value = pmt.pmt_from_long(4)
+ len_tag.key = pmt.string_to_symbol(len_tag_key)
+ len_tag.value = pmt.from_long(4)
chan_tag = gr.gr_tag_t()
chan_tag.offset = 0
- chan_tag.key = pmt.pmt_string_to_symbol("ofdm_sync_chan_taps")
- chan_tag.value = pmt.pmt_init_c32vector(fft_len, channel[:fft_len])
+ chan_tag.key = pmt.string_to_symbol("ofdm_sync_chan_taps")
+ chan_tag.value = pmt.init_c32vector(fft_len, channel[:fft_len])
src = gr.vector_source_c(numpy.multiply(tx_signal, channel), False, fft_len, (len_tag, chan_tag))
eq = digital.ofdm_frame_equalizer_vcvc(equalizer.base(), len_tag_key, True)
sink = gr.vector_sink_c(fft_len)
@@ -101,10 +101,10 @@ class qa_ofdm_frame_equalizer_vcvc (gr_unittest.TestCase):
rx_data = [cnst.decision_maker_v((x,)) if x != 0 else -1 for x in sink.data()]
self.assertEqual(tx_data, rx_data)
for tag in sink.tags():
- if pmt.pmt_symbol_to_string(tag.key) == len_tag_key:
- self.assertEqual(pmt.pmt_to_long(tag.value), 4)
- if pmt.pmt_symbol_to_string(tag.key) == "ofdm_sync_chan_taps":
- self.assertEqual(list(pmt.pmt_c32vector_elements(tag.value)), channel[-fft_len:])
+ if pmt.symbol_to_string(tag.key) == len_tag_key:
+ self.assertEqual(pmt.to_long(tag.value), 4)
+ if pmt.symbol_to_string(tag.key) == "ofdm_sync_chan_taps":
+ self.assertEqual(list(pmt.c32vector_elements(tag.value)), channel[-fft_len:])
def test_002_simpledfe (self):
fft_len = 8
@@ -136,12 +136,12 @@ class qa_ofdm_frame_equalizer_vcvc (gr_unittest.TestCase):
len_tag_key = "frame_len"
len_tag = gr.gr_tag_t()
len_tag.offset = 0
- len_tag.key = pmt.pmt_string_to_symbol(len_tag_key)
- len_tag.value = pmt.pmt_from_long(4)
+ len_tag.key = pmt.string_to_symbol(len_tag_key)
+ len_tag.value = pmt.from_long(4)
chan_tag = gr.gr_tag_t()
chan_tag.offset = 0
- chan_tag.key = pmt.pmt_string_to_symbol("ofdm_sync_chan_taps")
- chan_tag.value = pmt.pmt_init_c32vector(fft_len, channel[:fft_len])
+ chan_tag.key = pmt.string_to_symbol("ofdm_sync_chan_taps")
+ chan_tag.value = pmt.init_c32vector(fft_len, channel[:fft_len])
src = gr.vector_source_c(numpy.multiply(tx_signal, channel), False, fft_len, (len_tag, chan_tag))
eq = digital.ofdm_frame_equalizer_vcvc(equalizer.base(), len_tag_key, True)
sink = gr.vector_sink_c(fft_len)
@@ -150,10 +150,10 @@ class qa_ofdm_frame_equalizer_vcvc (gr_unittest.TestCase):
rx_data = [cnst.decision_maker_v((x,)) if x != 0 else -1 for x in sink.data()]
self.assertEqual(tx_data, rx_data)
for tag in sink.tags():
- if pmt.pmt_symbol_to_string(tag.key) == len_tag_key:
- self.assertEqual(pmt.pmt_to_long(tag.value), 4)
- if pmt.pmt_symbol_to_string(tag.key) == "ofdm_sync_chan_taps":
- self.assertComplexTuplesAlmostEqual(list(pmt.pmt_c32vector_elements(tag.value)), channel[-fft_len:], places=1)
+ if pmt.symbol_to_string(tag.key) == len_tag_key:
+ self.assertEqual(pmt.to_long(tag.value), 4)
+ if pmt.symbol_to_string(tag.key) == "ofdm_sync_chan_taps":
+ self.assertComplexTuplesAlmostEqual(list(pmt.c32vector_elements(tag.value)), channel[-fft_len:], places=1)
if __name__ == '__main__':
diff --git a/gr-digital/python/qa_ofdm_insert_preamble.py b/gr-digital/python/qa_ofdm_insert_preamble.py
index c45893fa38..60902edc14 100755
--- a/gr-digital/python/qa_ofdm_insert_preamble.py
+++ b/gr-digital/python/qa_ofdm_insert_preamble.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2007,2010,2011 Free Software Foundation, Inc.
+# Copyright 2007,2010-2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -22,14 +22,15 @@
from gnuradio import gr, gr_unittest
from pprint import pprint
-import digital_swig
+import digital_swig as digital
+import blocks_swig as blocks
-class test_ofdm_insert_preamble (gr_unittest.TestCase):
+class test_ofdm_insert_preamble(gr_unittest.TestCase):
- def setUp (self):
- self.tb = gr.top_block ()
+ def setUp(self):
+ self.tb = gr.top_block()
- def tearDown (self):
+ def tearDown(self):
self.tb = None
def helper(self, v0, v1, fft_length, preamble):
@@ -37,13 +38,13 @@ class test_ofdm_insert_preamble (gr_unittest.TestCase):
src0 = gr.vector_source_c(v0)
src1 = gr.vector_source_b(v1)
- s2v = gr.stream_to_vector(gr.sizeof_gr_complex, fft_length)
+ s2v = blocks.stream_to_vector(gr.sizeof_gr_complex, fft_length)
# print "len(v) = %d" % (len(v))
- op = digital_swig.ofdm_insert_preamble(fft_length, preamble)
+ op = digital.ofdm_insert_preamble(fft_length, preamble)
- v2s = gr.vector_to_stream(gr.sizeof_gr_complex, fft_length)
+ v2s = blocks.vector_to_stream(gr.sizeof_gr_complex, fft_length)
dst0 = gr.vector_sink_c()
dst1 = gr.vector_sink_b()
@@ -105,7 +106,6 @@ class test_ofdm_insert_preamble (gr_unittest.TestCase):
p.append(tuple(t))
v += t
-
r = self.helper(v, npayloads*[1], fft_length, preamble)
self.assertEqual(r[0], tuple(npayloads*[1, 0]))
@@ -175,6 +175,5 @@ class test_ofdm_insert_preamble (gr_unittest.TestCase):
p0, p1, p[12], p[13],
p0, p1, p[14], p[15]))
-
if __name__ == '__main__':
gr_unittest.run(test_ofdm_insert_preamble, "test_ofdm_insert_preamble.xml")
diff --git a/gr-digital/python/qa_ofdm_serializer_vcc.py b/gr-digital/python/qa_ofdm_serializer_vcc.py
index 537e19b593..107d6076c5 100755
--- a/gr-digital/python/qa_ofdm_serializer_vcc.py
+++ b/gr-digital/python/qa_ofdm_serializer_vcc.py
@@ -21,7 +21,9 @@
#
from gnuradio import gr, gr_unittest
+import blocks_swig as blocks
import fft_swig as fft
+import analog_swig as analog
import digital_swig as digital
try: import pmt
except: from gruel import pmt
@@ -48,8 +50,8 @@ class qa_ofdm_serializer_vcc (gr_unittest.TestCase):
tag_name = "len"
tag = gr.gr_tag_t()
tag.offset = 0
- tag.key = pmt.pmt_string_to_symbol(tag_name)
- tag.value = pmt.pmt_from_long(n_syms)
+ tag.key = pmt.string_to_symbol(tag_name)
+ tag.value = pmt.from_long(n_syms)
src = gr.vector_source_c(tx_symbols, False, fft_len, (tag,))
serializer = digital.ofdm_serializer_vcc(fft_len, occupied_carriers, tag_name, "", 0, False)
sink = gr.vector_sink_c()
@@ -58,8 +60,8 @@ class qa_ofdm_serializer_vcc (gr_unittest.TestCase):
self.assertEqual(sink.data(), expected_result)
self.assertEqual(len(sink.tags()), 1)
result_tag = sink.tags()[0]
- self.assertEqual(pmt.pmt_symbol_to_string(result_tag.key), tag_name)
- self.assertEqual(pmt.pmt_to_long(result_tag.value), n_syms * len(occupied_carriers[0]))
+ self.assertEqual(pmt.symbol_to_string(result_tag.key), tag_name)
+ self.assertEqual(pmt.to_long(result_tag.value), n_syms * len(occupied_carriers[0]))
def test_002_with_offset (self):
""" Standard test, carrier offset """
@@ -75,12 +77,12 @@ class qa_ofdm_serializer_vcc (gr_unittest.TestCase):
tag_name = "len"
tag = gr.gr_tag_t()
tag.offset = 0
- tag.key = pmt.pmt_string_to_symbol(tag_name)
- tag.value = pmt.pmt_from_long(n_syms)
+ tag.key = pmt.string_to_symbol(tag_name)
+ tag.value = pmt.from_long(n_syms)
offsettag = gr.gr_tag_t()
offsettag.offset = 0
- offsettag.key = pmt.pmt_string_to_symbol("ofdm_sync_carr_offset")
- offsettag.value = pmt.pmt_from_long(carr_offset)
+ offsettag.key = pmt.string_to_symbol("ofdm_sync_carr_offset")
+ offsettag.value = pmt.from_long(carr_offset)
src = gr.vector_source_c(tx_symbols, False, fft_len, (tag, offsettag))
serializer = digital.ofdm_serializer_vcc(fft_len, occupied_carriers, tag_name, "", 0, False)
sink = gr.vector_sink_c()
@@ -89,8 +91,8 @@ class qa_ofdm_serializer_vcc (gr_unittest.TestCase):
self.assertEqual(sink.data(), expected_result)
self.assertEqual(len(sink.tags()), 2)
for tag in sink.tags():
- if pmt.pmt_symbol_to_string(tag.key) == tag_name:
- self.assertEqual(pmt.pmt_to_long(tag.value), n_syms * len(occupied_carriers[0]))
+ if pmt.symbol_to_string(tag.key) == tag_name:
+ self.assertEqual(pmt.to_long(tag.value), n_syms * len(occupied_carriers[0]))
def test_003_connect (self):
""" Connect carrier_allocator to ofdm_serializer,
@@ -104,8 +106,8 @@ class qa_ofdm_serializer_vcc (gr_unittest.TestCase):
tag_name = "len"
tag = gr.gr_tag_t()
tag.offset = 0
- tag.key = pmt.pmt_string_to_symbol(tag_name)
- tag.value = pmt.pmt_from_long(len(tx_data))
+ tag.key = pmt.string_to_symbol(tag_name)
+ tag.value = pmt.from_long(len(tx_data))
src = gr.vector_source_c(tx_data, False, 1, (tag,))
alloc = digital.ofdm_carrier_allocator_cvc(fft_len,
occupied_carriers,
@@ -138,12 +140,12 @@ class qa_ofdm_serializer_vcc (gr_unittest.TestCase):
tag_name = "len"
tag = gr.gr_tag_t()
tag.offset = 0
- tag.key = pmt.pmt_string_to_symbol(tag_name)
- tag.value = pmt.pmt_from_long(len(tx_data))
+ tag.key = pmt.string_to_symbol(tag_name)
+ tag.value = pmt.from_long(len(tx_data))
offsettag = gr.gr_tag_t()
offsettag.offset = 0
- offsettag.key = pmt.pmt_string_to_symbol("ofdm_sync_carr_offset")
- offsettag.value = pmt.pmt_from_long(carr_offset)
+ offsettag.key = pmt.string_to_symbol("ofdm_sync_carr_offset")
+ offsettag.value = pmt.from_long(carr_offset)
src = gr.vector_source_c(tx_data, False, 1, (tag, offsettag))
alloc = digital.ofdm_carrier_allocator_cvc(fft_len,
occupied_carriers,
@@ -151,16 +153,16 @@ class qa_ofdm_serializer_vcc (gr_unittest.TestCase):
pilot_symbols,
tag_name)
tx_ifft = fft.fft_vcc(fft_len, False, ())
- offset_sig = gr.sig_source_c(1.0, gr.GR_COS_WAVE, freq_offset, 1.0)
- mixer = gr.multiply_cc()
+ offset_sig = analog.sig_source_c(1.0, analog.GR_COS_WAVE, freq_offset, 1.0)
+ mixer = blocks.multiply_cc()
rx_fft = fft.fft_vcc(fft_len, True, (), True)
serializer = digital.ofdm_serializer_vcc(alloc)
sink = gr.vector_sink_c()
self.tb.connect(
src, alloc, tx_ifft,
- gr.vector_to_stream(gr.sizeof_gr_complex, fft_len),
+ blocks.vector_to_stream(gr.sizeof_gr_complex, fft_len),
(mixer, 0),
- gr.stream_to_vector(gr.sizeof_gr_complex, fft_len),
+ blocks.stream_to_vector(gr.sizeof_gr_complex, fft_len),
rx_fft, serializer, sink
)
self.tb.connect(offset_sig, (mixer, 1))
@@ -181,12 +183,12 @@ class qa_ofdm_serializer_vcc (gr_unittest.TestCase):
tag_name = "len"
tag = gr.gr_tag_t()
tag.offset = 0
- tag.key = pmt.pmt_string_to_symbol(tag_name)
- tag.value = pmt.pmt_from_long(n_syms)
+ tag.key = pmt.string_to_symbol(tag_name)
+ tag.value = pmt.from_long(n_syms)
tag2 = gr.gr_tag_t()
tag2.offset = 0
- tag2.key = pmt.pmt_string_to_symbol("packet_len")
- tag2.value = pmt.pmt_from_long(len(expected_result))
+ tag2.key = pmt.string_to_symbol("packet_len")
+ tag2.value = pmt.from_long(len(expected_result))
src = gr.vector_source_c(tx_symbols, False, fft_len, (tag, tag2))
serializer = digital.ofdm_serializer_vcc(fft_len, occupied_carriers, tag_name, "packet_len", 0, False)
sink = gr.vector_sink_c()
@@ -195,8 +197,8 @@ class qa_ofdm_serializer_vcc (gr_unittest.TestCase):
self.assertEqual(sink.data(), expected_result)
self.assertEqual(len(sink.tags()), 1)
result_tag = sink.tags()[0]
- self.assertEqual(pmt.pmt_symbol_to_string(result_tag.key), "packet_len")
- self.assertEqual(pmt.pmt_to_long(result_tag.value), len(expected_result))
+ self.assertEqual(pmt.symbol_to_string(result_tag.key), "packet_len")
+ self.assertEqual(pmt.to_long(result_tag.value), len(expected_result))
def test_099 (self):
""" Make sure it fails if it should """
diff --git a/gr-digital/python/qa_ofdm_sync_sc_cfb.py b/gr-digital/python/qa_ofdm_sync_sc_cfb.py
index bed8e9c3ae..e71cd5cce3 100755
--- a/gr-digital/python/qa_ofdm_sync_sc_cfb.py
+++ b/gr-digital/python/qa_ofdm_sync_sc_cfb.py
@@ -24,6 +24,9 @@ import numpy
import random
from gnuradio import gr, gr_unittest
+import blocks_swig as blocks
+import analog_swig as analog
+
try:
# This will work when feature #505 is added.
from gnuradio import digital
@@ -35,6 +38,7 @@ except ImportError:
from utils import tagged_streams
from ofdm_txrx import ofdm_tx
+
class qa_ofdm_sync_sc_cfb (gr_unittest.TestCase):
def setUp (self):
@@ -57,12 +61,12 @@ class qa_ofdm_sync_sc_cfb (gr_unittest.TestCase):
sync_symbol + \
[(random.randint(0, 1)*2)-1 for x in range(sig_len)]
tx_signal = tx_signal * 2
- add = gr.add_cc()
+ add = blocks.add_cc()
sync = digital.ofdm_sync_sc_cfb(fft_len, cp_len)
sink_freq = gr.vector_sink_f()
sink_detect = gr.vector_sink_b()
self.tb.connect(gr.vector_source_c(tx_signal), (add, 0))
- self.tb.connect(gr.noise_source_c(gr.GR_GAUSSIAN, .01), (add, 1))
+ self.tb.connect(analog.noise_source_c(analog.GR_GAUSSIAN, .01), (add, 1))
self.tb.connect(add, sync)
self.tb.connect((sync, 0), sink_freq)
self.tb.connect((sync, 1), sink_detect)
@@ -85,14 +89,14 @@ class qa_ofdm_sync_sc_cfb (gr_unittest.TestCase):
tx_signal = sync_symbol[-cp_len:] + \
sync_symbol + \
[(random.randint(0, 1)*2)-1 for x in range(sig_len)]
- mult = gr.multiply_cc()
- add = gr.add_cc()
+ mult = blocks.multiply_cc()
+ add = blocks.add_cc()
sync = digital.ofdm_sync_sc_cfb(fft_len, cp_len)
sink_freq = gr.vector_sink_f()
sink_detect = gr.vector_sink_b()
self.tb.connect(gr.vector_source_c(tx_signal), (mult, 0), (add, 0))
- self.tb.connect(gr.sig_source_c(2 * numpy.pi, gr.GR_SIN_WAVE, freq_offset, 1.0), (mult, 1))
- self.tb.connect(gr.noise_source_c(gr.GR_GAUSSIAN, .01), (add, 1))
+ self.tb.connect(analog.sig_source_c(2 * numpy.pi, analog.GR_SIN_WAVE, freq_offset, 1.0), (mult, 1))
+ self.tb.connect(analog.noise_source_c(analog.GR_GAUSSIAN, .01), (add, 1))
self.tb.connect(add, sync)
self.tb.connect((sync, 0), sink_freq)
self.tb.connect((sync, 1), sink_detect)
@@ -116,12 +120,12 @@ class qa_ofdm_sync_sc_cfb (gr_unittest.TestCase):
sync_symbol[-cp_len:] + \
sync_symbol + \
[(random.randint(0, 1)*2)-1 for x in range(fft_len * random.randint(5,23))]
- add = gr.add_cc()
+ add = blocks.add_cc()
sync = digital.ofdm_sync_sc_cfb(fft_len, cp_len)
sink_freq = gr.vector_sink_f()
sink_detect = gr.vector_sink_b()
self.tb.connect(gr.vector_source_c(tx_signal), (add, 0))
- self.tb.connect(gr.noise_source_c(gr.GR_GAUSSIAN, .005), (add, 1))
+ self.tb.connect(analog.noise_source_c(analog.GR_GAUSSIAN, .005), (add, 1))
self.tb.connect(add, sync)
self.tb.connect((sync, 0), sink_freq)
self.tb.connect((sync, 1), sink_detect)
diff --git a/gr-digital/python/qa_packet_headergenerator_bb.py b/gr-digital/python/qa_packet_headergenerator_bb.py
index 1aeaa86063..2e6e401566 100755
--- a/gr-digital/python/qa_packet_headergenerator_bb.py
+++ b/gr-digital/python/qa_packet_headergenerator_bb.py
@@ -38,16 +38,16 @@ class qa_packet_headergenerator_bb (gr_unittest.TestCase):
tagname = "packet_len"
tag1 = gr.gr_tag_t()
tag1.offset = 0
- tag1.key = pmt.pmt_string_to_symbol(tagname)
- tag1.value = pmt.pmt_from_long(4)
+ tag1.key = pmt.string_to_symbol(tagname)
+ tag1.value = pmt.from_long(4)
tag2 = gr.gr_tag_t()
tag2.offset = 4
- tag2.key = pmt.pmt_string_to_symbol(tagname)
- tag2.value = pmt.pmt_from_long(2)
+ tag2.key = pmt.string_to_symbol(tagname)
+ tag2.value = pmt.from_long(2)
tag3 = gr.gr_tag_t()
tag3.offset = 6
- tag3.key = pmt.pmt_string_to_symbol(tagname)
- tag3.value = pmt.pmt_from_long(4)
+ tag3.key = pmt.string_to_symbol(tagname)
+ tag3.value = pmt.from_long(4)
src = gr.vector_source_b(data, False, 1, (tag1, tag2, tag3))
header = digital.packet_headergenerator_bb(12, tagname)
sink = gr.vector_sink_b()
@@ -67,16 +67,16 @@ class qa_packet_headergenerator_bb (gr_unittest.TestCase):
tagname = "packet_len"
tag1 = gr.gr_tag_t()
tag1.offset = 0
- tag1.key = pmt.pmt_string_to_symbol(tagname)
- tag1.value = pmt.pmt_from_long(4)
+ tag1.key = pmt.string_to_symbol(tagname)
+ tag1.value = pmt.from_long(4)
tag2 = gr.gr_tag_t()
tag2.offset = 4
- tag2.key = pmt.pmt_string_to_symbol(tagname)
- tag2.value = pmt.pmt_from_long(2)
+ tag2.key = pmt.string_to_symbol(tagname)
+ tag2.value = pmt.from_long(2)
tag3 = gr.gr_tag_t()
tag3.offset = 6
- tag3.key = pmt.pmt_string_to_symbol(tagname)
- tag3.value = pmt.pmt_from_long(4)
+ tag3.key = pmt.string_to_symbol(tagname)
+ tag3.value = pmt.from_long(4)
src = gr.vector_source_b(data, False, 1, (tag1, tag2, tag3))
header = digital.packet_headergenerator_bb(32, tagname)
sink = gr.vector_sink_b()
@@ -97,16 +97,16 @@ class qa_packet_headergenerator_bb (gr_unittest.TestCase):
tagname = "packet_len"
tag1 = gr.gr_tag_t()
tag1.offset = 0
- tag1.key = pmt.pmt_string_to_symbol(tagname)
- tag1.value = pmt.pmt_from_long(4)
+ tag1.key = pmt.string_to_symbol(tagname)
+ tag1.value = pmt.from_long(4)
tag2 = gr.gr_tag_t()
tag2.offset = 4
- tag2.key = pmt.pmt_string_to_symbol(tagname)
- tag2.value = pmt.pmt_from_long(2)
+ tag2.key = pmt.string_to_symbol(tagname)
+ tag2.value = pmt.from_long(2)
tag3 = gr.gr_tag_t()
tag3.offset = 6
- tag3.key = pmt.pmt_string_to_symbol(tagname)
- tag3.value = pmt.pmt_from_long(4)
+ tag3.key = pmt.string_to_symbol(tagname)
+ tag3.value = pmt.from_long(4)
src = gr.vector_source_b(data, False, 1, (tag1, tag2, tag3))
formatter_object = digital.packet_header_default(12, tagname)
header = digital.packet_headergenerator_bb(formatter_object.formatter())
@@ -127,20 +127,20 @@ class qa_packet_headergenerator_bb (gr_unittest.TestCase):
tagname = "packet_len"
tag1 = gr.gr_tag_t()
tag1.offset = 0
- tag1.key = pmt.pmt_string_to_symbol(tagname)
- tag1.value = pmt.pmt_from_long(4)
+ tag1.key = pmt.string_to_symbol(tagname)
+ tag1.value = pmt.from_long(4)
tag2 = gr.gr_tag_t()
tag2.offset = 4
- tag2.key = pmt.pmt_string_to_symbol(tagname)
- tag2.value = pmt.pmt_from_long(2)
+ tag2.key = pmt.string_to_symbol(tagname)
+ tag2.value = pmt.from_long(2)
tag3 = gr.gr_tag_t()
tag3.offset = 6
- tag3.key = pmt.pmt_string_to_symbol(tagname)
- tag3.value = pmt.pmt_from_long(4)
+ tag3.key = pmt.string_to_symbol(tagname)
+ tag3.value = pmt.from_long(4)
src = gr.vector_source_b(data, False, 1, (tag1, tag2, tag3))
formatter_object = digital.packet_header_ofdm(occupied_carriers, 1, tagname)
self.assertEqual(formatter_object.header_len(), 6)
- self.assertEqual(pmt.pmt_symbol_to_string(formatter_object.len_tag_key()), tagname)
+ self.assertEqual(pmt.symbol_to_string(formatter_object.len_tag_key()), tagname)
header = digital.packet_headergenerator_bb(formatter_object.formatter())
sink = gr.vector_sink_b()
self.tb.connect(src, header, sink)
diff --git a/gr-digital/python/qa_packet_headerparser_b.py b/gr-digital/python/qa_packet_headerparser_b.py
index 13dc46f9e3..aec2f96b57 100755
--- a/gr-digital/python/qa_packet_headerparser_b.py
+++ b/gr-digital/python/qa_packet_headerparser_b.py
@@ -23,6 +23,7 @@ import time
from gnuradio import gr, gr_unittest
try: import pmt
except: from gruel import pmt
+import blocks_swig as blocks
import digital_swig as digital
class qa_packet_headerparser_b (gr_unittest.TestCase):
@@ -44,7 +45,7 @@ class qa_packet_headerparser_b (gr_unittest.TestCase):
src = gr.vector_source_b(expected_data)
parser = digital.packet_headerparser_b(32, tagname)
- sink = gr.message_debug()
+ sink = blocks.message_debug()
self.tb.connect(src, parser)
self.tb.msg_connect(parser, "header_data", sink, "store")
diff --git a/gr-digital/python/qa_pfb_clock_sync.py b/gr-digital/python/qa_pfb_clock_sync.py
index 06c8a60ba7..4d0276bcd6 100755
--- a/gr-digital/python/qa_pfb_clock_sync.py
+++ b/gr-digital/python/qa_pfb_clock_sync.py
@@ -21,18 +21,19 @@
#
from gnuradio import gr, gr_unittest
+import filter_swig as filter
import digital_swig as digital
import random, cmath
class test_pfb_clock_sync(gr_unittest.TestCase):
- def setUp (self):
- self.tb = gr.top_block ()
+ def setUp(self):
+ self.tb = gr.top_block()
- def tearDown (self):
+ def tearDown(self):
self.tb = None
- def test01 (self):
+ def test01(self):
# Test BPSK sync
excess_bw = 0.35
@@ -44,36 +45,36 @@ class test_pfb_clock_sync(gr_unittest.TestCase):
osps = 1
ntaps = 11 * int(sps*nfilts)
- taps = gr.firdes.root_raised_cosine(nfilts, nfilts*sps,
- 1.0, excess_bw, ntaps)
+ taps = filter.firdes.root_raised_cosine(nfilts, nfilts*sps,
+ 1.0, excess_bw, ntaps)
self.test = digital.pfb_clock_sync_ccf(sps, loop_bw, taps,
nfilts, init_phase,
max_rate_deviation,
osps)
- data = 1000*[complex(1,0), complex(-1,0)]
+ data = 10000*[complex(1,0), complex(-1,0)]
self.src = gr.vector_source_c(data, False)
# pulse shaping interpolation filter
- rrc_taps = gr.firdes.root_raised_cosine(
+ rrc_taps = filter.firdes.root_raised_cosine(
nfilts, # gain
nfilts, # sampling rate based on 32 filters in resampler
1.0, # symbol rate
excess_bw, # excess bandwidth (roll-off factor)
ntaps)
- self.rrc_filter = gr.pfb_arb_resampler_ccf(sps, rrc_taps)
+ self.rrc_filter = filter.pfb_arb_resampler_ccf(sps, rrc_taps)
self.snk = gr.vector_sink_c()
self.tb.connect(self.src, self.rrc_filter, self.test, self.snk)
self.tb.run()
- expected_result = 1000*[complex(-1,0), complex(1,0)]
+ expected_result = 10000*[complex(-1,0), complex(1,0)]
dst_data = self.snk.data()
# Only compare last Ncmp samples
- Ncmp = 100
+ Ncmp = 1000
len_e = len(expected_result)
len_d = len(dst_data)
expected_result = expected_result[len_e - Ncmp:]
@@ -82,10 +83,10 @@ class test_pfb_clock_sync(gr_unittest.TestCase):
#for e,d in zip(expected_result, dst_data):
# print e, d
- self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 1)
+ self.assertComplexTuplesAlmostEqual(expected_result, dst_data, 1)
- def test02 (self):
+ def test02(self):
# Test real BPSK sync
excess_bw = 0.35
@@ -97,36 +98,36 @@ class test_pfb_clock_sync(gr_unittest.TestCase):
osps = 1
ntaps = 11 * int(sps*nfilts)
- taps = gr.firdes.root_raised_cosine(nfilts, nfilts*sps,
- 1.0, excess_bw, ntaps)
+ taps = filter.firdes.root_raised_cosine(nfilts, nfilts*sps,
+ 1.0, excess_bw, ntaps)
self.test = digital.pfb_clock_sync_fff(sps, loop_bw, taps,
nfilts, init_phase,
max_rate_deviation,
osps)
- data = 1000*[1, -1]
+ data = 10000*[1, -1]
self.src = gr.vector_source_f(data, False)
# pulse shaping interpolation filter
- rrc_taps = gr.firdes.root_raised_cosine(
+ rrc_taps = filter.firdes.root_raised_cosine(
nfilts, # gain
nfilts, # sampling rate based on 32 filters in resampler
1.0, # symbol rate
excess_bw, # excess bandwidth (roll-off factor)
ntaps)
- self.rrc_filter = gr.pfb_arb_resampler_fff(sps, rrc_taps)
+ self.rrc_filter = filter.pfb_arb_resampler_fff(sps, rrc_taps)
self.snk = gr.vector_sink_f()
self.tb.connect(self.src, self.rrc_filter, self.test, self.snk)
self.tb.run()
- expected_result = 1000*[-1, 1]
+ expected_result = 10000*[-1, 1]
dst_data = self.snk.data()
# Only compare last Ncmp samples
- Ncmp = 100
+ Ncmp = 1000
len_e = len(expected_result)
len_d = len(dst_data)
expected_result = expected_result[len_e - Ncmp:]
@@ -135,7 +136,7 @@ class test_pfb_clock_sync(gr_unittest.TestCase):
#for e,d in zip(expected_result, dst_data):
# print e, d
- self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 1)
+ self.assertComplexTuplesAlmostEqual(expected_result, dst_data, 1)
if __name__ == '__main__':
diff --git a/gr-digital/python/qa_pn_correlator_cc.py b/gr-digital/python/qa_pn_correlator_cc.py
index 377bef5feb..53633d04fa 100755
--- a/gr-digital/python/qa_pn_correlator_cc.py
+++ b/gr-digital/python/qa_pn_correlator_cc.py
@@ -22,11 +22,12 @@
from gnuradio import gr, gr_unittest
import digital_swig as digital
+import blocks_swig as blocks
class test_pn_correlator_cc(gr_unittest.TestCase):
def setUp(self):
- self.tb = gr.top_block ()
+ self.tb = gr.top_block()
def tearDown(self):
self.tb = None
@@ -39,7 +40,7 @@ class test_pn_correlator_cc(gr_unittest.TestCase):
length = 2**degree-1
src = digital.glfsr_source_f(degree)
head = gr.head(gr.sizeof_float, length*length)
- f2c = gr.float_to_complex()
+ f2c = blocks.float_to_complex()
corr = digital.pn_correlator_cc(degree)
dst = gr.vector_sink_c()
self.tb.connect(src, head, f2c, corr, dst)
diff --git a/gr-digital/python/qa_probe_density.py b/gr-digital/python/qa_probe_density.py
index c5b7e0e7c2..f42f00a7f7 100755
--- a/gr-digital/python/qa_probe_density.py
+++ b/gr-digital/python/qa_probe_density.py
@@ -34,37 +34,37 @@ class test_probe_density(gr_unittest.TestCase):
def test_001(self):
src_data = [0, 1, 0, 1]
expected_data = 1
- src = gr.vector_source_b (src_data)
+ src = gr.vector_source_b(src_data)
op = digital.probe_density_b(1)
- self.tb.connect (src, op)
- self.tb.run ()
+ self.tb.connect(src, op)
+ self.tb.run()
result_data = op.density()
- self.assertEqual (expected_data, result_data)
+ self.assertEqual(expected_data, result_data)
def test_002(self):
src_data = [1, 1, 1, 1]
expected_data = 1
- src = gr.vector_source_b (src_data)
+ src = gr.vector_source_b(src_data)
op = digital.probe_density_b(0.01)
- self.tb.connect (src, op)
- self.tb.run ()
+ self.tb.connect(src, op)
+ self.tb.run()
result_data = op.density()
- self.assertEqual (expected_data, result_data)
+ self.assertEqual(expected_data, result_data)
def test_003(self):
src_data = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1]
expected_data = 0.95243
- src = gr.vector_source_b (src_data)
+ src = gr.vector_source_b(src_data)
op = digital.probe_density_b(0.01)
- self.tb.connect (src, op)
- self.tb.run ()
+ self.tb.connect(src, op)
+ self.tb.run()
result_data = op.density()
print result_data
- self.assertAlmostEqual (expected_data, result_data, 5)
+ self.assertAlmostEqual(expected_data, result_data, 5)
if __name__ == '__main__':
gr_unittest.run(test_probe_density, "test_probe_density.xml")
diff --git a/gr-digital/python/qa_scrambler.py b/gr-digital/python/qa_scrambler.py
index f5bd612429..3127a7c1e6 100755
--- a/gr-digital/python/qa_scrambler.py
+++ b/gr-digital/python/qa_scrambler.py
@@ -25,7 +25,7 @@ import digital_swig as digital
class test_scrambler(gr_unittest.TestCase):
- def setUp (self):
+ def setUp(self):
self.tb = gr.top_block()
def tearDown(self):
diff --git a/gr-digital/python/qa_simple_correlator.py b/gr-digital/python/qa_simple_correlator.py
index 124201a556..ff0faeb415 100755
--- a/gr-digital/python/qa_simple_correlator.py
+++ b/gr-digital/python/qa_simple_correlator.py
@@ -21,6 +21,8 @@
#
from gnuradio import gr, gr_unittest
+import blocks_swig as blocks
+import filter_swig as filter
import digital_swig as digital
class test_simple_correlator(gr_unittest.TestCase):
@@ -40,15 +42,15 @@ class test_simple_correlator(gr_unittest.TestCase):
# Filter taps to expand the data to oversample by 8
# Just using a RRC for some basic filter shape
- taps = gr.firdes.root_raised_cosine(8, 8, 1.0, 0.5, 21)
+ taps = filter.firdes.root_raised_cosine(8, 8, 1.0, 0.5, 21)
src = gr.vector_source_b(expected_result)
frame = digital.simple_framer(4)
- unpack = gr.packed_to_unpacked_bb(1, gr.GR_MSB_FIRST)
- expand = gr.interp_fir_filter_fff(8, taps)
- b2f = gr.char_to_float()
- mult2 = gr.multiply_const_ff(2)
- sub1 = gr.add_const_ff(-1)
+ unpack = blocks.packed_to_unpacked_bb(1, gr.GR_MSB_FIRST)
+ expand = filter.interp_fir_filter_fff(8, taps)
+ b2f = blocks.char_to_float()
+ mult2 = blocks.multiply_const_ff(2)
+ sub1 = blocks.add_const_ff(-1)
op = digital.simple_correlator(4)
dst = gr.vector_sink_b()
self.tb.connect(src, frame, unpack, b2f, mult2, sub1, expand)
diff --git a/gr-digital/python/qa_simple_framer.py b/gr-digital/python/qa_simple_framer.py
index 09b2d329b2..f8c894da28 100755
--- a/gr-digital/python/qa_simple_framer.py
+++ b/gr-digital/python/qa_simple_framer.py
@@ -24,15 +24,15 @@ from gnuradio import gr, gr_unittest
import digital_swig as digital
import math
-class test_simple_framer (gr_unittest.TestCase):
+class test_simple_framer(gr_unittest.TestCase):
- def setUp (self):
- self.tb = gr.top_block ()
+ def setUp(self):
+ self.tb = gr.top_block()
- def tearDown (self):
+ def tearDown(self):
self.tb = None
- def test_simple_framer_001 (self):
+ def test_simple_framer_001(self):
src_data = (0x00, 0x11, 0x22, 0x33,
0x44, 0x55, 0x66, 0x77,
0x88, 0x99, 0xaa, 0xbb,
@@ -44,15 +44,14 @@ class test_simple_framer (gr_unittest.TestCase):
0xac, 0xdd, 0xa4, 0xe2, 0xf2, 0x8c, 0x20, 0xfc, 0x02, 0x88, 0x99, 0xaa, 0xbb, 0x55,
0xac, 0xdd, 0xa4, 0xe2, 0xf2, 0x8c, 0x20, 0xfc, 0x03, 0xcc, 0xdd, 0xee, 0xff, 0x55)
- src = gr.vector_source_b (src_data)
- op = digital.simple_framer (4)
- dst = gr.vector_sink_b ()
- self.tb.connect (src, op)
- self.tb.connect (op, dst)
- self.tb.run ()
- result_data = dst.data ()
- self.assertEqual (expected_result, result_data)
-
+ src = gr.vector_source_b(src_data)
+ op = digital.simple_framer(4)
+ dst = gr.vector_sink_b()
+ self.tb.connect(src, op)
+ self.tb.connect(op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertEqual(expected_result, result_data)
if __name__ == '__main__':
gr_unittest.run(test_simple_framer, "test_simple_framer.xml")
diff --git a/gr-digital/python/qam.py b/gr-digital/python/qam.py
index 6834e1945a..518be78941 100644
--- a/gr-digital/python/qam.py
+++ b/gr-digital/python/qam.py
@@ -1,5 +1,5 @@
#
-# Copyright 2005,2006,2011 Free Software Foundation, Inc.
+# Copyright 2005,2006,2011,2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -27,10 +27,11 @@ from math import pi, sqrt, log
from gnuradio import gr
from generic_mod_demod import generic_mod, generic_demod
+from generic_mod_demod import shared_mod_args, shared_demod_args
from utils.gray_code import gray_code
from utils import mod_codes
import modulation_utils
-import digital_swig
+import digital_swig as digital
# Default number of points in constellation.
_def_constellation_points = 16
@@ -165,21 +166,23 @@ def qam_constellation(constellation_points=_def_constellation_points,
else:
raise ValueError("Mod code is not implemented for QAM")
if differential:
- points = make_differential_constellation(constellation_points, gray_coded)
+ points = make_differential_constellation(constellation_points, gray_coded=False)
else:
points = make_non_differential_constellation(constellation_points, gray_coded)
side = int(sqrt(constellation_points))
width = 2.0/(side-1)
+
# No pre-diff code
# Should add one so that we can gray-code the quadrant bits too.
pre_diff_code = []
if not large_ampls_to_corners:
- constellation = digital_swig.constellation_rect(points, pre_diff_code, 4,
+ constellation = digital.constellation_rect(points, pre_diff_code, 4,
side, side, width, width)
else:
sector_values = large_ampls_to_corners_mapping(side, points, width)
- constellation = digital_swig.constellation_expl_rect(
+ constellation = digital.constellation_expl_rect(
points, pre_diff_code, 4, side, side, width, width, sector_values)
+
return constellation
def find_closest_point(p, qs):
@@ -257,6 +260,19 @@ def large_ampls_to_corners_mapping(side, points, width):
# /////////////////////////////////////////////////////////////////////////////
class qam_mod(generic_mod):
+ """
+ Hierarchical block for RRC-filtered QAM modulation.
+
+ The input is a byte stream (unsigned char) and the
+ output is the complex modulated signal at baseband.
+
+ Args:
+ constellation_points: Number of constellation points (must be a power of four) (integer).
+ mod_code: Whether to use a gray_code (digital.mod_codes.GRAY_CODE) or not (digital.mod_codes.NO_CODE).
+ differential: Whether to use differential encoding (boolean).
+ """
+ # See generic_mod for additional arguments
+ __doc__ += shared_mod_args
def __init__(self, constellation_points=_def_constellation_points,
differential=_def_differential,
@@ -291,13 +307,25 @@ class qam_mod(generic_mod):
# /////////////////////////////////////////////////////////////////////////////
class qam_demod(generic_demod):
+ """
+ Hierarchical block for RRC-filtered QAM modulation.
+
+ The input is a byte stream (unsigned char) and the
+ output is the complex modulated signal at baseband.
+
+ Args:
+ constellation_points: Number of constellation points (must be a power of four) (integer).
+ mod_code: Whether to use a gray_code (digital.mod_codes.GRAY_CODE) or not (digital.mod_codes.NO_CODE).
+ differential: Whether to use differential encoding (boolean).
+ """
+ # See generic_demod for additional arguments
+ __doc__ += shared_mod_args
def __init__(self, constellation_points=_def_constellation_points,
differential=_def_differential,
mod_code=_def_mod_code,
large_ampls_to_corner = False,
*args, **kwargs):
-
"""
Hierarchical block for RRC-filtered QAM modulation.
diff --git a/gr-digital/python/qpsk.py b/gr-digital/python/qpsk.py
index be21fd76f1..859d981367 100644
--- a/gr-digital/python/qpsk.py
+++ b/gr-digital/python/qpsk.py
@@ -27,50 +27,59 @@ Demodulation is not included since the generic_mod_demod
from gnuradio import gr
from gnuradio.digital.generic_mod_demod import generic_mod, generic_demod
-import digital_swig
+from gnuradio.digital.generic_mod_demod import shared_mod_args, shared_demod_args
+from utils import mod_codes
+import digital_swig as digital
import modulation_utils
-# Default number of points in constellation.
-_def_constellation_points = 4
-# Whether gray coding is used.
-_def_gray_coded = True
+# The default encoding (e.g. gray-code, set-partition)
+_def_mod_code = mod_codes.GRAY_CODE
# /////////////////////////////////////////////////////////////////////////////
# QPSK constellation
# /////////////////////////////////////////////////////////////////////////////
-def qpsk_constellation(m=_def_constellation_points):
- if m != _def_constellation_points:
- raise ValueError("QPSK can only have 4 constellation points.")
- return digital_swig.constellation_qpsk()
+def qpsk_constellation(mod_code=_def_mod_code):
+ """
+ Creates a QPSK constellation.
+ """
+ if mod_code != mod_codes.GRAY_CODE:
+ raise ValueError("This QPSK mod/demod works only for gray-coded constellations.")
+ return digital.constellation_qpsk()
# /////////////////////////////////////////////////////////////////////////////
# QPSK modulator
# /////////////////////////////////////////////////////////////////////////////
class qpsk_mod(generic_mod):
-
- def __init__(self, constellation_points=_def_constellation_points,
- gray_coded=_def_gray_coded,
- *args, **kwargs):
-
- """
- Hierarchical block for RRC-filtered QPSK modulation.
-
- The input is a byte stream (unsigned char) and the
- output is the complex modulated signal at baseband.
-
- See generic_mod block for list of parameters.
- """
-
- constellation_points = _def_constellation_points
- constellation = digital_swig.constellation_qpsk()
- if constellation_points != 4:
- raise ValueError("QPSK can only have 4 constellation points.")
- if not gray_coded:
- raise ValueError("This QPSK mod/demod works only for gray-coded constellations.")
+ """
+ Hierarchical block for RRC-filtered QPSK modulation.
+
+ The input is a byte stream (unsigned char) and the
+ output is the complex modulated signal at baseband.
+
+ Args:
+ mod_code: Whether to use a gray_code (digital.mod_codes.GRAY_CODE) or not (digital.mod_codes.NO_CODE).
+ differential: Whether to use differential encoding (boolean).
+ """
+ # See generic_mod for additional arguments
+ __doc__ += shared_mod_args
+
+ def __init__(self, mod_code=_def_mod_code, differential=False, *args, **kwargs):
+ pre_diff_code = True
+ if not differential:
+ constellation = digital.constellation_qpsk()
+ if mod_code != mod_codes.GRAY_CODE:
+ raise ValueError("This QPSK mod/demod works only for gray-coded constellations.")
+ else:
+ constellation = digital.constellation_dqpsk()
+ if mod_code not in set([mod_codes.GRAY_CODE, mod_codes.NO_CODE]):
+ raise ValueError("That mod_code is not supported for DQPSK mod/demod.")
+ if mod_code == mod_codes.NO_CODE:
+ pre_diff_code = False
+
super(qpsk_mod, self).__init__(constellation=constellation,
- gray_coded=gray_coded,
+ pre_diff_code=pre_diff_code,
*args, **kwargs)
@@ -80,24 +89,35 @@ class qpsk_mod(generic_mod):
# /////////////////////////////////////////////////////////////////////////////
class qpsk_demod(generic_demod):
-
- def __init__(self, constellation_points=_def_constellation_points,
+ """
+ Hierarchical block for RRC-filtered QPSK modulation.
+
+ The input is a byte stream (unsigned char) and the
+ output is the complex modulated signal at baseband.
+
+ Args:
+ mod_code: Whether to use a gray_code (digital.mod_codes.GRAY_CODE) or not (digital.mod_codes.NO_CODE).
+ differential: Whether to use differential encoding (boolean).
+ """
+ # See generic_mod for additional arguments
+ __doc__ += shared_demod_args
+
+ def __init__(self, mod_code=_def_mod_code, differential=False,
*args, **kwargs):
+ pre_diff_code = True
+ if not differential:
+ constellation = digital.constellation_qpsk()
+ if mod_code != mod_codes.GRAY_CODE:
+ raise ValueError("This QPSK mod/demod works only for gray-coded constellations.")
+ else:
+ constellation = digital.constellation_dqpsk()
+ if mod_code not in set([mod_codes.GRAY_CODE, mod_codes.NO_CODE]):
+ raise ValueError("That mod_code is not supported for DQPSK mod/demod.")
+ if mod_code == mod_codes.NO_CODE:
+ pre_diff_code = False
- """
- Hierarchical block for RRC-filtered QPSK modulation.
-
- The input is a byte stream (unsigned char) and the
- output is the complex modulated signal at baseband.
-
- See generic_demod block for list of parameters.
- """
-
- constellation_points = _def_constellation_points
- constellation = digital_swig.constellation_qpsk()
- if constellation_points != 4:
- raise ValueError('Number of constellation points must be 4 for QPSK.')
super(qpsk_demod, self).__init__(constellation=constellation,
+ pre_diff_code=pre_diff_code,
*args, **kwargs)
@@ -106,36 +126,30 @@ class qpsk_demod(generic_demod):
# DQPSK constellation
# /////////////////////////////////////////////////////////////////////////////
-def dqpsk_constellation(m=_def_constellation_points):
- if m != _def_constellation_points:
- raise ValueError("DQPSK can only have 4 constellation points.")
- return digital_swig.constellation_dqpsk()
+def dqpsk_constellation(mod_code=_def_mod_code):
+ if mod_code != mod_codes.GRAY_CODE:
+ raise ValueError("The DQPSK constellation is only generated for gray_coding. But it can be used for non-grayed coded modulation if one doesn't use the pre-differential code.")
+ return digital.constellation_dqpsk()
# /////////////////////////////////////////////////////////////////////////////
# DQPSK modulator
# /////////////////////////////////////////////////////////////////////////////
-class dqpsk_mod(generic_mod):
-
- def __init__(self, constellation_points=_def_constellation_points,
- gray_coded=_def_gray_coded,
- differential=True, *args, **kwargs):
- """
- Hierarchical block for RRC-filtered DQPSK modulation.
-
- The input is a byte stream (unsigned char) and the
- output is the complex modulated signal at baseband.
-
- See generic_mod block for list of parameters.
- """
-
- constellation_points = _def_constellation_points
- constellation = digital_swig.constellation_dqpsk()
- if constellation_points != 4:
- raise ValueError('Number of constellation points must be 4 for DQPSK.')
- super(dqpsk_mod, self).__init__(constellation=constellation,
- gray_coded=gray_coded,
- differential=True,
+class dqpsk_mod(qpsk_mod):
+ """
+ Hierarchical block for RRC-filtered DQPSK modulation.
+
+ The input is a byte stream (unsigned char) and the
+ output is the complex modulated signal at baseband.
+
+ Args:
+ mod_code: Whether to use a gray_code (digital.mod_codes.GRAY_CODE) or not (digital.mod_codes.NO_CODE).
+ """
+ # See generic_mod for additional arguments
+ __doc__ += shared_mod_args
+
+ def __init__(self, mod_code=_def_mod_code, *args, **kwargs):
+ super(dqpsk_mod, self).__init__(mod_code,
*args, **kwargs)
# /////////////////////////////////////////////////////////////////////////////
@@ -143,25 +157,21 @@ class dqpsk_mod(generic_mod):
#
# /////////////////////////////////////////////////////////////////////////////
-class dqpsk_demod(generic_demod):
-
- def __init__(self, constellation_points=_def_constellation_points,
- differential=True, *args, **kwargs):
-
- """
- Hierarchical block for RRC-filtered DQPSK modulation.
-
- The input is a byte stream (unsigned char) and the
- output is the complex modulated signal at baseband.
-
- See generic_demod block for list of parameters.
- """
- constellation_points = _def_constellation_points
- constellation = digital_swig.constellation_dqpsk()
- if constellation_points != 4:
- raise ValueError('Number of constellation points must be 4 for DQPSK.')
- super(dqpsk_demod, self).__init__(constellation=constellation,
- differential=True,
+class dqpsk_demod(qpsk_demod):
+ """
+ Hierarchical block for RRC-filtered DQPSK modulation.
+
+ The input is a byte stream (unsigned char) and the
+ output is the complex modulated signal at baseband.
+
+ Args:
+ mod_code: Whether to use a gray_code (digital.mod_codes.GRAY_CODE) or not (digital.mod_codes.NO_CODE).
+ """
+ # See generic_mod for additional arguments
+ __doc__ += shared_demod_args
+
+ def __init__(self, mod_code=_def_mod_code, *args, **kwargs):
+ super(dqpsk_demod, self).__init__(mod_code,
*args, **kwargs)
#
@@ -173,4 +183,3 @@ modulation_utils.add_type_1_constellation('qpsk', qpsk_constellation)
modulation_utils.add_type_1_mod('dqpsk', dqpsk_mod)
modulation_utils.add_type_1_demod('dqpsk', dqpsk_demod)
modulation_utils.add_type_1_constellation('dqpsk', dqpsk_constellation)
-
diff --git a/gr-digital/python/utils/mod_codes.py b/gr-digital/python/utils/mod_codes.py
index caacda5cc6..f55fe41b8b 100644
--- a/gr-digital/python/utils/mod_codes.py
+++ b/gr-digital/python/utils/mod_codes.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+# Constants used to represent what coding to use.
GRAY_CODE = 'gray'
SET_PARTITION_CODE = 'set-partition'
NO_CODE = 'none'
diff --git a/gr-digital/python/utils/tagged_streams.py b/gr-digital/python/utils/tagged_streams.py
index 7e69aa20be..6a956aa642 100644
--- a/gr-digital/python/utils/tagged_streams.py
+++ b/gr-digital/python/utils/tagged_streams.py
@@ -8,8 +8,8 @@ def make_lengthtags(lengths, offsets, tagname='length', vlen=1):
for offset, length in zip(offsets, lengths):
tag = gr.gr_tag_t()
tag.offset = offset/vlen
- tag.key = pmt.pmt_string_to_symbol(tagname)
- tag.value = pmt.pmt_from_long(length/vlen)
+ tag.key = pmt.string_to_symbol(tagname)
+ tag.value = pmt.from_long(length/vlen)
tags.append(tag)
return tags
@@ -35,14 +35,14 @@ def vectors_to_strings(data, tags, lengthtagname):
def count_bursts(data, tags, lengthtagname, vlen=1):
lengthtags = [t for t in tags
- if pmt.pmt_symbol_to_string(t.key) == lengthtagname]
+ if pmt.symbol_to_string(t.key) == lengthtagname]
lengths = {}
for tag in lengthtags:
if tag.offset in lengths:
raise ValueError(
"More than one tags with key {0} with the same offset={1}."
.format(lengthtagname, tag.offset))
- lengths[tag.offset] = pmt.pmt_to_long(tag.value)*vlen
+ lengths[tag.offset] = pmt.to_long(tag.value)*vlen
in_burst = False
in_packet = False
packet_length = None
@@ -70,14 +70,14 @@ def count_bursts(data, tags, lengthtagname, vlen=1):
def vectors_to_packets(data, tags, lengthtagname, vlen=1):
lengthtags = [t for t in tags
- if pmt.pmt_symbol_to_string(t.key) == lengthtagname]
+ if pmt.symbol_to_string(t.key) == lengthtagname]
lengths = {}
for tag in lengthtags:
if tag.offset in lengths:
raise ValueError(
"More than one tags with key {0} with the same offset={1}."
.format(lengthtagname, tag.offset))
- lengths[tag.offset] = pmt.pmt_to_long(tag.value)*vlen
+ lengths[tag.offset] = pmt.to_long(tag.value)*vlen
if 0 not in lengths:
raise ValueError("There is no tag with key {0} and an offset of 0"
.format(lengthtagname))
@@ -105,8 +105,8 @@ def packets_to_vectors(packets, lengthtagname, vlen=1):
data.extend(packet)
tag = gr.gr_tag_t()
tag.offset = offset/vlen
- tag.key = pmt.pmt_string_to_symbol(lengthtagname)
- tag.value = pmt.pmt_from_long(len(packet)/vlen)
+ tag.key = pmt.string_to_symbol(lengthtagname)
+ tag.value = pmt.from_long(len(packet)/vlen)
tags.append(tag)
offset = offset + len(packet)
return data, tags
diff --git a/gr-digital/swig/CMakeLists.txt b/gr-digital/swig/CMakeLists.txt
index 5e693af896..0db5140429 100644
--- a/gr-digital/swig/CMakeLists.txt
+++ b/gr-digital/swig/CMakeLists.txt
@@ -18,110 +18,37 @@
# Boston, MA 02110-1301, USA.
########################################################################
-# generate helper scripts to expand templated files
-########################################################################
-include(GrPython)
-file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py "
-#!${PYTHON_EXECUTABLE}
-
-import sys, os, re
-sys.path.append('${GR_CORE_PYTHONPATH}')
-os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}'
-os.chdir('${CMAKE_CURRENT_BINARY_DIR}')
-
-if __name__ == '__main__':
- import build_utils
- root, inp = sys.argv[1:3]
- for sig in sys.argv[3:]:
- name = re.sub ('X+', sig, root)
- d = build_utils.standard_dict(name, sig, 'digital')
- build_utils.expand_template(d, inp)
-
-")
-
-macro(expand_i root)
- # make a list of the .i generated files
- unset(expanded_files_i)
- foreach(sig ${ARGN})
- string(REGEX REPLACE "X+" ${sig} name ${root})
- list(APPEND expanded_files_i ${CMAKE_CURRENT_BINARY_DIR}/${name}.i)
- endforeach(sig)
-
- #create a command to generate the .i files
- add_custom_command(
- OUTPUT ${expanded_files_i}
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.i.t
- COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B}
- ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
- ${root} ${root}.i.t ${ARGN}
- )
-
- # Lists of generated i files
- list(APPEND generated_swigs ${expanded_files_i})
-endmacro(expand_i)
-
-
-########################################################################
-# Invoke macro to generate various sources
-########################################################################
-expand_i(digital_chunks_to_symbols_XX bf bc sf sc if ic)
-
-add_custom_target(digital_generated_swigs DEPENDS
- ${generated_swigs}
-)
-
-########################################################################
# Setup swig generation
########################################################################
+include(GrPython)
include(GrSwig)
-########################################################################
-# Create the master gengen swig include files
-########################################################################
-set(generated_index ${CMAKE_CURRENT_BINARY_DIR}/digital_generated.i.in)
-file(WRITE ${generated_index} "
-//
-// This file is machine generated. All edits will be overwritten
-//
-")
-
-file(APPEND ${generated_index} "%include \"gnuradio.i\"\n\n")
-file(APPEND ${generated_index} "%{\n")
-
-foreach(swig_file ${generated_swigs})
- get_filename_component(name ${swig_file} NAME_WE)
- file(APPEND ${generated_index} "#include<${name}.h>\n")
-endforeach(swig_file)
-file(APPEND ${generated_index} "%}\n")
-
-foreach(swig_file ${generated_swigs})
- get_filename_component(name ${swig_file} NAME)
- file(APPEND ${generated_index} "%include<${name}>\n")
-endforeach(swig_file)
-
-execute_process(
- COMMAND ${CMAKE_COMMAND} -E copy_if_different
- ${generated_index} ${CMAKE_CURRENT_BINARY_DIR}/digital_generated.i
-)
-
set(GR_SWIG_INCLUDE_DIRS
- ${CMAKE_CURRENT_BINARY_DIR}
- ${CMAKE_CURRENT_BINARY_DIR}/../include
${GR_DIGITAL_INCLUDE_DIRS}
+ ${GR_BLOCKS_INCLUDE_DIRS}
${GR_ANALOG_INCLUDE_DIRS}
+ ${GR_FFT_INCLUDE_DIRS}
+ ${GR_FILTER_INCLUDE_DIRS}
${GNURADIO_CORE_SWIG_INCLUDE_DIRS}
${GRUEL_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
)
+if(ENABLE_GR_CTRLPORT)
+ ADD_DEFINITIONS(-DGR_CTRLPORT)
+ list(APPEND GR_SWIG_INCLUDE_DIRS ${ICE_INCLUDE_DIR})
+endif(ENABLE_GR_CTRLPORT)
+
# Setup swig docs to depend on includes and pull in from build directory
-set(GR_SWIG_LIBRARIES gnuradio-digital)
set(GR_SWIG_TARGET_DEPS digital_generated_includes)
set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/digital_swig_doc.i)
-set(GR_SWIG_DOC_DIRS
- ${CMAKE_CURRENT_SOURCE_DIR}/../include
- ${CMAKE_CURRENT_BINARY_DIR}/../include)
+set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../lib)
+
+set(GR_SWIG_LIBRARIES gnuradio-digital
+ gnuradio-filter gnuradio-analog gnuradio-blocks)
+
GR_SWIG_MAKE(digital_swig digital_swig.i)
+
GR_SWIG_INSTALL(
TARGETS digital_swig
DESTINATION ${GR_PYTHON_DIR}/gnuradio/digital
@@ -131,52 +58,16 @@ GR_SWIG_INSTALL(
install(
FILES
digital_swig.i
+ constellation.i
+ digital_crc32_bb.i
+ digital_ofdm_carrier_allocator_cvc.i
+ digital_ofdm_chanest_vcvc.i
+ digital_ofdm_equalizer_base.i
+ digital_ofdm_equalizer_simpledfe.i
+ digital_ofdm_equalizer_static.i
+ digital_ofdm_sync_sc_cfb.i
+ packet_header.i
${CMAKE_CURRENT_BINARY_DIR}/digital_swig_doc.i
- ${CMAKE_CURRENT_BINARY_DIR}/digital_generated.i
- ${generated_swigs}
- digital_additive_scrambler_bb.i
- digital_binary_slicer_fb.i
- digital_bytes_to_syms.i
- digital_clock_recovery_mm_cc.i
- digital_clock_recovery_mm_ff.i
- digital_cma_equalizer_cc.i
- digital_constellation.i
- digital_constellation_receiver_cb.i
- digital_constellation_decoder_cb.i
- digital_correlate_access_code_bb.i
- digital_correlate_access_code_tag_bb.i
- digital_costas_loop_cc.i
- digital_cpmmod_bc.i
- digital_crc32.i
- digital_descrambler_bb.i
- digital_diff_decoder_bb.i
- digital_diff_encoder_bb.i
- digital_diff_phasor_cc.i
- digital_fll_band_edge_cc.i
- digital_framer_sink_1.i
- digital_glfsr_source_b.i
- digital_glfsr_source_f.i
- digital_gmskmod_bc.i
- digital_lms_dd_equalizer_cc.i
- digital_kurtotic_equalizer_cc.i
- digital_map_bb.i
- digital_mpsk_receiver_cc.i
- digital_mpsk_snr_est_cc.i
- digital_ofdm_frame_acquisition.i
- digital_ofdm_cyclic_prefixer.i
- digital_ofdm_frame_sink.i
- digital_ofdm_insert_preamble.i
- digital_ofdm_mapper_bcv.i
- digital_ofdm_sampler.i
- digital_packet_sink.i
- digital_pfb_clock_sync_ccf.i
- digital_pfb_clock_sync_fff.i
- digital_pn_correlator_cc.i
- digital_probe_density_b.i
- digital_probe_mpsk_snr_est_c.i
- digital_scrambler_bb.i
- digital_simple_framer.i
- digital_simple_correlator.i
DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig
COMPONENT "digital_swig"
)
diff --git a/gr-digital/swig/_digital_hier.i b/gr-digital/swig/_digital_hier.i
deleted file mode 100644
index 022e38644b..0000000000
--- a/gr-digital/swig/_digital_hier.i
+++ /dev/null
@@ -1,33 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-%{
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <digital_cpmmod_bc.h>
-#include <digital_gmskmod_bc.h>
-%}
-
-%include "digital_cpmmod_bc.i"
-%include "digital_gmskmod_bc.i"
diff --git a/gr-digital/swig/constellation.i b/gr-digital/swig/constellation.i
new file mode 100644
index 0000000000..7ff2d63c30
--- /dev/null
+++ b/gr-digital/swig/constellation.i
@@ -0,0 +1,71 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2010-2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+%template(constellation_sptr) boost::shared_ptr<gr::digital::constellation>;
+
+%template(constellation_calcdist_sptr) boost::shared_ptr<gr::digital::constellation_calcdist>;
+%pythoncode %{
+constellation_calcdist_sptr.__repr__ = lambda self: "<constellation calcdist (m=%d)>" % (len(self.points()))
+constellation_calcdist = constellation_calcdist.make;
+%}
+
+%template(constellation_rect_sptr) boost::shared_ptr<gr::digital::constellation_rect>;
+%pythoncode %{
+constellation_rect_sptr.__repr__ = lambda self: "<constellation rect (m=%d)>" % (len(self.points()))
+constellation_rect = constellation_rect.make;
+%}
+
+%template(constellation_expl_rect_sptr) boost::shared_ptr<gr::digital::constellation_expl_rect>;
+%pythoncode %{
+constellation_expl_rect_sptr.__repr__ = lambda self: "<constellation expl rect (m=%d)>" % (len(self.points()))
+constellation_expl_rect = constellation_expl_rect.make;
+%}
+
+%template(constellation_psk_sptr) boost::shared_ptr<gr::digital::constellation_psk>;
+%pythoncode %{
+constellation_psk_sptr.__repr__ = lambda self: "<constellation PSK (m=%d)>" % (len(self.points()))
+constellation_psk = constellation_psk.make;
+%}
+
+%template(constellation_bpsk_sptr) boost::shared_ptr<gr::digital::constellation_bpsk>;
+%pythoncode %{
+constellation_bpsk_sptr.__repr__ = lambda self: "<constellation BPSK>"
+constellation_bpsk = constellation_bpsk.make;
+%}
+
+%template(constellation_qpsk_sptr) boost::shared_ptr<gr::digital::constellation_qpsk>;
+%pythoncode %{
+constellation_qpsk_sptr.__repr__ = lambda self: "<constellation QPSK>"
+constellation_qpsk = constellation_qpsk.make;
+%}
+
+%template(constellation_dqpsk_sptr) boost::shared_ptr<gr::digital::constellation_dqpsk>;
+%pythoncode %{
+constellation_dqpsk_sptr.__repr__ = lambda self: "<constellation DQPSK>"
+constellation_dqpsk = constellation_dqpsk.make;
+%}
+
+%template(constellation_8psk_sptr) boost::shared_ptr<gr::digital::constellation_8psk>;
+%pythoncode %{
+constellation_8psk_sptr.__repr__ = lambda self: "<constellation 8PSK>"
+constellation_8psk = constellation_8psk.make;
+%}
diff --git a/gr-digital/swig/digital_additive_scrambler_bb.i b/gr-digital/swig/digital_additive_scrambler_bb.i
deleted file mode 100644
index b063f06725..0000000000
--- a/gr-digital/swig/digital_additive_scrambler_bb.i
+++ /dev/null
@@ -1,31 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2008,2010,2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-GR_SWIG_BLOCK_MAGIC(digital,additive_scrambler_bb);
-
-digital_additive_scrambler_bb_sptr
-digital_make_additive_scrambler_bb(int mask, int seed,
- int len, int count=0);
-
-class digital_additive_scrambler_bb : public gr_sync_block
-{
-};
diff --git a/gr-digital/swig/digital_binary_slicer_fb.i b/gr-digital/swig/digital_binary_slicer_fb.i
deleted file mode 100644
index 30603748b3..0000000000
--- a/gr-digital/swig/digital_binary_slicer_fb.i
+++ /dev/null
@@ -1,33 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2006,2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-GR_SWIG_BLOCK_MAGIC(digital,binary_slicer_fb);
-
-digital_binary_slicer_fb_sptr digital_make_binary_slicer_fb ();
-
-class digital_binary_slicer_fb : public gr_sync_block
-{
- private:
- digital_binary_slicer_fb ();
-
- public:
-};
diff --git a/gr-digital/swig/digital_bytes_to_syms.i b/gr-digital/swig/digital_bytes_to_syms.i
deleted file mode 100644
index cf23f035c4..0000000000
--- a/gr-digital/swig/digital_bytes_to_syms.i
+++ /dev/null
@@ -1,29 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-GR_SWIG_BLOCK_MAGIC(digital,bytes_to_syms);
-
-digital_bytes_to_syms_sptr digital_make_bytes_to_syms();
-
-class digital_bytes_to_syms : public gr_sync_interpolator
-{
-};
diff --git a/gr-digital/swig/digital_clock_recovery_mm_cc.i b/gr-digital/swig/digital_clock_recovery_mm_cc.i
deleted file mode 100644
index 4ce9a9725d..0000000000
--- a/gr-digital/swig/digital_clock_recovery_mm_cc.i
+++ /dev/null
@@ -1,51 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-GR_SWIG_BLOCK_MAGIC(digital,clock_recovery_mm_cc);
-
-digital_clock_recovery_mm_cc_sptr
-digital_make_clock_recovery_mm_cc (float omega, float gain_omega,
- float mu, float gain_mu,
- float omega_relative_limit) throw(std::exception);
-
-class digital_clock_recovery_mm_cc : public gr_sync_block
-{
- private:
- digital_clock_recovery_mm_cc (float omega, float gain_omega,
- float mu, float gain_mu,
- float omega_relative_limit);
-
-public:
- float mu() const { return d_mu;}
- float omega() const { return d_omega;}
- float gain_mu() const { return d_gain_mu;}
- float gain_omega() const { return d_gain_omega;}
-
- void set_gain_mu (float gain_mu) { d_gain_mu = gain_mu; }
- void set_gain_omega (float gain_omega) { d_gain_omega = gain_omega; }
- void set_mu (float omega) { d_mu = mu; }
- void set_omega (float omega) { d_omega = omega;
- d_min_omega = omega*(1.0 - d_omega_relative_limit);
- d_max_omega = omega*(1.0 + d_omega_relative_limit);
- }
- void set_verbose (bool verbose) { d_verbose = verbose; }
-};
diff --git a/gr-digital/swig/digital_clock_recovery_mm_ff.i b/gr-digital/swig/digital_clock_recovery_mm_ff.i
deleted file mode 100644
index 054ef9ebfe..0000000000
--- a/gr-digital/swig/digital_clock_recovery_mm_ff.i
+++ /dev/null
@@ -1,47 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-GR_SWIG_BLOCK_MAGIC(digital,clock_recovery_mm_ff);
-
-digital_clock_recovery_mm_ff_sptr
-digital_make_clock_recovery_mm_ff (float omega, float gain_omega,
- float mu, float gain_mu,
- float omega_relative_limit=0.001) throw(std::exception);
-
-class digital_clock_recovery_mm_ff : public gr_sync_block
-{
- private:
- digital_clock_recovery_mm_ff (float omega, float gain_omega,
- float mu, float gain_mu,
- float omega_relative_limit);
-
-public:
- float mu() const;
- float omega() const;
- float gain_mu() const;
- float gain_omega() const;
-
- void set_gain_mu (float gain_mu);
- void set_gain_omega (float gain_omega);
- void set_mu (float omega);
- void set_omega (float omega);
-};
diff --git a/gr-digital/swig/digital_cma_equalizer_cc.i b/gr-digital/swig/digital_cma_equalizer_cc.i
deleted file mode 100644
index 183e43ef94..0000000000
--- a/gr-digital/swig/digital_cma_equalizer_cc.i
+++ /dev/null
@@ -1,44 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-GR_SWIG_BLOCK_MAGIC(digital,cma_equalizer_cc)
-
-// retrieve info on the base class, without generating wrappers since
-// the base class has a pure virual method.
-%import "gr_adaptive_fir_ccc.i"
-
-digital_cma_equalizer_cc_sptr
-digital_make_cma_equalizer_cc(int num_taps, float modulus,
- float mu, int sps);
-
-class digital_cma_equalizer_cc : public gr_adaptive_fir_ccc
-{
-private:
- digital_cma_equalizer_cc(int num_taps, float modulus,
- float mu, int sps);
-
-public:
- float get_gain();
- void set_gain(float mu);
- float get_modulus();
- void set_modulus(float mod);
-};
diff --git a/gr-digital/swig/digital_constellation.i b/gr-digital/swig/digital_constellation.i
deleted file mode 100644
index 4c4f8aa01d..0000000000
--- a/gr-digital/swig/digital_constellation.i
+++ /dev/null
@@ -1,236 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2010,2011,2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-%template(gr_complex_vector) std::vector<gr_complex>;
-%template(unsigned_int_vector) std::vector<unsigned int>;
-
-// Make sure metric types get SWIGed.
-%include "digital_metric_type.h"
-
-class digital_constellation;
-typedef boost::shared_ptr<digital_constellation> digital_constellation_sptr;
-%template(digital_constellation_sptr) boost::shared_ptr<digital_constellation>;
-
-class digital_constellation
-{
-public:
- digital_constellation (std::vector<gr_complex> constellation,
- std::vector<unsigned int> pre_diff_code,
- unsigned int rotational_symmetry,
- unsigned int dimensionality);
- std::vector<gr_complex> points();
- std::vector<gr_complex> s_points();
- std::vector<std::vector<gr_complex> > v_points();
- virtual unsigned int decision_maker (gr_complex *sample) = 0;
- unsigned int decision_maker_v (std::vector<gr_complex> sample);
- // void calc_metric(gr_complex *sample, float *metric, trellis_metric_type_t type);
- // void calc_euclidean_metric(gr_complex *sample, float *metric);
- // void calc_hard_symbol_metric(gr_complex *sample, float *metric);
- std::vector<gr_complex> map_to_points_v(unsigned int value);
- unsigned int bits_per_symbol ();
- unsigned int arity ();
- digital_constellation_sptr base ();
- bool apply_pre_diff_code();
- void set_pre_diff_code(bool a);
- std::vector<unsigned int> pre_diff_code();
- unsigned int rotational_symmetry();
- unsigned int dimensionality();
-};
-
-class digital_constellation_calcdist;
-typedef boost::shared_ptr<digital_constellation_calcdist> digital_constellation_calcdist_sptr;
-%template(digital_constellation_calcdist_sptr) boost::shared_ptr<digital_constellation_calcdist>;
-%rename(constellation_calcdist) digital_make_constellation_calcdist;
-digital_constellation_calcdist_sptr
-digital_make_constellation_calcdist(std::vector<gr_complex> constellation,
- std::vector<unsigned int> pre_diff_code,
- unsigned int rotational_symmetry,
- unsigned int dimensionality);
-%ignore digital_constellation_calcdist;
-
-class digital_constellation_calcdist: public digital_constellation
-{
- public:
- digital_constellation_calcdist (std::vector<gr_complex> constellation,
- std::vector<unsigned int> pre_diff_code,
- unsigned int rotational_symmetry,
- unsigned int dimensionality);
- unsigned int decision_maker (const gr_complex *sample);
-};
-
-class digital_constellation_sector: public digital_constellation
-{
-};
-
-class digital_constellation_rect;
-typedef boost::shared_ptr<digital_constellation_rect> digital_constellation_rect_sptr;
-%template(digital_constellation_rect_sptr) boost::shared_ptr<digital_constellation_rect>;
-%rename(constellation_rect) digital_make_constellation_rect;
-digital_constellation_rect_sptr digital_make_constellation_rect(std::vector<gr_complex> constellation,
- std::vector<unsigned int> pre_diff_code,
- unsigned int rotational_symmetry,
- unsigned int real_sectors, unsigned int imag_sectors,
- float width_real_sectors, float width_imag_sectors);
-%ignore digital_constellation_rect;
-
-class digital_constellation_rect : public digital_constellation_sector
-{
-public:
- digital_constellation_rect (std::vector<gr_complex> constellation,
- std::vector<unsigned int> pre_diff_code,
- unsigned int rotational_symmetry,
- unsigned int real_sectors, unsigned int imag_sectors,
- float width_real_sectors, float width_imag_sectors);
-};
-
-class digital_constellation_expl_rect;
-typedef boost::shared_ptr<digital_constellation_expl_rect> digital_constellation_expl_rect_sptr;
-%template(digital_constellation_expl_rect_sptr) boost::shared_ptr<digital_constellation_expl_rect>;
-%rename(constellation_expl_rect) digital_make_constellation_expl_rect;
-digital_constellation_expl_rect_sptr digital_make_constellation_expl_rect(
- std::vector<gr_complex> constellation,
- std::vector<unsigned int> pre_diff_code,
- unsigned int rotational_symmetry,
- unsigned int real_sectors, unsigned int imag_sectors,
- float width_real_sectors, float width_imag_sectors,
- std::vector<unsigned int> sector_values
-);
-%ignore digital_constellation_expl_rect;
-
-class digital_constellation_expl_rect : public digital_constellation_rect
-{
-public:
- digital_constellation_expl_rect (
- std::vector<gr_complex> constellation,
- std::vector<unsigned int> pre_diff_code,
- unsigned int rotational_symmetry,
- unsigned int real_sectors, unsigned int imag_sectors,
- float width_real_sectors, float width_imag_sectors,
- std::vector<unsigned int> sector_values
- );
-};
-
-class digital_constellation_psk;
-typedef boost::shared_ptr<digital_constellation_psk> digital_constellation_psk_sptr;
-%template(digital_constellation_psk_sptr) boost::shared_ptr<digital_constellation_psk>;
-%rename(constellation_psk) digital_make_constellation_psk;
-digital_constellation_psk_sptr digital_make_constellation_psk(std::vector<gr_complex> constellation,
- std::vector<unsigned int> pre_diff_code,
- unsigned int n_sectors);
-%ignore digital_constellation_psk;
-
-class digital_constellation_psk : public digital_constellation_sector
-{
-public:
- digital_constellation_psk (std::vector<gr_complex> constellation,
- std::vector<unsigned int> pre_diff_code,
- unsigned int n_sectors);
-};
-
-/*
- BPSK Constellation
-*/
-
-class digital_constellation_bpsk;
-typedef boost::shared_ptr<digital_constellation_bpsk> digital_constellation_bpsk_sptr;
-%template(digital_constellation_bpsk_sptr) boost::shared_ptr<digital_constellation_bpsk>;
-%rename(constellation_bpsk) digital_make_constellation_bpsk;
-digital_constellation_bpsk_sptr digital_make_constellation_bpsk();
-%ignore digital_constellation_bpsk;
-
-class digital_constellation_bpsk : public digital_constellation
-{
-public:
- digital_constellation_bpsk ();
-};
-
-/*
- QPSK Constellation
-*/
-
-class digital_constellation_qpsk;
-typedef boost::shared_ptr<digital_constellation_qpsk> digital_constellation_qpsk_sptr;
-%template(digital_constellation_qpsk_sptr) boost::shared_ptr<digital_constellation_qpsk>;
-%rename(constellation_qpsk) digital_make_constellation_qpsk;
-digital_constellation_qpsk_sptr digital_make_constellation_qpsk();
-%ignore digital_constellation_qpsk;
-
-class digital_constellation_qpsk : public digital_constellation
-{
-public:
- digital_constellation_qpsk ();
-};
-
-/*
- DQPSK Constellation
-*/
-
-class digital_constellation_dqpsk;
-typedef boost::shared_ptr<digital_constellation_dqpsk> digital_constellation_dqpsk_sptr;
-%template(digital_constellation_dqpsk_sptr) boost::shared_ptr<digital_constellation_dqpsk>;
-%rename(constellation_dqpsk) digital_make_constellation_dqpsk;
-digital_constellation_dqpsk_sptr digital_make_constellation_dqpsk();
-%ignore digital_constellation_dqpsk;
-
-class digital_constellation_dqpsk : public digital_constellation
-{
-public:
- digital_constellation_dqpsk ();
-};
-
-
-/*
- 8PSK Constellation
-*/
-
-class digital_constellation_8psk;
-typedef boost::shared_ptr<digital_constellation_8psk> digital_constellation_8psk_sptr;
-%template(digital_constellation_8psk_sptr) boost::shared_ptr<digital_constellation_8psk>;
-%rename(constellation_8psk) digital_make_constellation_8psk;
-digital_constellation_8psk_sptr digital_make_constellation_8psk();
-%ignore digital_constellation_8psk;
-
-class digital_constellation_8psk : public digital_constellation
-{
-public:
- digital_constellation_8psk ();
-};
-
-#if SWIGPYTHON
-/*
- We want print(constellation) in python to produce nice useful output so
- we include code at the end of the generated python file that overrides
- the SWIG-generated __repr__ method.
- */
-%pythoncode %{
-
-digital_constellation_calcdist_sptr.__repr__ = lambda self: '<constellation calcdist (m=%s)>' % str(len(self.points()))
-digital_constellation_rect_sptr.__repr__ = lambda self: '<constellation rect (m=%s)>' % str(len(self.points()))
-digital_constellation_expl_rect_sptr.__repr__ = lambda self: '<constellation expl_rect (m=%s)>' % str(len(self.points()))
-digital_constellation_psk_sptr.__repr__ = lambda self: '<constellation psk (m=%s)>' % str(len(self.points()))
-digital_constellation_bpsk_sptr.__repr__ = lambda self: '<constellation bpsk>'
-digital_constellation_qpsk_sptr.__repr__ = lambda self: '<constellation qpsk>'
-digital_constellation_dqpsk_sptr.__repr__ = lambda self: '<constellation dqpsk>'
-digital_constellation_8psk_sptr.__repr__ = lambda self: '<constellation 8psk>'
-
-%}
-#endif
diff --git a/gr-digital/swig/digital_constellation_decoder_cb.i b/gr-digital/swig/digital_constellation_decoder_cb.i
deleted file mode 100644
index 547f57ee6a..0000000000
--- a/gr-digital/swig/digital_constellation_decoder_cb.i
+++ /dev/null
@@ -1,38 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2006, 2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-GR_SWIG_BLOCK_MAGIC(digital,constellation_decoder_cb)
-
-digital_constellation_decoder_cb_sptr
-digital_make_constellation_decoder_cb (digital_constellation_sptr constellation);
-
-class digital_constellation_decoder_cb : public gr_sync_block
-{
- private:
- digital_constellation_decoder_cb (digital_constellation_sptr constellation);
-
- friend digital_constellation_decoder_cb_sptr
- digital_make_constellation_decoder_cb (digital_constellation_sptr constellation);
-
- public:
- ~digital_constellation_decoder_cb();
-};
diff --git a/gr-digital/swig/digital_constellation_receiver_cb.i b/gr-digital/swig/digital_constellation_receiver_cb.i
deleted file mode 100644
index 9c4ba645e0..0000000000
--- a/gr-digital/swig/digital_constellation_receiver_cb.i
+++ /dev/null
@@ -1,36 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-GR_SWIG_BLOCK_MAGIC(digital,constellation_receiver_cb);
-
-%include "digital_constellation.i"
-
-digital_constellation_receiver_cb_sptr
-digital_make_constellation_receiver_cb (digital_constellation_sptr constellation,
- float loop_bw, float fmin, float fmax);
-
-class digital_constellation_receiver_cb : public gr_block, public gri_control_loop
-{
- private:
- digital_constellation_receiver_cb (digital_contellation_sptr constellation,
- float loop_bw, float fmin, float fmax);
-};
diff --git a/gr-digital/swig/digital_correlate_access_code_bb.i b/gr-digital/swig/digital_correlate_access_code_bb.i
deleted file mode 100644
index 01087b8e93..0000000000
--- a/gr-digital/swig/digital_correlate_access_code_bb.i
+++ /dev/null
@@ -1,60 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2006,2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-GR_SWIG_BLOCK_MAGIC(digital,correlate_access_code_bb);
-
-/*!
- * \param access_code is represented with 1 byte per bit, e.g., "010101010111000100"
- * \param threshold maximum number of bits that may be wrong
- */
-digital_correlate_access_code_bb_sptr
-digital_make_correlate_access_code_bb (const std::string &access_code, int threshold)
- throw(std::out_of_range);
-
-/*!
- * \brief Examine input for specified access code, one bit at a time.
- * \ingroup block
- *
- * input: stream of bits, 1 bit per input byte (data in LSB)
- * output: stream of bits, 2 bits per output byte (data in LSB, flag in next higher bit)
- *
- * Each output byte contains two valid bits, the data bit, and the
- * flag bit. The LSB (bit 0) is the data bit, and is the original
- * input data, delayed 64 bits. Bit 1 is the
- * flag bit and is 1 if the corresponding data bit is the first data
- * bit following the access code. Otherwise the flag bit is 0.
- */
-class digital_correlate_access_code_bb : public gr_sync_block
-{
- friend digital_correlate_access_code_bb_sptr
- digital_make_correlate_access_code_bb (const std::string &access_code, int threshold);
- protected:
- digital_correlate_access_code_bb(const std::string &access_code, int threshold);
-
- public:
- ~digital_correlate_access_code_bb();
-
- /*!
- * \param access_code is represented with 1 byte per bit, e.g., "010101010111000100"
- */
- bool set_access_code (const std::string &access_code);
-};
diff --git a/gr-digital/swig/digital_correlate_access_code_tag_bb.i b/gr-digital/swig/digital_correlate_access_code_tag_bb.i
deleted file mode 100644
index 03f20148a1..0000000000
--- a/gr-digital/swig/digital_correlate_access_code_tag_bb.i
+++ /dev/null
@@ -1,35 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2006,2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-GR_SWIG_BLOCK_MAGIC(digital,correlate_access_code_tag_bb);
-
-digital_correlate_access_code_tag_bb_sptr
-digital_make_correlate_access_code_tag_bb(const std::string &access_code,
- int threshold,
- const std::string &tag_name)
- throw(std::out_of_range);
-
-class digital_correlate_access_code_tag_bb : public gr_sync_block
-{
- public:
- bool set_access_code(const std::string &access_code);
-};
diff --git a/gr-digital/swig/digital_costas_loop_cc.i b/gr-digital/swig/digital_costas_loop_cc.i
deleted file mode 100644
index ab09200a0a..0000000000
--- a/gr-digital/swig/digital_costas_loop_cc.i
+++ /dev/null
@@ -1,33 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2005,2006,2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-GR_SWIG_BLOCK_MAGIC(digital,costas_loop_cc);
-
-digital_costas_loop_cc_sptr
-digital_make_costas_loop_cc (float loop_bw, int order
- ) throw (std::invalid_argument);
-
-class digital_costas_loop_cc : public gr_sync_block, public gri_control_loop
-{
- private:
- digital_costas_loop_cc (float loop_bw, int order);
-};
diff --git a/gr-digital/swig/digital_cpmmod_bc.i b/gr-digital/swig/digital_cpmmod_bc.i
deleted file mode 100644
index fa7c50da75..0000000000
--- a/gr-digital/swig/digital_cpmmod_bc.i
+++ /dev/null
@@ -1,40 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2010 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-GR_SWIG_BLOCK_MAGIC(digital, cpmmod_bc)
-
-digital_cpmmod_bc_sptr
-digital_make_cpmmod_bc(int type, float h,
- unsigned samples_per_sym,
- unsigned L, double beta=0.3);
-
-class digital_cpmmod_bc : public gr_hier_block2
-{
- private:
- digital_cpmmod_bc(int type, float h,
- unsigned samples_per_sym,
- unsigned L, double beta);
-
- public:
- std::vector<float> get_taps();
-};
-
diff --git a/gr-digital/swig/digital_crc32.i b/gr-digital/swig/digital_crc32.i
deleted file mode 100644
index 806bfad6a0..0000000000
--- a/gr-digital/swig/digital_crc32.i
+++ /dev/null
@@ -1,27 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2005,2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-%rename(update_crc32) digital_update_crc32;
-%rename(crc32) digital_crc32;
-
-unsigned int digital_update_crc32(unsigned int crc, const std::string buf);
-unsigned int digital_crc32(const std::string buf);
diff --git a/gr-digital/swig/digital_fll_band_edge_cc.i b/gr-digital/swig/digital_fll_band_edge_cc.i
deleted file mode 100644
index 3efcb89ed1..0000000000
--- a/gr-digital/swig/digital_fll_band_edge_cc.i
+++ /dev/null
@@ -1,60 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2009,2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-GR_SWIG_BLOCK_MAGIC(digital,fll_band_edge_cc);
-
-digital_fll_band_edge_cc_sptr digital_make_fll_band_edge_cc (float samps_per_sym,
- float rolloff,
- int filter_size,
- float bandwidth);
-
-class digital_fll_band_edge_cc : public gr_sync_block, public gri_control_loop
-{
- private:
- digital_fll_band_edge_cc (float samps_per_sym, float rolloff,
- int filter_size, float bandwidth);
-
- public:
- ~digital_fll_band_edge_cc ();
-
- void set_loop_bandwidth(float bw);
- void set_damping_factor(float df);
- void set_alpha(float alpha);
- void set_beta(float beta);
- void set_samples_per_symbol(float sps);
- void set_rolloff(float rolloff);
- void set_filter_size(int filter_size);
- void set_frequency(float freq);
- void set_phase(float phase);
-
- float get_loop_bandwidth() const;
- float get_damping_factor() const;
- float get_alpha() const;
- float get_beta() const;
- float get_samples_per_symbol() const;
- float get_rolloff() const;
- int get_filter_size() const;
- float get_frequency() const;
- float get_phase() const;
-
- void print_taps();
-};
diff --git a/gr-digital/swig/digital_framer_sink_1.i b/gr-digital/swig/digital_framer_sink_1.i
deleted file mode 100644
index a5c56560d3..0000000000
--- a/gr-digital/swig/digital_framer_sink_1.i
+++ /dev/null
@@ -1,30 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2006,2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-GR_SWIG_BLOCK_MAGIC(digital,framer_sink_1);
-
-digital_framer_sink_1_sptr
-digital_make_framer_sink_1(gr_msg_queue_sptr target_queue);
-
-class digital_framer_sink_1 : public gr_sync_block
-{
-};
diff --git a/gr-digital/swig/digital_glfsr_source_b.i b/gr-digital/swig/digital_glfsr_source_b.i
deleted file mode 100644
index b1c487209e..0000000000
--- a/gr-digital/swig/digital_glfsr_source_b.i
+++ /dev/null
@@ -1,35 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2007,2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-GR_SWIG_BLOCK_MAGIC(digital,glfsr_source_b);
-
-digital_glfsr_source_b_sptr
-digital_make_glfsr_source_b(int degree, bool repeat=true,
- int mask=0, int seed=1)
- throw (std::runtime_error);
-
-class digital_glfsr_source_b : public gr_sync_block
-{
-public:
- unsigned int period() const;
- int mask() const;
-};
diff --git a/gr-digital/swig/digital_gmskmod_bc.i b/gr-digital/swig/digital_gmskmod_bc.i
deleted file mode 100644
index ad7b82237e..0000000000
--- a/gr-digital/swig/digital_gmskmod_bc.i
+++ /dev/null
@@ -1,39 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2010 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-GR_SWIG_BLOCK_MAGIC(digital, gmskmod_bc)
-
-digital_gmskmod_bc_sptr
-digital_make_gmskmod_bc(unsigned samples_per_sym=2,
- double bt=0.3, unsigned L=4);
-
-class digital_gmskmod_bc : public gr_hier_block2
-{
- private:
- digital_cpmmod_bc(int type, float h,
- unsigned samples_per_sym,
- double beta, unsigned L);
-
- public:
- std::vector<float> get_taps();
-};
-
diff --git a/gr-digital/swig/digital_mpsk_receiver_cc.i b/gr-digital/swig/digital_mpsk_receiver_cc.i
deleted file mode 100644
index 2338a18547..0000000000
--- a/gr-digital/swig/digital_mpsk_receiver_cc.i
+++ /dev/null
@@ -1,57 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-GR_SWIG_BLOCK_MAGIC(digital,mpsk_receiver_cc);
-
-digital_mpsk_receiver_cc_sptr digital_make_mpsk_receiver_cc (unsigned int M, float theta,
- float loop_bw,
- float fmin, float fmax,
- float mu, float gain_mu,
- float omega, float gain_omega,
- float omega_rel);
-class digital_mpsk_receiver_cc : public gr_block, public gri_control_loop
-{
- private:
- digital_mpsk_receiver_cc (unsigned int M,float theta,
- float loop_bw,
- float fmin, float fmax,
- float mu, float gain_mu,
- float omega, float gain_omega, float omega_rel);
-public:
- float modulation_order() const { return d_M; }
- float mu() const { return d_mu;}
- float omega() const { return d_omega;}
- float gain_mu() const { return d_gain_mu;}
- float gain_omega() const { return d_gain_omega;}
- float gain_omega_rel() const {return d_omega_rel; }
- void set_modulation_order(unsigned int M);
- void set_mu (float mu) { d_mu = mu; }
- void set_omega (float omega) {
- d_omega = omega;
- d_min_omega = omega*(1.0 - d_omega_rel);
- d_max_omega = omega*(1.0 + d_omega_rel);
- }
- void set_theta(float theta) { d_theta = theta; }
- void set_gain_mu (float gain_mu) { d_gain_mu = gain_mu; }
- void set_gain_omega (float gain_omega) { d_gain_omega = gain_omega; }
- void set_gain_omega_rel(float omega_rel);
-};
diff --git a/gr-digital/swig/digital_mpsk_snr_est_cc.i b/gr-digital/swig/digital_mpsk_snr_est_cc.i
deleted file mode 100644
index f0ca13f874..0000000000
--- a/gr-digital/swig/digital_mpsk_snr_est_cc.i
+++ /dev/null
@@ -1,45 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-GR_SWIG_BLOCK_MAGIC(digital,mpsk_snr_est_cc);
-
-digital_mpsk_snr_est_cc_sptr
-digital_make_mpsk_snr_est_cc(snr_est_type_t type,
- int tag_nsamples=10000,
- double alpha=0.001);
-
-class digital_mpsk_snr_est_cc : public gr_sync_block
-{
-private:
- void digital_mpsk_snr_est_cc(snr_est_type_t type,
- int tag_nsamples,
- double alpha);
-
-public:
- double snr();
- snr_est_type_t type() const;
- int tag_nsample() const;
- double alpha() const;
- void set_type(snr_est_type_t t);
- void set_tag_nsample(int n);
- void set_alpha(double alpha);
-};
diff --git a/gr-digital/swig/digital_ofdm_equalizer_simpledfe.i b/gr-digital/swig/digital_ofdm_equalizer_simpledfe.i
index b9a26e246f..1ca31c1edd 100644
--- a/gr-digital/swig/digital_ofdm_equalizer_simpledfe.i
+++ b/gr-digital/swig/digital_ofdm_equalizer_simpledfe.i
@@ -27,7 +27,7 @@ typedef boost::shared_ptr<digital_ofdm_equalizer_simpledfe> digital_ofdm_equaliz
digital_ofdm_equalizer_simpledfe_sptr
digital_make_ofdm_equalizer_simpledfe(
int fft_len,
- const digital_constellation_sptr &constellation,
+ const gr::digital::constellation_sptr &constellation,
const std::vector<std::vector<int> > &occupied_carriers = std::vector<std::vector<int> >(),
const std::vector<std::vector<int> > &pilot_carriers = std::vector<std::vector<int> >(),
const std::vector<std::vector<gr_complex> > &pilot_symbols = std::vector<std::vector<gr_complex> >(),
diff --git a/gr-digital/swig/digital_ofdm_frame_acquisition.i b/gr-digital/swig/digital_ofdm_frame_acquisition.i
deleted file mode 100644
index b61297bdea..0000000000
--- a/gr-digital/swig/digital_ofdm_frame_acquisition.i
+++ /dev/null
@@ -1,49 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2006,2007,2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#include <vector>
-
-GR_SWIG_BLOCK_MAGIC(digital,ofdm_frame_acquisition);
-
-digital_ofdm_frame_acquisition_sptr
-digital_make_ofdm_frame_acquisition (unsigned int occupied_carriers,
- unsigned int fft_length,
- unsigned int cplen,
- const std::vector<gr_complex> &known_symbol,
- unsigned int max_fft_shift_len=4);
-
-class digital_ofdm_frame_acquisition : public gr_sync_decimator
-{
- protected:
- digital_ofdm_frame_acquisition (unsigned int occupied_carriers,
- unsigned int fft_length,
- unsigned int cplen,
- const std::vector<gr_complex> &known_symbol,
- unsigned int max_fft_shift_len);
-
- public:
- float snr() { return d_snr_est; }
- int general_work(int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
diff --git a/gr-digital/swig/digital_ofdm_frame_sink.i b/gr-digital/swig/digital_ofdm_frame_sink.i
deleted file mode 100644
index cd3fa14229..0000000000
--- a/gr-digital/swig/digital_ofdm_frame_sink.i
+++ /dev/null
@@ -1,41 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2007,2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-GR_SWIG_BLOCK_MAGIC(digital,ofdm_frame_sink);
-
-digital_ofdm_frame_sink_sptr
-digital_make_ofdm_frame_sink(const std::vector<gr_complex> &sym_position,
- const std::vector<unsigned char> &sym_value_out,
- gr_msg_queue_sptr target_queue, unsigned int occupied_tones,
- float phase_gain=0.25, float freq_gain=0.25*0.25/4);
-
-class digital_ofdm_frame_sink : public gr_sync_block
-{
- protected:
- digital_ofdm_frame_sink(const std::vector<gr_complex> &sym_position,
- const std::vector<unsigned char> &sym_value_out,
- gr_msg_queue_sptr target_queue, unsigned int occupied_tones,
- float phase_gain, float freq_gain);
-
- public:
- ~digital_ofdm_frame_sink();
-};
diff --git a/gr-digital/swig/digital_ofdm_insert_preamble.i b/gr-digital/swig/digital_ofdm_insert_preamble.i
deleted file mode 100644
index 0273c7fa75..0000000000
--- a/gr-digital/swig/digital_ofdm_insert_preamble.i
+++ /dev/null
@@ -1,37 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2007,2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-GR_SWIG_BLOCK_MAGIC(digital,ofdm_insert_preamble);
-
-digital_ofdm_insert_preamble_sptr
-digital_make_ofdm_insert_preamble(int fft_length,
- const std::vector<std::vector<gr_complex> > &preamble);
-
-
-class digital_ofdm_insert_preamble : public gr_block
-{
- protected:
- digital_ofdm_insert_preamble(int fft_length,
- const std::vector<std::vector<gr_complex> > &preamble);
- public:
- void enter_preamble();
-};
diff --git a/gr-digital/swig/digital_ofdm_mapper_bcv.i b/gr-digital/swig/digital_ofdm_mapper_bcv.i
deleted file mode 100644
index 4e9aaba7d7..0000000000
--- a/gr-digital/swig/digital_ofdm_mapper_bcv.i
+++ /dev/null
@@ -1,46 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2006,2007,2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-GR_SWIG_BLOCK_MAGIC(digital,ofdm_mapper_bcv);
-
-digital_ofdm_mapper_bcv_sptr
-digital_make_ofdm_mapper_bcv (const std::vector<gr_complex> &constellation,
- unsigned int msgq_limit,
- unsigned int bits_per_symbol,
- unsigned int fft_length) throw(std::exception);
-
-
-class digital_ofdm_mapper_bcv : public gr_sync_block
-{
- protected:
- digital_ofdm_mapper_bcv (const std::vector<gr_complex> &constellation,
- unsigned int msgq_limit,
- unsigned int bits_per_symbol,
- unsigned int fft_length);
-
- public:
- gr_msg_queue_sptr msgq();
-
- int work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
diff --git a/gr-digital/swig/digital_ofdm_sampler.i b/gr-digital/swig/digital_ofdm_sampler.i
deleted file mode 100644
index 91056c320b..0000000000
--- a/gr-digital/swig/digital_ofdm_sampler.i
+++ /dev/null
@@ -1,35 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2007,2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-GR_SWIG_BLOCK_MAGIC(digital,ofdm_sampler)
-
- digital_ofdm_sampler_sptr digital_make_ofdm_sampler (unsigned int fft_length,
- unsigned int symbol_length,
- unsigned int timeout=1000);
-
-class digital_ofdm_sampler : public gr_sync_block
-{
- private:
- digital_ofdm_sampler (unsigned int fft_length,
- unsigned int symbol_length,
- unsigned int timeout);
-};
diff --git a/gr-digital/swig/digital_packet_sink.i b/gr-digital/swig/digital_packet_sink.i
deleted file mode 100644
index 84f81f75cc..0000000000
--- a/gr-digital/swig/digital_packet_sink.i
+++ /dev/null
@@ -1,34 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-GR_SWIG_BLOCK_MAGIC(digital,packet_sink)
-
-digital_packet_sink_sptr
-digital_make_packet_sink(const std::vector<unsigned char>& sync_vector,
- gr_msg_queue_sptr target_queue,
- int threshold = -1); // -1 -> use default
-
-class digital_packet_sink : public gr_sync_block
-{
- public:
- bool carrier_sensed() const;
-};
diff --git a/gr-digital/swig/digital_pfb_clock_sync_ccf.i b/gr-digital/swig/digital_pfb_clock_sync_ccf.i
deleted file mode 100644
index dbba614cc1..0000000000
--- a/gr-digital/swig/digital_pfb_clock_sync_ccf.i
+++ /dev/null
@@ -1,58 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2009,2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-GR_SWIG_BLOCK_MAGIC(digital,pfb_clock_sync_ccf);
-
-digital_pfb_clock_sync_ccf_sptr
-digital_make_pfb_clock_sync_ccf(double sps, float loop_bw,
- const std::vector<float> &taps,
- unsigned int filter_size=32,
- float init_phase=0,
- float max_rate_deviation=1.5,
- int osps=1);
-
-class digital_pfb_clock_sync_ccf : public gr_block
-{
- public:
- void set_taps(const std::vector<float> &taps,
- std::vector< std::vector<float> > &ourtaps,
- std::vector<gr_fir_ccf*> &ourfilter);
-
- std::vector< std::vector<float> > get_taps();
- std::vector< std::vector<float> > get_diff_taps();
- std::vector<float> get_channel_taps(int channel);
- std::vector<float> get_diff_channel_taps(int channel);
- std::string get_taps_as_string();
- std::string get_diff_taps_as_string();
-
- void set_loop_bandwidth(float bw);
- void set_damping_factor(float df);
- void set_alpha(float alpha);
- void set_beta(float beta);
- void set_max_rate_deviation(float m);
-
- float get_loop_bandwidth() const;
- float get_damping_factor() const;
- float get_alpha() const;
- float get_beta() const;
- float get_clock_rate() const;
-};
diff --git a/gr-digital/swig/digital_pfb_clock_sync_fff.i b/gr-digital/swig/digital_pfb_clock_sync_fff.i
deleted file mode 100644
index 956495e5dd..0000000000
--- a/gr-digital/swig/digital_pfb_clock_sync_fff.i
+++ /dev/null
@@ -1,58 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2009,2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-GR_SWIG_BLOCK_MAGIC(digital,pfb_clock_sync_fff);
-
-digital_pfb_clock_sync_fff_sptr
-digital_make_pfb_clock_sync_fff(double sps, float loop_bw,
- const std::vector<float> &taps,
- unsigned int filter_size=32,
- float init_phase=0,
- float max_rate_deviation=1.5,
- int osps=1);
-
-class digital_pfb_clock_sync_fff : public gr_block
-{
- public:
- void set_taps (const std::vector<float> &taps,
- std::vector< std::vector<float> > &ourtaps,
- std::vector<gr_fir_fff*> &ourfilter);
-
- std::vector< std::vector<float> > get_taps();
- std::vector< std::vector<float> > get_diff_taps();
- std::vector<float> get_channel_taps(int channel);
- std::vector<float> get_diff_channel_taps(int channel);
- std::string get_taps_as_string();
- std::string get_diff_taps_as_string();
-
- void set_loop_bandwidth(float bw);
- void set_damping_factor(float df);
- void set_alpha(float alpha);
- void set_beta(float beta);
- void set_max_rate_deviation(float m);
-
- float get_loop_bandwidth() const;
- float get_damping_factor() const;
- float get_alpha() const;
- float get_beta() const;
- float get_clock_rate() const;
-};
diff --git a/gr-digital/swig/digital_probe_density_b.i b/gr-digital/swig/digital_probe_density_b.i
deleted file mode 100644
index b0c8a119ad..0000000000
--- a/gr-digital/swig/digital_probe_density_b.i
+++ /dev/null
@@ -1,33 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2008,2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-GR_SWIG_BLOCK_MAGIC(digital,probe_density_b);
-
-digital_probe_density_b_sptr
-digital_make_probe_density_b(double alpha);
-
-class digital_probe_density_b : public gr_sync_block
-{
-public:
- double density() const;
- void set_alpha(double alpha);
-};
diff --git a/gr-digital/swig/digital_probe_mpsk_snr_est_c.i b/gr-digital/swig/digital_probe_mpsk_snr_est_c.i
deleted file mode 100644
index 93db4127ac..0000000000
--- a/gr-digital/swig/digital_probe_mpsk_snr_est_c.i
+++ /dev/null
@@ -1,45 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-GR_SWIG_BLOCK_MAGIC(digital,probe_mpsk_snr_est_c);
-
-digital_probe_mpsk_snr_est_c_sptr
-digital_make_probe_mpsk_snr_est_c(snr_est_type_t type,
- int msg_nsamples=10000,
- double alpha=0.001);
-
-class digital_probe_mpsk_snr_est_c : public gr_sync_block
-{
-private:
- void digital_probe_mpsk_snr_est_c(snr_est_type_t type,
- int msg_nsamples,
- double alpha);
-
-public:
- double snr();
- snr_est_type_t type() const;
- int msg_nsample() const;
- double alpha() const;
- void set_type(snr_est_type_t t);
- void set_msg_nsample(int n);
- void set_alpha(double alpha);
-};
diff --git a/gr-digital/swig/digital_swig.i b/gr-digital/swig/digital_swig.i
index 2f36e13c8e..10f34c9c81 100644
--- a/gr-digital/swig/digital_swig.i
+++ b/gr-digital/swig/digital_swig.i
@@ -1,5 +1,5 @@
/*
- * Copyright 2011 Free Software Foundation, Inc.
+ * Copyright 2011,2012 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,150 +20,217 @@
*/
#define DIGITAL_API
+#define ANALOG_API
%include "gnuradio.i"
+%include "stdint.i"
//load generated python docstrings
%include "digital_swig_doc.i"
-#if SWIGPYTHON
-enum snr_est_type_t {
- SNR_EST_SIMPLE = 0, // Simple estimator (>= 7 dB)
- SNR_EST_SKEW, // Skewness-base est (>= 5 dB)
- SNR_EST_M2M4, // 2nd & 4th moment est (>= 1 dB)
- SNR_EST_SVR // SVR-based est (>= 0dB)
-};
-#endif
+%include "analog/cpm.h"
-%include <gri_control_loop.i>
+%{
+#include <blocks/control_loop.h>
+%}
-// Bring in generated blocks
-%include "digital_generated.i"
+// Used in the constellation objects
+%template(unsigned_int_vector) std::vector<unsigned int>;
%{
-#include "digital_additive_scrambler_bb.h"
-#include "digital_binary_slicer_fb.h"
-#include "digital_bytes_to_syms.h"
-#include "digital_clock_recovery_mm_cc.h"
-#include "digital_clock_recovery_mm_ff.h"
-#include "digital_cma_equalizer_cc.h"
-#include "digital_constellation.h"
-#include "digital_constellation_decoder_cb.h"
-#include "digital_constellation_receiver_cb.h"
-#include "digital_correlate_access_code_bb.h"
-#include "digital_correlate_access_code_tag_bb.h"
-#include "digital_costas_loop_cc.h"
-#include "digital_cpmmod_bc.h"
-#include "digital_crc32.h"
-#include "digital_descrambler_bb.h"
-#include "digital_diff_decoder_bb.h"
-#include "digital_diff_encoder_bb.h"
-#include "digital_diff_phasor_cc.h"
-#include "digital_fll_band_edge_cc.h"
-#include "digital_framer_sink_1.h"
-#include "digital_glfsr_source_b.h"
-#include "digital_glfsr_source_f.h"
-#include "digital_gmskmod_bc.h"
-#include "digital_kurtotic_equalizer_cc.h"
-#include "digital_lms_dd_equalizer_cc.h"
-#include "digital_map_bb.h"
-#include "digital_mpsk_receiver_cc.h"
-#include "digital_mpsk_snr_est_cc.h"
-#include "digital_ofdm_cyclic_prefixer.h"
-#include "digital_ofdm_frame_acquisition.h"
-#include "digital_ofdm_frame_sink.h"
-#include "digital_ofdm_insert_preamble.h"
-#include "digital_ofdm_mapper_bcv.h"
-#include "digital_ofdm_sampler.h"
-#include "digital_packet_sink.h"
-#include "digital_pfb_clock_sync_ccf.h"
-#include "digital_pfb_clock_sync_fff.h"
-#include "digital_pn_correlator_cc.h"
-#include "digital_probe_density_b.h"
-#include "digital_probe_mpsk_snr_est_c.h"
-#include "digital_scrambler_bb.h"
-#include "digital_simple_framer.h"
-#include "digital_ofdm_sync_sc_cfb.h"
-#include "digital_ofdm_chanest_vcvc.h"
-#include "digital_crc32_bb.h"
-#include "digital_ofdm_carrier_allocator_cvc.h"
-#include "digital_ofdm_equalizer_base.h"
-#include "digital_ofdm_equalizer_simpledfe.h"
-#include "digital_ofdm_equalizer_static.h"
+#include "digital/additive_scrambler_bb.h"
+#include "digital/binary_slicer_fb.h"
+#include "digital/chunks_to_symbols_bc.h"
+#include "digital/chunks_to_symbols_bf.h"
+#include "digital/chunks_to_symbols_ic.h"
+#include "digital/chunks_to_symbols_if.h"
+#include "digital/chunks_to_symbols_sc.h"
+#include "digital/chunks_to_symbols_sf.h"
+#include "digital/clock_recovery_mm_cc.h"
+#include "digital/clock_recovery_mm_ff.h"
+#include "digital/cma_equalizer_cc.h"
+#include "digital/constellation.h"
+#include "digital/constellation_decoder_cb.h"
+#include "digital/constellation_receiver_cb.h"
+#include "digital/correlate_access_code_bb.h"
+#include "digital/correlate_access_code_tag_bb.h"
+#include "digital/costas_loop_cc.h"
+#include "digital/cpmmod_bc.h"
+#include "digital/crc32.h"
+#include "digital/descrambler_bb.h"
+#include "digital/diff_decoder_bb.h"
+#include "digital/diff_encoder_bb.h"
+#include "digital/diff_phasor_cc.h"
+#include "digital/fll_band_edge_cc.h"
+#include "digital/framer_sink_1.h"
+#include "digital/glfsr_source_b.h"
+#include "digital/glfsr_source_f.h"
+#include "digital/header_payload_demux.h"
+#include "digital/kurtotic_equalizer_cc.h"
+#include "digital/lfsr.h"
+#include "digital/lms_dd_equalizer_cc.h"
+#include "digital/map_bb.h"
+#include "digital/metric_type.h"
+#include "digital/mpsk_receiver_cc.h"
+#include "digital/mpsk_snr_est.h"
+#include "digital/mpsk_snr_est_cc.h"
+#include "digital/ofdm_frame_acquisition.h"
#include "digital/ofdm_frame_equalizer_vcvc.h"
+#include "digital/ofdm_frame_sink.h"
+#include "digital/ofdm_insert_preamble.h"
+#include "digital/ofdm_mapper_bcv.h"
+#include "digital/ofdm_sampler.h"
+#include "digital/ofdm_serializer_vcc.h"
#include "digital/packet_header_default.h"
#include "digital/packet_header_ofdm.h"
#include "digital/packet_headergenerator_bb.h"
+#include "digital/packet_headerparser_b.h"
+#include "digital/packet_sink.h"
+#include "digital/pfb_clock_sync_ccf.h"
+#include "digital/pfb_clock_sync_fff.h"
+#include "digital/pn_correlator_cc.h"
+#include "digital/probe_density_b.h"
+#include "digital/probe_mpsk_snr_est_c.h"
+#include "digital/scrambler_bb.h"
+#include "digital/simple_correlator.h"
+#include "digital/simple_framer.h"
#include "digital/ofdm_serializer_vcc.h"
#include "digital/packet_headerparser_b.h"
#include "digital/header_payload_demux.h"
-#include "digital_simple_correlator.h"
%}
-%include "digital_additive_scrambler_bb.i"
-%include "digital_bytes_to_syms.i"
-%include "digital_binary_slicer_fb.i"
-%include "digital_clock_recovery_mm_cc.i"
-%include "digital_clock_recovery_mm_ff.i"
-%include "digital_cma_equalizer_cc.i"
-%include "digital_constellation.i"
-%include "digital_constellation_decoder_cb.i"
-%include "digital_constellation_receiver_cb.i"
-%include "digital_correlate_access_code_bb.i"
-%include "digital_correlate_access_code_tag_bb.i"
-%include "digital_costas_loop_cc.i"
-%include "digital_cpmmod_bc.i"
-%include "digital_crc32.i"
-%include "digital_descrambler_bb.i"
-%include "digital_diff_decoder_bb.i"
-%include "digital_diff_encoder_bb.i"
-%include "digital_diff_phasor_cc.i"
-%include "digital_fll_band_edge_cc.i"
-%include "digital_framer_sink_1.i"
-%include "digital_glfsr_source_b.i"
-%include "digital_glfsr_source_f.i"
-%include "digital_gmskmod_bc.i"
-%include "digital_kurtotic_equalizer_cc.i"
-%include "digital_lms_dd_equalizer_cc.i"
-%include "digital_map_bb.i"
-%include "digital_mpsk_receiver_cc.i"
-%include "digital_mpsk_snr_est_cc.i"
-%include "digital_ofdm_cyclic_prefixer.i"
-%include "digital_ofdm_frame_acquisition.i"
-%include "digital_ofdm_frame_sink.i"
-%include "digital_ofdm_insert_preamble.i"
-%include "digital_ofdm_mapper_bcv.i"
-%include "digital_ofdm_sampler.i"
-%include "digital_packet_sink.i"
-%include "digital_pfb_clock_sync_ccf.i"
-%include "digital_pfb_clock_sync_fff.i"
-%include "digital_pn_correlator_cc.i"
-%include "digital_probe_density_b.i"
-%include "digital_probe_mpsk_snr_est_c.i"
-%include "digital_scrambler_bb.i"
-%include "digital_simple_framer.i"
-%include "digital_ofdm_sync_sc_cfb.i"
-%include "digital_ofdm_chanest_vcvc.i"
-%include "digital_crc32_bb.i"
-%include "digital_ofdm_carrier_allocator_cvc.i"
-%include "digital_ofdm_equalizer_base.i"
-%include "digital_ofdm_equalizer_simpledfe.i"
-%include "digital_ofdm_equalizer_static.i"
+%include "digital/additive_scrambler_bb.h"
+%include "digital/binary_slicer_fb.h"
+%include "digital/chunks_to_symbols_bc.h"
+%include "digital/chunks_to_symbols_bf.h"
+%include "digital/chunks_to_symbols_ic.h"
+%include "digital/chunks_to_symbols_if.h"
+%include "digital/chunks_to_symbols_sc.h"
+%include "digital/chunks_to_symbols_sf.h"
+%include "digital/clock_recovery_mm_cc.h"
+%include "digital/clock_recovery_mm_ff.h"
+%include "digital/cma_equalizer_cc.h"
+%include "digital/constellation.h"
+%include "digital/constellation_decoder_cb.h"
+%include "digital/constellation_receiver_cb.h"
+%include "digital/correlate_access_code_bb.h"
+%include "digital/correlate_access_code_tag_bb.h"
+%include "digital/costas_loop_cc.h"
+%include "digital/cpmmod_bc.h"
+%include "digital/crc32.h"
+%include "digital/descrambler_bb.h"
+%include "digital/diff_decoder_bb.h"
+%include "digital/diff_encoder_bb.h"
+%include "digital/diff_phasor_cc.h"
+%include "digital/fll_band_edge_cc.h"
+%include "digital/framer_sink_1.h"
+%include "digital/glfsr_source_b.h"
+%include "digital/glfsr_source_f.h"
+%include "digital/header_payload_demux.h"
+%include "digital/kurtotic_equalizer_cc.h"
+%include "digital/lfsr.h"
+%include "digital/lms_dd_equalizer_cc.h"
+%include "digital/map_bb.h"
+%include "digital/metric_type.h"
+%include "digital/mpsk_receiver_cc.h"
+%include "digital/mpsk_snr_est.h"
+%include "digital/mpsk_snr_est_cc.h"
+%include "digital/ofdm_frame_acquisition.h"
%include "digital/ofdm_frame_equalizer_vcvc.h"
-GR_SWIG_BLOCK_MAGIC2(digital, ofdm_frame_equalizer_vcvc);
-
+%include "digital/ofdm_frame_sink.h"
+%include "digital/ofdm_insert_preamble.h"
+%include "digital/ofdm_mapper_bcv.h"
+%include "digital/ofdm_sampler.h"
+%include "digital/ofdm_serializer_vcc.h"
%include "digital/packet_header_default.h"
%include "digital/packet_header_ofdm.h"
-%include "packet_header.i"
-
%include "digital/packet_headergenerator_bb.h"
-GR_SWIG_BLOCK_MAGIC2(digital, packet_headergenerator_bb);
+%include "digital/packet_headerparser_b.h"
+%include "digital/packet_sink.h"
+%include "digital/pfb_clock_sync_ccf.h"
+%include "digital/pfb_clock_sync_fff.h"
+%include "digital/pn_correlator_cc.h"
+%include "digital/probe_density_b.h"
+%include "digital/probe_mpsk_snr_est_c.h"
+%include "digital/scrambler_bb.h"
+%include "digital/simple_correlator.h"
+%include "digital/simple_framer.h"
-%include "digital/ofdm_serializer_vcc.h"
+GR_SWIG_BLOCK_MAGIC2(digital, additive_scrambler_bb);
+GR_SWIG_BLOCK_MAGIC2(digital, binary_slicer_fb);
+GR_SWIG_BLOCK_MAGIC2(digital, chunks_to_symbols_bc);
+GR_SWIG_BLOCK_MAGIC2(digital, chunks_to_symbols_bf);
+GR_SWIG_BLOCK_MAGIC2(digital, chunks_to_symbols_ic);
+GR_SWIG_BLOCK_MAGIC2(digital, chunks_to_symbols_if);
+GR_SWIG_BLOCK_MAGIC2(digital, chunks_to_symbols_sc);
+GR_SWIG_BLOCK_MAGIC2(digital, chunks_to_symbols_sf);
+GR_SWIG_BLOCK_MAGIC2(digital, clock_recovery_mm_cc);
+GR_SWIG_BLOCK_MAGIC2(digital, clock_recovery_mm_ff);
+GR_SWIG_BLOCK_MAGIC2(digital, cma_equalizer_cc);
+GR_SWIG_BLOCK_MAGIC2(digital, constellation_decoder_cb);
+GR_SWIG_BLOCK_MAGIC2(digital, constellation_receiver_cb);
+GR_SWIG_BLOCK_MAGIC2(digital, correlate_access_code_bb);
+GR_SWIG_BLOCK_MAGIC2(digital, correlate_access_code_tag_bb);
+GR_SWIG_BLOCK_MAGIC2(digital, costas_loop_cc);
+GR_SWIG_BLOCK_MAGIC2(digital, cpmmod_bc);
+GR_SWIG_BLOCK_MAGIC2(digital, descrambler_bb);
+GR_SWIG_BLOCK_MAGIC2(digital, diff_decoder_bb);
+GR_SWIG_BLOCK_MAGIC2(digital, diff_encoder_bb);
+GR_SWIG_BLOCK_MAGIC2(digital, diff_phasor_cc);
+GR_SWIG_BLOCK_MAGIC2(digital, fll_band_edge_cc);
+GR_SWIG_BLOCK_MAGIC2(digital, framer_sink_1);
+GR_SWIG_BLOCK_MAGIC2(digital, glfsr_source_b);
+GR_SWIG_BLOCK_MAGIC2(digital, glfsr_source_f);
+GR_SWIG_BLOCK_MAGIC2(digital, header_payload_demux);
+GR_SWIG_BLOCK_MAGIC2(digital, kurtotic_equalizer_cc);
+GR_SWIG_BLOCK_MAGIC2(digital, lms_dd_equalizer_cc);
+GR_SWIG_BLOCK_MAGIC2(digital, map_bb);
+GR_SWIG_BLOCK_MAGIC2(digital, mpsk_receiver_cc);
+GR_SWIG_BLOCK_MAGIC2(digital, mpsk_snr_est_cc);
+GR_SWIG_BLOCK_MAGIC2(digital, ofdm_frame_acquisition);
+GR_SWIG_BLOCK_MAGIC2(digital, ofdm_frame_equalizer_vcvc);
+GR_SWIG_BLOCK_MAGIC2(digital, ofdm_frame_sink);
+GR_SWIG_BLOCK_MAGIC2(digital, ofdm_insert_preamble);
+GR_SWIG_BLOCK_MAGIC2(digital, ofdm_mapper_bcv);
+GR_SWIG_BLOCK_MAGIC2(digital, ofdm_sampler);
GR_SWIG_BLOCK_MAGIC2(digital, ofdm_serializer_vcc);
-
-%include "digital/packet_headerparser_b.h"
+GR_SWIG_BLOCK_MAGIC2(digital, packet_headergenerator_bb);
GR_SWIG_BLOCK_MAGIC2(digital, packet_headerparser_b);
-%include "digital/header_payload_demux.h"
-GR_SWIG_BLOCK_MAGIC2(digital, header_payload_demux);
-%include "digital_simple_correlator.i"
+GR_SWIG_BLOCK_MAGIC2(digital, packet_sink);
+GR_SWIG_BLOCK_MAGIC2(digital, pfb_clock_sync_ccf);
+GR_SWIG_BLOCK_MAGIC2(digital, pfb_clock_sync_fff);
+GR_SWIG_BLOCK_MAGIC2(digital, pn_correlator_cc);
+GR_SWIG_BLOCK_MAGIC2(digital, probe_density_b);
+GR_SWIG_BLOCK_MAGIC2(digital, probe_mpsk_snr_est_c);
+GR_SWIG_BLOCK_MAGIC2(digital, scrambler_bb);
+GR_SWIG_BLOCK_MAGIC2(digital, simple_correlator);
+GR_SWIG_BLOCK_MAGIC2(digital, simple_framer);
+
+GR_SWIG_BLOCK_MAGIC_FACTORY(digital, cpmmod_bc, gmskmod_bc);
+
+// Properly package up constellation objects
+%include "constellation.i"
+
+%include "packet_header.i"
+
+// Old-style blocks to be converted to 3.7
+%{
+#include <digital_crc32_bb.h>
+#include <digital_ofdm_carrier_allocator_cvc.h>
+#include <digital_ofdm_cyclic_prefixer.h>
+#include <digital_ofdm_chanest_vcvc.h>
+#include <digital_ofdm_cyclic_prefixer.h>
+#include <digital_ofdm_equalizer_base.h>
+#include <digital_ofdm_equalizer_simpledfe.h>
+#include <digital_ofdm_equalizer_static.h>
+#include <digital_ofdm_sync_sc_cfb.h>
+%}
+
+%include "digital_crc32_bb.i"
+%include "digital_ofdm_carrier_allocator_cvc.i"
+%include "digital_ofdm_chanest_vcvc.i"
+%include "digital_ofdm_cyclic_prefixer.i"
+%include "digital_ofdm_equalizer_base.i"
+%include "digital_ofdm_equalizer_simpledfe.i"
+%include "digital_ofdm_equalizer_static.i"
+%include "digital_ofdm_sync_sc_cfb.i"
diff --git a/gr-digital/swig/gnuradio/digital.scm b/gr-digital/swig/gnuradio/digital.scm
deleted file mode 100644
index 834bc8d6de..0000000000
--- a/gr-digital/swig/gnuradio/digital.scm
+++ /dev/null
@@ -1,28 +0,0 @@
-;;;
-;;; Copyright 2011 Free Software Foundation, Inc.
-;;;
-;;; This file is part of GNU Radio
-;;;
-;;; GNU Radio is free software; you can redistribute it and/or modify
-;;; it under the terms of the GNU General Public License as published by
-;;; the Free Software Foundation; either version 3, or (at your option)
-;;; any later version.
-;;;
-;;; GNU Radio is distributed in the hope that it will be useful,
-;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;;; GNU General Public License for more details.
-;;;
-;;; You should have received a copy of the GNU General Public License
-;;; along with this program. If not, see <http://www.gnu.org/licenses/>.
-;;;
-
-;;; Module that just re-exports the digital_swig module
-
-(define-module (gnuradio digital)
- #:use-module (gnuradio export-safely)
- #:use-module (gnuradio digital_swig)
- #:duplicates (merge-generics replace check))
-
-(re-export-all '(gnuradio digital_swig))
-