Added skeleton HRPT decoder block
authorJohnathan Corgan <jcorgan@corganenterprises.com>
Mon, 21 Sep 2009 02:32:30 +0000 (19:32 -0700)
committerJohnathan Corgan <jcorgan@corganenterprises.com>
Mon, 21 Sep 2009 02:32:30 +0000 (19:32 -0700)
gr-noaa/apps/usrp_rx_hrpt.grc
gr-noaa/apps/usrp_rx_hrpt.py
gr-noaa/grc/Makefile.am
gr-noaa/grc/noaa_hrpt_decoder.xml [new file with mode: 0644]
gr-noaa/lib/Makefile.am
gr-noaa/lib/noaa_hrpt_decoder.cc [new file with mode: 0644]
gr-noaa/lib/noaa_hrpt_decoder.h [new file with mode: 0644]
gr-noaa/swig/Makefile.am
gr-noaa/swig/noaa_hrpt_decoder.i [new file with mode: 0644]
gr-noaa/swig/noaa_hrpt_deframer.i
gr-noaa/swig/noaa_swig.i

index 8edc2b4ea9c1fba2951982b09eb7fef4706a1d62..f629ae8b7f5477a93917471d8f7e46f84c889f13 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version='1.0' encoding='ASCII'?>
 <flow_graph>
-  <timestamp>Sun Sep 20 19:09:57 2009</timestamp>
+  <timestamp>Sun Sep 20 19:30:16 2009</timestamp>
   <block>
     <key>options</key>
     <param>
       <value>0</value>
     </param>
   </block>
-  <block>
-    <key>gr_file_sink</key>
-    <param>
-      <key>id</key>
-      <value>gr_file_sink_1</value>
-    </param>
-    <param>
-      <key>_enabled</key>
-      <value>True</value>
-    </param>
-    <param>
-      <key>file</key>
-      <value>frames.dat</value>
-    </param>
-    <param>
-      <key>type</key>
-      <value>short</value>
-    </param>
-    <param>
-      <key>vlen</key>
-      <value>1</value>
-    </param>
-    <param>
-      <key>_coordinate</key>
-      <value>(1253, 805)</value>
-    </param>
-    <param>
-      <key>_rotation</key>
-      <value>0</value>
-    </param>
-  </block>
-  <block>
-    <key>noaa_hrpt_deframer</key>
-    <param>
-      <key>id</key>
-      <value>noaa_hrpt_deframer_0</value>
-    </param>
-    <param>
-      <key>_enabled</key>
-      <value>True</value>
-    </param>
-    <param>
-      <key>_coordinate</key>
-      <value>(1063, 809)</value>
-    </param>
-    <param>
-      <key>_rotation</key>
-      <value>0</value>
-    </param>
-  </block>
   <block>
     <key>wxgui_scopesink2</key>
     <param>
       <value>0</value>
     </param>
   </block>
+  <block>
+    <key>gr_file_sink</key>
+    <param>
+      <key>id</key>
+      <value>gr_file_sink_1</value>
+    </param>
+    <param>
+      <key>_enabled</key>
+      <value>True</value>
+    </param>
+    <param>
+      <key>file</key>
+      <value>frames.dat</value>
+    </param>
+    <param>
+      <key>type</key>
+      <value>short</value>
+    </param>
+    <param>
+      <key>vlen</key>
+      <value>1</value>
+    </param>
+    <param>
+      <key>_coordinate</key>
+      <value>(1265, 917)</value>
+    </param>
+    <param>
+      <key>_rotation</key>
+      <value>0</value>
+    </param>
+  </block>
+  <block>
+    <key>noaa_hrpt_deframer</key>
+    <param>
+      <key>id</key>
+      <value>noaa_hrpt_deframer_0</value>
+    </param>
+    <param>
+      <key>_enabled</key>
+      <value>True</value>
+    </param>
+    <param>
+      <key>_coordinate</key>
+      <value>(1063, 809)</value>
+    </param>
+    <param>
+      <key>_rotation</key>
+      <value>0</value>
+    </param>
+  </block>
+  <block>
+    <key>noaa_hrpt_decoder</key>
+    <param>
+      <key>id</key>
+      <value>noaa_hrpt_decoder_0</value>
+    </param>
+    <param>
+      <key>_enabled</key>
+      <value>True</value>
+    </param>
+    <param>
+      <key>_coordinate</key>
+      <value>(1266, 809)</value>
+    </param>
+    <param>
+      <key>_rotation</key>
+      <value>0</value>
+    </param>
+  </block>
   <connection>
     <source_block_id>virtual_source_0</source_block_id>
     <sink_block_id>agr</sink_block_id>
     <source_key>0</source_key>
     <sink_key>0</sink_key>
   </connection>
+  <connection>
+    <source_block_id>noaa_hrpt_deframer_0</source_block_id>
+    <sink_block_id>noaa_hrpt_decoder_0</sink_block_id>
+    <source_key>0</source_key>
+    <sink_key>0</sink_key>
+  </connection>
 </flow_graph>
index 6c50a348a6d5071d9161390c6ce3f75aa2cdbd99..b29af5654efc00751798fca598c59e3b24a85f5a 100755 (executable)
@@ -2,7 +2,7 @@
 ##################################################
 # Gnuradio Python Flow Graph
 # Title: USRP HRPT Receiver
-# Generated: Sun Sep 20 19:09:57 2009
+# Generated: Sun Sep 20 19:30:17 2009
 ##################################################
 
 from gnuradio import eng_notation
@@ -105,10 +105,11 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui):
                self.agr = gr.agc_cc(1e-6, 1.0, 1.0, 1.0)
                self.gr_deinterleave_0 = gr.deinterleave(gr.sizeof_float*1)
                self.gr_file_sink_1 = gr.file_sink(gr.sizeof_short*1, "frames.dat")
-               self.gr_file_source_0 = gr.file_source(gr.sizeof_short*1, "filename", False)
+               self.gr_file_source_0 = gr.file_source(gr.sizeof_short*1, filename, False)
                self.gr_float_to_complex_0 = gr.float_to_complex(1)
                self.gr_short_to_float_0 = gr.short_to_float()
                self.matched_filter = gr.moving_average_cc(hs, 1.0/hs, 4000)
+               self.noaa_hrpt_decoder_0 = noaa.hrpt_decoder()
                self.noaa_hrpt_deframer_0 = noaa.hrpt_deframer()
                self.noaa_hrpt_pll_cf_0 = noaa.hrpt_pll_cf(pll_alpha, pll_alpha**2/4.0, max_carrier_offset)
                self.noaa_hrpt_sync_fb_0 = noaa.hrpt_sync_fb(sync_alpha, sync_alpha**2/4.0, sps, max_sync_offset)
@@ -169,6 +170,7 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui):
                self.connect((self.gr_deinterleave_0, 1), (self.gr_float_to_complex_0, 1))
                self.connect((self.gr_deinterleave_0, 0), (self.gr_float_to_complex_0, 0))
                self.connect((self.gr_file_source_0, 0), (self.gr_short_to_float_0, 0))
+               self.connect((self.noaa_hrpt_deframer_0, 0), (self.noaa_hrpt_decoder_0, 0))
 
        def set_filename(self, filename):
                self.filename = filename
index 9f1f88195c54b17d54571eaaf8215940d83f8d40..1f056473c5be0be468b554702523081c0eb00eb7 100644 (file)
@@ -24,6 +24,7 @@ include $(top_srcdir)/Makefile.common
 grcblocksdir = $(prefix)/share/gnuradio/grc/blocks
 
 dist_grcblocks_DATA = \
+       noaa_hrpt_decoder.xml \
        noaa_hrpt_deframer.xml \
        noaa_hrpt_pll_cf.xml \
        noaa_hrpt_sync_fb.xml
diff --git a/gr-noaa/grc/noaa_hrpt_decoder.xml b/gr-noaa/grc/noaa_hrpt_decoder.xml
new file mode 100644 (file)
index 0000000..183d72a
--- /dev/null
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<block>
+  <name>HRPT Decoder</name>
+  <key>noaa_hrpt_decoder</key>
+  <category>NOAA</category>
+  <import>from gnuradio import noaa</import>
+  <make>noaa.hrpt_decoder()</make>
+  <sink>
+    <name>in</name>
+    <type>short</type>
+  </sink>
+</block>
index 578c98adaffc0a8a37025a3b011dbf55f9d8d219..6435d192e93876b8086fc06e8e3aa3b0e3c6306c 100644 (file)
@@ -29,6 +29,7 @@ lib_LTLIBRARIES = \
        libgnuradio-noaa.la
 
 libgnuradio_noaa_la_SOURCES = \
+       noaa_hrpt_decoder.cc \
        noaa_hrpt_deframer.cc \
        noaa_hrpt_pll_cf.cc \
        noaa_hrpt_sync_fb.cc
@@ -39,6 +40,7 @@ libgnuradio_noaa_la_LIBADD = \
 libgnuradio_noaa_la_LDFLAGS = $(NO_UNDEFINED) -version-info 0:0:0
 
 grinclude_HEADERS = \
+       noaa_hrpt_decoder.h \
        noaa_hrpt_deframer.h \
        noaa_hrpt_pll_cf.h \
        noaa_hrpt_sync_fb.h
diff --git a/gr-noaa/lib/noaa_hrpt_decoder.cc b/gr-noaa/lib/noaa_hrpt_decoder.cc
new file mode 100644 (file)
index 0000000..7aa815c
--- /dev/null
@@ -0,0 +1,64 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009 Free Software Foundation, Inc.
+ * 
+ * This file is part of GNU Radio
+ * 
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ * 
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along 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 <noaa_hrpt_decoder.h>
+#include <gr_io_signature.h>
+
+#define SYNC1 0x0284
+#define SYNC2 0x016F
+#define SYNC3 0x035C
+#define SYNC4 0x019D
+#define SYNC5 0x020F
+#define SYNC6 0x0095
+
+noaa_hrpt_decoder_sptr
+noaa_make_hrpt_decoder()
+{
+  return gnuradio::get_initial_sptr(new noaa_hrpt_decoder());
+}
+
+noaa_hrpt_decoder::noaa_hrpt_decoder()
+  : gr_sync_block("noaa_hrpt_decoder",
+                 gr_make_io_signature(1, 1, sizeof(short)),
+                 gr_make_io_signature(0, 0, 0))
+{
+  d_word_count = 0;
+}
+
+int
+noaa_hrpt_decoder::work(int noutput_items,
+                       gr_vector_const_void_star &input_items,
+                       gr_vector_void_star &output_items)
+{
+  const unsigned short *in = (const unsigned short*)input_items[0];
+
+  int i = 0;
+  while (i < noutput_items) {
+    unsigned short word = in[i++];
+  }
+
+  return i;
+}
diff --git a/gr-noaa/lib/noaa_hrpt_decoder.h b/gr-noaa/lib/noaa_hrpt_decoder.h
new file mode 100644 (file)
index 0000000..305243b
--- /dev/null
@@ -0,0 +1,47 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009 Free Software Foundation, Inc.
+ * 
+ * This file is part of GNU Radio
+ * 
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ * 
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along 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_NOAA_HRPT_DECODER_H
+#define INCLUDED_NOAA_HRPT_DECODER_H
+
+#include <gr_sync_block.h>
+
+class noaa_hrpt_decoder;
+typedef boost::shared_ptr<noaa_hrpt_decoder> noaa_hrpt_decoder_sptr;
+
+noaa_hrpt_decoder_sptr
+noaa_make_hrpt_decoder();
+
+class noaa_hrpt_decoder : public gr_sync_block
+{
+  friend noaa_hrpt_decoder_sptr noaa_make_hrpt_decoder();
+  noaa_hrpt_decoder();
+
+  unsigned int d_word_count;
+public:
+  int work(int noutput_items,
+          gr_vector_const_void_star &input_items,
+          gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_NOAA_HRPT_DECODER_H */
index 98311eb7bf1b7d766227912e0d06eeaff2560138..cd7686e212ea4859be4c272e6861ed23fb3a1713 100644 (file)
@@ -53,6 +53,7 @@ noaa_swig_python = \
 # additional SWIG files to be installed
 noaa_swig_swiginclude_headers =        \
        noaa_swig.i \
+       noaa_hrpt_decoder.i \
        noaa_hrpt_deframer.i \
        noaa_hrpt_pll_cf.i \
        noaa_hrpt_sync_fb.i
diff --git a/gr-noaa/swig/noaa_hrpt_decoder.i b/gr-noaa/swig/noaa_hrpt_decoder.i
new file mode 100644 (file)
index 0000000..ddf181c
--- /dev/null
@@ -0,0 +1,32 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009 Free Software Foundation, Inc.
+ * 
+ * This file is part of GNU Radio
+ * 
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ * 
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along 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(noaa,hrpt_decoder)
+
+noaa_hrpt_decoder_sptr
+noaa_make_hrpt_decoder();
+
+class noaa_hrpt_decoder : public gr_sync_block
+{
+private:
+  noaa_hrpt_decoder();
+};
index 73106d7262e6547a2c1a29c3c36afb9199a2e0cd..6914b93e636255e382e99d193785aaf7c94a69b6 100644 (file)
@@ -25,7 +25,7 @@ GR_SWIG_BLOCK_MAGIC(noaa,hrpt_deframer)
 noaa_hrpt_deframer_sptr
 noaa_make_hrpt_deframer();
 
-class noaa_hrpt_deframer : public gr_sync_block
+class noaa_hrpt_deframer : public gr_block
 {
 private:
   noaa_hrpt_deframer();
index 44f2e47235f034407d24c3fbf5387771d07bbb4b..e6497bc468314bc1776dceb42d69c0fa25e58135 100644 (file)
 %include "gnuradio.i"
 
 %{
+#include <noaa_hrpt_decoder.h>
 #include <noaa_hrpt_deframer.h>
 #include <noaa_hrpt_pll_cf.h>
 #include <noaa_hrpt_sync_fb.h>
 %}
 
+%include "noaa_hrpt_decoder.i"
 %include "noaa_hrpt_deframer.i"
 %include "noaa_hrpt_pll_cf.i"
 %include "noaa_hrpt_sync_fb.i"