[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r3531 - in gnuradio/branches/developers/jcorgan/pager/
From: |
jcorgan |
Subject: |
[Commit-gnuradio] r3531 - in gnuradio/branches/developers/jcorgan/pager/gr-pager/src: . lib python python/pager |
Date: |
Wed, 13 Sep 2006 14:50:30 -0600 (MDT) |
Author: jcorgan
Date: 2006-09-13 14:50:30 -0600 (Wed, 13 Sep 2006)
New Revision: 3531
Added:
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/__init__.py
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/flex_demod.py
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pgr.i
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pgr_flex_deframer.cc
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pgr_flex_deframer.h
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pgr_flex_modes.cc
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pgr_flex_modes.h
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pgr_slicer_fb.cc
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pgr_slicer_fb.h
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pgri_bch3221.cc
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pgri_bch3221.h
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/qa_pgr.py
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/run_tests.in
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/usrp_flex.py
Removed:
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/Makefile.am
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/lib/pgr.i
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/lib/pgr_flex_deframer.cc
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/lib/pgr_flex_deframer.h
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/lib/pgr_flex_modes.cc
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/lib/pgr_flex_modes.h
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/lib/pgr_slicer_fb.cc
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/lib/pgr_slicer_fb.h
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/lib/pgri_bch3221.cc
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/lib/pgri_bch3221.h
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/pager/__init__.py
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/pager/flex_demod.py
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/pager/usrp_flex.py
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/qa_pgr.py
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/run_tests.in
Log:
WIP reorganizing gr-pager source tree.
Deleted: gnuradio/branches/developers/jcorgan/pager/gr-pager/src/Makefile.am
Copied: gnuradio/branches/developers/jcorgan/pager/gr-pager/src/__init__.py
(from rev 3530,
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/pager/__init__.py)
===================================================================
--- gnuradio/branches/developers/jcorgan/pager/gr-pager/src/__init__.py
(rev 0)
+++ gnuradio/branches/developers/jcorgan/pager/gr-pager/src/__init__.py
2006-09-13 20:50:30 UTC (rev 3531)
@@ -0,0 +1,25 @@
+#
+# Copyright 2006 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+#
+
+# The presence of this file turns this directory into a Python package
+
+from pgr import *
+from flex_demod import flex_demod
Copied: gnuradio/branches/developers/jcorgan/pager/gr-pager/src/flex_demod.py
(from rev 3530,
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/pager/flex_demod.py)
===================================================================
--- gnuradio/branches/developers/jcorgan/pager/gr-pager/src/flex_demod.py
(rev 0)
+++ gnuradio/branches/developers/jcorgan/pager/gr-pager/src/flex_demod.py
2006-09-13 20:50:30 UTC (rev 3531)
@@ -0,0 +1,57 @@
+#
+# Copyright 2006 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+#
+
+from gnuradio import gr, optfir
+import pgr
+from math import pi
+
+class flex_demod(gr.hier_block):
+ """
+ FLEX protocol demodulation block.
+
+ This block demodulates a band-limited, complex down-converted baseband
+ channel into FLEX protocol frames.
+
+ Flow graph (so far):
+
+ QUAD - Quadrature demodulator converts FSK to baseband amplitudes
+ LPF - Low pass filter to remove noise prior to slicer
+ SLICER - Converts input to one of four symbols (0, 1, 2, 3)
+ DEFRAMER - Syncronizes symbol stream and outputs FLEX codewords
+ ---
+
+ @param fg: flowgraph
+ @param channel_rate: incoming sample rate of the baseband channel
+ @type sample_rate: integer
+ """
+
+ def __init__(self, fg, channel_rate):
+ k = channel_rate/(2*pi*4800) # 4800 Hz max deviation
+ QUAD = gr.quadrature_demod_cf(k)
+
+ taps = optfir.low_pass(1.0, channel_rate, 3200, 6400, 0.1, 60)
+ LPF = gr.fir_filter_fff(1, taps)
+ SLICER = pgr.slicer_fb(.001, .00001) # Attack, decay
+ DEFRAMER = pgr.flex_deframer(channel_rate)
+
+ fg.connect(QUAD, LPF, SLICER, DEFRAMER)
+
+ gr.hier_block.__init__(self, fg, QUAD, DEFRAMER)
Deleted: gnuradio/branches/developers/jcorgan/pager/gr-pager/src/lib/pgr.i
Deleted:
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/lib/pgr_flex_deframer.cc
Deleted:
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/lib/pgr_flex_deframer.h
Deleted:
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/lib/pgr_flex_modes.cc
Deleted:
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/lib/pgr_flex_modes.h
Deleted:
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/lib/pgr_slicer_fb.cc
Deleted:
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/lib/pgr_slicer_fb.h
Deleted:
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/lib/pgri_bch3221.cc
Deleted:
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/lib/pgri_bch3221.h
Copied: gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pgr.i (from rev
3529, gnuradio/branches/developers/jcorgan/pager/gr-pager/src/lib/pgr.i)
===================================================================
--- gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pgr.i
(rev 0)
+++ gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pgr.i
2006-09-13 20:50:30 UTC (rev 3531)
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2005,2006 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+%feature("autodoc","1");
+%include "exception.i"
+%import "gnuradio.i"
+
+%{
+#include "gnuradio_swig_bug_workaround.h" // mandatory bug fix
+#include "pgr_slicer_fb.h"
+#include "pgr_flex_deframer.h"
+#include <stdexcept>
+%}
+
+// ----------------------------------------------------------------
+
+GR_SWIG_BLOCK_MAGIC(pgr,slicer_fb);
+
+pgr_slicer_fb_sptr pgr_make_slicer_fb(float alpha, float beta);
+
+class pgr_slicer_fb : public gr_sync_block
+{
+private:
+ pgr_slicer_fb(float alpha, float beta);
+
+public:
+};
+
+// ----------------------------------------------------------------
+
+GR_SWIG_BLOCK_MAGIC(pgr,flex_deframer);
+
+pgr_flex_deframer_sptr pgr_make_flex_deframer(int rate);
+
+class pgr_flex_deframer : public gr_block
+{
+private:
+ pgr_flex_deframer(int rate);
+
+public:
+};
+
+// ----------------------------------------------------------------
Copied:
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pgr_flex_deframer.cc
(from rev 3529,
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/lib/pgr_flex_deframer.cc)
===================================================================
---
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pgr_flex_deframer.cc
(rev 0)
+++
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pgr_flex_deframer.cc
2006-09-13 20:50:30 UTC (rev 3531)
@@ -0,0 +1,324 @@
+/*
+ * Copyright 2004,2006 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <pgr_flex_deframer.h>
+#include <pgr_flex_modes.h>
+#include <gr_io_signature.h>
+#include <gr_count_bits.h>
+
+pgr_flex_deframer_sptr pgr_make_flex_deframer(int rate)
+{
+ return pgr_flex_deframer_sptr(new pgr_flex_deframer(rate));
+}
+
+// FLEX deframer block takes input from symbol stream with alphabet [0, 1, 2,
3]
+// at specified channel rate and and outputs deinterleaved 32-bit FLEX code
words
+// at 50, 100, or 200 code words per second (based on detected mode in sync
+// word).
+
+pgr_flex_deframer::pgr_flex_deframer(int rate) :
+ gr_block ("flex_deframer",
+ gr_make_io_signature (1, 1, sizeof(unsigned char)),
+ gr_make_io_signature (1, 1, sizeof(gr_int32))),
+ d_sync(rate/1600) // Maximum samples per baud
+{
+ d_rate = rate;
+ set_output_multiple(1);
+ enter_idle();
+}
+
+void pgr_flex_deframer::forecast(int noutput_items, gr_vector_int
&inputs_required)
+{
+ // samples per bit X 32 bits * number of outputs needed
+ int items = noutput_items*sizeof(gr_int32)*8*d_spb;
+ for (unsigned int i = 0; i < inputs_required.size(); i++)
+ inputs_required[i] = items;
+}
+
+int pgr_flex_deframer::index_avg(int start, int end)
+{
+ // modulo average
+ if (start < end)
+ return (end + start)/2;
+ else
+ return ((end + start)/2 + d_spb/2) % d_spb;
+}
+
+bool pgr_flex_deframer::test_sync(unsigned char sym)
+{
+ // 64-bit FLEX sync code:
+ // AAAA:BBBBBBBB:CCCC
+ //
+ // Where BBBBBBBB is always 0xA6C6AAAA
+ // and AAAA^CCCC is 0xFFFF
+ //
+ // Specific values of AAAA determine what bps and encoding the
+ // packet is beyond the frame information word
+ //
+ // First we match on the marker field with a hamming distance < 4
+ // Then we match on the outer code with a hamming distance < 4
+
+ d_sync[d_index] = (d_sync[d_index] << 1) | (sym < 2);
+ gr_int64 val = d_sync[d_index];
+ gr_int32 marker = ((val & 0x0000FFFFFFFF0000ULL)) >> 16;
+
+ if (gr_count_bits32(marker^FLEX_SYNC_MARKER) < 4) {
+ gr_int32 code = ((val & 0xFFFF000000000000ULL) >> 32) |
+ (val & 0x000000000000FFFFULL);
+
+ for (int i = 0; i < num_flex_modes; i++) {
+ if (gr_count_bits32(code^flex_modes[i].sync) < 4) {
+ d_mode = i;
+ return true;
+ }
+ }
+
+ // Marker received but doesn't match known codes
+ // All codes have high word inverted to low word
+ unsigned short high = (code & 0xFFFF0000) >> 16;
+ unsigned short low = code & 0x0000FFFF;
+ unsigned short syn = high^low;
+ if (syn == 0xFFFF)
+ fprintf(stderr, "Unknown sync code detected: %08X\n", code);
+ }
+
+ return false;
+}
+
+void pgr_flex_deframer::enter_idle()
+{
+ d_state = ST_IDLE;
+ d_index = 0;
+ d_start = 0;
+ d_center = 0;
+ d_end = 0;
+ d_count = 0;
+ d_mode = 0;
+ d_baudrate = 1600;
+ d_levels = 2;
+ d_spb = d_rate/d_baudrate;
+ d_hibit = false;
+ d_cdi = 0;
+ d_cdw = 0;
+ d_blk = 0;
+}
+
+void pgr_flex_deframer::enter_syncing()
+{
+ d_start = d_index;
+ d_state = ST_SYNCING;
+}
+
+void pgr_flex_deframer::enter_sync1()
+{
+ d_state = ST_SYNC1;
+ d_end = d_index;
+ d_center = index_avg(d_start, d_end);
+ d_count = 0;
+ fprintf(stderr, "SYNC1=%08X\n", flex_modes[d_mode].sync);
+}
+
+void pgr_flex_deframer::enter_sync2()
+{
+ d_state = ST_SYNC2;
+ d_count = 0;
+ d_baudrate = flex_modes[d_mode].baud;
+ d_levels = flex_modes[d_mode].levels;
+ d_spb = d_rate/d_baudrate;
+
+ if (d_baudrate == 3200) {
+ // Oversampling buffer just got halved
+ d_center = d_center/2;
+ d_index = d_index/2-d_spb/2; // We're here at the center of a 1600
baud bit
+ d_count = -1; // So this hack gets us in the right
place for 3200
+ }
+}
+
+void pgr_flex_deframer::enter_data()
+{
+ d_state = ST_DATA;
+ d_count = 0;
+}
+
+void pgr_flex_deframer::enter_output()
+{
+ d_state = ST_OUTPUT;
+ d_count = flex_modes[d_mode].phases*88; // Now d_count will count
codewords, not bits
+ d_output_phase = 0; // Always phase A
+ d_output_index = 0;
+}
+
+void pgr_flex_deframer::accumulate_frames(unsigned char sym)
+{
+ // Bits are encoded with 2-bit gray code
+ //
+ // SYM Bit1 Bit2
+ // --- ---- ----
+ // 0 1 1
+ // 1 1 0
+ // 2 0 0
+ // 3 0 1
+
+ // Codewords are interleaved in blocks of 8
+ //
+ // ABCDEFGH
+ // ABCDEFGH
+ // ABCDEFGH
+ // ABCDEFGH
+ // ...
+ // etc., for all 32 bits. So each successive incoming bit is multiplexed
+ // into a different d_frames[][], indexed by d_cdw
+
+ d_cdw = d_blk*8+d_cdi;
+ assert(d_cdw < 88);
+
+ if (d_baudrate == 1600) {
+ d_frames[0][d_cdw] <<= 1;
+ d_frames[0][d_cdw] |= (sym < 2);
+
+ if (d_levels == 4) {
+ d_frames[1][d_cdw] <<= 1;
+ d_frames[1][d_cdw] |= (sym == 0 || sym == 3);
+ }
+ }
+ else {
+ if (!d_hibit) {
+ d_frames[0][d_cdw] <<= 1;
+ d_frames[0][d_cdw] |= (sym < 2);
+
+ if (d_levels == 4) {
+ d_frames[1][d_cdw] <<= 1;
+ d_frames[1][d_cdw] |= (sym == 0 || sym == 3);
+ }
+ d_hibit = true;
+ }
+ else {
+ d_frames[2][d_cdw] <<= 1;
+ d_frames[2][d_cdw] |= (sym < 2);
+
+ if (d_levels == 4) {
+ d_frames[3][d_cdw] <<= 1;
+ d_frames[3][d_cdw] |= (sym == 0 || sym == 3);
+ }
+ d_hibit = false;
+ }
+ }
+
+ d_cdi = ++d_cdi % 8;
+ if (++d_count % (d_baudrate*4/25) == 0)
+ d_blk++;
+}
+
+int pgr_flex_deframer::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];
+ gr_int32 *out = (gr_int32 *)output_items[0];
+
+ int i = 0, j = 0;
+ int ninputs = ninput_items[0];
+
+ while (i < ninputs && j < noutput_items) {
+ unsigned char sym;
+ if (d_state != ST_OUTPUT) {
+ sym = *in++; i++;
+ d_index = ++d_index % d_spb;
+ }
+
+ switch (d_state) {
+ case ST_IDLE:
+ if (test_sync(sym))
+ enter_syncing();
+ break;
+
+ case ST_SYNCING:
+ if (!test_sync(sym)) {
+ enter_sync1();
+ // Output sync code
+ *out++ = flex_modes[d_mode].sync; j++;
+ }
+ break;
+
+ case ST_SYNC1:
+ if (d_index == d_center) {
+ d_sync[d_index] = (d_sync[d_index] << 1) | (sym < 2);
+ if (++d_count == 48) { // Skip 16 bits of dotting
+ // Output frame information word
+ *out++ = (gr_int32)(d_sync[d_index] &
0x00000000FFFFFFFFULL); j++;
+ enter_sync2();
+ }
+ }
+ break;
+
+ case ST_SYNC2:
+ if (d_index == d_center) {
+ // Skip 25 ms = 40 bits @ 1600 bps, 80 @ 3200 bps
+ if (++d_count == d_baudrate/40)
+ enter_data();
+ }
+ break;
+
+ case ST_DATA:
+ if (d_index == d_center) {
+ accumulate_frames(sym);
+ if (d_count == d_baudrate*1760/1000)
+ enter_output();
+ }
+ break;
+
+ case ST_OUTPUT:
+ output_codeword(out++); j++;
+ if (--d_count == 0)
+ enter_idle();
+ break;
+
+ default:
+ assert(0); // memory corruption of d_state if ever gets here
+ break;
+
+ }
+ }
+
+ consume_each(i);
+ return j;
+}
+
+void pgr_flex_deframer::output_codeword(gr_int32 *out)
+{
+ *out = d_frames[d_output_phase][d_output_index++];
+
+ if (d_output_index == 88) {
+ d_output_index = 0;
+ d_output_phase++;
+ if (d_output_phase == 1 && !flex_modes[d_mode].phase_b)
+ d_output_phase++;
+ if (d_output_phase == 2 && !flex_modes[d_mode].phase_c)
+ d_output_phase++;
+ if (d_output_phase == 3 && !flex_modes[d_mode].phase_d)
+ d_output_phase++;
+ }
+}
Copied:
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pgr_flex_deframer.h
(from rev 3529,
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/lib/pgr_flex_deframer.h)
===================================================================
--- gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pgr_flex_deframer.h
(rev 0)
+++ gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pgr_flex_deframer.h
2006-09-13 20:50:30 UTC (rev 3531)
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2006 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef INCLUDED_PGR_FLEX_DEFRAMER_H
+#define INCLUDED_PGR_FLEX_DEFRAMER_H
+
+#include <gr_block.h>
+
+class pgr_flex_deframer;
+typedef boost::shared_ptr<pgr_flex_deframer> pgr_flex_deframer_sptr;
+typedef std::vector<gr_int64> gr_int64_vector;
+
+pgr_flex_deframer_sptr pgr_make_flex_deframer(int rate);
+
+/*!
+ * \brief flex deframer description
+ * \ingroup block
+ */
+
+class pgr_flex_deframer : public gr_block
+{
+private:
+ // Constructors
+ friend pgr_flex_deframer_sptr pgr_make_flex_deframer(int rate);
+ pgr_flex_deframer(int rate);
+
+ // State machine transitions
+ void enter_idle();
+ void enter_syncing();
+ void enter_sync1();
+ void enter_sync2();
+ void enter_data();
+ void enter_output();
+
+ int index_avg(int start, int end);
+ bool test_sync(unsigned char sym);
+ void accumulate_frames(unsigned char sym);
+ void output_codeword(gr_int32 *out);
+
+ // Simple state machine
+ enum state_t { ST_IDLE, ST_SYNCING, ST_SYNC1, ST_SYNC2, ST_DATA, ST_OUTPUT
};
+ state_t d_state;
+
+ int d_rate; // Incoming sample rate
+ int d_index; // Index into current baud
+ int d_start; // Start of good sync
+ int d_center; // Center of bit
+ int d_end; // End of good sync
+ int d_count; // Bit counter
+
+ int d_mode; // Current packet mode
+ int d_baudrate; // Current decoding baud rate
+ int d_levels; // Current decoding levels
+ int d_spb; // Current samples per baud
+ bool d_hibit; // Current bit is high bit when 3200 baud
+
+ gr_int64_vector d_sync; // Trial synchronizers
+
+ int d_cdi; // 0-7 code word index for deinterleave
+ int d_cdw; // 0-87 code word index for frame
+ int d_blk; // 0-10 block index
+
+ int d_output_phase; // Indexes d_frames[][] during output
+ int d_output_index; // indexes d_frames[][] during output
+
+ gr_int32 d_frames[4][88]; // Frame accumulators for each phase
+
+public:
+ void forecast(int noutput_items, gr_vector_int &inputs_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_PGR_FLEX_DEFRAMER_H */
Copied:
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pgr_flex_modes.cc (from
rev 3529,
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/lib/pgr_flex_modes.cc)
===================================================================
--- gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pgr_flex_modes.cc
(rev 0)
+++ gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pgr_flex_modes.cc
2006-09-13 20:50:30 UTC (rev 3531)
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2006 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "pgr_flex_modes.h"
+
+const flex_mode_t flex_modes[] =
+{
+ { 0x870C78F3, 1600, 2, true, false, false, false, 1 },
+ { 0xB0684F97, 1600, 4, true, true, false, false, 2 },
+// { 0xUNKNOWN, 3200, 2, true, false, true, false, 2 },
+ { 0xDEA0215F, 3200, 4, true, true, true, true, 4 },
+ { 0x4C7CB383, 3200, 4, true, true, true, true, 4 }
+};
+
+const int num_flex_modes = sizeof(flex_modes);
Copied:
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pgr_flex_modes.h (from
rev 3529,
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/lib/pgr_flex_modes.h)
===================================================================
--- gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pgr_flex_modes.h
(rev 0)
+++ gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pgr_flex_modes.h
2006-09-13 20:50:30 UTC (rev 3531)
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2006 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef INCLUDED_PGR_FLEX_MODES_H
+#define INCLUDED_PGR_FLEX_MODES_H
+
+#include <gr_types.h>
+
+#define FLEX_SYNC_MARKER 0xA6C6AAAA
+
+typedef struct flex_mode
+{
+ gr_int32 sync; // Outer synchronization code
+ unsigned int baud; // Baudrate of SYNC2 and DATA
+ unsigned int levels; // FSK encoding of SYNC2 and DATA
+ bool phase_a; // PHASEA is transmitted
+ bool phase_b; // PHASEB is transmitted
+ bool phase_c; // PHASEC is transmitted
+ bool phase_d; // PHASED is transmitted
+ int phases; // number of phases transmitted
+}
+flex_mode_t;
+
+extern const flex_mode_t flex_modes[];
+extern const int num_flex_modes;
+
+#endif // INCLUDED_PGR_FLEX_MODES_H
Copied:
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pgr_slicer_fb.cc (from
rev 3529,
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/lib/pgr_slicer_fb.cc)
===================================================================
--- gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pgr_slicer_fb.cc
(rev 0)
+++ gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pgr_slicer_fb.cc
2006-09-13 20:50:30 UTC (rev 3531)
@@ -0,0 +1,100 @@
+/*
+ * Copyright 2004,2006 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <pgr_slicer_fb.h>
+#include <gr_io_signature.h>
+
+pgr_slicer_fb_sptr pgr_make_slicer_fb(float alpha, float beta)
+{
+ return pgr_slicer_fb_sptr(new pgr_slicer_fb(alpha, beta));
+}
+
+pgr_slicer_fb::pgr_slicer_fb(float alpha, float beta) :
+ gr_sync_block ("slicer_fb",
+ gr_make_io_signature (1, 1, sizeof(float)),
+ gr_make_io_signature (1, 1, sizeof(unsigned char)))
+{
+ d_alpha = alpha;
+ d_beta = beta;
+ d_max = 0.0;
+ d_hi = 0.0;
+ d_avg = 0.0;
+ d_lo = 0.0;
+ d_min = 0.0;
+}
+
+// Tracks average, minimum, and peak, then converts input into one of:
+//
+// [0, 1, 2, 3]
+unsigned char pgr_slicer_fb::slice(float sample)
+{
+ unsigned char decision;
+
+ // Update DC level and remove
+ d_avg = d_avg*(1.0-d_alpha)+sample*d_alpha;
+ sample -= d_avg;
+
+ if (sample > 0) {
+ if (sample > d_hi) { // In max region
+ d_max = d_max*(1.0-d_alpha) + sample*d_alpha;
+ decision = 3;
+ }
+ else {
+ d_max -= (d_max-d_avg)*d_beta; // decay otherwise
+ decision = 2;
+ }
+ }
+ else {
+ if (sample < d_lo) { // In min region
+ d_min = d_min*(1.0-d_alpha) + sample*d_alpha;
+ decision = 0;
+ }
+ else {
+ d_min -= (d_min-d_avg)*d_beta; // decay otherwise
+ decision = 1;
+ }
+ }
+
+ d_hi = d_max*2.0/3.0;
+ d_lo = d_min*2.0/3.0;
+
+ //fprintf(stderr, "%f %d\n", sample, decision);
+ return decision;
+}
+
+int pgr_slicer_fb::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ float *iptr = (float *) input_items[0];
+ unsigned char *optr = (unsigned char *) output_items[0];
+
+ int size = noutput_items;
+
+ for (int i = 0; i < size; i++)
+ *optr++ = slice(*iptr++);
+
+ return noutput_items;
+}
Copied: gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pgr_slicer_fb.h
(from rev 3529,
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/lib/pgr_slicer_fb.h)
===================================================================
--- gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pgr_slicer_fb.h
(rev 0)
+++ gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pgr_slicer_fb.h
2006-09-13 20:50:30 UTC (rev 3531)
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2006 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef INCLUDED_PGR_SLICER_FB_H
+#define INCLUDED_PGR_SLICER_FB_H
+
+#include <gr_sync_block.h>
+
+class pgr_slicer_fb;
+typedef boost::shared_ptr<pgr_slicer_fb> pgr_slicer_fb_sptr;
+
+pgr_slicer_fb_sptr pgr_make_slicer_fb(float alpha, float beta);
+
+/*!
+ * \brief slicer description
+ * \ingroup block
+ */
+class pgr_slicer_fb : public gr_sync_block
+{
+private:
+ friend pgr_slicer_fb_sptr pgr_make_slicer_fb(float alpha, float beta);
+ pgr_slicer_fb(float alpha, float beta);
+
+ unsigned char slice(float sample);
+
+ float d_alpha; // Attack constant
+ float d_beta; // Decay constant
+ float d_max; // Maximum value for symbol comparison
+ float d_hi; // High side decision boundary
+ float d_avg; // Average value for DC offset subtraction
+ float d_lo; // Low side decision boundary
+ float d_min; // Minimum value for symbol comparison
+
+public:
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_PGR_SLICER_FB_H */
Copied: gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pgri_bch3221.cc
(from rev 3529,
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/lib/pgri_bch3221.cc)
===================================================================
--- gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pgri_bch3221.cc
(rev 0)
+++ gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pgri_bch3221.cc
2006-09-13 20:50:30 UTC (rev 3531)
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2006 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <pgri_bch3221.h>
+
+int pgri_bch3221(gr_int32 &data)
+{
+ return 0;
+}
Copied: gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pgri_bch3221.h
(from rev 3529,
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/lib/pgri_bch3221.h)
===================================================================
--- gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pgri_bch3221.h
(rev 0)
+++ gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pgri_bch3221.h
2006-09-13 20:50:30 UTC (rev 3531)
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2006 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef INCLUDED_PGRI_BCH3221_H
+#define INCLUDED_PGRI_BCH3221_H
+
+#include <gr_types.h>
+
+// Perform BCH (32,21) error correction on supplied data
+// Return number of errors found/corrected (0, 1, or 2)
+int pgri_bch3221(gr_int32 &data);
+
+#endif /* INCLUDED_PGRI_BCH3221_H */
Deleted:
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/pager/__init__.py
Deleted:
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/pager/flex_demod.py
Deleted:
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/pager/usrp_flex.py
Deleted:
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/qa_pgr.py
Deleted:
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/run_tests.in
Copied: gnuradio/branches/developers/jcorgan/pager/gr-pager/src/qa_pgr.py (from
rev 3529,
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/qa_pgr.py)
===================================================================
--- gnuradio/branches/developers/jcorgan/pager/gr-pager/src/qa_pgr.py
(rev 0)
+++ gnuradio/branches/developers/jcorgan/pager/gr-pager/src/qa_pgr.py
2006-09-13 20:50:30 UTC (rev 3531)
@@ -0,0 +1,35 @@
+#!/usr/bin/env python
+#
+# Copyright 2004,2006 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+#
+
+from gnuradio import gr, gr_unittest
+import pgr
+
+class qa_pgr(gr_unittest.TestCase):
+
+ def setUp (self):
+ self.fg = gr.flow_graph ()
+
+ def tearDown (self):
+ self.fg = None
+
+if __name__ == '__main__':
+ gr_unittest.main ()
Copied: gnuradio/branches/developers/jcorgan/pager/gr-pager/src/run_tests.in
(from rev 3529,
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/run_tests.in)
===================================================================
--- gnuradio/branches/developers/jcorgan/pager/gr-pager/src/run_tests.in
(rev 0)
+++ gnuradio/branches/developers/jcorgan/pager/gr-pager/src/run_tests.in
2006-09-13 20:50:30 UTC (rev 3531)
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+# 1st parameter is absolute path to component source directory
+# 2nd parameter is absolute path to component build directory
+# 3rd parameter is path to Python QA directory
+
address@hidden@/run_tests.sh \
+ @abs_top_srcdir@/gr-pager \
+ @abs_top_builddir@/gr-pager \
+ @srcdir@
Copied: gnuradio/branches/developers/jcorgan/pager/gr-pager/src/usrp_flex.py
(from rev 3530,
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/python/pager/usrp_flex.py)
===================================================================
--- gnuradio/branches/developers/jcorgan/pager/gr-pager/src/usrp_flex.py
(rev 0)
+++ gnuradio/branches/developers/jcorgan/pager/gr-pager/src/usrp_flex.py
2006-09-13 20:50:30 UTC (rev 3531)
@@ -0,0 +1,163 @@
+#!/usr/bin/env python
+
+from gnuradio import gr, gru, usrp, optfir, eng_notation, blks
+from gnuradio.eng_option import eng_option
+from optparse import OptionParser
+import time, os, sys
+
+# This will force us to make it a package
+from flex_demod import flex_demod
+
+"""
+This example application demonstrates receiving and demodulating the
+FLEX pager protocol.
+
+A receive chain is built up of the following signal processing
+blocks:
+
+USRP - Daughter board source generating complex baseband signal.
+CHAN - Low pass filter to select channel bandwidth
+RFSQL - RF squelch zeroing output when input power below threshold
+AGC - Automatic gain control leveling signal at [-1.0, +1.0]
+FLEX - FLEX pager protocol decoder
+SINK - File sink for decoded output
+
+The following are required command line parameters:
+
+-f FREQ USRP receive frequency
+
+The following are optional command line parameters:
+
+-R SUBDEV Daughter board specification, defaults to first found
+-c FREQ Calibration offset. Gets added to receive frequency.
+ Defaults to 0.0 Hz.
+-g GAIN Daughterboard gain setting. Defaults to mid-range.
+-r RFSQL RF squelch in db. Defaults to -50.0.
+
+Once the program is running, ctrl-break (Ctrl-C) stops operation.
+"""
+
+def make_filename(dir, freq):
+ t = time.strftime('%Y%m%d-%H%M%S')
+ f = 'r%s-%s.dat' % (t, eng_notation.num_to_str(freq))
+ return os.path.join(dir, f)
+
+class usrp_source_c(gr.hier_block):
+ """
+ Create a USRP source object supplying complex floats.
+
+ Selects user supplied subdevice or chooses first available one.
+
+ Calibration value is the offset from the tuned frequency to
+ the actual frequency.
+ """
+ def __init__(self, fg, subdev_spec, decim, gain=None, calibration=0.0):
+ self._decim = decim
+ self._src = usrp.source_c()
+ if subdev_spec is None:
+ subdev_spec = usrp.pick_rx_subdevice(self._src)
+ self._subdev = usrp.selected_subdev(self._src, subdev_spec)
+ self._src.set_mux(usrp.determine_rx_mux_value(self._src, subdev_spec))
+ self._src.set_decim_rate(self._decim)
+
+ # If no gain specified, set to midrange
+ if gain is None:
+ g = self._subdev.gain_range()
+ gain = (g[0]+g[1])/2.0
+
+ self._subdev.set_gain(gain)
+ self._cal = calibration
+
+ gr.hier_block.__init__(self, fg, self._src, self._src)
+
+ def tune(self, freq):
+ result = usrp.tune(self._src, 0, self._subdev, freq+self._cal)
+ # TODO: deal with residual
+
+ def rate(self):
+ return self._src.adc_rate()/self._decim
+
+class app_flow_graph(gr.flow_graph):
+ def __init__(self, options, args):
+ gr.flow_graph.__init__(self)
+ self.options = options
+ self.args = args
+
+ USRP = usrp_source_c(self, # Flow graph
+ options.rx_subdev_spec, # Daugherboard spec
+ 250, # IF decimation ratio gets 256K
if_rate
+ options.gain, # Receiver gain
+ options.calibration) # Frequency offset
+ USRP.tune(options.frequency)
+
+ if_rate = USRP.rate()
+ channel_rate = 32000 # Oversampled by 10 or 20
+ channel_decim = if_rate // channel_rate
+
+ CHAN_taps = optfir.low_pass(1.0, # Filter gain
+ if_rate, # Sample rate
+ 8000, # One sided
modulation bandwidth
+ 10000, # One sided channel
bandwidth
+ 0.1, #
Passband ripple
+ 60) #
Stopband attenuation
+
+ CHAN = gr.freq_xlating_fir_filter_ccf(channel_decim, # Decimation rate
+ CHAN_taps, # Filter taps
+ 0.0, # Offset frequency
+ if_rate) # Sample rate
+
+ RFSQL = gr.pwr_squelch_cc(options.rf_squelch, # Power threshold
+ 125.0/channel_rate, # Time constant
+ channel_rate/20, # 50ms
rise/fall
+ False) # Zero, not gate output
+
+ AGC = gr.agc_cc(1.0/channel_rate, # Time constant
+ 1.0, # Reference power
+ 1.0, # Initial gain
+ 1.0) # Maximum gain
+
+ FLEX = flex_demod(self, 32000)
+
+ SINK = gr.file_sink(4, options.filename)
+
+ self.connect(USRP, CHAN)
+ self.connect(CHAN, RFSQL)
+ self.connect(RFSQL, AGC)
+ self.connect(AGC, FLEX)
+ self.connect(FLEX, SINK)
+
+def main():
+ parser = OptionParser(option_class=eng_option)
+ parser.add_option("-f", "--frequency", type="eng_float",
+ help="set receive frequency to Hz", metavar="Hz")
+ parser.add_option("-R", "--rx-subdev-spec", type="subdev",
+ help="select USRP Rx side A or B", metavar="SUBDEV")
+ parser.add_option("-c", "--calibration", type="eng_float", default=0.0,
+ help="set frequency offset to Hz", metavar="Hz")
+ parser.add_option("-g", "--gain", type="int", default=None,
+ help="set RF gain", metavar="dB")
+ parser.add_option("-r", "--rf-squelch", type="eng_float", default=-50.0,
+ help="set RF squelch to dB", metavar="dB")
+ parser.add_option("-F", "--filename", default=None)
+ parser.add_option("-D", "--dir", default=None)
+ (options, args) = parser.parse_args()
+
+ if options.frequency < 1e6:
+ options.frequency *= 1e6
+
+ if options.filename is None and options.dir is None:
+ sys.stderr.write('Must specify either -F FILENAME or -D DIR\n')
+ parser.print_help()
+ sys.exit(1)
+
+ if options.filename is None:
+ options.filename = make_filename(options.dir, options.frequency)
+
+ fg = app_flow_graph(options, args)
+ try:
+ fg.run()
+ except KeyboardInterrupt:
+ pass
+
+if __name__ == "__main__":
+ main()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r3531 - in gnuradio/branches/developers/jcorgan/pager/gr-pager/src: . lib python python/pager,
jcorgan <=