Merge branch 'ptrkrysik/trx' into development

This commit is contained in:
Piotr Krysik 2018-04-16 22:21:29 +02:00
commit 8a8d41a583
89 changed files with 4574 additions and 73 deletions

2
.gitignore vendored
View File

@ -5,7 +5,7 @@ build
*.pyc
*.pyo
.unittests
build/
build*/
debian/tmp/
debian/files
.directory

View File

@ -77,6 +77,7 @@ GR_PYTHON_INSTALL(
${CMAKE_CURRENT_BINARY_DIR}/grgsm_livemon_headless
grgsm_scanner
grgsm_decode
grgsm_trx
DESTINATION bin
)

165
apps/grgsm_trx Executable file
View File

@ -0,0 +1,165 @@
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# GR-GSM based transceiver
#
# (C) 2016-2017 by Vadim Yanitskiy <axilirator@gmail.com>
#
# All Rights Reserved
#
# This program 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 2 of the License, or
# (at your option) any later version.
#
# This program 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 this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
import signal
import getopt
import sys
from grgsm.trx import ctrl_if_bb
from grgsm.trx import radio_if
from grgsm.trx import fake_pm
COPYRIGHT = \
"Copyright (C) 2016-2017 by Vadim Yanitskiy <axilirator@gmail.com>\n" \
"License GPLv2+: GNU GPL version 2 or later " \
"<http://gnu.org/licenses/gpl.html>\n" \
"This is free software: you are free to change and redistribute it.\n" \
"There is NO WARRANTY, to the extent permitted by law.\n"
class Application:
# Application variables
remote_addr = "127.0.0.1"
base_port = 5700
# PHY specific
phy_sample_rate = 4*1625000/6
phy_tx_antenna = "TX/RX"
phy_rx_antenna = "RX2"
phy_rx_gain = 30
phy_tx_gain = 40
phy_args = ""
phy_ppm = 0
def __init__(self):
self.print_copyright()
self.parse_argv()
# Set up signal handlers
signal.signal(signal.SIGINT, self.sig_handler)
def run(self):
# Init Radio interface
self.radio = radio_if(self.phy_args, self.phy_sample_rate,
self.phy_rx_gain, self.phy_tx_gain, self.phy_ppm,
self.phy_rx_antenna, self.phy_tx_antenna,
self.remote_addr, self.base_port)
# Power measurement emulation
# Noise: -120 .. -105
# BTS: -75 .. -50
self.pm = fake_pm(-120, -105, -75, -50)
# Init TRX CTRL interface
self.server = ctrl_if_bb(self.remote_addr,
self.base_port + 101, self.base_port + 1,
self.radio, self.pm)
print("[i] Init complete")
# Enter main loop
while True:
self.server.loop()
def shutdown(self):
print("[i] Shutting down...")
self.server.shutdown()
self.radio.shutdown()
def print_copyright(self):
print(COPYRIGHT)
def print_help(self):
s = " Usage: " + sys.argv[0] + " [options]\n\n" \
" Some help...\n" \
" -h --help this text\n\n"
# TRX specific
s += " TRX interface specific\n" \
" -i --remote-addr Set remote address (default 127.0.0.1)\n" \
" -p --base-port Set base port number (default 5700)\n\n"
# PHY specific
s += " Radio interface specific\n" \
" -a --device-args Set device arguments\n" \
" -s --sample-rate Set sample rate (default 2000000)\n" \
" -g --rx-gain Set RX gain (default 30)\n" \
" -G --tx-gain Set TX gain (default 10)\n" \
" --rx-antenna Set RX antenna (default RX2)\n" \
" --tx-antenna Set TX antenna (default TX/RX)\n" \
" --ppm Set frequency correction (default 0)\n"
print(s)
def parse_argv(self):
try:
opts, args = getopt.getopt(sys.argv[1:],
"i:p:a:s:g:G:h",
["help", "remote-addr=", "base-port=", "device-args=",
"sample-rate=", "rx-gain=", "tx-gain=", "ppm=",
"rx-antenna=", "tx-antenna="])
except getopt.GetoptError as err:
# Print(help and exit)
self.print_help()
print("[!] " + str(err))
sys.exit(2)
for o, v in opts:
if o in ("-h", "--help"):
self.print_help()
sys.exit(2)
# TRX specific
elif o in ("-i", "--remote-addr"):
self.remote_addr = v
elif o in ("-p", "--base-port"):
if int(v) >= 0 and int(v) <= 65535:
self.base_port = int(v)
else:
print("[!] The port number should be in range [0-65536]")
sys.exit(2)
# PHY specific
elif o in ("-a", "--device-args"):
self.phy_args = v
elif o in ("-s", "--sample-rate"):
self.phy_sample_rate = int(v)
elif o in ("-g", "--rx-gain"):
self.phy_rx_gain = int(v)
elif o in ("-G", "--tx-gain"):
self.phy_tx_gain = int(v)
elif o in ("--rx-antenna"):
self.phy_rx_antenna = v
elif o in ("--tx-antenna"):
self.phy_tx_antenna = v
elif o in ("--ppm"):
self.phy_ppm = int(v)
def sig_handler(self, signum, frame):
print("Signal %d received" % signum)
if signum is signal.SIGINT:
self.shutdown()
sys.exit(0)
if __name__ == '__main__':
app = Application()
app.run()

@ -1 +1 @@
Subproject commit e4e387dddc3d9b860ae0938902fd59c1a569138c
Subproject commit 32727fc905c78b151cbb1794db05383220d7e61b

View File

@ -23,6 +23,7 @@ add_subdirectory(demapping)
add_subdirectory(receiver)
add_subdirectory(flow_control)
add_subdirectory(misc_utils)
add_subdirectory(transmitter)
install(FILES
gsm_block_tree.xml DESTINATION share/gnuradio/grc/blocks
)

View File

@ -21,6 +21,7 @@ install(FILES
gsm_burst_timeslot_splitter.xml
gsm_burst_fnr_filter.xml
gsm_burst_timeslot_filter.xml
gsm_burst_type_filter.xml
gsm_dummy_burst_filter.xml
gsm_burst_sdcch_subslot_splitter.xml
gsm_burst_sdcch_subslot_filter.xml

View File

@ -0,0 +1,32 @@
<?xml version="1.0"?>
<block>
<name>Burst Type Filter</name>
<key>gsm_burst_type_filter</key>
<import>import grgsm</import>
<make>grgsm.burst_type_filter($selected_burst_types)</make>
<param>
<name>Selected burst types</name>
<key>selected_burst_types</key>
<value>[0,1,2,3,4,5,6,7]</value>
<type>int_vector</type>
</param>
<sink>
<name>bursts_in</name>
<type>message</type>
<optional>1</optional>
</sink>
<source>
<name>bursts_out</name>
<type>message</type>
<optional>1</optional>
</source>
<doc>
This block filters bursts based on their type.
For more information on burst types, see GSM 05.02.
</doc>
</block>

View File

@ -21,6 +21,14 @@
<block>gsm_clock_offset_control</block>
<block>gsm_input</block>
</cat>
<cat>
<name>Transmitter</name>
<block>gsm_txtime_bursts_tagger</block>
<block>gsm_txtime_setter</block>
<block>gsm_gmsk_mod</block>
<block>gsm_preprocess_tx_burst</block>
<block>gsm_gen_test_ab</block>
</cat>
<cat>
<name>Logical channels demapping</name>
<block>gsm_universal_ctrl_chans_demapper</block>
@ -45,6 +53,7 @@
<block>gsm_burst_timeslot_filter</block>
<block>gsm_burst_sdcch_subslot_filter</block>
<block>gsm_burst_fnr_filter</block>
<block>gsm_burst_type_filter</block>
<block>gsm_dummy_burst_filter</block>
<block>gsm_uplink_downlink_splitter</block>
</cat>
@ -66,6 +75,8 @@
<block>gsm_clock_offset_corrector_tagged</block>
<block>gsm_msg_to_tag.xml</block>
<block>gsm_tmsi_dumper</block>
<block>gsm_trx_burst_if</block>
<block>gsm_burst_to_fn_time</block>
</cat>
</cat>
</cat>

View File

@ -32,6 +32,9 @@ install(FILES
gsm_burst_file_source.xml
gsm_message_file_sink.xml
gsm_message_file_source.xml
gsm_trx_burst_if.xml
gsm_msg_to_tag.xml
gsm_controlled_fractional_resampler_cc.xml DESTINATION share/gnuradio/grc/blocks
gsm_controlled_fractional_resampler_cc.xml
gsm_burst_to_fn_time.xml
DESTINATION share/gnuradio/grc/blocks
)

View File

@ -0,0 +1,19 @@
<?xml version="1.0"?>
<block>
<name>Burst to fn_time</name>
<key>gsm_burst_to_fn_time</key>
<import>import grgsm</import>
<make>grgsm.burst_to_fn_time()</make>
<sink>
<name>bursts_in</name>
<type>message</type>
<optional>1</optional>
</sink>
<source>
<name>fn_time_out</name>
<type>message</type>
<optional>1</optional>
</source>
</block>

View File

@ -0,0 +1,58 @@
<?xml version="1.0"?>
<block>
<name>TRX Burst Interface</name>
<key>gsm_trx_burst_if</key>
<import>import grgsm</import>
<make>grgsm.trx_burst_if($remote_addr, $base_port)</make>
<param>
<name>base_port</name>
<key>base_port</key>
<value>5700</value>
<type>string</type>
</param>
<param>
<name>remote_addr</name>
<key>remote_addr</key>
<value>127.0.0.1</value>
<type>string</type>
</param>
<sink>
<name>bursts</name>
<type>message</type>
<optional>1</optional>
</sink>
<source>
<name>bursts</name>
<type>message</type>
<optional>1</optional>
</source>
<doc>
OsmoTRX like UDP burst interface for external applications.
There are two UDP connections, where each message carries
one radio burst with header. Give a base port B (5700 by default).
One connection at port P=B+100+2 is used for sending received bursts
to an external application. Another one at port P=B+2 is used to
obtain to be transmitted bursts.
Received burst format:
1 byte timeslot index
4 bytes GSM frame number, big endian
1 byte RSSI in -dBm
2 bytes correlator timing offset in 1/256 symbol steps,
2's-comp, big endian
148 bytes soft symbol estimates, 0 -&gt; definite "0",
255 -&gt; definite "1"
To be transmitted burst format:
1 byte timeslot index
4 bytes GSM frame number, big endian
1 byte transmit level wrt ARFCN max, -dB (attenuation)
148 bytes output symbol values, 0 &amp; 1
</doc>
</block>

View File

@ -0,0 +1,27 @@
# Copyright 2011,2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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.
#
# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
install(FILES
gsm_gmsk_mod.xml
gsm_txtime_bursts_tagger.xml
gsm_txtime_setter.xml
gsm_preprocess_tx_burst.xml
gsm_gen_test_ab.xml
DESTINATION share/gnuradio/grc/blocks
)

View File

@ -0,0 +1,19 @@
<?xml version="1.0"?>
<block>
<name>Gen Test AB</name>
<key>gsm_gen_test_ab</key>
<import>import grgsm</import>
<make>grgsm.gen_test_ab()</make>
<sink>
<name>bursts_in</name>
<type>message</type>
<optional>1</optional>
</sink>
<source>
<name>bursts_out</name>
<type>message</type>
<optional>1</optional>
</source>
</block>

View File

@ -0,0 +1,47 @@
<block>
<name>GMSK Modulator for GSM</name>
<key>gsm_gmsk_mod</key>
<import>from grgsm import gsm_gmsk_mod</import>
<make>gsm_gmsk_mod(
BT=$BT,
pulse_duration=$pulse_duration,
sps=$sps,
)</make>
<callback>set_BT($BT)</callback>
<callback>set_pulse_duration($pulse_duration)</callback>
<callback>set_sps($sps)</callback>
<param>
<name>3 dB Time-Bandwidth Product</name>
<key>BT</key>
<value>4</value>
<type>raw</type>
</param>
<param>
<name>Pulse Duration</name>
<key>pulse_duration</key>
<value>4</value>
<type>raw</type>
</param>
<param>
<name>Samples/Symbol</name>
<key>sps</key>
<value>4</value>
<type>raw</type>
</param>
<sink>
<name>in</name>
<type>byte</type>
<vlen>1</vlen>
<optional>1</optional>
</sink>
<source>
<name>out</name>
<type>complex</type>
<vlen>1</vlen>
<optional>1</optional>
</source>
<doc>Piotr Krysik
GMSK Modulator for GSM
</doc>
<grc_source>gr-gsm/hier_blocks/transmitter/gsm_gmsk_mod.grc</grc_source>
</block>

View File

@ -0,0 +1,19 @@
<?xml version="1.0"?>
<block>
<name>Preprocess Tx burst</name>
<key>gsm_preprocess_tx_burst</key>
<import>import grgsm</import>
<make>grgsm.preprocess_tx_burst()</make>
<sink>
<name>bursts_in</name>
<type>message</type>
<optional>1</optional>
</sink>
<source>
<name>bursts_out</name>
<type>message</type>
<optional>1</optional>
</source>
</block>

View File

@ -0,0 +1,69 @@
<?xml version="1.0"?>
<block>
<name>txtime_bursts_tagger</name>
<key>gsm_txtime_bursts_tagger</key>
<import>import grgsm</import>
<make>grgsm.txtime_bursts_tagger($init_fn, $init_time, $time_hint, $timing_advance, $delay_correction)</make>
<callback>set_fn_time_reference($init_fn, $init_time)</callback>
<callback>set_time_hint($time_hint)</callback>
<callback>set_timing_advance($timing_advance)</callback>
<callback>set_delay_correction($delay_correction)</callback>
<param>
<name>init_fn</name>
<key>init_fn</key>
<value>None</value>
<type>raw</type>
<hide>part</hide>
</param>
<param>
<name>init_time</name>
<key>init_time</key>
<value>0</value>
<type>float</type>
<hide>part</hide>
</param>
<param>
<name>time_hint</name>
<key>time_hint</key>
<value>0</value>
<type>float</type>
<hide>part</hide>
</param>
<param>
<name>timing_advance</name>
<key>timing_advance</key>
<value>0</value>
<type>float</type>
<hide>part</hide>
</param>
<param>
<name>delay_correction</name>
<key>delay_correction</key>
<value>0</value>
<type>float</type>
<hide>part</hide>
</param>
<sink>
<name>fn_time</name>
<type>message</type>
<optional>1</optional>
</sink>
<sink>
<name>bursts</name>
<type>message</type>
<optional>1</optional>
</sink>
<source>
<name>bursts</name>
<type>message</type>
<optional>1</optional>
</source>
</block>

View File

@ -0,0 +1,84 @@
<?xml version="1.0"?>
<block>
<name>txtime_setter</name>
<key>gsm_txtime_setter</key>
<import>import grgsm</import>
<make>grgsm.txtime_setter($init_fn if ($init_fn is not None) else 0xffffffff, $init_time_secs, $init_time_fracs, $time_hint_secs, $time_hint_fracs, $timing_advance, $delay_correction)</make>
<callback>set_fn_time_reference($init_fn, $init_time_secs, $init_time_fracs)</callback>
<callback>set_time_hint($time_hint_secs, $time_hint_secs)</callback>
<callback>set_timing_advance($timing_advance)</callback>
<callback>set_delay_correction($delay_correction)</callback>
<param>
<name>init_fn</name>
<key>init_fn</key>
<value>None</value>
<type>raw</type>
<hide>part</hide>
</param>
<param>
<name>init_time_secs</name>
<key>init_time_secs</key>
<value>0</value>
<type>int</type>
<hide>part</hide>
</param>
<param>
<name>init_time_fracs</name>
<key>init_time_fracs</key>
<value>0</value>
<type>float</type>
<hide>part</hide>
</param>
<param>
<name>time_hint_secs</name>
<key>time_hint_secs</key>
<value>0</value>
<type>int</type>
<hide>part</hide>
</param>
<param>
<name>time_hint_fracs</name>
<key>time_hint_fracs</key>
<value>0</value>
<type>float</type>
<hide>part</hide>
</param>
<param>
<name>timing_advance</name>
<key>timing_advance</key>
<value>0</value>
<type>float</type>
<hide>part</hide>
</param>
<param>
<name>delay_correction</name>
<key>delay_correction</key>
<value>0</value>
<type>float</type>
<hide>part</hide>
</param>
<sink>
<name>fn_time</name>
<type>message</type>
<optional>1</optional>
</sink>
<sink>
<name>bursts_in</name>
<type>message</type>
<optional>1</optional>
</sink>
<source>
<name>bursts_out</name>
<type>message</type>
<optional>1</optional>
</source>
</block>

View File

@ -0,0 +1,621 @@
<?xml version='1.0' encoding='utf-8'?>
<?grc format='1' created='3.7.9'?>
<flow_graph>
<timestamp>Wed Sep 20 07:48:30 2017</timestamp>
<block>
<key>options</key>
<param>
<key>author</key>
<value>Piotr Krysik</value>
</param>
<param>
<key>window_size</key>
<value></value>
</param>
<param>
<key>category</key>
<value>Modulators</value>
</param>
<param>
<key>comment</key>
<value></value>
</param>
<param>
<key>description</key>
<value>GMSK Modulator for GSM</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
<key>_coordinate</key>
<value>(8, 8)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
<param>
<key>generate_options</key>
<value>hb</value>
</param>
<param>
<key>hier_block_src_path</key>
<value>.:</value>
</param>
<param>
<key>id</key>
<value>gsm_gmsk_mod</value>
</param>
<param>
<key>max_nouts</key>
<value>0</value>
</param>
<param>
<key>qt_qss_theme</key>
<value></value>
</param>
<param>
<key>realtime_scheduling</key>
<value></value>
</param>
<param>
<key>run_command</key>
<value>{python} -u {filename}</value>
</param>
<param>
<key>run_options</key>
<value>prompt</value>
</param>
<param>
<key>run</key>
<value>True</value>
</param>
<param>
<key>thread_safe_setters</key>
<value></value>
</param>
<param>
<key>title</key>
<value>GMSK Modulator for GSM</value>
</param>
</block>
<block>
<key>parameter</key>
<param>
<key>alias</key>
<value></value>
</param>
<param>
<key>comment</key>
<value></value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
<key>_coordinate</key>
<value>(504, 15)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
<param>
<key>id</key>
<value>BT</value>
</param>
<param>
<key>label</key>
<value>3 dB Time-Bandwidth Product</value>
</param>
<param>
<key>short_id</key>
<value></value>
</param>
<param>
<key>type</key>
<value>eng_float</value>
</param>
<param>
<key>value</key>
<value>4</value>
</param>
</block>
<block>
<key>blocks_float_to_char</key>
<param>
<key>alias</key>
<value></value>
</param>
<param>
<key>comment</key>
<value></value>
</param>
<param>
<key>affinity</key>
<value></value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
<key>_coordinate</key>
<value>(472, 204)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
<param>
<key>id</key>
<value>blocks_float_to_char_0</value>
</param>
<param>
<key>maxoutbuf</key>
<value>0</value>
</param>
<param>
<key>minoutbuf</key>
<value>0</value>
</param>
<param>
<key>scale</key>
<value>1</value>
</param>
<param>
<key>vlen</key>
<value>1</value>
</param>
</block>
<block>
<key>blocks_tagged_stream_multiply_length</key>
<param>
<key>alias</key>
<value></value>
</param>
<param>
<key>comment</key>
<value></value>
</param>
<param>
<key>affinity</key>
<value></value>
</param>
<param>
<key>_enabled</key>
<value>1</value>
</param>
<param>
<key>_coordinate</key>
<value>(848, 209)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
<param>
<key>id</key>
<value>blocks_tagged_stream_multiply_length_0</value>
</param>
<param>
<key>type</key>
<value>complex</value>
</param>
<param>
<key>c</key>
<value>sps</value>
</param>
<param>
<key>lengthtagname</key>
<value>packet_len</value>
</param>
<param>
<key>maxoutbuf</key>
<value>0</value>
</param>
<param>
<key>minoutbuf</key>
<value>0</value>
</param>
<param>
<key>vlen</key>
<value>1</value>
</param>
</block>
<block>
<key>digital_chunks_to_symbols_xx</key>
<param>
<key>alias</key>
<value></value>
</param>
<param>
<key>comment</key>
<value></value>
</param>
<param>
<key>affinity</key>
<value></value>
</param>
<param>
<key>dimension</key>
<value>1</value>
</param>
<param>
<key>_enabled</key>
<value>1</value>
</param>
<param>
<key>_coordinate</key>
<value>(296, 197)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
<param>
<key>id</key>
<value>digital_chunks_to_symbols_xx_0</value>
</param>
<param>
<key>in_type</key>
<value>byte</value>
</param>
<param>
<key>maxoutbuf</key>
<value>0</value>
</param>
<param>
<key>minoutbuf</key>
<value>0</value>
</param>
<param>
<key>num_ports</key>
<value>1</value>
</param>
<param>
<key>out_type</key>
<value>float</value>
</param>
<param>
<key>symbol_table</key>
<value>[1,-1]</value>
</param>
</block>
<block>
<key>digital_diff_decoder_bb</key>
<param>
<key>alias</key>
<value></value>
</param>
<param>
<key>comment</key>
<value></value>
</param>
<param>
<key>affinity</key>
<value></value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
<key>_coordinate</key>
<value>(120, 204)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
<param>
<key>id</key>
<value>digital_diff_decoder_bb_0</value>
</param>
<param>
<key>maxoutbuf</key>
<value>0</value>
</param>
<param>
<key>minoutbuf</key>
<value>0</value>
</param>
<param>
<key>modulus</key>
<value>2</value>
</param>
</block>
<block>
<key>digital_gmskmod_bc</key>
<param>
<key>bt</key>
<value>BT</value>
</param>
<param>
<key>alias</key>
<value></value>
</param>
<param>
<key>comment</key>
<value></value>
</param>
<param>
<key>affinity</key>
<value></value>
</param>
<param>
<key>_enabled</key>
<value>1</value>
</param>
<param>
<key>_coordinate</key>
<value>(616, 190)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
<param>
<key>id</key>
<value>digital_gmskmod_bc_0</value>
</param>
<param>
<key>maxoutbuf</key>
<value>0</value>
</param>
<param>
<key>minoutbuf</key>
<value>0</value>
</param>
<param>
<key>L</key>
<value>pulse_duration</value>
</param>
<param>
<key>samples_per_symbol</key>
<value>sps</value>
</param>
</block>
<block>
<key>import</key>
<param>
<key>alias</key>
<value></value>
</param>
<param>
<key>comment</key>
<value></value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
<key>_coordinate</key>
<value>(712, 28)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
<param>
<key>id</key>
<value>import_0</value>
</param>
<param>
<key>import</key>
<value>from gnuradio.analog import cpm</value>
</param>
</block>
<block>
<key>pad_sink</key>
<param>
<key>comment</key>
<value></value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
<key>_coordinate</key>
<value>(1136, 220)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
<param>
<key>id</key>
<value>pad_sink_0</value>
</param>
<param>
<key>type</key>
<value>complex</value>
</param>
<param>
<key>label</key>
<value>out</value>
</param>
<param>
<key>num_streams</key>
<value>1</value>
</param>
<param>
<key>optional</key>
<value>True</value>
</param>
<param>
<key>vlen</key>
<value>1</value>
</param>
</block>
<block>
<key>pad_source</key>
<param>
<key>comment</key>
<value></value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
<key>_coordinate</key>
<value>(0, 204)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
<param>
<key>id</key>
<value>pad_source_0</value>
</param>
<param>
<key>label</key>
<value>in</value>
</param>
<param>
<key>num_streams</key>
<value>1</value>
</param>
<param>
<key>optional</key>
<value>True</value>
</param>
<param>
<key>type</key>
<value>byte</value>
</param>
<param>
<key>vlen</key>
<value>1</value>
</param>
</block>
<block>
<key>parameter</key>
<param>
<key>alias</key>
<value></value>
</param>
<param>
<key>comment</key>
<value></value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
<key>_coordinate</key>
<value>(376, 14)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
<param>
<key>id</key>
<value>pulse_duration</value>
</param>
<param>
<key>label</key>
<value>Pulse Duration</value>
</param>
<param>
<key>short_id</key>
<value></value>
</param>
<param>
<key>type</key>
<value>eng_float</value>
</param>
<param>
<key>value</key>
<value>4</value>
</param>
</block>
<block>
<key>parameter</key>
<param>
<key>alias</key>
<value></value>
</param>
<param>
<key>comment</key>
<value></value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
<key>_coordinate</key>
<value>(240, 15)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
<param>
<key>id</key>
<value>sps</value>
</param>
<param>
<key>label</key>
<value>Samples/Symbol</value>
</param>
<param>
<key>short_id</key>
<value></value>
</param>
<param>
<key>type</key>
<value>intx</value>
</param>
<param>
<key>value</key>
<value>4</value>
</param>
</block>
<connection>
<source_block_id>blocks_float_to_char_0</source_block_id>
<sink_block_id>digital_gmskmod_bc_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>blocks_tagged_stream_multiply_length_0</source_block_id>
<sink_block_id>pad_sink_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>digital_chunks_to_symbols_xx_0</source_block_id>
<sink_block_id>blocks_float_to_char_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>digital_diff_decoder_bb_0</source_block_id>
<sink_block_id>digital_chunks_to_symbols_xx_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>digital_gmskmod_bc_0</source_block_id>
<sink_block_id>blocks_tagged_stream_multiply_length_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>pad_source_0</source_block_id>
<sink_block_id>digital_diff_decoder_bb_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
</flow_graph>

View File

@ -25,6 +25,7 @@ install(FILES
api.h
gsmtap.h
constants.h
gsm_constants.h
DESTINATION include/grgsm
)
@ -35,3 +36,4 @@ add_subdirectory(receiver)
add_subdirectory(misc_utils)
add_subdirectory(qa_utils)
add_subdirectory(flow_control)
add_subdirectory(transmitter)

View File

@ -27,6 +27,7 @@ install(FILES
burst_timeslot_filter.h
burst_sdcch_subslot_filter.h
burst_fnr_filter.h
burst_type_filter.h
dummy_burst_filter.h
uplink_downlink_splitter.h DESTINATION include/grgsm/flow_control
)

View File

@ -0,0 +1,63 @@
/* -*- c++ -*- */
/* @file
* @author (C) 2017 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.
*
*/
#ifndef INCLUDED_GSM_BURST_TYPE_FILTER_H
#define INCLUDED_GSM_BURST_TYPE_FILTER_H
#include <grgsm/api.h>
#include <gnuradio/block.h>
#include <grgsm/flow_control/common.h>
namespace gr {
namespace gsm {
/*!
* \brief <+description of block+>
* \ingroup gsm
*
*/
class GRGSM_API burst_type_filter : virtual public gr::block
{
public:
typedef boost::shared_ptr<burst_type_filter> sptr;
/*!
* \brief Return a shared_ptr to a new instance of grgsm::burst_type_filter.
*
* To avoid accidental use of raw pointers, grgsm::burst_type_filter's
* constructor is in a private implementation
* class. grgsm::burst_type_filter::make is the public interface for
* creating new instances.
*/
static sptr make(const std::vector<uint8_t> & selected_burst_types);
/* External API */
/* Filtering policy */
virtual filter_policy get_policy(void) = 0;
virtual filter_policy set_policy(filter_policy policy) = 0;
virtual void set_selected_burst_types(const std::vector<uint8_t> & selected_burst_types) = 0;
};
} // namespace gsm
} // namespace gr
#endif /* INCLUDED_GSM_BURST_TYPE_FILTER_H */

View File

@ -28,7 +28,7 @@
#include <gnuradio/block.h>
namespace gr {
namespace grgsm {
namespace gsm {
/*!
* \brief <+description of block+>
@ -51,7 +51,7 @@ namespace gr {
static sptr make();
};
} // namespace grgsm
} // namespace gsm
} // namespace gr
#endif /* INCLUDED_GRGSM_UPLINK_DOWNLINK_SPLITTER_H */

View File

@ -38,6 +38,7 @@
#define USEFUL_BITS 142 //(2*(DATA_BITS+STEALING_BIT) + N_TRAIN_BITS )
#define FCCH_BITS USEFUL_BITS
#define BURST_SIZE (USEFUL_BITS+2*TAIL_BITS)
#define ACCESS_BURST_SIZE 88
#define PROCESSED_CHUNK BURST_SIZE+2*GUARD_PERIOD
#define SCH_DATA_LEN 39

View File

@ -35,5 +35,8 @@ install(FILES
message_printer.h
tmsi_dumper.h
msg_to_tag.h
controlled_fractional_resampler_cc.h DESTINATION include/grgsm/misc_utils
trx_burst_if.h
controlled_fractional_resampler_cc.h
time_spec.h
fn_time.h DESTINATION include/grgsm/misc_utils
)

View File

@ -57,7 +57,7 @@ namespace gr {
virtual void set_resamp_ratio(float resamp_ratio) = 0;
};
} // namespace grgsm
} // namespace gsm
} // namespace gr
#endif /* INCLUDED_GRGSM_CONTROLLED_FRACTIONAL_RESAMPLER_CC_H */

View File

@ -0,0 +1,55 @@
/* -*- c++ -*- */
/* @file
* @author Piotr Krysik <ptrkrysik@gmail.com>
* @author Vadim Yanitskiy <axilirator@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.
*
*/
#ifndef INCLUDED_GRGSM_FN_TIME_H
#define INCLUDED_GRGSM_FN_TIME_H
#include <grgsm/api.h>
#include <stdint.h>
#include <utility>
namespace gr {
namespace gsm {
/**
* Computes difference between reference frame number
* and a second frame number.
* @param fn_ref reference frame number modulo GSM_HYPER_FRAME
* @param fn second frame number modulo GSM_HYPER_FRAME
* @param time_ref precise timestamp of the first sample in the fn_ref
* @param time_hint coarse time for fn that is used as a hint to avoid
* ambiguities caused by modulo operation applied to
* frame numbers
* @return difference between fn_ref and fn
*/
typedef std::pair<unsigned long long, double> time_format;
GRGSM_API time_format fn_time_delta_cpp(uint32_t fn_ref, time_format time_ref, uint32_t fn_x,
time_format time_hint, uint32_t ts_num, uint32_t ts_ref);
} // namespace gsm
} // namespace gr
#endif /* INCLUDED_GRGSM_FN_TIME_H */

View File

@ -50,7 +50,7 @@ namespace gr {
static sptr make();
};
} // namespace grgsm
} // namespace gsm
} // namespace gr
#endif /* INCLUDED_GRGSM_MSG_TO_TAG_H */

View File

@ -0,0 +1,141 @@
//
// Copyright 2010-2012 Ettus Research LLC
//
// This program 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 of the License, or
// (at your option) any later version.
//
// This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
//
#ifndef INCLUDED_TYPES_TIME_SPEC_HPP
#define INCLUDED_TYPES_TIME_SPEC_HPP
#include <grgsm/api.h>
#include <boost/operators.hpp>
#include <ctime>
namespace gr {
namespace gsm {
/*!
* A time_spec_t holds a seconds and a fractional seconds time value.
* Depending upon usage, the time_spec_t can represent absolute times,
* relative times, or time differences (between absolute times).
*
* The time_spec_t provides clock-domain independent time storage,
* but can convert fractional seconds to/from clock-domain specific units.
*
* The fractional seconds are stored as double precision floating point.
* This gives the fractional seconds enough precision to unambiguously
* specify a clock-tick/sample-count up to rates of several petahertz.
*/
class GRGSM_API time_spec_t : boost::additive<time_spec_t>, boost::totally_ordered<time_spec_t>{
public:
/*!
* Copy constructor
*/
time_spec_t(const time_spec_t & spec);
/*!
* Create a time_spec_t from a real-valued seconds count.
* \param secs the real-valued seconds count (default = 0)
*/
time_spec_t(double secs = 0);
/*!
* Create a time_spec_t from whole and fractional seconds.
* \param full_secs the whole/integer seconds count
* \param frac_secs the fractional seconds count (default = 0)
*/