blob: 9e94ee221c5a2e6e1984386d0a90695bf8235141 [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"));
piotrd0bf1492014-02-05 17:27:32 +010098}
piotr437f5462014-02-04 17:57:25 +010099
piotrd0bf1492014-02-05 17:27:32 +0100100/*
101 * Our virtual destructor.
102 */
103receiver_impl::~receiver_impl()
104{
105}
106
107void receiver_impl::forecast(int noutput_items, gr_vector_int &ninput_items_required)
108{
109 ninput_items_required[0] = noutput_items * floor((TS_BITS + 2 * GUARD_PERIOD) * d_OSR);
110}
111
112
113int
114receiver_impl::general_work(int noutput_items,
115 gr_vector_int &ninput_items,
116 gr_vector_const_void_star &input_items,
117 gr_vector_void_star &output_items)
118{
119 const gr_complex *input = (const gr_complex *) input_items[0];
piotr7c82b172014-02-08 14:15:27 +0100120
piotrd0bf1492014-02-05 17:27:32 +0100121 switch (d_state)
piotr437f5462014-02-04 17:57:25 +0100122 {
piotrd0bf1492014-02-05 17:27:32 +0100123 //bootstrapping
124 case first_fcch_search:
piotr7e3b0db2014-02-05 22:44:30 +0100125 DCOUT("FCCH search");
piotrd0bf1492014-02-05 17:27:32 +0100126 if (find_fcch_burst(input, ninput_items[0])) //find frequency correction burst in the input buffer
127 {
piotr5f1e1d32014-02-05 18:10:05 +0100128 //set_frequency(d_freq_offset); //if fcch search is successful set frequency offset
piotr6d152d92014-02-21 00:02:44 +0100129 COUT("Freq offset " << d_freq_offset);
piotr437f5462014-02-04 17:57:25 +0100130 d_state = next_fcch_search;
piotrd0bf1492014-02-05 17:27:32 +0100131 }
132 else
133 {
piotr437f5462014-02-04 17:57:25 +0100134 d_state = first_fcch_search;
piotrd0bf1492014-02-05 17:27:32 +0100135 }
136 break;
piotr437f5462014-02-04 17:57:25 +0100137
piotrd0bf1492014-02-05 17:27:32 +0100138 case next_fcch_search: //this state is used because it takes some time (a bunch of buffered samples)
139 {
piotr7e3b0db2014-02-05 22:44:30 +0100140 DCOUT("NEXT FCCH search");
piotrd0bf1492014-02-05 17:27:32 +0100141 float prev_freq_offset = d_freq_offset; //before previous set_frequqency cause change
142 if (find_fcch_burst(input, ninput_items[0]))
143 {
144 if (abs(prev_freq_offset - d_freq_offset) > FCCH_MAX_FREQ_OFFSET)
145 {
piotr5f1e1d32014-02-05 18:10:05 +0100146 //set_frequency(d_freq_offset); //call set_frequncy only frequency offset change is greater than some value
piotr6d152d92014-02-21 00:02:44 +0100147 DCOUT("Freq offset " << d_freq_offset);
piotr437f5462014-02-04 17:57:25 +0100148 }
piotrd0bf1492014-02-05 17:27:32 +0100149 d_state = sch_search;
150 }
151 else
152 {
piotrd0bf1492014-02-05 17:27:32 +0100153 d_state = next_fcch_search;
154 }
155 break;
156 }
piotr437f5462014-02-04 17:57:25 +0100157
158
piotrd0bf1492014-02-05 17:27:32 +0100159 case sch_search:
160 {
piotr7c82b172014-02-08 14:15:27 +0100161 DCOUT("SCH search");
piotrd0bf1492014-02-05 17:27:32 +0100162 vector_complex channel_imp_resp(CHAN_IMP_RESP_LENGTH*d_OSR);
163 int t1, t2, t3;
164 int burst_start = 0;
165 unsigned char output_binary[BURST_SIZE];
piotr437f5462014-02-04 17:57:25 +0100166
piotrd0bf1492014-02-05 17:27:32 +0100167 if (reach_sch_burst(ninput_items[0])) //wait for a SCH burst
168 {
169 burst_start = get_sch_chan_imp_resp(input, &channel_imp_resp[0]); //get channel impulse response from it
170 detect_burst(input, &channel_imp_resp[0], burst_start, output_binary); //detect bits using MLSE detection
171 if (decode_sch(&output_binary[3], &t1, &t2, &t3, &d_ncc, &d_bcc) == 0) //decode SCH burst
172 {
piotr6d152d92014-02-21 00:02:44 +0100173 DCOUT("sch burst_start: " << burst_start);
174 DCOUT("bcc: " << d_bcc << " ncc: " << d_ncc << " t1: " << t1 << " t2: " << t2 << " t3: " << t3);
piotr437f5462014-02-04 17:57:25 +0100175 d_burst_nr.set(t1, t2, t3, 0); //set counter of bursts value
176
177 //configure the receiver - tell him where to find which burst type
178 d_channel_conf.set_multiframe_type(TIMESLOT0, multiframe_51); //in the timeslot nr.0 bursts changes according to t3 counter
179 configure_receiver();//TODO: this shouldn't be here - remove it when gsm receiver's interface will be ready
180 d_channel_conf.set_burst_types(TIMESLOT0, FCCH_FRAMES, sizeof(FCCH_FRAMES) / sizeof(unsigned), fcch_burst); //tell where to find fcch bursts
181 d_channel_conf.set_burst_types(TIMESLOT0, SCH_FRAMES, sizeof(SCH_FRAMES) / sizeof(unsigned), sch_burst); //sch bursts
182 d_channel_conf.set_burst_types(TIMESLOT0, BCCH_FRAMES, sizeof(BCCH_FRAMES) / sizeof(unsigned), normal_burst);//!and maybe normal bursts of the BCCH logical channel
183 d_burst_nr++;
184
185 consume_each(burst_start + BURST_SIZE * d_OSR); //consume samples up to next guard period
186 d_state = synchronized;
piotrd0bf1492014-02-05 17:27:32 +0100187 }
188 else
189 {
piotr437f5462014-02-04 17:57:25 +0100190 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 +0100191 }
piotrd0bf1492014-02-05 17:27:32 +0100192 }
193 else
194 {
195 d_state = sch_search;
196 }
197 break;
198 }
199 //in this state receiver is synchronized and it processes bursts according to burst type for given burst number
200 case synchronized:
201 {
piotr6d152d92014-02-21 00:02:44 +0100202 DCOUT("Synchronized");
piotrd0bf1492014-02-05 17:27:32 +0100203 vector_complex channel_imp_resp(CHAN_IMP_RESP_LENGTH*d_OSR);
204 int burst_start;
205 int offset = 0;
206 int to_consume = 0;
207 unsigned char output_binary[BURST_SIZE];
piotr437f5462014-02-04 17:57:25 +0100208
piotrd0bf1492014-02-05 17:27:32 +0100209 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 +0100210 double signal_pwr=0;
211 for(int ii=0;ii<ninput_items[0];ii++)
212 {
213 signal_pwr += abs(input[ii])*abs(input[ii]);
214 }
215 d_signal_dbm=static_cast<int8_t>(round(20*log10(signal_pwr)));
216
piotrd0bf1492014-02-05 17:27:32 +0100217 switch (b_type)
218 {
219 case fcch_burst: //if it's FCCH burst
220 {
221 const unsigned first_sample = ceil((GUARD_PERIOD + 2 * TAIL_BITS) * d_OSR) + 1;
222 const unsigned last_sample = first_sample + USEFUL_BITS * d_OSR - TAIL_BITS * d_OSR;
223 double freq_offset = compute_freq_offset(input, first_sample, last_sample); //extract frequency offset from it
piotr437f5462014-02-04 17:57:25 +0100224
piotrd0bf1492014-02-05 17:27:32 +0100225 d_freq_offset_vals.push_front(freq_offset);
piotr6d152d92014-02-21 00:02:44 +0100226 send_burst(d_burst_nr, fc_fb, b_type);
227
piotrd0bf1492014-02-05 17:27:32 +0100228 if (d_freq_offset_vals.size() >= 10)
229 {
230 double sum = std::accumulate(d_freq_offset_vals.begin(), d_freq_offset_vals.end(), 0);
231 double mean_offset = sum / d_freq_offset_vals.size(); //compute mean
232 d_freq_offset_vals.clear();
piotr7c82b172014-02-08 14:15:27 +0100233 DCOUT("mean offset" << mean_offset);
piotrd0bf1492014-02-05 17:27:32 +0100234 if (abs(mean_offset) > FCCH_MAX_FREQ_OFFSET)
235 {
piotr7c82b172014-02-08 14:15:27 +0100236 //d_freq_offset -= mean_offset; //and adjust frequency if it have changed beyond
piotr5f1e1d32014-02-05 18:10:05 +0100237 //set_frequency(d_freq_offset); //some limit
piotr7e3b0db2014-02-05 22:44:30 +0100238 DCOUT("Adjusting frequency, new frequency offset: " << d_freq_offset << "\n");
piotrd0bf1492014-02-05 17:27:32 +0100239 }
240 }
241 }
242 break;
243 case sch_burst: //if it's SCH burst
244 {
245 int t1, t2, t3, d_ncc, d_bcc;
246 burst_start = get_sch_chan_imp_resp(input, &channel_imp_resp[0]); //get channel impulse response
247 detect_burst(input, &channel_imp_resp[0], burst_start, output_binary); //MLSE detection of bits
piotr6d152d92014-02-21 00:02:44 +0100248 send_burst(d_burst_nr, output_binary, b_type);
piotrd0bf1492014-02-05 17:27:32 +0100249 if (decode_sch(&output_binary[3], &t1, &t2, &t3, &d_ncc, &d_bcc) == 0) //and decode SCH data
250 {
251 // d_burst_nr.set(t1, t2, t3, 0); //but only to check if burst_start value is correct
252 d_failed_sch = 0;
253 DCOUT("bcc: " << d_bcc << " ncc: " << d_ncc << " t1: " << t1 << " t2: " << t2 << " t3: " << t3);
254 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 +0100255 DCOUT("offset: "<<offset);
piotrd0bf1492014-02-05 17:27:32 +0100256 to_consume += offset; //adjust with offset number of samples to be consumed
257 }
258 else
259 {
260 d_failed_sch++;
261 if (d_failed_sch >= MAX_SCH_ERRORS)
262 {
piotr437f5462014-02-04 17:57:25 +0100263 d_freq_offset_vals.clear();
piotrd0bf1492014-02-05 17:27:32 +0100264 d_freq_offset=0;
piotr7c82b172014-02-08 14:15:27 +0100265 //set_frequency(0);
266 DCOUT("Re-Synchronization");
piotr437f5462014-02-04 17:57:25 +0100267 }
piotr437f5462014-02-04 17:57:25 +0100268 }
piotrd0bf1492014-02-05 17:27:32 +0100269 }
270 break;
piotr437f5462014-02-04 17:57:25 +0100271
piotr7e3b0db2014-02-05 22:44:30 +0100272 case normal_burst:
273 {
274 float normal_corr_max; //if it's normal burst
275 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 +0100276 detect_burst(input, &channel_imp_resp[0], burst_start, output_binary); //MLSE detection of bits
piotr8dc74a42014-04-17 09:48:46 +0200277 send_burst(d_burst_nr, output_binary, b_type);
piotrd0bf1492014-02-05 17:27:32 +0100278 break;
piotr7e3b0db2014-02-05 22:44:30 +0100279 }
piotrd0bf1492014-02-05 17:27:32 +0100280 case dummy_or_normal:
281 {
piotr7e3b0db2014-02-05 22:44:30 +0100282 unsigned int normal_burst_start;
283 float dummy_corr_max, normal_corr_max;
piotr7c82b172014-02-08 14:15:27 +0100284 DCOUT("Dummy");
piotr7e3b0db2014-02-05 22:44:30 +0100285 get_norm_chan_imp_resp(input, &channel_imp_resp[0], &dummy_corr_max, TS_DUMMY);
piotr7c82b172014-02-08 14:15:27 +0100286 DCOUT("Normal");
piotr7e3b0db2014-02-05 22:44:30 +0100287 normal_burst_start = get_norm_chan_imp_resp(input, &channel_imp_resp[0], &normal_corr_max, d_bcc);
288
piotr7c82b172014-02-08 14:15:27 +0100289 DCOUT("normal_corr_max: " << normal_corr_max << " dummy_corr_max:" << dummy_corr_max);
piotr7e3b0db2014-02-05 22:44:30 +0100290 if (normal_corr_max > dummy_corr_max)
piotrd0bf1492014-02-05 17:27:32 +0100291 {
piotr7e3b0db2014-02-05 22:44:30 +0100292 detect_burst(input, &channel_imp_resp[0], normal_burst_start, output_binary);
piotr8dc74a42014-04-17 09:48:46 +0200293 send_burst(d_burst_nr, output_binary, b_type);
piotrd0bf1492014-02-05 17:27:32 +0100294 }
295 else
296 {
piotr6d152d92014-02-21 00:02:44 +0100297 send_burst(d_burst_nr, dummy_burst, b_type);
piotrd0bf1492014-02-05 17:27:32 +0100298 }
299 }
300 case rach_burst:
piotrd0bf1492014-02-05 17:27:32 +0100301 break;
piotr7e3b0db2014-02-05 22:44:30 +0100302 case dummy:
piotr6d152d92014-02-21 00:02:44 +0100303 send_burst(d_burst_nr, dummy_burst, b_type);
piotrd0bf1492014-02-05 17:27:32 +0100304 break;
305 case empty: //if it's empty burst
306 break; //do nothing
307 }
308
309 d_burst_nr++; //go to next burst
310
311 to_consume += TS_BITS * d_OSR + d_burst_nr.get_offset(); //consume samples of the burst up to next guard period
312 //and add offset which is introduced by
313 //0.25 fractional part of a guard period
piotrd0bf1492014-02-05 17:27:32 +0100314 consume_each(to_consume);
315 }
316 break;
piotr437f5462014-02-04 17:57:25 +0100317 }
318
piotr6d152d92014-02-21 00:02:44 +0100319 return 0;
piotrd0bf1492014-02-05 17:27:32 +0100320}
piotr437f5462014-02-04 17:57:25 +0100321
piotrd0bf1492014-02-05 17:27:32 +0100322
323bool receiver_impl::find_fcch_burst(const gr_complex *input, const int nitems)
324{
325 circular_buffer_float phase_diff_buffer(FCCH_HITS_NEEDED * d_OSR); //circular buffer used to scan throug signal to find
326 //best match for FCCH burst
327 float phase_diff = 0;
328 gr_complex conjprod;
329 int start_pos = -1;
330 int hit_count = 0;
331 int miss_count = 0;
332 float min_phase_diff;
333 float max_phase_diff;
334 double best_sum = 0;
335 float lowest_max_min_diff = 99999;
336
337 int to_consume = 0;
338 int sample_number = 0;
339 bool end = false;
340 bool result = false;
341 circular_buffer_float::iterator buffer_iter;
piotr6d152d92014-02-21 00:02:44 +0100342
piotrd0bf1492014-02-05 17:27:32 +0100343 /**@name Possible states of FCCH search algorithm*/
344 //@{
345 enum states
piotr437f5462014-02-04 17:57:25 +0100346 {
piotr437f5462014-02-04 17:57:25 +0100347 init, ///< initialize variables
348 search, ///< search for positive samples
349 found_something, ///< search for FCCH and the best position of it
350 fcch_found, ///< when FCCH was found
351 search_fail ///< when there is no FCCH in the input vector
piotrd0bf1492014-02-05 17:27:32 +0100352 } fcch_search_state;
353 //@}
piotr437f5462014-02-04 17:57:25 +0100354
piotrd0bf1492014-02-05 17:27:32 +0100355 fcch_search_state = init;
piotr437f5462014-02-04 17:57:25 +0100356
piotrd0bf1492014-02-05 17:27:32 +0100357 while (!end)
358 {
359 switch (fcch_search_state)
360 {
piotr437f5462014-02-04 17:57:25 +0100361
piotrd0bf1492014-02-05 17:27:32 +0100362 case init: //initialize variables
piotr437f5462014-02-04 17:57:25 +0100363 hit_count = 0;
364 miss_count = 0;
365 start_pos = -1;
366 lowest_max_min_diff = 99999;
367 phase_diff_buffer.clear();
368 fcch_search_state = search;
369
370 break;
371
piotr7c82b172014-02-08 14:15:27 +0100372 case search: // search for positive samples
piotr437f5462014-02-04 17:57:25 +0100373 sample_number++;
374
piotrd0bf1492014-02-05 17:27:32 +0100375 if (sample_number > nitems - FCCH_HITS_NEEDED * d_OSR) //if it isn't possible to find FCCH because
376 {
piotr7c82b172014-02-08 14:15:27 +0100377 //there's too few samples left to look into,
piotrd0bf1492014-02-05 17:27:32 +0100378 to_consume = sample_number; //don't do anything with those samples which are left
piotr7c82b172014-02-08 14:15:27 +0100379 //and consume only those which were checked
piotrd0bf1492014-02-05 17:27:32 +0100380 fcch_search_state = search_fail;
381 }
382 else
383 {
384 phase_diff = compute_phase_diff(input[sample_number], input[sample_number-1]);
piotr437f5462014-02-04 17:57:25 +0100385
piotrd0bf1492014-02-05 17:27:32 +0100386 if (phase_diff > 0) //if a positive phase difference was found
387 {
388 to_consume = sample_number;
389 fcch_search_state = found_something; //switch to state in which searches for FCCH
390 }
391 else
392 {
393 fcch_search_state = search;
394 }
piotr437f5462014-02-04 17:57:25 +0100395 }
396
397 break;
398
piotrd0bf1492014-02-05 17:27:32 +0100399 case found_something: // search for FCCH and the best position of it
400 {
401 if (phase_diff > 0)
402 {
piotr437f5462014-02-04 17:57:25 +0100403 hit_count++; //positive phase differencies increases hits_count
piotrd0bf1492014-02-05 17:27:32 +0100404 }
405 else
406 {
piotr437f5462014-02-04 17:57:25 +0100407 miss_count++; //negative increases miss_count
piotrd0bf1492014-02-05 17:27:32 +0100408 }
piotr437f5462014-02-04 17:57:25 +0100409
piotrd0bf1492014-02-05 17:27:32 +0100410 if ((miss_count >= FCCH_MAX_MISSES * d_OSR) && (hit_count <= FCCH_HITS_NEEDED * d_OSR))
411 {
piotr437f5462014-02-04 17:57:25 +0100412 //if miss_count exceeds limit before hit_count
413 fcch_search_state = init; //go to init
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)) || (hit_count > 2 * FCCH_HITS_NEEDED * d_OSR))
417 {
piotr437f5462014-02-04 17:57:25 +0100418 //if hit_count and miss_count exceeds limit then FCCH was found
419 fcch_search_state = fcch_found;
420 continue;
piotrd0bf1492014-02-05 17:27:32 +0100421 }
422 else if ((miss_count < FCCH_MAX_MISSES * d_OSR) && (hit_count > FCCH_HITS_NEEDED * d_OSR))
423 {
piotr437f5462014-02-04 17:57:25 +0100424 //find difference between minimal and maximal element in the buffer
425 //for FCCH this value should be low
426 //this part is searching for a region where this value is lowest
427 min_phase_diff = * (min_element(phase_diff_buffer.begin(), phase_diff_buffer.end()));
428 max_phase_diff = * (max_element(phase_diff_buffer.begin(), phase_diff_buffer.end()));
429
piotrd0bf1492014-02-05 17:27:32 +0100430 if (lowest_max_min_diff > max_phase_diff - min_phase_diff)
431 {
432 lowest_max_min_diff = max_phase_diff - min_phase_diff;
433 start_pos = sample_number - FCCH_HITS_NEEDED * d_OSR - FCCH_MAX_MISSES * d_OSR; //store start pos
434 best_sum = 0;
piotr437f5462014-02-04 17:57:25 +0100435
piotrd0bf1492014-02-05 17:27:32 +0100436 for (buffer_iter = phase_diff_buffer.begin();
437 buffer_iter != (phase_diff_buffer.end());
438 buffer_iter++)
439 {
440 best_sum += *buffer_iter - (M_PI / 2) / d_OSR; //store best value of phase offset sum
441 }
piotr437f5462014-02-04 17:57:25 +0100442 }
piotrd0bf1492014-02-05 17:27:32 +0100443 }
piotr437f5462014-02-04 17:57:25 +0100444
piotrd0bf1492014-02-05 17:27:32 +0100445 sample_number++;
piotr437f5462014-02-04 17:57:25 +0100446
piotrd0bf1492014-02-05 17:27:32 +0100447 if (sample_number >= nitems) //if there's no single sample left to check
448 {
piotr437f5462014-02-04 17:57:25 +0100449 fcch_search_state = search_fail;//FCCH search failed
450 continue;
piotr437f5462014-02-04 17:57:25 +0100451 }
piotrd0bf1492014-02-05 17:27:32 +0100452
453 phase_diff = compute_phase_diff(input[sample_number], input[sample_number-1]);
454 phase_diff_buffer.push_back(phase_diff);
455 fcch_search_state = found_something;
456 }
457 break;
458
459 case fcch_found:
460 {
461 DCOUT("fcch found on position: " << d_counter + start_pos);
462 to_consume = start_pos + FCCH_HITS_NEEDED * d_OSR + 1; //consume one FCCH burst
463
464 d_fcch_start_pos = d_counter + start_pos;
465
466 //compute frequency offset
467 double phase_offset = best_sum / FCCH_HITS_NEEDED;
468 double freq_offset = phase_offset * 1625000.0 / (12.0 * M_PI);
469 d_freq_offset -= freq_offset;
470 DCOUT("freq_offset: " << d_freq_offset);
471
472 end = true;
473 result = true;
piotr437f5462014-02-04 17:57:25 +0100474 break;
piotrd0bf1492014-02-05 17:27:32 +0100475 }
piotr437f5462014-02-04 17:57:25 +0100476
piotrd0bf1492014-02-05 17:27:32 +0100477 case search_fail:
piotr437f5462014-02-04 17:57:25 +0100478 end = true;
479 result = false;
480 break;
481 }
piotr437f5462014-02-04 17:57:25 +0100482 }
483
piotrd0bf1492014-02-05 17:27:32 +0100484 d_counter += to_consume;
485 consume_each(to_consume);
piotr437f5462014-02-04 17:57:25 +0100486
piotrd0bf1492014-02-05 17:27:32 +0100487 return result;
488}
489
piotrd0bf1492014-02-05 17:27:32 +0100490double receiver_impl::compute_freq_offset(const gr_complex * input, unsigned first_sample, unsigned last_sample)
491{
492 double phase_sum = 0;
493 unsigned ii;
494
495 for (ii = first_sample; ii < last_sample; ii++)
piotr437f5462014-02-04 17:57:25 +0100496 {
piotr437f5462014-02-04 17:57:25 +0100497 double phase_diff = compute_phase_diff(input[ii], input[ii-1]) - (M_PI / 2) / d_OSR;
498 phase_sum += phase_diff;
piotr437f5462014-02-04 17:57:25 +0100499 }
500
piotrd0bf1492014-02-05 17:27:32 +0100501 double phase_offset = phase_sum / (last_sample - first_sample);
502 double freq_offset = phase_offset * 1625000.0 / (12.0 * M_PI);
503 return freq_offset;
504}
piotr437f5462014-02-04 17:57:25 +0100505
piotrd0bf1492014-02-05 17:27:32 +0100506void receiver_impl::set_frequency(double freq_offset)
507{
508 d_tuner->calleval(freq_offset);
509}
piotr437f5462014-02-04 17:57:25 +0100510
piotrd0bf1492014-02-05 17:27:32 +0100511inline float receiver_impl::compute_phase_diff(gr_complex val1, gr_complex val2)
512{
513 gr_complex conjprod = val1 * conj(val2);
514 return fast_atan2f(imag(conjprod), real(conjprod));
515}
piotr437f5462014-02-04 17:57:25 +0100516
piotrd0bf1492014-02-05 17:27:32 +0100517bool receiver_impl::reach_sch_burst(const int nitems)
518{
519 //it just consumes samples to get near to a SCH burst
520 int to_consume = 0;
521 bool result = false;
522 unsigned sample_nr_near_sch_start = d_fcch_start_pos + (FRAME_BITS - SAFETY_MARGIN) * d_OSR;
523
524 //consume samples until d_counter will be equal to sample_nr_near_sch_start
525 if (d_counter < sample_nr_near_sch_start)
526 {
527 if (d_counter + nitems >= sample_nr_near_sch_start)
528 {
529 to_consume = sample_nr_near_sch_start - d_counter;
530 }
531 else
532 {
533 to_consume = nitems;
piotr437f5462014-02-04 17:57:25 +0100534 }
535 result = false;
piotrd0bf1492014-02-05 17:27:32 +0100536 }
537 else
538 {
piotr437f5462014-02-04 17:57:25 +0100539 to_consume = 0;
540 result = true;
piotr437f5462014-02-04 17:57:25 +0100541 }
542
piotrd0bf1492014-02-05 17:27:32 +0100543 d_counter += to_consume;
544 consume_each(to_consume);
545 return result;
546}
547
548int receiver_impl::get_sch_chan_imp_resp(const gr_complex *input, gr_complex * chan_imp_resp)
549{
550 vector_complex correlation_buffer;
551 vector_float power_buffer;
552 vector_float window_energy_buffer;
553
554 int strongest_window_nr;
555 int burst_start = 0;
556 int chan_imp_resp_center = 0;
557 float max_correlation = 0;
558 float energy = 0;
559
560 for (int ii = SYNC_POS * d_OSR; ii < (SYNC_POS + SYNC_SEARCH_RANGE) *d_OSR; ii++)
piotr437f5462014-02-04 17:57:25 +0100561 {
piotr437f5462014-02-04 17:57:25 +0100562 gr_complex correlation = correlate_sequence(&d_sch_training_seq[5], N_SYNC_BITS - 10, &input[ii]);
563 correlation_buffer.push_back(correlation);
564 power_buffer.push_back(std::pow(abs(correlation), 2));
piotrd0bf1492014-02-05 17:27:32 +0100565 }
piotr437f5462014-02-04 17:57:25 +0100566
piotrd0bf1492014-02-05 17:27:32 +0100567 //compute window energies
568 vector_float::iterator iter = power_buffer.begin();
569 bool loop_end = false;
570 while (iter != power_buffer.end())
571 {
piotr437f5462014-02-04 17:57:25 +0100572 vector_float::iterator iter_ii = iter;
573 energy = 0;
574
piotrd0bf1492014-02-05 17:27:32 +0100575 for (int ii = 0; ii < (d_chan_imp_length) *d_OSR; ii++, iter_ii++)
576 {
577 if (iter_ii == power_buffer.end())
578 {
579 loop_end = true;
580 break;
581 }
582 energy += (*iter_ii);
piotr437f5462014-02-04 17:57:25 +0100583 }
piotrd0bf1492014-02-05 17:27:32 +0100584 if (loop_end)
585 {
586 break;
piotr437f5462014-02-04 17:57:25 +0100587 }
588 iter++;
589 window_energy_buffer.push_back(energy);
piotrd0bf1492014-02-05 17:27:32 +0100590 }
piotr437f5462014-02-04 17:57:25 +0100591
piotrd0bf1492014-02-05 17:27:32 +0100592 strongest_window_nr = max_element(window_energy_buffer.begin(), window_energy_buffer.end()) - window_energy_buffer.begin();
piotr437f5462014-02-04 17:57:25 +0100593 // d_channel_imp_resp.clear();
594
piotrd0bf1492014-02-05 17:27:32 +0100595 max_correlation = 0;
596 for (int ii = 0; ii < (d_chan_imp_length) *d_OSR; ii++)
597 {
piotr437f5462014-02-04 17:57:25 +0100598 gr_complex correlation = correlation_buffer[strongest_window_nr + ii];
piotrd0bf1492014-02-05 17:27:32 +0100599 if (abs(correlation) > max_correlation)
600 {
601 chan_imp_resp_center = ii;
602 max_correlation = abs(correlation);
piotr437f5462014-02-04 17:57:25 +0100603 }
piotrd0bf1492014-02-05 17:27:32 +0100604 // d_channel_imp_resp.push_back(correlation);
piotr437f5462014-02-04 17:57:25 +0100605 chan_imp_resp[ii] = correlation;
piotr437f5462014-02-04 17:57:25 +0100606 }
607
piotrd0bf1492014-02-05 17:27:32 +0100608 burst_start = strongest_window_nr + chan_imp_resp_center - 48 * d_OSR - 2 * d_OSR + 2 + SYNC_POS * d_OSR;
609 return burst_start;
610}
piotr437f5462014-02-04 17:57:25 +0100611
612
piotrd0bf1492014-02-05 17:27:32 +0100613
614void receiver_impl::detect_burst(const gr_complex * input, gr_complex * chan_imp_resp, int burst_start, unsigned char * output_binary)
615{
616 float output[BURST_SIZE];
617 gr_complex rhh_temp[CHAN_IMP_RESP_LENGTH*d_OSR];
618 gr_complex rhh[CHAN_IMP_RESP_LENGTH];
619 gr_complex filtered_burst[BURST_SIZE];
620 int start_state = 3;
621 unsigned int stop_states[2] = {4, 12};
622
623 autocorrelation(chan_imp_resp, rhh_temp, d_chan_imp_length*d_OSR);
624 for (int ii = 0; ii < (d_chan_imp_length); ii++)
piotr437f5462014-02-04 17:57:25 +0100625 {
piotr437f5462014-02-04 17:57:25 +0100626 rhh[ii] = conj(rhh_temp[ii*d_OSR]);
piotr437f5462014-02-04 17:57:25 +0100627 }
628
piotrd0bf1492014-02-05 17:27:32 +0100629 mafi(&input[burst_start], BURST_SIZE, chan_imp_resp, d_chan_imp_length*d_OSR, filtered_burst);
630
631 viterbi_detector(filtered_burst, BURST_SIZE, rhh, start_state, stop_states, 2, output);
632
633 for (int i = 0; i < BURST_SIZE ; i++)
piotr437f5462014-02-04 17:57:25 +0100634 {
piotrd0bf1492014-02-05 17:27:32 +0100635 output_binary[i] = (output[i] > 0);
636 }
637}
piotr437f5462014-02-04 17:57:25 +0100638
piotrd0bf1492014-02-05 17:27:32 +0100639//TODO consider placing this funtion in a separate class for signal processing
640void receiver_impl::gmsk_mapper(const unsigned char * input, int nitems, gr_complex * gmsk_output, gr_complex start_point)
641{
642 gr_complex j = gr_complex(0.0, 1.0);
piotr437f5462014-02-04 17:57:25 +0100643
piotrd0bf1492014-02-05 17:27:32 +0100644 int current_symbol;
645 int encoded_symbol;
646 int previous_symbol = 2 * input[0] - 1;
647 gmsk_output[0] = start_point;
648
649 for (int i = 1; i < nitems; i++)
650 {
piotr437f5462014-02-04 17:57:25 +0100651 //change bits representation to NRZ
652 current_symbol = 2 * input[i] - 1;
653 //differentially encode
654 encoded_symbol = current_symbol * previous_symbol;
655 //and do gmsk mapping
656 gmsk_output[i] = j * gr_complex(encoded_symbol, 0.0) * gmsk_output[i-1];
657 previous_symbol = current_symbol;
piotr437f5462014-02-04 17:57:25 +0100658 }
piotrd0bf1492014-02-05 17:27:32 +0100659}
piotr437f5462014-02-04 17:57:25 +0100660
piotrd0bf1492014-02-05 17:27:32 +0100661//TODO consider use of some generalized function for correlation and placing it in a separate class for signal processing
662gr_complex receiver_impl::correlate_sequence(const gr_complex * sequence, int length, const gr_complex * input)
663{
664 gr_complex result(0.0, 0.0);
665 int sample_number = 0;
666
667 for (int ii = 0; ii < length; ii++)
piotr437f5462014-02-04 17:57:25 +0100668 {
piotr437f5462014-02-04 17:57:25 +0100669 sample_number = (ii * d_OSR) ;
670 result += sequence[ii] * conj(input[sample_number]);
piotr437f5462014-02-04 17:57:25 +0100671 }
672
piotrd0bf1492014-02-05 17:27:32 +0100673 result = result / gr_complex(length, 0);
674 return result;
675}
676
677//computes autocorrelation for positive arguments
678//TODO consider placing this funtion in a separate class for signal processing
679inline void receiver_impl::autocorrelation(const gr_complex * input, gr_complex * out, int nitems)
680{
681 int i, k;
682 for (k = nitems - 1; k >= 0; k--)
piotr437f5462014-02-04 17:57:25 +0100683 {
piotr437f5462014-02-04 17:57:25 +0100684 out[k] = gr_complex(0, 0);
piotrd0bf1492014-02-05 17:27:32 +0100685 for (i = k; i < nitems; i++)
686 {
687 out[k] += input[i] * conj(input[i-k]);
piotr437f5462014-02-04 17:57:25 +0100688 }
piotr437f5462014-02-04 17:57:25 +0100689 }
piotrd0bf1492014-02-05 17:27:32 +0100690}
piotr437f5462014-02-04 17:57:25 +0100691
piotrd0bf1492014-02-05 17:27:32 +0100692//TODO consider use of some generalized function for filtering and placing it in a separate class for signal processing
693inline void receiver_impl::mafi(const gr_complex * input, int nitems, gr_complex * filter, int filter_length, gr_complex * output)
694{
695 int ii = 0, n, a;
696
697 for (n = 0; n < nitems; n++)
piotr437f5462014-02-04 17:57:25 +0100698 {
piotr437f5462014-02-04 17:57:25 +0100699 a = n * d_OSR;
700 output[n] = 0;
701 ii = 0;
702
piotrd0bf1492014-02-05 17:27:32 +0100703 while (ii < filter_length)
704 {
705 if ((a + ii) >= nitems*d_OSR)
706 break;
707 output[n] += input[a+ii] * filter[ii];
708 ii++;
piotr437f5462014-02-04 17:57:25 +0100709 }
piotr437f5462014-02-04 17:57:25 +0100710 }
piotrd0bf1492014-02-05 17:27:32 +0100711}
piotr437f5462014-02-04 17:57:25 +0100712
piotrd0bf1492014-02-05 17:27:32 +0100713//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 +0100714//especially computations of strongest_window_nr
piotr7e3b0db2014-02-05 22:44:30 +0100715int 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 +0100716{
717 vector_complex correlation_buffer;
718 vector_float power_buffer;
719 vector_float window_energy_buffer;
piotr437f5462014-02-04 17:57:25 +0100720
piotrd0bf1492014-02-05 17:27:32 +0100721 int strongest_window_nr;
722 int burst_start = 0;
723 int chan_imp_resp_center = 0;
724 float max_correlation = 0;
725 float energy = 0;
piotr5c820252014-04-17 09:43:02 +0200726
piotrd0bf1492014-02-05 17:27:32 +0100727 int search_center = (int)((TRAIN_POS + GUARD_PERIOD) * d_OSR);
piotr7c82b172014-02-08 14:15:27 +0100728 int search_start_pos = search_center + 1 - 5*d_OSR;
piotr437f5462014-02-04 17:57:25 +0100729 // int search_start_pos = search_center - d_chan_imp_length * d_OSR;
piotr5c820252014-04-17 09:43:02 +0200730 int search_stop_pos = search_center + d_chan_imp_length * d_OSR + 5 * d_OSR;
piotr437f5462014-02-04 17:57:25 +0100731
piotrd0bf1492014-02-05 17:27:32 +0100732 for (int ii = search_start_pos; ii < search_stop_pos; ii++)
733 {
piotr437f5462014-02-04 17:57:25 +0100734 gr_complex correlation = correlate_sequence(&d_norm_training_seq[bcc][TRAIN_BEGINNING], N_TRAIN_BITS - 10, &input[ii]);
735
736 correlation_buffer.push_back(correlation);
737 power_buffer.push_back(std::pow(abs(correlation), 2));
piotrd0bf1492014-02-05 17:27:32 +0100738 }
piotr437f5462014-02-04 17:57:25 +0100739
piotrd0bf1492014-02-05 17:27:32 +0100740 //compute window energies
741 vector_float::iterator iter = power_buffer.begin();
742 bool loop_end = false;
743 while (iter != power_buffer.end())
744 {
piotr437f5462014-02-04 17:57:25 +0100745 vector_float::iterator iter_ii = iter;
746 energy = 0;
747
piotrd0bf1492014-02-05 17:27:32 +0100748 for (int ii = 0; ii < (d_chan_imp_length - 2)*d_OSR; ii++, iter_ii++)
749 {
piotrd0bf1492014-02-05 17:27:32 +0100750 if (iter_ii == power_buffer.end())
751 {
752 loop_end = true;
753 break;
754 }
755 energy += (*iter_ii);
piotr437f5462014-02-04 17:57:25 +0100756 }
piotrd0bf1492014-02-05 17:27:32 +0100757 if (loop_end)
758 {
759 break;
piotr437f5462014-02-04 17:57:25 +0100760 }
761 iter++;
762
763 window_energy_buffer.push_back(energy);
piotrd0bf1492014-02-05 17:27:32 +0100764 }
piotr437f5462014-02-04 17:57:25 +0100765
piotr5c820252014-04-17 09:43:02 +0200766 strongest_window_nr = max_element(window_energy_buffer.begin(), window_energy_buffer.end()-((d_chan_imp_length)*d_OSR)) - window_energy_buffer.begin();
767 //strongest_window_nr = strongest_window_nr-d_OSR;
768 if(strongest_window_nr<0){
769 strongest_window_nr = 0;
770 }
piotr6d152d92014-02-21 00:02:44 +0100771
piotrd0bf1492014-02-05 17:27:32 +0100772 max_correlation = 0;
773 for (int ii = 0; ii < (d_chan_imp_length)*d_OSR; ii++)
774 {
piotr437f5462014-02-04 17:57:25 +0100775 gr_complex correlation = correlation_buffer[strongest_window_nr + ii];
piotrd0bf1492014-02-05 17:27:32 +0100776 if (abs(correlation) > max_correlation)
777 {
778 chan_imp_resp_center = ii;
779 max_correlation = abs(correlation);
piotr437f5462014-02-04 17:57:25 +0100780 }
piotrd0bf1492014-02-05 17:27:32 +0100781 // d_channel_imp_resp.push_back(correlation);
piotr437f5462014-02-04 17:57:25 +0100782 chan_imp_resp[ii] = correlation;
piotr437f5462014-02-04 17:57:25 +0100783 }
piotr7c82b172014-02-08 14:15:27 +0100784
piotr7e3b0db2014-02-05 22:44:30 +0100785 *corr_max = max_correlation;
786 // We want to use the first sample of the impulse response, and the
piotrd0bf1492014-02-05 17:27:32 +0100787 // corresponding samples of the received signal.
788 // the variable sync_w should contain the beginning of the used part of
789 // training sequence, which is 3+57+1+6=67 bits into the burst. That is
790 // we have that sync_t16 equals first sample in bit number 67.
791
piotr7c82b172014-02-08 14:15:27 +0100792 DCOUT("strongest_window_nr_new: " << strongest_window_nr);
piotr6d152d92014-02-21 00:02:44 +0100793 burst_start = search_start_pos + strongest_window_nr - TRAIN_POS * d_OSR;
piotr7c82b172014-02-08 14:15:27 +0100794
795 DCOUT("burst_start: " << burst_start);
piotrd0bf1492014-02-05 17:27:32 +0100796 return burst_start;
797}
piotr437f5462014-02-04 17:57:25 +0100798
799
piotr6d152d92014-02-21 00:02:44 +0100800void receiver_impl::send_burst(burst_counter burst_nr, const unsigned char * burst_binary, burst_type b_type)
piotrd0bf1492014-02-05 17:27:32 +0100801{
piotr7c82b172014-02-08 14:15:27 +0100802
piotr6d152d92014-02-21 00:02:44 +0100803 boost::scoped_ptr<gsmtap_hdr> tap_header(new gsmtap_hdr());
804
805 tap_header->version = GSMTAP_VERSION;
806 tap_header->hdr_len = BURST_SIZE/4;
807 tap_header->type = GSMTAP_TYPE_UM_BURST;
808 tap_header->timeslot = static_cast<uint8_t>(d_burst_nr.get_timeslot_nr());
809 tap_header->frame_number = d_burst_nr.get_frame_nr();
810 tap_header->sub_type = static_cast<uint8_t>(b_type);
811 tap_header->arfcn = d_arfcn;
812 tap_header->signal_dbm = static_cast<int8_t>(d_signal_dbm);
813 pmt::pmt_t header_blob=pmt::make_blob(tap_header.get(),sizeof(gsmtap_hdr));
814 pmt::pmt_t burst_binary_blob=pmt::make_blob(burst_binary,BURST_SIZE);
815 pmt::pmt_t msg = pmt::cons(header_blob, burst_binary_blob);
816
817 message_port_pub(pmt::mp("bursts"), msg);
piotrd0bf1492014-02-05 17:27:32 +0100818}
piotr6d152d92014-02-21 00:02:44 +0100819
piotrd0bf1492014-02-05 17:27:32 +0100820void receiver_impl::configure_receiver()
821{
822 d_channel_conf.set_multiframe_type(TSC0, multiframe_51);
823 d_channel_conf.set_burst_types(TIMESLOT0, TEST51, sizeof(TEST51) / sizeof(unsigned), dummy_or_normal);
piotr437f5462014-02-04 17:57:25 +0100824
piotrd0bf1492014-02-05 17:27:32 +0100825 d_channel_conf.set_burst_types(TSC0, TEST_CCH_FRAMES, sizeof(TEST_CCH_FRAMES) / sizeof(unsigned), dummy_or_normal);
826 d_channel_conf.set_burst_types(TSC0, FCCH_FRAMES, sizeof(FCCH_FRAMES) / sizeof(unsigned), fcch_burst);
piotr437f5462014-02-04 17:57:25 +0100827
828 // d_channel_conf.set_multiframe_type(TIMESLOT1, multiframe_26);
829 // d_channel_conf.set_burst_types(TIMESLOT1, TRAFFIC_CHANNEL_F, sizeof(TRAFFIC_CHANNEL_F) / sizeof(unsigned), dummy_or_normal);
830 // d_channel_conf.set_multiframe_type(TIMESLOT2, multiframe_26);
831 // d_channel_conf.set_burst_types(TIMESLOT2, TRAFFIC_CHANNEL_F, sizeof(TRAFFIC_CHANNEL_F) / sizeof(unsigned), dummy_or_normal);
832 // d_channel_conf.set_multiframe_type(TIMESLOT3, multiframe_26);
833 // d_channel_conf.set_burst_types(TIMESLOT3, TRAFFIC_CHANNEL_F, sizeof(TRAFFIC_CHANNEL_F) / sizeof(unsigned), dummy_or_normal);
834 // d_channel_conf.set_multiframe_type(TIMESLOT4, multiframe_26);
835 // d_channel_conf.set_burst_types(TIMESLOT4, TRAFFIC_CHANNEL_F, sizeof(TRAFFIC_CHANNEL_F) / sizeof(unsigned), dummy_or_normal);
836 // d_channel_conf.set_multiframe_type(TIMESLOT5, multiframe_26);
837 // d_channel_conf.set_burst_types(TIMESLOT5, TRAFFIC_CHANNEL_F, sizeof(TRAFFIC_CHANNEL_F) / sizeof(unsigned), dummy_or_normal);
838 // d_channel_conf.set_multiframe_type(TIMESLOT6, multiframe_26);
839 // d_channel_conf.set_burst_types(TIMESLOT6, TRAFFIC_CHANNEL_F, sizeof(TRAFFIC_CHANNEL_F) / sizeof(unsigned), dummy_or_normal);
840 // d_channel_conf.set_multiframe_type(TIMESLOT7, multiframe_26);
841 // 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 +0100842
piotrd0bf1492014-02-05 17:27:32 +0100843 d_channel_conf.set_multiframe_type(TIMESLOT1, multiframe_51);
844 d_channel_conf.set_burst_types(TIMESLOT1, TEST51, sizeof(TEST51) / sizeof(unsigned), dummy_or_normal);
845 d_channel_conf.set_multiframe_type(TIMESLOT2, multiframe_51);
846 d_channel_conf.set_burst_types(TIMESLOT2, TEST51, sizeof(TEST51) / sizeof(unsigned), dummy_or_normal);
847 d_channel_conf.set_multiframe_type(TIMESLOT3, multiframe_51);
848 d_channel_conf.set_burst_types(TIMESLOT3, TEST51, sizeof(TEST51) / sizeof(unsigned), dummy_or_normal);
849 d_channel_conf.set_multiframe_type(TIMESLOT4, multiframe_51);
850 d_channel_conf.set_burst_types(TIMESLOT4, TEST51, sizeof(TEST51) / sizeof(unsigned), dummy_or_normal);
851 d_channel_conf.set_multiframe_type(TIMESLOT5, multiframe_51);
852 d_channel_conf.set_burst_types(TIMESLOT5, TEST51, sizeof(TEST51) / sizeof(unsigned), dummy_or_normal);
853 d_channel_conf.set_multiframe_type(TIMESLOT6, multiframe_51);
854 d_channel_conf.set_burst_types(TIMESLOT6, TEST51, sizeof(TEST51) / sizeof(unsigned), dummy_or_normal);
855 d_channel_conf.set_multiframe_type(TIMESLOT7, multiframe_51);
856 d_channel_conf.set_burst_types(TIMESLOT7, TEST51, sizeof(TEST51) / sizeof(unsigned), dummy_or_normal);
857
858}
piotr437f5462014-02-04 17:57:25 +0100859
860
piotrd0bf1492014-02-05 17:27:32 +0100861} /* namespace gsm */
piotr437f5462014-02-04 17:57:25 +0100862} /* namespace gr */
863