summaryrefslogtreecommitdiff
path: root/gr-digital/include/digital
diff options
context:
space:
mode:
authorTom Rondeau <trondeau@vt.edu>2012-08-14 20:07:00 -0400
committerTom Rondeau <trondeau@vt.edu>2012-08-14 20:07:00 -0400
commit0298cf616a3635bfda4e8f58eae7b23af901c36b (patch)
treefb10ec466c21c97e94d5092015dd3f030dd925ce /gr-digital/include/digital
parent29a019d2761f8001f2c132968c67b060a0ba24bc (diff)
digital: converted framer blocks to new style.
Diffstat (limited to 'gr-digital/include/digital')
-rw-r--r--gr-digital/include/digital/CMakeLists.txt10
-rw-r--r--gr-digital/include/digital/crc32.h57
-rw-r--r--gr-digital/include/digital/framer_sink_1.h65
-rw-r--r--gr-digital/include/digital/simple_framer.h57
-rw-r--r--gr-digital/include/digital/simple_framer_sync.h57
5 files changed, 241 insertions, 5 deletions
diff --git a/gr-digital/include/digital/CMakeLists.txt b/gr-digital/include/digital/CMakeLists.txt
index 83d0dfc557..abb1380a5d 100644
--- a/gr-digital/include/digital/CMakeLists.txt
+++ b/gr-digital/include/digital/CMakeLists.txt
@@ -76,26 +76,27 @@ add_custom_target(digital_generated_includes DEPENDS
install(FILES
${digital_generated_includes}
api.h
+ constellation.h
+ crc32.h
glfsr.h
mpsk_snr_est.h
+ simple_framer_sync.h
additive_scrambler_bb.h
binary_slicer_fb.h
clock_recovery_mm_cc.h
clock_recovery_mm_ff.h
cma_equalizer_cc.h
# cpmmod_bc.h
- constellation.h
constellation_receiver_cb.h
constellation_decoder_cb.h
correlate_access_code_bb.h
correlate_access_code_tag_bb.h
costas_loop_cc.h
-# crc32.h
descrambler_bb.h
diff_decoder_bb.h
diff_encoder_bb.h
diff_phasor_cc.h
-# framer_sink_1.h
+ framer_sink_1.h
fll_band_edge_cc.h
glfsr_source_b.h
glfsr_source_f.h
@@ -119,8 +120,7 @@ install(FILES
probe_density_b.h
probe_mpsk_snr_est_c.h
scrambler_bb.h
-# simple_framer.h
-# simple_framer_sync.h
+ simple_framer.h
DESTINATION ${GR_INCLUDE_DIR}/gnuradio/digital
COMPONENT "digital_devel"
)
diff --git a/gr-digital/include/digital/crc32.h b/gr-digital/include/digital/crc32.h
new file mode 100644
index 0000000000..b84dd6832d
--- /dev/null
+++ b/gr-digital/include/digital/crc32.h
@@ -0,0 +1,57 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,2011,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_DIGITAL_CRC32_H
+#define INCLUDED_DIGITAL_CRC32_H
+
+#include <digital/api.h>
+#include <string>
+#include <gr_types.h>
+
+namespace gr {
+ namespace digital {
+
+ /*!
+ * \brief update running CRC-32
+ * \ingroup digital
+ *
+ * Update a running CRC with the bytes buf[0..len-1] The CRC
+ * should be initialized to all 1's, and the transmitted value is
+ * the 1's complement of the final running CRC. The resulting CRC
+ * should be transmitted in big endian order.
+ */
+ DIGITAL_API unsigned int
+ update_crc32(unsigned int crc, const unsigned char *buf, size_t len);
+
+ DIGITAL_API unsigned int
+ update_crc32(unsigned int crc, const std::string buf);
+
+ DIGITAL_API unsigned int
+ crc32(const unsigned char *buf, size_t len);
+
+ DIGITAL_API unsigned int
+ crc32(const std::string buf);
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_CRC32_H */
diff --git a/gr-digital/include/digital/framer_sink_1.h b/gr-digital/include/digital/framer_sink_1.h
new file mode 100644
index 0000000000..7998238bbb
--- /dev/null
+++ b/gr-digital/include/digital/framer_sink_1.h
@@ -0,0 +1,65 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,2006,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_FRAMER_SINK_1_H
+#define INCLUDED_GR_FRAMER_SINK_1_H
+
+#include <digital/api.h>
+#include <gr_sync_block.h>
+#include <gr_msg_queue.h>
+
+namespace gr {
+ namespace digital {
+
+ /*!
+ * \brief Given a stream of bits and access_code flags, assemble packets.
+ * \ingroup sink_blk
+ *
+ * input: stream of bytes from digital_correlate_access_code_bb
+ * output: none. Pushes assembled packet into target queue
+ *
+ * The framer expects a fixed length header of 2 16-bit shorts
+ * containing the payload length, followed by the payload. If the
+ * 2 16-bit shorts are not identical, this packet is
+ * ignored. Better algs are welcome.
+ *
+ * The input data consists of bytes that have two bits used. Bit
+ * 0, the LSB, contains the data bit. Bit 1 if set, indicates that
+ * the corresponding bit is the the first bit of the packet. That
+ * is, this bit is the first one after the access code.
+ */
+ class DIGITAL_API framer_sink_1 : virtual public gr_sync_block
+ {
+ public:
+ // gr::digital::framer_sink_1::sptr
+ typedef boost::shared_ptr<framer_sink_1> sptr;
+
+ /*!
+ * Make a framer_sink_1 block.
+ */
+ static sptr make(gr_msg_queue_sptr target_queue);
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_FRAMER_SINK_1_H */
diff --git a/gr-digital/include/digital/simple_framer.h b/gr-digital/include/digital/simple_framer.h
new file mode 100644
index 0000000000..d388ffb7a9
--- /dev/null
+++ b/gr-digital/include/digital/simple_framer.h
@@ -0,0 +1,57 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_SIMPLE_FRAMER_H
+#define INCLUDED_GR_SIMPLE_FRAMER_H
+
+#include <digital/api.h>
+#include <gr_block.h>
+
+namespace gr {
+ namespace digital {
+
+ /*!
+ * \brief add sync field, seq number and command field to payload
+ * \ingroup sync_blk
+ *
+ * Takes in enough samples to create a full output frame. The
+ * frame is prepended with the GRSF_SYNC (defind in
+ * digital_simple_framer_sync.h) and an 8-bit sequence number.
+ */
+ class DIGITAL_API simple_framer : virtual public gr_block
+ {
+ public:
+ // gr::digital::simple_framer::sptr
+ typedef boost::shared_ptr<simple_framer> sptr;
+
+ /*!
+ * Make a simple_framer block.
+ *
+ * \param payload_bytesize The size of the payload in bytes.
+ */
+ static sptr make(int payload_bytesize);
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_SIMPLE_FRAMER_H */
diff --git a/gr-digital/include/digital/simple_framer_sync.h b/gr-digital/include/digital/simple_framer_sync.h
new file mode 100644
index 0000000000..5dd2b82c3c
--- /dev/null
+++ b/gr-digital/include/digital/simple_framer_sync.h
@@ -0,0 +1,57 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2005,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_SIMPLE_FRAMER_SYNC_H
+#define INCLUDED_GR_SIMPLE_FRAMER_SYNC_H
+
+namespace gr {
+ namespace digital {
+
+ /*!
+ * \brief Here are a couple of maximum length sequences
+ * (m-sequences) that were generated by the the "mseq"
+ * matlab/octave code downloaded from: <a
+ * href="http://www.mathworks.com/matlabcentral/fileexchange/990">http://www.mathworks.com/matlabcentral/fileexchange/990</a>
+ *
+ * <pre>
+ * 31-bit m-sequence:
+ * 0110100100001010111011000111110
+ * 0x690AEC76 (padded on right with a zero)
+ *
+ * 63-bit m-sequence:
+ * 101011001101110110100100111000101111001010001100001000001111110
+ * 0xACDDA4E2F28C20FC (padded on right with a zero)
+ * </pre>
+ */
+
+ static const unsigned long long GRSF_SYNC = 0xacdda4e2f28c20fcULL;
+
+ static const int GRSF_BITS_PER_BYTE = 8;
+ static const int GRSF_SYNC_OVERHEAD = sizeof(GRSF_SYNC);
+ static const int GRSF_PAYLOAD_OVERHEAD = 1; // 1 byte seqno
+ static const int GRSF_TAIL_PAD = 1; // one byte trailing padding
+ static const int GRSF_OVERHEAD = GRSF_SYNC_OVERHEAD + GRSF_PAYLOAD_OVERHEAD + GRSF_TAIL_PAD;
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_SIMPLE_FRAMER_SYNC_H */