blob: f025a7087aaf81759ff47a8eb961d3b38ee4faff [file] [log] [blame]
Piotr Krysikea34c012016-10-02 18:53:43 +02001#!/usr/bin/env python2
Piotr Krysik773a1942016-05-20 12:45:54 +02002# -*- coding: utf-8 -*-
Piotr Krysikea34c012016-10-02 18:53:43 +02003# @file
Piotr Krysika6268a52017-08-23 16:02:19 +02004# @author (C) 2016 by Piotr Krysik <ptrkrysik@gmail.com>
Piotr Krysikea34c012016-10-02 18:53:43 +02005# @section LICENSE
6#
7# Gr-gsm is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation; either version 3, or (at your option)
10# any later version.
11#
12# Gr-gsm is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with gr-gsm; see the file COPYING. If not, write to
19# the Free Software Foundation, Inc., 51 Franklin Street,
20# Boston, MA 02110-1301, USA.
21#
Piotr Krysik773a1942016-05-20 12:45:54 +020022##################################################
23# GNU Radio Python Flow Graph
24# Title: BCCH + CCCH + SDCCH/4 demapper
25# Author: Piotr Krysik
26# 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
Piotr Krysike5bd4b82016-05-23 09:43:05 +020027# Generated: Mon May 23 09:32:46 2016
Piotr Krysik773a1942016-05-20 12:45:54 +020028##################################################
29
30from gnuradio import gr
31from gnuradio.filter import firdes
32import grgsm
33
34
Vasil Velichkov46c90be2019-09-02 04:06:41 +030035class gsm_bcch_ccch_sdcch4_demapper(gr.hier_block2):
Piotr Krysik773a1942016-05-20 12:45:54 +020036
37 def __init__(self, timeslot_nr=0):
Vasil Velichkov46c90be2019-09-02 04:06:41 +030038 gr.hier_block2.__init__(
Piotr Krysik773a1942016-05-20 12:45:54 +020039 self, "BCCH + CCCH + SDCCH/4 demapper",
40 gr.io_signature(0, 0, 0),
41 gr.io_signature(0, 0, 0),
42 )
43 self.message_port_register_hier_in("bursts")
44 self.message_port_register_hier_out("bursts")
45
46 ##################################################
47 # Parameters
48 ##################################################
49 self.timeslot_nr = timeslot_nr
50
51 ##################################################
52 # Blocks
53 ##################################################
Vasil Velichkovfa184a92019-07-25 22:43:33 +030054
55 # 3GPP TS 45.002 version 15.1.0 Release 15
56 # Table 3 : Mapping of logical channels onto physical channels (see subclauses 6.3, 6.4, 6.5)
57 #
58 # BCCH Norm D 0,2,4,6 C0 NB 51 B(2..5)
59 # SDCCH/4 0 D 0 C0 NB1 51 B(22..25)
60 # U B(37..40)
61 # 1 D B(26..29)
62 # U B(41..44)
63 # 2 D B(32..35)
64 # U B(47..50)
65 # 3 D B(36..39)
66 # U B(0..3)
67 # SACCH/C4 0 D 0 C0 NB3 102 B(42..45)
68 # U B(57..60)
69 # 1 D B(46..49)
70 # U B(61..64)
71 # 2 D B(93..96)
72 # U B(6..9)
73 # 3 D B(97..100)
74 # U B(10..13)
75 #
76 # Figure 8b: TDMA frame mapping for FCCH + SCH + BCCH + CCCH + SDCCH/4(0...3) + SACCH/4(0...3)
77 #
78 self.gsm_universal_ctrl_chans_demapper_0 = grgsm.universal_ctrl_chans_demapper(
79 timeslot_nr, ([ #downlink
80 0,0,
81 2,2,2,2,
82 6,6,6,6,
83 0,0,
84 12,12,12,12,
85 16,16,16,16,
86 0,0,
87 22,22,22,22,
88 26,26,26,26,
89 0,0,
90 32,32,32,32,
91 36,36,36,36,
92 0,0,
93 42,42,42,42,
94 46,46,46,46,
95 0,
96 ]), ([
97 0,0,
98 1,1,1,1,
99 2,2,2,2,
100 0,0,
101 2,2,2,2,
102 2,2,2,2,
103 0,0,
104 7,7,7,7,
105 7,7,7,7,
106 0,0,
107 7,7,7,7,
108 7,7,7,7,
109 0,0,
110 135,135,135,135,
111 135,135,135,135,
112 0,
113 ]), ([
114 0,0,
115 0,0,0,0,
116 0,0,0,0,
117 0,0,
118 1,1,1,1,
119 2,2,2,2,
120 0,0,
121 0,0,0,0,
122 1,1,1,1,
123 0,0,
124 2,2,2,2,
125 3,3,3,3,
126 0,0,
127 0,0,0,0,
128 1,1,1,1,
129 0,0,
130 0,0,0,0,
131 0,0,0,0,
132 0,0,
133 0,
134 1,1,1,1,
135 2,2,2,2,
136 0,0,
137 0,0,0,0,
138 1,1,1,1,
139 0,0,
140 2,2,2,2,
141 3,3,3,3,
142 0,0,
143 2,2,2,2,
144 3,3,3,3,
145 0,
146 ]), ([ #uplink
147 0,0,0,0,
148 4,5,
149 6,6,6,6,
150 10,10,10,10,
151 14,15,16,17,
152 18,19,20,21,
153 22,23,24,25,
154 26,27,28,29,
155 30,31,32,33,
156 34,35,36,
157 37,37,37,37,
158 41,41,41,41,
159 45,46,
160 47,47,47,47,
161 ]), ([
162 7,7,7,7,
163 3,3,
164 135,135,135,135,
165 135,135,135,135,
166 3,3,3,3,
167 3,3,3,3,
168 3,3,3,3,
169 3,3,3,3,
170 3,3,3,3,
171 3,3,
172 3,
173 7,7,7,7,
174 7,7,7,7,
175 3,3,
176 7,7,7,7,
177 ]), ([
178 3,3,3,3,
179 0,0,
180 2,2,2,2,
181 3,3,3,3,
182 0,0,0,0,
183 0,0,0,0,
184 0,0,0,0,
185 0,0,0,0,
186 0,0,0,0,
187 0,0,
188 0,
189 0,0,0,0,
190 1,1,1,1,
191 0,0,
192 2,2,2,2,
193 3,3,3,3,
194 0,0,
195 0,0,0,0,
196 1,1,1,1,
197 0,0,0,0,
198 0,0,0,0,
199 0,0,0,0,
200 0,0,0,0,
201 0,0,0,0,
202 0,0,
203 0,
204 0,0,0,0,
205 1,1,1,1,
206 0,0,
207 2,2,2,2,
208 ]))
Piotr Krysik773a1942016-05-20 12:45:54 +0200209
210 ##################################################
211 # Connections
212 ##################################################
213 self.msg_connect((self.gsm_universal_ctrl_chans_demapper_0, 'bursts'), (self, 'bursts'))
214 self.msg_connect((self, 'bursts'), (self.gsm_universal_ctrl_chans_demapper_0, 'bursts'))
215
216 def get_timeslot_nr(self):
217 return self.timeslot_nr
218
219 def set_timeslot_nr(self, timeslot_nr):
220 self.timeslot_nr = timeslot_nr