summaryrefslogtreecommitdiff
path: root/gr-digital/include
diff options
context:
space:
mode:
authorTom Rondeau <tom@trondeau.com>2014-05-16 10:10:07 -0400
committerTom Rondeau <tom@trondeau.com>2014-05-17 17:45:16 -0400
commit372c53a1d57f052015dc1247896e6e49944b54fb (patch)
treef846e7279525a4a0b8fe80298c4ef9869ab4dde6 /gr-digital/include
parent5a55bb4e468812f3620323ab948d1ee4f12eab59 (diff)
digital: adding an async message passsing CRC32 calc/check block for PDUs.
Diffstat (limited to 'gr-digital/include')
-rw-r--r--gr-digital/include/gnuradio/digital/CMakeLists.txt2
-rw-r--r--gr-digital/include/gnuradio/digital/crc32_async_bb.h70
2 files changed, 71 insertions, 1 deletions
diff --git a/gr-digital/include/gnuradio/digital/CMakeLists.txt b/gr-digital/include/gnuradio/digital/CMakeLists.txt
index 26e9412435..0d958e867f 100644
--- a/gr-digital/include/gnuradio/digital/CMakeLists.txt
+++ b/gr-digital/include/gnuradio/digital/CMakeLists.txt
@@ -94,6 +94,7 @@ install(FILES
cpmmod_bc.h
crc32.h
crc32_bb.h
+ crc32_async_bb.h
descrambler_bb.h
diff_decoder_bb.h
diff_encoder_bb.h
@@ -146,4 +147,3 @@ install(FILES
DESTINATION ${GR_INCLUDE_DIR}/gnuradio/digital
COMPONENT "digital_devel"
)
-
diff --git a/gr-digital/include/gnuradio/digital/crc32_async_bb.h b/gr-digital/include/gnuradio/digital/crc32_async_bb.h
new file mode 100644
index 0000000000..335ac20438
--- /dev/null
+++ b/gr-digital/include/gnuradio/digital/crc32_async_bb.h
@@ -0,0 +1,70 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2014 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_ASYNC_BB_H
+#define INCLUDED_DIGITAL_CRC32_ASYNC_BB_H
+
+#include <gnuradio/digital/api.h>
+#include <gnuradio/block.h>
+
+namespace gr {
+ namespace digital {
+
+ /*!
+ * \brief Byte-stream CRC block for async messages
+ * \ingroup packet_operators_blk
+ *
+ * \details
+ *
+ * Processes packets (as async PDU messages) for CRC32. The \p
+ * check parameter determines if the block acts to check and strip
+ * the CRC or to calculate and append the CRC32.
+ *
+ * The input PDU is expected to be a message of packet bytes.
+ *
+ * When using check mode, if the CRC passes, the output is a
+ * payload of the message with the CRC stripped, so the output
+ * will be 4 bytes smaller than the input.
+ *
+ * When using calculate mode (check == false), then the CRC is
+ * calculated on the PDU and appended to it. The output is then 4
+ * bytes longer than the input.
+ *
+ * This block implements the CRC32 using the Boost crc_optimal
+ * class for 32-bit CRCs with the standard generator 0x04C11DB7.
+ */
+ class DIGITAL_API crc32_async_bb : virtual public block
+ {
+ public:
+ typedef boost::shared_ptr<crc32_async_bb> sptr;
+
+ /*!
+ * \param check Set to true if you want to check CRC, false to create CRC.
+ */
+ static sptr make(bool check=false);
+ };
+
+ } // namespace digital
+} // namespace gr
+
+#endif /* INCLUDED_DIGITAL_CRC32_ASYNC_BB_H */