diff options
author | Piotr Krysik <ptrkrysik@gmail.com> | 2016-05-14 19:37:14 +0200 |
---|---|---|
committer | Piotr Krysik <ptrkrysik@gmail.com> | 2016-05-14 19:37:14 +0200 |
commit | 8630fac60ca3b1609725498348267e66602d2067 (patch) | |
tree | 7d275e2455ca3efa11e86f90a036d9ff859e5723 /lib/receiver/receiver_impl.cc | |
parent | cdff492ff7f318dc452b6270a4845b8df6d9e025 (diff) | |
parent | 5d6ae655574947444b713f1d34fab85167554b8c (diff) |
Merged uplink-decoding branch (with complete support for control channels decoding on uplink)
# Conflicts:
# examples
# lib/demapping/universal_ctrl_chans_demapper_impl.cc
# lib/receiver/receiver_impl.cc
Diffstat (limited to 'lib/receiver/receiver_impl.cc')
-rw-r--r-- | lib/receiver/receiver_impl.cc | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/lib/receiver/receiver_impl.cc b/lib/receiver/receiver_impl.cc index bd2b306..09a3703 100644 --- a/lib/receiver/receiver_impl.cc +++ b/lib/receiver/receiver_impl.cc @@ -52,20 +52,21 @@ namespace gr namespace gsm { receiver::sptr -receiver::make(int osr, const std::vector<int> &cell_allocation, const std::vector<int> &tseq_nums) +receiver::make(int osr, const std::vector<int> &cell_allocation, const std::vector<int> &tseq_nums, bool process_uplink) { return gnuradio::get_initial_sptr - (new receiver_impl(osr, cell_allocation, tseq_nums)); + (new receiver_impl(osr, cell_allocation, tseq_nums, process_uplink)); } /* * The private constructor */ -receiver_impl::receiver_impl(int osr, const std::vector<int> &cell_allocation, const std::vector<int> &tseq_nums) +receiver_impl::receiver_impl(int osr, const std::vector<int> &cell_allocation, const std::vector<int> &tseq_nums, bool process_uplink) : gr::sync_block("receiver", gr::io_signature::make(1, -1, sizeof(gr_complex)), gr::io_signature::make(0, 0, 0)), d_OSR(osr), + d_process_uplink(process_uplink), d_chan_imp_length(CHAN_IMP_RESP_LENGTH), d_counter(0), d_fcch_start_pos(0), @@ -172,7 +173,7 @@ receiver_impl::work(int noutput_items, { burst_start = get_sch_chan_imp_resp(input, &channel_imp_resp[0]); //get channel impulse response from it detect_burst(input, &channel_imp_resp[0], burst_start, output_binary); //detect bits using MLSE detection - if (decode_sch(&output_binary[3], &t1, &t2, &t3, &d_ncc, &d_bcc) == 0) //decode SCH burst + if (decode_sch(&output_binary[3], &t1, &t2, &t3, &d_ncc, &d_bcc) == 0) //decode SCH burst { d_burst_nr.set(t1, t2, t3, 0); //set counter of bursts value d_burst_nr++; @@ -198,10 +199,15 @@ receiver_impl::work(int noutput_items, int offset = 0; int to_consume = 0; unsigned char output_binary[BURST_SIZE]; - burst_type b_type; + unsigned int inputs_to_process=d_cell_allocation.size(); + + if(d_process_uplink) + { + inputs_to_process = 2*inputs_to_process; + } - for(int input_nr=0; input_nr<d_cell_allocation.size(); input_nr++) + for(int input_nr=0; input_nr<inputs_to_process; input_nr++) { double signal_pwr = 0; input = (gr_complex *)input_items[input_nr]; @@ -827,10 +833,21 @@ void receiver_impl::send_burst(burst_counter burst_nr, const unsigned char * bur tap_header->version = GSMTAP_VERSION; tap_header->hdr_len = sizeof(gsmtap_hdr)/4; tap_header->type = GSMTAP_TYPE_UM_BURST; - tap_header->timeslot = static_cast<uint8_t>(d_burst_nr.get_timeslot_nr()); - tap_header->frame_number = htobe32(d_burst_nr.get_frame_nr()); tap_header->sub_type = burst_type; - tap_header->arfcn = htobe16(d_cell_allocation[input_nr]) ; + bool uplink_burst = (input_nr >= d_cell_allocation.size()); + if(!uplink_burst) // downlink burst + { + tap_header->timeslot = static_cast<uint8_t>(d_burst_nr.get_timeslot_nr()); + tap_header->frame_number = htobe32(d_burst_nr.get_frame_nr()); + tap_header->arfcn = htobe16(d_cell_allocation[input_nr]) ; + } + else //uplink burst + { + tap_header->timeslot = static_cast<uint8_t>(d_burst_nr.subtract_timeslots(3).get_timeslot_nr()); + tap_header->frame_number = htobe32(d_burst_nr.subtract_timeslots(3).get_frame_nr()); + input_nr = input_nr - d_cell_allocation.size(); + tap_header->arfcn = htobe16(d_cell_allocation[input_nr] | 0x4000); + } tap_header->signal_dbm = static_cast<int8_t>(d_signal_dbm); tap_header->snr_db = 0; |