From f8fcb642dabca11870886c53dfdff66c86774db0 Mon Sep 17 00:00:00 2001 From: Johnathan Corgan Date: Sun, 20 Sep 2009 19:32:30 -0700 Subject: [PATCH] Added skeleton HRPT decoder block --- gr-noaa/apps/usrp_rx_hrpt.grc | 127 ++++++++++++++++++------------ gr-noaa/apps/usrp_rx_hrpt.py | 6 +- gr-noaa/grc/Makefile.am | 1 + gr-noaa/grc/noaa_hrpt_decoder.xml | 12 +++ gr-noaa/lib/Makefile.am | 2 + gr-noaa/lib/noaa_hrpt_decoder.cc | 64 +++++++++++++++ gr-noaa/lib/noaa_hrpt_decoder.h | 47 +++++++++++ gr-noaa/swig/Makefile.am | 1 + gr-noaa/swig/noaa_hrpt_decoder.i | 32 ++++++++ gr-noaa/swig/noaa_hrpt_deframer.i | 2 +- gr-noaa/swig/noaa_swig.i | 2 + 11 files changed, 242 insertions(+), 54 deletions(-) create mode 100644 gr-noaa/grc/noaa_hrpt_decoder.xml create mode 100644 gr-noaa/lib/noaa_hrpt_decoder.cc create mode 100644 gr-noaa/lib/noaa_hrpt_decoder.h create mode 100644 gr-noaa/swig/noaa_hrpt_decoder.i diff --git a/gr-noaa/apps/usrp_rx_hrpt.grc b/gr-noaa/apps/usrp_rx_hrpt.grc index 8edc2b4e..f629ae8b 100644 --- a/gr-noaa/apps/usrp_rx_hrpt.grc +++ b/gr-noaa/apps/usrp_rx_hrpt.grc @@ -1,6 +1,6 @@ - Sun Sep 20 19:09:57 2009 + Sun Sep 20 19:30:16 2009 options @@ -110,56 +110,6 @@ 0 - - gr_file_sink - - id - gr_file_sink_1 - - - _enabled - True - - - file - frames.dat - - - type - short - - - vlen - 1 - - - _coordinate - (1253, 805) - - - _rotation - 0 - - - - noaa_hrpt_deframer - - id - noaa_hrpt_deframer_0 - - - _enabled - True - - - _coordinate - (1063, 809) - - - _rotation - 0 - - wxgui_scopesink2 @@ -1000,6 +950,75 @@ 0 + + gr_file_sink + + id + gr_file_sink_1 + + + _enabled + True + + + file + frames.dat + + + type + short + + + vlen + 1 + + + _coordinate + (1265, 917) + + + _rotation + 0 + + + + noaa_hrpt_deframer + + id + noaa_hrpt_deframer_0 + + + _enabled + True + + + _coordinate + (1063, 809) + + + _rotation + 0 + + + + noaa_hrpt_decoder + + id + noaa_hrpt_decoder_0 + + + _enabled + True + + + _coordinate + (1266, 809) + + + _rotation + 0 + + virtual_source_0 agr @@ -1090,4 +1109,10 @@ 0 0 + + noaa_hrpt_deframer_0 + noaa_hrpt_decoder_0 + 0 + 0 + diff --git a/gr-noaa/apps/usrp_rx_hrpt.py b/gr-noaa/apps/usrp_rx_hrpt.py index 6c50a348..b29af565 100755 --- a/gr-noaa/apps/usrp_rx_hrpt.py +++ b/gr-noaa/apps/usrp_rx_hrpt.py @@ -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 diff --git a/gr-noaa/grc/Makefile.am b/gr-noaa/grc/Makefile.am index 9f1f8819..1f056473 100644 --- a/gr-noaa/grc/Makefile.am +++ b/gr-noaa/grc/Makefile.am @@ -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 index 00000000..183d72ab --- /dev/null +++ b/gr-noaa/grc/noaa_hrpt_decoder.xml @@ -0,0 +1,12 @@ + + + HRPT Decoder + noaa_hrpt_decoder + NOAA + from gnuradio import noaa + noaa.hrpt_decoder() + + in + short + + diff --git a/gr-noaa/lib/Makefile.am b/gr-noaa/lib/Makefile.am index 578c98ad..6435d192 100644 --- a/gr-noaa/lib/Makefile.am +++ b/gr-noaa/lib/Makefile.am @@ -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 index 00000000..7aa815c5 --- /dev/null +++ b/gr-noaa/lib/noaa_hrpt_decoder.cc @@ -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 +#include + +#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 index 00000000..305243b0 --- /dev/null +++ b/gr-noaa/lib/noaa_hrpt_decoder.h @@ -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 + +class noaa_hrpt_decoder; +typedef boost::shared_ptr 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 */ diff --git a/gr-noaa/swig/Makefile.am b/gr-noaa/swig/Makefile.am index 98311eb7..cd7686e2 100644 --- a/gr-noaa/swig/Makefile.am +++ b/gr-noaa/swig/Makefile.am @@ -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 index 00000000..ddf181c2 --- /dev/null +++ b/gr-noaa/swig/noaa_hrpt_decoder.i @@ -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(); +}; diff --git a/gr-noaa/swig/noaa_hrpt_deframer.i b/gr-noaa/swig/noaa_hrpt_deframer.i index 73106d72..6914b93e 100644 --- a/gr-noaa/swig/noaa_hrpt_deframer.i +++ b/gr-noaa/swig/noaa_hrpt_deframer.i @@ -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(); diff --git a/gr-noaa/swig/noaa_swig.i b/gr-noaa/swig/noaa_swig.i index 44f2e472..e6497bc4 100644 --- a/gr-noaa/swig/noaa_swig.i +++ b/gr-noaa/swig/noaa_swig.i @@ -23,11 +23,13 @@ %include "gnuradio.i" %{ +#include #include #include #include %} +%include "noaa_hrpt_decoder.i" %include "noaa_hrpt_deframer.i" %include "noaa_hrpt_pll_cf.i" %include "noaa_hrpt_sync_fb.i" -- 2.30.2