receiver: add public API for multiframe configuration

Change-Id: I3a4621852baad254f2bd626251fb7958492f0f32
This commit is contained in:
Vadim Yanitskiy 2019-01-19 16:52:20 +07:00
parent 588baff6b3
commit cdd0c993d3
5 changed files with 99 additions and 1 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

@ -58,6 +58,12 @@ class multiframe_configuration
}
}
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) {
d_burst_types[nr] = type;
}
@ -146,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);
}
@ -157,13 +167,17 @@ 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++)
set_multiframe_type(i, unknown);
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

@ -222,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);