GNU Radio's GSM Package
gsm_constants.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 * @file
4 * @author (C) 2014 by Piotr Krysik <ptrkrysik@gmail.com>
5 * @section LICENSE
6 *
7 * Gr-gsm is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3, or (at your option)
10 * any later version.
11 *
12 * Gr-gsm is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with gr-gsm; see the file COPYING. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street,
20 * Boston, MA 02110-1301, USA.
21 */
22
23#ifndef INCLUDED_GSM_CONSTANTS_H
24#define INCLUDED_GSM_CONSTANTS_H
25
26#define GSM_SYMBOL_RATE (1625000.0/6.0) //symbols per second
27#define GSM_SYMBOL_PERIOD (1.0/GSM_SYMBOL_RATE) //seconds per symbol
28
29//Burst timing
30#define TAIL_BITS 3
31#define GUARD_BITS 8
32#define GUARD_FRACTIONAL 0.25 //fractional part of guard period
33#define GUARD_PERIOD GUARD_BITS + GUARD_FRACTIONAL
34#define DATA_BITS 57 //size of 1 data block in normal burst
35#define STEALING_BIT 1
36#define N_TRAIN_BITS 26
37#define N_SYNC_BITS 64
38#define USEFUL_BITS 142 //(2*(DATA_BITS+STEALING_BIT) + N_TRAIN_BITS )
39#define FCCH_BITS USEFUL_BITS
40#define BURST_SIZE (USEFUL_BITS+2*TAIL_BITS)
41#define ACCESS_BURST_SIZE 88
42#define PROCESSED_CHUNK BURST_SIZE+2*GUARD_PERIOD
43
44#define SCH_DATA_LEN 39
45#define TS_BITS (TAIL_BITS+USEFUL_BITS+TAIL_BITS+GUARD_BITS) //a full TS (156 bits)
46#define TS_PER_FRAME 8
47#define FRAME_BITS (TS_PER_FRAME * TS_BITS + 2) // 156.25 * 8
48#define FCCH_POS TAIL_BITS
49#define SYNC_POS 39
50#define TRAIN_POS ( TAIL_BITS + (DATA_BITS+STEALING_BIT) + 5) //first 5 bits of a training sequence
51 //aren't used for channel impulse response estimation
52#define TRAIN_BEGINNING 5
53#define SAFETY_MARGIN 6 //
54
55#define FCCH_HITS_NEEDED (USEFUL_BITS - 4)
56#define FCCH_MAX_MISSES 1
57#define FCCH_MAX_FREQ_OFFSET 100
58
59#define CHAN_IMP_RESP_LENGTH 5
60
61#define MAX_SCH_ERRORS 10 //maximum number of subsequent sch errors after which gsm receiver goes to find_next_fcch state
62
65
66static const unsigned char SYNC_BITS[] = {
67 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0,
68 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1,
69 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1,
70 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1
71};
72
73const unsigned FCCH_FRAMES[] = {0, 10, 20, 30, 40};
74const unsigned SCH_FRAMES[] = {1, 11, 21, 31, 41};
75
76const unsigned BCCH_FRAMES[] = {2, 3, 4, 5}; //!!the receiver shouldn't care about logical
77 //!!channels so this will be removed from this header
78const unsigned TEST_CCH_FRAMES[] = {2, 3, 4, 5, 6, 7, 8, 9, 12, 13, 14, 15, 16, 17, 18, 19, 22, 23, 24, 25, 26, 27, 28, 29, 32, 33, 34, 35, 36, 37, 38, 39, 42, 43, 44, 45, 46, 47, 48, 49};
79const unsigned TRAFFIC_CHANNEL_F[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24};
80const unsigned TEST51[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50};
81
82
83#define TSC0 0
84#define TSC1 1
85#define TSC2 2
86#define TSC3 3
87#define TSC4 4
88#define TSC5 5
89#define TSC6 6
90#define TSC7 7
91#define TS_DUMMY 8
92
93#define TRAIN_SEQ_NUM 9
94
95#define TIMESLOT0 0
96#define TIMESLOT1 1
97#define TIMESLOT2 2
98#define TIMESLOT3 3
99#define TIMESLOT4 4
100#define TIMESLOT5 5
101#define TIMESLOT6 6
102#define TIMESLOT7 7
103
104
105static const unsigned char train_seq[TRAIN_SEQ_NUM][N_TRAIN_BITS] = {
106 {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},
107 {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},
108 {0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0},
109 {0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0},
110 {0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1},
111 {0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0},
112 {1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1},
113 {1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0},
114 {0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1} // DUMMY
115};
116
117
118//Dummy burst 0xFB 76 0A 4E 09 10 1F 1C 5C 5C 57 4A 33 39 E9 F1 2F A8
119static const unsigned char dummy_burst[] = {
120 0, 0, 0,
121 1, 1, 1, 1, 1, 0, 1, 1, 0, 1,
122 1, 1, 0, 1, 1, 0, 0, 0, 0, 0,
123 1, 0, 1, 0, 0, 1, 0, 0, 1, 1,
124 1, 0, 0, 0, 0, 0, 1, 0, 0, 1,
125 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
126 0, 1, 1, 1, 1, 1, 0, 0,
127
128 0, 1, 1, 1, 0, 0, 0, 1, 0, 1,
129 1, 1, 0, 0, 0, 1, 0, 1, 1, 1,
130 0, 0, 0, 1, 0, 1,
131
132 0, 1, 1, 1, 0, 1, 0, 0, 1, 0,
133 1, 0, 0, 0, 1, 1, 0, 0, 1, 1,
134 0, 0, 1, 1, 1, 0, 0, 1, 1, 1,
135 1, 0, 1, 0, 0, 1, 1, 1, 1, 1,
136 0, 0, 0, 1, 0, 0, 1, 0, 1, 1,
137 1, 1, 1, 0, 1, 0, 1, 0,
138 0, 0, 0
139};
140
141
142/*
143 * The frequency correction burst is used for frequency synchronization
144 * of the mobile. This is broadcast in TS0 together with the SCH and
145 * BCCH.
146 *
147 * Modulating the bits below causes a spike at 62.5kHz above (below for
148 * COMPACT) the center frequency. One can use this spike with a narrow
149 * band filter to accurately determine the center of the channel.
150 */
151static const unsigned char fc_fb[] = {
152 0, 0, 0, //I don't use this tables,
153 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //I copied this here from burst_types.h because
154 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //the description is very informative - p.krysik
155 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
156 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
157 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
158 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
159 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
160 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
161 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
162 0, 0, 0
163};
164
165static const unsigned char fc_compact_fb[] = {
166 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
167 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
168 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
169 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
170 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
171 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
172 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
173 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
174 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0
175};
176
177
178#endif /* INCLUDED_GSM_CONSTANTS_H */
static const unsigned char dummy_burst[]
Definition: gsm_constants.h:119
#define TRAIN_SEQ_NUM
Definition: gsm_constants.h:93
static const unsigned char fc_compact_fb[]
Definition: gsm_constants.h:165
const unsigned TEST51[]
Definition: gsm_constants.h:80
const unsigned BCCH_FRAMES[]
Definition: gsm_constants.h:76
const unsigned TRAFFIC_CHANNEL_F[]
Definition: gsm_constants.h:79
static const unsigned char fc_fb[]
Definition: gsm_constants.h:151
const unsigned SCH_FRAMES[]
Definition: gsm_constants.h:74
const unsigned FCCH_FRAMES[]
Definition: gsm_constants.h:73
const unsigned TEST_CCH_FRAMES[]
!the receiver shouldn't care about logical !channels so this will be removed from this header
Definition: gsm_constants.h:78
#define N_TRAIN_BITS
Definition: gsm_constants.h:36
multiframe_type
Definition: gsm_constants.h:64
@ unknown
Definition: gsm_constants.h:64
@ multiframe_26
Definition: gsm_constants.h:64
@ multiframe_51
Definition: gsm_constants.h:64
static const unsigned char train_seq[TRAIN_SEQ_NUM][N_TRAIN_BITS]
Definition: gsm_constants.h:105
burst_type
Definition: gsm_constants.h:63
@ dummy
Definition: gsm_constants.h:63
@ normal_or_noise
Definition: gsm_constants.h:63
@ fcch_burst
Definition: gsm_constants.h:63
@ normal_burst
Definition: gsm_constants.h:63
@ sch_burst
Definition: gsm_constants.h:63
@ rach_burst
Definition: gsm_constants.h:63
@ dummy_or_normal
Definition: gsm_constants.h:63
@ empty
Definition: gsm_constants.h:63
static const unsigned char SYNC_BITS[]
Definition: gsm_constants.h:66