summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPiotr Krysik <perper@o2.pl>2009-04-20 19:56:50 +0200
committerPiotr Krysik <perper@o2.pl>2009-04-20 19:56:50 +0200
commit59ea3a8a82e6f166b80fc489945c43fdc8764ea0 (patch)
tree92176874246d4e5619200f1284934a9d70f96b74
parent00cf03a40f5ddee09aadec5a45d6bb311d170bbd (diff)
added non-traced files
-rw-r--r--src/lib/Assert.h65
-rw-r--r--src/lib/gsm.i36
-rw-r--r--src/lib/gsm_constants.h94
3 files changed, 195 insertions, 0 deletions
diff --git a/src/lib/Assert.h b/src/lib/Assert.h
new file mode 100644
index 0000000..6c04f18
--- /dev/null
+++ b/src/lib/Assert.h
@@ -0,0 +1,65 @@
+/*
+* Copyright 2008 Free Software Foundation, Inc.
+*
+* This software is distributed under the terms of the GNU Public License.
+* See the COPYING file in the main directory for details.
+
+ This program 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 of the License, or
+ (at your option) any later version.
+
+ This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+
+#ifndef ASSERT_H
+#define ASSERT_H
+
+#include "stdio.h"
+#include <iostream>
+
+/**@name Macros for standard messages. */
+//@{
+#define COUT(text) { std::cout << text << std::endl; }
+#define CERR(text) { std::cerr << __FILE__ << ":" << __LINE__ << ": " << text; }
+#ifdef NDEBUG
+#define DCOUT(text) {}
+#define OBJDCOUT(text) {}
+#else
+#define DCOUT(text) { COUT(__FILE__ << ":" << __LINE__ << " " << text); }
+#define OBJDCOUT(text) { DCOUT(this << " " << text); }
+#endif
+//@}
+
+
+/** This is thrown by assert() so that gdb can catch it. */
+
+class Assertion
+{
+
+ public:
+
+ Assertion() {
+ fprintf( stderr,"Try setting a breakpoint @ %s:%u.\n",__FILE__,__LINE__ );
+ return;
+ }
+
+};
+
+#ifdef NDEBUG
+#define assert(EXPR) {};
+#else
+/** This replaces the regular assert() with a C++ exception. */
+#include "stdio.h"
+#define assert(E) { if (!(E)) { fprintf(stderr,"%s:%u failed assertion '%s'\n",__FILE__,__LINE__,#E); throw Assertion(); } }
+#endif
+
+#endif
diff --git a/src/lib/gsm.i b/src/lib/gsm.i
new file mode 100644
index 0000000..dac7602
--- /dev/null
+++ b/src/lib/gsm.i
@@ -0,0 +1,36 @@
+/* -*- c++ -*- */
+
+%feature("autodoc", "1"); // generate python docstrings
+
+%include "exception.i"
+%import "gnuradio.i" // the common stuff
+
+%include "gsm_constants.h"
+
+%{
+#include "gnuradio_swig_bug_workaround.h" // mandatory bug fix
+#include "gsm_receiver_cf.h"
+#include <stdexcept>
+#include "gsm_constants.h"
+%}
+
+// ----------------------------------------------------------------
+
+/*
+ * First arg is the package prefix.
+ * Second arg is the name of the class minus the prefix.
+ *
+ * This does some behind-the-scenes magic so we can
+ * access howto_square_ff from python as howto.square_ff
+ */
+GR_SWIG_BLOCK_MAGIC(gsm,receiver_cf);
+
+gsm_receiver_cf_sptr gsm_make_receiver_cf ( gr_feval_dd *tuner, int osr);
+
+class gsm_receiver_cf : public gr_block
+{
+private:
+ gsm_receiver_cf ( gr_feval_dd *tuner, int osr);
+};
+
+// ----------------------------------------------------------------
diff --git a/src/lib/gsm_constants.h b/src/lib/gsm_constants.h
new file mode 100644
index 0000000..01dfb22
--- /dev/null
+++ b/src/lib/gsm_constants.h
@@ -0,0 +1,94 @@
+#ifndef INCLUDED_GSM_CONSTANTS_H
+#define INCLUDED_GSM_CONSTANTS_H
+
+#define GSM_SYMBOL_RATE (1625000.0/6.0) //symbols per second
+#define GSM_SYMBOL_PERIOD (1.0/GSM_SYMBOL_RATE) //seconds per symbol
+
+//Burst timing
+#define TAIL_BITS 3
+#define GUARD_BITS 8 //8.25
+#define DATA_BITS 58 //size of 1 data block in normal burst
+#define N_TRAIN_BITS 26
+#define N_SYNC_BITS 64
+#define USEFUL_BITS 142 //(2*DATA_BITS + N_TRAIN_BITS )
+#define FCCH_BITS USEFUL_BITS
+
+#define TS_BITS (TAIL_BITS+USEFUL_BITS+TAIL_BITS+GUARD_BITS) //a full TS (156)
+#define TS_PER_FRAME 8
+#define FRAME_BITS (TS_PER_FRAME * TS_BITS + 2) // +2 for extra 8*0.25 guard bits
+#define FCCH_POS TAIL_BITS
+#define SYNC_POS 39
+#define TRAIN_POS 58
+
+#define FCCH_HITS_NEEDED (USEFUL_BITS - 4)
+#define FCCH_MAX_MISSES 2
+
+static const int SYNC_BITS[] = {
+ 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1,
+ 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1,
+ 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1
+};
+
+// Sync : .+...++.+..+++.++++++.++++++....++.+..+.+.+++.+.+...+..++++..+..
+// Diff Encoded Sync: .++..+.+++.+..++.....++.....+...+.+++.+++++..+++++..++.+...+.++.
+
+#define TSC0 0
+#define TSC1 1
+#define TSC2 2
+#define TSC3 3
+#define TSC4 4
+#define TSC5 5
+#define TSC6 6
+#define TSC7 7
+#define TS_FCCH 8
+#define TS_DUMMY 9
+
+static const unsigned char train_seq[10][N_TRAIN_BITS] = {
+ {0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1},
+ {0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1},
+ {0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0,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0, 1, 1,
+ 0, 0, 1, 1, 1, 0, 0, 1, 1, 1,
+ 1, 0, 1, 0, 0, 1, 1, 1, 1, 1,
+ 0, 0, 0, 1, 0, 0, 1, 0, 1, 1,
+ 1, 1, 1, 0, 1, 0, 1, 0
+};
+
+//Diff encoded train_seq
+//TSC0: +.++.+++..+...++..++.+++..
+//TSC1: +.+++.++..++...+..++.+++..
+//TSC2: +++...+..++..+++.++...+..+
+//TSC3: +++..+...++.+++..++..+...+
+//TSC4: +..+.++++..+.++....+.++++.
+//TSC5: +++.+..++++.+....++.+..+++
+//TSC6: .+++.+....++.+..++++.+....
+//TSC7: ...++...+..++.+++..++...+.
+//TSC8: ..........................
+//TSC9: ++..+..+++..+..+++..+..+++
+
+
+#endif /* INCLUDED_GSM_CONSTANTS_H */
personal git repositories of Harald Welte. Your mileage may vary