Changed control channels demappers in order to support uplink. Values of parameters for uplink are incorrect at this stage.

This commit is contained in:
Piotr Krysik 2015-08-06 10:23:52 +02:00
parent 7a85170a63
commit 9f723fd771
6 changed files with 285 additions and 101 deletions

View File

@ -3,7 +3,7 @@
<name>BCCH + CCCH demapper</name>
<key>gsm_bcch_ccch_demapper</key>
<import>import grgsm</import>
<make>grgsm.universal_ctrl_chans_demapper($timeslot_nr, $starts_fn_mod51, $channel_types)</make>
<make>grgsm.universal_ctrl_chans_demapper($timeslot_nr, $downlink_starts_fn_mod51, $downlink_channel_types, $uplink_starts_fn_mod51, $uplink_channel_types)</make>
<param>
<name>Timeslot</name>
@ -14,7 +14,7 @@
</param>
<param>
<name>starts_fn_mod51</name>
<name>downlink_starts_fn_mod51</name>
<key>starts_fn_mod51</key>
<value>[2,6,12,16,22,26,32,36,42,46]</value>
<type>int_vector</type>
@ -22,7 +22,23 @@
</param>
<param>
<name>channel_types</name>
<name>downlink_channel_types</name>
<key>channel_types</key>
<value>[1,2,2,2,2,2,2,2,2,2]</value>
<type>int_vector</type>
<hide>all</hide>
</param>
<param>
<name>uplink_starts_fn_mod51</name>
<key>starts_fn_mod51</key>
<value>[2,6,12,16,22,26,32,36,42,46]</value>
<type>int_vector</type>
<hide>all</hide>
</param>
<param>
<name>uplink_channel_types</name>
<key>channel_types</key>
<value>[1,2,2,2,2,2,2,2,2,2]</value>
<type>int_vector</type>

View File

@ -3,7 +3,7 @@
<name>BCCH + CCCH + SDCCH/4 demapper</name>
<key>gsm_bcch_ccch_sdcch4_demapper</key>
<import>import grgsm</import>
<make>grgsm.universal_ctrl_chans_demapper($timeslot_nr, $starts_fn_mod51, $channel_types)</make>
<make>grgsm.universal_ctrl_chans_demapper($timeslot_nr, $downlink_starts_fn_mod51, $downlink_channel_types, $uplink_starts_fn_mod51, $uplink_channel_types)</make>
<param>
<name>Timeslot</name>
@ -14,7 +14,7 @@
</param>
<param>
<name>starts_fn_mod51</name>
<name>downlink_starts_fn_mod51</name>
<key>starts_fn_mod51</key>
<value>[2,6,12,16,22,26,32,36,42,46]</value>
<type>int_vector</type>
@ -22,7 +22,23 @@
</param>
<param>
<name>channel_types</name>
<name>downlink_channel_types</name>
<key>channel_types</key>
<value>[1,2,2,2,7,7,7,7,135,135]</value>
<type>int_vector</type>
<hide>all</hide>
</param>
<param>
<name>uplink_starts_fn_mod51</name>
<key>starts_fn_mod51</key>
<value>[2,6,12,16,22,26,32,36,42,46]</value>
<type>int_vector</type>
<hide>all</hide>
</param>
<param>
<name>uplink_channel_types</name>
<key>channel_types</key>
<value>[1,2,2,2,7,7,7,7,135,135]</value>
<type>int_vector</type>

View File

@ -3,7 +3,7 @@
<name>SDCCH/8 demapper</name>
<key>gsm_sdcch8_demapper</key>
<import>import grgsm</import>
<make>grgsm.universal_ctrl_chans_demapper($timeslot_nr, $starts_fn_mod51, $channel_types)</make>
<make>grgsm.universal_ctrl_chans_demapper($timeslot_nr, $downlink_starts_fn_mod51, $downlink_channel_types, $uplink_starts_fn_mod51, $uplink_channel_types)</make>
<param>
<name>Timeslot</name>
@ -14,7 +14,7 @@
</param>
<param>
<name>starts_fn_mod51</name>
<name>downlink_starts_fn_mod51</name>
<key>starts_fn_mod51</key>
<value>[0,4,8,12,16,20,24,28,32,36,40,44]</value>
<type>int_vector</type>
@ -22,7 +22,23 @@
</param>
<param>
<name>channel_types</name>
<name>downlink_channel_types</name>
<key>channel_types</key>
<value>[8,8,8,8,8,8,8,8,136,136,136,136]</value>
<type>int_vector</type>
<hide>all</hide>
</param>
<param>
<name>uplink_starts_fn_mod51</name>
<key>starts_fn_mod51</key>
<value>[0,4,8,12,16,20,24,28,32,36,40,44]</value>
<type>int_vector</type>
<hide>all</hide>
</param>
<param>
<name>uplink_channel_types</name>
<key>channel_types</key>
<value>[8,8,8,8,8,8,8,8,136,136,136,136]</value>
<type>int_vector</type>
@ -42,4 +58,4 @@
Demapper for SDCCH/8 + SACCH/C8 control channels.
This corresponds to channel combination vii specified in GSM 05.02, section 6.4
</doc>
</block>
</block>

View File

@ -3,7 +3,7 @@
<name>Universal ctrl chans demapper</name>
<key>gsm_universal_ctrl_chans_demapper</key>
<import>import grgsm</import>
<make>grgsm.universal_ctrl_chans_demapper($timeslot_nr, $starts_fn_mod51, $channel_types)</make>
<make>grgsm.universal_ctrl_chans_demapper($timeslot_nr, $downlink_starts_fn_mod51, $downlink_channel_types, $uplink_starts_fn_mod51, $uplink_channel_types)</make>
<param>
<name>timeslot_nr</name>
@ -14,16 +14,32 @@
</param>
<param>
<name>starts_fn_mod51</name>
<key>starts_fn_mod51</key>
<name>downlink_starts_fn_mod51</name>
<key>downlink_starts_fn_mod51</key>
<value>[2,6,12,16,22,26,32,36,42,46]</value>
<type>int_vector</type>
<hide>part</hide>
</param>
<param>
<name>channel_types</name>
<key>channel_types</key>
<name>downlink_channel_types</name>
<key>downlink_channel_types</key>
<value>[1,2,2,2,2,2,2,2,2,2]</value>
<type>int_vector</type>
<hide>part</hide>
</param>
<param>
<name>uplink_starts_fn_mod51</name>
<key>uplink_starts_fn_mod51</key>
<value>[2,6,12,16,22,26,32,36,42,46]</value>
<type>int_vector</type>
<hide>part</hide>
</param>
<param>
<name>uplink_channel_types</name>
<key>uplink_channel_types</key>
<value>[1,2,2,2,2,2,2,2,2,2]</value>
<type>int_vector</type>
<hide>part</hide>
@ -37,4 +53,7 @@
<name>bursts</name>
<type>message</type>
</source>
<doc>
Universal demapper for control channels.
</doc>
</block>

View File

@ -34,16 +34,16 @@ namespace gr {
namespace gsm {
universal_ctrl_chans_demapper::sptr
universal_ctrl_chans_demapper::make(unsigned int timeslot_nr, const std::vector<int> &starts_fn_mod51, const std::vector<int> &channel_types)
universal_ctrl_chans_demapper::make(unsigned int timeslot_nr, const std::vector<int> &downlink_starts_fn_mod51, const std::vector<int> &downlink_channel_types, const std::vector<int> &uplink_starts_fn_mod51, const std::vector<int> &uplink_channel_types)
{
return gnuradio::get_initial_sptr
(new universal_ctrl_chans_demapper_impl(timeslot_nr, starts_fn_mod51, channel_types));
(new universal_ctrl_chans_demapper_impl(timeslot_nr, downlink_starts_fn_mod51, downlink_channel_types, uplink_starts_fn_mod51, uplink_channel_types));
}
/*
* The private constructor
*/
universal_ctrl_chans_demapper_impl::universal_ctrl_chans_demapper_impl(unsigned int timeslot_nr, const std::vector<int> &starts_fn_mod51, const std::vector<int> &channel_types)
universal_ctrl_chans_demapper_impl::universal_ctrl_chans_demapper_impl(unsigned int timeslot_nr, const std::vector<int> &downlink_starts_fn_mod51, const std::vector<int> &downlink_channel_types, const std::vector<int> &uplink_starts_fn_mod51, const std::vector<int> &uplink_channel_types)
: gr::block("universal_ctrl_chans_demapper",
gr::io_signature::make(0, 0, 0),
gr::io_signature::make(0, 0, 0)),
@ -54,75 +54,137 @@ namespace gr {
for(int ii=0; ii<51; ii++)
{
d_starts_fn_mod51[ii]=0;
d_channel_types[ii]=0;
d_subslots[ii] = 0;
d_subslots[ii+51] = 0;
d_downlink_starts_fn_mod51[ii]=0;
d_downlink_channel_types[ii]=0;
d_downlink_subslots[ii] = 0;
d_downlink_subslots[ii+51] = 0;
d_uplink_starts_fn_mod51[ii]=0;
d_uplink_channel_types[ii]=0;
d_uplink_subslots[ii] = 0;
d_uplink_subslots[ii+51] = 0;
}
std::vector<int>::const_iterator s;
std::vector<int>::const_iterator ch_type;
for(s=starts_fn_mod51.begin(), ch_type=channel_types.begin();s != starts_fn_mod51.end(); s++)
for(s=downlink_starts_fn_mod51.begin(), ch_type=downlink_channel_types.begin();s != downlink_starts_fn_mod51.end(); s++)
{
if((*s >= 0) and (*s <= (51-4)))
{
for(int ii=0; ii<4; ii++){
d_starts_fn_mod51[*s+ii] = *s;
if(ch_type!=channel_types.end())
d_downlink_starts_fn_mod51[*s+ii] = *s;
if(ch_type!=downlink_channel_types.end())
{
d_channel_types[*s+ii] = *ch_type;
d_downlink_channel_types[*s+ii] = *ch_type;
}
}
if(ch_type!=channel_types.end())
if(ch_type!=downlink_channel_types.end())
{
ch_type++;
}
}
}
std::set<int> distinct_channels(channel_types.begin(), channel_types.end());
std::set<int>::iterator it;
unsigned int subslot;
for (it=distinct_channels.begin(); it != distinct_channels.end(); it++)
{
subslot = 0;
for(s=starts_fn_mod51.begin();s != starts_fn_mod51.end(); s++)
{
if ((d_channel_types[*s] == *it) and (*s >= 0) and (*s <= (51-4)))
{
for(int ii=0; ii<4; ii++)
{
d_subslots[*s+ii] = subslot;
d_subslots[*s+ii+51] = subslot;
}
subslot++;
}
}
if (*it == GSMTAP_CHANNEL_ACCH or
*it == (GSMTAP_CHANNEL_ACCH|GSMTAP_CHANNEL_SDCCH) or
*it == (GSMTAP_CHANNEL_ACCH|GSMTAP_CHANNEL_SDCCH4) or
*it == (GSMTAP_CHANNEL_ACCH|GSMTAP_CHANNEL_SDCCH8) or
*it == (GSMTAP_CHANNEL_ACCH|GSMTAP_CHANNEL_TCH_F) or
*it == (GSMTAP_CHANNEL_ACCH|GSMTAP_CHANNEL_TCH_H)
)
{
for(s=starts_fn_mod51.begin();s != starts_fn_mod51.end(); s++)
{
if ((d_channel_types[*s] == *it) and (*s >= 0) and (*s <= (51-4)))
{
for(int ii=0; ii<4; ii++)
{
d_subslots[*s+ii+51] = subslot;
}
subslot++;
}
}
}
}
for(s=uplink_starts_fn_mod51.begin(), ch_type=uplink_channel_types.begin();s != uplink_starts_fn_mod51.end(); s++)
{
if((*s >= 0) and (*s <= (51-4)))
{
for(int ii=0; ii<4; ii++){
d_uplink_starts_fn_mod51[*s+ii] = *s;
if(ch_type!=uplink_channel_types.end())
{
d_uplink_channel_types[*s+ii] = *ch_type;
}
}
if(ch_type!=uplink_channel_types.end())
{
ch_type++;
}
}
}
std::set<int> distinct_downlink_channels(downlink_channel_types.begin(), downlink_channel_types.end());
std::set<int>::iterator it;
unsigned int subslot;
for (it=distinct_downlink_channels.begin(); it != distinct_downlink_channels.end(); it++)
{
subslot = 0;
for(s=downlink_starts_fn_mod51.begin();s != downlink_starts_fn_mod51.end(); s++)
{
if ((d_downlink_channel_types[*s] == *it) and (*s >= 0) and (*s <= (51-4)))
{
for(int ii=0; ii<4; ii++)
{
d_downlink_subslots[*s+ii] = subslot;
d_downlink_subslots[*s+ii+51] = subslot;
}
subslot++;
}
}
if (*it == GSMTAP_CHANNEL_ACCH or
*it == (GSMTAP_CHANNEL_ACCH|GSMTAP_CHANNEL_SDCCH) or
*it == (GSMTAP_CHANNEL_ACCH|GSMTAP_CHANNEL_SDCCH4) or
*it == (GSMTAP_CHANNEL_ACCH|GSMTAP_CHANNEL_SDCCH8) or
*it == (GSMTAP_CHANNEL_ACCH|GSMTAP_CHANNEL_TCH_F) or
*it == (GSMTAP_CHANNEL_ACCH|GSMTAP_CHANNEL_TCH_H)
)
{
for(s=downlink_starts_fn_mod51.begin();s != downlink_starts_fn_mod51.end(); s++)
{
if ((d_downlink_channel_types[*s] == *it) and (*s >= 0) and (*s <= (51-4)))
{
for(int ii=0; ii<4; ii++)
{
d_downlink_subslots[*s+ii+51] = subslot;
}
subslot++;
}
}
}
}
std::set<int> distinct_uplink_channels(uplink_channel_types.begin(), uplink_channel_types.end());
for (it=distinct_uplink_channels.begin(); it != distinct_uplink_channels.end(); it++)
{
subslot = 0;
for(s=uplink_starts_fn_mod51.begin();s != uplink_starts_fn_mod51.end(); s++)
{
if ((d_uplink_channel_types[*s] == *it) and (*s >= 0) and (*s <= (51-4)))
{
for(int ii=0; ii<4; ii++)
{
d_uplink_subslots[*s+ii] = subslot;
d_uplink_subslots[*s+ii+51] = subslot;
}
subslot++;
}
}
if (*it == GSMTAP_CHANNEL_ACCH or
*it == (GSMTAP_CHANNEL_ACCH|GSMTAP_CHANNEL_SDCCH) or
*it == (GSMTAP_CHANNEL_ACCH|GSMTAP_CHANNEL_SDCCH4) or
*it == (GSMTAP_CHANNEL_ACCH|GSMTAP_CHANNEL_SDCCH8) or
*it == (GSMTAP_CHANNEL_ACCH|GSMTAP_CHANNEL_TCH_F) or
*it == (GSMTAP_CHANNEL_ACCH|GSMTAP_CHANNEL_TCH_H)
)
{
for(s=uplink_starts_fn_mod51.begin();s != uplink_starts_fn_mod51.end(); s++)
{
if ((d_uplink_channel_types[*s] == *it) and (*s >= 0) and (*s <= (51-4)))
{
for(int ii=0; ii<4; ii++)
{
d_uplink_subslots[*s+ii+51] = subslot;
}
subslot++;
}
}
}
}
message_port_register_in(pmt::mp("bursts"));
set_msg_handler(pmt::mp("bursts"), boost::bind(&universal_ctrl_chans_demapper_impl::filter_ctrl_chans, this, _1));
@ -143,41 +205,91 @@ namespace gr {
uint32_t frame_nr = be32toh(header->frame_number);
uint32_t fn_mod51 = frame_nr % 51;
uint32_t fn51_start = d_starts_fn_mod51[fn_mod51];
uint32_t fn51_stop = fn51_start + 3;
uint32_t ch_type = d_channel_types[fn_mod51];
bool uplink_burst = (be16toh(header->arfcn) & 0x4000) ? true : false;
if(header->timeslot==d_timeslot){
header->sub_type = ch_type;
header->sub_slot = d_subslots[fn_mod51 + (51 * (frame_nr % 2))];
if(fn_mod51>=fn51_start && fn_mod51<=fn51_stop)
if(uplink_burst)
{
uint32_t ii = fn_mod51 - fn51_start;
d_frame_numbers[ii] = frame_nr;
d_bursts[ii] = msg;
}
if(fn_mod51==fn51_stop)
{
//check for a situation where some bursts were lost
//in this situation frame numbers won't be consecutive
bool frames_are_consecutive = true;
for(int jj=1; jj<4; jj++)
uint32_t fn51_start = d_uplink_starts_fn_mod51[fn_mod51];
uint32_t fn51_stop = fn51_start + 3;
uint32_t ch_type = d_uplink_channel_types[fn_mod51];
if(ch_type != 0)
{
if((d_frame_numbers[jj]-d_frame_numbers[jj-1])!=1)
{
frames_are_consecutive = false;
}
header->sub_type = ch_type;
}
if(frames_are_consecutive)
header->sub_slot = d_uplink_subslots[fn_mod51 + (51 * (frame_nr % 2))];
if(fn_mod51>=fn51_start && fn_mod51<=fn51_stop)
{
//send bursts to the output
for(int jj=0; jj<4; jj++)
uint32_t ii = fn_mod51 - fn51_start;
d_uplink_frame_numbers[ii] = frame_nr;
d_uplink_bursts[ii] = msg;
}
if(fn_mod51==fn51_stop)
{
//check for a situation where some bursts were lost
//in this situation frame numbers won't be consecutive
bool frames_are_consecutive = true;
for(int jj=1; jj<4; jj++)
{
message_port_pub(pmt::mp("bursts"), d_bursts[jj]);
if((d_uplink_frame_numbers[jj]-d_uplink_frame_numbers[jj-1])!=1)
{
frames_are_consecutive = false;
}
}
}
if(frames_are_consecutive)
{
//send bursts to the output
for(int jj=0; jj<4; jj++)
{
message_port_pub(pmt::mp("bursts"), d_uplink_bursts[jj]);
}
}
}
}
else
{
uint32_t fn51_start = d_downlink_starts_fn_mod51[fn_mod51];
uint32_t fn51_stop = fn51_start + 3;
uint32_t ch_type = d_downlink_channel_types[fn_mod51];
if(ch_type != 0)
{
header->sub_type = ch_type;
}
header->sub_slot = d_downlink_subslots[fn_mod51 + (51 * (frame_nr % 2))];
if(fn_mod51>=fn51_start && fn_mod51<=fn51_stop)
{
uint32_t ii = fn_mod51 - fn51_start;
d_downlink_frame_numbers[ii] = frame_nr;
d_downlink_bursts[ii] = msg;
}
if(fn_mod51==fn51_stop)
{
//check for a situation where some bursts were lost
//in this situation frame numbers won't be consecutive
bool frames_are_consecutive = true;
for(int jj=1; jj<4; jj++)
{
if((d_downlink_frame_numbers[jj]-d_downlink_frame_numbers[jj-1])!=1)
{
frames_are_consecutive = false;
}
}
if(frames_are_consecutive)
{
//send bursts to the output
for(int jj=0; jj<4; jj++)
{
message_port_pub(pmt::mp("bursts"), d_downlink_bursts[jj]);
}
}
}
}
}
}

View File

@ -32,14 +32,19 @@ namespace gr {
class universal_ctrl_chans_demapper_impl : public universal_ctrl_chans_demapper
{
private:
unsigned int d_starts_fn_mod51[51];
unsigned int d_channel_types[51];
unsigned int d_subslots[102];
unsigned int d_downlink_starts_fn_mod51[51];
unsigned int d_uplink_starts_fn_mod51[51];
unsigned int d_downlink_channel_types[51];
unsigned int d_uplink_channel_types[51];
unsigned int d_downlink_subslots[102];
unsigned int d_uplink_subslots[102];
unsigned int d_timeslot;
uint32_t d_frame_numbers[4];
pmt::pmt_t d_bursts[4];
uint32_t d_downlink_frame_numbers[4];
uint32_t d_uplink_frame_numbers[4];
pmt::pmt_t d_downlink_bursts[4];
pmt::pmt_t d_uplink_bursts[4];
public:
universal_ctrl_chans_demapper_impl(unsigned int timeslot_nr, const std::vector<int> &starts_fn_mod51, const std::vector<int> &channel_types);
universal_ctrl_chans_demapper_impl(unsigned int timeslot_nr, const std::vector<int> &downlink_starts_fn_mod51, const std::vector<int> &downlink_channel_types, const std::vector<int> &uplink_starts_fn_mod51, const std::vector<int> &uplink_channel_types);
~universal_ctrl_chans_demapper_impl();
void filter_ctrl_chans(pmt::pmt_t msg);