blob: 9e97277f259ec417707b7e0a47260bd4f8fb80a8 [file] [log] [blame]
Piotr Krysik902f4eb2017-09-19 08:04:33 +02001#!/usr/bin/env python2
2# -*- coding: utf-8 -*-
3
4# GR-GSM based transceiver
Piotr Krysikd2f162f2017-11-30 12:50:00 +01005# Extending a GRC flowgraph gr-gsm/examples/trx_radio_if/radio_if_grc.grc
Piotr Krysik902f4eb2017-09-19 08:04:33 +02006#
7# (C) 2016-2017 by Vadim Yanitskiy <axilirator@gmail.com>
Piotr Krysikd2f162f2017-11-30 12:50:00 +01008# (C) 2017 by Piotr Krysik <ptrkrysik@gmail.com>
Piotr Krysik902f4eb2017-09-19 08:04:33 +02009#
10# All Rights Reserved
11#
12# This program is free software; you can redistribute it and/or modify
13# it under the terms of the GNU General Public License as published by
14# the Free Software Foundation; either version 2 of the License, or
15# (at your option) any later version.
16#
17# This program is distributed in the hope that it will be useful,
18# but WITHOUT ANY WARRANTY; without even the implied warranty of
19# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20# GNU General Public License for more details.
21#
22# You should have received a copy of the GNU General Public License along
23# with this program; if not, write to the Free Software Foundation, Inc.,
24# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25
Piotr Krysikd2f162f2017-11-30 12:50:00 +010026from grgsm.trx import radio_if_grc
Piotr Krysik902f4eb2017-09-19 08:04:33 +020027
Piotr Krysikd2f162f2017-11-30 12:50:00 +010028class radio_if(radio_if_grc):
Piotr Krysik902f4eb2017-09-19 08:04:33 +020029 # Application state flags
30 trx_started = False
Vadim Yanitskiy89aa4692017-11-14 00:15:20 +070031
Vadim Yanitskiy790b6f02017-10-17 11:47:36 +070032 def __init__(self, phy_args, phy_sample_rate,
33 phy_rx_gain, phy_tx_gain, phy_ppm,
34 phy_rx_antenna, phy_tx_antenna,
Piotr Krysikd2f162f2017-11-30 12:50:00 +010035 trx_remote_addr, trx_base_port,
36 phy_tx_freq=938900000,
37 phy_rx_freq=938900000-45e6,
38 delay_correction=285.616e-6,
39 uplink_shift=-(6.0/1625000*(156.25)*3),
40 timing_advance=0):
Piotr Krysik902f4eb2017-09-19 08:04:33 +020041
Vadim Yanitskiy790b6f02017-10-17 11:47:36 +070042 print("[i] Init Radio interface")
Piotr Krysik902f4eb2017-09-19 08:04:33 +020043
Piotr Krysikd2f162f2017-11-30 12:50:00 +010044 radio_if_grc.__init__(self,
45 samp_rate=phy_sample_rate,
46 tx_gain=phy_tx_gain, rx_gain=phy_rx_gain,
47 tx_freq=phy_tx_freq, rx_freq=phy_rx_freq,
48 osr=4, ppm=phy_ppm,
49 trx_base_port=str(trx_base_port),
50 trx_remote_addr=trx_remote_addr,
51 delay_correction=delay_correction,
52 uplink_shift=uplink_shift,
53 timing_advance=timing_advance)
Piotr Krysik902f4eb2017-09-19 08:04:33 +020054
55 def shutdown(self):
56 print("[i] Shutdown Radio interface")
57 self.stop()
58 self.wait()
59