summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gnuradio-core/src/lib/general/Makefile.am3
-rw-r--r--gnuradio-core/src/lib/general/general.i2
-rw-r--r--gr-digital/lib/Makefile.am2
-rw-r--r--gr-digital/lib/digital_crc32.cc (renamed from gnuradio-core/src/lib/general/gr_crc32.cc)18
-rw-r--r--gr-digital/lib/digital_crc32.h (renamed from gnuradio-core/src/lib/general/gr_crc32.h)14
-rw-r--r--gr-digital/python/Makefile.am12
-rw-r--r--gr-digital/python/crc.py (renamed from gnuradio-core/src/python/gnuradio/gruimpl/crc.py)7
-rw-r--r--gr-digital/python/qa_crc32.py60
-rw-r--r--gr-digital/swig/Makefile.am1
-rw-r--r--gr-digital/swig/digital_crc32.i (renamed from gnuradio-core/src/lib/general/gr_crc32.i)10
-rw-r--r--gr-digital/swig/digital_swig.i2
11 files changed, 96 insertions, 35 deletions
diff --git a/gnuradio-core/src/lib/general/Makefile.am b/gnuradio-core/src/lib/general/Makefile.am
index ed6717c4d..7382df721 100644
--- a/gnuradio-core/src/lib/general/Makefile.am
+++ b/gnuradio-core/src/lib/general/Makefile.am
@@ -55,7 +55,6 @@ libgeneral_la_SOURCES = \
gr_copy.cc \
gr_count_bits.cc \
gr_cpfsk_bc.cc \
- gr_crc32.cc \
gr_ctcss_squelch_ff.cc \
gr_decode_ccsds_27_fb.cc \
gr_deinterleave.cc \
@@ -205,7 +204,6 @@ grinclude_HEADERS = \
gr_copy.h \
gr_count_bits.h \
gr_cpfsk_bc.h \
- gr_crc32.h \
gr_ctcss_squelch_ff.h \
gr_decode_ccsds_27_fb.h \
gr_diff_decoder_bb.h \
@@ -371,7 +369,6 @@ swiginclude_HEADERS = \
gr_conjugate_cc.i \
gr_copy.i \
gr_cpfsk_bc.i \
- gr_crc32.i \
gr_ctcss_squelch_ff.i \
gr_decode_ccsds_27_fb.i \
gr_diff_decoder_bb.i \
diff --git a/gnuradio-core/src/lib/general/general.i b/gnuradio-core/src/lib/general/general.i
index d4bad60b8..d10b6ecfb 100644
--- a/gnuradio-core/src/lib/general/general.i
+++ b/gnuradio-core/src/lib/general/general.i
@@ -77,7 +77,6 @@
#include <gr_vector_to_streams.h>
#include <gr_conjugate_cc.h>
#include <gr_vco_f.h>
-#include <gr_crc32.h>
#include <gr_threshold_ff.h>
#include <gr_packet_sink.h>
#include <gr_dpll_bb.h>
@@ -196,7 +195,6 @@
%include "gr_vector_to_streams.i"
%include "gr_conjugate_cc.i"
%include "gr_vco_f.i"
-%include "gr_crc32.i"
%include "gr_threshold_ff.i"
%include "gr_packet_sink.i"
%include "gr_dpll_bb.i"
diff --git a/gr-digital/lib/Makefile.am b/gr-digital/lib/Makefile.am
index acefa1ef9..e3cbbe7ea 100644
--- a/gr-digital/lib/Makefile.am
+++ b/gr-digital/lib/Makefile.am
@@ -34,6 +34,7 @@ grinclude_HEADERS = \
digital_correlate_access_code_bb.h \
digital_costas_loop_cc.h \
digital_cma_equalizer_cc.h \
+ digital_crc32.h \
digital_lms_dd_equalizer_cc.h \
digital_kurtotic_equalizer_cc.h \
digital_metric_type.h
@@ -50,6 +51,7 @@ libgnuradio_digital_la_SOURCES = \
digital_correlate_access_code_bb.cc \
digital_costas_loop_cc.cc \
digital_cma_equalizer_cc.cc \
+ digital_crc32.cc \
digital_lms_dd_equalizer_cc.cc \
digital_kurtotic_equalizer_cc.cc
diff --git a/gnuradio-core/src/lib/general/gr_crc32.cc b/gr-digital/lib/digital_crc32.cc
index d4e843528..8806d6e9c 100644
--- a/gnuradio-core/src/lib/general/gr_crc32.cc
+++ b/gr-digital/lib/digital_crc32.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2005 Free Software Foundation, Inc.
+ * Copyright 2005,2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -27,13 +27,13 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
-#include <gr_crc32.h>
+#include <digital_crc32.h>
// Automatically generated CRC function
// polynomial: 0x104C11DB7
unsigned int
-gr_update_crc32(unsigned int crc, const unsigned char *data, size_t len)
+digital_update_crc32(unsigned int crc, const unsigned char *data, size_t len)
{
static const unsigned int table[256] = {
0x00000000U,0x04C11DB7U,0x09823B6EU,0x0D4326D9U,
@@ -112,19 +112,19 @@ gr_update_crc32(unsigned int crc, const unsigned char *data, size_t len)
}
unsigned int
-gr_update_crc32(unsigned int crc, const std::string s)
+digital_update_crc32(unsigned int crc, const std::string s)
{
- return gr_update_crc32(crc, (const unsigned char *) s.data(), s.size());
+ return digital_update_crc32(crc, (const unsigned char *) s.data(), s.size());
}
unsigned int
-gr_crc32(const unsigned char *buf, size_t len)
+digital_crc32(const unsigned char *buf, size_t len)
{
- return gr_update_crc32(0xffffffff, buf, len) ^ 0xffffffff;
+ return digital_update_crc32(0xffffffff, buf, len) ^ 0xffffffff;
}
unsigned int
-gr_crc32(const std::string s)
+digital_crc32(const std::string s)
{
- return gr_crc32((const unsigned char *) s.data(), s.size());
+ return digital_crc32((const unsigned char *) s.data(), s.size());
}
diff --git a/gnuradio-core/src/lib/general/gr_crc32.h b/gr-digital/lib/digital_crc32.h
index 87a8d15f2..64aa12f7b 100644
--- a/gnuradio-core/src/lib/general/gr_crc32.h
+++ b/gr-digital/lib/digital_crc32.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2005 Free Software Foundation, Inc.
+ * Copyright 2005,2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,8 +20,8 @@
* Boston, MA 02110-1301, USA.
*/
-#ifndef INCLUDED_GR_CRC32_H
-#define INCLUDED_GR_CRC32_H
+#ifndef INCLUDED_DIGITAL_CRC32_H
+#define INCLUDED_DIGITAL_CRC32_H
#include <string>
#include <gr_types.h>
@@ -36,15 +36,15 @@
* transmitted in big endian order.
*/
unsigned int
-gr_update_crc32(unsigned int crc, const unsigned char *buf, size_t len);
+digital_update_crc32(unsigned int crc, const unsigned char *buf, size_t len);
unsigned int
-gr_update_crc32(unsigned int crc, const std::string buf);
+digital_update_crc32(unsigned int crc, const std::string buf);
unsigned int
-gr_crc32(const unsigned char *buf, size_t len);
+digital_crc32(const unsigned char *buf, size_t len);
unsigned int
-gr_crc32(const std::string buf);
+digital_crc32(const std::string buf);
#endif /* INCLUDED_CRC32_H */
diff --git a/gr-digital/python/Makefile.am b/gr-digital/python/Makefile.am
index a6d9f779d..09be67f3a 100644
--- a/gr-digital/python/Makefile.am
+++ b/gr-digital/python/Makefile.am
@@ -40,18 +40,20 @@ noinst_PYTHON = \
qa_constellation_decoder_cb.py \
qa_correlate_access_code.py \
qa_costas_loop_cc.py \
+ qa_crc32.py \
qa_lms_equalizer.py
digital_PYTHON = \
__init__.py \
- psk.py \
+ crc.py \
+ bpsk.py \
dbpsk.py \
dqpsk.py \
d8psk.py \
- psk2.py \
generic_mod_demod.py \
+ gmsk.py \
+ psk.py \
+ psk2.py \
qam.py \
- bpsk.py \
- qpsk.py \
- gmsk.py
+ qpsk.py
endif
diff --git a/gnuradio-core/src/python/gnuradio/gruimpl/crc.py b/gr-digital/python/crc.py
index d31aca0ea..f9d369f4c 100644
--- a/gnuradio-core/src/python/gnuradio/gruimpl/crc.py
+++ b/gr-digital/python/crc.py
@@ -1,5 +1,5 @@
#
-# Copyright 2005,2007 Free Software Foundation, Inc.
+# Copyright 2005,2007,2011 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -19,13 +19,12 @@
# Boston, MA 02110-1301, USA.
#
-from gnuradio import gr
-from hexint import *
+from gnuradio import gr, gru
import struct
def gen_and_append_crc32(s):
crc = gr.crc32(s)
- return s + struct.pack(">I", hexint(crc) & 0xFFFFFFFF)
+ return s + struct.pack(">I", gru.hexint(crc) & 0xFFFFFFFF)
def check_crc32(s):
if len(s) < 4:
diff --git a/gr-digital/python/qa_crc32.py b/gr-digital/python/qa_crc32.py
new file mode 100644
index 000000000..f86813f3f
--- /dev/null
+++ b/gr-digital/python/qa_crc32.py
@@ -0,0 +1,60 @@
+#!/usr/bin/env python
+#
+# Copyright 2011 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.
+#
+
+from gnuradio import gr, gr_unittest
+import digital_swig
+import random, cmath
+
+class test_crc32(gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test01 (self):
+ data = 100*"0"
+ expected_result = 2943744955
+ result = digital_swig.crc32(data)
+ #print hex(result)
+
+ self.assertEqual (expected_result, result)
+
+ def test02 (self):
+ data = 100*"1"
+ expected_result = 2326594156
+ result = digital_swig.crc32(data)
+ #print hex(result)
+
+ self.assertEqual (expected_result, result)
+
+ def test03 (self):
+ data = 10*"0123456789"
+ expected_result = 3774345973
+ result = digital_swig.crc32(data)
+ #print hex(result)
+
+ self.assertEqual (expected_result, result)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_crc32, "test_crc32.xml")
diff --git a/gr-digital/swig/Makefile.am b/gr-digital/swig/Makefile.am
index df8f184b3..0a4176fc1 100644
--- a/gr-digital/swig/Makefile.am
+++ b/gr-digital/swig/Makefile.am
@@ -67,6 +67,7 @@ digital_swig_swiginclude_headers = \
digital_correlate_access_code_bb.i \
digital_costas_loop_cc.i \
digital_cma_equalizer_cc.i \
+ digital_crc32.i \
digital_lms_dd_equalizer_cc.i \
digital_kurtotic_equalizer_cc.i
diff --git a/gnuradio-core/src/lib/general/gr_crc32.i b/gr-digital/swig/digital_crc32.i
index 7dca5c6a1..806bfad6a 100644
--- a/gnuradio-core/src/lib/general/gr_crc32.i
+++ b/gr-digital/swig/digital_crc32.i
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2005 Free Software Foundation, Inc.
+ * Copyright 2005,2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,8 +20,8 @@
* Boston, MA 02110-1301, USA.
*/
-%rename(update_crc32) gr_update_crc32;
-%rename(crc32) gr_crc32;
+%rename(update_crc32) digital_update_crc32;
+%rename(crc32) digital_crc32;
-unsigned int gr_update_crc32(unsigned int crc, const std::string buf);
-unsigned int gr_crc32(const std::string buf);
+unsigned int digital_update_crc32(unsigned int crc, const std::string buf);
+unsigned int digital_crc32(const std::string buf);
diff --git a/gr-digital/swig/digital_swig.i b/gr-digital/swig/digital_swig.i
index 700c54039..bc7c9b0d9 100644
--- a/gr-digital/swig/digital_swig.i
+++ b/gr-digital/swig/digital_swig.i
@@ -31,6 +31,7 @@
#include "digital_constellation_receiver_cb.h"
#include "digital_correlate_access_code_bb.h"
#include "digital_costas_loop_cc.h"
+#include "digital_crc32.h"
#include "digital_kurtotic_equalizer_cc.h"
#include "digital_lms_dd_equalizer_cc.h"
%}
@@ -44,6 +45,7 @@
%include "digital_constellation_receiver_cb.i"
%include "digital_correlate_access_code_bb.i"
%include "digital_costas_loop_cc.i"
+%include "digital_crc32.i"
%include "digital_kurtotic_equalizer_cc.i"
%include "digital_lms_dd_equalizer_cc.i"