Skip to content

Commit

Permalink
Merge branch 'fixeria/trx' of https://github.com/axilirator/gr-gsm in…
Browse files Browse the repository at this point in the history
…to fixeria_trx

# Resolved conflicts:
#	apps/grgsm_trx
#	python/trx/radio_if.py
#	swig/grgsm_swig.i
  • Loading branch information
ptrkrysik committed Apr 17, 2018
2 parents 2ece45f + 0123232 commit 2471052
Show file tree
Hide file tree
Showing 14 changed files with 466 additions and 88 deletions.
6 changes: 3 additions & 3 deletions apps/grgsm_trx
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ class Application:
base_port = 5700

# PHY specific
phy_sample_rate = 4*1625000/6
phy_sample_rate = 4 * 1625000 / 6
phy_tx_antenna = "TX/RX"
phy_rx_antenna = "RX2"
phy_rx_gain = 30
phy_tx_gain = 40
phy_tx_gain = 10
phy_args = ""
phy_ppm = 0

Expand Down Expand Up @@ -101,7 +101,7 @@ class Application:
# PHY specific
s += " Radio interface specific\n" \
" -a --device-args Set device arguments\n" \
" -s --sample-rate Set sample rate (default 2000000)\n" \
" -s --sample-rate Set sample rate\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" \
Expand Down
4 changes: 2 additions & 2 deletions grc/misc_utils/gsm_burst_to_fn_time.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0"?>
<block>
<name>Burst to fn_time</name>
<name>Burst to FN time</name>
<key>gsm_burst_to_fn_time</key>
<import>import grgsm</import>
<make>grgsm.burst_to_fn_time()</make>
<make>grgsm.gsm_burst_to_fn_time()</make>

<sink>
<name>bursts_in</name>
Expand Down
1 change: 1 addition & 0 deletions include/grgsm/misc_utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ install(FILES
tmsi_dumper.h
msg_to_tag.h
trx_burst_if.h
burst_to_fn_time.h
controlled_fractional_resampler_cc.h
time_spec.h
fn_time.h DESTINATION include/grgsm/misc_utils
Expand Down
57 changes: 57 additions & 0 deletions include/grgsm/misc_utils/burst_to_fn_time.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/* -*- c++ -*- */
/* @file
* @author Piotr Krysik <[email protected]>
* @author Vadim Yanitskiy <[email protected]>
* @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_BURST_TO_FN_TIME_H
#define INCLUDED_GRGSM_BURST_TO_FN_TIME_H

#include <grgsm/api.h>
#include <gnuradio/block.h>

namespace gr {
namespace gsm {

/*!
* \brief <+description of block+>
* \ingroup gsm
*
*/
class GRGSM_API burst_to_fn_time : virtual public gr::block
{
public:
typedef boost::shared_ptr<burst_to_fn_time> sptr;

/*!
* \brief Return a shared_ptr to a new instance of grgsm::burst_to_fn_time.
*
* To avoid accidental use of raw pointers, grgsm::burst_to_fn_time's
* constructor is in a private implementation
* class. grgsm::burst_to_fn_time::make is the public interface for
* creating new instances.
*/
static sptr make();
};

} // namespace gsm
} // namespace gr

#endif /* INCLUDED_GRGSM_BURST_TO_FN_TIME_H */
1 change: 1 addition & 0 deletions lib/misc_utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,6 @@ add_sources(
fn_time.cc
udp_socket.cc
trx_burst_if_impl.cc
burst_to_fn_time_impl.cc
)

84 changes: 84 additions & 0 deletions lib/misc_utils/burst_to_fn_time_impl.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/* -*- c++ -*- */
/* @file
* @author Piotr Krysik <[email protected]>
* @author Vadim Yanitskiy <[email protected]>
* @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.
*
*/

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include <gnuradio/io_signature.h>
#include "burst_to_fn_time_impl.h"

namespace gr {
namespace gsm {

burst_to_fn_time::sptr
burst_to_fn_time::make(void)
{
return gnuradio::get_initial_sptr
(new burst_to_fn_time_impl());
}

/*
* The private constructor
*/
burst_to_fn_time_impl::burst_to_fn_time_impl(void)
: gr::block("burst_to_fn_time",
gr::io_signature::make(0, 0, 0),
gr::io_signature::make(0, 0, 0))
{
// Register I/O ports
message_port_register_in(pmt::mp("bursts_in"));
message_port_register_out(pmt::mp("fn_time_out"));

// Bind a port handler
set_msg_handler(pmt::mp("bursts_in"),
boost::bind(&burst_to_fn_time_impl::handle_burst, this, _1));
}

/*
* Our virtual destructor.
*/
burst_to_fn_time_impl::~burst_to_fn_time_impl()
{
}

void
burst_to_fn_time_impl::handle_burst(pmt::pmt_t msg_in)
{
// Obtain fn_time tag from message
pmt::pmt_t blob = pmt::car(msg_in);
pmt::pmt_t fn_time = pmt::dict_ref(blob,
pmt::intern("fn_time"), pmt::PMT_NIL);

// Drop messages without required tag
if (fn_time == pmt::PMT_NIL)
return;

// Compose and send a new message
pmt::pmt_t msg_out = pmt::dict_add(pmt::make_dict(),
pmt::intern("fn_time"), fn_time);
message_port_pub(pmt::mp("fn_time_out"), msg_out);
}

} /* namespace gsm */
} /* namespace gr */
45 changes: 45 additions & 0 deletions lib/misc_utils/burst_to_fn_time_impl.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/* -*- c++ -*- */
/* @file
* @author Piotr Krysik <[email protected]>
* @author Vadim Yanitskiy <[email protected]>
* @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_BURST_TO_FN_TIME_IMPL_H
#define INCLUDED_GRGSM_BURST_TO_FN_TIME_IMPL_H

#include <grgsm/misc_utils/burst_to_fn_time.h>

namespace gr {
namespace gsm {

class burst_to_fn_time_impl : public burst_to_fn_time
{
private:
void handle_burst(pmt::pmt_t msg_in);

public:
burst_to_fn_time_impl(void);
~burst_to_fn_time_impl(void);
};

} // namespace gsm
} // namespace gr

#endif /* INCLUDED_GRGSM_BURST_TO_FN_TIME_IMPL_H */
9 changes: 4 additions & 5 deletions lib/transmitter/txtime_setter_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,14 @@ namespace gr {

void txtime_setter_impl::process_fn_time_reference(pmt::pmt_t msg)
{
pmt::pmt_t not_found = pmt::intern("not_found");
pmt::pmt_t fn_time, time_hint;

fn_time = pmt::dict_ref(msg,
pmt::intern("fn_time"), not_found);
pmt::intern("fn_time"), pmt::PMT_NIL);
time_hint = pmt::dict_ref(msg,
pmt::intern("fn_time"), not_found);
pmt::intern("time_hint"), pmt::PMT_NIL);

if (fn_time != not_found) {
if (fn_time != pmt::PMT_NIL) {
uint32_t fn_ref = static_cast<uint32_t>
(pmt::to_uint64(pmt::car(pmt::car(fn_time))));
uint32_t ts = static_cast<uint32_t>
Expand All @@ -109,7 +108,7 @@ namespace gr {
pmt::cdr(pmt::cdr(fn_time)));

set_fn_time_reference(fn_ref, ts, time_secs, time_fracs);
} else if (time_hint != not_found) {
} else if (time_hint != pmt::PMT_NIL) {
set_time_hint(pmt::to_uint64(pmt::car(fn_time)),
pmt::to_double(pmt::cdr(fn_time)));
}
Expand Down
1 change: 0 additions & 1 deletion python/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
from gsm_gmsk_mod import gsm_gmsk_mod
from fn_time import *
from txtime_bursts_tagger import *
from burst_to_fn_time import *
import arfcn


Expand Down
1 change: 0 additions & 1 deletion python/misc_utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,5 @@ GR_PYTHON_INSTALL(
clock_offset_corrector_tagged.py
hier_block.py
fn_time.py
burst_to_fn_time.py
DESTINATION ${GR_PYTHON_DIR}/grgsm
)
28 changes: 0 additions & 28 deletions python/misc_utils/burst_to_fn_time.py

This file was deleted.

14 changes: 14 additions & 0 deletions python/trx/ctrl_if_bb.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ def parse_cmd(self, request):
if self.tb.trx_started:
print("[i] Stopping transceiver...")
self.tb.trx_started = False
self.tb.set_ta(0)
self.tb.stop()
self.tb.wait()

Expand Down Expand Up @@ -144,6 +145,19 @@ def parse_cmd(self, request):

return (0, [meas_dbm])

# Timing Advance control
elif self.verify_cmd(request, "SETTA", 1):
print("[i] Recv SETTA cmd")

# Check TA range
ta = int(request[1])
if ta < 0 or ta > 63:
print("[!] TA value must be in range: 0..63")
return -1

self.tb.set_ta(ta)
return 0

# Misc
elif self.verify_cmd(request, "ECHO", 0):
print("[i] Recv ECHO cmd")
Expand Down
Loading

0 comments on commit 2471052

Please sign in to comment.