blob: 6e92c2d5fbaf3a44394a62a938bfea976d9edb24 [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)
piotrc7c249a2014-05-02 17:24:08 +020065 : gr::sync_block("receiver",
piotrd0bf1492014-02-05 17:27:32 +010066 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;
piotrc7c249a2014-05-02 17:24:08 +020081 set_output_multiple(floor((TS_BITS + 2 * GUARD_PERIOD) * d_OSR)); //don't send samples to the receiver until there are at least samples for one
82 // burst and two gurad periods (one gurard period is an arbitrary overlap)
piotrd0bf1492014-02-05 17:27:32 +010083 gmsk_mapper(SYNC_BITS, N_SYNC_BITS, d_sch_training_seq, gr_complex(0.0, -1.0));
84 for (i = 0; i < TRAIN_SEQ_NUM; i++)
piotr437f5462014-02-04 17:57:25 +010085 {
piotrf502e0f2014-04-24 10:28:29 +020086 gr_complex startpoint = (train_seq[i][0]==0) ? gr_complex(1.0, 0.0) : gr_complex(-1.0, 0.0); //if first bit of the seqeunce ==0 first symbol ==1
piotr437f5462014-02-04 17:57:25 +010087 gmsk_mapper(train_seq[i], N_TRAIN_BITS, d_norm_training_seq[i], startpoint);
piotr437f5462014-02-04 17:57:25 +010088 }
piotr7c82b172014-02-08 14:15:27 +010089 message_port_register_out(pmt::mp("bursts"));
piotr903b1d62014-04-17 11:33:27 +020090 configure_receiver(); //configure the receiver - tell it where to find which burst type
piotrd0bf1492014-02-05 17:27:32 +010091}
piotr437f5462014-02-04 17:57:25 +010092
piotrd0bf1492014-02-05 17:27:32 +010093/*
94 * Our virtual destructor.
95 */
96receiver_impl::~receiver_impl()
97{
98}
99
piotrd0bf1492014-02-05 17:27:32 +0100100int
piotrc7c249a2014-05-02 17:24:08 +0200101receiver_impl::work(int noutput_items,
102 gr_vector_const_void_star &input_items,
103 gr_vector_void_star &output_items)
piotrd0bf1492014-02-05 17:27:32 +0100104{
piotrc7c249a2014-05-02 17:24:08 +0200105 //std::cout << noutput_items << std::endl;
piotrd0bf1492014-02-05 17:27:32 +0100106 const gr_complex *input = (const gr_complex *) input_items[0];
piotr7c82b172014-02-08 14:15:27 +0100107
piotrd0bf1492014-02-05 17:27:32 +0100108 switch (d_state)
piotr437f5462014-02-04 17:57:25 +0100109 {
piotrd0bf1492014-02-05 17:27:32 +0100110 //bootstrapping
111 case first_fcch_search:
piotr7e3b0db2014-02-05 22:44:30 +0100112 DCOUT("FCCH search");
piotrc7c249a2014-05-02 17:24:08 +0200113 if (find_fcch_burst(input, noutput_items)) //find frequency correction burst in the input buffer
piotrd0bf1492014-02-05 17:27:32 +0100114 {
piotr5f1e1d32014-02-05 18:10:05 +0100115 //set_frequency(d_freq_offset); //if fcch search is successful set frequency offset
piotr6d152d92014-02-21 00:02:44 +0100116 COUT("Freq offset " << d_freq_offset);
piotr437f5462014-02-04 17:57:25 +0100117 d_state = next_fcch_search;
piotrd0bf1492014-02-05 17:27:32 +0100118 }
119 else
120 {
piotr437f5462014-02-04 17:57:25 +0100121 d_state = first_fcch_search;
piotrd0bf1492014-02-05 17:27:32 +0100122 }
123 break;
piotr437f5462014-02-04 17:57:25 +0100124
piotrd0bf1492014-02-05 17:27:32 +0100125 case next_fcch_search: //this state is used because it takes some time (a bunch of buffered samples)
126 {
piotr7e3b0db2014-02-05 22:44:30 +0100127 DCOUT("NEXT FCCH search");
piotrd0bf1492014-02-05 17:27:32 +0100128 float prev_freq_offset = d_freq_offset; //before previous set_frequqency cause change
piotrc7c249a2014-05-02 17:24:08 +0200129 if (find_fcch_burst(input, noutput_items))
piotrd0bf1492014-02-05 17:27:32 +0100130 {
131 if (abs(prev_freq_offset - d_freq_offset) > FCCH_MAX_FREQ_OFFSET)
132 {
piotr5f1e1d32014-02-05 18:10:05 +0100133 //set_frequency(d_freq_offset); //call set_frequncy only frequency offset change is greater than some value
piotr6d152d92014-02-21 00:02:44 +0100134 DCOUT("Freq offset " << d_freq_offset);
piotr437f5462014-02-04 17:57:25 +0100135 }
piotrd0bf1492014-02-05 17:27:32 +0100136 d_state = sch_search;
137 }
138 else
139 {
piotrd0bf1492014-02-05 17:27:32 +0100140 d_state = next_fcch_search;
141 }
142 break;
143 }
piotr437f5462014-02-04 17:57:25 +0100144
145
piotrd0bf1492014-02-05 17:27:32 +0100146 case sch_search:
147 {
piotr7c82b172014-02-08 14:15:27 +0100148 DCOUT("SCH search");
piotrd0bf1492014-02-05 17:27:32 +0100149 vector_complex channel_imp_resp(CHAN_IMP_RESP_LENGTH*d_OSR);
150 int t1, t2, t3;
151 int burst_start = 0;
152 unsigned char output_binary[BURST_SIZE];
piotr437f5462014-02-04 17:57:25 +0100153
piotrc7c249a2014-05-02 17:24:08 +0200154 if (reach_sch_burst(noutput_items)) //wait for a SCH burst
piotrd0bf1492014-02-05 17:27:32 +0100155 {
156 burst_start = get_sch_chan_imp_resp(input, &channel_imp_resp[0]); //get channel impulse response from it
157 detect_burst(input, &channel_imp_resp[0], burst_start, output_binary); //detect bits using MLSE detection
158 if (decode_sch(&output_binary[3], &t1, &t2, &t3, &d_ncc, &d_bcc) == 0) //decode SCH burst
159 {
piotr6d152d92014-02-21 00:02:44 +0100160 DCOUT("sch burst_start: " << burst_start);
161 DCOUT("bcc: " << d_bcc << " ncc: " << d_ncc << " t1: " << t1 << " t2: " << t2 << " t3: " << t3);
piotr437f5462014-02-04 17:57:25 +0100162 d_burst_nr.set(t1, t2, t3, 0); //set counter of bursts value
piotr437f5462014-02-04 17:57:25 +0100163 d_burst_nr++;
164
165 consume_each(burst_start + BURST_SIZE * d_OSR); //consume samples up to next guard period
166 d_state = synchronized;
piotrd0bf1492014-02-05 17:27:32 +0100167 }
168 else
169 {
piotr437f5462014-02-04 17:57:25 +0100170 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 +0100171 }
piotrd0bf1492014-02-05 17:27:32 +0100172 }
173 else
174 {
175 d_state = sch_search;
176 }
177 break;
178 }
179 //in this state receiver is synchronized and it processes bursts according to burst type for given burst number
180 case synchronized:
181 {
piotr6d152d92014-02-21 00:02:44 +0100182 DCOUT("Synchronized");
piotrd0bf1492014-02-05 17:27:32 +0100183 vector_complex channel_imp_resp(CHAN_IMP_RESP_LENGTH*d_OSR);
184 int burst_start;
185 int offset = 0;
186 int to_consume = 0;
187 unsigned char output_binary[BURST_SIZE];
piotr437f5462014-02-04 17:57:25 +0100188
piotrd0bf1492014-02-05 17:27:32 +0100189 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 +0100190 double signal_pwr=0;
piotrc7c249a2014-05-02 17:24:08 +0200191 for(int ii=0;ii<noutput_items;ii++)
piotr6d152d92014-02-21 00:02:44 +0100192 {
193 signal_pwr += abs(input[ii])*abs(input[ii]);
194 }
195 d_signal_dbm=static_cast<int8_t>(round(20*log10(signal_pwr)));
196
piotrd0bf1492014-02-05 17:27:32 +0100197 switch (b_type)
198 {
199 case fcch_burst: //if it's FCCH burst
200 {
201 const unsigned first_sample = ceil((GUARD_PERIOD + 2 * TAIL_BITS) * d_OSR) + 1;
202 const unsigned last_sample = first_sample + USEFUL_BITS * d_OSR - TAIL_BITS * d_OSR;
203 double freq_offset = compute_freq_offset(input, first_sample, last_sample); //extract frequency offset from it
piotr437f5462014-02-04 17:57:25 +0100204
piotrd0bf1492014-02-05 17:27:32 +0100205 d_freq_offset_vals.push_front(freq_offset);
piotr6d152d92014-02-21 00:02:44 +0100206 send_burst(d_burst_nr, fc_fb, b_type);
207
piotrd0bf1492014-02-05 17:27:32 +0100208 if (d_freq_offset_vals.size() >= 10)
209 {
210 double sum = std::accumulate(d_freq_offset_vals.begin(), d_freq_offset_vals.end(), 0);
211 double mean_offset = sum / d_freq_offset_vals.size(); //compute mean
212 d_freq_offset_vals.clear();
piotr7c82b172014-02-08 14:15:27 +0100213 DCOUT("mean offset" << mean_offset);
piotrd0bf1492014-02-05 17:27:32 +0100214 if (abs(mean_offset) > FCCH_MAX_FREQ_OFFSET)
215 {
piotr7c82b172014-02-08 14:15:27 +0100216 //d_freq_offset -= mean_offset; //and adjust frequency if it have changed beyond
piotr5f1e1d32014-02-05 18:10:05 +0100217 //set_frequency(d_freq_offset); //some limit
piotr7e3b0db2014-02-05 22:44:30 +0100218 DCOUT("Adjusting frequency, new frequency offset: " << d_freq_offset << "\n");
piotrd0bf1492014-02-05 17:27:32 +0100219 }
220 }
221 }
222 break;
223 case sch_burst: //if it's SCH burst
224 {
225 int t1, t2, t3, d_ncc, d_bcc;
226 burst_start = get_sch_chan_imp_resp(input, &channel_imp_resp[0]); //get channel impulse response
227 detect_burst(input, &channel_imp_resp[0], burst_start, output_binary); //MLSE detection of bits
piotr6d152d92014-02-21 00:02:44 +0100228 send_burst(d_burst_nr, output_binary, b_type);
piotrd0bf1492014-02-05 17:27:32 +0100229 if (decode_sch(&output_binary[3], &t1, &t2, &t3, &d_ncc, &d_bcc) == 0) //and decode SCH data
230 {
231 // d_burst_nr.set(t1, t2, t3, 0); //but only to check if burst_start value is correct
232 d_failed_sch = 0;
233 DCOUT("bcc: " << d_bcc << " ncc: " << d_ncc << " t1: " << t1 << " t2: " << t2 << " t3: " << t3);
234 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 +0100235 DCOUT("offset: "<<offset);
piotrd0bf1492014-02-05 17:27:32 +0100236 to_consume += offset; //adjust with offset number of samples to be consumed
237 }
238 else
239 {
240 d_failed_sch++;
241 if (d_failed_sch >= MAX_SCH_ERRORS)
242 {
piotr54624012014-04-17 23:36:27 +0200243 d_state = next_fcch_search;
piotr437f5462014-02-04 17:57:25 +0100244 d_freq_offset_vals.clear();
piotrd0bf1492014-02-05 17:27:32 +0100245 d_freq_offset=0;
piotr7c82b172014-02-08 14:15:27 +0100246 //set_frequency(0);
247 DCOUT("Re-Synchronization");
piotr437f5462014-02-04 17:57:25 +0100248 }
piotr437f5462014-02-04 17:57:25 +0100249 }
piotrd0bf1492014-02-05 17:27:32 +0100250 }
251 break;
piotr437f5462014-02-04 17:57:25 +0100252
piotr7e3b0db2014-02-05 22:44:30 +0100253 case normal_burst:
254 {
255 float normal_corr_max; //if it's normal burst
256 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 +0100257 detect_burst(input, &channel_imp_resp[0], burst_start, output_binary); //MLSE detection of bits
piotr8dc74a42014-04-17 09:48:46 +0200258 send_burst(d_burst_nr, output_binary, b_type);
piotrd0bf1492014-02-05 17:27:32 +0100259 break;
piotr7e3b0db2014-02-05 22:44:30 +0100260 }
piotrd0bf1492014-02-05 17:27:32 +0100261 case dummy_or_normal:
262 {
piotr7e3b0db2014-02-05 22:44:30 +0100263 unsigned int normal_burst_start;
264 float dummy_corr_max, normal_corr_max;
piotr7c82b172014-02-08 14:15:27 +0100265 DCOUT("Dummy");
piotr7e3b0db2014-02-05 22:44:30 +0100266 get_norm_chan_imp_resp(input, &channel_imp_resp[0], &dummy_corr_max, TS_DUMMY);
piotr7c82b172014-02-08 14:15:27 +0100267 DCOUT("Normal");
piotr7e3b0db2014-02-05 22:44:30 +0100268 normal_burst_start = get_norm_chan_imp_resp(input, &channel_imp_resp[0], &normal_corr_max, d_bcc);
269
piotr7c82b172014-02-08 14:15:27 +0100270 DCOUT("normal_corr_max: " << normal_corr_max << " dummy_corr_max:" << dummy_corr_max);
piotr7e3b0db2014-02-05 22:44:30 +0100271 if (normal_corr_max > dummy_corr_max)
piotrd0bf1492014-02-05 17:27:32 +0100272 {
piotr7e3b0db2014-02-05 22:44:30 +0100273 detect_burst(input, &channel_imp_resp[0], normal_burst_start, output_binary);
piotr8dc74a42014-04-17 09:48:46 +0200274 send_burst(d_burst_nr, output_binary, b_type);
piotrd0bf1492014-02-05 17:27:32 +0100275 }
276 else
277 {
piotr6d152d92014-02-21 00:02:44 +0100278 send_burst(d_burst_nr, dummy_burst, b_type);
piotrd0bf1492014-02-05 17:27:32 +0100279 }
280 }
281 case rach_burst:
piotrd0bf1492014-02-05 17:27:32 +0100282 break;
piotr7e3b0db2014-02-05 22:44:30 +0100283 case dummy:
piotr6d152d92014-02-21 00:02:44 +0100284 send_burst(d_burst_nr, dummy_burst, b_type);
piotrd0bf1492014-02-05 17:27:32 +0100285 break;
286 case empty: //if it's empty burst
287 break; //do nothing
288 }
289
290 d_burst_nr++; //go to next burst
291
292 to_consume += TS_BITS * d_OSR + d_burst_nr.get_offset(); //consume samples of the burst up to next guard period
293 //and add offset which is introduced by
294 //0.25 fractional part of a guard period
piotrd0bf1492014-02-05 17:27:32 +0100295 consume_each(to_consume);
296 }
297 break;
piotr437f5462014-02-04 17:57:25 +0100298 }
299
piotr6d152d92014-02-21 00:02:44 +0100300 return 0;
piotrd0bf1492014-02-05 17:27:32 +0100301}
piotr437f5462014-02-04 17:57:25 +0100302
piotrd0bf1492014-02-05 17:27:32 +0100303
304bool receiver_impl::find_fcch_burst(const gr_complex *input, const int nitems)
305{
306 circular_buffer_float phase_diff_buffer(FCCH_HITS_NEEDED * d_OSR); //circular buffer used to scan throug signal to find
307 //best match for FCCH burst
308 float phase_diff = 0;
309 gr_complex conjprod;
310 int start_pos = -1;
311 int hit_count = 0;
312 int miss_count = 0;
313 float min_phase_diff;
314 float max_phase_diff;
315 double best_sum = 0;
316 float lowest_max_min_diff = 99999;
317
318 int to_consume = 0;
319 int sample_number = 0;
320 bool end = false;
321 bool result = false;
322 circular_buffer_float::iterator buffer_iter;
piotr6d152d92014-02-21 00:02:44 +0100323
piotrd0bf1492014-02-05 17:27:32 +0100324 /**@name Possible states of FCCH search algorithm*/
325 //@{
326 enum states
piotr437f5462014-02-04 17:57:25 +0100327 {
piotr437f5462014-02-04 17:57:25 +0100328 init, ///< initialize variables
329 search, ///< search for positive samples
330 found_something, ///< search for FCCH and the best position of it
331 fcch_found, ///< when FCCH was found
332 search_fail ///< when there is no FCCH in the input vector
piotrd0bf1492014-02-05 17:27:32 +0100333 } fcch_search_state;
334 //@}
piotr437f5462014-02-04 17:57:25 +0100335
piotrd0bf1492014-02-05 17:27:32 +0100336 fcch_search_state = init;
piotr437f5462014-02-04 17:57:25 +0100337
piotrd0bf1492014-02-05 17:27:32 +0100338 while (!end)
339 {
340 switch (fcch_search_state)
341 {
piotr437f5462014-02-04 17:57:25 +0100342
piotrd0bf1492014-02-05 17:27:32 +0100343 case init: //initialize variables
piotr437f5462014-02-04 17:57:25 +0100344 hit_count = 0;
345 miss_count = 0;
346 start_pos = -1;
347 lowest_max_min_diff = 99999;
348 phase_diff_buffer.clear();
349 fcch_search_state = search;
350
351 break;
352
piotr7c82b172014-02-08 14:15:27 +0100353 case search: // search for positive samples
piotr437f5462014-02-04 17:57:25 +0100354 sample_number++;
355
piotrd0bf1492014-02-05 17:27:32 +0100356 if (sample_number > nitems - FCCH_HITS_NEEDED * d_OSR) //if it isn't possible to find FCCH because
357 {
piotr7c82b172014-02-08 14:15:27 +0100358 //there's too few samples left to look into,
piotrd0bf1492014-02-05 17:27:32 +0100359 to_consume = sample_number; //don't do anything with those samples which are left
piotr7c82b172014-02-08 14:15:27 +0100360 //and consume only those which were checked
piotrd0bf1492014-02-05 17:27:32 +0100361 fcch_search_state = search_fail;
362 }
363 else
364 {
365 phase_diff = compute_phase_diff(input[sample_number], input[sample_number-1]);
piotr437f5462014-02-04 17:57:25 +0100366
piotrd0bf1492014-02-05 17:27:32 +0100367 if (phase_diff > 0) //if a positive phase difference was found
368 {
369 to_consume = sample_number;
370 fcch_search_state = found_something; //switch to state in which searches for FCCH
371 }
372 else
373 {
374 fcch_search_state = search;
375 }
piotr437f5462014-02-04 17:57:25 +0100376 }
377
378 break;
379
piotrd0bf1492014-02-05 17:27:32 +0100380 case found_something: // search for FCCH and the best position of it
381 {
382 if (phase_diff > 0)
383 {
piotr437f5462014-02-04 17:57:25 +0100384 hit_count++; //positive phase differencies increases hits_count
piotrd0bf1492014-02-05 17:27:32 +0100385 }
386 else
387 {
piotr437f5462014-02-04 17:57:25 +0100388 miss_count++; //negative increases miss_count
piotrd0bf1492014-02-05 17:27:32 +0100389 }
piotr437f5462014-02-04 17:57:25 +0100390
piotrd0bf1492014-02-05 17:27:32 +0100391 if ((miss_count >= FCCH_MAX_MISSES * d_OSR) && (hit_count <= FCCH_HITS_NEEDED * d_OSR))
392 {
piotr437f5462014-02-04 17:57:25 +0100393 //if miss_count exceeds limit before hit_count
394 fcch_search_state = init; //go to init
395 continue;
piotrd0bf1492014-02-05 17:27:32 +0100396 }
397 else if (((miss_count >= FCCH_MAX_MISSES * d_OSR) && (hit_count > FCCH_HITS_NEEDED * d_OSR)) || (hit_count > 2 * FCCH_HITS_NEEDED * d_OSR))
398 {
piotr437f5462014-02-04 17:57:25 +0100399 //if hit_count and miss_count exceeds limit then FCCH was found
400 fcch_search_state = fcch_found;
401 continue;
piotrd0bf1492014-02-05 17:27:32 +0100402 }
403 else if ((miss_count < FCCH_MAX_MISSES * d_OSR) && (hit_count > FCCH_HITS_NEEDED * d_OSR))
404 {
piotr437f5462014-02-04 17:57:25 +0100405 //find difference between minimal and maximal element in the buffer
406 //for FCCH this value should be low
407 //this part is searching for a region where this value is lowest
408 min_phase_diff = * (min_element(phase_diff_buffer.begin(), phase_diff_buffer.end()));
409 max_phase_diff = * (max_element(phase_diff_buffer.begin(), phase_diff_buffer.end()));
410
piotrd0bf1492014-02-05 17:27:32 +0100411 if (lowest_max_min_diff > max_phase_diff - min_phase_diff)
412 {
413 lowest_max_min_diff = max_phase_diff - min_phase_diff;
414 start_pos = sample_number - FCCH_HITS_NEEDED * d_OSR - FCCH_MAX_MISSES * d_OSR; //store start pos
415 best_sum = 0;
piotr437f5462014-02-04 17:57:25 +0100416
piotrd0bf1492014-02-05 17:27:32 +0100417 for (buffer_iter = phase_diff_buffer.begin();
418 buffer_iter != (phase_diff_buffer.end());
419 buffer_iter++)
420 {
421 best_sum += *buffer_iter - (M_PI / 2) / d_OSR; //store best value of phase offset sum
422 }
piotr437f5462014-02-04 17:57:25 +0100423 }
piotrd0bf1492014-02-05 17:27:32 +0100424 }
piotr437f5462014-02-04 17:57:25 +0100425
piotrd0bf1492014-02-05 17:27:32 +0100426 sample_number++;
piotr437f5462014-02-04 17:57:25 +0100427
piotrd0bf1492014-02-05 17:27:32 +0100428 if (sample_number >= nitems) //if there's no single sample left to check
429 {
piotr437f5462014-02-04 17:57:25 +0100430 fcch_search_state = search_fail;//FCCH search failed
431 continue;
piotr437f5462014-02-04 17:57:25 +0100432 }
piotrd0bf1492014-02-05 17:27:32 +0100433
434 phase_diff = compute_phase_diff(input[sample_number], input[sample_number-1]);
435 phase_diff_buffer.push_back(phase_diff);
436 fcch_search_state = found_something;
437 }
438 break;
439
440 case fcch_found:
441 {
442 DCOUT("fcch found on position: " << d_counter + start_pos);
443 to_consume = start_pos + FCCH_HITS_NEEDED * d_OSR + 1; //consume one FCCH burst
444
445 d_fcch_start_pos = d_counter + start_pos;
446
447 //compute frequency offset
448 double phase_offset = best_sum / FCCH_HITS_NEEDED;
449 double freq_offset = phase_offset * 1625000.0 / (12.0 * M_PI);
450 d_freq_offset -= freq_offset;
451 DCOUT("freq_offset: " << d_freq_offset);
452
453 end = true;
454 result = true;
piotr437f5462014-02-04 17:57:25 +0100455 break;
piotrd0bf1492014-02-05 17:27:32 +0100456 }
piotr437f5462014-02-04 17:57:25 +0100457
piotrd0bf1492014-02-05 17:27:32 +0100458 case search_fail:
piotr437f5462014-02-04 17:57:25 +0100459 end = true;
460 result = false;
461 break;
462 }
piotr437f5462014-02-04 17:57:25 +0100463 }
464
piotrd0bf1492014-02-05 17:27:32 +0100465 d_counter += to_consume;
466 consume_each(to_consume);
piotr437f5462014-02-04 17:57:25 +0100467
piotrd0bf1492014-02-05 17:27:32 +0100468 return result;
469}
470
piotrd0bf1492014-02-05 17:27:32 +0100471double receiver_impl::compute_freq_offset(const gr_complex * input, unsigned first_sample, unsigned last_sample)
472{
473 double phase_sum = 0;
474 unsigned ii;
475
476 for (ii = first_sample; ii < last_sample; ii++)
piotr437f5462014-02-04 17:57:25 +0100477 {
piotr437f5462014-02-04 17:57:25 +0100478 double phase_diff = compute_phase_diff(input[ii], input[ii-1]) - (M_PI / 2) / d_OSR;
479 phase_sum += phase_diff;
piotr437f5462014-02-04 17:57:25 +0100480 }
481
piotrd0bf1492014-02-05 17:27:32 +0100482 double phase_offset = phase_sum / (last_sample - first_sample);
483 double freq_offset = phase_offset * 1625000.0 / (12.0 * M_PI);
484 return freq_offset;
485}
piotr437f5462014-02-04 17:57:25 +0100486
piotrd0bf1492014-02-05 17:27:32 +0100487void receiver_impl::set_frequency(double freq_offset)
488{
489 d_tuner->calleval(freq_offset);
490}
piotr437f5462014-02-04 17:57:25 +0100491
piotrd0bf1492014-02-05 17:27:32 +0100492inline float receiver_impl::compute_phase_diff(gr_complex val1, gr_complex val2)
493{
494 gr_complex conjprod = val1 * conj(val2);
495 return fast_atan2f(imag(conjprod), real(conjprod));
496}
piotr437f5462014-02-04 17:57:25 +0100497
piotrd0bf1492014-02-05 17:27:32 +0100498bool receiver_impl::reach_sch_burst(const int nitems)
499{
500 //it just consumes samples to get near to a SCH burst
501 int to_consume = 0;
502 bool result = false;
503 unsigned sample_nr_near_sch_start = d_fcch_start_pos + (FRAME_BITS - SAFETY_MARGIN) * d_OSR;
504
505 //consume samples until d_counter will be equal to sample_nr_near_sch_start
506 if (d_counter < sample_nr_near_sch_start)
507 {
508 if (d_counter + nitems >= sample_nr_near_sch_start)
509 {
510 to_consume = sample_nr_near_sch_start - d_counter;
511 }
512 else
513 {
514 to_consume = nitems;
piotr437f5462014-02-04 17:57:25 +0100515 }
516 result = false;
piotrd0bf1492014-02-05 17:27:32 +0100517 }
518 else
519 {
piotr437f5462014-02-04 17:57:25 +0100520 to_consume = 0;
521 result = true;
piotr437f5462014-02-04 17:57:25 +0100522 }
523
piotrd0bf1492014-02-05 17:27:32 +0100524 d_counter += to_consume;
525 consume_each(to_consume);
526 return result;
527}
528
529int receiver_impl::get_sch_chan_imp_resp(const gr_complex *input, gr_complex * chan_imp_resp)
530{
531 vector_complex correlation_buffer;
532 vector_float power_buffer;
533 vector_float window_energy_buffer;
534
535 int strongest_window_nr;
536 int burst_start = 0;
537 int chan_imp_resp_center = 0;
538 float max_correlation = 0;
539 float energy = 0;
540
541 for (int ii = SYNC_POS * d_OSR; ii < (SYNC_POS + SYNC_SEARCH_RANGE) *d_OSR; ii++)
piotr437f5462014-02-04 17:57:25 +0100542 {
piotr437f5462014-02-04 17:57:25 +0100543 gr_complex correlation = correlate_sequence(&d_sch_training_seq[5], N_SYNC_BITS - 10, &input[ii]);
544 correlation_buffer.push_back(correlation);
545 power_buffer.push_back(std::pow(abs(correlation), 2));
piotrd0bf1492014-02-05 17:27:32 +0100546 }
piotr437f5462014-02-04 17:57:25 +0100547
piotrd0bf1492014-02-05 17:27:32 +0100548 //compute window energies
549 vector_float::iterator iter = power_buffer.begin();
550 bool loop_end = false;
551 while (iter != power_buffer.end())
552 {
piotr437f5462014-02-04 17:57:25 +0100553 vector_float::iterator iter_ii = iter;
554 energy = 0;
555
piotrd0bf1492014-02-05 17:27:32 +0100556 for (int ii = 0; ii < (d_chan_imp_length) *d_OSR; ii++, iter_ii++)
557 {
558 if (iter_ii == power_buffer.end())
559 {
560 loop_end = true;
561 break;
562 }
563 energy += (*iter_ii);
piotr437f5462014-02-04 17:57:25 +0100564 }
piotrd0bf1492014-02-05 17:27:32 +0100565 if (loop_end)
566 {
567 break;
piotr437f5462014-02-04 17:57:25 +0100568 }
569 iter++;
570 window_energy_buffer.push_back(energy);
piotrd0bf1492014-02-05 17:27:32 +0100571 }
piotr437f5462014-02-04 17:57:25 +0100572
piotrd0bf1492014-02-05 17:27:32 +0100573 strongest_window_nr = max_element(window_energy_buffer.begin(), window_energy_buffer.end()) - window_energy_buffer.begin();
piotr437f5462014-02-04 17:57:25 +0100574 // d_channel_imp_resp.clear();
575
piotrd0bf1492014-02-05 17:27:32 +0100576 max_correlation = 0;
577 for (int ii = 0; ii < (d_chan_imp_length) *d_OSR; ii++)
578 {
piotr437f5462014-02-04 17:57:25 +0100579 gr_complex correlation = correlation_buffer[strongest_window_nr + ii];
piotrd0bf1492014-02-05 17:27:32 +0100580 if (abs(correlation) > max_correlation)
581 {
582 chan_imp_resp_center = ii;
583 max_correlation = abs(correlation);
piotr437f5462014-02-04 17:57:25 +0100584 }
piotrd0bf1492014-02-05 17:27:32 +0100585 // d_channel_imp_resp.push_back(correlation);
piotr437f5462014-02-04 17:57:25 +0100586 chan_imp_resp[ii] = correlation;
piotr437f5462014-02-04 17:57:25 +0100587 }
588
piotrd0bf1492014-02-05 17:27:32 +0100589 burst_start = strongest_window_nr + chan_imp_resp_center - 48 * d_OSR - 2 * d_OSR + 2 + SYNC_POS * d_OSR;
590 return burst_start;
591}
piotr437f5462014-02-04 17:57:25 +0100592
593
piotrd0bf1492014-02-05 17:27:32 +0100594
595void receiver_impl::detect_burst(const gr_complex * input, gr_complex * chan_imp_resp, int burst_start, unsigned char * output_binary)
596{
597 float output[BURST_SIZE];
598 gr_complex rhh_temp[CHAN_IMP_RESP_LENGTH*d_OSR];
599 gr_complex rhh[CHAN_IMP_RESP_LENGTH];
600 gr_complex filtered_burst[BURST_SIZE];
601 int start_state = 3;
602 unsigned int stop_states[2] = {4, 12};
603
604 autocorrelation(chan_imp_resp, rhh_temp, d_chan_imp_length*d_OSR);
605 for (int ii = 0; ii < (d_chan_imp_length); ii++)
piotr437f5462014-02-04 17:57:25 +0100606 {
piotr437f5462014-02-04 17:57:25 +0100607 rhh[ii] = conj(rhh_temp[ii*d_OSR]);
piotr437f5462014-02-04 17:57:25 +0100608 }
609
piotrd0bf1492014-02-05 17:27:32 +0100610 mafi(&input[burst_start], BURST_SIZE, chan_imp_resp, d_chan_imp_length*d_OSR, filtered_burst);
611
612 viterbi_detector(filtered_burst, BURST_SIZE, rhh, start_state, stop_states, 2, output);
613
614 for (int i = 0; i < BURST_SIZE ; i++)
piotr437f5462014-02-04 17:57:25 +0100615 {
piotrd0bf1492014-02-05 17:27:32 +0100616 output_binary[i] = (output[i] > 0);
617 }
618}
piotr437f5462014-02-04 17:57:25 +0100619
piotrd0bf1492014-02-05 17:27:32 +0100620//TODO consider placing this funtion in a separate class for signal processing
621void receiver_impl::gmsk_mapper(const unsigned char * input, int nitems, gr_complex * gmsk_output, gr_complex start_point)
622{
623 gr_complex j = gr_complex(0.0, 1.0);
piotr437f5462014-02-04 17:57:25 +0100624
piotrd0bf1492014-02-05 17:27:32 +0100625 int current_symbol;
626 int encoded_symbol;
627 int previous_symbol = 2 * input[0] - 1;
628 gmsk_output[0] = start_point;
629
630 for (int i = 1; i < nitems; i++)
631 {
piotr437f5462014-02-04 17:57:25 +0100632 //change bits representation to NRZ
633 current_symbol = 2 * input[i] - 1;
634 //differentially encode
635 encoded_symbol = current_symbol * previous_symbol;
636 //and do gmsk mapping
637 gmsk_output[i] = j * gr_complex(encoded_symbol, 0.0) * gmsk_output[i-1];
638 previous_symbol = current_symbol;
piotr437f5462014-02-04 17:57:25 +0100639 }
piotrd0bf1492014-02-05 17:27:32 +0100640}
piotr437f5462014-02-04 17:57:25 +0100641
piotrd0bf1492014-02-05 17:27:32 +0100642//TODO consider use of some generalized function for correlation and placing it in a separate class for signal processing
643gr_complex receiver_impl::correlate_sequence(const gr_complex * sequence, int length, const gr_complex * input)
644{
645 gr_complex result(0.0, 0.0);
646 int sample_number = 0;
647
648 for (int ii = 0; ii < length; ii++)
piotr437f5462014-02-04 17:57:25 +0100649 {
piotr437f5462014-02-04 17:57:25 +0100650 sample_number = (ii * d_OSR) ;
651 result += sequence[ii] * conj(input[sample_number]);
piotr437f5462014-02-04 17:57:25 +0100652 }
653
piotrd0bf1492014-02-05 17:27:32 +0100654 result = result / gr_complex(length, 0);
655 return result;
656}
657
658//computes autocorrelation for positive arguments
659//TODO consider placing this funtion in a separate class for signal processing
660inline void receiver_impl::autocorrelation(const gr_complex * input, gr_complex * out, int nitems)
661{
662 int i, k;
663 for (k = nitems - 1; k >= 0; k--)
piotr437f5462014-02-04 17:57:25 +0100664 {
piotr437f5462014-02-04 17:57:25 +0100665 out[k] = gr_complex(0, 0);
piotrd0bf1492014-02-05 17:27:32 +0100666 for (i = k; i < nitems; i++)
667 {
668 out[k] += input[i] * conj(input[i-k]);
piotr437f5462014-02-04 17:57:25 +0100669 }
piotr437f5462014-02-04 17:57:25 +0100670 }
piotrd0bf1492014-02-05 17:27:32 +0100671}
piotr437f5462014-02-04 17:57:25 +0100672
piotrd0bf1492014-02-05 17:27:32 +0100673//TODO consider use of some generalized function for filtering and placing it in a separate class for signal processing
674inline void receiver_impl::mafi(const gr_complex * input, int nitems, gr_complex * filter, int filter_length, gr_complex * output)
675{
676 int ii = 0, n, a;
677
678 for (n = 0; n < nitems; n++)
piotr437f5462014-02-04 17:57:25 +0100679 {
piotr437f5462014-02-04 17:57:25 +0100680 a = n * d_OSR;
681 output[n] = 0;
682 ii = 0;
683
piotrd0bf1492014-02-05 17:27:32 +0100684 while (ii < filter_length)
685 {
piotrda8a0662014-04-24 10:29:38 +0200686 if ((a + ii) >= nitems*d_OSR){
piotrd0bf1492014-02-05 17:27:32 +0100687 break;
piotrda8a0662014-04-24 10:29:38 +0200688 }
piotrd0bf1492014-02-05 17:27:32 +0100689 output[n] += input[a+ii] * filter[ii];
690 ii++;
piotr437f5462014-02-04 17:57:25 +0100691 }
piotr437f5462014-02-04 17:57:25 +0100692 }
piotrd0bf1492014-02-05 17:27:32 +0100693}
piotr437f5462014-02-04 17:57:25 +0100694
piotrd0bf1492014-02-05 17:27:32 +0100695//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 +0100696//especially computations of strongest_window_nr
piotr7e3b0db2014-02-05 22:44:30 +0100697int 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 +0100698{
699 vector_complex correlation_buffer;
700 vector_float power_buffer;
701 vector_float window_energy_buffer;
piotr437f5462014-02-04 17:57:25 +0100702
piotrd0bf1492014-02-05 17:27:32 +0100703 int strongest_window_nr;
704 int burst_start = 0;
705 int chan_imp_resp_center = 0;
706 float max_correlation = 0;
707 float energy = 0;
piotr5c820252014-04-17 09:43:02 +0200708
piotrd0bf1492014-02-05 17:27:32 +0100709 int search_center = (int)((TRAIN_POS + GUARD_PERIOD) * d_OSR);
piotr7c82b172014-02-08 14:15:27 +0100710 int search_start_pos = search_center + 1 - 5*d_OSR;
piotr437f5462014-02-04 17:57:25 +0100711 // int search_start_pos = search_center - d_chan_imp_length * d_OSR;
piotr5c820252014-04-17 09:43:02 +0200712 int search_stop_pos = search_center + d_chan_imp_length * d_OSR + 5 * d_OSR;
piotr437f5462014-02-04 17:57:25 +0100713
piotrd0bf1492014-02-05 17:27:32 +0100714 for (int ii = search_start_pos; ii < search_stop_pos; ii++)
715 {
piotr437f5462014-02-04 17:57:25 +0100716 gr_complex correlation = correlate_sequence(&d_norm_training_seq[bcc][TRAIN_BEGINNING], N_TRAIN_BITS - 10, &input[ii]);
717
718 correlation_buffer.push_back(correlation);
719 power_buffer.push_back(std::pow(abs(correlation), 2));
piotrd0bf1492014-02-05 17:27:32 +0100720 }
piotr437f5462014-02-04 17:57:25 +0100721
piotrd0bf1492014-02-05 17:27:32 +0100722 //compute window energies
723 vector_float::iterator iter = power_buffer.begin();
724 bool loop_end = false;
725 while (iter != power_buffer.end())
726 {
piotr437f5462014-02-04 17:57:25 +0100727 vector_float::iterator iter_ii = iter;
728 energy = 0;
729
piotrd0bf1492014-02-05 17:27:32 +0100730 for (int ii = 0; ii < (d_chan_imp_length - 2)*d_OSR; ii++, iter_ii++)
731 {
piotrd0bf1492014-02-05 17:27:32 +0100732 if (iter_ii == power_buffer.end())
733 {
734 loop_end = true;
735 break;
736 }
737 energy += (*iter_ii);
piotr437f5462014-02-04 17:57:25 +0100738 }
piotrd0bf1492014-02-05 17:27:32 +0100739 if (loop_end)
740 {
741 break;
piotr437f5462014-02-04 17:57:25 +0100742 }
743 iter++;
744
745 window_energy_buffer.push_back(energy);
piotrd0bf1492014-02-05 17:27:32 +0100746 }
piotr437f5462014-02-04 17:57:25 +0100747
piotr5c820252014-04-17 09:43:02 +0200748 strongest_window_nr = max_element(window_energy_buffer.begin(), window_energy_buffer.end()-((d_chan_imp_length)*d_OSR)) - window_energy_buffer.begin();
749 //strongest_window_nr = strongest_window_nr-d_OSR;
750 if(strongest_window_nr<0){
751 strongest_window_nr = 0;
752 }
piotr6d152d92014-02-21 00:02:44 +0100753
piotrd0bf1492014-02-05 17:27:32 +0100754 max_correlation = 0;
755 for (int ii = 0; ii < (d_chan_imp_length)*d_OSR; ii++)
756 {
piotr437f5462014-02-04 17:57:25 +0100757 gr_complex correlation = correlation_buffer[strongest_window_nr + ii];
piotrd0bf1492014-02-05 17:27:32 +0100758 if (abs(correlation) > max_correlation)
759 {
760 chan_imp_resp_center = ii;
761 max_correlation = abs(correlation);
piotr437f5462014-02-04 17:57:25 +0100762 }
piotrd0bf1492014-02-05 17:27:32 +0100763 // d_channel_imp_resp.push_back(correlation);
piotr437f5462014-02-04 17:57:25 +0100764 chan_imp_resp[ii] = correlation;
piotr437f5462014-02-04 17:57:25 +0100765 }
piotr7c82b172014-02-08 14:15:27 +0100766
piotr7e3b0db2014-02-05 22:44:30 +0100767 *corr_max = max_correlation;
piotrd0bf1492014-02-05 17:27:32 +0100768
piotr7c82b172014-02-08 14:15:27 +0100769 DCOUT("strongest_window_nr_new: " << strongest_window_nr);
piotrc7c249a2014-05-02 17:24:08 +0200770 burst_start = search_start_pos + strongest_window_nr - TRAIN_POS * d_OSR; //compute first sample posiiton which corresponds to the first sample of the impulse response
771 //TRAIN_POS=3+57+1+6
772 //TODO: describe this part in detail in documentation as this is crucial part for synchronization
piotr7c82b172014-02-08 14:15:27 +0100773
774 DCOUT("burst_start: " << burst_start);
piotrd0bf1492014-02-05 17:27:32 +0100775 return burst_start;
776}
piotr437f5462014-02-04 17:57:25 +0100777
778
piotr6d152d92014-02-21 00:02:44 +0100779void receiver_impl::send_burst(burst_counter burst_nr, const unsigned char * burst_binary, burst_type b_type)
piotrd0bf1492014-02-05 17:27:32 +0100780{
piotr7c82b172014-02-08 14:15:27 +0100781
piotr6d152d92014-02-21 00:02:44 +0100782 boost::scoped_ptr<gsmtap_hdr> tap_header(new gsmtap_hdr());
783
784 tap_header->version = GSMTAP_VERSION;
785 tap_header->hdr_len = BURST_SIZE/4;
786 tap_header->type = GSMTAP_TYPE_UM_BURST;
787 tap_header->timeslot = static_cast<uint8_t>(d_burst_nr.get_timeslot_nr());
788 tap_header->frame_number = d_burst_nr.get_frame_nr();
789 tap_header->sub_type = static_cast<uint8_t>(b_type);
790 tap_header->arfcn = d_arfcn;
791 tap_header->signal_dbm = static_cast<int8_t>(d_signal_dbm);
792 pmt::pmt_t header_blob=pmt::make_blob(tap_header.get(),sizeof(gsmtap_hdr));
793 pmt::pmt_t burst_binary_blob=pmt::make_blob(burst_binary,BURST_SIZE);
794 pmt::pmt_t msg = pmt::cons(header_blob, burst_binary_blob);
795
796 message_port_pub(pmt::mp("bursts"), msg);
piotrd0bf1492014-02-05 17:27:32 +0100797}
piotr6d152d92014-02-21 00:02:44 +0100798
piotrd0bf1492014-02-05 17:27:32 +0100799void receiver_impl::configure_receiver()
800{
piotrce92f982014-04-17 23:37:18 +0200801 d_channel_conf.set_multiframe_type(TIMESLOT0, multiframe_51);
piotrd0bf1492014-02-05 17:27:32 +0100802 d_channel_conf.set_burst_types(TIMESLOT0, TEST51, sizeof(TEST51) / sizeof(unsigned), dummy_or_normal);
piotr437f5462014-02-04 17:57:25 +0100803
piotrce92f982014-04-17 23:37:18 +0200804 d_channel_conf.set_burst_types(TIMESLOT0, TEST_CCH_FRAMES, sizeof(TEST_CCH_FRAMES) / sizeof(unsigned), dummy_or_normal);
805 d_channel_conf.set_burst_types(TIMESLOT0, FCCH_FRAMES, sizeof(FCCH_FRAMES) / sizeof(unsigned), fcch_burst);
806 d_channel_conf.set_burst_types(TIMESLOT0, SCH_FRAMES, sizeof(SCH_FRAMES) / sizeof(unsigned), sch_burst);
piotr437f5462014-02-04 17:57:25 +0100807
808 // d_channel_conf.set_multiframe_type(TIMESLOT1, multiframe_26);
809 // d_channel_conf.set_burst_types(TIMESLOT1, TRAFFIC_CHANNEL_F, sizeof(TRAFFIC_CHANNEL_F) / sizeof(unsigned), dummy_or_normal);
810 // d_channel_conf.set_multiframe_type(TIMESLOT2, multiframe_26);
811 // d_channel_conf.set_burst_types(TIMESLOT2, TRAFFIC_CHANNEL_F, sizeof(TRAFFIC_CHANNEL_F) / sizeof(unsigned), dummy_or_normal);
812 // d_channel_conf.set_multiframe_type(TIMESLOT3, multiframe_26);
813 // d_channel_conf.set_burst_types(TIMESLOT3, TRAFFIC_CHANNEL_F, sizeof(TRAFFIC_CHANNEL_F) / sizeof(unsigned), dummy_or_normal);
814 // d_channel_conf.set_multiframe_type(TIMESLOT4, multiframe_26);
815 // d_channel_conf.set_burst_types(TIMESLOT4, TRAFFIC_CHANNEL_F, sizeof(TRAFFIC_CHANNEL_F) / sizeof(unsigned), dummy_or_normal);
816 // d_channel_conf.set_multiframe_type(TIMESLOT5, multiframe_26);
817 // d_channel_conf.set_burst_types(TIMESLOT5, TRAFFIC_CHANNEL_F, sizeof(TRAFFIC_CHANNEL_F) / sizeof(unsigned), dummy_or_normal);
818 // d_channel_conf.set_multiframe_type(TIMESLOT6, multiframe_26);
819 // d_channel_conf.set_burst_types(TIMESLOT6, TRAFFIC_CHANNEL_F, sizeof(TRAFFIC_CHANNEL_F) / sizeof(unsigned), dummy_or_normal);
820 // d_channel_conf.set_multiframe_type(TIMESLOT7, multiframe_26);
821 // 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 +0100822
piotrd0bf1492014-02-05 17:27:32 +0100823 d_channel_conf.set_multiframe_type(TIMESLOT1, multiframe_51);
824 d_channel_conf.set_burst_types(TIMESLOT1, TEST51, sizeof(TEST51) / sizeof(unsigned), dummy_or_normal);
825 d_channel_conf.set_multiframe_type(TIMESLOT2, multiframe_51);
826 d_channel_conf.set_burst_types(TIMESLOT2, TEST51, sizeof(TEST51) / sizeof(unsigned), dummy_or_normal);
827 d_channel_conf.set_multiframe_type(TIMESLOT3, multiframe_51);
828 d_channel_conf.set_burst_types(TIMESLOT3, TEST51, sizeof(TEST51) / sizeof(unsigned), dummy_or_normal);
829 d_channel_conf.set_multiframe_type(TIMESLOT4, multiframe_51);
830 d_channel_conf.set_burst_types(TIMESLOT4, TEST51, sizeof(TEST51) / sizeof(unsigned), dummy_or_normal);
831 d_channel_conf.set_multiframe_type(TIMESLOT5, multiframe_51);
832 d_channel_conf.set_burst_types(TIMESLOT5, TEST51, sizeof(TEST51) / sizeof(unsigned), dummy_or_normal);
833 d_channel_conf.set_multiframe_type(TIMESLOT6, multiframe_51);
834 d_channel_conf.set_burst_types(TIMESLOT6, TEST51, sizeof(TEST51) / sizeof(unsigned), dummy_or_normal);
835 d_channel_conf.set_multiframe_type(TIMESLOT7, multiframe_51);
836 d_channel_conf.set_burst_types(TIMESLOT7, TEST51, sizeof(TEST51) / sizeof(unsigned), dummy_or_normal);
piotrd0bf1492014-02-05 17:27:32 +0100837}
piotr437f5462014-02-04 17:57:25 +0100838
839
piotrd0bf1492014-02-05 17:27:32 +0100840} /* namespace gsm */
piotr437f5462014-02-04 17:57:25 +0100841} /* namespace gr */
842