diff options
Diffstat (limited to 'gr-digital')
122 files changed, 9613 insertions, 1855 deletions
diff --git a/gr-digital/examples/CMakeLists.txt b/gr-digital/examples/CMakeLists.txt index 33d257e59f..63e1eba4e4 100644 --- a/gr-digital/examples/CMakeLists.txt +++ b/gr-digital/examples/CMakeLists.txt @@ -71,6 +71,7 @@ install( demod/pam_timing.grc demod/ber_simulation.grc demod/dpsk_loopback.grc + demod/gfsk_loopback.grc DESTINATION ${GR_PKG_DIGITAL_EXAMPLES_DIR}/demod COMPONENT "digital_python" ) diff --git a/gr-digital/examples/berawgn.py b/gr-digital/examples/berawgn.py new file mode 100755 index 0000000000..d58dfbaaeb --- /dev/null +++ b/gr-digital/examples/berawgn.py @@ -0,0 +1,104 @@ +#!/usr/bin/env python +""" +BER simulation for QPSK signals, compare to theoretical values. +Change the N_BITS value to simulate more bits per Eb/N0 value, +thus allowing to check for lower BER values. + +Lower values will work faster, higher values will use a lot of RAM. +Also, this app isn't highly optimized--the flow graph is completely +reinstantiated for every Eb/N0 value. +Of course, expect the maximum value for BER to be one order of +magnitude below what you chose for N_BITS. +""" + + +import math +import numpy +from scipy.special import erfc +import pylab +from gnuradio import gr, digital + +# Best to choose powers of 10 +N_BITS = 1e7 +RAND_SEED = 42 + +def berawgn(EbN0): + """ Calculates theoretical bit error rate in AWGN (for BPSK and given Eb/N0) """ + return 0.5 * erfc(math.sqrt(10**(float(EbN0)/10))) + +class BitErrors(gr.hier_block2): + """ Two inputs: true and received bits. We compare them and + add up the number of incorrect bits. Because integrate_ff() + can only add up a certain number of values, the output is + not a scalar, but a sequence of values, the sum of which is + the BER. """ + def __init__(self, bits_per_byte): + gr.hier_block2.__init__(self, "BitErrors", + gr.io_signature(2, 2, gr.sizeof_char), + gr.io_signature(1, 1, gr.sizeof_int)) + + # Bit comparison + comp = gr.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), + self) + self.connect((self, 1), (comp, 1)) + +class BERAWGNSimu(gr.top_block): + " This contains the simulation flow graph " + def __init__(self, EbN0): + gr.top_block.__init__(self) + self.const = digital.qpsk_constellation() + # 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) + demod = digital.constellation_decoder_cb(self.const.base()) + ber = BitErrors(self.const.bits_per_symbol()) + self.sink = gr.vector_sink_f() + self.connect(src, mod, add, demod, ber, self.sink) + self.connect(noise, (add, 1)) + self.connect(src, (ber, 1)) + + def EbN0_to_noise_voltage(self, EbN0): + """ Converts Eb/N0 to a single-sided noise voltage (assuming unit symbol power) """ + return 1.0 / math.sqrt(2.0 * self.const.bits_per_symbol() * 10**(float(EbN0)/10)) + + +def simulate_ber(EbN0): + """ All the work's done here: create flow graph, run, read out BER """ + print "Eb/N0 = %d dB" % EbN0 + fg = BERAWGNSimu(EbN0) + fg.run() + return numpy.sum(fg.sink.data()) + +if __name__ == "__main__": + EbN0_min = 0 + EbN0_max = 15 + EbN0_range = range(EbN0_min, EbN0_max+1) + ber_theory = [berawgn(x) for x in EbN0_range] + print "Simulating..." + ber_simu = [simulate_ber(x) for x in EbN0_range] + + f = pylab.figure() + s = f.add_subplot(1,1,1) + s.semilogy(EbN0_range, ber_theory, 'g-.', label="Theoretical") + s.semilogy(EbN0_range, ber_simu, 'b-o', label="Simulated") + s.set_title('BER Simulation') + s.set_xlabel('Eb/N0 (dB)') + s.set_ylabel('BER') + s.legend() + s.grid() + pylab.show() + diff --git a/gr-digital/examples/demod/ber_simulation.grc b/gr-digital/examples/demod/ber_simulation.grc index 6a9361ed16..b7c6a624b6 100644 --- a/gr-digital/examples/demod/ber_simulation.grc +++ b/gr-digital/examples/demod/ber_simulation.grc @@ -1,6 +1,6 @@ <?xml version='1.0' encoding='ASCII'?> <flow_graph> - <timestamp>Tue Apr 3 18:11:51 2012</timestamp> + <timestamp>Thu Jul 5 15:57:06 2012</timestamp> <block> <key>options</key> <param> @@ -44,6 +44,10 @@ <value>True</value> </param> <param> + <key>max_nouts</key> + <value>0</value> + </param> + <param> <key>realtime_scheduling</key> <value></value> </param> @@ -57,10 +61,41 @@ </param> </block> <block> - <key>gr_noise_source_x</key> + <key>gr_throttle</key> <param> <key>id</key> - <value>gr_noise_source_x</value> + <value>gr_throttle</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>byte</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>(284, 24)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_add_xx</key> + <param> + <key>id</key> + <value>gr_add_xx</value> </param> <param> <key>_enabled</key> @@ -71,20 +106,39 @@ <value>complex</value> </param> <param> - <key>noise_type</key> - <value>gr.GR_GAUSSIAN</value> + <key>num_inputs</key> + <value>2</value> </param> <param> - <key>amp</key> - <value>noise</value> + <key>vlen</key> + <value>1</value> </param> <param> - <key>seed</key> - <value>42</value> + <key>_coordinate</key> + <value>(486, 151)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>digital_constellation_decoder_cb</key> + <param> + <key>id</key> + <value>digital_constellation_decoder_cb_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>constellation</key> + <value>const.base()</value> </param> <param> <key>_coordinate</key> - <value>(235, 379)</value> + <value>(618, 164)</value> </param> <param> <key>_rotation</key> @@ -171,38 +225,30 @@ </param> <param> <key>_coordinate</key> - <value>(1062, 11)</value> + <value>(791, 228)</value> </param> <param> <key>_rotation</key> - <value>0</value> + <value>180</value> </param> </block> <block> - <key>gr_throttle</key> + <key>import</key> <param> <key>id</key> - <value>gr_throttle</value> + <value>import</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>type</key> - <value>byte</value> - </param> - <param> - <key>samples_per_second</key> - <value>samp_rate</value> - </param> - <param> - <key>vlen</key> - <value>1</value> + <key>import</key> + <value>import math</value> </param> <param> <key>_coordinate</key> - <value>(397, 27)</value> + <value>(18, 373)</value> </param> <param> <key>_rotation</key> @@ -213,7 +259,7 @@ <key>variable</key> <param> <key>id</key> - <value>samp_rate</value> + <value>const</value> </param> <param> <key>_enabled</key> @@ -221,11 +267,11 @@ </param> <param> <key>value</key> - <value>50e3</value> + <value>digital.qpsk_constellation()</value> </param> <param> <key>_coordinate</key> - <value>(20, 168)</value> + <value>(116, 310)</value> </param> <param> <key>_rotation</key> @@ -233,22 +279,22 @@ </param> </block> <block> - <key>import</key> + <key>variable</key> <param> <key>id</key> - <value>import</value> + <value>samp_rate</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>import</key> - <value>import math</value> + <key>value</key> + <value>100e3</value> </param> <param> <key>_coordinate</key> - <value>(138, 168)</value> + <value>(16, 308)</value> </param> <param> <key>_rotation</key> @@ -271,7 +317,7 @@ </param> <param> <key>title</key> - <value>"Constellation: "+str(const)</value> + <value>"Constellation: "+str(const.arity()) + "-PSK"</value> </param> <param> <key>samp_rate</key> @@ -323,7 +369,7 @@ </param> <param> <key>_coordinate</key> - <value>(828, 368)</value> + <value>(623, 228)</value> </param> <param> <key>_rotation</key> @@ -331,10 +377,10 @@ </param> </block> <block> - <key>gr_add_xx</key> + <key>blks2_error_rate</key> <param> <key>id</key> - <value>gr_add_xx</value> + <value>blks2_error_rate</value> </param> <param> <key>_enabled</key> @@ -342,42 +388,19 @@ </param> <param> <key>type</key> - <value>complex</value> - </param> - <param> - <key>num_inputs</key> - <value>2</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(652, 395)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>digital_constellation_decoder_cb</key> - <param> - <key>id</key> - <value>digital_constellation_decoder_cb_0</value> + <value>'BER'</value> </param> <param> - <key>_enabled</key> - <value>True</value> + <key>win_size</key> + <value>int(1e7)</value> </param> <param> - <key>constellation</key> - <value>const.base()</value> + <key>bits_per_symbol</key> + <value>const.bits_per_symbol()</value> </param> <param> <key>_coordinate</key> - <value>(693, 205)</value> + <value>(720, 25)</value> </param> <param> <key>_rotation</key> @@ -385,45 +408,34 @@ </param> </block> <block> - <key>variable</key> + <key>gr_noise_source_x</key> <param> <key>id</key> - <value>const</value> + <value>gr_noise_source_x</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>(16, 461)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> + <key>type</key> + <value>complex</value> </param> - </block> - <block> - <key>variable</key> <param> - <key>id</key> - <value>const_points</value> + <key>noise_type</key> + <value>gr.GR_GAUSSIAN</value> </param> <param> - <key>_enabled</key> - <value>True</value> + <key>amp</key> + <value>1.0 / math.sqrt(2.0 * const.bits_per_symbol() * 10**(EbN0/10))</value> </param> <param> - <key>value</key> - <value>const.points()</value> + <key>seed</key> + <value>42</value> </param> <param> <key>_coordinate</key> - <value>(17, 532)</value> + <value>(16, 224)</value> </param> <param> <key>_rotation</key> @@ -431,38 +443,38 @@ </param> </block> <block> - <key>random_source_x</key> + <key>gr_chunks_to_symbols_xx</key> <param> <key>id</key> - <value>random_source_x</value> + <value>gr_chunks_to_symbols_xx</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>type</key> + <key>in_type</key> <value>byte</value> </param> <param> - <key>min</key> - <value>0</value> + <key>out_type</key> + <value>complex</value> </param> <param> - <key>max</key> - <value>len(const_points)</value> + <key>symbol_table</key> + <value>const.points()</value> </param> <param> - <key>num_samps</key> - <value>1000000</value> + <key>dimension</key> + <value>1</value> </param> <param> - <key>repeat</key> - <value>False</value> + <key>num_ports</key> + <value>1</value> </param> <param> <key>_coordinate</key> - <value>(15, 244)</value> + <value>(240, 140)</value> </param> <param> <key>_rotation</key> @@ -470,69 +482,54 @@ </param> </block> <block> - <key>gr_chunks_to_symbols_xx</key> + <key>variable_slider</key> <param> <key>id</key> - <value>gr_chunks_to_symbols_xx</value> + <value>EbN0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>in_type</key> - <value>byte</value> - </param> - <param> - <key>out_type</key> - <value>complex</value> - </param> - <param> - <key>symbol_table</key> - <value>const_points</value> - </param> - <param> - <key>dimension</key> - <value>1</value> + <key>label</key> + <value>Eb/N0 (dB)</value> </param> <param> - <key>num_ports</key> - <value>1</value> + <key>value</key> + <value>10</value> </param> <param> - <key>_coordinate</key> - <value>(367, 260)</value> + <key>min</key> + <value>-10</value> </param> <param> - <key>_rotation</key> - <value>0</value> + <key>max</key> + <value>200</value> </param> - </block> - <block> - <key>blks2_error_rate</key> <param> - <key>id</key> - <value>blks2_error_rate</value> + <key>num_steps</key> + <value>211</value> </param> <param> - <key>_enabled</key> - <value>True</value> + <key>style</key> + <value>wx.SL_HORIZONTAL</value> </param> <param> - <key>type</key> - <value>'BER'</value> + <key>converver</key> + <value>float_converter</value> </param> <param> - <key>win_size</key> - <value>1000000</value> + <key>grid_pos</key> + <value></value> </param> <param> - <key>bits_per_symbol</key> - <value>int(math.log(len(const_points))/math.log(2))</value> + <key>notebook</key> + <value></value> </param> <param> <key>_coordinate</key> - <value>(670, 41)</value> + <value>(311, 309)</value> </param> <param> <key>_rotation</key> @@ -540,22 +537,18 @@ </param> </block> <block> - <key>variable_slider</key> + <key>random_source_x</key> <param> <key>id</key> - <value>noise</value> + <value>random_source_x</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>label</key> - <value>AWGN Noise</value> - </param> - <param> - <key>value</key> - <value>0.10</value> + <key>type</key> + <value>byte</value> </param> <param> <key>min</key> @@ -563,31 +556,19 @@ </param> <param> <key>max</key> - <value>1</value> - </param> - <param> - <key>num_steps</key> - <value>100</value> + <value>const.arity()</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> + <key>num_samps</key> + <value>10000000</value> </param> <param> - <key>notebook</key> - <value></value> + <key>repeat</key> + <value>True</value> </param> <param> <key>_coordinate</key> - <value>(268, 481)</value> + <value>(17, 125)</value> </param> <param> <key>_rotation</key> diff --git a/gr-digital/examples/demod/digital_freq_lock.grc b/gr-digital/examples/demod/digital_freq_lock.grc index 36037febb0..df105dd7f5 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>Sat Mar 6 17:17:12 2010</timestamp> + <timestamp>Thu Jul 5 18:11:22 2012</timestamp> <block> <key>options</key> <param> @@ -44,12 +44,16 @@ <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> + <value>(-1, 0)</value> </param> <param> <key>_rotation</key> @@ -57,37 +61,38 @@ </param> </block> <block> - <key>gr_uchar_to_float</key> + <key>random_source_x</key> <param> <key>id</key> - <value>gr_uchar_to_float_0</value> + <value>random_source_x</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>_coordinate</key> - <value>(217, 108)</value> + <key>type</key> + <value>byte</value> </param> <param> - <key>_rotation</key> + <key>min</key> <value>0</value> </param> - </block> - <block> - <key>gr_uchar_to_float</key> <param> - <key>id</key> - <value>gr_uchar_to_float_0_0</value> + <key>max</key> + <value>256</value> </param> <param> - <key>_enabled</key> + <key>num_samps</key> + <value>10000000</value> + </param> + <param> + <key>repeat</key> <value>True</value> </param> <param> <key>_coordinate</key> - <value>(216, 273)</value> + <value>(-2, 111)</value> </param> <param> <key>_rotation</key> @@ -95,54 +100,30 @@ </param> </block> <block> - <key>variable_slider</key> + <key>gr_throttle</key> <param> <key>id</key> - <value>freq_offset</value> + <value>gr_throttle_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> - </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>(293, 684)</value> + <value>(456, 134)</value> </param> <param> <key>_rotation</key> @@ -150,38 +131,22 @@ </param> </block> <block> - <key>random_source_x</key> + <key>variable</key> <param> <key>id</key> - <value>random_source_x_0</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>pam_amp</value> - </param> - <param> - <key>num_samps</key> - <value>10000</value> - </param> - <param> - <key>repeat</key> - <value>True</value> + <key>value</key> + <value>4</value> </param> <param> <key>_coordinate</key> - <value>(13, 80)</value> + <value>(166, -2)</value> </param> <param> <key>_rotation</key> @@ -189,38 +154,22 @@ </param> </block> <block> - <key>random_source_x</key> + <key>variable</key> <param> <key>id</key> - <value>random_source_x_0_0</value> + <value>rolloff</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>pam_amp</value> - </param> - <param> - <key>num_samps</key> - <value>10000</value> - </param> - <param> - <key>repeat</key> - <value>True</value> + <key>value</key> + <value>0.35</value> </param> <param> <key>_coordinate</key> - <value>(15, 245)</value> + <value>(231, 0)</value> </param> <param> <key>_rotation</key> @@ -228,10 +177,10 @@ </param> </block> <block> - <key>const_source_x</key> + <key>digital_fll_band_edge_cc</key> <param> <key>id</key> - <value>const_source_x_0</value> + <value>digital_fll_band_edge_cc_0</value> </param> <param> <key>_enabled</key> @@ -239,42 +188,27 @@ </param> <param> <key>type</key> - <value>float</value> - </param> - <param> - <key>const</key> - <value>-0.5*(pam_amp-1)</value> - </param> - <param> - <key>_coordinate</key> - <value>(213, 197)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> + <value>cc</value> </param> - </block> - <block> - <key>const_source_x</key> <param> - <key>id</key> - <value>const_source_x_0_0</value> + <key>samps_per_sym</key> + <value>sps</value> </param> <param> - <key>_enabled</key> - <value>True</value> + <key>rolloff</key> + <value>rolloff</value> </param> <param> - <key>type</key> - <value>float</value> + <key>filter_size</key> + <value>44</value> </param> <param> - <key>const</key> - <value>-0.5*(pam_amp-1)</value> + <key>w</key> + <value>freq_bw</value> </param> <param> <key>_coordinate</key> - <value>(200, 360)</value> + <value>(81, 248)</value> </param> <param> <key>_rotation</key> @@ -282,61 +216,54 @@ </param> </block> <block> - <key>gr_add_xx</key> + <key>variable_slider</key> <param> <key>id</key> - <value>gr_add_xx_0</value> + <value>freq_bw</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>type</key> - <value>float</value> + <key>label</key> + <value>FLL Loop Bandwidth</value> </param> <param> - <key>num_inputs</key> - <value>2</value> + <key>value</key> + <value>0</value> </param> <param> - <key>vlen</key> - <value>1</value> + <key>min</key> + <value>0</value> </param> <param> - <key>_coordinate</key> - <value>(440, 167)</value> + <key>max</key> + <value>0.1</value> </param> <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_add_xx</key> - <param> - <key>id</key> - <value>gr_add_xx_0_1</value> + <key>num_steps</key> + <value>1000</value> </param> <param> - <key>_enabled</key> - <value>True</value> + <key>style</key> + <value>wx.SL_HORIZONTAL</value> </param> <param> - <key>type</key> - <value>float</value> + <key>converver</key> + <value>float_converter</value> </param> <param> - <key>num_inputs</key> - <value>2</value> + <key>grid_pos</key> + <value></value> </param> <param> - <key>vlen</key> - <value>1</value> + <key>notebook</key> + <value></value> </param> <param> <key>_coordinate</key> - <value>(430, 330)</value> + <value>(80, 382)</value> </param> <param> <key>_rotation</key> @@ -347,7 +274,7 @@ <key>variable</key> <param> <key>id</key> - <value>nfilts</value> + <value>samp_rate</value> </param> <param> <key>_enabled</key> @@ -355,11 +282,11 @@ </param> <param> <key>value</key> - <value>32</value> + <value>32000</value> </param> <param> <key>_coordinate</key> - <value>(435, 686)</value> + <value>(439, -1)</value> </param> <param> <key>_rotation</key> @@ -414,7 +341,7 @@ </param> <param> <key>_coordinate</key> - <value>(168, 684)</value> + <value>(553, 0)</value> </param> <param> <key>_rotation</key> @@ -422,91 +349,54 @@ </param> </block> <block> - <key>variable</key> + <key>variable_slider</key> <param> <key>id</key> - <value>spb_gen</value> + <value>freq_offset</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>value</key> - <value>4</value> - </param> - <param> - <key>_coordinate</key> - <value>(119, 841)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>pam_amp</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> + <key>label</key> + <value>Frequency Offset</value> </param> <param> <key>value</key> - <value>2</value> - </param> - <param> - <key>_coordinate</key> - <value>(223, 9)</value> - </param> - <param> - <key>_rotation</key> <value>0</value> </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>spb</value> - </param> <param> - <key>_enabled</key> - <value>True</value> + <key>min</key> + <value>-0.5</value> </param> <param> - <key>value</key> - <value>4.1</value> + <key>max</key> + <value>0.5</value> </param> <param> - <key>_coordinate</key> - <value>(32, 842)</value> + <key>num_steps</key> + <value>1000</value> </param> <param> - <key>_rotation</key> - <value>0</value> + <key>style</key> + <value>wx.SL_HORIZONTAL</value> </param> - </block> - <block> - <key>gr_float_to_complex</key> <param> - <key>id</key> - <value>gr_float_to_complex_0</value> + <key>converver</key> + <value>float_converter</value> </param> <param> - <key>_enabled</key> - <value>True</value> + <key>grid_pos</key> + <value></value> </param> <param> - <key>vlen</key> - <value>1</value> + <key>notebook</key> + <value></value> </param> <param> <key>_coordinate</key> - <value>(590, 184)</value> + <value>(673, -1)</value> </param> <param> <key>_rotation</key> @@ -514,65 +404,38 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>gr_channel_model</key> <param> <key>id</key> - <value>gr_throttle_0</value> + <value>gr_channel_model_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>(788, 197)</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> + <key>noise_voltage</key> + <value>noise_amp</value> </param> <param> - <key>style</key> - <value>wx.NB_TOP</value> + <key>freq_offset</key> + <value>freq_offset</value> </param> <param> - <key>labels</key> - <value>['Freq', 'Time']</value> + <key>epsilon</key> + <value>1.0</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>(216, 845)</value> + <value>(649, 104)</value> </param> <param> <key>_rotation</key> @@ -638,8 +501,16 @@ <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>(1123, 392)</value> + <value>(875, 0)</value> </param> <param> <key>_rotation</key> @@ -725,8 +596,59 @@ <value>notebook_0,0</value> </param> <param> + <key>freqvar</key> + <value>None</value> + </param> + <param> <key>_coordinate</key> - <value>(1122, 473)</value> + <value>(875, 108)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>digital_psk_mod</key> + <param> + <key>id</key> + <value>digital_psk_mod_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>constellation_points</key> + <value>2</value> + </param> + <param> + <key>mod_code</key> + <value>"gray"</value> + </param> + <param> + <key>differential</key> + <value>False</value> + </param> + <param> + <key>samples_per_symbol</key> + <value>sps</value> + </param> + <param> + <key>excess_bw</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>(194, 104)</value> </param> <param> <key>_rotation</key> @@ -792,8 +714,16 @@ <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>(1122, 680)</value> + <value>(439, 289)</value> </param> <param> <key>_rotation</key> @@ -879,233 +809,12 @@ <value>notebook_0,0</value> </param> <param> - <key>_coordinate</key> - <value>(1121, 762)</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>(128, 9)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>sig_amp</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(315, 9)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>rolloff</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>0.35</value> - </param> - <param> - <key>_coordinate</key> - <value>(398, 12)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>rrctaps</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>firdes.root_raised_cosine(nfilts,1.0,1.0/(spb*nfilts), .35, int(11*spb*nfilts))</value> - </param> - <param> - <key>_coordinate</key> - <value>(826, 61)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>root_raised_cosine_filter</key> - <param> - <key>id</key> - <value>root_raised_cosine_filter_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>interp_fir_filter_ccf</value> - </param> - <param> - <key>decim</key> - <value>1</value> - </param> - <param> - <key>interp</key> - <value>spb_gen</value> - </param> - <param> - <key>gain</key> - <value>2*spb_gen</value> - </param> - <param> - <key>samp_rate</key> - <value>1.0</value> - </param> - <param> - <key>sym_rate</key> - <value>1./spb_gen</value> - </param> - <param> - <key>alpha</key> - <value>rolloff</value> - </param> - <param> - <key>ntaps</key> - <value>44</value> - </param> - <param> - <key>_coordinate</key> - <value>(978, 157)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_fll_band_edge_cc</key> - <param> - <key>id</key> - <value>gr_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_gen</value> - </param> - <param> - <key>rolloff</key> - <value>rolloff</value> - </param> - <param> - <key>filter_size</key> - <value>44</value> - </param> - <param> - <key>alpha</key> - <value>alpha</value> - </param> - <param> - <key>beta</key> - <value>beta</value> - </param> - <param> - <key>_coordinate</key> - <value>(874, 664)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </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>1.0</value> - </param> - <param> - <key>taps</key> - <value>1.0</value> - </param> - <param> - <key>seed</key> - <value>42</value> + <key>freqvar</key> + <value>None</value> </param> <param> <key>_coordinate</key> - <value>(618, 376)</value> + <value>(439, 423)</value> </param> <param> <key>_rotation</key> @@ -1113,97 +822,22 @@ </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>Freq 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.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>(668, 5)</value> - </param> - <param> - <key>_rotation</key> - <value>180</value> - </param> - </block> - <block> - <key>variable_slider</key> + <key>notebook</key> <param> <key>id</key> - <value>alpha</value> + <value>notebook_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>label</key> - <value>Freq Alpha</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> + <value>wx.NB_TOP</value> </param> <param> - <key>converver</key> - <value>float_converter</value> + <key>labels</key> + <value>['Freq', 'Time']</value> </param> <param> <key>grid_pos</key> @@ -1215,7 +849,7 @@ </param> <param> <key>_coordinate</key> - <value>(552, 4)</value> + <value>(114, 521)</value> </param> <param> <key>_rotation</key> @@ -1223,97 +857,49 @@ </param> </block> <connection> - <source_block_id>random_source_x_0</source_block_id> - <sink_block_id>gr_uchar_to_float_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_uchar_to_float_0</source_block_id> - <sink_block_id>gr_add_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>const_source_x_0</source_block_id> - <sink_block_id>gr_add_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>gr_uchar_to_float_0_0</source_block_id> - <sink_block_id>gr_add_xx_0_1</sink_block_id> + <source_block_id>gr_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>const_source_x_0_0</source_block_id> - <sink_block_id>gr_add_xx_0_1</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>random_source_x_0_0</source_block_id> - <sink_block_id>gr_uchar_to_float_0_0</sink_block_id> + <source_block_id>gr_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> </connection> <connection> - <source_block_id>gr_add_xx_0</source_block_id> - <sink_block_id>gr_float_to_complex_0</sink_block_id> + <source_block_id>random_source_x</source_block_id> + <sink_block_id>digital_psk_mod_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_add_xx_0_1</source_block_id> - <sink_block_id>gr_float_to_complex_0</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>gr_float_to_complex_0</source_block_id> + <source_block_id>digital_psk_mod_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>root_raised_cosine_filter_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>wxgui_scopesink2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>root_raised_cosine_filter_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_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> - </connection> - <connection> - <source_block_id>gr_channel_model_0</source_block_id> - <sink_block_id>gr_fll_band_edge_cc_0</sink_block_id> + <sink_block_id>digital_fll_band_edge_cc_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_fll_band_edge_cc_0</source_block_id> + <source_block_id>digital_fll_band_edge_cc_0</source_block_id> <sink_block_id>wxgui_scopesink2_0_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_fll_band_edge_cc_0</source_block_id> + <source_block_id>digital_fll_band_edge_cc_0</source_block_id> <sink_block_id>wxgui_fftsink2_0_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 aef6a77385..c9867bea20 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>Tue Apr 3 18:03:52 2012</timestamp> + <timestamp>Thu Jul 5 16:26:53 2012</timestamp> <block> <key>options</key> <param> @@ -17,11 +17,11 @@ </param> <param> <key>author</key> - <value>Example</value> + <value>GNU Radio</value> </param> <param> <key>description</key> - <value>gnuradio flow graph</value> + <value>Encode a signal into a packet, modulate, demodulate, decode and show it's the same data.</value> </param> <param> <key>window_size</key> @@ -44,6 +44,10 @@ <value>True</value> </param> <param> + <key>max_nouts</key> + <value>0</value> + </param> + <param> <key>realtime_scheduling</key> <value></value> </param> @@ -72,7 +76,7 @@ </param> <param> <key>_coordinate</key> - <value>(10, 170)</value> + <value>(11, 120)</value> </param> <param> <key>_rotation</key> @@ -127,7 +131,7 @@ </param> <param> <key>_coordinate</key> - <value>(12, 257)</value> + <value>(13, 188)</value> </param> <param> <key>_rotation</key> @@ -135,10 +139,10 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>gr_sig_source_x</key> <param> <key>id</key> - <value>gr_throttle_0_0</value> + <value>gr_sig_source_x_0</value> </param> <param> <key>_enabled</key> @@ -149,16 +153,28 @@ <value>float</value> </param> <param> - <key>samples_per_second</key> + <key>samp_rate</key> <value>samp_rate</value> </param> <param> - <key>vlen</key> + <key>waveform</key> + <value>gr.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>(225, 174)</value> + <value>(184, 9)</value> </param> <param> <key>_rotation</key> @@ -166,10 +182,10 @@ </param> </block> <block> - <key>gr_sig_source_x</key> + <key>digital_dxpsk_mod</key> <param> <key>id</key> - <value>gr_sig_source_x_0</value> + <value>digital_dxpsk_mod_1</value> </param> <param> <key>_enabled</key> @@ -177,31 +193,31 @@ </param> <param> <key>type</key> - <value>float</value> + <value>dbpsk</value> </param> <param> - <key>samp_rate</key> - <value>samp_rate</value> + <key>samples_per_symbol</key> + <value>2</value> </param> <param> - <key>waveform</key> - <value>gr.GR_COS_WAVE</value> + <key>excess_bw</key> + <value>0.35</value> </param> <param> - <key>freq</key> - <value>freq</value> + <key>gray_coded</key> + <value>True</value> </param> <param> - <key>amp</key> - <value>1</value> + <key>verbose</key> + <value>False</value> </param> <param> - <key>offset</key> - <value>0</value> + <key>log</key> + <value>False</value> </param> <param> <key>_coordinate</key> - <value>(203, 8)</value> + <value>(745, 16)</value> </param> <param> <key>_rotation</key> @@ -209,10 +225,10 @@ </param> </block> <block> - <key>blks2_packet_decoder</key> + <key>gr_throttle</key> <param> <key>id</key> - <value>blks2_packet_decoder_0</value> + <value>gr_throttle_0_0</value> </param> <param> <key>_enabled</key> @@ -223,16 +239,16 @@ <value>float</value> </param> <param> - <key>access_code</key> - <value></value> + <key>samples_per_second</key> + <value>samp_rate</value> </param> <param> - <key>threshold</key> - <value>-1</value> + <key>vlen</key> + <value>1</value> </param> <param> <key>_coordinate</key> - <value>(551, 65)</value> + <value>(358, 39)</value> </param> <param> <key>_rotation</key> @@ -240,10 +256,10 @@ </param> </block> <block> - <key>digital_dxpsk_demod</key> + <key>blks2_packet_encoder</key> <param> <key>id</key> - <value>digital_dxpsk_demod_0</value> + <value>blks2_packet_encoder_0</value> </param> <param> <key>_enabled</key> @@ -251,51 +267,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>freq_bw</key> - <value>6.28/100.0</value> - </param> - <param> - <key>phase_bw</key> - <value>6.28/100.0</value> - </param> - <param> - <key>timing_bw</key> - <value>6.28/100.0</value> + <key>bits_per_symbol</key> + <value>1</value> </param> <param> - <key>omega_relative_limit</key> - <value>0.005</value> + <key>access_code</key> + <value></value> </param> <param> - <key>gray_coded</key> + <key>pad_for_usrp</key> <value>True</value> </param> <param> - <key>verbose</key> - <value>False</value> - </param> - <param> - <key>log</key> - <value>False</value> - </param> - <param> - <key>sync_out</key> - <value>False</value> + <key>payload_length</key> + <value>0</value> </param> <param> <key>_coordinate</key> - <value>(639, 254)</value> + <value>(541, 9)</value> </param> <param> <key>_rotation</key> @@ -303,10 +299,10 @@ </param> </block> <block> - <key>digital_dxpsk_mod</key> + <key>digital_dxpsk_demod</key> <param> <key>id</key> - <value>digital_dxpsk_mod_0</value> + <value>digital_dxpsk_demod_1</value> </param> <param> <key>_enabled</key> @@ -325,6 +321,22 @@ <value>0.35</value> </param> <param> + <key>freq_bw</key> + <value>6.28/100.0</value> + </param> + <param> + <key>phase_bw</key> + <value>6.28/100.0</value> + </param> + <param> + <key>timing_bw</key> + <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> </param> @@ -337,19 +349,23 @@ <value>False</value> </param> <param> + <key>sync_out</key> + <value>False</value> + </param> + <param> <key>_coordinate</key> - <value>(421, 294)</value> + <value>(746, 135)</value> </param> <param> <key>_rotation</key> - <value>0</value> + <value>180</value> </param> </block> <block> - <key>blks2_packet_encoder</key> + <key>blks2_packet_decoder</key> <param> <key>id</key> - <value>blks2_packet_encoder_0</value> + <value>blks2_packet_decoder_0</value> </param> <param> <key>_enabled</key> @@ -360,32 +376,20 @@ <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> <value></value> </param> <param> - <key>pad_for_usrp</key> - <value>True</value> - </param> - <param> - <key>payload_length</key> - <value>0</value> + <key>threshold</key> + <value>-1</value> </param> <param> <key>_coordinate</key> - <value>(216, 286)</value> + <value>(545, 187)</value> </param> <param> <key>_rotation</key> - <value>0</value> + <value>180</value> </param> </block> <block> @@ -456,46 +460,46 @@ </param> <param> <key>_coordinate</key> - <value>(760, 41)</value> + <value>(184, 165)</value> </param> <param> <key>_rotation</key> - <value>0</value> + <value>180</value> </param> </block> <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>blks2_packet_decoder_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_throttle_0_0</source_block_id> - <sink_block_id>blks2_packet_encoder_0</sink_block_id> + <source_block_id>blks2_packet_encoder_0</source_block_id> + <sink_block_id>digital_dxpsk_mod_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>digital_dxpsk_mod_1</source_block_id> + <sink_block_id>digital_dxpsk_demod_1</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>digital_dxpsk_demod_0</source_block_id> + <source_block_id>digital_dxpsk_demod_1</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>digital_dxpsk_mod_0</source_block_id> - <sink_block_id>digital_dxpsk_demod_0</sink_block_id> + <source_block_id>gr_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_encoder_0</source_block_id> - <sink_block_id>digital_dxpsk_mod_0</sink_block_id> + <source_block_id>gr_sig_source_x_0</source_block_id> + <sink_block_id>gr_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 new file mode 100644 index 0000000000..f74a835266 --- /dev/null +++ b/gr-digital/examples/demod/gfsk_loopback.grc @@ -0,0 +1,646 @@ +<?xml version='1.0' encoding='ASCII'?> +<flow_graph> + <timestamp>Sun Jul 8 16:56:18 2012</timestamp> + <block> + <key>variable_slider</key> + <param> + <key>id</key> + <value>freq</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>label</key> + <value>Frequency (Hz)</value> + </param> + <param> + <key>value</key> + <value>500</value> + </param> + <param> + <key>min</key> + <value>0</value> + </param> + <param> + <key>max</key> + <value>samp_rate/2</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> + </param> + <param> + <key>grid_pos</key> + <value></value> + </param> + <param> + <key>notebook</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(34, 241)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_sig_source_x</key> + <param> + <key>id</key> + <value>gr_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>gr.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>(215, 26)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_throttle</key> + <param> + <key>id</key> + <value>gr_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>(272.5, 142.0)</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>2</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>(261, 227)</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>10000</value> + </param> + <param> + <key>_coordinate</key> + <value>(10, 170)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>digital_gfsk_demod</key> + <param> + <key>id</key> + <value>digital_gfsk_demod_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>samples_per_symbol</key> + <value>sps</value> + </param> + <param> + <key>sensitivity</key> + <value>fm_sensitivity</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>(669, 257)</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>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> + </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> + </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>(40, 366)</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>(705, 130)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_quadrature_demod_cf</key> + <param> + <key>id</key> + <value>gr_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>(627, 417)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <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>wx_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>wxgui_scopesink2</key> + <param> + <key>id</key> + <value>wxgui_scopesink2_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>float</value> + </param> + <param> + <key>title</key> + <value>Scope Plot</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>1./freq</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> + </param> + <param> + <key>grid_pos</key> + <value></value> + </param> + <param> + <key>notebook</key> + <value></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>(907, 59)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>wxgui_scopesink2</key> + <param> + <key>id</key> + <value>wxgui_scopesink2_1</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>float</value> + </param> + <param> + <key>title</key> + <value>Scope Plot</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> + </param> + <param> + <key>grid_pos</key> + <value></value> + </param> + <param> + <key>notebook</key> + <value></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>(853, 400)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <connection> + <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>gr_sig_source_x_0</source_block_id> + <sink_block_id>gr_throttle_0_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_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_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_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_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> + <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_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 d7cca96617..b718fb68af 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>Tue Apr 3 18:01:57 2012</timestamp> + <timestamp>Thu Jul 5 16:28:45 2012</timestamp> <block> <key>options</key> <param> @@ -44,6 +44,10 @@ <value>True</value> </param> <param> + <key>max_nouts</key> + <value>0</value> + </param> + <param> <key>realtime_scheduling</key> <value></value> </param> @@ -405,6 +409,10 @@ <value>notebook, 1</value> </param> <param> + <key>freqvar</key> + <value>None</value> + </param> + <param> <key>_coordinate</key> <value>(847, 10)</value> </param> diff --git a/gr-digital/examples/demod/pam_sync.grc b/gr-digital/examples/demod/pam_sync.grc index 8571995a58..f870a0b067 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>Sat Mar 6 17:17:22 2010</timestamp> + <timestamp>Thu Jul 5 17:54:54 2012</timestamp> <block> <key>options</key> <param> @@ -44,12 +44,16 @@ <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> + <value>(-1, 0)</value> </param> <param> <key>_rotation</key> @@ -57,37 +61,22 @@ </param> </block> <block> - <key>gr_uchar_to_float</key> + <key>variable</key> <param> <key>id</key> - <value>gr_uchar_to_float_0</value> + <value>const</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>_coordinate</key> - <value>(217, 108)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_uchar_to_float</key> - <param> - <key>id</key> - <value>gr_uchar_to_float_0_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> + <key>value</key> + <value>digital.qpsk_constellation()</value> </param> <param> <key>_coordinate</key> - <value>(216, 273)</value> + <value>(336, -2)</value> </param> <param> <key>_rotation</key> @@ -98,7 +87,7 @@ <key>variable</key> <param> <key>id</key> - <value>samp_rate</value> + <value>rrctaps</value> </param> <param> <key>_enabled</key> @@ -106,11 +95,11 @@ </param> <param> <key>value</key> - <value>32000</value> + <value>firdes.root_raised_cosine(nfilts,1.0,1.0/(spb*nfilts), rolloff, int(11*spb*nfilts))</value> </param> <param> <key>_coordinate</key> - <value>(128, 9)</value> + <value>(686, -1)</value> </param> <param> <key>_rotation</key> @@ -118,54 +107,22 @@ </param> </block> <block> - <key>variable_slider</key> + <key>variable</key> <param> <key>id</key> - <value>freq_offset</value> + <value>rolloff</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></value> - </param> - <param> - <key>notebook</key> - <value></value> + <value>0.35</value> </param> <param> <key>_coordinate</key> - <value>(293, 684)</value> + <value>(607, -1)</value> </param> <param> <key>_rotation</key> @@ -173,38 +130,22 @@ </param> </block> <block> - <key>random_source_x</key> + <key>variable</key> <param> <key>id</key> - <value>random_source_x_0</value> + <value>spb</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>pam_amp</value> - </param> - <param> - <key>num_samps</key> - <value>10000</value> - </param> - <param> - <key>repeat</key> - <value>True</value> + <key>value</key> + <value>4.0</value> </param> <param> <key>_coordinate</key> - <value>(13, 80)</value> + <value>(542, -1)</value> </param> <param> <key>_rotation</key> @@ -212,38 +153,22 @@ </param> </block> <block> - <key>random_source_x</key> + <key>variable</key> <param> <key>id</key> - <value>random_source_x_0_0</value> + <value>sig_amp</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>pam_amp</value> - </param> - <param> - <key>num_samps</key> - <value>10000</value> - </param> - <param> - <key>repeat</key> - <value>True</value> + <key>value</key> + <value>1.0</value> </param> <param> <key>_coordinate</key> - <value>(15, 245)</value> + <value>(861, 0)</value> </param> <param> <key>_rotation</key> @@ -251,26 +176,22 @@ </param> </block> <block> - <key>const_source_x</key> + <key>virtual_sink</key> <param> <key>id</key> - <value>const_source_x_0</value> + <value>virtual_sink_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>const</key> - <value>-0.5*(pam_amp-1)</value> + <key>stream_id</key> + <value>input_signal_probe</value> </param> <param> <key>_coordinate</key> - <value>(213, 197)</value> + <value>(330, 183)</value> </param> <param> <key>_rotation</key> @@ -278,10 +199,10 @@ </param> </block> <block> - <key>const_source_x</key> + <key>gr_pfb_clock_sync_xxx</key> <param> <key>id</key> - <value>const_source_x_0_0</value> + <value>gr_pfb_clock_sync_xxx_0</value> </param> <param> <key>_enabled</key> @@ -289,46 +210,43 @@ </param> <param> <key>type</key> - <value>float</value> + <value>ccf</value> </param> <param> - <key>const</key> - <value>-0.5*(pam_amp-1)</value> + <key>sps</key> + <value>spb</value> </param> <param> - <key>_coordinate</key> - <value>(200, 360)</value> + <key>alpha</key> + <value>time_alpha</value> </param> <param> - <key>_rotation</key> - <value>0</value> + <key>beta</key> + <value>time_beta</value> </param> - </block> - <block> - <key>gr_add_xx</key> <param> - <key>id</key> - <value>gr_add_xx_0</value> + <key>taps</key> + <value>rrctaps</value> </param> <param> - <key>_enabled</key> - <value>True</value> + <key>filter_size</key> + <value>nfilts</value> </param> <param> - <key>type</key> - <value>float</value> + <key>init_phase</key> + <value>16</value> </param> <param> - <key>num_inputs</key> - <value>2</value> + <key>max_dev</key> + <value>1.5</value> </param> <param> - <key>vlen</key> + <key>osps</key> <value>1</value> </param> <param> <key>_coordinate</key> - <value>(440, 167)</value> + <value>(598, 241)</value> </param> <param> <key>_rotation</key> @@ -336,10 +254,10 @@ </param> </block> <block> - <key>gr_add_xx</key> + <key>digital_fll_band_edge_cc</key> <param> <key>id</key> - <value>gr_add_xx_0_1</value> + <value>digital_fll_band_edge_cc_0</value> </param> <param> <key>_enabled</key> @@ -347,19 +265,27 @@ </param> <param> <key>type</key> - <value>float</value> + <value>cc</value> </param> <param> - <key>num_inputs</key> - <value>2</value> + <key>samps_per_sym</key> + <value>spb</value> </param> <param> - <key>vlen</key> - <value>1</value> + <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>(430, 330)</value> + <value>(331, 239)</value> </param> <param> <key>_rotation</key> @@ -382,7 +308,7 @@ </param> <param> <key>_coordinate</key> - <value>(435, 686)</value> + <value>(598, 186)</value> </param> <param> <key>_rotation</key> @@ -390,54 +316,22 @@ </param> </block> <block> - <key>variable_slider</key> + <key>variable</key> <param> <key>id</key> - <value>noise_amp</value> + <value>samp_rate</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> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> + <value>128000</value> </param> <param> <key>_coordinate</key> - <value>(168, 684)</value> + <value>(193, -1)</value> </param> <param> <key>_rotation</key> @@ -445,77 +339,38 @@ </param> </block> <block> - <key>variable_slider</key> + <key>random_source_x</key> <param> <key>id</key> - <value>interpratio</value> + <value>random_source_x</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> + <key>type</key> + <value>byte</value> </param> <param> <key>min</key> - <value>0.99</value> + <value>0</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> + <value>const.arity()</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>(40, 684)</value> - </param> - <param> - <key>_rotation</key> - <value>180</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>pam_amp</value> + <key>num_samps</key> + <value>10000000</value> </param> <param> - <key>_enabled</key> + <key>repeat</key> <value>True</value> </param> <param> - <key>value</key> - <value>2</value> - </param> - <param> <key>_coordinate</key> - <value>(223, 9)</value> + <value>(0, 72)</value> </param> <param> <key>_rotation</key> @@ -523,45 +378,38 @@ </param> </block> <block> - <key>variable</key> + <key>gr_chunks_to_symbols_xx</key> <param> <key>id</key> - <value>sig_amp</value> + <value>gr_chunks_to_symbols_xx</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>value</key> - <value>1</value> + <key>in_type</key> + <value>byte</value> </param> <param> - <key>_coordinate</key> - <value>(315, 9)</value> + <key>out_type</key> + <value>complex</value> </param> <param> - <key>_rotation</key> - <value>0</value> + <key>symbol_table</key> + <value>const.points()</value> </param> - </block> - <block> - <key>variable</key> <param> - <key>id</key> - <value>rolloff</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> + <key>dimension</key> + <value>1</value> </param> <param> - <key>value</key> - <value>0.35</value> + <key>num_ports</key> + <value>1</value> </param> <param> <key>_coordinate</key> - <value>(397, 9)</value> + <value>(196, 87)</value> </param> <param> <key>_rotation</key> @@ -569,30 +417,30 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>blks2_pfb_arb_resampler_ccf</key> <param> <key>id</key> - <value>gr_throttle_0</value> + <value>blks2_pfb_arb_resampler_ccf_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>type</key> - <value>complex</value> + <key>rate</key> + <value>spb</value> </param> <param> - <key>samples_per_second</key> - <value>samp_rate</value> + <key>taps</key> + <value>firdes.root_raised_cosine(32, 32, 1.0, 0.35, 44*32)</value> </param> <param> - <key>vlen</key> - <value>1</value> + <key>size</key> + <value>32</value> </param> <param> <key>_coordinate</key> - <value>(253, 575)</value> + <value>(435, 80)</value> </param> <param> <key>_rotation</key> @@ -600,109 +448,69 @@ </param> </block> <block> - <key>variable_slider</key> + <key>gr_channel_model</key> <param> <key>id</key> - <value>time_beta</value> + <value>gr_channel_model_0</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> + <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>(606, 8)</value> + <value>(46, 183)</value> </param> <param> <key>_rotation</key> - <value>180</value> + <value>0</value> </param> </block> <block> - <key>variable_slider</key> + <key>gr_multiply_const_vxx</key> <param> <key>id</key> - <value>time_alpha</value> + <value>gr_multiply_const_vxx_0</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> + <key>type</key> + <value>complex</value> </param> <param> - <key>min</key> - <value>0</value> + <key>const</key> + <value>sig_amp</value> </param> <param> - <key>max</key> + <key>vlen</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>(490, 8)</value> + <value>(659, 95)</value> </param> <param> <key>_rotation</key> @@ -710,54 +518,30 @@ </param> </block> <block> - <key>variable_slider</key> + <key>gr_throttle</key> <param> <key>id</key> - <value>phase_alpha</value> + <value>gr_throttle_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>label</key> - <value>Phase Alpha</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> + <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>(953, 8)</value> + <value>(857, 95)</value> </param> <param> <key>_rotation</key> @@ -765,85 +549,41 @@ </param> </block> <block> - <key>variable_slider</key> + <key>virtual_source</key> <param> <key>id</key> - <value>phase_beta</value> + <value>virtual_source_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>label</key> - <value>Phase 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.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> + <key>stream_id</key> + <value>input_signal_probe</value> </param> <param> <key>_coordinate</key> - <value>(1066, 8)</value> + <value>(835, 562)</value> </param> <param> <key>_rotation</key> - <value>180</value> + <value>0</value> </param> </block> <block> - <key>gr_costas_loop_cc</key> + <key>digital_costas_loop_cc</key> <param> <key>id</key> - <value>gr_costas_loop_cc_0</value> + <value>digital_costas_loop_cc_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>alpha</key> - <value>phase_alpha</value> - </param> - <param> - <key>beta</key> - <value>phase_beta</value> - </param> - <param> - <key>max_freq</key> - <value>0.2</value> - </param> - <param> - <key>min_freq</key> - <value>-0.2</value> + <key>w</key> + <value>phase_bw</value> </param> <param> <key>order</key> @@ -851,7 +591,7 @@ </param> <param> <key>_coordinate</key> - <value>(915, 560)</value> + <value>(866, 246)</value> </param> <param> <key>_rotation</key> @@ -862,7 +602,7 @@ <key>wxgui_scopesink2</key> <param> <key>id</key> - <value>wxgui_scopesink2_0</value> + <value>wxgui_scopesink2_0_0_1</value> </param> <param> <key>_enabled</key> @@ -874,7 +614,7 @@ </param> <param> <key>title</key> - <value>Input Signal</value> + <value>Pre-sync Signal</value> </param> <param> <key>samp_rate</key> @@ -882,7 +622,7 @@ </param> <param> <key>v_scale</key> - <value>0</value> + <value>.5</value> </param> <param> <key>v_offset</key> @@ -914,34 +654,19 @@ </param> <param> <key>notebook</key> - <value>notebook_0,0</value> - </param> - <param> - <key>_coordinate</key> - <value>(1116, 559)</value> + <value>notebook_0,1</value> </param> <param> - <key>_rotation</key> - <value>0</value> + <key>trig_mode</key> + <value>gr.gr_TRIG_MODE_AUTO</value> </param> - </block> - <block> - <key>variable</key> <param> - <key>id</key> - <value>rrctaps</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>firdes.root_raised_cosine(nfilts,1.0,1.0/(spb*nfilts), rolloff, int(11*spb*nfilts))</value> + <key>y_axis_label</key> + <value>Counts</value> </param> <param> <key>_coordinate</key> - <value>(436, 755)</value> + <value>(1081, 439)</value> </param> <param> <key>_rotation</key> @@ -949,85 +674,70 @@ </param> </block> <block> - <key>notebook</key> + <key>wxgui_fftsink2</key> <param> <key>id</key> - <value>notebook_0</value> + <value>wxgui_fftsink2_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>['Output Signal', 'Input Signal']</value> - </param> - <param> - <key>grid_pos</key> - <value></value> + <key>type</key> + <value>complex</value> </param> <param> - <key>notebook</key> - <value></value> + <key>title</key> + <value>Received spectrum</value> </param> <param> - <key>_coordinate</key> - <value>(203, 823)</value> + <key>samp_rate</key> + <value>samp_rate</value> </param> <param> - <key>_rotation</key> + <key>baseband_freq</key> <value>0</value> </param> - </block> - <block> - <key>wxgui_scopesink2</key> - <param> - <key>id</key> - <value>wxgui_scopesink2_0_0_1</value> - </param> <param> - <key>_enabled</key> - <value>True</value> + <key>y_per_div</key> + <value>10</value> </param> <param> - <key>type</key> - <value>complex</value> + <key>y_divs</key> + <value>10</value> </param> <param> - <key>title</key> - <value>Input Signal</value> + <key>ref_level</key> + <value>10</value> </param> <param> - <key>samp_rate</key> - <value>samp_rate</value> + <key>ref_scale</key> + <value>2.0</value> </param> <param> - <key>v_scale</key> - <value>.5</value> + <key>fft_size</key> + <value>1024</value> </param> <param> - <key>v_offset</key> - <value>0</value> + <key>fft_rate</key> + <value>30</value> </param> <param> - <key>t_scale</key> - <value>0</value> + <key>peak_hold</key> + <value>False</value> </param> <param> - <key>ac_couple</key> + <key>average</key> <value>False</value> </param> <param> - <key>xy_mode</key> - <value>False</value> + <key>avg_alpha</key> + <value>0</value> </param> <param> - <key>num_inputs</key> - <value>1</value> + <key>win</key> + <value>None</value> </param> <param> <key>win_size</key> @@ -1042,8 +752,12 @@ <value>notebook_0,1</value> </param> <param> + <key>freqvar</key> + <value>None</value> + </param> + <param> <key>_coordinate</key> - <value>(975, 312)</value> + <value>(1081, 563)</value> </param> <param> <key>_rotation</key> @@ -1054,7 +768,7 @@ <key>wxgui_fftsink2</key> <param> <key>id</key> - <value>wxgui_fftsink2_0</value> + <value>wxgui_fftsink2_0_0</value> </param> <param> <key>_enabled</key> @@ -1066,7 +780,7 @@ </param> <param> <key>title</key> - <value>Input Frequency</value> + <value>Post-sync spectrum</value> </param> <param> <key>samp_rate</key> @@ -1126,195 +840,200 @@ </param> <param> <key>notebook</key> - <value>notebook_0,1</value> + <value>notebook_0,0</value> + </param> + <param> + <key>freqvar</key> + <value>None</value> </param> <param> <key>_coordinate</key> - <value>(1116, 355)</value> + <value>(347, 516)</value> </param> <param> <key>_rotation</key> - <value>0</value> + <value>180</value> </param> </block> <block> - <key>virtual_source</key> + <key>wxgui_scopesink2</key> <param> <key>id</key> - <value>virtual_source_0</value> + <value>wxgui_scopesink2_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>stream_id</key> - <value>input_signal_probe</value> + <key>type</key> + <value>complex</value> </param> <param> - <key>_coordinate</key> - <value>(801, 453)</value> + <key>title</key> + <value>Post-sync Signal</value> </param> <param> - <key>_rotation</key> - <value>0</value> + <key>samp_rate</key> + <value>samp_rate</value> </param> - </block> - <block> - <key>virtual_sink</key> <param> - <key>id</key> - <value>virtual_sink_0</value> + <key>v_scale</key> + <value>0</value> </param> <param> - <key>_enabled</key> - <value>True</value> + <key>v_offset</key> + <value>0</value> </param> <param> - <key>stream_id</key> - <value>input_signal_probe</value> + <key>t_scale</key> + <value>0</value> </param> <param> - <key>_coordinate</key> - <value>(280, 475)</value> + <key>ac_couple</key> + <value>False</value> </param> <param> - <key>_rotation</key> - <value>0</value> + <key>xy_mode</key> + <value>True</value> </param> - </block> - <block> - <key>wxgui_fftsink2</key> <param> - <key>id</key> - <value>wxgui_fftsink2_0_0</value> + <key>num_inputs</key> + <value>1</value> </param> <param> - <key>_enabled</key> - <value>True</value> + <key>win_size</key> + <value></value> </param> <param> - <key>type</key> - <value>complex</value> + <key>grid_pos</key> + <value></value> </param> <param> - <key>title</key> - <value>Output Frequency</value> + <key>notebook</key> + <value>notebook_0,0</value> </param> <param> - <key>samp_rate</key> - <value>samp_rate</value> + <key>trig_mode</key> + <value>gr.gr_TRIG_MODE_AUTO</value> </param> <param> - <key>baseband_freq</key> - <value>0</value> + <key>y_axis_label</key> + <value>Counts</value> </param> <param> - <key>y_per_div</key> - <value>10</value> + <key>_coordinate</key> + <value>(1085, 213)</value> </param> <param> - <key>y_divs</key> - <value>10</value> + <key>_rotation</key> + <value>0</value> </param> + </block> + <block> + <key>variable_slider</key> <param> - <key>ref_level</key> - <value>10</value> + <key>id</key> + <value>freq_bw</value> </param> <param> - <key>ref_scale</key> - <value>2.0</value> + <key>_enabled</key> + <value>True</value> </param> <param> - <key>fft_size</key> - <value>1024</value> + <key>label</key> + <value>FLL Bandwidth</value> </param> <param> - <key>fft_rate</key> - <value>30</value> + <key>value</key> + <value>0</value> </param> <param> - <key>peak_hold</key> - <value>False</value> + <key>min</key> + <value>0.0</value> </param> <param> - <key>average</key> - <value>False</value> + <key>max</key> + <value>0.05</value> </param> <param> - <key>avg_alpha</key> - <value>0</value> + <key>num_steps</key> + <value>1000</value> </param> <param> - <key>win</key> - <value>None</value> + <key>style</key> + <value>wx.SL_HORIZONTAL</value> </param> <param> - <key>win_size</key> - <value></value> + <key>converver</key> + <value>float_converter</value> </param> <param> <key>grid_pos</key> - <value></value> + <value>(4,2,1,1)</value> </param> <param> <key>notebook</key> - <value>notebook_0,0</value> + <value></value> </param> <param> <key>_coordinate</key> - <value>(663, 687)</value> + <value>(341, 373)</value> </param> <param> <key>_rotation</key> - <value>0</value> + <value>180</value> </param> </block> <block> - <key>gr_pfb_clock_sync_xxx</key> + <key>variable_slider</key> <param> <key>id</key> - <value>gr_pfb_clock_sync_xxx_0</value> + <value>time_alpha</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>type</key> - <value>ccf</value> + <key>label</key> + <value>Timing Alpha</value> </param> <param> - <key>sps</key> - <value>spb</value> + <key>value</key> + <value>0</value> </param> <param> - <key>alpha</key> - <value>time_alpha</value> + <key>min</key> + <value>0</value> </param> <param> - <key>beta</key> - <value>time_beta</value> + <key>max</key> + <value>1</value> </param> <param> - <key>taps</key> - <value>rrctaps</value> + <key>num_steps</key> + <value>1000</value> </param> <param> - <key>filter_size</key> - <value>nfilts</value> + <key>style</key> + <value>wx.SL_HORIZONTAL</value> </param> <param> - <key>init_phase</key> - <value>16</value> + <key>converver</key> + <value>float_converter</value> </param> <param> - <key>max_dev</key> - <value>1.5</value> + <key>grid_pos</key> + <value>(5,2,1,1)</value> + </param> + <param> + <key>notebook</key> + <value></value> </param> <param> <key>_coordinate</key> - <value>(662, 527)</value> + <value>(598, 388)</value> </param> <param> <key>_rotation</key> @@ -1322,92 +1041,109 @@ </param> </block> <block> - <key>gr_float_to_complex</key> + <key>variable_slider</key> <param> <key>id</key> - <value>gr_float_to_complex_0</value> + <value>time_beta</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(592, 184)</value> + <key>label</key> + <value>Timing Beta</value> </param> <param> - <key>_rotation</key> + <key>value</key> <value>0</value> </param> - </block> - <block> - <key>gr_channel_model</key> <param> - <key>id</key> - <value>gr_channel_model_0</value> + <key>min</key> + <value>0.0</value> </param> <param> - <key>_enabled</key> - <value>True</value> + <key>max</key> + <value>0.1</value> </param> <param> - <key>noise_voltage</key> - <value>noise_amp</value> + <key>num_steps</key> + <value>1000</value> </param> <param> - <key>freq_offset</key> - <value>freq_offset</value> + <key>style</key> + <value>wx.SL_HORIZONTAL</value> </param> <param> - <key>epsilon</key> - <value>interpratio</value> + <key>converver</key> + <value>float_converter</value> </param> <param> - <key>taps</key> - <value>1.0</value> + <key>grid_pos</key> + <value>(6,2,1,1)</value> </param> <param> - <key>seed</key> - <value>42</value> + <key>notebook</key> + <value></value> </param> <param> <key>_coordinate</key> - <value>(60, 443)</value> + <value>(708, 388)</value> </param> <param> <key>_rotation</key> - <value>0</value> + <value>180</value> </param> </block> <block> - <key>gr_multiply_const_vxx</key> + <key>variable_slider</key> <param> <key>id</key> - <value>gr_multiply_const_vxx_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>const</key> - <value>sig_amp</value> + <key>value</key> + <value>0</value> </param> <param> - <key>vlen</key> - <value>1</value> + <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>(7,2,1,1)</value> + </param> + <param> + <key>notebook</key> + <value></value> </param> <param> <key>_coordinate</key> - <value>(670, 322)</value> + <value>(866, 313)</value> </param> <param> <key>_rotation</key> @@ -1415,30 +1151,34 @@ </param> </block> <block> - <key>blks2_pfb_arb_resampler_ccf</key> + <key>notebook</key> <param> <key>id</key> - <value>blks2_pfb_arb_resampler_ccf_0</value> + <value>notebook_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>rate</key> - <value>spb</value> + <key>style</key> + <value>wx.NB_TOP</value> </param> <param> - <key>taps</key> - <value>firdes.root_raised_cosine(32, 32, 1.0, 0.35, 44*32)</value> + <key>labels</key> + <value>['Synched Signal', 'Received Signal']</value> </param> <param> - <key>size</key> - <value>32</value> + <key>grid_pos</key> + <value>(1,1,8,1)</value> + </param> + <param> + <key>notebook</key> + <value></value> </param> <param> <key>_coordinate</key> - <value>(778, 180)</value> + <value>(9, 601)</value> </param> <param> <key>_rotation</key> @@ -1446,76 +1186,65 @@ </param> </block> <block> - <key>gr_fll_band_edge_cc</key> + <key>variable_slider</key> <param> <key>id</key> - <value>gr_fll_band_edge_cc_0</value> + <value>interpratio</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> + <key>label</key> + <value>Timing Offset</value> </param> <param> - <key>filter_size</key> - <value>44</value> + <key>value</key> + <value>1.00</value> </param> <param> - <key>alpha</key> - <value>freq_alpha</value> + <key>min</key> + <value>0.99</value> </param> <param> - <key>beta</key> - <value>freq_beta</value> + <key>max</key> + <value>1.01</value> </param> <param> - <key>_coordinate</key> - <value>(429, 528)</value> + <key>num_steps</key> + <value>1000</value> </param> <param> - <key>_rotation</key> - <value>0</value> + <key>style</key> + <value>wx.SL_HORIZONTAL</value> </param> - </block> - <block> - <key>variable</key> <param> - <key>id</key> - <value>spb</value> + <key>converver</key> + <value>float_converter</value> </param> <param> - <key>_enabled</key> - <value>True</value> + <key>grid_pos</key> + <value>(3,2,1,1)</value> </param> <param> - <key>value</key> - <value>4.0</value> + <key>notebook</key> + <value></value> </param> <param> <key>_coordinate</key> - <value>(40, 829)</value> + <value>(60, 407)</value> </param> <param> <key>_rotation</key> - <value>0</value> + <value>180</value> </param> </block> <block> <key>variable_slider</key> <param> <key>id</key> - <value>freq_alpha</value> + <value>noise_amp</value> </param> <param> <key>_enabled</key> @@ -1523,7 +1252,7 @@ </param> <param> <key>label</key> - <value>Freq Alpha</value> + <value>Channel Noise</value> </param> <param> <key>value</key> @@ -1535,7 +1264,7 @@ </param> <param> <key>max</key> - <value>0.1</value> + <value>1.0</value> </param> <param> <key>num_steps</key> @@ -1551,7 +1280,7 @@ </param> <param> <key>grid_pos</key> - <value></value> + <value>(1,2,1,1)</value> </param> <param> <key>notebook</key> @@ -1559,7 +1288,7 @@ </param> <param> <key>_coordinate</key> - <value>(734, 10)</value> + <value>(125, 284)</value> </param> <param> <key>_rotation</key> @@ -1570,7 +1299,7 @@ <key>variable_slider</key> <param> <key>id</key> - <value>freq_beta</value> + <value>freq_offset</value> </param> <param> <key>_enabled</key> @@ -1578,7 +1307,7 @@ </param> <param> <key>label</key> - <value>Freq Beta</value> + <value>Frequency Offset</value> </param> <param> <key>value</key> @@ -1586,11 +1315,11 @@ </param> <param> <key>min</key> - <value>0.0</value> + <value>-0.5</value> </param> <param> <key>max</key> - <value>0.01</value> + <value>0.5</value> </param> <param> <key>num_steps</key> @@ -1606,7 +1335,7 @@ </param> <param> <key>grid_pos</key> - <value></value> + <value>(2,2,1,1)</value> </param> <param> <key>notebook</key> @@ -1614,130 +1343,88 @@ </param> <param> <key>_coordinate</key> - <value>(836, 9)</value> + <value>(6, 284)</value> </param> <param> <key>_rotation</key> - <value>180</value> + <value>0</value> </param> </block> <connection> - <source_block_id>random_source_x_0</source_block_id> - <sink_block_id>gr_uchar_to_float_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_uchar_to_float_0_0</source_block_id> - <sink_block_id>gr_add_xx_0_1</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>const_source_x_0_0</source_block_id> - <sink_block_id>gr_add_xx_0_1</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>random_source_x_0_0</source_block_id> - <sink_block_id>gr_uchar_to_float_0_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> + <sink_block_id>virtual_sink_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_add_xx_0</source_block_id> - <sink_block_id>gr_float_to_complex_0</sink_block_id> + <source_block_id>digital_fll_band_edge_cc_0</source_block_id> + <sink_block_id>gr_pfb_clock_sync_xxx_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_add_xx_0_1</source_block_id> - <sink_block_id>gr_float_to_complex_0</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>gr_uchar_to_float_0</source_block_id> - <sink_block_id>gr_add_xx_0</sink_block_id> + <source_block_id>gr_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> </connection> <connection> - <source_block_id>const_source_x_0</source_block_id> - <sink_block_id>gr_add_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>gr_throttle_0</source_block_id> - <sink_block_id>gr_fll_band_edge_cc_0</sink_block_id> + <source_block_id>digital_costas_loop_cc_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_fll_band_edge_cc_0</source_block_id> - <sink_block_id>gr_pfb_clock_sync_xxx_0</sink_block_id> + <source_block_id>blks2_pfb_arb_resampler_ccf_0</source_block_id> + <sink_block_id>gr_multiply_const_vxx_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> - <sink_block_id>gr_costas_loop_cc_0</sink_block_id> + <source_block_id>gr_chunks_to_symbols_xx</source_block_id> + <sink_block_id>blks2_pfb_arb_resampler_ccf_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_costas_loop_cc_0</source_block_id> - <sink_block_id>wxgui_scopesink2_0</sink_block_id> + <source_block_id>gr_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> </connection> <connection> - <source_block_id>gr_fll_band_edge_cc_0</source_block_id> + <source_block_id>digital_fll_band_edge_cc_0</source_block_id> <sink_block_id>wxgui_fftsink2_0_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> <source_block_id>virtual_source_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>virtual_source_0</source_block_id> <sink_block_id>wxgui_fftsink2_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>virtual_sink_0</sink_block_id> + <source_block_id>virtual_source_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>gr_float_to_complex_0</source_block_id> - <sink_block_id>blks2_pfb_arb_resampler_ccf_0</sink_block_id> + <source_block_id>random_source_x</source_block_id> + <sink_block_id>gr_chunks_to_symbols_xx</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>gr_throttle_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_multiply_const_vxx_0</source_block_id> - <sink_block_id>gr_channel_model_0</sink_block_id> + <sink_block_id>gr_throttle_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 02130f4815..14a7d403e3 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 Feb 1 18:54:46 2010</timestamp> + <timestamp>Thu Jul 5 17:55:51 2012</timestamp> <block> <key>options</key> <param> @@ -44,6 +44,10 @@ <value>True</value> </param> <param> + <key>max_nouts</key> + <value>0</value> + </param> + <param> <key>realtime_scheduling</key> <value></value> </param> @@ -749,6 +753,14 @@ <value></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>(1116, 500)</value> </param> @@ -792,7 +804,7 @@ <key>wxgui_scopesink2</key> <param> <key>id</key> - <value>wxgui_scopesink2_0_0</value> + <value>wxgui_scopesink2_0_0_0</value> </param> <param> <key>_enabled</key> @@ -804,7 +816,7 @@ </param> <param> <key>title</key> - <value>Error</value> + <value>Scope Plot</value> </param> <param> <key>samp_rate</key> @@ -812,7 +824,7 @@ </param> <param> <key>v_scale</key> - <value>3</value> + <value>9</value> </param> <param> <key>v_offset</key> @@ -844,11 +856,42 @@ </param> <param> <key>notebook</key> - <value>notebook_0,0</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>(1110, 651)</value> + <value>(1112, 881)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>rrctaps</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>firdes.root_raised_cosine(nfilts,1.0,1.0/(spb*nfilts), .35, int(11*spb*nfilts))</value> + </param> + <param> + <key>_coordinate</key> + <value>(513, 679)</value> </param> <param> <key>_rotation</key> @@ -859,7 +902,7 @@ <key>wxgui_scopesink2</key> <param> <key>id</key> - <value>wxgui_scopesink2_0_0_0</value> + <value>wxgui_scopesink2_0_0_1</value> </param> <param> <key>_enabled</key> @@ -867,11 +910,11 @@ </param> <param> <key>type</key> - <value>float</value> + <value>complex</value> </param> <param> <key>title</key> - <value>Scope Plot</value> + <value>Error</value> </param> <param> <key>samp_rate</key> @@ -879,7 +922,7 @@ </param> <param> <key>v_scale</key> - <value>9</value> + <value>.5</value> </param> <param> <key>v_offset</key> @@ -911,11 +954,19 @@ </param> <param> <key>notebook</key> - <value>notebook_0,1</value> + <value>notebook_0,3</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>(1112, 881)</value> + <value>(1115, 358)</value> </param> <param> <key>_rotation</key> @@ -923,22 +974,22 @@ </param> </block> <block> - <key>variable</key> + <key>gr_float_to_complex</key> <param> <key>id</key> - <value>rrctaps</value> + <value>gr_float_to_complex_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>value</key> - <value>firdes.root_raised_cosine(nfilts,1.0,1.0/(spb*nfilts), .35, int(11*spb*nfilts))</value> + <key>vlen</key> + <value>1</value> </param> <param> <key>_coordinate</key> - <value>(513, 679)</value> + <value>(590, 184)</value> </param> <param> <key>_rotation</key> @@ -946,50 +997,69 @@ </param> </block> <block> - <key>gr_pfb_clock_sync_xxx</key> + <key>blks2_pfb_arb_resampler_ccf</key> <param> <key>id</key> - <value>gr_pfb_clock_sync_xxx_0</value> + <value>blks2_pfb_arb_resampler_ccf_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>type</key> - <value>ccf</value> + <key>rate</key> + <value>spb</value> </param> <param> - <key>sps</key> - <value>spb</value> + <key>taps</key> + <value>firdes.root_raised_cosine(32, 32, 1.0, 0.35, 44*32)</value> </param> <param> - <key>alpha</key> - <value>alpha</value> + <key>size</key> + <value>32</value> </param> <param> - <key>beta</key> - <value>beta</value> + <key>_coordinate</key> + <value>(816, 181)</value> </param> <param> - <key>taps</key> - <value>rrctaps</value> + <key>_rotation</key> + <value>0</value> </param> + </block> + <block> + <key>gr_channel_model</key> <param> - <key>filter_size</key> - <value>nfilts</value> + <key>id</key> + <value>gr_channel_model_0</value> </param> <param> - <key>init_phase</key> - <value>16</value> + <key>_enabled</key> + <value>True</value> </param> <param> - <key>max_dev</key> - <value>1.5</value> + <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>(512, 527)</value> + <value>(59, 543)</value> </param> <param> <key>_rotation</key> @@ -997,10 +1067,10 @@ </param> </block> <block> - <key>wxgui_scopesink2</key> + <key>gr_multiply_const_vxx</key> <param> <key>id</key> - <value>wxgui_scopesink2_0_0_0_0</value> + <value>gr_multiply_const_vxx_0</value> </param> <param> <key>_enabled</key> @@ -1008,55 +1078,97 @@ </param> <param> <key>type</key> - <value>float</value> + <value>complex</value> </param> <param> - <key>title</key> - <value>Scope Plot</value> + <key>const</key> + <value>sig_amp</value> </param> <param> - <key>samp_rate</key> - <value>samp_rate</value> + <key>vlen</key> + <value>1</value> </param> <param> - <key>v_scale</key> - <value>1.25</value> + <key>_coordinate</key> + <value>(714, 382)</value> </param> <param> - <key>v_offset</key> + <key>_rotation</key> <value>0</value> </param> + </block> + <block> + <key>variable</key> <param> - <key>t_scale</key> + <key>id</key> + <value>spb</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>4.2563</value> + </param> + <param> + <key>_coordinate</key> + <value>(42, 840)</value> + </param> + <param> + <key>_rotation</key> <value>0</value> </param> + </block> + <block> + <key>gr_pfb_clock_sync_xxx</key> <param> - <key>ac_couple</key> - <value>False</value> + <key>id</key> + <value>gr_pfb_clock_sync_xxx_0</value> </param> <param> - <key>xy_mode</key> - <value>False</value> + <key>_enabled</key> + <value>True</value> </param> <param> - <key>num_inputs</key> - <value>1</value> + <key>type</key> + <value>ccf</value> </param> <param> - <key>win_size</key> - <value></value> + <key>sps</key> + <value>spb</value> </param> <param> - <key>grid_pos</key> - <value></value> + <key>alpha</key> + <value>alpha</value> </param> <param> - <key>notebook</key> - <value>notebook_0,2</value> + <key>beta</key> + <value>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>(1111, 767)</value> + <value>(512, 527)</value> </param> <param> <key>_rotation</key> @@ -1067,7 +1179,7 @@ <key>wxgui_scopesink2</key> <param> <key>id</key> - <value>wxgui_scopesink2_0_0_1</value> + <value>wxgui_scopesink2_0_0</value> </param> <param> <key>_enabled</key> @@ -1075,7 +1187,7 @@ </param> <param> <key>type</key> - <value>complex</value> + <value>float</value> </param> <param> <key>title</key> @@ -1087,7 +1199,7 @@ </param> <param> <key>v_scale</key> - <value>.5</value> + <value>3</value> </param> <param> <key>v_offset</key> @@ -1119,34 +1231,19 @@ </param> <param> <key>notebook</key> - <value>notebook_0,3</value> - </param> - <param> - <key>_coordinate</key> - <value>(1115, 358)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_float_to_complex</key> - <param> - <key>id</key> - <value>gr_float_to_complex_0</value> + <value>notebook_0,0</value> </param> <param> - <key>_enabled</key> - <value>True</value> + <key>trig_mode</key> + <value>gr.gr_TRIG_MODE_AUTO</value> </param> <param> - <key>vlen</key> - <value>1</value> + <key>y_axis_label</key> + <value>Counts</value> </param> <param> <key>_coordinate</key> - <value>(590, 184)</value> + <value>(1114, 615)</value> </param> <param> <key>_rotation</key> @@ -1154,123 +1251,74 @@ </param> </block> <block> - <key>blks2_pfb_arb_resampler_ccf</key> + <key>wxgui_scopesink2</key> <param> <key>id</key> - <value>blks2_pfb_arb_resampler_ccf_0</value> + <value>wxgui_scopesink2_0_0_0_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>rate</key> - <value>spb</value> + <key>type</key> + <value>float</value> </param> <param> - <key>taps</key> - <value>firdes.root_raised_cosine(32, 32, 1.0, 0.35, 44*32)</value> + <key>title</key> + <value>Scope Plot</value> </param> <param> - <key>size</key> - <value>32</value> + <key>samp_rate</key> + <value>samp_rate</value> </param> <param> - <key>_coordinate</key> - <value>(816, 181)</value> + <key>v_scale</key> + <value>1.25</value> </param> <param> - <key>_rotation</key> + <key>v_offset</key> <value>0</value> </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>(59, 543)</value> - </param> - <param> - <key>_rotation</key> + <key>t_scale</key> <value>0</value> </param> - </block> - <block> - <key>gr_multiply_const_vxx</key> <param> - <key>id</key> - <value>gr_multiply_const_vxx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> + <key>ac_couple</key> + <value>False</value> </param> <param> - <key>const</key> - <value>sig_amp</value> + <key>xy_mode</key> + <value>False</value> </param> <param> - <key>vlen</key> + <key>num_inputs</key> <value>1</value> </param> <param> - <key>_coordinate</key> - <value>(714, 382)</value> + <key>win_size</key> + <value></value> </param> <param> - <key>_rotation</key> - <value>0</value> + <key>grid_pos</key> + <value></value> </param> - </block> - <block> - <key>variable</key> <param> - <key>id</key> - <value>spb</value> + <key>notebook</key> + <value>notebook_0,2</value> </param> <param> - <key>_enabled</key> - <value>True</value> + <key>trig_mode</key> + <value>gr.gr_TRIG_MODE_AUTO</value> </param> <param> - <key>value</key> - <value>4.2563</value> + <key>y_axis_label</key> + <value>Counts</value> </param> <param> <key>_coordinate</key> - <value>(42, 840)</value> + <value>(1080, 751)</value> </param> <param> <key>_rotation</key> diff --git a/gr-digital/grc/digital_additive_scrambler_bb.xml b/gr-digital/grc/digital_additive_scrambler_bb.xml new file mode 100644 index 0000000000..5ae5ba06f0 --- /dev/null +++ b/gr-digital/grc/digital_additive_scrambler_bb.xml @@ -0,0 +1,44 @@ +<?xml version="1.0"?> +<!-- +################################################### +## Additive Scrambler +################################################### + --> +<block> + <name>Additive Scrambler</name> + <key>digital_additive_scrambler_bb</key> + <import>from gnuradio import digital</import> + <make>digital.additive_scrambler_bb($mask, $seed, $len, $count)</make> + <param> + <name>Mask</name> + <key>mask</key> + <value>0x8A</value> + <type>hex</type> + </param> + <param> + <name>Seed</name> + <key>seed</key> + <value>0x7F</value> + <type>hex</type> + </param> + <param> + <name>Length</name> + <key>len</key> + <value>7</value> + <type>int</type> + </param> + <param> + <name>Count</name> + <key>count</key> + <value>0</value> + <type>int</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_block_tree.xml b/gr-digital/grc/digital_block_tree.xml index 3ef4d0b1d0..9efa0d3fb5 100644 --- a/gr-digital/grc/digital_block_tree.xml +++ b/gr-digital/grc/digital_block_tree.xml @@ -30,19 +30,35 @@ <name></name> <!-- Blank for Root Name --> <cat> <name>Digital</name> + <block>digital_additive_scrambler_bb</block> <block>digital_binary_slicer_fb</block> + <block>digital_bytes_to_syms</block> + <block>digital_chunks_to_symbols_xx</block> <block>digital_clock_recovery_mm_xx</block> <block>digital_cma_equalizer_cc</block> <block>digital_constellation_decoder_cb</block> <block>digital_constellation_receiver_cb</block> <block>digital_correlate_access_code_bb</block> <block>digital_costas_loop_cc</block> + <block>digital_descrambler_bb</block> <block>digital_fll_band_edge_cc</block> + <block>digital_glfsr_source_x</block> <block>digital_kurtotic_equalizer_cc</block> <block>digital_lms_dd_equalizer_cc</block> + <block>digital_map_bb</block> <block>digital_mpsk_receiver_cc</block> <block>digital_mpsk_snr_est_cc</block> + <block>digital_pfb_clock_sync_xxx</block> + <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> + <block>digital_diff_decoder_bb</block> + <block>digital_diff_encoder_bb</block> + <block>digital_diff_phasor_cc</block> + <block>digital_framer_sink_1</block> + <block>digital_packet_sink</block> + <block>digital_simple_framer</block> </cat> <cat> <name>Digital Modulators</name> diff --git a/gr-digital/grc/digital_bytes_to_syms.xml b/gr-digital/grc/digital_bytes_to_syms.xml new file mode 100644 index 0000000000..fb17bb6def --- /dev/null +++ b/gr-digital/grc/digital_bytes_to_syms.xml @@ -0,0 +1,20 @@ +<?xml version="1.0"?> +<!-- +################################################### +## Bytes to Syms +################################################### + --> +<block> + <name>Bytes to Symbols</name> + <key>digital_bytes_to_syms</key> + <import>from gnuradio import digital</import> + <make>digital.bytes_to_syms()</make> + <sink> + <name>in</name> + <type>byte</type> + </sink> + <source> + <name>out</name> + <type>float</type> + </source> +</block> diff --git a/gr-digital/grc/digital_chunks_to_symbols.xml b/gr-digital/grc/digital_chunks_to_symbols.xml new file mode 100644 index 0000000000..494be274df --- /dev/null +++ b/gr-digital/grc/digital_chunks_to_symbols.xml @@ -0,0 +1,77 @@ +<?xml version="1.0"?> +<!-- +################################################### +##Chunks to Symbols +################################################### + --> +<block> + <name>Chunks to Symbols</name> + <key>digital_chunks_to_symbols_xx</key> + <import>from gnuradio import digital</import> + <make>digital.chunks_to_symbols_$(in_type.fcn)$(out_type.fcn)($symbol_table, $dimension)</make> + <param> + <name>Input Type</name> + <key>in_type</key> + <type>enum</type> + <option> + <name>Int</name> + <key>int</key> + <opt>fcn:i</opt> + </option> + <option> + <name>Short</name> + <key>short</key> + <opt>fcn:s</opt> + </option> + <option> + <name>Byte</name> + <key>byte</key> + <opt>fcn:b</opt> + </option> + </param> + <param> + <name>Output Type</name> + <key>out_type</key> + <type>enum</type> + <option> + <name>Complex</name> + <key>complex</key> + <opt>fcn:c</opt> + <opt>table:complex_vector</opt> + </option> + <option> + <name>Float</name> + <key>float</key> + <opt>fcn:f</opt> + <opt>table:real_vector</opt> + </option> + </param> + <param> + <name>Symbol Table</name> + <key>symbol_table</key> + <type>$out_type.table</type> + </param> + <param> + <name>Dimension</name> + <key>dimension</key> + <value>2</value> + <type>int</type> + </param> + <param> + <name>Num Ports</name> + <key>num_ports</key> + <value>1</value> + <type>int</type> + </param> + <check>$num_ports > 0</check> + <sink> + <name>in</name> + <type>$in_type</type> + <nports>$num_ports</nports> + </sink> + <source> + <name>out</name> + <type>$out_type</type> + <nports>$num_ports</nports> + </source> +</block> diff --git a/gr-digital/grc/digital_descrambler_bb.xml b/gr-digital/grc/digital_descrambler_bb.xml new file mode 100644 index 0000000000..4f52c79645 --- /dev/null +++ b/gr-digital/grc/digital_descrambler_bb.xml @@ -0,0 +1,38 @@ +<?xml version="1.0"?> +<!-- +################################################### +## Descrambler +################################################### + --> +<block> + <name>Descrambler</name> + <key>digital_descrambler_bb</key> + <import>from gnuradio import digital</import> + <make>digital.descrambler_bb($mask, $seed, $len)</make> + <param> + <name>Mask</name> + <key>mask</key> + <value>0x8A</value> + <type>hex</type> + </param> + <param> + <name>Seed</name> + <key>seed</key> + <value>0x7F</value> + <type>hex</type> + </param> + <param> + <name>Length</name> + <key>len</key> + <value>7</value> + <type>int</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_diff_decoder_bb.xml b/gr-digital/grc/digital_diff_decoder_bb.xml new file mode 100644 index 0000000000..a7c94b834c --- /dev/null +++ b/gr-digital/grc/digital_diff_decoder_bb.xml @@ -0,0 +1,25 @@ +<?xml version="1.0"?> +<!-- +################################################### +##Differential Decoder +################################################### + --> +<block> + <name>Differential Decoder</name> + <key>digital_diff_decoder_bb</key> + <import>from gnuradio import digital</import> + <make>digital.diff_decoder_bb($modulus)</make> + <param> + <name>Modulus</name> + <key>modulus</key> + <type>int</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_diff_encoder_bb.xml b/gr-digital/grc/digital_diff_encoder_bb.xml new file mode 100644 index 0000000000..3885bed9aa --- /dev/null +++ b/gr-digital/grc/digital_diff_encoder_bb.xml @@ -0,0 +1,25 @@ +<?xml version="1.0"?> +<!-- +################################################### +##Differential Encoder +################################################### + --> +<block> + <name>Differential Encoder</name> + <key>digital_diff_encoder_bb</key> + <import>from gnuradio import digital</import> + <make>digital.diff_encoder_bb($modulus)</make> + <param> + <name>Modulus</name> + <key>modulus</key> + <type>int</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_diff_phasor_cc.xml b/gr-digital/grc/digital_diff_phasor_cc.xml new file mode 100644 index 0000000000..506bf400ba --- /dev/null +++ b/gr-digital/grc/digital_diff_phasor_cc.xml @@ -0,0 +1,20 @@ +<?xml version="1.0"?> +<!-- +################################################### +##Differential Phasor +################################################### + --> +<block> + <name>Differential Phasor</name> + <key>digital_diff_phasor_cc</key> + <import>from gnuradio import digital</import> + <make>digital.diff_phasor_cc()</make> + <sink> + <name>in</name> + <type>complex</type> + </sink> + <source> + <name>out</name> + <type>complex</type> + </source> +</block> diff --git a/gr-digital/grc/digital_dxpsk_demod.xml b/gr-digital/grc/digital_dxpsk_demod.xml index cfd474f68f..f3e9ee6fcc 100644 --- a/gr-digital/grc/digital_dxpsk_demod.xml +++ b/gr-digital/grc/digital_dxpsk_demod.xml @@ -86,16 +86,10 @@ <type>real</type> </param> <param> - <name>Omega Relative Limit</name> - <key>omega_relative_limit</key> - <value>0.005</value> - <type>real</type> - </param> - <param> <name>Gray Code</name> <key>gray_coded</key> <value>True</value> - <type>bool</type> + <type>enum</type> <option> <name>Yes</name> <key>True</key> diff --git a/gr-digital/grc/digital_dxpsk_mod.xml b/gr-digital/grc/digital_dxpsk_mod.xml index fbda9fb1f9..93334d27d5 100644 --- a/gr-digital/grc/digital_dxpsk_mod.xml +++ b/gr-digital/grc/digital_dxpsk_mod.xml @@ -70,7 +70,7 @@ <name>Gray Code</name> <key>gray_coded</key> <value>True</value> - <type>bool</type> + <type>enum</type> <option> <name>Yes</name> <key>True</key> diff --git a/gr-digital/grc/digital_framer_sink_1.xml b/gr-digital/grc/digital_framer_sink_1.xml new file mode 100644 index 0000000000..9124e6d0dc --- /dev/null +++ b/gr-digital/grc/digital_framer_sink_1.xml @@ -0,0 +1,21 @@ +<?xml version="1.0"?> +<!-- +################################################### +## Framer Sink 1 +################################################### + --> +<block> + <name>Framer Sink 1</name> + <key>digital_framer_sink_1</key> + <import>from gnuradio import digital</import> + <make>digital.framer_sink_1($target_queue)</make> + <param> + <name>Target Message Queue</name> + <key>target_queue</key> + <type>raw</type> + </param> + <sink> + <name>in</name> + <type>byte</type> + </sink> +</block> diff --git a/gr-digital/grc/digital_gfsk_demod.xml b/gr-digital/grc/digital_gfsk_demod.xml new file mode 100644 index 0000000000..ce3024d892 --- /dev/null +++ b/gr-digital/grc/digital_gfsk_demod.xml @@ -0,0 +1,95 @@ +<?xml version="1.0"?> +<!-- +################################################### +##GFSK Demod +################################################### + --> +<block> + <name>GFSK Demod</name> + <key>digital_gfsk_demod</key> + <import>from gnuradio import digital</import> + <make>digital.gfsk_demod( + samples_per_symbol=$samples_per_symbol, + sensitivity=$sensitivity, + gain_mu=$gain_mu, + mu=$mu, + omega_relative_limit=$omega_relative_limit, + freq_error=$freq_error, + verbose=$verbose, + log=$log, +)</make> + <param> + <name>Samples/Symbol</name> + <key>samples_per_symbol</key> + <value>2</value> + <type>int</type> + </param> + <param> + <name>Sensitivity</name> + <key>sensitivity</key> + <value>1.0</value> + <type>real</type> + </param> + <param> + <name>Gain Mu</name> + <key>gain_mu</key> + <value>0.175</value> + <type>real</type> + </param> + <param> + <name>Mu</name> + <key>mu</key> + <value>0.5</value> + <type>real</type> + </param> + <param> + <name>Omega Relative Limit</name> + <key>omega_relative_limit</key> + <value>0.005</value> + <type>real</type> + </param> + <param> + <name>Freq Error</name> + <key>freq_error</key> + <value>0.0</value> + <type>real</type> + </param> + <param> + <name>Verbose</name> + <key>verbose</key> + <value>False</value> + <type>bool</type> + <hide>#if str($verbose) == 'False' then 'part' else 'none'#</hide> + <option> + <name>On</name> + <key>True</key> + </option> + <option> + <name>Off</name> + <key>False</key> + </option> + </param> + <param> + <name>Logging</name> + <key>log</key> + <value>False</value> + <type>bool</type> + <hide>#if str($log) == 'False' then 'part' else 'none'#</hide> + <option> + <name>On</name> + <key>True</key> + </option> + <option> + <name>Off</name> + <key>False</key> + </option> + </param> + <sink> + <name>in</name> + <type>complex</type> + </sink> + <source> + <name>out</name> + <type>byte</type> + </source> +</block> diff --git a/gr-digital/grc/digital_gfsk_mod.xml b/gr-digital/grc/digital_gfsk_mod.xml new file mode 100644 index 0000000000..2d6cd1ea54 --- /dev/null +++ b/gr-digital/grc/digital_gfsk_mod.xml @@ -0,0 +1,74 @@ +<?xml version="1.0"?> +<!-- +################################################### +##GFSK Mod +################################################### + --> +<block> + <name>GFSK Mod</name> + <key>digital_gfsk_mod</key> + <import>from gnuradio import digital</import> + <make>digital.gfsk_mod( + samples_per_symbol=$samples_per_symbol, + sensitivity=$sensitivity, + bt=$bt, + verbose=$verbose, + log=$log, +)</make> + <param> + <name>Samples/Symbol</name> + <key>samples_per_symbol</key> + <value>2</value> + <type>int</type> + </param> + <param> + <name>Sensitivity</name> + <key>sensitivity</key> + <value>1.0</value> + <type>real</type> + </param> + <param> + <name>BT</name> + <key>bt</key> + <value>0.35</value> + <type>real</type> + </param> + <param> + <name>Verbose</name> + <key>verbose</key> + <value>False</value> + <type>bool</type> + <hide>#if str($verbose) == 'False' then 'part' else 'none'#</hide> + <option> + <name>On</name> + <key>True</key> + </option> + <option> + <name>Off</name> + <key>False</key> + </option> + </param> + <param> + <name>Logging</name> + <key>log</key> + <value>False</value> + <type>bool</type> + <hide>#if str($log) == 'False' then 'part' else 'none'#</hide> + <option> + <name>On</name> + <key>True</key> + </option> + <option> + <name>Off</name> + <key>False</key> + </option> + </param> + <sink> + <name>in</name> + <type>byte</type> + </sink> + <source> + <name>out</name> + <type>complex</type> + </source> +</block> diff --git a/gr-digital/grc/digital_glfsr_source_x.xml b/gr-digital/grc/digital_glfsr_source_x.xml new file mode 100644 index 0000000000..654dfa71c0 --- /dev/null +++ b/gr-digital/grc/digital_glfsr_source_x.xml @@ -0,0 +1,61 @@ +<?xml version="1.0"?> +<!-- +################################################### +##GLFSR Source +################################################### + --> +<block> + <name>GLFSR Source</name> + <key>digital_glfsr_source_x</key> + <import>from gnuradio import digital</import> + <make>digital.glfsr_source_$(type.fcn)($degree, $repeat, $mask, $seed)</make> + <param> + <name>Type</name> + <key>type</key> + <type>enum</type> + <option> + <name>Float</name> + <key>float</key> + <opt>fcn:f</opt> + </option> + <option> + <name>Byte</name> + <key>byte</key> + <opt>fcn:b</opt> + </option> + </param> + <param> + <name>Degree</name> + <key>degree</key> + <type>int</type> + </param> + <param> + <name>Repeat</name> + <key>repeat</key> + <type>enum</type> + <option> + <name>Yes</name> + <key>True</key> + </option> + <option> + <name>No</name> + <key>False</key> + </option> + </param> + <param> + <name>Mask</name> + <key>mask</key> + <value>0</value> + <type>int</type> + </param> + <param> + <name>Seed</name> + <key>seed</key> + <value>1</value> + <type>int</type> + </param> + <source> + <name>out</name> + <type>$type</type> + </source> +</block> diff --git a/gr-digital/grc/digital_map_bb.xml b/gr-digital/grc/digital_map_bb.xml new file mode 100644 index 0000000000..1435c5ac78 --- /dev/null +++ b/gr-digital/grc/digital_map_bb.xml @@ -0,0 +1,25 @@ +<?xml version="1.0"?> +<!-- +################################################### +##Map +################################################### + --> +<block> + <name>Map</name> + <key>digital_map_bb</key> + <import>from gnuradio import digital</import> + <make>digital.map_bb($map)</make> + <param> + <name>Map</name> + <key>map</key> + <type>int_vector</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_mpsk_receiver_cc.xml b/gr-digital/grc/digital_mpsk_receiver_cc.xml index ab7e5c2091..bd738fccc3 100644 --- a/gr-digital/grc/digital_mpsk_receiver_cc.xml +++ b/gr-digital/grc/digital_mpsk_receiver_cc.xml @@ -7,7 +7,7 @@ <block> <name>MPSK Receiver</name> <key>digital_mpsk_receiver_cc</key> - <import>from gnuradio import digital</import> + <import>from gnuradio import digital;import cmath</import> <make>digital.mpsk_receiver_cc($M, $theta, $w, $fmin, $fmax, $mu, $gain_mu, $omega, $gain_omega, $omega_relative_limit)</make> <callback>set_loop_bandwidth($w)</callback> <callback>set_mu($mu)</callback> @@ -17,51 +17,61 @@ <param> <name>M</name> <key>M</key> + <value>4</value> <type>int</type> </param> <param> <name>Theta</name> <key>theta</key> + <value>0</value> <type>real</type> </param> <param> <name>Loop Bandwidth</name> <key>w</key> + <value>cmath.pi/100.0</value> <type>real</type> </param> <param> <name>Min Freq</name> <key>fmin</key> + <value>-0.5</value> <type>real</type> </param> <param> <name>Max Freq</name> <key>fmax</key> + <value>0.5</value> <type>real</type> </param> <param> <name>Mu</name> <key>mu</key> + <value>0.25</value> <type>real</type> </param> <param> <name>Gain Mu</name> <key>gain_mu</key> + <value>0.01</value> <type>real</type> </param> <param> <name>Omega</name> <key>omega</key> + <value>2</value> <type>real</type> </param> <param> <name>Gain Omega</name> <key>gain_omega</key> + <value>0.001</value> <type>real</type> </param> <param> <name>Omega Relative Limit</name> <key>omega_relative_limit</key> + <value>0.001</value> <type>real</type> </param> <sink> @@ -72,4 +82,5 @@ <name>out</name> <type>complex</type> </source> + </block> diff --git a/gr-digital/grc/digital_ofdm_insert_preamble.xml b/gr-digital/grc/digital_ofdm_insert_preamble.xml index 33a93058f9..9ad8fa793b 100644 --- a/gr-digital/grc/digital_ofdm_insert_preamble.xml +++ b/gr-digital/grc/digital_ofdm_insert_preamble.xml @@ -48,10 +48,16 @@ <sink> <name>flag</name> <type>byte</type> + <optional>1</optional> </sink> <source> <name>out</name> <type>complex</type> <vlen>$fft_length</vlen> </source> + <source> + <name>flag</name> + <type>byte</type> + <optional>1</optional> + </source> </block> diff --git a/gr-digital/grc/digital_packet_sink.xml b/gr-digital/grc/digital_packet_sink.xml new file mode 100644 index 0000000000..e9231bd059 --- /dev/null +++ b/gr-digital/grc/digital_packet_sink.xml @@ -0,0 +1,31 @@ +<?xml version="1.0"?> +<!-- +################################################### +## Packet Sink +################################################### + --> +<block> + <name>Packet Sink</name> + <key>digital_packet_sink</key> + <import>from gnuradio import digital</import> + <make>digital.packet_sink($sync_vector, $target_queue, $threshold)</make> + <param> + <name>Sync Vector</name> + <key>sync_vector</key> + <type>int_vector</type> + </param> + <param> + <name>Target Message Queue</name> + <key>target_queue</key> + <type>raw</type> + </param> + <param> + <name>Threshold</name> + <key>threshold</key> + <type>int</type> + </param> + <sink> + <name>in</name> + <type>float</type> + </sink> +</block> diff --git a/gr-digital/grc/digital_pfb_clock_sync.xml b/gr-digital/grc/digital_pfb_clock_sync.xml new file mode 100644 index 0000000000..9e2a4cd5ef --- /dev/null +++ b/gr-digital/grc/digital_pfb_clock_sync.xml @@ -0,0 +1,104 @@ +<?xml version="1.0"?> +<!-- +################################################### +## Polyphase Filter based Clock Sync +################################################### + --> +<block> + <name>Polyphase Clock Sync</name> + <key>digital_pfb_clock_sync_xxx</key> + <import>from gnuradio import digital</import> + <make>digital.pfb_clock_sync_$(type)($sps, $alpha, $taps, $filter_size, $init_phase, $max_dev, $osps) +self.$(id).set_beta($beta)</make> + <callback>set_taps($taps)</callback> + <callback>set_alpha($alpha)</callback> + <callback>set_beta($beta)</callback> + + <param> + <name>Type</name> + <key>type</key> + <type>enum</type> + <option> + <name>Complex->Complex (Real Taps)</name> + <key>ccf</key> + <opt>input:complex</opt> + <opt>output:complex</opt> + <opt>taps:real_vector</opt> + </option> + <option> + <name>Float->Float (Real Taps)</name> + <key>fff</key> + <opt>input:float</opt> + <opt>output:float</opt> + <opt>taps:real_vector</opt> + </option> + </param> + + <param> + <name>Samples/Symbol</name> + <key>sps</key> + <type>real</type> + </param> + <param> + <name>Alpha</name> + <key>alpha</key> + <type>real</type> + </param> + <param> + <name>Beta</name> + <key>beta</key> + <type>real</type> + </param> + <param> + <name>Taps</name> + <key>taps</key> + <type>real_vector</type> + </param> + <param> + <name>Filter Size</name> + <key>filter_size</key> + <value>32</value> + <type>int</type> + </param> + <param> + <name>Initial Phase</name> + <key>init_phase</key> + <value>16</value> + <type>real</type> + </param> + <param> + <name>Maximum Rate Deviation</name> + <key>max_dev</key> + <value>1.5</value> + <type>real</type> + </param> + <param> + <name>Output SPS</name> + <key>osps</key> + <value>1</value> + <type>int</type> + </param> + <sink> + <name>in</name> + <type>$type.input</type> + </sink> + <source> + <name>out</name> + <type>$type.output</type> + </source> + <source> + <name>err</name> + <type>float</type> + <optional>1</optional> + </source> + <source> + <name>rate</name> + <type>float</type> + <optional>1</optional> + </source> + <source> + <name>phase</name> + <type>float</type> + <optional>1</optional> + </source> +</block> diff --git a/gr-digital/grc/digital_pn_correlator_cc.xml b/gr-digital/grc/digital_pn_correlator_cc.xml new file mode 100644 index 0000000000..999cea15d9 --- /dev/null +++ b/gr-digital/grc/digital_pn_correlator_cc.xml @@ -0,0 +1,37 @@ +<?xml version="1.0"?> +<!-- +################################################### +##PN Correlator +################################################### + --> +<block> + <name>PN Correlator</name> + <key>digital_pn_correlator_cc</key> + <import>from gnuradio import digital</import> + <make>digital.pn_correlator_cc($degree, $mask, $seed)</make> + <param> + <name>Degree</name> + <key>degree</key> + <type>int</type> + </param> + <param> + <name>Mask</name> + <key>mask</key> + <value>0</value> + <type>int</type> + </param> + <param> + <name>Seed</name> + <key>seed</key> + <value>1</value> + <type>int</type> + </param> + <sink> + <name>in</name> + <type>complex</type> + </sink> + <source> + <name>out</name> + <type>complex</type> + </source> +</block> diff --git a/gr-digital/grc/digital_probe_density_b.xml b/gr-digital/grc/digital_probe_density_b.xml new file mode 100644 index 0000000000..8cf5dd8943 --- /dev/null +++ b/gr-digital/grc/digital_probe_density_b.xml @@ -0,0 +1,29 @@ +<?xml version="1.0"?> +<!-- +################################################### +##Probe Density +################################################### + --> +<block> + <name>Probe Density</name> + <key>digital_probe_density_b</key> + <import>from gnuradio import digital</import> + <make>digital.probe_density_b($alpha)</make> + <callback>set_alpha($alpha)</callback> + <param> + <name>Alpha</name> + <key>alpha</key> + <value>1</value> + <type>real</type> + </param> + <param> + <name>Probe Rate</name> + <key>probe_rate</key> + <value>10</value> + <type>real</type> + </param> + <sink> + <name>in</name> + <type>byte</type> + </sink> +</block> diff --git a/gr-digital/grc/digital_psk_demod.xml b/gr-digital/grc/digital_psk_demod.xml index 7e0773a986..2e0e86ebc6 100644 --- a/gr-digital/grc/digital_psk_demod.xml +++ b/gr-digital/grc/digital_psk_demod.xml @@ -37,7 +37,7 @@ excess_bw=$excess_bw, phase_bw=$phase_bw, timing_bw=$timing_bw, - gray_coded=$gray_coded, + mod_code=$mod_code, verbose=$verbose, log=$log, )</make> @@ -93,7 +93,7 @@ </param> <param> <name>Gray Code</name> - <key>gray_coded</key> + <key>mod_code</key> <type>enum</type> <option> <name>Yes</name> diff --git a/gr-digital/grc/digital_qam_demod.xml b/gr-digital/grc/digital_qam_demod.xml index 86080fff79..5aaec1bd0a 100644 --- a/gr-digital/grc/digital_qam_demod.xml +++ b/gr-digital/grc/digital_qam_demod.xml @@ -38,7 +38,7 @@ freq_bw=$freq_bw, timing_bw=$timing_bw, phase_bw=$phase_bw, - gray_coded=$gray_coded, + mod_code=$mod_code, verbose=$verbose, log=$log, )</make> diff --git a/gr-digital/grc/digital_scrambler_bb.xml b/gr-digital/grc/digital_scrambler_bb.xml new file mode 100644 index 0000000000..9c40b49f64 --- /dev/null +++ b/gr-digital/grc/digital_scrambler_bb.xml @@ -0,0 +1,38 @@ +<?xml version="1.0"?> +<!-- +################################################### +##Descrambler +################################################### + --> +<block> + <name>Scrambler</name> + <key>digital_scrambler_bb</key> + <import>from gnuradio import digital</import> + <make>digital.scrambler_bb($mask, $seed, $len)</make> + <param> + <name>Mask</name> + <key>mask</key> + <value>0x8A</value> + <type>hex</type> + </param> + <param> + <name>Seed</name> + <key>seed</key> + <value>0x7F</value> + <type>hex</type> + </param> + <param> + <name>Length</name> + <key>len</key> + <value>7</value> + <type>int</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_simple_framer.xml b/gr-digital/grc/digital_simple_framer.xml new file mode 100644 index 0000000000..bbeed32d3e --- /dev/null +++ b/gr-digital/grc/digital_simple_framer.xml @@ -0,0 +1,25 @@ +<?xml version="1.0"?> +<!-- +################################################### +##Simple Framer +################################################### + --> +<block> + <name>Simple Framer</name> + <key>digital_simple_framer</key> + <import>from gnuradio import gr</import> + <make>gr.simple_framer($payload_bytesize)</make> + <param> + <name>Payload Byte Size</name> + <key>payload_bytesize</key> + <type>int</type> + </param> + <sink> + <name>in</name> + <type>byte</type> + </sink> + <source> + <name>out</name> + <type>byte</type> + </source> +</block> diff --git a/gr-digital/include/CMakeLists.txt b/gr-digital/include/CMakeLists.txt index 81ed8d368e..f863b28757 100644 --- a/gr-digital/include/CMakeLists.txt +++ b/gr-digital/include/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2011 Free Software Foundation, Inc. +# Copyright 2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -17,25 +17,94 @@ # 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_cma_equalizer_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 @@ -45,9 +114,16 @@ install(FILES 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_gmskmod_bc.h - digital_cpmmod_bc.h + digital_scrambler_bb.h + digital_simple_framer.h + digital_simple_framer_sync.h DESTINATION ${GR_INCLUDE_DIR}/gnuradio 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..d4bd7d4ae8 --- /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_GR_ADDITIVE_SCRAMBLER_BB_H +#define INCLUDED_GR_ADDITIVE_SCRAMBLER_BB_H + +#include <digital_api.h> +#include <gr_sync_block.h> +#include <gri_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); + + gri_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_bytes_to_syms.h b/gr-digital/include/digital_bytes_to_syms.h new file mode 100644 index 0000000000..3062366b95 --- /dev/null +++ b/gr-digital/include/digital_bytes_to_syms.h @@ -0,0 +1,62 @@ +/* -*- 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 new file mode 100644 index 0000000000..92b7c94d58 --- /dev/null +++ b/gr-digital/include/digital_chunks_to_symbols_XX.h.t @@ -0,0 +1,75 @@ +/* -*- 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_correlate_access_code_tag_bb.h b/gr-digital/include/digital_correlate_access_code_tag_bb.h new file mode 100644 index 0000000000..b4a12108f4 --- /dev/null +++ b/gr-digital/include/digital_correlate_access_code_tag_bb.h @@ -0,0 +1,89 @@ +/* -*- 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_cpmmod_bc.h b/gr-digital/include/digital_cpmmod_bc.h index 332856afce..f0f11ee30e 100644 --- a/gr-digital/include/digital_cpmmod_bc.h +++ b/gr-digital/include/digital_cpmmod_bc.h @@ -74,9 +74,10 @@ digital_make_cpmmod_bc(int type, float h, */ 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); + 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; diff --git a/gr-digital/include/digital_descrambler_bb.h b/gr-digital/include/digital_descrambler_bb.h new file mode 100644 index 0000000000..b719803f33 --- /dev/null +++ b/gr-digital/include/digital_descrambler_bb.h @@ -0,0 +1,62 @@ +/* -*- 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 "gri_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); + + gri_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_diff_decoder_bb.h b/gr-digital/include/digital_diff_decoder_bb.h new file mode 100644 index 0000000000..928035d0e7 --- /dev/null +++ b/gr-digital/include/digital_diff_decoder_bb.h @@ -0,0 +1,56 @@ +/* -*- 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. + */ + +#ifndef INCLUDED_GR_DIFF_DECODER_BB_H +#define INCLUDED_GR_DIFF_DECODER_BB_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 diff --git a/gr-digital/include/digital_diff_encoder_bb.h b/gr-digital/include/digital_diff_encoder_bb.h new file mode 100644 index 0000000000..d4be69cadd --- /dev/null +++ b/gr-digital/include/digital_diff_encoder_bb.h @@ -0,0 +1,57 @@ +/* -*- 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. + */ + +#ifndef INCLUDED_GR_DIFF_ENCODER_BB_H +#define INCLUDED_GR_DIFF_ENCODER_BB_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 diff --git a/gr-digital/include/digital_diff_phasor_cc.h b/gr-digital/include/digital_diff_phasor_cc.h new file mode 100644 index 0000000000..32a2464b28 --- /dev/null +++ b/gr-digital/include/digital_diff_phasor_cc.h @@ -0,0 +1,59 @@ +/* -*- 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. + */ + +#ifndef INCLUDED_GR_DIFF_PHASOR_CC_H +#define INCLUDED_GR_DIFF_PHASOR_CC_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 diff --git a/gr-digital/include/digital_fll_band_edge_cc.h b/gr-digital/include/digital_fll_band_edge_cc.h index c70bfc86d4..68083bbaeb 100644 --- a/gr-digital/include/digital_fll_band_edge_cc.h +++ b/gr-digital/include/digital_fll_band_edge_cc.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2009,2011 Free Software Foundation, Inc. + * Copyright 2009,2011,2012 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -27,13 +27,19 @@ #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); +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 @@ -86,7 +92,8 @@ DIGITAL_API digital_fll_band_edge_cc_sptr digital_make_fll_band_edge_cc (float s * */ -class DIGITAL_API digital_fll_band_edge_cc : public gr_sync_block, public gri_control_loop +class DIGITAL_API digital_fll_band_edge_cc : + public gr_sync_block, public gri_control_loop { private: /*! @@ -96,10 +103,11 @@ class DIGITAL_API digital_fll_band_edge_cc : public gr_sync_block, public gri_co * \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); + 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; @@ -108,6 +116,10 @@ class DIGITAL_API digital_fll_band_edge_cc : public gr_sync_block, public gri_co 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 @@ -130,7 +142,7 @@ class DIGITAL_API digital_fll_band_edge_cc : public gr_sync_block, public gri_co void design_filter(float samps_per_sym, float rolloff, int filter_size); public: - ~digital_fll_band_edge_cc (); + ~digital_fll_band_edge_cc(); /******************************************************************* SET FUNCTIONS @@ -206,9 +218,9 @@ public: */ void print_taps(); - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); + 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 new file mode 100644 index 0000000000..bb82bf5a73 --- /dev/null +++ b/gr-digital/include/digital_framer_sink_1.h @@ -0,0 +1,107 @@ +/* -*- 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 new file mode 100644 index 0000000000..92e5e81f5c --- /dev/null +++ b/gr-digital/include/digital_glfsr_source_b.h @@ -0,0 +1,78 @@ +/* -*- 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 new file mode 100644 index 0000000000..77d7b0f741 --- /dev/null +++ b/gr-digital/include/digital_glfsr_source_f.h @@ -0,0 +1,78 @@ +/* -*- 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_impl_glfsr.h b/gr-digital/include/digital_impl_glfsr.h new file mode 100644 index 0000000000..3aadf7cf2f --- /dev/null +++ b/gr-digital/include/digital_impl_glfsr.h @@ -0,0 +1,57 @@ +/* -*- 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_IMPL_GLFSR_H +#define INCLUDED_DIGITAL_IMPL_GLFSR_H + +#include <digital_api.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 + */ + +class DIGITAL_API digital_impl_glfsr +{ + private: + int d_shift_register; + int d_mask; + + public: + + digital_impl_glfsr(int mask, int seed) { d_shift_register = seed; d_mask = mask; } + 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; } +}; + +#endif /* INCLUDED_DIGITAL_IMPL_GLFSR_H */ diff --git a/gr-digital/include/digital_map_bb.h b/gr-digital/include/digital_map_bb.h new file mode 100644 index 0000000000..4aca66fbe1 --- /dev/null +++ b/gr-digital/include/digital_map_bb.h @@ -0,0 +1,62 @@ +/* -*- 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. + */ +#ifndef INCLUDED_GR_MAP_BB_H +#define INCLUDED_GR_MAP_BB_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); +}; + +#endif /* INCLUDED_GR_MAP_BB_H */ diff --git a/gr-digital/include/digital_ofdm_insert_preamble.h b/gr-digital/include/digital_ofdm_insert_preamble.h index 6f9dae5d6b..fa44558add 100644 --- a/gr-digital/include/digital_ofdm_insert_preamble.h +++ b/gr-digital/include/digital_ofdm_insert_preamble.h @@ -88,18 +88,20 @@ private: int d_pending_flag; void enter_idle(); - void enter_preamble(); 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_packet_sink.h b/gr-digital/include/digital_packet_sink.h new file mode 100644 index 0000000000..7ab41c0ef7 --- /dev/null +++ b/gr-digital/include/digital_packet_sink.h @@ -0,0 +1,131 @@ +/* -*- 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 new file mode 100644 index 0000000000..1b403ab253 --- /dev/null +++ b/gr-digital/include/digital_pfb_clock_sync_ccf.h @@ -0,0 +1,376 @@ +/* -*- 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 new file mode 100644 index 0000000000..c7e8babd69 --- /dev/null +++ b/gr-digital/include/digital_pfb_clock_sync_fff.h @@ -0,0 +1,376 @@ +/* -*- 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 new file mode 100644 index 0000000000..87cc2ff93c --- /dev/null +++ b/gr-digital/include/digital_pn_correlator_cc.h @@ -0,0 +1,72 @@ +/* -*- 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 new file mode 100644 index 0000000000..271ad2a072 --- /dev/null +++ b/gr-digital/include/digital_probe_density_b.h @@ -0,0 +1,75 @@ +/* -*- 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_scrambler_bb.h b/gr-digital/include/digital_scrambler_bb.h new file mode 100644 index 0000000000..d6f08dcc83 --- /dev/null +++ b/gr-digital/include/digital_scrambler_bb.h @@ -0,0 +1,62 @@ +/* -*- 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 "gri_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); + + gri_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_framer.h b/gr-digital/include/digital_simple_framer.h new file mode 100644 index 0000000000..b622ae5dd4 --- /dev/null +++ b/gr-digital/include/digital_simple_framer.h @@ -0,0 +1,66 @@ +/* -*- 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 new file mode 100644 index 0000000000..4120035827 --- /dev/null +++ b/gr-digital/include/digital_simple_framer_sync.h @@ -0,0 +1,51 @@ +/* -*- 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 779972ff3a..bd4f1a5004 100644 --- a/gr-digital/lib/CMakeLists.txt +++ b/gr-digital/lib/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2011 Free Software Foundation, Inc. +# Copyright 2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -23,29 +23,102 @@ include_directories( ${GNURADIO_CORE_INCLUDE_DIRS} ${GR_DIGITAL_INCLUDE_DIRS} + ${CMAKE_CURRENT_BINARY_DIR}/../include ) include_directories(${Boost_INCLUDE_DIRS}) link_directories(${Boost_LIBRARY_DIRS}) + +######################################################################## +# 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_cc root) + #make a list of all the generated files + unset(expanded_files_cc) + unset(expanded_files_h) + 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) + endforeach(sig) + + #create a command to generate the files + add_custom_command( + OUTPUT ${expanded_files_cc} + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.cc.t + COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} + ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py + ${root} ${root}.cc.t ${ARGN} + ) + + #make source files depends on headers to force generation + set_source_files_properties(${expanded_files_cc} + PROPERTIES OBJECT_DEPENDS "${expanded_files_h}" + ) + + #install rules for the generated cc files + list(APPEND generated_sources ${expanded_files_cc}) +endmacro(expand_cc) + +######################################################################## +# Invoke macro to generate various sources +######################################################################## +expand_cc(digital_chunks_to_symbols_XX bf bc sf sc if ic) + ######################################################################## # Setup library ######################################################################## list(APPEND gr_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_cma_equalizer_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 @@ -54,9 +127,14 @@ list(APPEND gr_digital_sources 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_gmskmod_bc.cc - digital_cpmmod_bc.cc + digital_scrambler_bb.cc + digital_simple_framer.cc ) list(APPEND digital_libs @@ -67,3 +145,5 @@ list(APPEND digital_libs add_library(gnuradio-digital SHARED ${gr_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) diff --git a/gr-digital/lib/digital_additive_scrambler_bb.cc b/gr-digital/lib/digital_additive_scrambler_bb.cc new file mode 100644 index 0000000000..a8affaa78f --- /dev/null +++ b/gr-digital/lib/digital_additive_scrambler_bb.cc @@ -0,0 +1,69 @@ +/* -*- 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 new file mode 100644 index 0000000000..f8bd82d5b8 --- /dev/null +++ b/gr-digital/lib/digital_bytes_to_syms.cc @@ -0,0 +1,74 @@ +/* -*- 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 new file mode 100644 index 0000000000..399a474a62 --- /dev/null +++ b/gr-digital/lib/digital_chunks_to_symbols_XX.cc.t @@ -0,0 +1,74 @@ +/* -*- 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_correlate_access_code_tag_bb.cc b/gr-digital/lib/digital_correlate_access_code_tag_bb.cc new file mode 100644 index 0000000000..95f06534e3 --- /dev/null +++ b/gr-digital/lib/digital_correlate_access_code_tag_bb.cc @@ -0,0 +1,131 @@ +/* -*- 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_descrambler_bb.cc b/gr-digital/lib/digital_descrambler_bb.cc new file mode 100644 index 0000000000..68cba7145e --- /dev/null +++ b/gr-digital/lib/digital_descrambler_bb.cc @@ -0,0 +1,56 @@ +/* -*- 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 new file mode 100644 index 0000000000..7b8e8726ac --- /dev/null +++ b/gr-digital/lib/digital_diff_decoder_bb.cc @@ -0,0 +1,61 @@ +/* -*- 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 new file mode 100644 index 0000000000..bfbaba98fb --- /dev/null +++ b/gr-digital/lib/digital_diff_encoder_bb.cc @@ -0,0 +1,62 @@ +/* -*- 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_diff_phasor_cc.cc b/gr-digital/lib/digital_diff_phasor_cc.cc new file mode 100644 index 0000000000..8313a4de89 --- /dev/null +++ b/gr-digital/lib/digital_diff_phasor_cc.cc @@ -0,0 +1,61 @@ +/* -*- 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_phasor_cc.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()); +} + +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); +} + + +digital_diff_phasor_cc::~digital_diff_phasor_cc(){} + +int +digital_diff_phasor_cc::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. + + for(int i = 0; i < noutput_items; i++) { + out[i] = in[i] * conj(in[i-1]); + } + + 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 index 05c092622a..f2cfb1020a 100644 --- a/gr-digital/lib/digital_fll_band_edge_cc.cc +++ b/gr-digital/lib/digital_fll_band_edge_cc.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2009-2011 Free Software Foundation, Inc. + * Copyright 2009-2012 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -50,37 +50,38 @@ digital_make_fll_band_edge_cc (float samps_per_sym, float rolloff, 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)), +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) + 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."); + 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]."); + 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."); + 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 () +digital_fll_band_edge_cc::~digital_fll_band_edge_cc() { } @@ -93,7 +94,7 @@ 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."); + 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); @@ -103,7 +104,7 @@ 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]."); + 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); @@ -113,7 +114,7 @@ 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."); + 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); @@ -185,6 +186,8 @@ digital_fll_band_edge_cc::design_filter(float samps_per_sym, // 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 @@ -206,23 +209,25 @@ digital_fll_band_edge_cc::print_taps() } int -digital_fll_band_edge_cc::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) +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]; + 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]; + frq = (float*)output_items[1]; + phs = (float*)output_items[2]; + err = (float*)output_items[3]; } - if (d_updated) { + if(d_updated) { d_updated = false; return 0; // history requirements may have changed. } @@ -231,17 +236,19 @@ digital_fll_band_edge_cc::work (int noutput_items, 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); - out[i+d_filter_size-1] = in[i] * nco_out; - + 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; - for(int k = 0; k < d_filter_size; k++) { - out_upper += d_taps_upper[k] * out[i+k]; - out_lower += d_taps_lower[k] * out[i+k]; - } + + 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); @@ -255,5 +262,10 @@ digital_fll_band_edge_cc::work (int noutput_items, } } + 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 new file mode 100644 index 0000000000..ba1c5bd50e --- /dev/null +++ b/gr-digital/lib/digital_framer_sink_1.cc @@ -0,0 +1,192 @@ +/* -*- 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 new file mode 100644 index 0000000000..e557e475a8 --- /dev/null +++ b/gr-digital/lib/digital_glfsr_source_b.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 <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 new file mode 100644 index 0000000000..5a7736ef8d --- /dev/null +++ b/gr-digital/lib/digital_glfsr_source_f.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 <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_impl_glfsr.cc b/gr-digital/lib/digital_impl_glfsr.cc new file mode 100644 index 0000000000..342980e535 --- /dev/null +++ b/gr-digital/lib/digital_impl_glfsr.cc @@ -0,0 +1,67 @@ +/* -*- 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_map_bb.cc b/gr-digital/lib/digital_map_bb.cc new file mode 100644 index 0000000000..1d8444a405 --- /dev/null +++ b/gr-digital/lib/digital_map_bb.cc @@ -0,0 +1,61 @@ +/* -*- 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_ofdm_insert_preamble.cc b/gr-digital/lib/digital_ofdm_insert_preamble.cc index a46133643d..72b9e82a82 100644 --- a/gr-digital/lib/digital_ofdm_insert_preamble.cc +++ b/gr-digital/lib/digital_ofdm_insert_preamble.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2007,2010,2011 Free Software Foundation, Inc. + * Copyright 2007,2010-2012 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -41,7 +41,7 @@ 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(2, 2, + gr_make_io_signature2(1, 2, sizeof(gr_complex)*fft_length, sizeof(char)), gr_make_io_signature2(1, 2, @@ -54,8 +54,8 @@ digital_ofdm_insert_preamble::digital_ofdm_insert_preamble 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) + 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"); } @@ -67,15 +67,22 @@ 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) +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 = std::min(ninput_items_v[0], ninput_items_v[1]); + 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 = (const unsigned char *) input_items[1]; + 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; @@ -97,14 +104,14 @@ digital_ofdm_insert_preamble::general_work (int noutput_items, while (no < noutput_items && ni < ninput_items){ switch(d_state){ case ST_IDLE: - if (in_flag[ni] & 0x1) // this is first symbol of new payload + 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[ni] & 0x1); + assert(!in_flag || in_flag[ni] & 0x1); if (d_nsymbols_output >= (int) d_preamble.size()){ // we've output all the preamble enter_first_payload(); @@ -133,7 +140,7 @@ digital_ofdm_insert_preamble::general_work (int noutput_items, break; case ST_PAYLOAD: - if (in_flag[ni] & 0x1){ // this is first symbol of a new payload + if (in_flag && in_flag[ni] & 0x1){ // this is first symbol of a new payload enter_preamble(); break; } diff --git a/gr-digital/lib/digital_packet_sink.cc b/gr-digital/lib/digital_packet_sink.cc new file mode 100644 index 0000000000..92521376fd --- /dev/null +++ b/gr-digital/lib/digital_packet_sink.cc @@ -0,0 +1,207 @@ +/* -*- 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 new file mode 100644 index 0000000000..1a2d5970ba --- /dev/null +++ b/gr-digital/lib/digital_pfb_clock_sync_ccf.cc @@ -0,0 +1,440 @@ +/* -*- 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 new file mode 100644 index 0000000000..0e7d2a52da --- /dev/null +++ b/gr-digital/lib/digital_pfb_clock_sync_fff.cc @@ -0,0 +1,434 @@ +/* -*- 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 new file mode 100644 index 0000000000..43a3ddbd1f --- /dev/null +++ b/gr-digital/lib/digital_pn_correlator_cc.cc @@ -0,0 +1,80 @@ +/* -*- 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 new file mode 100644 index 0000000000..6b83d2ddb7 --- /dev/null +++ b/gr-digital/lib/digital_probe_density_b.cc @@ -0,0 +1,68 @@ +/* -*- 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_scrambler_bb.cc b/gr-digital/lib/digital_scrambler_bb.cc new file mode 100644 index 0000000000..c81b09d8c3 --- /dev/null +++ b/gr-digital/lib/digital_scrambler_bb.cc @@ -0,0 +1,57 @@ +/* -*- 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_framer.cc b/gr-digital/lib/digital_simple_framer.cc new file mode 100644 index 0000000000..5c194543ca --- /dev/null +++ b/gr-digital/lib/digital_simple_framer.cc @@ -0,0 +1,102 @@ +/* -*- 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/python/CMakeLists.txt b/gr-digital/python/CMakeLists.txt index c786b5a142..6a9f102955 100644 --- a/gr-digital/python/CMakeLists.txt +++ b/gr-digital/python/CMakeLists.txt @@ -30,6 +30,7 @@ GR_PYTHON_INSTALL( crc.py generic_mod_demod.py gmsk.py + gfsk.py modulation_utils.py ofdm.py ofdm_packet_utils.py diff --git a/gr-digital/python/__init__.py b/gr-digital/python/__init__.py index 3599fe91c1..662bb2d8f8 100644 --- a/gr-digital/python/__init__.py +++ b/gr-digital/python/__init__.py @@ -30,6 +30,7 @@ from qam import * from bpsk import * from qpsk import * from gmsk import * +from gfsk import * from cpm import * from pkt import * from crc import * diff --git a/gr-digital/python/generic_mod_demod.py b/gr-digital/python/generic_mod_demod.py index ae876e1086..a6c4f3445a 100644 --- a/gr-digital/python/generic_mod_demod.py +++ b/gr-digital/python/generic_mod_demod.py @@ -28,7 +28,7 @@ Generic modulation and demodulation. from gnuradio import gr from modulation_utils import extract_kwargs_from_options_for_class from utils import mod_codes -import digital_swig +import digital_swig as digital import math # default values (used in __init__ and add_options) @@ -121,12 +121,12 @@ class generic_mod(gr.hier_block2): gr.packed_to_unpacked_bb(self.bits_per_symbol(), gr.GR_MSB_FIRST) if gray_coded == True: - self.symbol_mapper = gr.map_bb(self._constellation.pre_diff_code()) + self.symbol_mapper = digital.map_bb(self._constellation.pre_diff_code()) if differential: - self.diffenc = gr.diff_encoder_bb(arity) + self.diffenc = digital.diff_encoder_bb(arity) - self.chunks2symbols = gr.chunks_to_symbols_bc(self._constellation.points()) + self.chunks2symbols = digital.chunks_to_symbols_bc(self._constellation.points()) # pulse shaping filter nfilts = 32 @@ -269,28 +269,28 @@ class generic_demod(gr.hier_block2): # Frequency correction fll_ntaps = 55 - self.freq_recov = digital_swig.fll_band_edge_cc(self._samples_per_symbol, self._excess_bw, - fll_ntaps, self._freq_bw) + self.freq_recov = digital.fll_band_edge_cc(self._samples_per_symbol, self._excess_bw, + 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) - self.time_recov = gr.pfb_clock_sync_ccf(self._samples_per_symbol, - self._timing_bw, taps, - nfilts, nfilts//2, self._timing_max_dev) + self.time_recov = digital.pfb_clock_sync_ccf(self._samples_per_symbol, + self._timing_bw, taps, + nfilts, nfilts//2, self._timing_max_dev) fmin = -0.25 fmax = 0.25 - self.receiver = digital_swig.constellation_receiver_cb( + self.receiver = digital.constellation_receiver_cb( self._constellation, self._phase_bw, fmin, fmax) # Do differential decoding based on phase change of symbols if differential: - self.diffdec = gr.diff_decoder_bb(arity) + self.diffdec = digital.diff_decoder_bb(arity) if gray_coded: - self.symbol_mapper = gr.map_bb( + 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 diff --git a/gr-digital/python/gfsk.py b/gr-digital/python/gfsk.py new file mode 100644 index 0000000000..c85fdf0e00 --- /dev/null +++ b/gr-digital/python/gfsk.py @@ -0,0 +1,306 @@ +# +# GFSK modulation and demodulation. +# +# +# Copyright 2005,2006,2007 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 gnuradio-examples/python/digital for examples + +from gnuradio import gr +import modulation_utils +import digital_swig as digital +from math import pi +import numpy +from pprint import pprint +import inspect + +# default values (used in __init__ and add_options) +_def_samples_per_symbol = 2 +_def_sensitivity = 1 +_def_bt = 0.35 +_def_verbose = False +_def_log = False + +_def_gain_mu = None +_def_mu = 0.5 +_def_freq_error = 0.0 +_def_omega_relative_limit = 0.005 + + +# FIXME: Figure out how to make GFSK work with pfb_arb_resampler_fff for both +# transmit and receive so we don't require integer samples per symbol. + + +# ///////////////////////////////////////////////////////////////////////////// +# GFSK modulator +# ///////////////////////////////////////////////////////////////////////////// + +class gfsk_mod(gr.hier_block2): + + def __init__(self, + samples_per_symbol=_def_samples_per_symbol, + sensitivity=_def_sensitivity, + bt=_def_bt, + verbose=_def_verbose, + log=_def_log): + """ + Hierarchical block for Gaussian Frequency Shift Key (GFSK) + 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, "gfsk_mod", + gr.io_signature(1, 1, gr.sizeof_char), # Input signature + gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature + + samples_per_symbol = int(samples_per_symbol) + self._samples_per_symbol = samples_per_symbol + self._bt = bt + self._differential = False + + if not isinstance(samples_per_symbol, int) or samples_per_symbol < 2: + raise TypeError, ("samples_per_symbol must be an integer >= 2, is %r" % (samples_per_symbol,)) + + ntaps = 4 * samples_per_symbol # up to 3 bits in filter at once + #sensitivity = (pi / 2) / samples_per_symbol # phase change per bit = pi / 2 + + # Turn it into NRZ data. + self.nrz = gr.bytes_to_syms() + + # Form Gaussian filter + # Generate Gaussian response (Needs to be convolved with window below). + self.gaussian_taps = gr.firdes.gaussian( + 1.0, # gain + samples_per_symbol, # symbol_rate + bt, # bandwidth * symbol time + ntaps # number of taps + ) + + 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) + + # FM modulation + self.fmmod = gr.frequency_modulator_fc(sensitivity) + + # small amount of output attenuation to prevent clipping USRP sink + self.amp = gr.multiply_const_cc(0.999) + + if verbose: + self._print_verbage() + + if log: + self._setup_logging() + + # Connect & Initialize base class + self.connect(self, self.nrz, self.gaussian_filter, self.fmmod, self.amp, self) + + def samples_per_symbol(self): + return self._samples_per_symbol + + def bits_per_symbol(self=None): # staticmethod that's also callable on an instance + return 1 + bits_per_symbol = staticmethod(bits_per_symbol) # make it a static method. + + + def _print_verbage(self): + print "bits per symbol = %d" % self.bits_per_symbol() + print "Gaussian filter bt = %.2f" % self._bt + + + def _setup_logging(self): + print "Modulation logging turned on." + self.connect(self.nrz, + gr.file_sink(gr.sizeof_float, "nrz.dat")) + self.connect(self.gaussian_filter, + gr.file_sink(gr.sizeof_float, "gaussian_filter.dat")) + self.connect(self.fmmod, + gr.file_sink(gr.sizeof_gr_complex, "fmmod.dat")) + + + def add_options(parser): + """ + Adds GFSK modulation-specific options to the standard parser + """ + parser.add_option("", "--bt", type="float", default=_def_bt, + help="set bandwidth-time product [default=%default] (GFSK)") + add_options=staticmethod(add_options) + + + def extract_kwargs_from_options(options): + """ + Given command line options, create dictionary suitable for passing to __init__ + """ + return modulation_utils.extract_kwargs_from_options(gfsk_mod.__init__, + ('self',), options) + extract_kwargs_from_options=staticmethod(extract_kwargs_from_options) + + + +# ///////////////////////////////////////////////////////////////////////////// +# GFSK demodulator +# ///////////////////////////////////////////////////////////////////////////// + +class gfsk_demod(gr.hier_block2): + + def __init__(self, + samples_per_symbol=_def_samples_per_symbol, + sensitivity=_def_sensitivity, + gain_mu=_def_gain_mu, + mu=_def_mu, + omega_relative_limit=_def_omega_relative_limit, + freq_error=_def_freq_error, + verbose=_def_verbose, + log=_def_log): + """ + Hierarchical block for Gaussian Minimum Shift Key (GFSK) + 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, "gfsk_demod", + gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature + gr.io_signature(1, 1, gr.sizeof_char)) # Output signature + + self._samples_per_symbol = samples_per_symbol + self._gain_mu = gain_mu + self._mu = mu + self._omega_relative_limit = omega_relative_limit + self._freq_error = freq_error + self._differential = False + + if samples_per_symbol < 2: + raise TypeError, "samples_per_symbol >= 2, is %f" % samples_per_symbol + + self._omega = samples_per_symbol*(1+self._freq_error) + + if not self._gain_mu: + self._gain_mu = 0.175 + + self._gain_omega = .25 * self._gain_mu * self._gain_mu # critically damped + + # Demodulate FM + #sensitivity = (pi / 2) / samples_per_symbol + self.fmdemod = gr.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) + self.clock_recovery = digital.clock_recovery_mm_ff(self._omega, self._gain_omega, + self._mu, self._gain_mu, + self._omega_relative_limit) + + # slice the floats at 0, outputting 1 bit (the LSB of the output byte) per sample + self.slicer = digital.binary_slicer_fb() + + if verbose: + self._print_verbage() + + if log: + self._setup_logging() + + # Connect & Initialize base class + self.connect(self, self.fmdemod, self.clock_recovery, self.slicer, self) + + def samples_per_symbol(self): + return self._samples_per_symbol + + def bits_per_symbol(self=None): # staticmethod that's also callable on an instance + return 1 + bits_per_symbol = staticmethod(bits_per_symbol) # make it a static method. + + + def _print_verbage(self): + print "bits per symbol = %d" % self.bits_per_symbol() + print "M&M clock recovery omega = %f" % self._omega + print "M&M clock recovery gain mu = %f" % self._gain_mu + print "M&M clock recovery mu = %f" % self._mu + print "M&M clock recovery omega rel. limit = %f" % self._omega_relative_limit + print "frequency error = %f" % self._freq_error + + + def _setup_logging(self): + print "Demodulation logging turned on." + self.connect(self.fmdemod, + gr.file_sink(gr.sizeof_float, "fmdemod.dat")) + self.connect(self.clock_recovery, + gr.file_sink(gr.sizeof_float, "clock_recovery.dat")) + self.connect(self.slicer, + gr.file_sink(gr.sizeof_char, "slicer.dat")) + + def add_options(parser): + """ + Adds GFSK demodulation-specific options to the standard parser + """ + parser.add_option("", "--gain-mu", type="float", default=_def_gain_mu, + help="M&M clock recovery gain mu [default=%default] (GFSK/PSK)") + parser.add_option("", "--mu", type="float", default=_def_mu, + help="M&M clock recovery mu [default=%default] (GFSK/PSK)") + parser.add_option("", "--omega-relative-limit", type="float", default=_def_omega_relative_limit, + help="M&M clock recovery omega relative limit [default=%default] (GFSK/PSK)") + parser.add_option("", "--freq-error", type="float", default=_def_freq_error, + help="M&M clock recovery frequency error [default=%default] (GFSK)") + add_options=staticmethod(add_options) + + def extract_kwargs_from_options(options): + """ + Given command line options, create dictionary suitable for passing to __init__ + """ + return modulation_utils.extract_kwargs_from_options(gfsk_demod.__init__, + ('self',), options) + extract_kwargs_from_options=staticmethod(extract_kwargs_from_options) + + +# +# Add these to the mod/demod registry +# +modulation_utils.add_type_1_mod('gfsk', gfsk_mod) +modulation_utils.add_type_1_demod('gfsk', gfsk_demod) diff --git a/gr-digital/python/qa_bytes_to_syms.py b/gr-digital/python/qa_bytes_to_syms.py new file mode 100755 index 0000000000..75475a95b2 --- /dev/null +++ b/gr-digital/python/qa_bytes_to_syms.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python +# +# Copyright 2004,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. +# + +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 () + + def tearDown (self): + self.tb = None + + 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) + +if __name__ == '__main__': + gr_unittest.run(test_bytes_to_syms, "test_bytes_to_syms.xml") + diff --git a/gr-digital/python/qa_chunks_to_symbols.py b/gr-digital/python/qa_chunks_to_symbols.py new file mode 100755 index 0000000000..63af10d8ff --- /dev/null +++ b/gr-digital/python/qa_chunks_to_symbols.py @@ -0,0 +1,140 @@ +#!/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. +# + +from gnuradio import gr, gr_unittest +import digital_swig as digital + +class test_chunks_to_symbols(gr_unittest.TestCase): + + def setUp (self): + self.tb = gr.top_block () + + def tearDown (self): + self.tb = None + + def test_bc_001(self): + const = [ 1+0j, 0+1j, + -1+0j, 0-1j] + src_data = (0, 1, 2, 3, 3, 2, 1, 0) + expected_result = (1+0j, 0+1j, -1+0j, 0-1j, + 0-1j, -1+0j, 0+1j, 1+0j) + + src = gr.vector_source_b(src_data) + op = digital.chunks_to_symbols_bc(const) + + dst = gr.vector_sink_c() + self.tb.connect(src, op) + self.tb.connect(op, dst) + self.tb.run() + + actual_result = dst.data() + self.assertEqual(expected_result, actual_result) + + def test_bf_002(self): + const = [-3, -1, 1, 3] + src_data = (0, 1, 2, 3, 3, 2, 1, 0) + expected_result = (-3, -1, 1, 3, + 3, 1, -1, -3) + + src = gr.vector_source_b(src_data) + op = digital.chunks_to_symbols_bf(const) + + dst = gr.vector_sink_f() + self.tb.connect(src, op) + self.tb.connect(op, dst) + self.tb.run() + + actual_result = dst.data() + self.assertEqual(expected_result, actual_result) + + def test_ic_003(self): + const = [ 1+0j, 0+1j, + -1+0j, 0-1j] + src_data = (0, 1, 2, 3, 3, 2, 1, 0) + expected_result = (1+0j, 0+1j, -1+0j, 0-1j, + 0-1j, -1+0j, 0+1j, 1+0j) + + src = gr.vector_source_i(src_data) + op = digital.chunks_to_symbols_ic(const) + + dst = gr.vector_sink_c() + self.tb.connect(src, op) + self.tb.connect(op, dst) + self.tb.run() + + actual_result = dst.data() + self.assertEqual(expected_result, actual_result) + + def test_if_004(self): + const = [-3, -1, 1, 3] + src_data = (0, 1, 2, 3, 3, 2, 1, 0) + expected_result = (-3, -1, 1, 3, + 3, 1, -1, -3) + + src = gr.vector_source_i(src_data) + op = digital.chunks_to_symbols_if(const) + + dst = gr.vector_sink_f() + self.tb.connect(src, op) + self.tb.connect(op, dst) + self.tb.run() + + actual_result = dst.data() + self.assertEqual(expected_result, actual_result) + + def test_sc_005(self): + const = [ 1+0j, 0+1j, + -1+0j, 0-1j] + src_data = (0, 1, 2, 3, 3, 2, 1, 0) + expected_result = (1+0j, 0+1j, -1+0j, 0-1j, + 0-1j, -1+0j, 0+1j, 1+0j) + + src = gr.vector_source_s(src_data) + op = digital.chunks_to_symbols_sc(const) + + dst = gr.vector_sink_c() + self.tb.connect(src, op) + self.tb.connect(op, dst) + self.tb.run() + + actual_result = dst.data() + self.assertEqual(expected_result, actual_result) + + def test_sf_006(self): + const = [-3, -1, 1, 3] + src_data = (0, 1, 2, 3, 3, 2, 1, 0) + expected_result = (-3, -1, 1, 3, + 3, 1, -1, -3) + + src = gr.vector_source_s(src_data) + op = digital.chunks_to_symbols_sf(const) + + dst = gr.vector_sink_f() + self.tb.connect(src, op) + self.tb.connect(op, dst) + self.tb.run() + + actual_result = dst.data() + self.assertEqual(expected_result, actual_result) + +if __name__ == '__main__': + gr_unittest.run(test_chunks_to_symbols, "test_chunks_to_symbols.xml") diff --git a/gr-digital/python/qa_correlate_access_code.py b/gr-digital/python/qa_correlate_access_code.py index 6b6f25051e..96246dcfb9 100755 --- a/gr-digital/python/qa_correlate_access_code.py +++ b/gr-digital/python/qa_correlate_access_code.py @@ -21,7 +21,7 @@ # from gnuradio import gr, gr_unittest -import digital_swig +import digital_swig as digital import math default_access_code = '\xAC\xDD\xA4\xE2\xF2\x8C\x20\xFC' @@ -53,7 +53,7 @@ class test_correlate_access_code(gr_unittest.TestCase): 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) - op = digital_swig.correlate_access_code_bb("1011", 0) + op = digital.correlate_access_code_bb("1011", 0) dst = gr.vector_sink_b () self.tb.connect (src, op, dst) self.tb.run () @@ -70,13 +70,28 @@ class test_correlate_access_code(gr_unittest.TestCase): src_data = code + (1, 0, 1, 1) + pad expected_result = pad + code + (3, 0, 1, 1) src = gr.vector_source_b (src_data) - op = digital_swig.correlate_access_code_bb(access_code, 0) + 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) + def test_003(self): + code = tuple(string_to_1_0_list(default_access_code)) + access_code = to_1_0_string(code) + pad = (0,) * 64 + #print code + #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) + 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) if __name__ == '__main__': diff --git a/gr-digital/python/qa_diff_encoder.py b/gr-digital/python/qa_diff_encoder.py new file mode 100755 index 0000000000..e4f5470af5 --- /dev/null +++ b/gr-digital/python/qa_diff_encoder.py @@ -0,0 +1,87 @@ +#!/usr/bin/env python +# +# 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. +# + +from gnuradio import gr, gr_unittest +import digital_swig as digital +import math +import random + +def make_random_int_tuple(L, min, max): + result = [] + for x in range(L): + result.append(random.randint(min, max)) + return tuple(result) + + +class test_diff_encoder (gr_unittest.TestCase): + + def setUp (self): + self.tb = gr.top_block () + + def tearDown (self): + self.tb = None + + def test_diff_encdec_000(self): + random.seed(0) + modulus = 2 + src_data = make_random_int_tuple(1000, 0, modulus-1) + expected_result = src_data + src = gr.vector_source_b(src_data) + enc = digital.diff_encoder_bb(modulus) + dec = digital.diff_decoder_bb(modulus) + dst = gr.vector_sink_b() + self.tb.connect(src, enc, dec, dst) + self.tb.run() # run the graph and wait for it to finish + actual_result = dst.data() # fetch the contents of the sink + self.assertEqual(expected_result, actual_result) + + def test_diff_encdec_001(self): + random.seed(0) + modulus = 4 + src_data = make_random_int_tuple(1000, 0, modulus-1) + expected_result = src_data + src = gr.vector_source_b(src_data) + enc = digital.diff_encoder_bb(modulus) + dec = digital.diff_decoder_bb(modulus) + dst = gr.vector_sink_b() + self.tb.connect(src, enc, dec, dst) + self.tb.run() # run the graph and wait for it to finish + actual_result = dst.data() # fetch the contents of the sink + self.assertEqual(expected_result, actual_result) + + def test_diff_encdec_002(self): + random.seed(0) + modulus = 8 + src_data = make_random_int_tuple(40000, 0, modulus-1) + expected_result = src_data + src = gr.vector_source_b(src_data) + enc = digital.diff_encoder_bb(modulus) + dec = digital.diff_decoder_bb(modulus) + dst = gr.vector_sink_b() + self.tb.connect(src, enc, dec, dst) + self.tb.run() # run the graph and wait for it to finish + actual_result = dst.data() # fetch the contents of the sink + self.assertEqual(expected_result, actual_result) + +if __name__ == '__main__': + gr_unittest.run(test_diff_encoder, "test_diff_encoder.xml") + diff --git a/gr-digital/python/qa_diff_phasor_cc.py b/gr-digital/python/qa_diff_phasor_cc.py new file mode 100755 index 0000000000..3e7617fe47 --- /dev/null +++ b/gr-digital/python/qa_diff_phasor_cc.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python +# +# Copyright 2004,2007,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. +# + +from gnuradio import gr, gr_unittest +import digital_swig as digital +import math + +class test_diff_phasor (gr_unittest.TestCase): + + def setUp (self): + self.tb = gr.top_block () + + def tearDown (self): + self.tb = None + + 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) + +if __name__ == '__main__': + gr_unittest.run(test_diff_phasor, "test_diff_phasor.xml") + diff --git a/gr-digital/python/qa_framer_sink.py b/gr-digital/python/qa_framer_sink.py new file mode 100755 index 0000000000..bccc86dc78 --- /dev/null +++ b/gr-digital/python/qa_framer_sink.py @@ -0,0 +1,98 @@ +#!/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. +# + +from gnuradio import gr, gr_unittest +import digital_swig as digital + +default_access_code = '\xAC\xDD\xA4\xE2\xF2\x8C\x20\xFC' + +def string_to_1_0_list(s): + r = [] + for ch in s: + x = ord(ch) + for i in range(8): + t = (x >> i) & 0x1 + r.append(t) + return r + +def to_1_0_string(L): + return ''.join(map(lambda x: chr(x + ord('0')), L)) + +class test_framker_sink(gr_unittest.TestCase): + + def setUp(self): + self.tb = gr.top_block() + + def tearDown(self): + self.tb = None + + def test_001(self): + + code = (1, 1, 0, 1) + access_code = to_1_0_string(code) + header = tuple(2*[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1]) # len=1 + pad = (0,) * 100 + src_data = code + header + (0,1,0,0,0,0,0,1) + pad + expected_data = 'A' + + rcvd_pktq = gr.msg_queue() + + src = gr.vector_source_b(src_data) + correlator = digital.correlate_access_code_bb(access_code, 0) + framer_sink = digital.framer_sink_1(rcvd_pktq) + vsnk = gr.vector_sink_b() + + self.tb.connect(src, correlator, framer_sink) + self.tb.connect(correlator, vsnk) + self.tb.run () + + result_data = rcvd_pktq.delete_head() + result_data = result_data.to_string() + self.assertEqual (expected_data, result_data) + + def test_002(self): + + code = tuple(string_to_1_0_list(default_access_code)) + access_code = to_1_0_string(code) + header = tuple(2*[0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0]) # len=2 + pad = (0,) * 100 + src_data = code + header + (0,1,0,0,1,0,0,0) + (0,1,0,0,1,0,0,1) + pad + expected_data = 'HI' + + rcvd_pktq = gr.msg_queue() + + src = gr.vector_source_b(src_data) + correlator = digital.correlate_access_code_bb(access_code, 0) + framer_sink = digital.framer_sink_1(rcvd_pktq) + vsnk = gr.vector_sink_b() + + self.tb.connect(src, correlator, framer_sink) + self.tb.connect(correlator, vsnk) + self.tb.run () + + result_data = rcvd_pktq.delete_head() + result_data = result_data.to_string() + 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 new file mode 100755 index 0000000000..157520d7f8 --- /dev/null +++ b/gr-digital/python/qa_glfsr_source.py @@ -0,0 +1,95 @@ +#!/usr/bin/env python +# +# 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. +# + +from gnuradio import gr, gr_unittest +import digital_swig as digital + +class test_glfsr_source(gr_unittest.TestCase): + + def setUp (self): + self.tb = gr.top_block () + + def tearDown (self): + self.tb = None + + def test_000_make_b(self): + src = digital.glfsr_source_b(16) + self.assertEquals(src.mask(), 0x8016) + self.assertEquals(src.period(), 2**16-1) + + def test_001_degree_b(self): + self.assertRaises(RuntimeError, + lambda: gr.glfsr_source_b(0)) + self.assertRaises(RuntimeError, + lambda: gr.glfsr_source_b(33)) + + def test_002_correlation_b(self): + for degree in range(1,11): # Higher degrees take too long to correlate + src = digital.glfsr_source_b(degree, False) + b2f = digital.chunks_to_symbols_bf((-1.0,1.0), 1) + dst = gr.vector_sink_f() + del self.tb # Discard existing top block + self.tb = gr.top_block() + self.tb.connect(src, b2f, dst) + self.tb.run() + self.tb.disconnect_all() + actual_result = dst.data() + R = auto_correlate(actual_result) + self.assertEqual(R[0], float(len(R))) # Auto-correlation peak at origin + for i in range(len(R)-1): + self.assertEqual(R[i+1], -1.0) # Auto-correlation minimum everywhere else + + def test_003_make_f(self): + src = digital.glfsr_source_f(16) + self.assertEquals(src.mask(), 0x8016) + self.assertEquals(src.period(), 2**16-1) + + def test_004_degree_f(self): + self.assertRaises(RuntimeError, + lambda: gr.glfsr_source_f(0)) + self.assertRaises(RuntimeError, + lambda: gr.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) + dst = gr.vector_sink_f() + del self.tb # Discard existing top block + self.tb = gr.top_block() + self.tb.connect(src, dst) + self.tb.run() + + actual_result = dst.data() + R = auto_correlate(actual_result) + self.assertEqual(R[0], float(len(R))) # Auto-correlation peak at origin + for i in range(len(R)-1): + self.assertEqual(R[i+1], -1.0) # Auto-correlation minimum everywhere else + +def auto_correlate(data): + l = len(data) + R = [0,]*l + for lag in range(l): + for i in range(l): + R[lag] += data[i]*data[i-lag] + return R + +if __name__ == '__main__': + gr_unittest.run(test_glfsr_source, "test_glfsr_source.xml") diff --git a/gr-digital/python/qa_map.py b/gr-digital/python/qa_map.py new file mode 100755 index 0000000000..3ad99a2c12 --- /dev/null +++ b/gr-digital/python/qa_map.py @@ -0,0 +1,60 @@ +#!/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. +# + +from gnuradio import gr, gr_unittest +import digital_swig as digital + +class test_map(gr_unittest.TestCase): + + def setUp(self): + self.tb = gr.top_block() + + def tearDown(self): + self.tb = None + + 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) + op = digital.map_bb(symbols) + 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) + + def test_001(self): + symbols = [0, 0, 0, 0] + self.helper(symbols) + + def test_002(self): + symbols = [3, 2, 1, 0] + self.helper(symbols) + + def test_003(self): + symbols = [8-1, 32-1, 128, 256-1] + self.helper(symbols) + +if __name__ == '__main__': + gr_unittest.run(test_map, "test_map.xml") + diff --git a/gr-digital/python/qa_pfb_clock_sync.py b/gr-digital/python/qa_pfb_clock_sync.py new file mode 100755 index 0000000000..06c8a60ba7 --- /dev/null +++ b/gr-digital/python/qa_pfb_clock_sync.py @@ -0,0 +1,142 @@ +#!/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, gr_unittest +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 tearDown (self): + self.tb = None + + def test01 (self): + # Test BPSK sync + excess_bw = 0.35 + + sps = 4 + loop_bw = cmath.pi/100.0 + nfilts = 32 + init_phase = nfilts/2 + max_rate_deviation = 1.5 + osps = 1 + + ntaps = 11 * int(sps*nfilts) + taps = gr.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)] + self.src = gr.vector_source_c(data, False) + + # pulse shaping interpolation filter + rrc_taps = gr.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.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)] + dst_data = self.snk.data() + + # Only compare last Ncmp samples + Ncmp = 100 + len_e = len(expected_result) + len_d = len(dst_data) + expected_result = expected_result[len_e - Ncmp:] + dst_data = dst_data[len_d - Ncmp:] + + #for e,d in zip(expected_result, dst_data): + # print e, d + + self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 1) + + + def test02 (self): + # Test real BPSK sync + excess_bw = 0.35 + + sps = 4 + loop_bw = cmath.pi/100.0 + nfilts = 32 + init_phase = nfilts/2 + max_rate_deviation = 1.5 + osps = 1 + + ntaps = 11 * int(sps*nfilts) + taps = gr.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] + self.src = gr.vector_source_f(data, False) + + # pulse shaping interpolation filter + rrc_taps = gr.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.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] + dst_data = self.snk.data() + + # Only compare last Ncmp samples + Ncmp = 100 + len_e = len(expected_result) + len_d = len(dst_data) + expected_result = expected_result[len_e - Ncmp:] + dst_data = dst_data[len_d - Ncmp:] + + #for e,d in zip(expected_result, dst_data): + # print e, d + + self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 1) + + +if __name__ == '__main__': + gr_unittest.run(test_pfb_clock_sync, "test_pfb_clock_sync.xml") diff --git a/gr-digital/python/qa_pn_correlator_cc.py b/gr-digital/python/qa_pn_correlator_cc.py new file mode 100755 index 0000000000..377bef5feb --- /dev/null +++ b/gr-digital/python/qa_pn_correlator_cc.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python +# +# 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. +# + +from gnuradio import gr, gr_unittest +import digital_swig as digital + +class test_pn_correlator_cc(gr_unittest.TestCase): + + def setUp(self): + self.tb = gr.top_block () + + def tearDown(self): + self.tb = None + + def test_000_make(self): + c = digital.pn_correlator_cc(10) + + def test_001_correlate(self): + degree = 10 + length = 2**degree-1 + src = digital.glfsr_source_f(degree) + head = gr.head(gr.sizeof_float, length*length) + f2c = gr.float_to_complex() + corr = digital.pn_correlator_cc(degree) + dst = gr.vector_sink_c() + self.tb.connect(src, head, f2c, corr, dst) + self.tb.run() + data = dst.data() + self.assertEqual(data[-1], (1.0+0j)) + +if __name__ == '__main__': + gr_unittest.run(test_pn_correlator_cc, "test_pn_correlator_cc.xml") diff --git a/gr-digital/python/qa_probe_density.py b/gr-digital/python/qa_probe_density.py new file mode 100755 index 0000000000..c5b7e0e7c2 --- /dev/null +++ b/gr-digital/python/qa_probe_density.py @@ -0,0 +1,71 @@ +#!/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. +# + +from gnuradio import gr, gr_unittest +import digital_swig as digital + +class test_probe_density(gr_unittest.TestCase): + + def setUp(self): + self.tb = gr.top_block() + + def tearDown(self): + self.tb = None + + def test_001(self): + src_data = [0, 1, 0, 1] + expected_data = 1 + src = gr.vector_source_b (src_data) + op = digital.probe_density_b(1) + self.tb.connect (src, op) + self.tb.run () + + result_data = op.density() + 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) + op = digital.probe_density_b(0.01) + self.tb.connect (src, op) + self.tb.run () + + result_data = op.density() + 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) + op = digital.probe_density_b(0.01) + self.tb.connect (src, op) + self.tb.run () + + result_data = op.density() + print result_data + 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 new file mode 100755 index 0000000000..f5bd612429 --- /dev/null +++ b/gr-digital/python/qa_scrambler.py @@ -0,0 +1,65 @@ +#!/usr/bin/env python +# +# 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. +# + +from gnuradio import gr, gr_unittest +import digital_swig as digital + +class test_scrambler(gr_unittest.TestCase): + + def setUp (self): + self.tb = gr.top_block() + + def tearDown(self): + self.tb = None + + def test_scrambler_descrambler(self): + src_data = (1,)*1000 + src = gr.vector_source_b(src_data, False) + scrambler = digital.scrambler_bb(0x8a, 0x7F, 7) # CCSDS 7-bit scrambler + descrambler = digital.descrambler_bb(0x8a, 0x7F, 7) + dst = gr.vector_sink_b() + self.tb.connect(src, scrambler, descrambler, dst) + self.tb.run() + self.assertEqual(tuple(src_data[:-8]), dst.data()[8:]) # skip garbage during synchronization + + def test_additive_scrambler(self): + src_data = (1,)*1000 + src = gr.vector_source_b(src_data, False) + scrambler = digital.additive_scrambler_bb(0x8a, 0x7f, 7) + descrambler = digital.additive_scrambler_bb(0x8a, 0x7f, 7) + dst = gr.vector_sink_b() + self.tb.connect(src, scrambler, descrambler, dst) + self.tb.run() + self.assertEqual(src_data, dst.data()) + + def test_additive_scrambler_reset(self): + src_data = (1,)*1000 + src = gr.vector_source_b(src_data, False) + scrambler = digital.additive_scrambler_bb(0x8a, 0x7f, 7, 100) + descrambler = digital.additive_scrambler_bb(0x8a, 0x7f, 7, 100) + dst = gr.vector_sink_b() + self.tb.connect(src, scrambler, descrambler, dst) + self.tb.run() + self.assertEqual(src_data, dst.data()) + +if __name__ == '__main__': + gr_unittest.run(test_scrambler, "test_scrambler.xml") diff --git a/gr-digital/python/qa_simple_framer.py b/gr-digital/python/qa_simple_framer.py new file mode 100755 index 0000000000..09b2d329b2 --- /dev/null +++ b/gr-digital/python/qa_simple_framer.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python +# +# Copyright 2004,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. +# + +from gnuradio import gr, gr_unittest +import digital_swig as digital +import math + +class test_simple_framer (gr_unittest.TestCase): + + def setUp (self): + self.tb = gr.top_block () + + def tearDown (self): + self.tb = None + + def test_simple_framer_001 (self): + src_data = (0x00, 0x11, 0x22, 0x33, + 0x44, 0x55, 0x66, 0x77, + 0x88, 0x99, 0xaa, 0xbb, + 0xcc, 0xdd, 0xee, 0xff) + + expected_result = ( + 0xac, 0xdd, 0xa4, 0xe2, 0xf2, 0x8c, 0x20, 0xfc, 0x00, 0x00, 0x11, 0x22, 0x33, 0x55, + 0xac, 0xdd, 0xa4, 0xe2, 0xf2, 0x8c, 0x20, 0xfc, 0x01, 0x44, 0x55, 0x66, 0x77, 0x55, + 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) + + +if __name__ == '__main__': + gr_unittest.run(test_simple_framer, "test_simple_framer.xml") + diff --git a/gr-digital/swig/CMakeLists.txt b/gr-digital/swig/CMakeLists.txt index 6f2c2251ad..df5f04148c 100644 --- a/gr-digital/swig/CMakeLists.txt +++ b/gr-digital/swig/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2011 Free Software Foundation, Inc. +# Copyright 2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -18,23 +18,107 @@ # Boston, MA 02110-1301, USA. ######################################################################## -# Setup swig generation +# 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(GrSwig) -set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/digital_swig_doc.i) -set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include) +######################################################################## +# 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 ${GR_DIGITAL_INCLUDE_DIRS} ${GNURADIO_CORE_SWIG_INCLUDE_DIRS} + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR}/../include ) +# 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 core_swig) +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) GR_SWIG_MAKE(digital_swig digital_swig.i) - GR_SWIG_INSTALL( TARGETS digital_swig DESTINATION ${GR_PYTHON_DIR}/gnuradio/digital @@ -45,19 +129,34 @@ install( FILES digital_swig.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_cma_equalizer_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_cyclic_prefixer.i @@ -66,9 +165,14 @@ install( 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_gmskmod_bc.i - digital_cpmmod_bc.i + digital_scrambler_bb.i + digital_simple_framer.i DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig COMPONENT "digital_swig" ) diff --git a/gr-digital/swig/digital_additive_scrambler_bb.i b/gr-digital/swig/digital_additive_scrambler_bb.i new file mode 100644 index 0000000000..b063f06725 --- /dev/null +++ b/gr-digital/swig/digital_additive_scrambler_bb.i @@ -0,0 +1,31 @@ +/* -*- 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_bytes_to_syms.i b/gr-digital/swig/digital_bytes_to_syms.i new file mode 100644 index 0000000000..cf23f035c4 --- /dev/null +++ b/gr-digital/swig/digital_bytes_to_syms.i @@ -0,0 +1,29 @@ +/* -*- 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_chunks_to_symbols_XX.i.t b/gr-digital/swig/digital_chunks_to_symbols_XX.i.t new file mode 100644 index 0000000000..a80ba2af11 --- /dev/null +++ b/gr-digital/swig/digital_chunks_to_symbols_XX.i.t @@ -0,0 +1,38 @@ +/* -*- 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@ + +GR_SWIG_BLOCK_MAGIC(digital,@BASE_NAME@); + +@SPTR_NAME@ digital_make_@BASE_NAME@ +(const std::vector<@O_TYPE@> &symbol_table, const int D = 1); + +class @NAME@ : public gr_sync_interpolator +{ +private: + @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; } +}; diff --git a/gr-digital/swig/digital_constellation_decoder_cb.i b/gr-digital/swig/digital_constellation_decoder_cb.i index 53d3fe8e0d..547f57ee6a 100644 --- a/gr-digital/swig/digital_constellation_decoder_cb.i +++ b/gr-digital/swig/digital_constellation_decoder_cb.i @@ -31,7 +31,7 @@ class digital_constellation_decoder_cb : public gr_sync_block digital_constellation_decoder_cb (digital_constellation_sptr constellation); friend digital_constellation_decoder_cb_sptr - gr_make_constellation_decoder_cb (digital_constellation_sptr constellation); + digital_make_constellation_decoder_cb (digital_constellation_sptr constellation); public: ~digital_constellation_decoder_cb(); diff --git a/gr-digital/swig/digital_correlate_access_code_tag_bb.i b/gr-digital/swig/digital_correlate_access_code_tag_bb.i new file mode 100644 index 0000000000..03f20148a1 --- /dev/null +++ b/gr-digital/swig/digital_correlate_access_code_tag_bb.i @@ -0,0 +1,35 @@ +/* -*- 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_descrambler_bb.i b/gr-digital/swig/digital_descrambler_bb.i new file mode 100644 index 0000000000..59de806fba --- /dev/null +++ b/gr-digital/swig/digital_descrambler_bb.i @@ -0,0 +1,30 @@ +/* -*- 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,descrambler_bb); + +digital_descrambler_bb_sptr +digital_make_descrambler_bb(int mask, int seed, int len); + +class digital_descrambler_bb : public gr_sync_block +{ +}; diff --git a/gr-digital/swig/digital_diff_decoder_bb.i b/gr-digital/swig/digital_diff_decoder_bb.i new file mode 100644 index 0000000000..f9741c771f --- /dev/null +++ b/gr-digital/swig/digital_diff_decoder_bb.i @@ -0,0 +1,30 @@ +/* -*- 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,diff_decoder_bb) + +digital_diff_decoder_bb_sptr +digital_make_diff_decoder_bb(unsigned int modulus); + +class digital_diff_decoder_bb : public gr_sync_block +{ +}; diff --git a/gr-digital/swig/digital_diff_encoder_bb.i b/gr-digital/swig/digital_diff_encoder_bb.i new file mode 100644 index 0000000000..45a4589bf1 --- /dev/null +++ b/gr-digital/swig/digital_diff_encoder_bb.i @@ -0,0 +1,30 @@ +/* -*- 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,diff_encoder_bb) + +digital_diff_encoder_bb_sptr +digital_make_diff_encoder_bb(unsigned int modulus); + +class digital_diff_encoder_bb : public gr_sync_block +{ +}; diff --git a/gr-digital/swig/digital_diff_phasor_cc.i b/gr-digital/swig/digital_diff_phasor_cc.i new file mode 100644 index 0000000000..b1e20eb997 --- /dev/null +++ b/gr-digital/swig/digital_diff_phasor_cc.i @@ -0,0 +1,30 @@ +/* -*- 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,diff_phasor_cc) + +digital_diff_phasor_cc_sptr +digital_make_diff_phasor_cc(); + +class digital_diff_phasor_cc : public gr_sync_block +{ +}; diff --git a/gr-digital/swig/digital_framer_sink_1.i b/gr-digital/swig/digital_framer_sink_1.i new file mode 100644 index 0000000000..a5c56560d3 --- /dev/null +++ b/gr-digital/swig/digital_framer_sink_1.i @@ -0,0 +1,30 @@ +/* -*- 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 new file mode 100644 index 0000000000..b1c487209e --- /dev/null +++ b/gr-digital/swig/digital_glfsr_source_b.i @@ -0,0 +1,35 @@ +/* -*- 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_glfsr_source_f.i b/gr-digital/swig/digital_glfsr_source_f.i new file mode 100644 index 0000000000..4d94d8cd49 --- /dev/null +++ b/gr-digital/swig/digital_glfsr_source_f.i @@ -0,0 +1,35 @@ +/* -*- 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_f); + +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); + +class digital_glfsr_source_f : public gr_sync_block +{ +public: + unsigned int period() const; + int mask() const; +}; diff --git a/gr-digital/swig/digital_map_bb.i b/gr-digital/swig/digital_map_bb.i new file mode 100644 index 0000000000..50117d4f58 --- /dev/null +++ b/gr-digital/swig/digital_map_bb.i @@ -0,0 +1,31 @@ +/* -*- 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,map_bb); + +digital_map_bb_sptr +digital_make_map_bb(const std::vector<int> &map); + +class digital_map_bb : public gr_sync_block +{ +}; + diff --git a/gr-digital/swig/digital_ofdm_insert_preamble.i b/gr-digital/swig/digital_ofdm_insert_preamble.i index 5f7b163698..0273c7fa75 100644 --- a/gr-digital/swig/digital_ofdm_insert_preamble.i +++ b/gr-digital/swig/digital_ofdm_insert_preamble.i @@ -32,4 +32,6 @@ 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_packet_sink.i b/gr-digital/swig/digital_packet_sink.i new file mode 100644 index 0000000000..84f81f75cc --- /dev/null +++ b/gr-digital/swig/digital_packet_sink.i @@ -0,0 +1,34 @@ +/* -*- 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 new file mode 100644 index 0000000000..dbba614cc1 --- /dev/null +++ b/gr-digital/swig/digital_pfb_clock_sync_ccf.i @@ -0,0 +1,58 @@ +/* -*- 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 new file mode 100644 index 0000000000..956495e5dd --- /dev/null +++ b/gr-digital/swig/digital_pfb_clock_sync_fff.i @@ -0,0 +1,58 @@ +/* -*- 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_pn_correlator_cc.i b/gr-digital/swig/digital_pn_correlator_cc.i new file mode 100644 index 0000000000..11ccf12c2f --- /dev/null +++ b/gr-digital/swig/digital_pn_correlator_cc.i @@ -0,0 +1,32 @@ +/* -*- 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,pn_correlator_cc) + +digital_pn_correlator_cc_sptr +digital_make_pn_correlator_cc(int degree, int mask=0, int seed=1); + +class digital_pn_correlator_cc : public gr_sync_decimator +{ + protected: + digital_pn_correlator_cc(); +}; diff --git a/gr-digital/swig/digital_probe_density_b.i b/gr-digital/swig/digital_probe_density_b.i new file mode 100644 index 0000000000..b0c8a119ad --- /dev/null +++ b/gr-digital/swig/digital_probe_density_b.i @@ -0,0 +1,33 @@ +/* -*- 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_scrambler_bb.i b/gr-digital/swig/digital_scrambler_bb.i new file mode 100644 index 0000000000..ac9abef920 --- /dev/null +++ b/gr-digital/swig/digital_scrambler_bb.i @@ -0,0 +1,30 @@ +/* -*- 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,scrambler_bb); + +digital_scrambler_bb_sptr +digital_make_scrambler_bb(int mask, int seed, int len); + +class digital_scrambler_bb : public gr_sync_block +{ +}; diff --git a/gr-digital/swig/digital_simple_framer.i b/gr-digital/swig/digital_simple_framer.i new file mode 100644 index 0000000000..a376317c5c --- /dev/null +++ b/gr-digital/swig/digital_simple_framer.i @@ -0,0 +1,30 @@ +/* -*- 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,simple_framer); + +digital_simple_framer_sptr +digital_make_simple_framer(int payload_bytesize); + +class digital_simple_framer : public gr_block +{ +}; diff --git a/gr-digital/swig/digital_swig.i b/gr-digital/swig/digital_swig.i index 4e9c660bc1..191076d75c 100644 --- a/gr-digital/swig/digital_swig.i +++ b/gr-digital/swig/digital_swig.i @@ -35,8 +35,13 @@ enum snr_est_type_t { %include <gri_control_loop.i> +// Bring in generated blocks +%include "digital_generated.i" + %{ +#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" @@ -44,11 +49,22 @@ enum snr_est_type_t { #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" @@ -57,11 +73,18 @@ enum snr_est_type_t { #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_cpmmod_bc.h" -#include "digital_gmskmod_bc.h" +#include "digital_scrambler_bb.h" +#include "digital_simple_framer.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" @@ -70,11 +93,22 @@ enum snr_est_type_t { %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" @@ -83,6 +117,11 @@ enum snr_est_type_t { %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_cpmmod_bc.i" -%include "digital_gmskmod_bc.i" +%include "digital_scrambler_bb.i" +%include "digital_simple_framer.i" |