blob: d56d1f37de237f9a7a868ba7fecd84d240d0050a [file] [log] [blame]
piotr437f5462014-02-04 17:57:25 +01001/* -*- c++ -*- */
piotrd0bf1492014-02-05 17:27:32 +01002/*
piotrc1d47df2014-04-17 09:45:50 +02003 * Copyright 2014 Piotr Krysik <pkrysik@elka.pw.edu.pl>.
piotrd0bf1492014-02-05 17:27:32 +01004 *
piotr437f5462014-02-04 17:57:25 +01005 * This is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3, or (at your option)
8 * any later version.
piotrd0bf1492014-02-05 17:27:32 +01009 *
piotr437f5462014-02-04 17:57:25 +010010 * This software is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
piotrd0bf1492014-02-05 17:27:32 +010014 *
piotr437f5462014-02-04 17:57:25 +010015 * You should have received a copy of the GNU General Public License
16 * along with this software; see the file COPYING. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street,
18 * Boston, MA 02110-1301, USA.
19 */
20
21#ifdef HAVE_CONFIG_H
22#include "config.h"
23#endif
24
25#include <gnuradio/io_signature.h>
26#include "receiver_impl.h"
27
28#include <gnuradio/io_signature.h>
29#include <gnuradio/math.h>
30#include <math.h>
31#include <boost/circular_buffer.hpp>
32#include <algorithm>
33#include <numeric>
34#include <viterbi_detector.h>
35#include <string.h>
36#include <sch.h>
37#include <iostream>
38#include <iomanip>
piotr437f5462014-02-04 17:57:25 +010039#include <assert.h>
piotr6d152d92014-02-21 00:02:44 +010040#include <boost/scoped_ptr.hpp>
piotr437f5462014-02-04 17:57:25 +010041
42#define SYNC_SEARCH_RANGE 30
43
piotrd0bf1492014-02-05 17:27:32 +010044namespace gr
45{
46namespace gsm
47{
piotr437f5462014-02-04 17:57:25 +010048
piotrd0bf1492014-02-05 17:27:32 +010049typedef std::list<float> list_float;
50typedef std::vector<float> vector_float;
piotr437f5462014-02-04 17:57:25 +010051
piotrd0bf1492014-02-05 17:27:32 +010052typedef boost::circular_buffer<float> circular_buffer_float;
piotr437f5462014-02-04 17:57:25 +010053
piotrd0bf1492014-02-05 17:27:32 +010054receiver::sptr
piotr6d152d92014-02-21 00:02:44 +010055receiver::make(feval_dd * tuner, int osr, int arfcn)
piotrd0bf1492014-02-05 17:27:32 +010056{
57 return gnuradio::get_initial_sptr
piotr6d152d92014-02-21 00:02:44 +010058 (new receiver_impl(tuner, osr, arfcn));
piotrd0bf1492014-02-05 17:27:32 +010059}
60
61/*
62 * The private constructor
63 */
piotr6d152d92014-02-21 00:02:44 +010064receiver_impl::receiver_impl(feval_dd * tuner, int osr, int arfcn)
piotrd0bf1492014-02-05 17:27:32 +010065 : gr::block("receiver",
66 gr::io_signature::make(1, 1, sizeof(gr_complex)),
piotr7c82b172014-02-08 14:15:27 +010067 gr::io_signature::make(0, 0, 0)),
piotrd0bf1492014-02-05 17:27:32 +010068 d_OSR(osr),
69 d_chan_imp_length(CHAN_IMP_RESP_LENGTH),
70 d_tuner(tuner),
71 d_counter(0),
72 d_fcch_start_pos(0),
73 d_freq_offset(0),
74 d_state(first_fcch_search),
75 d_burst_nr(osr),
piotr6d152d92014-02-21 00:02:44 +010076 d_failed_sch(0),
77 d_arfcn((int)(arfcn)),
78 d_signal_dbm(-120)
piotrd0bf1492014-02-05 17:27:32 +010079{
80 int i;
81 gmsk_mapper(SYNC_BITS, N_SYNC_BITS, d_sch_training_seq, gr_complex(0.0, -1.0));
82 for (i = 0; i < TRAIN_SEQ_NUM; i++)
piotr437f5462014-02-04 17:57:25 +010083 {
piotr437f5462014-02-04 17:57:25 +010084 gr_complex startpoint;
piotrd0bf1492014-02-05 17:27:32 +010085 if (i == 6 || i == 7) //this is nasty hack
86 {
87 startpoint = gr_complex(-1.0, 0.0); //if I don't change it here all bits of normal bursts for BTSes with bcc=6 will have reversed values
88 }
89 else
90 {
91 startpoint = gr_complex(1.0, 0.0); //I've checked this hack for bcc==0,1,2,3,4,6
piotr437f5462014-02-04 17:57:25 +010092 } //I don't know what about bcc==5 and 7 yet
93 //TODO:find source of this situation - this is purely mathematical problem I guess
94
95 gmsk_mapper(train_seq[i], N_TRAIN_BITS, d_norm_training_seq[i], startpoint);
piotr437f5462014-02-04 17:57:25 +010096 }
piotr7c82b172014-02-08 14:15:27 +010097 message_port_register_out(pmt::mp("bursts"));
piotr903b1d62014-04-17 11:33:27 +020098 configure_receiver(); //configure the receiver - tell it where to find which burst type
piotrd0bf1492014-02-05 17:27:32 +010099}
piotr437f5462014-02-04 17:57:25 +0100100
piotrd0bf1492014-02-05 17:27:32 +0100101/*
102 * Our virtual destructor.
103 */
104receiver_impl::~receiver_impl()
105{
106}
107
108void receiver_impl::forecast(int noutput_items, gr_vector_int &ninput_items_required)
109{
110 ninput_items_required[0] = noutput_items * floor((TS_BITS + 2 * GUARD_PERIOD) * d_OSR);
111}
112
113
114int
115receiver_impl::general_work(int noutput_items,
116 gr_vector_int &ninput_items,
117 gr_vector_const_void_star &input_items,
118 gr_vector_void_star &output_items)
119{
120 const gr_complex *input = (const gr_complex *) input_items[0];
piotr7c82b172014-02-08 14:15:27 +0100121
piotrd0bf1492014-02-05 17:27:32 +0100122 switch (d_state)
piotr437f5462014-02-04 17:57:25 +0100123 {
piotrd0bf1492014-02-05 17:27:32 +0100124 //bootstrapping
125 case first_fcch_search:
piotr7e3b0db2014-02-05 22:44:30 +0100126 DCOUT("FCCH search");
piotrd0bf1492014-02-05 17:27:32 +0100127 if (find_fcch_burst(input, ninput_items[0])) //find frequency correction burst in the input buffer
128 {
piotr5f1e1d32014-02-05 18:10:05 +0100129 //set_frequency(d_freq_offset); //if fcch search is successful set frequency offset
piotr6d152d92014-02-21 00:02:44 +0100130 COUT("Freq offset " << d_freq_offset);
piotr437f5462014-02-04 17:57:25 +0100131 d_state = next_fcch_search;
piotrd0bf1492014-02-05 17:27:32 +0100132 }
133 else
134 {
piotr437f5462014-02-04 17:57:25 +0100135 d_state = first_fcch_search;
piotrd0bf1492014-02-05 17:27:32 +0100136 }
137 break;
piotr437f5462014-02-04 17:57:25 +0100138
piotrd0bf1492014-02-05 17:27:32 +0100139 case next_fcch_search: //this state is used because it takes some time (a bunch of buffered samples)
140 {
piotr7e3b0db2014-02-05 22:44:30 +0100141 DCOUT("NEXT FCCH search");
piotrd0bf1492014-02-05 17:27:32 +0100142 float prev_freq_offset = d_freq_offset; //before previous set_frequqency cause change
143 if (find_fcch_burst(input, ninput_items[0]))
144 {
145 if (abs(prev_freq_offset - d_freq_offset) > FCCH_MAX_FREQ_OFFSET)
146 {
piotr5f1e1d32014-02-05 18:10:05 +0100147 //set_frequency(d_freq_offset); //call set_frequncy only frequency offset change is greater than some value
piotr6d152d92014-02-21 00:02:44 +0100148 DCOUT("Freq offset " << d_freq_offset);
piotr437f5462014-02-04 17:57:25 +0100149 }
piotrd0bf1492014-02-05 17:27:32 +0100150 d_state = sch_search;
151 }
152 else
153 {
piotrd0bf1492014-02-05 17:27:32 +0100154 d_state = next_fcch_search;
155 }
156 break;
157 }
piotr437f5462014-02-04 17:57:25 +0100158
159
piotrd0bf1492014-02-05 17:27:32 +0100160 case sch_search:
161 {
piotr7c82b172014-02-08 14:15:27 +0100162 DCOUT("SCH search");
piotrd0bf1492014-02-05 17:27:32 +0100163 vector_complex channel_imp_resp(CHAN_IMP_RESP_LENGTH*d_OSR);
164 int t1, t2, t3;
165 int burst_start = 0;
166 unsigned char output_binary[BURST_SIZE];
piotr437f5462014-02-04 17:57:25 +0100167
piotrd0bf1492014-02-05 17:27:32 +0100168 if (reach_sch_burst(ninput_items[0])) //wait for a SCH burst
169 {
170 burst_start = get_sch_chan_imp_resp(input, &channel_imp_resp[0]); //get channel impulse response from it
171 detect_burst(input, &channel_imp_resp[0], burst_start, output_binary); //detect bits using MLSE detection
172 if (decode_sch(&output_binary[3], &t1, &t2, &t3, &d_ncc, &d_bcc) == 0) //decode SCH burst
173 {
piotr6d152d92014-02-21 00:02:44 +0100174 DCOUT("sch burst_start: " << burst_start);
175 DCOUT("bcc: " << d_bcc << " ncc: " << d_ncc << " t1: " << t1 << " t2: " << t2 << " t3: " << t3);
piotr437f5462014-02-04 17:57:25 +0100176 d_burst_nr.set(t1, t2, t3, 0); //set counter of bursts value
piotr437f5462014-02-04 17:57:25 +0100177 d_burst_nr++;
178
179 consume_each(burst_start + BURST_SIZE * d_OSR); //consume samples up to next guard period
180 d_state = synchronized;
piotrd0bf1492014-02-05 17:27:32 +0100181 }
182 else
183 {
piotr437f5462014-02-04 17:57:25 +0100184 d_state = next_fcch_search; //if there is error in the sch burst go back to fcch search phase
piotr437f5462014-02-04 17:57:25 +0100185 }
piotrd0bf1492014-02-05 17:27:32 +0100186 }
187 else
188 {
189 d_state = sch_search;
190 }
191 break;
192 }
193 //in this state receiver is synchronized and it processes bursts according to burst type for given burst number
194 case synchronized:
195 {
piotr6d152d92014-02-21 00:02:44 +0100196 DCOUT("Synchronized");
piotrd0bf1492014-02-05 17:27:32 +0100197 vector_complex channel_imp_resp(CHAN_IMP_RESP_LENGTH*d_OSR);
198 int burst_start;
199 int offset = 0;
200 int to_consume = 0;
201 unsigned char output_binary[BURST_SIZE];
piotr437f5462014-02-04 17:57:25 +0100202
piotrd0bf1492014-02-05 17:27:32 +0100203 burst_type b_type = d_channel_conf.get_burst_type(d_burst_nr); //get burst type for given burst number
piotr6d152d92014-02-21 00:02:44 +0100204 double signal_pwr=0;
205 for(int ii=0;ii<ninput_items[0];ii++)
206 {
207 signal_pwr += abs(input[ii])*abs(input[ii]);
208 }
209 d_signal_dbm=static_cast<int8_t>(round(20*log10(signal_pwr)));
210
piotrd0bf1492014-02-05 17:27:32 +0100211 switch (b_type)
212 {
213 case fcch_burst: //if it's FCCH burst
214 {
215 const unsigned first_sample = ceil((GUARD_PERIOD + 2 * TAIL_BITS) * d_OSR) + 1;
216 const unsigned last_sample = first_sample + USEFUL_BITS * d_OSR - TAIL_BITS * d_OSR;
217 double freq_offset = compute_freq_offset(input, first_sample, last_sample); //extract frequency offset from it
piotr437f5462014-02-04 17:57:25 +0100218
piotrd0bf1492014-02-05 17:27:32 +0100219 d_freq_offset_vals.push_front(freq_offset);
piotr6d152d92014-02-21 00:02:44 +0100220 send_burst(d_burst_nr, fc_fb, b_type);
221
piotrd0bf1492014-02-05 17:27:32 +0100222 if (d_freq_offset_vals.size() >= 10)
223 {
224 double sum = std::accumulate(d_freq_offset_vals.begin(), d_freq_offset_vals.end(), 0);
225 double mean_offset = sum / d_freq_offset_vals.size(); //compute mean
226 d_freq_offset_vals.clear();
piotr7c82b172014-02-08 14:15:27 +0100227 DCOUT("mean offset" << mean_offset);
piotrd0bf1492014-02-05 17:27:32 +0100228 if (abs(mean_offset) > FCCH_MAX_FREQ_OFFSET)
229 {
piotr7c82b172014-02-08 14:15:27 +0100230 //d_freq_offset -= mean_offset; //and adjust frequency if it have changed beyond
piotr5f1e1d32014-02-05 18:10:05 +0100231 //set_frequency(d_freq_offset); //some limit
piotr7e3b0db2014-02-05 22:44:30 +0100232 DCOUT("Adjusting frequency, new frequency offset: " << d_freq_offset << "\n");
piotrd0bf1492014-02-05 17:27:32 +0100233 }
234 }
235 }
236 break;
237 case sch_burst: //if it's SCH burst
238 {
239 int t1, t2, t3, d_ncc, d_bcc;
240 burst_start = get_sch_chan_imp_resp(input, &channel_imp_resp[0]); //get channel impulse response
241 detect_burst(input, &channel_imp_resp[0], burst_start, output_binary); //MLSE detection of bits
piotr6d152d92014-02-21 00:02:44 +0100242 send_burst(d_burst_nr, output_binary, b_type);
piotrd0bf1492014-02-05 17:27:32 +0100243 if (decode_sch(&output_binary[3], &t1, &t2, &t3, &d_ncc, &d_bcc) == 0) //and decode SCH data
244 {
245 // d_burst_nr.set(t1, t2, t3, 0); //but only to check if burst_start value is correct
246 d_failed_sch = 0;
247 DCOUT("bcc: " << d_bcc << " ncc: " << d_ncc << " t1: " << t1 << " t2: " << t2 << " t3: " << t3);
248 offset = burst_start - floor((GUARD_PERIOD) * d_OSR); //compute offset from burst_start - burst should start after a guard period
piotr7c82b172014-02-08 14:15:27 +0100249 DCOUT("offset: "<<offset);
piotrd0bf1492014-02-05 17:27:32 +0100250 to_consume += offset; //adjust with offset number of samples to be consumed
251 }
252 else
253 {
254 d_failed_sch++;
255 if (d_failed_sch >= MAX_SCH_ERRORS)
256 {
piotr437f5462014-02-04 17:57:25 +0100257 d_freq_offset_vals.clear();
piotrd0bf1492014-02-05 17:27:32 +0100258 d_freq_offset=0;
piotr7c82b172014-02-08 14:15:27 +0100259 //set_frequency(0);
260 DCOUT("Re-Synchronization");
piotr437f5462014-02-04 17:57:25 +0100261 }
piotr437f5462014-02-04 17:57:25 +0100262 }
piotrd0bf1492014-02-05 17:27:32 +0100263 }
264 break;
piotr437f5462014-02-04 17:57:25 +0100265
piotr7e3b0db2014-02-05 22:44:30 +0100266 case normal_burst:
267 {
268 float normal_corr_max; //if it's normal burst
269 burst_start = get_norm_chan_imp_resp(input, &channel_imp_resp[0], &normal_corr_max, d_bcc); //get channel impulse response for given training sequence number - d_bcc
piotrd0bf1492014-02-05 17:27:32 +0100270 detect_burst(input, &channel_imp_resp[0], burst_start, output_binary); //MLSE detection of bits
piotr8dc74a42014-04-17 09:48:46 +0200271 send_burst(d_burst_nr, output_binary, b_type);
piotrd0bf1492014-02-05 17:27:32 +0100272 break;
piotr7e3b0db2014-02-05 22:44:30 +0100273 }
piotrd0bf1492014-02-05 17:27:32 +0100274 case dummy_or_normal:
275 {
piotr7e3b0db2014-02-05 22:44:30 +0100276 unsigned int normal_burst_start;
277 float dummy_corr_max, normal_corr_max;
piotr7c82b172014-02-08 14:15:27 +0100278 DCOUT("Dummy");
piotr7e3b0db2014-02-05 22:44:30 +0100279 get_norm_chan_imp_resp(input, &channel_imp_resp[0], &dummy_corr_max, TS_DUMMY);
piotr7c82b172014-02-08 14:15:27 +0100280 DCOUT("Normal");
piotr7e3b0db2014-02-05 22:44:30 +0100281 normal_burst_start = get_norm_chan_imp_resp(input, &channel_imp_resp[0], &normal_corr_max, d_bcc);
282
piotr7c82b172014-02-08 14:15:27 +0100283 DCOUT("normal_corr_max: " << normal_corr_max << " dummy_corr_max:" << dummy_corr_max);
piotr7e3b0db2014-02-05 22:44:30 +0100284 if (normal_corr_max > dummy_corr_max)
piotrd0bf1492014-02-05 17:27:32 +0100285 {
piotr7e3b0db2014-02-05 22:44:30 +0100286 detect_burst(input, &channel_imp_resp[0], normal_burst_start, output_binary);
piotr8dc74a42014-04-17 09:48:46 +0200287 send_burst(d_burst_nr, output_binary, b_type);
piotrd0bf1492014-02-05 17:27:32 +0100288 }
289 else
290 {
piotr6d152d92014-02-21 00:02:44 +0100291 send_burst(d_burst_nr, dummy_burst, b_type);
piotrd0bf1492014-02-05 17:27:32 +0100292 }
293 }
294 case rach_burst:
piotrd0bf1492014-02-05 17:27:32 +0100295 break;
piotr7e3b0db2014-02-05 22:44:30 +0100296 case dummy:
piotr6d152d92014-02-21 00:02:44 +0100297 send_burst(d_burst_nr, dummy_burst, b_type);
piotrd0bf1492014-02-05 17:27:32 +0100298 break;
299 case empty: //if it's empty burst
300 break; //do nothing
301 }
302
303 d_burst_nr++; //go to next burst
304
305 to_consume += TS_BITS * d_OSR + d_burst_nr.get_offset(); //consume samples of the burst up to next guard period
306 //and add offset which is introduced by
307 //0.25 fractional part of a guard period
piotrd0bf1492014-02-05 17:27:32 +0100308 consume_each(to_consume);
309 }
310 break;
piotr437f5462014-02-04 17:57:25 +0100311 }
312
piotr6d152d92014-02-21 00:02:44 +0100313 return 0;
piotrd0bf1492014-02-05 17:27:32 +0100314}
piotr437f5462014-02-04 17:57:25 +0100315
piotrd0bf1492014-02-05 17:27:32 +0100316
317bool receiver_impl::find_fcch_burst(const gr_complex *input, const int nitems)
318{
319 circular_buffer_float phase_diff_buffer(FCCH_HITS_NEEDED * d_OSR); //circular buffer used to scan throug signal to find
320 //best match for FCCH burst
321 float phase_diff = 0;
322 gr_complex conjprod;
323 int start_pos = -1;
324 int hit_count = 0;
325 int miss_count = 0;
326 float min_phase_diff;
327 float max_phase_diff;
328 double best_sum = 0;
329 float lowest_max_min_diff = 99999;
330
331 int to_consume = 0;
332 int sample_number = 0;
333 bool end = false;
334 bool result = false;
335 circular_buffer_float::iterator buffer_iter;
piotr6d152d92014-02-21 00:02:44 +0100336
piotrd0bf1492014-02-05 17:27:32 +0100337 /**@name Possible states of FCCH search algorithm*/
338 //@{
339 enum states
piotr437f5462014-02-04 17:57:25 +0100340 {
piotr437f5462014-02-04 17:57:25 +0100341 init, ///< initialize variables
342 search, ///< search for positive samples
343 found_something, ///< search for FCCH and the best position of it
344 fcch_found, ///< when FCCH was found
345 search_fail ///< when there is no FCCH in the input vector
piotrd0bf1492014-02-05 17:27:32 +0100346 } fcch_search_state;
347 //@}
piotr437f5462014-02-04 17:57:25 +0100348
piotrd0bf1492014-02-05 17:27:32 +0100349 fcch_search_state = init;
piotr437f5462014-02-04 17:57:25 +0100350
piotrd0bf1492014-02-05 17:27:32 +0100351 while (!end)
352 {
353 switch (fcch_search_state)
354 {
piotr437f5462014-02-04 17:57:25 +0100355
piotrd0bf1492014-02-05 17:27:32 +0100356 case init: //initialize variables
piotr437f5462014-02-04 17:57:25 +0100357 hit_count = 0;
358 miss_count = 0;
359 start_pos = -1;
360 lowest_max_min_diff = 99999;
361 phase_diff_buffer.clear();
362 fcch_search_state = search;
363
364 break;
365
piotr7c82b172014-02-08 14:15:27 +0100366 case search: // search for positive samples
piotr437f5462014-02-04 17:57:25 +0100367 sample_number++;
368
piotrd0bf1492014-02-05 17:27:32 +0100369 if (sample_number > nitems - FCCH_HITS_NEEDED * d_OSR) //if it isn't possible to find FCCH because
370 {
piotr7c82b172014-02-08 14:15:27 +0100371 //there's too few samples left to look into,
piotrd0bf1492014-02-05 17:27:32 +0100372 to_consume = sample_number; //don't do anything with those samples which are left
piotr7c82b172014-02-08 14:15:27 +0100373 //and consume only those which were checked
piotrd0bf1492014-02-05 17:27:32 +0100374 fcch_search_state = search_fail;
375 }
376 else
377 {
378 phase_diff = compute_phase_diff(input[sample_number], input[sample_number-1]);
piotr437f5462014-02-04 17:57:25 +0100379
piotrd0bf1492014-02-05 17:27:32 +0100380 if (phase_diff > 0) //if a positive phase difference was found
381 {
382 to_consume = sample_number;
383 fcch_search_state = found_something; //switch to state in which searches for FCCH
384 }
385 else
386 {
387 fcch_search_state = search;
388 }
piotr437f5462014-02-04 17:57:25 +0100389 }
390
391 break;
392
piotrd0bf1492014-02-05 17:27:32 +0100393 case found_something: // search for FCCH and the best position of it
394 {
395 if (phase_diff > 0)
396 {
piotr437f5462014-02-04 17:57:25 +0100397 hit_count++; //positive phase differencies increases hits_count
piotrd0bf1492014-02-05 17:27:32 +0100398 }
399 else
400 {
piotr437f5462014-02-04 17:57:25 +0100401 miss_count++; //negative increases miss_count
piotrd0bf1492014-02-05 17:27:32 +0100402 }
piotr437f5462014-02-04 17:57:25 +0100403
piotrd0bf1492014-02-05 17:27:32 +0100404 if ((miss_count >= FCCH_MAX_MISSES * d_OSR) && (hit_count <= FCCH_HITS_NEEDED * d_OSR))
405 {
piotr437f5462014-02-04 17:57:25 +0100406 //if miss_count exceeds limit before hit_count
407 fcch_search_state = init; //go to init
408 continue;
piotrd0bf1492014-02-05 17:27:32 +0100409 }
410 else if (((miss_count >= FCCH_MAX_MISSES * d_OSR) && (hit_count > FCCH_HITS_NEEDED * d_OSR)) || (hit_count > 2 * FCCH_HITS_NEEDED * d_OSR))
411 {
piotr437f5462014-02-04 17:57:25 +0100412 //if hit_count and miss_count exceeds limit then FCCH was found
413 fcch_search_state = fcch_found;
414 continue;
piotrd0bf1492014-02-05 17:27:32 +0100415 }
416 else if ((miss_count < FCCH_MAX_MISSES * d_OSR) && (hit_count > FCCH_HITS_NEEDED * d_OSR))
417 {
piotr437f5462014-02-04 17:57:25 +0100418 //find difference between minimal and maximal element in the buffer
419 //for FCCH this value should be low
420 //this part is searching for a region where this value is lowest
421 min_phase_diff = * (min_element(phase_diff_buffer.begin(), phase_diff_buffer.end()));
422 max_phase_diff = * (max_element(phase_diff_buffer.begin(), phase_diff_buffer.end()));
423
piotrd0bf1492014-02-05 17:27:32 +0100424 if (lowest_max_min_diff > max_phase_diff - min_phase_diff)
425 {
426 lowest_max_min_diff = max_phase_diff - min_phase_diff;
427 start_pos = sample_number - FCCH_HITS_NEEDED * d_OSR - FCCH_MAX_MISSES * d_OSR; //store start pos
428 best_sum = 0;
piotr437f5462014-02-04 17:57:25 +0100429
piotrd0bf1492014-02-05 17:27:32 +0100430 for (buffer_iter = phase_diff_buffer.begin();
431 buffer_iter != (phase_diff_buffer.end());
432 buffer_iter++)
433 {
434 best_sum += *buffer_iter - (M_PI / 2) / d_OSR; //store best value of phase offset sum
435 }
piotr437f5462014-02-04 17:57:25 +0100436 }
piotrd0bf1492014-02-05 17:27:32 +0100437 }
piotr437f5462014-02-04 17:57:25 +0100438
piotrd0bf1492014-02-05 17:27:32 +0100439 sample_number++;
piotr437f5462014-02-04 17:57:25 +0100440
piotrd0bf1492014-02-05 17:27:32 +0100441 if (sample_number >= nitems) //if there's no single sample left to check
442 {
piotr437f5462014-02-04 17:57:25 +0100443 fcch_search_state = search_fail;//FCCH search failed
444 continue;
piotr437f5462014-02-04 17:57:25 +0100445 }
piotrd0bf1492014-02-05 17:27:32 +0100446
447 phase_diff = compute_phase_diff(input[sample_number], input[sample_number-1]);
448 phase_diff_buffer.push_back(phase_diff);
449 fcch_search_state = found_something;
450 }
451 break;
452
453 case fcch_found:
454 {
455 DCOUT("fcch found on position: " << d_counter + start_pos);
456 to_consume = start_pos + FCCH_HITS_NEEDED * d_OSR + 1; //consume one FCCH burst
457
458 d_fcch_start_pos = d_counter + start_pos;
459
460 //compute frequency offset
461 double phase_offset = best_sum / FCCH_HITS_NEEDED;
462 double freq_offset = phase_offset * 1625000.0 / (12.0 * M_PI);
463 d_freq_offset -= freq_offset;
464 DCOUT("freq_offset: " << d_freq_offset);
465
466 end = true;
467 result = true;
piotr437f5462014-02-04 17:57:25 +0100468 break;
piotrd0bf1492014-02-05 17:27:32 +0100469 }
piotr437f5462014-02-04 17:57:25 +0100470
piotrd0bf1492014-02-05 17:27:32 +0100471 case search_fail:
piotr437f5462014-02-04 17:57:25 +0100472 end = true;
473 result = false;
474 break;
475 }
piotr437f5462014-02-04 17:57:25 +0100476 }
477
piotrd0bf1492014-02-05 17:27:32 +0100478 d_counter += to_consume;
479 consume_each(to_consume);
piotr437f5462014-02-04 17:57:25 +0100480
piotrd0bf1492014-02-05 17:27:32 +0100481 return result;
482}
483
piotrd0bf1492014-02-05 17:27:32 +0100484double receiver_impl::compute_freq_offset(const gr_complex * input, unsigned first_sample, unsigned last_sample)
485{
486 double phase_sum = 0;
487 unsigned ii;
488
489 for (ii = first_sample; ii < last_sample; ii++)
piotr437f5462014-02-04 17:57:25 +0100490 {
piotr437f5462014-02-04 17:57:25 +0100491 double phase_diff = compute_phase_diff(input[ii], input[ii-1]) - (M_PI / 2) / d_OSR;
492 phase_sum += phase_diff;
piotr437f5462014-02-04 17:57:25 +0100493 }
494
piotrd0bf1492014-02-05 17:27:32 +0100495 double phase_offset = phase_sum / (last_sample - first_sample);
496 double freq_offset = phase_offset * 1625000.0 / (12.0 * M_PI);
497 return freq_offset;
498}
piotr437f5462014-02-04 17:57:25 +0100499
piotrd0bf1492014-02-05 17:27:32 +0100500void receiver_impl::set_frequency(double freq_offset)
501{
502 d_tuner->calleval(freq_offset);
503}
piotr437f5462014-02-04 17:57:25 +0100504
piotrd0bf1492014-02-05 17:27:32 +0100505inline float receiver_impl::compute_phase_diff(gr_complex val1, gr_complex val2)
506{
507 gr_complex conjprod = val1 * conj(val2);
508 return fast_atan2f(imag(conjprod), real(conjprod));
509}
piotr437f5462014-02-04 17:57:25 +0100510
piotrd0bf1492014-02-05 17:27:32 +0100511bool receiver_impl::reach_sch_burst(const int nitems)
512{
513 //it just consumes samples to get near to a SCH burst
514 int to_consume = 0;
515 bool result = false;
516 unsigned sample_nr_near_sch_start = d_fcch_start_pos + (FRAME_BITS - SAFETY_MARGIN) * d_OSR;
517
518 //consume samples until d_counter will be equal to sample_nr_near_sch_start
519 if (d_counter < sample_nr_near_sch_start)
520 {
521 if (d_counter + nitems >= sample_nr_near_sch_start)
522 {
523 to_consume = sample_nr_near_sch_start - d_counter;
524 }
525 else
526 {
527 to_consume = nitems;
piotr437f5462014-02-04 17:57:25 +0100528 }
529 result = false;
piotrd0bf1492014-02-05 17:27:32 +0100530 }
531 else
532 {
piotr437f5462014-02-04 17:57:25 +0100533 to_consume = 0;
534 result = true;
piotr437f5462014-02-04 17:57:25 +0100535 }
536
piotrd0bf1492014-02-05 17:27:32 +0100537 d_counter += to_consume;
538 consume_each(to_consume);
539 return result;
540}
541
542int receiver_impl::get_sch_chan_imp_resp(const gr_complex *input, gr_complex * chan_imp_resp)
543{
544 vector_complex correlation_buffer;
545 vector_float power_buffer;
546 vector_float window_energy_buffer;
547
548 int strongest_window_nr;
549 int burst_start = 0;
550 int chan_imp_resp_center = 0;
551 float max_correlation = 0;
552 float energy = 0;
553
554 for (int ii = SYNC_POS * d_OSR; ii < (SYNC_POS + SYNC_SEARCH_RANGE) *d_OSR; ii++)
piotr437f5462014-02-04 17:57:25 +0100555 {
piotr437f5462014-02-04 17:57:25 +0100556 gr_complex correlation = correlate_sequence(&d_sch_training_seq[5], N_SYNC_BITS - 10, &input[ii]);
557 correlation_buffer.push_back(correlation);
558 power_buffer.push_back(std::pow(abs(correlation), 2));
piotrd0bf1492014-02-05 17:27:32 +0100559 }
piotr437f5462014-02-04 17:57:25 +0100560
piotrd0bf1492014-02-05 17:27:32 +0100561 //compute window energies
562 vector_float::iterator iter = power_buffer.begin();
563 bool loop_end = false;
564 while (iter != power_buffer.end())
565 {
piotr437f5462014-02-04 17:57:25 +0100566 vector_float::iterator iter_ii = iter;
567 energy = 0;
568
piotrd0bf1492014-02-05 17:27:32 +0100569 for (int ii = 0; ii < (d_chan_imp_length) *d_OSR; ii++, iter_ii++)
570 {
571 if (iter_ii == power_buffer.end())
572 {
573 loop_end = true;
574 break;
575 }
576 energy += (*iter_ii);
piotr437f5462014-02-04 17:57:25 +0100577 }
piotrd0bf1492014-02-05 17:27:32 +0100578 if (loop_end)
579 {
580 break;
piotr437f5462014-02-04 17:57:25 +0100581 }
582 iter++;
583 window_energy_buffer.push_back(energy);
piotrd0bf1492014-02-05 17:27:32 +0100584 }
piotr437f5462014-02-04 17:57:25 +0100585
piotrd0bf1492014-02-05 17:27:32 +0100586 strongest_window_nr = max_element(window_energy_buffer.begin(), window_energy_buffer.end()) - window_energy_buffer.begin();
piotr437f5462014-02-04 17:57:25 +0100587 // d_channel_imp_resp.clear();
588
piotrd0bf1492014-02-05 17:27:32 +0100589 max_correlation = 0;
590 for (int ii = 0; ii < (d_chan_imp_length) *d_OSR; ii++)
591 {
piotr437f5462014-02-04 17:57:25 +0100592 gr_complex correlation = correlation_buffer[strongest_window_nr + ii];
piotrd0bf1492014-02-05 17:27:32 +0100593 if (abs(correlation) > max_correlation)
594 {
595 chan_imp_resp_center = ii;
596 max_correlation = abs(correlation);
piotr437f5462014-02-04 17:57:25 +0100597 }
piotrd0bf1492014-02-05 17:27:32 +0100598 // d_channel_imp_resp.push_back(correlation);
piotr437f5462014-02-04 17:57:25 +0100599 chan_imp_resp[ii] = correlation;
piotr437f5462014-02-04 17:57:25 +0100600 }
601
piotrd0bf1492014-02-05 17:27:32 +0100602 burst_start = strongest_window_nr + chan_imp_resp_center - 48 * d_OSR - 2 * d_OSR + 2 + SYNC_POS * d_OSR;
603 return burst_start;
604}
piotr437f5462014-02-04 17:57:25 +0100605
606
piotrd0bf1492014-02-05 17:27:32 +0100607
608void receiver_impl::detect_burst(const gr_complex * input, gr_complex * chan_imp_resp, int burst_start, unsigned char * output_binary)
609{
610 float output[BURST_SIZE];
611 gr_complex rhh_temp[CHAN_IMP_RESP_LENGTH*d_OSR];
612 gr_complex rhh[CHAN_IMP_RESP_LENGTH];
613 gr_complex filtered_burst[BURST_SIZE];
614 int start_state = 3;
615 unsigned int stop_states[2] = {4, 12};
616
617 autocorrelation(chan_imp_resp, rhh_temp, d_chan_imp_length*d_OSR);
618 for (int ii = 0; ii < (d_chan_imp_length); ii++)
piotr437f5462014-02-04 17:57:25 +0100619 {
piotr437f5462014-02-04 17:57:25 +0100620 rhh[ii] = conj(rhh_temp[ii*d_OSR]);
piotr437f5462014-02-04 17:57:25 +0100621 }
622
piotrd0bf1492014-02-05 17:27:32 +0100623 mafi(&input[burst_start], BURST_SIZE, chan_imp_resp, d_chan_imp_length*d_OSR, filtered_burst);
624
625 viterbi_detector(filtered_burst, BURST_SIZE, rhh, start_state, stop_states, 2, output);
626
627 for (int i = 0; i < BURST_SIZE ; i++)
piotr437f5462014-02-04 17:57:25 +0100628 {
piotrd0bf1492014-02-05 17:27:32 +0100629 output_binary[i] = (output[i] > 0);
630 }
631}
piotr437f5462014-02-04 17:57:25 +0100632
piotrd0bf1492014-02-05 17:27:32 +0100633//TODO consider placing this funtion in a separate class for signal processing
634void receiver_impl::gmsk_mapper(const unsigned char * input, int nitems, gr_complex * gmsk_output, gr_complex start_point)
635{
636 gr_complex j = gr_complex(0.0, 1.0);
piotr437f5462014-02-04 17:57:25 +0100637
piotrd0bf1492014-02-05 17:27:32 +0100638 int current_symbol;
639 int encoded_symbol;
640 int previous_symbol = 2 * input[0] - 1;
641 gmsk_output[0] = start_point;
642
643 for (int i = 1; i < nitems; i++)
644 {
piotr437f5462014-02-04 17:57:25 +0100645 //change bits representation to NRZ
646 current_symbol = 2 * input[i] - 1;
647 //differentially encode
648 encoded_symbol = current_symbol * previous_symbol;
649 //and do gmsk mapping
650 gmsk_output[i] = j * gr_complex(encoded_symbol, 0.0) * gmsk_output[i-1];
651 previous_symbol = current_symbol;
piotr437f5462014-02-04 17:57:25 +0100652 }
piotrd0bf1492014-02-05 17:27:32 +0100653}
piotr437f5462014-02-04 17:57:25 +0100654
piotrd0bf1492014-02-05 17:27:32 +0100655//TODO consider use of some generalized function for correlation and placing it in a separate class for signal processing
656gr_complex receiver_impl::correlate_sequence(const gr_complex * sequence, int length, const gr_complex * input)
657{
658 gr_complex result(0.0, 0.0);
659 int sample_number = 0;
660
661 for (int ii = 0; ii < length; ii++)
piotr437f5462014-02-04 17:57:25 +0100662 {
piotr437f5462014-02-04 17:57:25 +0100663 sample_number = (ii * d_OSR) ;
664 result += sequence[ii] * conj(input[sample_number]);
piotr437f5462014-02-04 17:57:25 +0100665 }
666
piotrd0bf1492014-02-05 17:27:32 +0100667 result = result / gr_complex(length, 0);
668 return result;
669}
670
671//computes autocorrelation for positive arguments
672//TODO consider placing this funtion in a separate class for signal processing
673inline void receiver_impl::autocorrelation(const gr_complex * input, gr_complex * out, int nitems)
674{
675 int i, k;
676 for (k = nitems - 1; k >= 0; k--)
piotr437f5462014-02-04 17:57:25 +0100677 {
piotr437f5462014-02-04 17:57:25 +0100678 out[k] = gr_complex(0, 0);
piotrd0bf1492014-02-05 17:27:32 +0100679 for (i = k; i < nitems; i++)
680 {
681 out[k] += input[i] * conj(input[i-k]);
piotr437f5462014-02-04 17:57:25 +0100682 }
piotr437f5462014-02-04 17:57:25 +0100683 }
piotrd0bf1492014-02-05 17:27:32 +0100684}
piotr437f5462014-02-04 17:57:25 +0100685
piotrd0bf1492014-02-05 17:27:32 +0100686//TODO consider use of some generalized function for filtering and placing it in a separate class for signal processing
687inline void receiver_impl::mafi(const gr_complex * input, int nitems, gr_complex * filter, int filter_length, gr_complex * output)
688{
689 int ii = 0, n, a;
690
691 for (n = 0; n < nitems; n++)
piotr437f5462014-02-04 17:57:25 +0100692 {
piotr437f5462014-02-04 17:57:25 +0100693 a = n * d_OSR;
694 output[n] = 0;
695 ii = 0;
696
piotrd0bf1492014-02-05 17:27:32 +0100697 while (ii < filter_length)
698 {
699 if ((a + ii) >= nitems*d_OSR)
700 break;
701 output[n] += input[a+ii] * filter[ii];
702 ii++;
piotr437f5462014-02-04 17:57:25 +0100703 }
piotr437f5462014-02-04 17:57:25 +0100704 }
piotrd0bf1492014-02-05 17:27:32 +0100705}
piotr437f5462014-02-04 17:57:25 +0100706
piotrd0bf1492014-02-05 17:27:32 +0100707//TODO: get_norm_chan_imp_resp is similar to get_sch_chan_imp_resp - consider joining this two functions
piotrd0bf1492014-02-05 17:27:32 +0100708//especially computations of strongest_window_nr
piotr7e3b0db2014-02-05 22:44:30 +0100709int receiver_impl::get_norm_chan_imp_resp(const gr_complex *input, gr_complex * chan_imp_resp, float *corr_max, int bcc)
piotrd0bf1492014-02-05 17:27:32 +0100710{
711 vector_complex correlation_buffer;
712 vector_float power_buffer;
713 vector_float window_energy_buffer;
piotr437f5462014-02-04 17:57:25 +0100714
piotrd0bf1492014-02-05 17:27:32 +0100715 int strongest_window_nr;
716 int burst_start = 0;
717 int chan_imp_resp_center = 0;
718 float max_correlation = 0;
719 float energy = 0;
piotr5c820252014-04-17 09:43:02 +0200720
piotrd0bf1492014-02-05 17:27:32 +0100721 int search_center = (int)((TRAIN_POS + GUARD_PERIOD) * d_OSR);
piotr7c82b172014-02-08 14:15:27 +0100722 int search_start_pos = search_center + 1 - 5*d_OSR;
piotr437f5462014-02-04 17:57:25 +0100723 // int search_start_pos = search_center - d_chan_imp_length * d_OSR;
piotr5c820252014-04-17 09:43:02 +0200724 int search_stop_pos = search_center + d_chan_imp_length * d_OSR + 5 * d_OSR;
piotr437f5462014-02-04 17:57:25 +0100725
piotrd0bf1492014-02-05 17:27:32 +0100726 for (int ii = search_start_pos; ii < search_stop_pos; ii++)
727 {
piotr437f5462014-02-04 17:57:25 +0100728 gr_complex correlation = correlate_sequence(&d_norm_training_seq[bcc][TRAIN_BEGINNING], N_TRAIN_BITS - 10, &input[ii]);
729
730 correlation_buffer.push_back(correlation);
731 power_buffer.push_back(std::pow(abs(correlation), 2));
piotrd0bf1492014-02-05 17:27:32 +0100732 }
piotr437f5462014-02-04 17:57:25 +0100733
piotrd0bf1492014-02-05 17:27:32 +0100734 //compute window energies
735 vector_float::iterator iter = power_buffer.begin();
736 bool loop_end = false;
737 while (iter != power_buffer.end())
738 {
piotr437f5462014-02-04 17:57:25 +0100739 vector_float::iterator iter_ii = iter;
740 energy = 0;
741
piotrd0bf1492014-02-05 17:27:32 +0100742 for (int ii = 0; ii < (d_chan_imp_length - 2)*d_OSR; ii++, iter_ii++)
743 {
piotrd0bf1492014-02-05 17:27:32 +0100744 if (iter_ii == power_buffer.end())
745 {
746 loop_end = true;
747 break;
748 }
749 energy += (*iter_ii);
piotr437f5462014-02-04 17:57:25 +0100750 }
piotrd0bf1492014-02-05 17:27:32 +0100751 if (loop_end)
752 {
753 break;
piotr437f5462014-02-04 17:57:25 +0100754 }
755 iter++;
756
757 window_energy_buffer.push_back(energy);
piotrd0bf1492014-02-05 17:27:32 +0100758 }
piotr437f5462014-02-04 17:57:25 +0100759
piotr5c820252014-04-17 09:43:02 +0200760 strongest_window_nr = max_element(window_energy_buffer.begin(), window_energy_buffer.end()-((d_chan_imp_length)*d_OSR)) - window_energy_buffer.begin();
761 //strongest_window_nr = strongest_window_nr-d_OSR;
762 if(strongest_window_nr<0){
763 strongest_window_nr = 0;
764 }
piotr6d152d92014-02-21 00:02:44 +0100765
piotrd0bf1492014-02-05 17:27:32 +0100766 max_correlation = 0;
767 for (int ii = 0; ii < (d_chan_imp_length)*d_OSR; ii++)
768 {
piotr437f5462014-02-04 17:57:25 +0100769 gr_complex correlation = correlation_buffer[strongest_window_nr + ii];
piotrd0bf1492014-02-05 17:27:32 +0100770 if (abs(correlation) > max_correlation)
771 {
772 chan_imp_resp_center = ii;
773 max_correlation = abs(correlation);
piotr437f5462014-02-04 17:57:25 +0100774 }
piotrd0bf1492014-02-05 17:27:32 +0100775 // d_channel_imp_resp.push_back(correlation);
piotr437f5462014-02-04 17:57:25 +0100776 chan_imp_resp[ii] = correlation;
piotr437f5462014-02-04 17:57:25 +0100777 }
piotr7c82b172014-02-08 14:15:27 +0100778
piotr7e3b0db2014-02-05 22:44:30 +0100779 *corr_max = max_correlation;
780 // We want to use the first sample of the impulse response, and the
piotrd0bf1492014-02-05 17:27:32 +0100781 // corresponding samples of the received signal.
782 // the variable sync_w should contain the beginning of the used part of
783 // training sequence, which is 3+57+1+6=67 bits into the burst. That is
784 // we have that sync_t16 equals first sample in bit number 67.
785
piotr7c82b172014-02-08 14:15:27 +0100786 DCOUT("strongest_window_nr_new: " << strongest_window_nr);
piotr6d152d92014-02-21 00:02:44 +0100787 burst_start = search_start_pos + strongest_window_nr - TRAIN_POS * d_OSR;
piotr7c82b172014-02-08 14:15:27 +0100788
789 DCOUT("burst_start: " << burst_start);
piotrd0bf1492014-02-05 17:27:32 +0100790 return burst_start;
791}
piotr437f5462014-02-04 17:57:25 +0100792
793
piotr6d152d92014-02-21 00:02:44 +0100794void receiver_impl::send_burst(burst_counter burst_nr, const unsigned char * burst_binary, burst_type b_type)
piotrd0bf1492014-02-05 17:27:32 +0100795{
piotr7c82b172014-02-08 14:15:27 +0100796
piotr6d152d92014-02-21 00:02:44 +0100797 boost::scoped_ptr<gsmtap_hdr> tap_header(new gsmtap_hdr());
798
799 tap_header->version = GSMTAP_VERSION;
800 tap_header->hdr_len = BURST_SIZE/4;
801 tap_header->type = GSMTAP_TYPE_UM_BURST;
802 tap_header->timeslot = static_cast<uint8_t>(d_burst_nr.get_timeslot_nr());
803 tap_header->frame_number = d_burst_nr.get_frame_nr();
804 tap_header->sub_type = static_cast<uint8_t>(b_type);
805 tap_header->arfcn = d_arfcn;
806 tap_header->signal_dbm = static_cast<int8_t>(d_signal_dbm);
807 pmt::pmt_t header_blob=pmt::make_blob(tap_header.get(),sizeof(gsmtap_hdr));
808 pmt::pmt_t burst_binary_blob=pmt::make_blob(burst_binary,BURST_SIZE);
809 pmt::pmt_t msg = pmt::cons(header_blob, burst_binary_blob);
810
811 message_port_pub(pmt::mp("bursts"), msg);
piotrd0bf1492014-02-05 17:27:32 +0100812}
piotr6d152d92014-02-21 00:02:44 +0100813
piotrd0bf1492014-02-05 17:27:32 +0100814void receiver_impl::configure_receiver()
815{
816 d_channel_conf.set_multiframe_type(TSC0, multiframe_51);
817 d_channel_conf.set_burst_types(TIMESLOT0, TEST51, sizeof(TEST51) / sizeof(unsigned), dummy_or_normal);
piotr437f5462014-02-04 17:57:25 +0100818
piotrd0bf1492014-02-05 17:27:32 +0100819 d_channel_conf.set_burst_types(TSC0, TEST_CCH_FRAMES, sizeof(TEST_CCH_FRAMES) / sizeof(unsigned), dummy_or_normal);
820 d_channel_conf.set_burst_types(TSC0, FCCH_FRAMES, sizeof(FCCH_FRAMES) / sizeof(unsigned), fcch_burst);
piotr903b1d62014-04-17 11:33:27 +0200821 d_channel_conf.set_burst_types(TSC0, SCH_FRAMES, sizeof(FCCH_FRAMES) / sizeof(unsigned), fcch_burst);
piotr437f5462014-02-04 17:57:25 +0100822
823 // d_channel_conf.set_multiframe_type(TIMESLOT1, multiframe_26);
824 // d_channel_conf.set_burst_types(TIMESLOT1, TRAFFIC_CHANNEL_F, sizeof(TRAFFIC_CHANNEL_F) / sizeof(unsigned), dummy_or_normal);
825 // d_channel_conf.set_multiframe_type(TIMESLOT2, multiframe_26);
826 // d_channel_conf.set_burst_types(TIMESLOT2, TRAFFIC_CHANNEL_F, sizeof(TRAFFIC_CHANNEL_F) / sizeof(unsigned), dummy_or_normal);
827 // d_channel_conf.set_multiframe_type(TIMESLOT3, multiframe_26);
828 // d_channel_conf.set_burst_types(TIMESLOT3, TRAFFIC_CHANNEL_F, sizeof(TRAFFIC_CHANNEL_F) / sizeof(unsigned), dummy_or_normal);
829 // d_channel_conf.set_multiframe_type(TIMESLOT4, multiframe_26);
830 // d_channel_conf.set_burst_types(TIMESLOT4, TRAFFIC_CHANNEL_F, sizeof(TRAFFIC_CHANNEL_F) / sizeof(unsigned), dummy_or_normal);
831 // d_channel_conf.set_multiframe_type(TIMESLOT5, multiframe_26);
832 // d_channel_conf.set_burst_types(TIMESLOT5, TRAFFIC_CHANNEL_F, sizeof(TRAFFIC_CHANNEL_F) / sizeof(unsigned), dummy_or_normal);
833 // d_channel_conf.set_multiframe_type(TIMESLOT6, multiframe_26);
834 // d_channel_conf.set_burst_types(TIMESLOT6, TRAFFIC_CHANNEL_F, sizeof(TRAFFIC_CHANNEL_F) / sizeof(unsigned), dummy_or_normal);
835 // d_channel_conf.set_multiframe_type(TIMESLOT7, multiframe_26);
836 // d_channel_conf.set_burst_types(TIMESLOT7, TRAFFIC_CHANNEL_F, sizeof(TRAFFIC_CHANNEL_F) / sizeof(unsigned), dummy_or_normal);
piotr7e3b0db2014-02-05 22:44:30 +0100837
piotrd0bf1492014-02-05 17:27:32 +0100838 d_channel_conf.set_multiframe_type(TIMESLOT1, multiframe_51);
839 d_channel_conf.set_burst_types(TIMESLOT1, TEST51, sizeof(TEST51) / sizeof(unsigned), dummy_or_normal);
840 d_channel_conf.set_multiframe_type(TIMESLOT2, multiframe_51);
841 d_channel_conf.set_burst_types(TIMESLOT2, TEST51, sizeof(TEST51) / sizeof(unsigned), dummy_or_normal);
842 d_channel_conf.set_multiframe_type(TIMESLOT3, multiframe_51);
843 d_channel_conf.set_burst_types(TIMESLOT3, TEST51, sizeof(TEST51) / sizeof(unsigned), dummy_or_normal);
844 d_channel_conf.set_multiframe_type(TIMESLOT4, multiframe_51);
845 d_channel_conf.set_burst_types(TIMESLOT4, TEST51, sizeof(TEST51) / sizeof(unsigned), dummy_or_normal);
846 d_channel_conf.set_multiframe_type(TIMESLOT5, multiframe_51);
847 d_channel_conf.set_burst_types(TIMESLOT5, TEST51, sizeof(TEST51) / sizeof(unsigned), dummy_or_normal);
848 d_channel_conf.set_multiframe_type(TIMESLOT6, multiframe_51);
849 d_channel_conf.set_burst_types(TIMESLOT6, TEST51, sizeof(TEST51) / sizeof(unsigned), dummy_or_normal);
850 d_channel_conf.set_multiframe_type(TIMESLOT7, multiframe_51);
851 d_channel_conf.set_burst_types(TIMESLOT7, TEST51, sizeof(TEST51) / sizeof(unsigned), dummy_or_normal);
piotrd0bf1492014-02-05 17:27:32 +0100852}
piotr437f5462014-02-04 17:57:25 +0100853
854
piotrd0bf1492014-02-05 17:27:32 +0100855} /* namespace gsm */
piotr437f5462014-02-04 17:57:25 +0100856} /* namespace gr */
857