Compare commits

...

4 Commits

Author SHA1 Message Date
Vadim Yanitskiy cdd0c993d3 receiver: add public API for multiframe configuration
Change-Id: I3a4621852baad254f2bd626251fb7958492f0f32
2019-01-19 18:24:27 +07:00
Vadim Yanitskiy 588baff6b3 receiver: clarify receiver_impl.configure_receiver()
Change-Id: I98192f51c19162d6013607eb702314601fabf2c5
2019-01-19 16:44:36 +07:00
Vadim Yanitskiy 4f3fd6de7d receiver: add channel_configuration.reset_all()
Change-Id: I712f773a82d88fad77535821ce33ac54fbf52944
2019-01-19 16:38:02 +07:00
Vadim Yanitskiy c120422a24 receiver: use switch in multiframe_configuration.set_type()
Change-Id: I2d929bb2eac42beb8f9da9f7ed27fe41e09ab0b6
2019-01-19 16:37:55 +07:00
5 changed files with 118 additions and 5 deletions

View File

@ -29,6 +29,8 @@
#include <gnuradio/sync_block.h>
#include <vector>
#include <grgsm/gsm_constants.h>
namespace gr {
namespace gsm {
@ -55,6 +57,19 @@ namespace gr {
virtual void set_cell_allocation(const std::vector<int> &cell_allocation) = 0;
virtual void set_tseq_nums(const std::vector<int> & tseq_nums) = 0;
virtual void reset() = 0;
/* Reset multiframe configuration for all timeslots */
virtual void reset_mf_config(void) = 0;
/* Get multiframe type for a given timeslot */
virtual multiframe_type get_mf_type(int tn) = 0;
/* Set multiframe type for a given timeslot */
virtual void set_mf_type(int tn, multiframe_type type) = 0;
/* Get burst type for a given pair of timeslot and frame number */
virtual burst_type get_mf_burst_type(int tn, unsigned fn) = 0;
/* Set burst type for a given pair of timeslot and frame number */
virtual void set_mf_burst_type(int tn, unsigned fn, burst_type type) = 0;
/* Set burst type for every frame number within a given modulo */
virtual void set_mf_burst_type_mod(int tn, int mod, unsigned fn, burst_type type) = 0;
};
} // namespace gsm

View File

@ -41,13 +41,27 @@ class multiframe_configuration
~multiframe_configuration() {}
void set_type(multiframe_type type) {
if (type == multiframe_26) {
d_burst_types.resize(26);
} else {
switch (type) {
case multiframe_51:
d_burst_types.resize(51);
d_type = multiframe_51;
break;
case multiframe_26:
d_burst_types.resize(26);
d_type = multiframe_26;
break;
case unknown:
default:
d_burst_types.resize(0);
d_type = unknown;
break;
}
}
d_type = type;
void reset(void) {
fill(d_burst_types.begin(), d_burst_types.end(), empty);
d_burst_types.resize(0);
d_type = unknown;
}
void set_burst_type(int nr, burst_type type) {
@ -138,6 +152,10 @@ class channel_configuration
}
}
multiframe_type get_multiframe_type(int timeslot_nr) {
return d_timeslots_descriptions[timeslot_nr].get_type();
}
void set_multiframe_type(int timeslot_nr, multiframe_type type) {
d_timeslots_descriptions[timeslot_nr].set_type(type);
}
@ -149,10 +167,19 @@ class channel_configuration
}
}
burst_type get_single_burst_type(int timeslot_nr, int burst_nr) {
return d_timeslots_descriptions[timeslot_nr].get_burst_type(burst_nr);
}
void set_single_burst_type(int timeslot_nr, int burst_nr, burst_type b_type) {
d_timeslots_descriptions[timeslot_nr].set_burst_type(burst_nr, b_type);
}
void reset_all(void) {
for (int i = 0; i < TS_PER_FRAME; i++)
d_timeslots_descriptions[i].reset();
}
burst_type get_burst_type(burst_counter burst_nr);
};

View File

@ -1132,5 +1132,59 @@ namespace gr
{
d_state = fcch_search;
}
void
receiver_impl::reset_mf_config(void)
{
d_channel_conf.reset_all();
}
multiframe_type
receiver_impl::get_mf_type(int tn)
{
return d_channel_conf.get_multiframe_type(tn);
}
void
receiver_impl::set_mf_type(int tn, multiframe_type type)
{
d_channel_conf.set_multiframe_type(tn, type);
}
burst_type
receiver_impl::get_mf_burst_type(int tn, unsigned fn)
{
return d_channel_conf.get_single_burst_type(tn, fn);
}
void
receiver_impl::set_mf_burst_type(int tn, unsigned fn, burst_type type)
{
d_channel_conf.set_single_burst_type(tn, fn, type);
}
void
receiver_impl::set_mf_burst_type_mod(int tn, int mod, unsigned fn, burst_type type)
{
multiframe_type mf_type;
unsigned i, mf_len;
mf_type = d_channel_conf.get_multiframe_type(tn);
switch (mf_type) {
case multiframe_51:
mf_len = 51; break;
case multiframe_26:
mf_len = 26; break;
case unknown:
default:
mf_len = 0; break;
}
for (i = 0; i < mf_len; i++) {
if (i % mod == fn)
d_channel_conf.set_single_burst_type(tn, i, type);
}
}
} /* namespace gsm */
} /* namespace gr */

View File

@ -202,7 +202,9 @@ namespace gr {
void send_burst(burst_counter burst_nr, const unsigned char * burst_binary, uint8_t burst_type, size_t input_nr, unsigned int burst_start=-1);
/**
* Configures burst types in different channels
* Initializes default burst detection config for all timeslots:
* TS0 (MF51): FB + SB + NB / DB
* TS1-7 (MF51): NB / DB
*/
void configure_receiver();
@ -220,6 +222,19 @@ namespace gr {
virtual void set_cell_allocation(const std::vector<int> &cell_allocation);
virtual void set_tseq_nums(const std::vector<int> & tseq_nums);
virtual void reset();
/* Reset multiframe configuration for all timeslots */
virtual void reset_mf_config(void);
/* Get multiframe type for a given timeslot */
virtual multiframe_type get_mf_type(int tn);
/* Set multiframe type for a given timeslot */
virtual void set_mf_type(int tn, multiframe_type type);
/* Get burst type for a given pair of timeslot and frame number */
virtual burst_type get_mf_burst_type(int tn, unsigned fn);
/* Set burst type for a given pair of timeslot and frame number */
virtual void set_mf_burst_type(int tn, unsigned fn, burst_type type);
/* Set burst type for every frame number within a given modulo */
virtual void set_mf_burst_type_mod(int tn, int mod, unsigned fn, burst_type type);
};
} // namespace gsm
} // namespace gr

View File

@ -33,6 +33,7 @@
%{
#include "grgsm/constants.h"
#include "grgsm/gsm_constants.h"
#include "grgsm/receiver/receiver.h"
#include "grgsm/receiver/clock_offset_control.h"
#include "grgsm/receiver/cx_channel_hopper.h"
@ -80,6 +81,7 @@
%}
%include "constants.i"
%include "grgsm/gsm_constants.h"
%include "grgsm/receiver/receiver.h"
GR_SWIG_BLOCK_MAGIC2(gsm, receiver);