commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r3535 - gnuradio/branches/developers/jcorgan/pager/gr-


From: jcorgan
Subject: [Commit-gnuradio] r3535 - gnuradio/branches/developers/jcorgan/pager/gr-pager/src
Date: Wed, 13 Sep 2006 19:33:29 -0600 (MDT)

Author: jcorgan
Date: 2006-09-13 19:33:29 -0600 (Wed, 13 Sep 2006)
New Revision: 3535

Added:
   gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pager.i
   
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pager_flex_deframer.cc
   gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pager_flex_deframer.h
   gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pager_slicer_fb.cc
   gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pager_slicer_fb.h
   gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pageri_bch3221.cc
   gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pageri_bch3221.h
   gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pageri_flex_modes.cc
   gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pageri_flex_modes.h
   gnuradio/branches/developers/jcorgan/pager/gr-pager/src/qa_pager.py
Removed:
   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
Modified:
   gnuradio/branches/developers/jcorgan/pager/gr-pager/src/
   gnuradio/branches/developers/jcorgan/pager/gr-pager/src/Makefile.am
   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/usrp_flex.py
Log:
Finished with gr-pager reorganization.


Property changes on: gnuradio/branches/developers/jcorgan/pager/gr-pager/src
___________________________________________________________________
Name: svn:ignore
   - Makefile
Makefile.in

   + .libs
.deps
Makefile
Makefile.in
pager_swig.py
pager_swig.cc
*.pyc
run_tests


Modified: gnuradio/branches/developers/jcorgan/pager/gr-pager/src/Makefile.am
===================================================================
--- gnuradio/branches/developers/jcorgan/pager/gr-pager/src/Makefile.am 
2006-09-13 21:30:04 UTC (rev 3534)
+++ gnuradio/branches/developers/jcorgan/pager/gr-pager/src/Makefile.am 
2006-09-14 01:33:29 UTC (rev 3535)
@@ -49,50 +49,50 @@
     $(GNURADIO_I)
 
 LOCAL_IFILES = \
-    $(top_srcdir)/gr-pager/src/pgr.i                           
+    $(top_srcdir)/gr-pager/src/pager.i
 
 # These files are built by SWIG.  The first is the C++ glue.
 # The second is the python wrapper that loads the _howto shared library
 # and knows how to call our extensions.
 
 BUILT_SOURCES = \
-    pgr.cc \
-    pgr.py                             
+    pager_swig.cc \
+    pager_swig.py                              
 
 # This gets pgr.py installed in the right place
 ourpython_PYTHON = \
     __init__.py \
-    pgr.py \
+    pager_swig.py \
     flex_demod.py \
     usrp_flex.py
 
-ourlib_LTLIBRARIES = _pgr.la
+ourlib_LTLIBRARIES = _pager_swig.la
 
 # These are the source files that go into the shared library
-_pgr_la_SOURCES = \
-    pgr.cc \
-    pgr_slicer_fb.cc \
-    pgr_flex_modes.cc \
-    pgr_flex_deframer.cc \
-    pgri_bch3221.cc
+_pager_swig_la_SOURCES = \
+    pager_swig.cc \
+    pager_slicer_fb.cc \
+    pager_flex_deframer.cc \
+    pageri_flex_modes.cc \
+    pageri_bch3221.cc
     # Additional source modules here
 
 # magic flags
-_pgr_la_LDFLAGS = $(NO_UNDEFINED) -module -avoid-version
+_pager_swig_la_LDFLAGS = $(NO_UNDEFINED) -module -avoid-version
 
 # link the library against the c++ standard library
-_pgr_la_LIBADD = \
+_pager_swig_la_LIBADD = \
     $(PYTHON_LDFLAGS) \
     $(GNURADIO_CORE_LIBS) \
     -lstdc++                   
 
-pgr.cc pgr.py: $(ALL_IFILES)
-       $(SWIG) $(SWIGPYTHONARGS) -module pgr -o pgr.cc $(LOCAL_IFILES)
+pager_swig.cc pager_swig.py: $(ALL_IFILES)
+       $(SWIG) $(SWIGPYTHONARGS) -module pager_swig -o pager_swig.cc 
$(LOCAL_IFILES)
 
 # These headers get installed in ${prefix}/include/gnuradio
 grinclude_HEADERS = \
-    pgr_slicer_fb.h \
-    pgr_flex_deframer.h
+    pager_slicer_fb.h \
+    pager_flex_deframer.h
     # Additional header files here
 
 # These swig headers get installed in ${prefix}/include/gnuradio/swig

Modified: gnuradio/branches/developers/jcorgan/pager/gr-pager/src/__init__.py
===================================================================
--- gnuradio/branches/developers/jcorgan/pager/gr-pager/src/__init__.py 
2006-09-13 21:30:04 UTC (rev 3534)
+++ gnuradio/branches/developers/jcorgan/pager/gr-pager/src/__init__.py 
2006-09-14 01:33:29 UTC (rev 3535)
@@ -21,5 +21,5 @@
 
 # The presence of this file turns this directory into a Python package
 
-from pgr import *
+from pager_swig import *
 from flex_demod import flex_demod

Modified: gnuradio/branches/developers/jcorgan/pager/gr-pager/src/flex_demod.py
===================================================================
--- gnuradio/branches/developers/jcorgan/pager/gr-pager/src/flex_demod.py       
2006-09-13 21:30:04 UTC (rev 3534)
+++ gnuradio/branches/developers/jcorgan/pager/gr-pager/src/flex_demod.py       
2006-09-14 01:33:29 UTC (rev 3535)
@@ -20,8 +20,8 @@
 # 
 
 from gnuradio import gr, optfir
-import pgr
 from math import pi
+import pager_swig
 
 class flex_demod(gr.hier_block):
     """
@@ -49,8 +49,8 @@
 
         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)
+        SLICER = pager_swig.slicer_fb(.001, .00001) # Attack, decay
+        DEFRAMER = pager_swig.flex_deframer(channel_rate)
        
         fg.connect(QUAD, LPF, SLICER, DEFRAMER)
 

Copied: gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pager.i (from 
rev 3531, gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pgr.i)
===================================================================
--- gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pager.i             
                (rev 0)
+++ gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pager.i     
2006-09-14 01:33:29 UTC (rev 3535)
@@ -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 "pager_slicer_fb.h"
+#include "pager_flex_deframer.h"
+#include <stdexcept>
+%}
+
+// ----------------------------------------------------------------
+
+GR_SWIG_BLOCK_MAGIC(pager,slicer_fb);
+
+pager_slicer_fb_sptr pager_make_slicer_fb(float alpha, float beta);
+
+class pager_slicer_fb : public gr_sync_block
+{
+private:
+    pager_slicer_fb(float alpha, float beta);
+
+public:
+};
+
+// ----------------------------------------------------------------
+
+GR_SWIG_BLOCK_MAGIC(pager,flex_deframer);
+
+pager_flex_deframer_sptr pager_make_flex_deframer(int rate);
+
+class pager_flex_deframer : public gr_block
+{
+private:
+    pager_flex_deframer(int rate);
+
+public:
+};
+
+// ----------------------------------------------------------------

Copied: 
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pager_flex_deframer.cc 
(from rev 3534, 
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pgr_flex_deframer.cc)
===================================================================
--- 
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pager_flex_deframer.cc  
                            (rev 0)
+++ 
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pager_flex_deframer.cc  
    2006-09-14 01:33:29 UTC (rev 3535)
@@ -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 <pager_flex_deframer.h>
+#include <pageri_flex_modes.h>
+#include <gr_io_signature.h>
+#include <gr_count_bits.h>
+
+pager_flex_deframer_sptr pager_make_flex_deframer(int rate)
+{
+    return pager_flex_deframer_sptr(new pager_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).
+
+pager_flex_deframer::pager_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 pager_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 pager_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 pager_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 pager_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 pager_flex_deframer::enter_syncing()
+{
+    d_start = d_index;
+    d_state = ST_SYNCING;
+}
+
+void pager_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 pager_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 pager_flex_deframer::enter_data()
+{
+    d_state = ST_DATA;
+    d_count = 0;
+}
+
+void pager_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 pager_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 pager_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 pager_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/pager_flex_deframer.h 
(from rev 3531, 
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pgr_flex_deframer.h)
===================================================================
--- 
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pager_flex_deframer.h   
                            (rev 0)
+++ 
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pager_flex_deframer.h   
    2006-09-14 01:33:29 UTC (rev 3535)
@@ -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_PAGER_FLEX_DEFRAMER_H
+#define INCLUDED_PAGER_FLEX_DEFRAMER_H
+
+#include <gr_block.h>
+
+class pager_flex_deframer;
+typedef boost::shared_ptr<pager_flex_deframer> pager_flex_deframer_sptr;
+typedef std::vector<gr_int64> gr_int64_vector;
+
+pager_flex_deframer_sptr pgr_make_flex_deframer(int rate);
+
+/*!
+ * \brief flex deframer description
+ * \ingroup block
+ */
+
+class pager_flex_deframer : public gr_block
+{
+private:
+    // Constructors
+    friend pager_flex_deframer_sptr pager_make_flex_deframer(int rate);
+    pager_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_PAGER_FLEX_DEFRAMER_H */

Copied: 
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pager_slicer_fb.cc 
(from rev 3531, 
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pgr_slicer_fb.cc)
===================================================================
--- gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pager_slicer_fb.cc  
                        (rev 0)
+++ gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pager_slicer_fb.cc  
2006-09-14 01:33:29 UTC (rev 3535)
@@ -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 <pager_slicer_fb.h>
+#include <gr_io_signature.h>
+
+pager_slicer_fb_sptr pager_make_slicer_fb(float alpha, float beta)
+{
+    return pager_slicer_fb_sptr(new pager_slicer_fb(alpha, beta));
+}
+
+pager_slicer_fb::pager_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 pager_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 pager_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/pager_slicer_fb.h (from 
rev 3531, 
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pgr_slicer_fb.h)
===================================================================
--- gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pager_slicer_fb.h   
                        (rev 0)
+++ gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pager_slicer_fb.h   
2006-09-14 01:33:29 UTC (rev 3535)
@@ -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_PAGER_SLICER_FB_H
+#define INCLUDED_PAGER_SLICER_FB_H
+
+#include <gr_sync_block.h>
+
+class pager_slicer_fb;
+typedef boost::shared_ptr<pager_slicer_fb> pager_slicer_fb_sptr;
+
+pager_slicer_fb_sptr pgr_make_slicer_fb(float alpha, float beta);
+
+/*!
+ * \brief slicer description
+ * \ingroup block
+ */
+class pager_slicer_fb : public gr_sync_block
+{
+private:
+    friend pager_slicer_fb_sptr pager_make_slicer_fb(float alpha, float beta);
+    pager_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_PAGER_SLICER_FB_H */

Copied: 
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pageri_bch3221.cc (from 
rev 3531, 
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pgri_bch3221.cc)
===================================================================
--- gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pageri_bch3221.cc   
                        (rev 0)
+++ gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pageri_bch3221.cc   
2006-09-14 01:33:29 UTC (rev 3535)
@@ -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 <pageri_bch3221.h>
+
+int pageri_bch3221(gr_int32 &data)
+{
+    return 0;
+}

Copied: 
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pageri_bch3221.h (from 
rev 3531, 
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pgri_bch3221.h)
===================================================================
--- gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pageri_bch3221.h    
                        (rev 0)
+++ gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pageri_bch3221.h    
2006-09-14 01:33:29 UTC (rev 3535)
@@ -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_PAGERI_BCH3221_H
+#define INCLUDED_PAGERI_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 pageri_bch3221(gr_int32 &data);
+
+#endif /* INCLUDED_PAGERI_BCH3221_H */

Copied: 
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pageri_flex_modes.cc 
(from rev 3531, 
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pgr_flex_modes.cc)
===================================================================
--- 
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pageri_flex_modes.cc    
                            (rev 0)
+++ 
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pageri_flex_modes.cc    
    2006-09-14 01:33:29 UTC (rev 3535)
@@ -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 "pageri_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/pageri_flex_modes.h 
(from rev 3531, 
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pgr_flex_modes.h)
===================================================================
--- gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pageri_flex_modes.h 
                        (rev 0)
+++ gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pageri_flex_modes.h 
2006-09-14 01:33:29 UTC (rev 3535)
@@ -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_PAGERI_FLEX_MODES_H
+#define INCLUDED_PAGERI_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_PAGERI_FLEX_MODES_H

Deleted: gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pgr.i

Deleted: 
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pgr_flex_deframer.cc

Deleted: 
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pgr_flex_deframer.h

Deleted: 
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pgr_flex_modes.cc

Deleted: 
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pgr_flex_modes.h

Deleted: 
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pgr_slicer_fb.cc

Deleted: gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pgr_slicer_fb.h

Deleted: gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pgri_bch3221.cc

Deleted: gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pgri_bch3221.h

Copied: gnuradio/branches/developers/jcorgan/pager/gr-pager/src/qa_pager.py 
(from rev 3531, 
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/qa_pgr.py)
===================================================================
--- gnuradio/branches/developers/jcorgan/pager/gr-pager/src/qa_pager.py         
                (rev 0)
+++ gnuradio/branches/developers/jcorgan/pager/gr-pager/src/qa_pager.py 
2006-09-14 01:33:29 UTC (rev 3535)
@@ -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 pager_swig
+
+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 ()

Deleted: gnuradio/branches/developers/jcorgan/pager/gr-pager/src/qa_pgr.py

Modified: gnuradio/branches/developers/jcorgan/pager/gr-pager/src/usrp_flex.py
===================================================================
--- gnuradio/branches/developers/jcorgan/pager/gr-pager/src/usrp_flex.py        
2006-09-13 21:30:04 UTC (rev 3534)
+++ gnuradio/branches/developers/jcorgan/pager/gr-pager/src/usrp_flex.py        
2006-09-14 01:33:29 UTC (rev 3535)
@@ -5,7 +5,6 @@
 from optparse import OptionParser
 import time, os, sys
 
-# This will force us to make it a package
 from flex_demod import flex_demod
 
 """





reply via email to

[Prev in Thread] Current Thread [Next in Thread]