aboutsummaryrefslogtreecommitdiffstats
path: root/python/demapping/gsm_sdcch8_demapper.py
blob: 30450bfb596645704b0e3c1f2e081928c01f0e0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# @file
# @author (C) 2016 by Piotr Krysik <ptrkrysik@gmail.com>
# @section LICENSE
#
# Gr-gsm is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# Gr-gsm is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with gr-gsm; see the file COPYING.  If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
#
##################################################
# 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: Mon May 23 09:32:48 2016
##################################################

from gnuradio import gr
from gnuradio.filter import firdes
import grgsm


class gsm_sdcch8_demapper(gr.hier_block2):

    def __init__(self, timeslot_nr=1):
        gr.hier_block2.__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
        ##################################################

        # 3GPP TS 45.002 version 15.1.0 Release 15
        # Table 4 : Mapping of logical channels onto physical channels (see subclauses 6.3, 6.4, 6.5)
        # SDCCH/8 0 D 0 ... 7 C0 ... Cn NB1 51 B (0 ... 3)
        #           U B (15 ... 18)
        #         1 D B (4 ... 7)
        #           U B (19 ... 22)
        #         2 D B (8 ... 11)
        #           U B (23 ... 26)
        #         3 D B (12 ... 15)
        #           U B (27 ... 30)
        #         4 D B (16 ... 19)
        #           U B (31 ... 34)
        #         5 D B (20 ... 23)
        #           U B (35 ... 38)
        #         6 D B (24 ... 27)
        #           U B (39 ... 42)
        #         7 D B (28 ... 31)
        #           U B (43 ... 46)
        # SACCH/C8 0 D 0 ... 7 C0 ... Cn NB3 102 B (32 ... 35)
        #            U B (47 ... 50)
        #          1 D B (36 ... 39)
        #            U B (51 ... 54)
        #          2 D B (40 ... 43)
        #            U B (55 ... 58)
        #          3 D B (44 ... 47)
        #            U B (59 ... 62)
        #          4 D B (83 ... 86)
        #            U B (98 ... 101)
        #          5 D B (87 ... 90)
        #            U B (0 ... 3)
        #          6 D B (91 ... 94)
        #            U B (4 ... 7)
        #          7 D B (95 ... 98)
        #            U B (8 ... 11)
        self.gsm_universal_ctrl_chans_demapper_0 = grgsm.universal_ctrl_chans_demapper(
                timeslot_nr, ([ #downlink
                    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
                ]), ([
                    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,
                    136,136,136,136,
                    136,136,136,136,
                    136,136,136,136,
                    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
                ]), ([ #uplink
                    0,0,0,0,
                    4,4,4,4,
                    8,8,8,8,
                    0,0,0,
                    15,15,15,15,
                    19,19,19,19,
                    23,23,23,23,
                    27,27,27,27,
                    31,31,31,31,
                    35,35,35,35,
                    39,39,39,39,
                    43,43,43,43,
                    47,47,47,47
                ]), ([
                    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
                ]), ([
                    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
                ]))

        ##################################################
        # 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