From 773a194c327c89161b3d11e5246dfea04d9b45dc Mon Sep 17 00:00:00 2001 From: Piotr Krysik Date: Fri, 20 May 2016 12:45:54 +0200 Subject: Big change of the universal control channels demapper: -simplification of the universal demapper, -addition of hierarhical blocks for each of the demappers - so they also look well and readable in python, -addition of helper script for compilation of the demappers. --- apps/grgsm_decode | 12 +- apps/grgsm_livemon | 4 +- apps/grgsm_scanner | 2 +- grc/demapping/gsm_bcch_ccch_demapper.xml | 59 +--- grc/demapping/gsm_bcch_ccch_sdcch4_demapper.xml | 60 +---- grc/demapping/gsm_sdcch8_demapper.xml | 57 +--- .../gsm_universal_ctrl_chans_demapper.xml | 27 +- hier_blocks/compile_demappers | 37 +++ hier_blocks/demapping/gsm_bcch_ccch_demapper.grc | 292 ++++++++++++++++++++ .../demapping/gsm_bcch_ccch_sdcch4_demapper.grc | 292 ++++++++++++++++++++ hier_blocks/demapping/gsm_sdcch8_demapper.grc | 292 ++++++++++++++++++++ .../demapping/universal_ctrl_chans_demapper.h | 2 +- .../universal_ctrl_chans_demapper_impl.cc | 300 ++++++--------------- lib/demapping/universal_ctrl_chans_demapper_impl.h | 31 ++- python/CMakeLists.txt | 3 + python/__init__.py | 3 + python/demapping/gsm_bcch_ccch_demapper.py | 46 ++++ python/demapping/gsm_bcch_ccch_sdcch4_demapper.py | 46 ++++ python/demapping/gsm_sdcch8_demapper.py | 46 ++++ 19 files changed, 1223 insertions(+), 388 deletions(-) create mode 100755 hier_blocks/compile_demappers create mode 100644 hier_blocks/demapping/gsm_bcch_ccch_demapper.grc create mode 100644 hier_blocks/demapping/gsm_bcch_ccch_sdcch4_demapper.grc create mode 100644 hier_blocks/demapping/gsm_sdcch8_demapper.grc create mode 100644 python/demapping/gsm_bcch_ccch_demapper.py create mode 100644 python/demapping/gsm_bcch_ccch_sdcch4_demapper.py create mode 100644 python/demapping/gsm_sdcch8_demapper.py diff --git a/apps/grgsm_decode b/apps/grgsm_decode index 4be199d..8f412bf 100755 --- a/apps/grgsm_decode +++ b/apps/grgsm_decode @@ -88,17 +88,11 @@ class grgsm_decoder(gr.top_block): self.subslot_filter = grgsm.burst_sdcch_subslot_filter(grgsm.SS_FILTER_SDCCH8, self.subslot) if self.chan_mode == 'BCCH': - self.bcch_demapper = grgsm.universal_ctrl_chans_demapper(self.timeslot, - ([2, 6, 12, 16, 22, 26, 32, 36, 42, 46]), - ([1, 2, 2, 2, 2, 2, 2, 2, 2, 2])) + self.bcch_demapper = grgsm.gsm_bcch_ccch_demapper(self.timeslot) elif self.chan_mode == 'BCCH_SDCCH4': - self.bcch_sdcch4_demapper = grgsm.universal_ctrl_chans_demapper(self.timeslot, - ([2, 6, 12, 16, 22, 26, 32, 36, 42, 46]), - ([1, 2, 2, 2, 7, 7, 7, 7, 135, 135])) + self.bcch_sdcch4_demapper = grgsm.gsm_bcch_ccch_sdcch4_demapper(self.timeslot) elif self.chan_mode == 'SDCCH8': - self.sdcch8_demapper = grgsm.universal_ctrl_chans_demapper(self.timeslot, - ([0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44]), - ([8, 8, 8, 8, 8, 8, 8, 8, 136, 136, 136, 136])) + self.sdcch8_demapper = grgsm.gsm_sdcch8_demapper(self.timeslot) elif self.chan_mode == 'TCHF': self.tch_f_demapper = grgsm.tch_f_chans_demapper(self.timeslot) self.tch_f_decoder = grgsm.tch_f_decoder(speech_codec, speech_file) diff --git a/apps/grgsm_livemon b/apps/grgsm_livemon index 6c58e08..1d37970 100755 --- a/apps/grgsm_livemon +++ b/apps/grgsm_livemon @@ -140,7 +140,7 @@ class grgsm_livemon(gr.top_block, Qt.QWidget): self._qtgui_freq_sink_x_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_freq_sink_x_0_win) - self.gsm_sdcch8_demapper_0 = grgsm.universal_ctrl_chans_demapper(1, ([0,4,8,12,16,20,24,28,32,36,40,44]), ([8,8,8,8,8,8,8,8,136,136,136,136])) + self.gsm_sdcch8_demapper_0 = grgsm.gsm_sdcch8_demapper(1) self.gsm_receiver_0 = grgsm.receiver(4, ([0]), ([])) self.gsm_message_printer_1 = grgsm.message_printer(pmt.intern(""), False) self.gsm_input_0 = grgsm.gsm_input( @@ -153,7 +153,7 @@ class grgsm_livemon(gr.top_block, Qt.QWidget): self.gsm_control_channels_decoder_0_0 = grgsm.control_channels_decoder() self.gsm_control_channels_decoder_0 = grgsm.control_channels_decoder() self.gsm_clock_offset_control_0 = grgsm.clock_offset_control(fc-shiftoff) - self.gsm_bcch_ccch_demapper_0 = grgsm.universal_ctrl_chans_demapper(0, ([2,6,12,16,22,26,32,36,42,46]), ([1,2,2,2,2,2,2,2,2,2])) + self.gsm_bcch_ccch_demapper_0 = grgsm.gsm_bcch_ccch_demapper(0) self.blocks_socket_pdu_0_0 = blocks.socket_pdu("UDP_SERVER", "127.0.0.1", "4729", 10000) self.blocks_socket_pdu_0 = blocks.socket_pdu("UDP_CLIENT", "127.0.0.1", "4729", 10000) self.blocks_rotator_cc_0 = blocks.rotator_cc(-2*pi*shiftoff/samp_rate) diff --git a/apps/grgsm_scanner b/apps/grgsm_scanner index 94bba43..ebfdb7a 100755 --- a/apps/grgsm_scanner +++ b/apps/grgsm_scanner @@ -77,7 +77,7 @@ class receiver_with_decoder(grgsm.hier_block): ) self.gsm_control_channels_decoder_0 = grgsm.control_channels_decoder() self.gsm_clock_offset_control_0 = grgsm.clock_offset_control(fc) - self.gsm_bcch_ccch_demapper_0 = grgsm.universal_ctrl_chans_demapper(0, ([2,6,12,16,22,26,32,36,42,46]), ([1,2,2,2,2,2,2,2,2,2])) + self.gsm_bcch_ccch_demapper_0 = grgsm.gsm_bcch_ccch_demapper(0) ################################################## # Connections diff --git a/grc/demapping/gsm_bcch_ccch_demapper.xml b/grc/demapping/gsm_bcch_ccch_demapper.xml index b295ce1..ff392f1 100644 --- a/grc/demapping/gsm_bcch_ccch_demapper.xml +++ b/grc/demapping/gsm_bcch_ccch_demapper.xml @@ -1,61 +1,30 @@ - BCCH + CCCH demapper gsm_bcch_ccch_demapper + import grgsm - grgsm.universal_ctrl_chans_demapper($timeslot_nr, $downlink_starts_fn_mod51, $downlink_channel_types, $uplink_starts_fn_mod51, $uplink_channel_types) - + grgsm.gsm_bcch_ccch_demapper( + timeslot_nr=$timeslot_nr, +) + set_timeslot_nr($timeslot_nr) - Timeslot + timeslot_nr timeslot_nr 0 - int - none + raw - - - downlink_starts_fn_mod51 - downlink_starts_fn_mod51 - [2,6,12,16,22,26,32,36,42,46] - int_vector - all - - - - downlink_channel_types - downlink_channel_types - [1,2,2,2,2,2,2,2,2,2] - int_vector - all - - - - uplink_starts_fn_mod51 - uplink_starts_fn_mod51 - [] - int_vector - all - - - - uplink_channel_types - uplink_channel_types - [] - int_vector - all - - bursts message + 1 bursts message + 1 - - - Demapper for BCCH + CCCH control channels. - This corresponds to channel combination iv specified in GSM 05.02, section 6.4 - - + Piotr Krysik +Demapper for BCCH + CCCH control channels. This corresponds to channel combination iv specified in GSM 05.02, section 6.4 + + gr-gsm/hier_blocks/demapping/gsm_bcch_ccch_demapper.grc + diff --git a/grc/demapping/gsm_bcch_ccch_sdcch4_demapper.xml b/grc/demapping/gsm_bcch_ccch_sdcch4_demapper.xml index 90b33ce..94a433e 100644 --- a/grc/demapping/gsm_bcch_ccch_sdcch4_demapper.xml +++ b/grc/demapping/gsm_bcch_ccch_sdcch4_demapper.xml @@ -1,62 +1,30 @@ - BCCH + CCCH + SDCCH/4 demapper gsm_bcch_ccch_sdcch4_demapper + import grgsm - grgsm.universal_ctrl_chans_demapper($timeslot_nr, $downlink_starts_fn_mod51, $downlink_channel_types, $uplink_starts_fn_mod51, $uplink_channel_types) - + grgsm.gsm_bcch_ccch_sdcch4_demapper( + timeslot_nr=$timeslot_nr, +) + set_timeslot_nr($timeslot_nr) - Timeslot + timeslot_nr timeslot_nr 0 - int - none + raw - - - downlink_starts_fn_mod51 - downlink_starts_fn_mod51 - [2,6,12,16,22,26,32,36,42,46] - int_vector - all - - - - downlink_channel_types - downlink_channel_types - [1,2,2,2,7,7,7,7,135,135] - int_vector - all - - - - uplink_starts_fn_mod51 - uplink_starts_fn_mod51 - [0,6,10,37,41,47] - int_vector - all - - - - uplink_channel_types - uplink_channel_types - [7,135,135,7,7,7] - int_vector - all - - bursts message + 1 bursts message + 1 - - - Demapper for BCCH + CCCH + SDCCH/4 + SACCH/C4 control channels. - This corresponds to channel combination v specified in GSM 05.02, section 6.4 - - - + Piotr Krysik +Demapper for BCCH + CCCH + SDCCH/4 + SACCH/C4 control channels. This corresponds to channel combination v specified in GSM 05.02, section 6.4 + + gr-gsm/hier_blocks/demapping/gsm_bcch_ccch_sdcch4_demapper.grc + diff --git a/grc/demapping/gsm_sdcch8_demapper.xml b/grc/demapping/gsm_sdcch8_demapper.xml index c81032a..7507065 100644 --- a/grc/demapping/gsm_sdcch8_demapper.xml +++ b/grc/demapping/gsm_sdcch8_demapper.xml @@ -1,61 +1,30 @@ - SDCCH/8 demapper gsm_sdcch8_demapper + import grgsm - grgsm.universal_ctrl_chans_demapper($timeslot_nr, $downlink_starts_fn_mod51, $downlink_channel_types, $uplink_starts_fn_mod51, $uplink_channel_types) - + grgsm.gsm_sdcch8_demapper( + timeslot_nr=$timeslot_nr, +) + set_timeslot_nr($timeslot_nr) - Timeslot + timeslot_nr timeslot_nr 1 - int - none + raw - - - downlink_starts_fn_mod51 - downlink_starts_fn_mod51 - [0,4,8,12,16,20,24,28,32,36,40,44] - int_vector - all - - - - downlink_channel_types - downlink_channel_types - [8,8,8,8,8,8,8,8,136,136,136,136] - int_vector - all - - - - uplink_starts_fn_mod51 - uplink_starts_fn_mod51 - [15,19,23,27,31,35,39,43,47,0,4,8] - int_vector - all - - - - uplink_channel_types - uplink_channel_types - [8,8,8,8,8,8,8,8,136,136,136,136] - int_vector - all - - bursts message + 1 bursts message + 1 - - - Demapper for SDCCH/8 + SACCH/C8 control channels. - This corresponds to channel combination vii specified in GSM 05.02, section 6.4 - + Piotr Krysik +Demapper for SDCCH/8 + SACCH/C8 control channels. This corresponds to channel combination vii specified in GSM 05.02, section 6.4 + + gr-gsm/hier_blocks/demapping/gsm_sdcch8_demapper.grc diff --git a/grc/demapping/gsm_universal_ctrl_chans_demapper.xml b/grc/demapping/gsm_universal_ctrl_chans_demapper.xml index 3b522be..f173752 100644 --- a/grc/demapping/gsm_universal_ctrl_chans_demapper.xml +++ b/grc/demapping/gsm_universal_ctrl_chans_demapper.xml @@ -3,7 +3,7 @@ Universal ctrl chans demapper gsm_universal_ctrl_chans_demapper import grgsm - grgsm.universal_ctrl_chans_demapper($timeslot_nr, $downlink_starts_fn_mod51, $downlink_channel_types, $uplink_starts_fn_mod51, $uplink_channel_types) + grgsm.universal_ctrl_chans_demapper($timeslot_nr, $downlink_starts_fn_mod51, $downlink_channel_types, $downlink_subslots, $uplink_starts_fn_mod51, $uplink_channel_types, $uplink_subslots) timeslot_nr @@ -16,7 +16,7 @@ downlink_starts_fn_mod51 downlink_starts_fn_mod51 - [2,6,12,16,22,26,32,36,42,46] + [0,0,2,2,2,2,6,6,6,6,0,0,12,12,12,12,16,16,16,16,0,0,22,22,22,22,26,26,26,26,0,0,32,32,32,32,36,36,36,36,0,0,42,42,42,42,46,46,46,46,0,] int_vector part @@ -24,7 +24,15 @@ downlink_channel_types downlink_channel_types - [1,2,2,2,2,2,2,2,2,2] + [0,0,1,1,1,1,2,2,2,2,0,0,2,2,2,2,2,2,2,2,0,0,2,2,2,2,2,2,2,2,0,0,2,2,2,2,2,2,2,2,0,0,2,2,2,2,2,2,2,2,0,] + int_vector + part + + + + downlink_subslots + downlink_subslots + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,] int_vector part @@ -32,7 +40,7 @@ uplink_starts_fn_mod51 uplink_starts_fn_mod51 - [0,6,10,37,41,47] + [0,0,0,0,0,0,6,6,6,6,10,10,10,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,37,37,37,41,41,41,41,0,0,47,47,47,47] int_vector part @@ -40,10 +48,18 @@ uplink_channel_types uplink_channel_types - [2,2,2,2,2,2] + [2,2,2,2,0,0,2,2,2,2,2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,2,2,2,0,0,2,2,2,2,] int_vector part + + + uplink_subslots + uplink_subslots + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,] + int_vector + part + bursts @@ -55,5 +71,6 @@ Universal demapper for control channels. + Author: Piotr Krysik diff --git a/hier_blocks/compile_demappers b/hier_blocks/compile_demappers new file mode 100755 index 0000000..96d652b --- /dev/null +++ b/hier_blocks/compile_demappers @@ -0,0 +1,37 @@ +#!/bin/bash + +#This is just helper script for manual compilation of hierarhical blocks +#by gr-gsm developers +#Author: Piotr Krysik + +cd demapping +for p in *.grc +do + echo $p + grcc $p -d `pwd` +done +cd .. + +mv ~/.grc_gnuradio/gsm_* . + +for file in *.py.xml +do + cat $file | sed 's/.*\.*/ import grgsm<\/import>/' \ + | sed 's//grgsm./' \ + | sed "s/.*.py//" \ + | sed 's/.*hier_blocks/gr-gsm\/hier_blocks/' \ + > ${file}2 + + mv ${file}2 $file + + mv "$file" "`basename $file .py.xml`.xml" +done + +for py in *.py +do + cat $py |sed 's/gr.hier_block2/grgsm.hier_block/' > ${py}2 + mv ${py}2 $py +done + +mv *.py ../python/demapping +mv *.xml ../grc/demapping \ No newline at end of file diff --git a/hier_blocks/demapping/gsm_bcch_ccch_demapper.grc b/hier_blocks/demapping/gsm_bcch_ccch_demapper.grc new file mode 100644 index 0000000..faef3dd --- /dev/null +++ b/hier_blocks/demapping/gsm_bcch_ccch_demapper.grc @@ -0,0 +1,292 @@ + + + + Tue May 17 17:08:42 2016 + + options + + author + Piotr Krysik + + + window_size + + + + category + + + + comment + + + + description + Demapper for BCCH + CCCH control channels. This corresponds to channel combination iv specified in GSM 05.02, section 6.4 + + + _enabled + True + + + _coordinate + (8, 8) + + + _rotation + 0 + + + generate_options + hb + + + hier_block_src_path + .: + + + id + gsm_bcch_ccch_demapper + + + max_nouts + 0 + + + qt_qss_theme + + + + realtime_scheduling + + + + run_command + {python} -u {filename} + + + run_options + prompt + + + run + True + + + thread_safe_setters + + + + title + BCCH + CCCH demapper + + + + gsm_universal_ctrl_chans_demapper + + alias + + + + comment + + + + affinity + + + + _enabled + True + + + _coordinate + (168, 193) + + + _rotation + 0 + + + id + gsm_universal_ctrl_chans_demapper_0 + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + downlink_channel_types + [0,0,1,1,1,1,2,2,2,2,0,0,2,2,2,2,2,2,2,2,0,0,2,2,2,2,2,2,2,2,0,0,2,2,2,2,2,2,2,2,0,0,2,2,2,2,2,2,2,2,0,] + + + downlink_starts_fn_mod51 + [0,0,2,2,2,2,6,6,6,6,0,0,12,12,12,12,16,16,16,16,0,0,22,22,22,22,26,26,26,26,0,0,32,32,32,32,36,36,36,36,0,0,42,42,42,42,46,46,46,46,0,] + + + downlink_subslots + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,] + + + timeslot_nr + timeslot_nr + + + uplink_channel_types + [2,2,2,2,0,0,2,2,2,2,2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,2,2,2,0,0,2,2,2,2,] + + + uplink_starts_fn_mod51 + [0,0,0,0,0,0,6,6,6,6,10,10,10,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,37,37,37,41,41,41,41,0,0,47,47,47,47] + + + uplink_subslots + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,] + + + + pad_sink + + comment + + + + _enabled + True + + + _coordinate + (424, 188) + + + _rotation + 0 + + + id + pad_sink_0 + + + type + message + + + label + bursts + + + num_streams + 1 + + + optional + True + + + vlen + 1 + + + + pad_source + + comment + + + + _enabled + True + + + _coordinate + (32, 188) + + + _rotation + 0 + + + id + pad_source_0 + + + label + bursts + + + num_streams + 1 + + + optional + True + + + type + message + + + vlen + 1 + + + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (192, 7) + + + _rotation + 0 + + + id + timeslot_nr + + + label + timeslot_nr + + + short_id + + + + type + intx + + + value + 0 + + + + gsm_universal_ctrl_chans_demapper_0 + pad_sink_0 + bursts + in + + + pad_source_0 + gsm_universal_ctrl_chans_demapper_0 + out + bursts + + diff --git a/hier_blocks/demapping/gsm_bcch_ccch_sdcch4_demapper.grc b/hier_blocks/demapping/gsm_bcch_ccch_sdcch4_demapper.grc new file mode 100644 index 0000000..ad5c751 --- /dev/null +++ b/hier_blocks/demapping/gsm_bcch_ccch_sdcch4_demapper.grc @@ -0,0 +1,292 @@ + + + + Tue May 17 17:08:42 2016 + + options + + author + Piotr Krysik + + + window_size + + + + category + + + + comment + + + + description + Demapper for BCCH + CCCH + SDCCH/4 + SACCH/C4 control channels. This corresponds to channel combination v specified in GSM 05.02, section 6.4 + + + _enabled + True + + + _coordinate + (8, 8) + + + _rotation + 0 + + + generate_options + hb + + + hier_block_src_path + .: + + + id + gsm_bcch_ccch_sdcch4_demapper + + + max_nouts + 0 + + + qt_qss_theme + + + + realtime_scheduling + + + + run_command + {python} -u {filename} + + + run_options + prompt + + + run + True + + + thread_safe_setters + + + + title + BCCH + CCCH + SDCCH/4 demapper + + + + gsm_universal_ctrl_chans_demapper + + alias + + + + comment + + + + affinity + + + + _enabled + True + + + _coordinate + (168, 193) + + + _rotation + 0 + + + id + gsm_universal_ctrl_chans_demapper_0 + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + downlink_channel_types + [0,0,1,1,1,1,2,2,2,2,0,0,2,2,2,2,2,2,2,2,0,0,7,7,7,7,7,7,7,7,0,0,7,7,7,7,7,7,7,7,0,0,135,135,135,135,135,135,135,135,0] + + + downlink_starts_fn_mod51 + [0,0,2,2,2,2,6,6,6,6,0,0,12,12,12,12,16,16,16,16,0,0,22,22,22,22,26,26,26,26,0,0,32,32,32,32,36,36,36,36,0,0,42,42,42,42,46,46,46,46,0,] + + + downlink_subslots + [0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,0,0,0,0,0,0,1,1,1,1,0,0,2,2,2,2,3,3,3,3,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,0,0,0,0,0,0,1,1,1,1,0,0,2,2,2,2,3,3,3,3,0,0,2,2,2,2,3,3,3,3,0,] + + + timeslot_nr + timeslot_nr + + + uplink_channel_types + [7,7,7,7,0,0,135,135,135,135,135,135,135,135,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,7,7,7,7,7,7,7,0,0,7,7,7,7,] + + + uplink_starts_fn_mod51 + [0,0,0,0,0,0,6,6,6,6,10,10,10,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,37,37,37,41,41,41,41,0,0,47,47,47,47,] + + + uplink_subslots + [0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,0,0,3,3,3,3,0,0,0,0,0,0,2,2,2,2,3,3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,0,0,3,3,3,3,] + + + + pad_sink + + comment + + + + _enabled + True + + + _coordinate + (416, 188) + + + _rotation + 0 + + + id + pad_sink_0 + + + type + message + + + label + bursts + + + num_streams + 1 + + + optional + True + + + vlen + 1 + + + + pad_source + + comment + + + + _enabled + True + + + _coordinate + (32, 188) + + + _rotation + 0 + + + id + pad_source_0 + + + label + bursts + + + num_streams + 1 + + + optional + True + + + type + message + + + vlen + 1 + + + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (192, 7) + + + _rotation + 0 + + + id + timeslot_nr + + + label + timeslot_nr + + + short_id + + + + type + intx + + + value + 0 + + + + gsm_universal_ctrl_chans_demapper_0 + pad_sink_0 + bursts + in + + + pad_source_0 + gsm_universal_ctrl_chans_demapper_0 + out + bursts + + diff --git a/hier_blocks/demapping/gsm_sdcch8_demapper.grc b/hier_blocks/demapping/gsm_sdcch8_demapper.grc new file mode 100644 index 0000000..3cc5f7e --- /dev/null +++ b/hier_blocks/demapping/gsm_sdcch8_demapper.grc @@ -0,0 +1,292 @@ + + + + Tue May 17 17:08:42 2016 + + options + + author + Piotr Krysik + + + window_size + + + + category + + + + comment + + + + description + Demapper for SDCCH/8 + SACCH/C8 control channels. This corresponds to channel combination vii specified in GSM 05.02, section 6.4 + + + _enabled + True + + + _coordinate + (8, 8) + + + _rotation + 0 + + + generate_options + hb + + + hier_block_src_path + .: + + + id + gsm_sdcch8_demapper + + + max_nouts + 0 + + + qt_qss_theme + + + + realtime_scheduling + + + + run_command + {python} -u {filename} + + + run_options + prompt + + + run + True + + + thread_safe_setters + + + + title + SDCCH/8 demapper + + + + gsm_universal_ctrl_chans_demapper + + alias + + + + comment + + + + affinity + + + + _enabled + True + + + _coordinate + (168, 193) + + + _rotation + 0 + + + id + gsm_universal_ctrl_chans_demapper_0 + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + downlink_channel_types + [0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,0,0,0] + + + downlink_starts_fn_mod51 + [0,0,0,0,4,4,4,4,8,8,8,8,12,12,12,12,16,16,16,16,20,20,20,20,24,24,24,24,28,28,28,28,32,32,32,32,36,36,36,36,40,40,40,40,44,44,44,44,0,0,0] + + + downlink_subslots + [0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,0,0,0,] + + + timeslot_nr + timeslot_nr + + + uplink_channel_types + [1,1,1,1,2,2,2,2,3,3,3,3,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,0,0,0,0,5,5,5,5,6,6,6,6,7,7,7,7,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,4,4,4,4] + + + uplink_starts_fn_mod51 + [136,136,136,136,136,136,136,136,136,136,136,136,0,0,0,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,136,136,136,136] + + + uplink_subslots + [1,1,1,1,2,2,2,2,3,3,3,3,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,0,0,0,0,5,5,5,5,6,6,6,6,7,7,7,7,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,4,4,4,4,] + + + + pad_sink + + comment + + + + _enabled + True + + + _coordinate + (416, 188) + + + _rotation + 0 + + + id + pad_sink_0 + + + type + message + + + label + bursts + + + num_streams + 1 + + + optional + True + + + vlen + 1 + + + + pad_source + + comment + + + + _enabled + True + + + _coordinate + (32, 188) + + + _rotation + 0 + + + id + pad_source_0 + + + label + bursts + + + num_streams + 1 + + + optional + True + + + type + message + + + vlen + 1 + + + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (192, 7) + + + _rotation + 0 + + + id + timeslot_nr + + + label + timeslot_nr + + + short_id + + + + type + intx + + + value + 1 + + + + gsm_universal_ctrl_chans_demapper_0 + pad_sink_0 + bursts + in + + + pad_source_0 + gsm_universal_ctrl_chans_demapper_0 + out + bursts + + diff --git a/include/grgsm/demapping/universal_ctrl_chans_demapper.h b/include/grgsm/demapping/universal_ctrl_chans_demapper.h index c1778af..eea2bde 100644 --- a/include/grgsm/demapping/universal_ctrl_chans_demapper.h +++ b/include/grgsm/demapping/universal_ctrl_chans_demapper.h @@ -49,7 +49,7 @@ namespace gr { * class. gsm::universal_ctrl_chans_demapper::make is the public interface for * creating new instances. */ - static sptr make(unsigned int timeslot_nr, const std::vector &downlink_starts_fn_mod51, const std::vector &downlink_channel_types, const std::vector &uplink_starts_fn_mod51=std::vector(), const std::vector &uplink_channel_types=std::vector()); + static sptr make(unsigned int timeslot_nr, const std::vector &downlink_starts_fn_mod51, const std::vector &downlink_channel_types, const std::vector &downlink_subslots, const std::vector &uplink_starts_fn_mod51=std::vector(), const std::vector &uplink_channel_types=std::vector(), const std::vector &uplink_subslots=std::vector()); }; } // namespace gsm diff --git a/lib/demapping/universal_ctrl_chans_demapper_impl.cc b/lib/demapping/universal_ctrl_chans_demapper_impl.cc index cbbbc32..32987ca 100644 --- a/lib/demapping/universal_ctrl_chans_demapper_impl.cc +++ b/lib/demapping/universal_ctrl_chans_demapper_impl.cc @@ -36,158 +36,34 @@ namespace gr { namespace gsm { universal_ctrl_chans_demapper::sptr - universal_ctrl_chans_demapper::make(unsigned int timeslot_nr, const std::vector &downlink_starts_fn_mod51, const std::vector &downlink_channel_types, const std::vector &uplink_starts_fn_mod51, const std::vector &uplink_channel_types) - { + universal_ctrl_chans_demapper::make(unsigned int timeslot_nr, const std::vector &downlink_starts_fn_mod51, const std::vector &downlink_channel_types, const std::vector &downlink_subslots, const std::vector &uplink_starts_fn_mod51, const std::vector &uplink_channel_types, const std::vector &uplink_subslots) + { return gnuradio::get_initial_sptr - (new universal_ctrl_chans_demapper_impl(timeslot_nr, downlink_starts_fn_mod51, downlink_channel_types, uplink_starts_fn_mod51, uplink_channel_types)); + (new universal_ctrl_chans_demapper_impl(timeslot_nr, downlink_starts_fn_mod51, downlink_channel_types, downlink_subslots, uplink_starts_fn_mod51, uplink_channel_types, uplink_subslots)); } /* * The private constructor */ - universal_ctrl_chans_demapper_impl::universal_ctrl_chans_demapper_impl(unsigned int timeslot_nr, const std::vector &downlink_starts_fn_mod51, const std::vector &downlink_channel_types, const std::vector &uplink_starts_fn_mod51, const std::vector &uplink_channel_types) + universal_ctrl_chans_demapper_impl::universal_ctrl_chans_demapper_impl(unsigned int timeslot_nr, const std::vector &downlink_starts_fn_mod51, const std::vector &downlink_channel_types, const std::vector &downlink_subslots, const std::vector &uplink_starts_fn_mod51, const std::vector &uplink_channel_types, const std::vector &uplink_subslots) : gr::block("universal_ctrl_chans_demapper", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)), - d_timeslot(timeslot_nr) - + d_timeslot_nr(timeslot_nr), + d_downlink_starts_fn_mod51(51, 0), + d_downlink_channel_types(51, 0), + d_downlink_subslots(102, 0), + d_uplink_starts_fn_mod51(51, 0), + d_uplink_channel_types(51, 0), + d_uplink_subslots(102, 0) { - - - for(int ii=0; ii<51; ii++) - { - 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::const_iterator s; - std::vector::const_iterator ch_type; - - 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_downlink_starts_fn_mod51[*s+ii] = *s; - if(ch_type!=downlink_channel_types.end()) - { - d_downlink_channel_types[*s+ii] = *ch_type; - } - } - if(ch_type!=downlink_channel_types.end()) - { - ch_type++; - } - } - } - - 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 distinct_downlink_channels(downlink_channel_types.begin(), downlink_channel_types.end()); - std::set::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 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++; - } - } - } - } - - + std::copy(downlink_starts_fn_mod51.begin(), downlink_starts_fn_mod51.end(), d_downlink_starts_fn_mod51.begin()); + std::copy(downlink_channel_types.begin(), downlink_channel_types.end(), d_downlink_channel_types.begin()); + std::copy(downlink_subslots.begin(), downlink_subslots.end(), d_downlink_subslots.begin()); + std::copy(uplink_starts_fn_mod51.begin(), uplink_starts_fn_mod51.end(), d_uplink_starts_fn_mod51.begin()); + std::copy(uplink_channel_types.begin(), uplink_channel_types.end(), d_uplink_channel_types.begin()); + std::copy(uplink_subslots.begin(), uplink_subslots.end(), d_uplink_subslots.begin()); + 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)); message_port_register_out(pmt::mp("bursts")); @@ -205,99 +81,79 @@ namespace gr { pmt::pmt_t header_plus_burst = pmt::cdr(msg); gsmtap_hdr * header = (gsmtap_hdr *)pmt::blob_data(header_plus_burst); - uint32_t frame_nr = be32toh(header->frame_number); - uint32_t fn_mod51 = frame_nr % 51; - - bool uplink_burst = (be16toh(header->arfcn) & 0x4000) ? true : false; - - if(header->timeslot==d_timeslot){ + if(header->timeslot==d_timeslot_nr) + { + int * starts_fn_mod51; + int * channel_types; + int * subslots; + uint32_t * frame_numbers; + pmt::pmt_t * bursts; + + uint32_t frame_nr = be32toh(header->frame_number); //get frame number + uint32_t fn_mod51 = frame_nr % 51; //frame number modulo 51 + + //crate new message int8_t new_msg[sizeof(gsmtap_hdr)+BURST_SIZE]; gsmtap_hdr * new_hdr = (gsmtap_hdr*)new_msg; memcpy(new_msg, header, sizeof(gsmtap_hdr)+BURST_SIZE); pmt::pmt_t msg_binary_blob = pmt::make_blob(new_msg,sizeof(gsmtap_hdr)+BURST_SIZE); pmt::pmt_t msg_out = pmt::cons(pmt::PMT_NIL, msg_binary_blob); - - if(uplink_burst) - { - 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) - { - new_hdr->sub_type = ch_type; - } - new_hdr->sub_slot = d_uplink_subslots[fn_mod51 + (51 * (frame_nr % 2))]; - - if(fn_mod51>=fn51_start && fn_mod51<=fn51_stop) - { - uint32_t ii = fn_mod51 - fn51_start; - d_uplink_frame_numbers[ii] = frame_nr; - d_uplink_bursts[ii] = msg_out; - } - - 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_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]); - } - } - } + //get information if burst is from uplink or downlink + bool uplink_burst = (be16toh(header->arfcn) & 0x4000) ? true : false; + + //select right set of configuration and history for uplink or downlink + if(uplink_burst) { + starts_fn_mod51 = &d_uplink_starts_fn_mod51[0]; + channel_types = &d_uplink_channel_types[0]; + subslots = &d_uplink_subslots[0]; + frame_numbers = d_uplink_frame_numbers; + bursts = d_uplink_bursts; + } else { + starts_fn_mod51 = &d_downlink_starts_fn_mod51[0]; + channel_types = &d_downlink_channel_types[0]; + subslots = &d_downlink_subslots[0]; + frame_numbers = d_downlink_frame_numbers; + bursts = d_downlink_bursts; } - 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]; + + uint32_t fn51_start = starts_fn_mod51[fn_mod51]; + uint32_t fn51_stop = fn51_start + 3; + uint32_t ch_type = channel_types[fn_mod51]; - if(ch_type != 0) - { - new_hdr->sub_type = ch_type; - } - new_hdr->sub_slot = d_downlink_subslots[fn_mod51 + (51 * (frame_nr % 2))]; - - if(fn_mod51>=fn51_start && fn_mod51<=fn51_stop) + if(ch_type != 0) + { + new_hdr->sub_type = ch_type; + } + new_hdr->sub_slot = subslots[fn_mod51 + (51 * (frame_nr % 2))]; + + if(fn_mod51>=fn51_start && fn_mod51<=fn51_stop) + { + uint32_t ii = fn_mod51 - fn51_start; + frame_numbers[ii] = frame_nr; + bursts[ii] = msg_out; + } + + 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 ii = fn_mod51 - fn51_start; - d_downlink_frame_numbers[ii] = frame_nr; - d_downlink_bursts[ii] = msg_out; + if((frame_numbers[jj] - frame_numbers[jj-1])!=1) + { + frames_are_consecutive = false; + } } - - if(fn_mod51==fn51_stop) + if(frames_are_consecutive) { - //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++) + //send bursts to the output + for(int jj=0; jj<4; jj++) { - if((d_downlink_frame_numbers[jj]-d_downlink_frame_numbers[jj-1])!=1) - { - frames_are_consecutive = false; - } + message_port_pub(pmt::mp("bursts"), bursts[jj]); } - 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]); - } - } - } + } } } } diff --git a/lib/demapping/universal_ctrl_chans_demapper_impl.h b/lib/demapping/universal_ctrl_chans_demapper_impl.h index 0316bf4..9545ab6 100644 --- a/lib/demapping/universal_ctrl_chans_demapper_impl.h +++ b/lib/demapping/universal_ctrl_chans_demapper_impl.h @@ -29,23 +29,28 @@ namespace gr { namespace gsm { + typedef enum {downlink=0,uplink=1} um_radio_link_direction; class universal_ctrl_chans_demapper_impl : public universal_ctrl_chans_demapper { private: - 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_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]; + //configuration of the block + unsigned int d_timeslot_nr; + std::vector d_downlink_starts_fn_mod51; + std::vector d_downlink_channel_types; + std::vector d_downlink_subslots; + + std::vector d_uplink_starts_fn_mod51; + std::vector d_uplink_channel_types; + std::vector d_uplink_subslots; + + //history of the downlink and uplink bursts + uint32_t d_downlink_frame_numbers[4]; + pmt::pmt_t d_downlink_bursts[4]; + uint32_t d_uplink_frame_numbers[4]; + pmt::pmt_t d_uplink_bursts[4]; public: - universal_ctrl_chans_demapper_impl(unsigned int timeslot_nr, const std::vector &downlink_starts_fn_mod51, const std::vector &downlink_channel_types, const std::vector &uplink_starts_fn_mod51, const std::vector &uplink_channel_types); - ~universal_ctrl_chans_demapper_impl(); + universal_ctrl_chans_demapper_impl(unsigned int timeslot_nr, const std::vector &downlink_starts_fn_mod51, const std::vector &downlink_channel_types, const std::vector &downlink_subslots, const std::vector &uplink_starts_fn_mod51, const std::vector &uplink_channel_types, const std::vector &uplink_subslots); + ~universal_ctrl_chans_demapper_impl(); void filter_ctrl_chans(pmt::pmt_t msg); }; diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 04a97c2..8fc48de 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -31,6 +31,9 @@ endif() GR_PYTHON_INSTALL( FILES __init__.py + demapping/gsm_bcch_ccch_demapper.py + demapping/gsm_bcch_ccch_sdcch4_demapper.py + demapping/gsm_sdcch8_demapper.py receiver/gsm_input.py receiver/gsm_wideband_input.py receiver/fcch_burst_tagger.py diff --git a/python/__init__.py b/python/__init__.py index 247c040..dfa7a0e 100644 --- a/python/__init__.py +++ b/python/__init__.py @@ -53,6 +53,9 @@ from fcch_detector import fcch_detector from clock_offset_corrector import clock_offset_corrector from gsm_input import gsm_input from gsm_wideband_input import gsm_wideband_input +from gsm_bcch_ccch_demapper import gsm_bcch_ccch_demapper +from gsm_bcch_ccch_sdcch4_demapper import gsm_bcch_ccch_sdcch4_demapper +from gsm_sdcch8_demapper import gsm_sdcch8_demapper import arfcn diff --git a/python/demapping/gsm_bcch_ccch_demapper.py b/python/demapping/gsm_bcch_ccch_demapper.py new file mode 100644 index 0000000..adb4c12 --- /dev/null +++ b/python/demapping/gsm_bcch_ccch_demapper.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +################################################## +# GNU Radio Python Flow Graph +# Title: BCCH + CCCH demapper +# Author: Piotr Krysik +# Description: Demapper for BCCH + CCCH control channels. This corresponds to channel combination iv specified in GSM 05.02, section 6.4 +# Generated: Fri May 20 12:11:59 2016 +################################################## + +from gnuradio import gr +from gnuradio.filter import firdes +import grgsm + + +class gsm_bcch_ccch_demapper(grgsm.hier_block): + + def __init__(self, timeslot_nr=0): + grgsm.hier_block.__init__( + self, "BCCH + CCCH demapper", + gr.io_signature(0, 0, 0), + gr.io_signature(0, 0, 0), + ) + self.message_port_register_hier_in("bursts") + self.message_port_register_hier_out("bursts") + + ################################################## + # Parameters + ################################################## + self.timeslot_nr = timeslot_nr + + ################################################## + # Blocks + ################################################## + self.gsm_universal_ctrl_chans_demapper_0 = grgsm.universal_ctrl_chans_demapper(timeslot_nr, ([0,0,2,2,2,2,6,6,6,6,0,0,12,12,12,12,16,16,16,16,0,0,22,22,22,22,26,26,26,26,0,0,32,32,32,32,36,36,36,36,0,0,42,42,42,42,46,46,46,46,0,]), ([0,0,1,1,1,1,2,2,2,2,0,0,2,2,2,2,2,2,2,2,0,0,2,2,2,2,2,2,2,2,0,0,2,2,2,2,2,2,2,2,0,0,2,2,2,2,2,2,2,2,0,]), ([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,]), ([0,0,0,0,0,0,6,6,6,6,10,10,10,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,37,37,37,41,41,41,41,0,0,47,47,47,47]), ([2,2,2,2,0,0,2,2,2,2,2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,2,2,2,0,0,2,2,2,2,]), ([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,])) + + ################################################## + # Connections + ################################################## + self.msg_connect((self.gsm_universal_ctrl_chans_demapper_0, 'bursts'), (self, 'bursts')) + self.msg_connect((self, 'bursts'), (self.gsm_universal_ctrl_chans_demapper_0, 'bursts')) + + def get_timeslot_nr(self): + return self.timeslot_nr + + def set_timeslot_nr(self, timeslot_nr): + self.timeslot_nr = timeslot_nr diff --git a/python/demapping/gsm_bcch_ccch_sdcch4_demapper.py b/python/demapping/gsm_bcch_ccch_sdcch4_demapper.py new file mode 100644 index 0000000..92fb5f0 --- /dev/null +++ b/python/demapping/gsm_bcch_ccch_sdcch4_demapper.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +################################################## +# GNU Radio Python Flow Graph +# Title: BCCH + CCCH + SDCCH/4 demapper +# Author: Piotr Krysik +# Description: Demapper for BCCH + CCCH + SDCCH/4 + SACCH/C4 control channels. This corresponds to channel combination v specified in GSM 05.02, section 6.4 +# Generated: Fri May 20 12:12:01 2016 +################################################## + +from gnuradio import gr +from gnuradio.filter import firdes +import grgsm + + +class gsm_bcch_ccch_sdcch4_demapper(grgsm.hier_block): + + def __init__(self, timeslot_nr=0): + grgsm.hier_block.__init__( + self, "BCCH + CCCH + SDCCH/4 demapper", + gr.io_signature(0, 0, 0), + gr.io_signature(0, 0, 0), + ) + self.message_port_register_hier_in("bursts") + self.message_port_register_hier_out("bursts") + + ################################################## + # Parameters + ################################################## + self.timeslot_nr = timeslot_nr + + ################################################## + # Blocks + ################################################## + self.gsm_universal_ctrl_chans_demapper_0 = grgsm.universal_ctrl_chans_demapper(timeslot_nr, ([0,0,2,2,2,2,6,6,6,6,0,0,12,12,12,12,16,16,16,16,0,0,22,22,22,22,26,26,26,26,0,0,32,32,32,32,36,36,36,36,0,0,42,42,42,42,46,46,46,46,0,]), ([0,0,1,1,1,1,2,2,2,2,0,0,2,2,2,2,2,2,2,2,0,0,7,7,7,7,7,7,7,7,0,0,7,7,7,7,7,7,7,7,0,0,135,135,135,135,135,135,135,135,0]), ([0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,0,0,0,0,0,0,1,1,1,1,0,0,2,2,2,2,3,3,3,3,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,0,0,0,0,0,0,1,1,1,1,0,0,2,2,2,2,3,3,3,3,0,0,2,2,2,2,3,3,3,3,0,]), ([0,0,0,0,0,0,6,6,6,6,10,10,10,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,37,37,37,41,41,41,41,0,0,47,47,47,47,]), ([7,7,7,7,0,0,135,135,135,135,135,135,135,135,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,7,7,7,7,7,7,7,0,0,7,7,7,7,]), ([0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,0,0,3,3,3,3,0,0,0,0,0,0,2,2,2,2,3,3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,0,0,3,3,3,3,])) + + ################################################## + # Connections + ################################################## + self.msg_connect((self.gsm_universal_ctrl_chans_demapper_0, 'bursts'), (self, 'bursts')) + self.msg_connect((self, 'bursts'), (self.gsm_universal_ctrl_chans_demapper_0, 'bursts')) + + def get_timeslot_nr(self): + return self.timeslot_nr + + def set_timeslot_nr(self, timeslot_nr): + self.timeslot_nr = timeslot_nr diff --git a/python/demapping/gsm_sdcch8_demapper.py b/python/demapping/gsm_sdcch8_demapper.py new file mode 100644 index 0000000..e69d277 --- /dev/null +++ b/python/demapping/gsm_sdcch8_demapper.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +################################################## +# GNU Radio Python Flow Graph +# Title: SDCCH/8 demapper +# Author: Piotr Krysik +# Description: Demapper for SDCCH/8 + SACCH/C8 control channels. This corresponds to channel combination vii specified in GSM 05.02, section 6.4 +# Generated: Fri May 20 12:12:04 2016 +################################################## + +from gnuradio import gr +from gnuradio.filter import firdes +import grgsm + + +class gsm_sdcch8_demapper(grgsm.hier_block): + + def __init__(self, timeslot_nr=1): + grgsm.hier_block.__init__( + self, "SDCCH/8 demapper", + gr.io_signature(0, 0, 0), + gr.io_signature(0, 0, 0), + ) + self.message_port_register_hier_in("bursts") + self.message_port_register_hier_out("bursts") + + ################################################## + # Parameters + ################################################## + self.timeslot_nr = timeslot_nr + + ################################################## + # Blocks + ################################################## + self.gsm_universal_ctrl_chans_demapper_0 = grgsm.universal_ctrl_chans_demapper(timeslot_nr, ([0,0,0,0,4,4,4,4,8,8,8,8,12,12,12,12,16,16,16,16,20,20,20,20,24,24,24,24,28,28,28,28,32,32,32,32,36,36,36,36,40,40,40,40,44,44,44,44,0,0,0]), ([0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,0,0,0]), ([0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,0,0,0,]), ([136,136,136,136,136,136,136,136,136,136,136,136,0,0,0,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,136,136,136,136]), ([1,1,1,1,2,2,2,2,3,3,3,3,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,0,0,0,0,5,5,5,5,6,6,6,6,7,7,7,7,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,4,4,4,4]), ([1,1,1,1,2,2,2,2,3,3,3,3,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,0,0,0,0,5,5,5,5,6,6,6,6,7,7,7,7,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,4,4,4,4,])) + + ################################################## + # Connections + ################################################## + self.msg_connect((self.gsm_universal_ctrl_chans_demapper_0, 'bursts'), (self, 'bursts')) + self.msg_connect((self, 'bursts'), (self.gsm_universal_ctrl_chans_demapper_0, 'bursts')) + + def get_timeslot_nr(self): + return self.timeslot_nr + + def set_timeslot_nr(self, timeslot_nr): + self.timeslot_nr = timeslot_nr -- cgit v1.2.3