mirror of
https://gitea.osmocom.org/cellular-infrastructure/osmo-trx.git
synced 2025-10-27 18:23:33 +00:00
Compare commits
63 Commits
1.1.1
...
whytek/ocs
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3629017b0d | ||
|
|
6d496c8e15 | ||
|
|
dfc6e5ffc7 | ||
|
|
f8c0c464b8 | ||
|
|
93707d0227 | ||
|
|
5291e8a654 | ||
|
|
7a07de1efd | ||
|
|
fd67262df8 | ||
|
|
0569845a08 | ||
|
|
c69b87f9bd | ||
|
|
a7bf6cd8a4 | ||
|
|
e7f6a27ab6 | ||
|
|
a979f5f32b | ||
|
|
b0e54265ad | ||
|
|
62c9280590 | ||
|
|
1421adbc61 | ||
|
|
dccc82491c | ||
|
|
bf58370675 | ||
|
|
7c84925ea4 | ||
|
|
fd99c6ce05 | ||
|
|
e947db8d98 | ||
|
|
9279e0e123 | ||
|
|
84231bd8b7 | ||
|
|
aebbfe0ee7 | ||
|
|
da7fee8ea8 | ||
|
|
9f2baf3e04 | ||
|
|
0a2a40f43c | ||
|
|
501d053b70 | ||
|
|
0fafe03199 | ||
|
|
9a87d90c1e | ||
|
|
066fd04f47 | ||
|
|
aeaba02e02 | ||
|
|
b7e992703c | ||
|
|
928141b7d6 | ||
|
|
e503c988d8 | ||
|
|
ee2ba19cec | ||
|
|
80d053acb9 | ||
|
|
18a615176e | ||
|
|
25383a3610 | ||
|
|
e2ac20a96e | ||
|
|
62845241a2 | ||
|
|
2ab921812e | ||
|
|
752055c7c1 | ||
|
|
705a348326 | ||
|
|
331c88ae82 | ||
|
|
ca0892d822 | ||
|
|
17e6cd0394 | ||
|
|
a801ae5d94 | ||
|
|
923b4bc9a2 | ||
|
|
0d56d75dbb | ||
|
|
94c5241403 | ||
|
|
e3a2516280 | ||
|
|
1fba10409b | ||
|
|
77f3396d04 | ||
|
|
e0010fa425 | ||
|
|
bfc1d0bed7 | ||
|
|
76ff96e210 | ||
|
|
4e6ec4554d | ||
|
|
e4166be76f | ||
|
|
e7195ac7d0 | ||
|
|
ca6a78e193 | ||
|
|
67aa91b2c0 | ||
|
|
3eed8ebb0d |
2
COPYING
2
COPYING
@@ -666,7 +666,7 @@ For more information on this, and how to apply and follow the GNU AGPL, see
|
||||
=========================================================================
|
||||
|
||||
This marks the end of the AGPLv3 text. The following text is appended to the
|
||||
same file for convience but constituting a distinct document, not part of the
|
||||
same file for convenience but constituting a distinct document, not part of the
|
||||
actual AGPL text and not part of an attempt to create a deriviative work based
|
||||
on the AGPLv3 text.
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ using namespace std;
|
||||
|
||||
|
||||
/**
|
||||
Apply a Galois polymonial to a binary seqeunce.
|
||||
Apply a Galois polymonial to a binary sequence.
|
||||
@param val The input sequence.
|
||||
@param poly The polynomial.
|
||||
@param order The order of the polynomial.
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
// (pat) The elements in the queue are type T*, and
|
||||
// the Fifo class implements the underlying queue.
|
||||
// The default is class PointerFIFO, which does not place any restrictions on the type of T,
|
||||
// and is implemented by allocating auxilliary structures for the queue,
|
||||
// and is implemented by allocating auxiliary structures for the queue,
|
||||
// or SingleLinkedList, which implements the queue using an internal pointer in type T,
|
||||
// which must implement the functional interface of class SingleLinkListNode,
|
||||
// namely: functions T*next() and void setNext(T*).
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0+
|
||||
*
|
||||
* This software is distributed under multiple licenses; see the COPYING file in
|
||||
* the main directory for licensing information for this specific distribuion.
|
||||
* the main directory for licensing information for this specific distribution.
|
||||
*
|
||||
* This software is distributed under the terms of the GNU Affero Public License.
|
||||
* See the COPYING file in the main directory for details.
|
||||
|
||||
@@ -48,9 +48,11 @@ Log::~Log()
|
||||
int neednl = (mlen==0 || mStream.str()[mlen-1] != '\n');
|
||||
const char *fmt = neednl ? "%s\n" : "%s";
|
||||
|
||||
log_mutex_lock_canceldisable(&old_state);
|
||||
/* print related function called inside a C++ destructor, use pthread_setcancelstate() APIs.
|
||||
See osmo-trx commit 86be40b4eb762d5c12e8e3f7388ca9f254e77b36 for more information */
|
||||
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &old_state);
|
||||
LOGPSRC(mCategory, mPriority, filename, line, fmt, mStream.str().c_str());
|
||||
log_mutex_unlock_canceldisable(old_state);
|
||||
pthread_setcancelstate(old_state, NULL);
|
||||
}
|
||||
|
||||
ostringstream& Log::get()
|
||||
|
||||
@@ -58,6 +58,9 @@ extern "C" {
|
||||
#define LOGLV(category, level) \
|
||||
Log(category, level, __BASE_FILE__, __LINE__).get() << "[tid=" << pthread_self() << "] "
|
||||
|
||||
#define LOGSRC(category, level, file, line) \
|
||||
Log(category, level, file, line).get() << "[tid=" << pthread_self() << "] "
|
||||
|
||||
#define LOGCHAN(chan, category, level) \
|
||||
Log(category, LOGL_##level, __BASE_FILE__, __LINE__).get() << "[tid=" << pthread_self() << "][chan=" << chan << "] "
|
||||
|
||||
|
||||
@@ -40,7 +40,9 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
#ifndef HAVE_ATOMIC_OPS
|
||||
pthread_mutex_t atomic_ops_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
#endif
|
||||
|
||||
|
||||
Mutex gStreamLock; ///< Global lock to control access to cout and cerr.
|
||||
|
||||
@@ -28,6 +28,8 @@
|
||||
#ifndef THREADS_H
|
||||
#define THREADS_H
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <pthread.h>
|
||||
#include <iostream>
|
||||
#include <assert.h>
|
||||
@@ -184,12 +186,34 @@ class Thread {
|
||||
}
|
||||
}
|
||||
|
||||
/** Send cancelation to thread */
|
||||
/** Send cancellation to thread */
|
||||
void cancel() { pthread_cancel(mThread); }
|
||||
};
|
||||
|
||||
#ifdef HAVE_ATOMIC_OPS
|
||||
#define osmo_trx_sync_fetch_and_and(ptr, value) __sync_fetch_and_and((ptr), (value))
|
||||
#define osmo_trx_sync_or_and_fetch(ptr, value) __sync_or_and_fetch((ptr), (value))
|
||||
#else
|
||||
extern pthread_mutex_t atomic_ops_mutex;
|
||||
static inline int osmo_trx_sync_fetch_and_and(int *ptr, int value)
|
||||
{
|
||||
pthread_mutex_lock(&atomic_ops_mutex);
|
||||
int tmp = *ptr;
|
||||
*ptr &= value;
|
||||
pthread_mutex_unlock(&atomic_ops_mutex);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
||||
static inline int osmo_trx_sync_or_and_fetch(int *ptr, int value)
|
||||
{
|
||||
int tmp;
|
||||
pthread_mutex_lock(&atomic_ops_mutex);
|
||||
*ptr |= value;
|
||||
tmp = *ptr;
|
||||
pthread_mutex_unlock(&atomic_ops_mutex);
|
||||
return tmp;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// vim: ts=4 sw=4
|
||||
|
||||
@@ -84,7 +84,7 @@ class Timeval {
|
||||
uint32_t usec() const { return mTimespec.tv_nsec / 1000; }
|
||||
uint32_t nsec() const { return mTimespec.tv_nsec; }
|
||||
|
||||
/** Return differnce from other (other-self), in ms. */
|
||||
/** Return difference from other (other-self), in ms. */
|
||||
long delta(const Timeval& other) const;
|
||||
|
||||
/** Elapsed time in ms. */
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
// We cant use Logger.h in this file...
|
||||
// We can't use Logger.h in this file...
|
||||
extern int gVectorDebug;
|
||||
#define BVDEBUG(msg) if (gVectorDebug) {std::cout << msg;}
|
||||
|
||||
@@ -232,7 +232,7 @@ template <class T> class Vector {
|
||||
assert(mStart+span<=mEnd);
|
||||
for (i = 0; i < span; i++, src++, dst++)
|
||||
*dst = *src;
|
||||
/*TODO if not non-trivially copyable type class, optimize:
|
||||
/*TODO if not non-trivially copiable type class, optimize:
|
||||
memcpy(dst,mStart,span*sizeof(T)); */
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,17 @@
|
||||
* See the COPYING file in the main directory for details.
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
#include "config.h"
|
||||
|
||||
/* If HAVE_GETTID, then "_GNU_SOURCE" may need to be defined to use gettid() */
|
||||
#if HAVE_GETTID
|
||||
#define _GNU_SOURCE
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/syscall.h>
|
||||
#include "config.h"
|
||||
|
||||
#include <osmocom/core/logging.h>
|
||||
#include <osmocom/core/utils.h>
|
||||
@@ -35,21 +45,39 @@ static const struct log_info_cat default_categories[] = {
|
||||
.color = NULL,
|
||||
.enabled = 1, .loglevel = LOGL_NOTICE,
|
||||
},
|
||||
[DTRXCLK] = {
|
||||
.name = "DTRXCLK",
|
||||
.description = "TRX Master Clock",
|
||||
.color = NULL,
|
||||
.enabled = 1, .loglevel = LOGL_NOTICE,
|
||||
},
|
||||
[DTRXCTRL] = {
|
||||
.name = "DTRXCTRL",
|
||||
.description = "TRX CTRL interface",
|
||||
.color = "\033[1;33m",
|
||||
.enabled = 1, .loglevel = LOGL_NOTICE,
|
||||
},
|
||||
[DTRXDDL] = {
|
||||
.name = "DTRXDDL",
|
||||
.description = "TRX Data interface Downlink",
|
||||
.color = NULL,
|
||||
.enabled = 1, .loglevel = LOGL_NOTICE,
|
||||
},
|
||||
[DTRXDUL] = {
|
||||
.name = "DTRXDUL",
|
||||
.description = "TRX CTRL interface Uplink",
|
||||
.color = NULL,
|
||||
.enabled = 1, .loglevel = LOGL_NOTICE,
|
||||
},
|
||||
[DDEV] = {
|
||||
.name = "DDEV",
|
||||
.description = "Device/Driver specific code",
|
||||
.color = NULL,
|
||||
.enabled = 1, .loglevel = LOGL_INFO,
|
||||
},
|
||||
[DLMS] = {
|
||||
.name = "DLMS",
|
||||
.description = "Logging from within LimeSuite itself",
|
||||
[DDEVDRV] = {
|
||||
.name = "DDEVDRV",
|
||||
.description = "Logging from external device driver library implementing lower level specifics",
|
||||
.color = NULL,
|
||||
.enabled = 1, .loglevel = LOGL_NOTICE,
|
||||
},
|
||||
@@ -60,48 +88,14 @@ const struct log_info log_info = {
|
||||
.num_cat = ARRAY_SIZE(default_categories),
|
||||
};
|
||||
|
||||
pthread_mutex_t log_mutex;
|
||||
|
||||
bool log_mutex_init() {
|
||||
int rc;
|
||||
pthread_mutexattr_t attr;
|
||||
|
||||
if ((rc = pthread_mutexattr_init(&attr))) {
|
||||
fprintf(stderr, "pthread_mutexattr_init() failed: %d\n", rc);
|
||||
return false;
|
||||
}
|
||||
if ((rc = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE))) {
|
||||
fprintf(stderr, "pthread_mutexattr_settype() failed: %d\n", rc);
|
||||
return false;
|
||||
}
|
||||
if ((rc = pthread_mutex_init(&log_mutex, &attr))) {
|
||||
fprintf(stderr, "pthread_mutex_init() failed: %d\n", rc);
|
||||
return false;
|
||||
}
|
||||
if ((rc = pthread_mutexattr_destroy(&attr))) {
|
||||
fprintf(stderr, "pthread_mutexattr_destroy() failed: %d\n", rc);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
/* FIXME: do we need to call pthread_mutex_destroy() during process exit? */
|
||||
}
|
||||
|
||||
/* If called inside a C++ destructor, use log_mutex_(un)lock_canceldisable() APIs instead.
|
||||
See osmo-trx commit 86be40b4eb762d5c12e8e3f7388ca9f254e77b36 for more information */
|
||||
void log_mutex_lock() {
|
||||
OSMO_ASSERT(!pthread_mutex_lock(&log_mutex));
|
||||
}
|
||||
|
||||
void log_mutex_unlock() {
|
||||
OSMO_ASSERT(!pthread_mutex_unlock(&log_mutex));
|
||||
}
|
||||
|
||||
void log_mutex_lock_canceldisable(int *st) {
|
||||
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, st);
|
||||
log_mutex_lock();
|
||||
}
|
||||
|
||||
void log_mutex_unlock_canceldisable(int st) {
|
||||
log_mutex_unlock();
|
||||
pthread_setcancelstate(st, NULL);
|
||||
pid_t my_gettid(void)
|
||||
{
|
||||
#if HAVE_GETTID
|
||||
return gettid();
|
||||
#elif defined(LINUX) && defined(__NR_gettid)
|
||||
return (pid_t) syscall(__NR_gettid);
|
||||
#else
|
||||
#pragma message ("use pid as tid")
|
||||
return getpid();
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <pthread.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <osmocom/core/logging.h>
|
||||
|
||||
@@ -10,26 +10,20 @@ extern const struct log_info log_info;
|
||||
/* Debug Areas of the code */
|
||||
enum {
|
||||
DMAIN,
|
||||
DTRXCLK,
|
||||
DTRXCTRL,
|
||||
DTRXDDL,
|
||||
DTRXDUL,
|
||||
DDEV,
|
||||
DLMS,
|
||||
DDEVDRV,
|
||||
};
|
||||
|
||||
|
||||
bool log_mutex_init();
|
||||
void log_mutex_lock();
|
||||
void log_mutex_unlock();
|
||||
void log_mutex_lock_canceldisable(int *st);
|
||||
void log_mutex_unlock_canceldisable(int st);
|
||||
pid_t my_gettid(void);
|
||||
|
||||
#define CLOGC(category, level, fmt, args...) do { \
|
||||
log_mutex_lock(); \
|
||||
LOGP(category, level, "[tid=%lu] " fmt, pthread_self(), ##args); \
|
||||
log_mutex_unlock(); \
|
||||
LOGP(category, level, "[tid=%ld] " fmt, (long int) my_gettid(), ##args); \
|
||||
} while(0)
|
||||
|
||||
#define CLOGCHAN(chan, category, level, fmt, args...) do { \
|
||||
log_mutex_lock(); \
|
||||
LOGP(category, level, "[tid=%lu][chan=%lu] " fmt, pthread_self(), chan, ##args); \
|
||||
log_mutex_unlock(); \
|
||||
LOGP(category, level, "[tid=%ld][chan=%zu] " fmt, (long int) my_gettid(), chan, ##args); \
|
||||
} while(0)
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
* That signal is processed here in device_sig_cb, where a copy of the "struct
|
||||
* device_counters" structure is held and the main thread is instructed through
|
||||
* a timerfd to update rate_ctr APIs against this copy. All this is done inside
|
||||
* a mutex to avoid different race conditons (between Rx andTx threads, and
|
||||
* a mutex to avoid different race conditions (between Rx andTx threads, and
|
||||
* between Rx/Tx and main thread). For the same reason, callers of signal
|
||||
* <SS_DEVICE,S_DEVICE_COUNTER_CHANGE> (device_sig_cb), that is Rx/Tx threads,
|
||||
* must do so with PTHREAD_CANCEL_DISABLE, in order to avoid possible deadlocks
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <osmocom/core/rate_ctr.h>
|
||||
|
||||
#include <osmocom/vty/command.h>
|
||||
#include <osmocom/vty/logging.h>
|
||||
#include <osmocom/vty/vty.h>
|
||||
#include <osmocom/vty/misc.h>
|
||||
|
||||
@@ -41,22 +42,32 @@
|
||||
|
||||
static struct trx_ctx* g_trx_ctx;
|
||||
|
||||
static const struct value_string clock_ref_names[] = {
|
||||
const struct value_string clock_ref_names[] = {
|
||||
{ REF_INTERNAL, "internal" },
|
||||
{ REF_EXTERNAL, "external" },
|
||||
{ REF_GPS, "gpsdo" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static const struct value_string filler_names[] = {
|
||||
{ FILLER_DUMMY, "Dummy bursts" },
|
||||
{ FILLER_ZERO, "Disabled" },
|
||||
{ FILLER_NORM_RAND, "Normal bursts with random payload" },
|
||||
{ FILLER_EDGE_RAND, "EDGE bursts with random payload" },
|
||||
{ FILLER_ACCESS_RAND, "Access bursts with random payload" },
|
||||
const struct value_string filler_names[] = {
|
||||
{ FILLER_DUMMY, "Dummy bursts (C0 only)" },
|
||||
{ FILLER_ZERO, "Empty bursts" },
|
||||
{ FILLER_NORM_RAND, "GMSK Normal Bursts with random payload" },
|
||||
{ FILLER_EDGE_RAND, "8-PSK Normal Bursts with random payload" },
|
||||
{ FILLER_ACCESS_RAND, "Access Bursts with random payload" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static const struct value_string filler_types[] = {
|
||||
{ FILLER_DUMMY, "dummy" },
|
||||
{ FILLER_ZERO, "zero" },
|
||||
{ FILLER_NORM_RAND, "random-nb-gmsk" },
|
||||
{ FILLER_EDGE_RAND, "random-nb-8psk" },
|
||||
{ FILLER_ACCESS_RAND, "random-ab" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
|
||||
struct trx_ctx *trx_from_vty(struct vty *v)
|
||||
{
|
||||
/* It can't hurt to force callers to continue to pass the vty instance
|
||||
@@ -172,57 +183,10 @@ DEFUN(cfg_rx_sps, cfg_rx_sps_cmd,
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN(cfg_test_rtsc, cfg_test_rtsc_cmd,
|
||||
"test rtsc <0-7>",
|
||||
"Set the Random Normal Burst test mode with TSC\n"
|
||||
"TSC\n")
|
||||
{
|
||||
struct trx_ctx *trx = trx_from_vty(vty);
|
||||
|
||||
if (trx->cfg.rach_delay_set) {
|
||||
vty_out(vty, "rach-delay and rtsc options are mutual-exclusive%s",
|
||||
VTY_NEWLINE);
|
||||
return CMD_WARNING;
|
||||
}
|
||||
|
||||
trx->cfg.rtsc_set = true;
|
||||
trx->cfg.rtsc = atoi(argv[0]);
|
||||
if (!trx->cfg.egprs) /* Don't override egprs which sets different filler */
|
||||
trx->cfg.filler = FILLER_NORM_RAND;
|
||||
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN(cfg_test_rach_delay, cfg_test_rach_delay_cmd,
|
||||
"test rach-delay <0-68>",
|
||||
"Set the Random Access Burst test mode with delay\n"
|
||||
"RACH delay\n")
|
||||
{
|
||||
struct trx_ctx *trx = trx_from_vty(vty);
|
||||
|
||||
if (trx->cfg.rtsc_set) {
|
||||
vty_out(vty, "rach-delay and rtsc options are mutual-exclusive%s",
|
||||
VTY_NEWLINE);
|
||||
return CMD_WARNING;
|
||||
}
|
||||
|
||||
if (trx->cfg.egprs) {
|
||||
vty_out(vty, "rach-delay and egprs options are mutual-exclusive%s",
|
||||
VTY_NEWLINE);
|
||||
return CMD_WARNING;
|
||||
}
|
||||
|
||||
trx->cfg.rach_delay_set = true;
|
||||
trx->cfg.rach_delay = atoi(argv[0]);
|
||||
trx->cfg.filler = FILLER_ACCESS_RAND;
|
||||
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN(cfg_clock_ref, cfg_clock_ref_cmd,
|
||||
"clock-ref (internal|external|gpsdo)",
|
||||
"Set the Reference Clock\n"
|
||||
"Enable internal referece (default)\n"
|
||||
"Enable internal reference (default)\n"
|
||||
"Enable external 10 MHz reference\n"
|
||||
"Enable GPSDO reference\n")
|
||||
{
|
||||
@@ -305,7 +269,6 @@ DEFUN(cfg_egprs, cfg_egprs_cmd,
|
||||
trx->cfg.egprs = false;
|
||||
} else if (strcmp("enable", argv[0]) == 0) {
|
||||
trx->cfg.egprs = true;
|
||||
trx->cfg.filler = FILLER_EDGE_RAND;
|
||||
} else {
|
||||
return CMD_WARNING;
|
||||
}
|
||||
@@ -352,14 +315,57 @@ DEFUN(cfg_stack_size, cfg_stack_size_cmd,
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN(cfg_filler, cfg_filler_cmd,
|
||||
"filler dummy",
|
||||
"Enable C0 filler table\n"
|
||||
"Dummy method\n")
|
||||
DEFUN(cfg_filler, cfg_filler_type_cmd,
|
||||
"filler type (zero|dummy|random-nb-gmsk|random-nb-8psk|random-ab)",
|
||||
"Filler burst settings\n"
|
||||
"Filler burst type (default=zero)\n"
|
||||
"Send an empty burst when there is nothing to send (default)\n"
|
||||
"Send a dummy burst when there is nothing to send on C0 (TRX0) and empty burst on other channels."
|
||||
" Use for OpenBTS compatibility only, don't use with OsmoBTS as it breaks encryption.\n"
|
||||
"Send a GMSK modulated Normal Burst with random bits when there is nothing to send."
|
||||
" Use for spectrum mask testing. Configure 'filler tsc' to set training sequence.\n"
|
||||
"Send an 8-PSK modulated Normal Burst with random bits when there is nothing to send."
|
||||
" Use for spectrum mask testing. Configure 'filler tsc' to set training sequence.\n"
|
||||
"Send an Access Burst with random bits when there is nothing to send. Use for Rx/Tx alignment."
|
||||
" Configure 'filler access-burst-delay' to introduce artificial delay.\n"
|
||||
)
|
||||
{
|
||||
struct trx_ctx *trx = trx_from_vty(vty);
|
||||
// trx->cfg.filler is unsigned, so we need an interim int var to detect errors
|
||||
int type = get_string_value(filler_types, argv[0]);
|
||||
|
||||
if (type < 0) {
|
||||
trx->cfg.filler = FILLER_ZERO;
|
||||
return CMD_WARNING;
|
||||
}
|
||||
trx->cfg.filler = type;
|
||||
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN(cfg_test_rtsc, cfg_filler_tsc_cmd,
|
||||
"filler tsc <0-7>",
|
||||
"Filler burst settings\n"
|
||||
"Set the TSC for GMSK/8-PSK Normal Burst random fillers. Used only with 'random-nb-gmsk' and"
|
||||
" 'random-nb-8psk' filler types. (default=0)\n"
|
||||
"TSC\n")
|
||||
{
|
||||
struct trx_ctx *trx = trx_from_vty(vty);
|
||||
|
||||
trx->cfg.filler = FILLER_DUMMY;
|
||||
trx->cfg.rtsc = atoi(argv[0]);
|
||||
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN(cfg_test_rach_delay, cfg_filler_rach_delay_cmd,
|
||||
"filler access-burst-delay <0-68>",
|
||||
"Filler burst settings\n"
|
||||
"Set the delay for Access Burst random fillers. Used only with 'random-ab' filler type. (default=0)\n"
|
||||
"RACH delay in symbols\n")
|
||||
{
|
||||
struct trx_ctx *trx = trx_from_vty(vty);
|
||||
|
||||
trx->cfg.rach_delay = atoi(argv[0]);
|
||||
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
@@ -547,10 +553,6 @@ static int config_write_trx(struct vty *vty)
|
||||
vty_out(vty, " tx-sps %u%s", trx->cfg.tx_sps, VTY_NEWLINE);
|
||||
if (trx->cfg.rx_sps != DEFAULT_RX_SPS)
|
||||
vty_out(vty, " rx-sps %u%s", trx->cfg.rx_sps, VTY_NEWLINE);
|
||||
if (trx->cfg.rtsc_set)
|
||||
vty_out(vty, " test rtsc %u%s", trx->cfg.rtsc, VTY_NEWLINE);
|
||||
if (trx->cfg.rach_delay_set)
|
||||
vty_out(vty, " test rach-delay %u%s", trx->cfg.rach_delay, VTY_NEWLINE);
|
||||
if (trx->cfg.clock_ref != REF_INTERNAL)
|
||||
vty_out(vty, " clock-ref %s%s", get_value_string(clock_ref_names, trx->cfg.clock_ref), VTY_NEWLINE);
|
||||
vty_out(vty, " multi-arfcn %s%s", trx->cfg.multi_arfcn ? "enable" : "disable", VTY_NEWLINE);
|
||||
@@ -563,6 +565,12 @@ static int config_write_trx(struct vty *vty)
|
||||
vty_out(vty, " ext-rach %s%s", trx->cfg.ext_rach ? "enable" : "disable", VTY_NEWLINE);
|
||||
if (trx->cfg.sched_rr != 0)
|
||||
vty_out(vty, " rt-prio %u%s", trx->cfg.sched_rr, VTY_NEWLINE);
|
||||
if (trx->cfg.filler != FILLER_ZERO)
|
||||
vty_out(vty, " filler type %s%s", get_value_string(filler_types, trx->cfg.filler), VTY_NEWLINE);
|
||||
if (trx->cfg.rtsc > 0)
|
||||
vty_out(vty, " filler tsc %u%s", trx->cfg.rtsc, VTY_NEWLINE);
|
||||
if (trx->cfg.rach_delay > 0)
|
||||
vty_out(vty, " filler access-burst-delay %u%s", trx->cfg.rach_delay, VTY_NEWLINE);
|
||||
if (trx->cfg.stack_size != 0)
|
||||
vty_out(vty, " stack-size %u%s", trx->cfg.stack_size, VTY_NEWLINE);
|
||||
trx_rate_ctr_threshold_write_config(vty, " ");
|
||||
@@ -590,11 +598,9 @@ static void trx_dump_vty(struct vty *vty, struct trx_ctx *trx)
|
||||
vty_out(vty, " Device args: %s%s", trx->cfg.dev_args, VTY_NEWLINE);
|
||||
vty_out(vty, " Tx Samples-per-Symbol: %u%s", trx->cfg.tx_sps, VTY_NEWLINE);
|
||||
vty_out(vty, " Rx Samples-per-Symbol: %u%s", trx->cfg.rx_sps, VTY_NEWLINE);
|
||||
vty_out(vty, " Test Mode: TSC: %u (%s)%s", trx->cfg.rtsc,
|
||||
trx->cfg.rtsc_set ? "Enabled" : "Disabled", VTY_NEWLINE);
|
||||
vty_out(vty, " Test Mode: RACH Delay: %u (%s)%s", trx->cfg.rach_delay,
|
||||
trx->cfg.rach_delay_set ? "Enabled" : "Disabled", VTY_NEWLINE);
|
||||
vty_out(vty, " C0 Filler Table: %s%s", get_value_string(filler_names, trx->cfg.filler), VTY_NEWLINE);
|
||||
vty_out(vty, " Filler Burst Type: %s%s", get_value_string(filler_names, trx->cfg.filler), VTY_NEWLINE);
|
||||
vty_out(vty, " Filler Burst TSC: %u%s", trx->cfg.rtsc, VTY_NEWLINE);
|
||||
vty_out(vty, " Filler Burst RACH Delay: %u%s", trx->cfg.rach_delay, VTY_NEWLINE);
|
||||
vty_out(vty, " Clock Reference: %s%s", get_value_string(clock_ref_names, trx->cfg.clock_ref), VTY_NEWLINE);
|
||||
vty_out(vty, " Multi-Carrier: %s%s", trx->cfg.multi_arfcn ? "Enabled" : "Disabled", VTY_NEWLINE);
|
||||
vty_out(vty, " Tuning offset: %f%s", trx->cfg.offset, VTY_NEWLINE);
|
||||
@@ -663,6 +669,7 @@ static int trx_vty_go_parent(struct vty *vty)
|
||||
static const char trx_copyright[] =
|
||||
"Copyright (C) 2007-2014 Free Software Foundation, Inc.\r\n"
|
||||
"Copyright (C) 2013 Thomas Tsou <tom@tsou.cc>\r\n"
|
||||
"Copyright (C) 2013-2019 Fairwaves, Inc.\r\n"
|
||||
"Copyright (C) 2015 Ettus Research LLC\r\n"
|
||||
"Copyright (C) 2017-2018 by sysmocom s.f.m.c. GmbH <info@sysmocom.de>\r\n"
|
||||
"License AGPLv3+: GNU AGPL version 3 or later <http://gnu.org/licenses/agpl-3.0.html>\r\n"
|
||||
@@ -705,8 +712,6 @@ int trx_vty_init(struct trx_ctx* trx)
|
||||
install_element(TRX_NODE, &cfg_dev_args_cmd);
|
||||
install_element(TRX_NODE, &cfg_tx_sps_cmd);
|
||||
install_element(TRX_NODE, &cfg_rx_sps_cmd);
|
||||
install_element(TRX_NODE, &cfg_test_rtsc_cmd);
|
||||
install_element(TRX_NODE, &cfg_test_rach_delay_cmd);
|
||||
install_element(TRX_NODE, &cfg_clock_ref_cmd);
|
||||
install_element(TRX_NODE, &cfg_multi_arfcn_cmd);
|
||||
install_element(TRX_NODE, &cfg_offset_cmd);
|
||||
@@ -715,7 +720,9 @@ int trx_vty_init(struct trx_ctx* trx)
|
||||
install_element(TRX_NODE, &cfg_egprs_cmd);
|
||||
install_element(TRX_NODE, &cfg_ext_rach_cmd);
|
||||
install_element(TRX_NODE, &cfg_rt_prio_cmd);
|
||||
install_element(TRX_NODE, &cfg_filler_cmd);
|
||||
install_element(TRX_NODE, &cfg_filler_type_cmd);
|
||||
install_element(TRX_NODE, &cfg_filler_tsc_cmd);
|
||||
install_element(TRX_NODE, &cfg_filler_rach_delay_cmd);
|
||||
install_element(TRX_NODE, &cfg_ctr_error_threshold_cmd);
|
||||
install_element(TRX_NODE, &cfg_no_ctr_error_threshold_cmd);
|
||||
install_element(TRX_NODE, &cfg_stack_size_cmd);
|
||||
@@ -725,5 +732,7 @@ int trx_vty_init(struct trx_ctx* trx)
|
||||
install_element(CHAN_NODE, &cfg_chan_rx_path_cmd);
|
||||
install_element(CHAN_NODE, &cfg_chan_tx_path_cmd);
|
||||
|
||||
logging_vty_add_deprecated_subsys(g_trx_ctx, "lms");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
#include "config_defs.h"
|
||||
|
||||
extern struct vty_app_info g_vty_info;
|
||||
extern const struct value_string clock_ref_names[];
|
||||
extern const struct value_string filler_names[];
|
||||
|
||||
/* Maximum number of physical RF channels */
|
||||
#define TRX_CHAN_MAX 8
|
||||
@@ -51,9 +53,7 @@ struct trx_ctx {
|
||||
unsigned int tx_sps;
|
||||
unsigned int rx_sps;
|
||||
unsigned int rtsc;
|
||||
bool rtsc_set;
|
||||
unsigned int rach_delay;
|
||||
bool rach_delay_set;
|
||||
enum ReferenceType clock_ref;
|
||||
enum FillerType filler;
|
||||
bool multi_arfcn;
|
||||
|
||||
@@ -98,7 +98,7 @@ bool Channelizer::rotate(const float *in, size_t len)
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Setup channelizer paramaters */
|
||||
/* Setup channelizer parameters */
|
||||
Channelizer::Channelizer(size_t m, size_t blockLen, size_t hLen)
|
||||
: ChannelizerBase(m, blockLen, hLen)
|
||||
{
|
||||
|
||||
@@ -225,7 +225,7 @@ bool ChannelizerBase::checkLen(size_t innerLen, size_t outerLen)
|
||||
}
|
||||
|
||||
/*
|
||||
* Setup channelizer paramaters
|
||||
* Setup channelizer parameters
|
||||
*/
|
||||
ChannelizerBase::ChannelizerBase(size_t m, size_t blockLen, size_t hLen)
|
||||
: subFilters(NULL), hInputs(NULL), hOutputs(NULL), hist(NULL),
|
||||
|
||||
@@ -32,7 +32,7 @@ protected:
|
||||
/* Buffer length validity checking */
|
||||
bool checkLen(size_t innerLen, size_t outerLen);
|
||||
public:
|
||||
/* Initilize channelizer/synthesis filter internals */
|
||||
/* Initialize channelizer/synthesis filter internals */
|
||||
bool init();
|
||||
};
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ unlike the built-in complex<> templates, these inline most operations for speed
|
||||
/*
|
||||
* Copyright 2008 Free Software Foundation, Inc.
|
||||
*
|
||||
* This software is distributed under multiple licenses; see the COPYING file in the main directory for licensing information for this specific distribuion.
|
||||
* This software is distributed under multiple licenses; see the COPYING file in the main directory for licensing information for this specific distribution.
|
||||
*
|
||||
* This use of this software may be subject to additional restrictions.
|
||||
* See the LEGAL file in the main directory for details.
|
||||
|
||||
@@ -35,12 +35,12 @@ public:
|
||||
Resampler(size_t p, size_t q, size_t filt_len = 16);
|
||||
~Resampler();
|
||||
|
||||
/* Initilize resampler filterbank.
|
||||
/* Initialize resampler filterbank.
|
||||
* @param bw bandwidth factor on filter generation (pre-window)
|
||||
* @return false on error, zero otherwise
|
||||
*
|
||||
* Automatic setting is to compute the filter to prevent aliasing with
|
||||
* a Blackman-Harris window. Adjustment is made through a bandwith
|
||||
* a Blackman-Harris window. Adjustment is made through a bandwidth
|
||||
* factor to shift the cutoff and/or the constituent filter lengths.
|
||||
* Calculation of specific rolloff factors or 3-dB cutoff points is
|
||||
* left as an excersize for the reader.
|
||||
|
||||
@@ -151,9 +151,11 @@ Transceiver::~Transceiver()
|
||||
close(mClockSocket);
|
||||
|
||||
for (size_t i = 0; i < mChans; i++) {
|
||||
mControlServiceLoopThreads[i]->cancel();
|
||||
mControlServiceLoopThreads[i]->join();
|
||||
delete mControlServiceLoopThreads[i];
|
||||
if (mControlServiceLoopThreads[i]) {
|
||||
mControlServiceLoopThreads[i]->cancel();
|
||||
mControlServiceLoopThreads[i]->join();
|
||||
delete mControlServiceLoopThreads[i];
|
||||
}
|
||||
|
||||
mTxPriorityQueues[i].clear();
|
||||
if (mCtrlSockets[i] >= 0)
|
||||
@@ -178,12 +180,12 @@ bool Transceiver::init(FillerType filler, size_t rtsc, unsigned rach_delay,
|
||||
int d_srcport, d_dstport, c_srcport, c_dstport;
|
||||
|
||||
if (!mChans) {
|
||||
LOG(ALERT) << "No channels assigned";
|
||||
LOG(FATAL) << "No channels assigned";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!sigProcLibSetup()) {
|
||||
LOG(ALERT) << "Failed to initialize signal processing library";
|
||||
LOG(FATAL) << "Failed to initialize signal processing library";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -210,6 +212,8 @@ bool Transceiver::init(FillerType filler, size_t rtsc, unsigned rach_delay,
|
||||
mLocalAddr.c_str(), mBasePort,
|
||||
mRemoteAddr.c_str(), mBasePort + 100,
|
||||
OSMO_SOCK_F_BIND | OSMO_SOCK_F_CONNECT);
|
||||
if (mClockSocket < 0)
|
||||
return false;
|
||||
|
||||
for (size_t i = 0; i < mChans; i++) {
|
||||
c_srcport = mBasePort + 2 * i + 1;
|
||||
@@ -281,7 +285,7 @@ bool Transceiver::start()
|
||||
mLatencyUpdateTime = time;
|
||||
|
||||
if (!mRadioInterface->start()) {
|
||||
LOG(ALERT) << "Device failed to start";
|
||||
LOG(FATAL) << "Device failed to start";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -367,12 +371,12 @@ void Transceiver::addRadioVector(size_t chan, BitVector &bits,
|
||||
radioVector *radio_burst;
|
||||
|
||||
if (chan >= mTxPriorityQueues.size()) {
|
||||
LOG(ALERT) << "Invalid channel " << chan;
|
||||
LOGCHAN(chan, DTRXDDL, FATAL) << "Invalid channel";
|
||||
return;
|
||||
}
|
||||
|
||||
if (wTime.TN() > 7) {
|
||||
LOG(ALERT) << "Received burst with invalid slot " << wTime.TN();
|
||||
LOGCHAN(chan, DTRXDDL, FATAL) << "Received burst with invalid slot " << wTime.TN();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -415,7 +419,7 @@ void Transceiver::pushRadioVector(GSM::Time &nowTime)
|
||||
state = &mStates[i];
|
||||
|
||||
while ((burst = mTxPriorityQueues[i].getStaleBurst(nowTime))) {
|
||||
LOGCHAN(i, DMAIN, NOTICE) << "dumping STALE burst in TRX->SDR interface ("
|
||||
LOGCHAN(i, DTRXDDL, NOTICE) << "dumping STALE burst in TRX->SDR interface ("
|
||||
<< burst->getTime() <<" vs " << nowTime << "), retrans=" << state->mRetrans;
|
||||
if (state->mRetrans)
|
||||
updateFillerTable(i, burst);
|
||||
@@ -554,8 +558,8 @@ CorrType Transceiver::expectedCorrType(GSM::Time currTime,
|
||||
return mExtRACH ? EXT_RACH : RACH;
|
||||
else if ((mod52 == 25) || (mod52 == 51))
|
||||
return IDLE;
|
||||
else
|
||||
return TSC;
|
||||
else /* Enable 8-PSK burst detection if EDGE is enabled */
|
||||
return mEdge ? EDGE : TSC;
|
||||
break;
|
||||
}
|
||||
case LOOPBACK:
|
||||
@@ -583,8 +587,11 @@ void writeToFile(radioVector *radio_burst, size_t chan)
|
||||
/*
|
||||
* Pull bursts from the FIFO and handle according to the slot
|
||||
* and burst correlation type. Equalzation is currently disabled.
|
||||
* returns 0 on success (bi filled), negative on error (bi content undefined):
|
||||
* -ENOENT: timeslot is off (fn and tn in bi are filled),
|
||||
* -EIO: read error
|
||||
*/
|
||||
bool Transceiver::pullRadioVector(size_t chan, struct trx_ul_burst_ind *bi)
|
||||
int Transceiver::pullRadioVector(size_t chan, struct trx_ul_burst_ind *bi)
|
||||
{
|
||||
int rc;
|
||||
struct estim_burst_params ebp;
|
||||
@@ -598,30 +605,15 @@ bool Transceiver::pullRadioVector(size_t chan, struct trx_ul_burst_ind *bi)
|
||||
|
||||
/* Blocking FIFO read */
|
||||
radioVector *radio_burst = mReceiveFIFO[chan]->read();
|
||||
if (!radio_burst)
|
||||
return false;
|
||||
if (!radio_burst) {
|
||||
LOGCHAN(chan, DTRXDUL, ERROR) << "ReceiveFIFO->read() returned no burst";
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
/* Set time and determine correlation type */
|
||||
burstTime = radio_burst->getTime();
|
||||
CorrType type = expectedCorrType(burstTime, chan);
|
||||
|
||||
/* Enable 8-PSK burst detection if EDGE is enabled */
|
||||
if (mEdge && (type == TSC))
|
||||
type = EDGE;
|
||||
|
||||
/* Debug: dump bursts to disk */
|
||||
/* bits 0-7 - chan 0 timeslots
|
||||
* bits 8-15 - chan 1 timeslots */
|
||||
if (mWriteBurstToDiskMask & ((1<<bi->tn) << (8*chan)))
|
||||
writeToFile(radio_burst, chan);
|
||||
|
||||
/* No processing if the timeslot is off.
|
||||
* Not even power level or noise calculation. */
|
||||
if (type == OFF) {
|
||||
delete radio_burst;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Initialize struct bi */
|
||||
bi->nbits = 0;
|
||||
bi->fn = burstTime.FN();
|
||||
@@ -635,6 +627,19 @@ bool Transceiver::pullRadioVector(size_t chan, struct trx_ul_burst_ind *bi)
|
||||
bi->tsc = 0;
|
||||
bi->ci = 0.0;
|
||||
|
||||
/* Debug: dump bursts to disk */
|
||||
/* bits 0-7 - chan 0 timeslots
|
||||
* bits 8-15 - chan 1 timeslots */
|
||||
if (mWriteBurstToDiskMask & ((1<<bi->tn) << (8*chan)))
|
||||
writeToFile(radio_burst, chan);
|
||||
|
||||
/* No processing if the timeslot is off.
|
||||
* Not even power level or noise calculation. */
|
||||
if (type == OFF) {
|
||||
delete radio_burst;
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
/* Select the diversity channel with highest energy */
|
||||
for (size_t i = 0; i < radio_burst->chans(); i++) {
|
||||
float pow = energyDetect(*radio_burst->getVector(i), 20 * mSPSRx);
|
||||
@@ -646,7 +651,7 @@ bool Transceiver::pullRadioVector(size_t chan, struct trx_ul_burst_ind *bi)
|
||||
}
|
||||
|
||||
if (max_i < 0) {
|
||||
LOG(ALERT) << "Received empty burst";
|
||||
LOGCHAN(chan, DTRXDUL, FATAL) << "Received empty burst";
|
||||
goto ret_idle;
|
||||
}
|
||||
|
||||
@@ -673,9 +678,9 @@ bool Transceiver::pullRadioVector(size_t chan, struct trx_ul_burst_ind *bi)
|
||||
rc = detectAnyBurst(*burst, mTSC, BURST_THRESH, mSPSRx, type, max_toa, &ebp);
|
||||
if (rc <= 0) {
|
||||
if (rc == -SIGERR_CLIP)
|
||||
LOG(WARNING) << "Clipping detected on received RACH or Normal Burst";
|
||||
LOGCHAN(chan, DTRXDUL, NOTICE) << "Clipping detected on received RACH or Normal Burst";
|
||||
else if (rc != SIGERR_NONE)
|
||||
LOG(WARNING) << "Unhandled RACH or Normal Burst detection error";
|
||||
LOGCHAN(chan, DTRXDUL, NOTICE) << "Unhandled RACH or Normal Burst detection error";
|
||||
goto ret_idle;
|
||||
}
|
||||
|
||||
@@ -699,12 +704,12 @@ bool Transceiver::pullRadioVector(size_t chan, struct trx_ul_burst_ind *bi)
|
||||
|
||||
delete rxBurst;
|
||||
delete radio_burst;
|
||||
return true;
|
||||
return 0;
|
||||
|
||||
ret_idle:
|
||||
bi->idle = true;
|
||||
delete radio_burst;
|
||||
return false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Transceiver::reset()
|
||||
@@ -745,7 +750,7 @@ static bool match_cmd(char *buf,
|
||||
return true;
|
||||
}
|
||||
|
||||
void Transceiver::driveControl(size_t chan)
|
||||
bool Transceiver::driveControl(size_t chan)
|
||||
{
|
||||
char buffer[MAX_PACKET_LENGTH + 1];
|
||||
char response[MAX_PACKET_LENGTH + 1];
|
||||
@@ -755,8 +760,8 @@ void Transceiver::driveControl(size_t chan)
|
||||
/* Attempt to read from control socket */
|
||||
msgLen = read(mCtrlSockets[chan], buffer, MAX_PACKET_LENGTH);
|
||||
if (msgLen <= 0) {
|
||||
LOGCHAN(chan, DTRXCTRL, WARNING) << "mCtrlSockets read(" << mCtrlSockets[chan] << ") failed: " << msgLen;
|
||||
return;
|
||||
LOGCHAN(chan, DTRXCTRL, NOTICE) << "mCtrlSockets read(" << mCtrlSockets[chan] << ") failed: " << msgLen;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Zero-terminate received string */
|
||||
@@ -764,8 +769,8 @@ void Transceiver::driveControl(size_t chan)
|
||||
|
||||
/* Verify a command signature */
|
||||
if (strncmp(buffer, "CMD ", 4)) {
|
||||
LOGC(DTRXCTRL, WARNING) << "bogus message on control interface";
|
||||
return;
|
||||
LOGCHAN(chan, DTRXCTRL, NOTICE) << "bogus message on control interface";
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Set command pointer */
|
||||
@@ -789,7 +794,7 @@ void Transceiver::driveControl(size_t chan)
|
||||
unsigned ts = 0, ss = 0;
|
||||
sscanf(params, "%u %u", &ts, &ss);
|
||||
if (ts > 7 || ss > 7) {
|
||||
sprintf(response, "RSP NOHANDOVER 1 %u %u", ts, ss);
|
||||
sprintf(response, "RSP HANDOVER 1 %u %u", ts, ss);
|
||||
} else {
|
||||
mHandover[ts][ss] = true;
|
||||
sprintf(response, "RSP HANDOVER 0 %u %u", ts, ss);
|
||||
@@ -849,7 +854,7 @@ void Transceiver::driveControl(size_t chan)
|
||||
sscanf(params, "%d", &freqKhz);
|
||||
mRxFreq = freqKhz * 1e3;
|
||||
if (!mRadioInterface->tuneRx(mRxFreq, chan)) {
|
||||
LOGC(DTRXCTRL, ALERT) << "RX failed to tune";
|
||||
LOGCHAN(chan, DTRXCTRL, FATAL) << "RX failed to tune";
|
||||
sprintf(response,"RSP RXTUNE 1 %d",freqKhz);
|
||||
}
|
||||
else
|
||||
@@ -860,7 +865,7 @@ void Transceiver::driveControl(size_t chan)
|
||||
sscanf(params, "%d", &freqKhz);
|
||||
mTxFreq = freqKhz * 1e3;
|
||||
if (!mRadioInterface->tuneTx(mTxFreq, chan)) {
|
||||
LOGC(DTRXCTRL, ALERT) << "TX failed to tune";
|
||||
LOGCHAN(chan, DTRXCTRL, FATAL) << "TX failed to tune";
|
||||
sprintf(response,"RSP TXTUNE 1 %d",freqKhz);
|
||||
}
|
||||
else
|
||||
@@ -882,9 +887,9 @@ void Transceiver::driveControl(size_t chan)
|
||||
int timeslot;
|
||||
sscanf(params, "%d %d", ×lot, &corrCode);
|
||||
if ((timeslot < 0) || (timeslot > 7)) {
|
||||
LOGC(DTRXCTRL, WARNING) << "bogus message on control interface";
|
||||
LOGCHAN(chan, DTRXCTRL, NOTICE) << "bogus message on control interface";
|
||||
sprintf(response,"RSP SETSLOT 1 %d %d",timeslot,corrCode);
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
mStates[chan].chanType[timeslot] = (ChannelCombination) corrCode;
|
||||
setModulus(timeslot, chan);
|
||||
@@ -904,100 +909,104 @@ void Transceiver::driveControl(size_t chan)
|
||||
sprintf(response, "RSP SETFORMAT %u %u", version_recv, version_recv);
|
||||
}
|
||||
} else if (match_cmd(command, "_SETBURSTTODISKMASK", ¶ms)) {
|
||||
// debug command! may change or disapear without notice
|
||||
// debug command! may change or disappear without notice
|
||||
// set a mask which bursts to dump to disk
|
||||
int mask;
|
||||
sscanf(params, "%d", &mask);
|
||||
mWriteBurstToDiskMask = mask;
|
||||
sprintf(response,"RSP _SETBURSTTODISKMASK 0 %d",mask);
|
||||
} else {
|
||||
LOGC(DTRXCTRL, WARNING) << "bogus command " << command << " on control interface.";
|
||||
LOGCHAN(chan, DTRXCTRL, NOTICE) << "bogus command " << command << " on control interface.";
|
||||
sprintf(response,"RSP ERR 1");
|
||||
}
|
||||
|
||||
LOGCHAN(chan, DTRXCTRL, INFO) << "response is '" << response << "'";
|
||||
msgLen = write(mCtrlSockets[chan], response, strlen(response) + 1);
|
||||
if (msgLen <= 0)
|
||||
LOGCHAN(chan, DTRXCTRL, WARNING) << "mCtrlSockets write(" << mCtrlSockets[chan] << ") failed: " << msgLen;
|
||||
if (msgLen <= 0) {
|
||||
LOGCHAN(chan, DTRXCTRL, NOTICE) << "mCtrlSockets write(" << mCtrlSockets[chan] << ") failed: " << msgLen;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Transceiver::driveTxPriorityQueue(size_t chan)
|
||||
{
|
||||
int msgLen;
|
||||
int burstLen;
|
||||
char buffer[EDGE_BURST_NBITS + 50];
|
||||
struct trxd_hdr_common *chdr;
|
||||
struct trxd_hdr_v01_dl *dl;
|
||||
char buffer[sizeof(*dl) + EDGE_BURST_NBITS];
|
||||
uint32_t fn;
|
||||
|
||||
// check data socket
|
||||
msgLen = read(mDataSockets[chan], buffer, sizeof(buffer));
|
||||
if (msgLen <= 0) {
|
||||
LOGCHAN(chan, DTRXCTRL, WARNING) << "mDataSockets read(" << mCtrlSockets[chan] << ") failed: " << msgLen;
|
||||
LOGCHAN(chan, DTRXDDL, NOTICE) << "mDataSockets read(" << mCtrlSockets[chan] << ") failed: " << msgLen;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (msgLen == gSlotLen + 1 + 4 + 1) {
|
||||
burstLen = gSlotLen;
|
||||
} else if (msgLen == EDGE_BURST_NBITS + 1 + 4 + 1) {
|
||||
if (mSPSTx != 4)
|
||||
switch (msgLen) {
|
||||
case sizeof(*dl) + gSlotLen: /* GSM burst */
|
||||
burstLen = gSlotLen;
|
||||
break;
|
||||
case sizeof(*dl) + EDGE_BURST_NBITS: /* EDGE burst */
|
||||
if (mSPSTx != 4) {
|
||||
LOGCHAN(chan, DTRXDDL, ERROR) << "EDGE burst received but SPS is set to " << mSPSTx;
|
||||
return false;
|
||||
}
|
||||
burstLen = EDGE_BURST_NBITS;
|
||||
break;
|
||||
default:
|
||||
LOGCHAN(chan, DTRXDDL, ERROR) << "badly formatted packet on GSM->TRX interface (len="<< msgLen << ")";
|
||||
return false;
|
||||
|
||||
burstLen = EDGE_BURST_NBITS;
|
||||
} else {
|
||||
LOG(ERR) << "badly formatted packet on GSM->TRX interface";
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Common header part: HDR version, TDMA TN & FN */
|
||||
chdr = (struct trxd_hdr_common *) buffer;
|
||||
dl = (struct trxd_hdr_v01_dl *) buffer;
|
||||
|
||||
/* Convert TDMA FN to the host endianness */
|
||||
fn = osmo_load32be(&chdr->fn);
|
||||
fn = osmo_load32be(&dl->common.fn);
|
||||
|
||||
/* Make sure we support the received header format */
|
||||
switch (chdr->version) {
|
||||
switch (dl->common.version) {
|
||||
case 0:
|
||||
/* Version 1 has the same format */
|
||||
case 1:
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG(ERR) << "Rx TRXD message with unknown header version " << chdr->version;
|
||||
LOGCHAN(chan, DTRXDDL, ERROR) << "Rx TRXD message with unknown header version " << unsigned(dl->common.version);
|
||||
return false;
|
||||
}
|
||||
|
||||
LOG(DEBUG) << "Rx TRXD message (hdr_ver=" << chdr->version << "): "
|
||||
<< "fn=" << fn << ", tn=" << chdr->tn << ", "
|
||||
<< "burst_len=" << burstLen;
|
||||
LOGCHAN(chan, DTRXDDL, DEBUG) << "Rx TRXD message (hdr_ver=" << unsigned(dl->common.version)
|
||||
<< "): fn=" << fn << ", tn=" << unsigned(dl->common.tn) << ", burst_len=" << burstLen;
|
||||
|
||||
int RSSI = (int) buffer[5];
|
||||
BitVector newBurst(burstLen);
|
||||
BitVector::iterator itr = newBurst.begin();
|
||||
char *bufferItr = buffer+6;
|
||||
uint8_t *bufferItr = dl->soft_bits;
|
||||
while (itr < newBurst.end())
|
||||
*itr++ = *bufferItr++;
|
||||
|
||||
GSM::Time currTime = GSM::Time(fn, chdr->tn);
|
||||
GSM::Time currTime = GSM::Time(fn, dl->common.tn);
|
||||
|
||||
addRadioVector(chan, newBurst, RSSI, currTime);
|
||||
addRadioVector(chan, newBurst, dl->tx_att, currTime);
|
||||
|
||||
return true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
void Transceiver::driveReceiveRadio()
|
||||
bool Transceiver::driveReceiveRadio()
|
||||
{
|
||||
int rc = mRadioInterface->driveReceiveRadio();
|
||||
if (rc == 0) {
|
||||
usleep(100000);
|
||||
} else if (rc < 0) {
|
||||
LOG(FATAL) << "radio Interface receive failed, requesting stop.";
|
||||
osmo_signal_dispatch(SS_MAIN, S_MAIN_STOP_REQUIRED, NULL);
|
||||
} else if (mForceClockInterface || mTransmitDeadlineClock > mLastClockUpdateTime + GSM::Time(216,0)) {
|
||||
mForceClockInterface = false;
|
||||
writeClockInterface();
|
||||
return true;
|
||||
}
|
||||
if (rc < 0)
|
||||
return false;
|
||||
|
||||
if (mForceClockInterface || mTransmitDeadlineClock > mLastClockUpdateTime + GSM::Time(216,0)) {
|
||||
mForceClockInterface = false;
|
||||
return writeClockInterface();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void Transceiver::logRxBurst(size_t chan, const struct trx_ul_burst_ind *bi)
|
||||
@@ -1010,9 +1019,8 @@ void Transceiver::logRxBurst(size_t chan, const struct trx_ul_burst_ind *bi)
|
||||
else os << "-";
|
||||
}
|
||||
|
||||
LOG(DEBUG) << std::fixed << std::right
|
||||
<< " chan: " << chan
|
||||
<< " time: " << bi->tn << ":" << bi->fn
|
||||
LOGCHAN(chan, DTRXDUL, DEBUG) << std::fixed << std::right
|
||||
<< " time: " << unsigned(bi->tn) << ":" << bi->fn
|
||||
<< " RSSI: " << std::setw(5) << std::setprecision(1) << (bi->rssi - rssiOffset)
|
||||
<< "dBFS/" << std::setw(6) << -bi->rssi << "dBm"
|
||||
<< " noise: " << std::setw(5) << std::setprecision(1) << (bi->noise - rssiOffset)
|
||||
@@ -1022,22 +1030,27 @@ void Transceiver::logRxBurst(size_t chan, const struct trx_ul_burst_ind *bi)
|
||||
<< " bits: " << os;
|
||||
}
|
||||
|
||||
void Transceiver::driveReceiveFIFO(size_t chan)
|
||||
bool Transceiver::driveReceiveFIFO(size_t chan)
|
||||
{
|
||||
struct trx_ul_burst_ind bi;
|
||||
int rc;
|
||||
|
||||
if ((rc = pullRadioVector(chan, &bi)) < 0) {
|
||||
if (rc == -ENOENT) { /* timeslot off, continue processing */
|
||||
LOGCHAN(chan, DTRXDUL, DEBUG) << unsigned(bi.tn) << ":" << bi.fn << " timeslot is off";
|
||||
return true;
|
||||
}
|
||||
return false; /* other errors: we want to stop the process */
|
||||
}
|
||||
|
||||
if (!pullRadioVector(chan, &bi))
|
||||
return;
|
||||
if (!bi.idle)
|
||||
logRxBurst(chan, &bi);
|
||||
logRxBurst(chan, &bi);
|
||||
|
||||
switch (mVersionTRXD[chan]) {
|
||||
case 0:
|
||||
trxd_send_burst_ind_v0(chan, mDataSockets[chan], &bi);
|
||||
break;
|
||||
return trxd_send_burst_ind_v0(chan, mDataSockets[chan], &bi);
|
||||
case 1:
|
||||
trxd_send_burst_ind_v1(chan, mDataSockets[chan], &bi);
|
||||
break;
|
||||
return trxd_send_burst_ind_v1(chan, mDataSockets[chan], &bi);
|
||||
default:
|
||||
OSMO_ASSERT(false);
|
||||
}
|
||||
@@ -1061,7 +1074,7 @@ void Transceiver::driveTxFIFO()
|
||||
|
||||
if (mOn) {
|
||||
//radioClock->wait(); // wait until clock updates
|
||||
LOG(DEBUG) << "radio clock " << radioClock->get();
|
||||
LOGC(DTRXCLK, DEBUG) << "radio clock " << radioClock->get();
|
||||
while (radioClock->get() + mTransmitLatency > mTransmitDeadlineClock) {
|
||||
// if underrun, then we're not providing bursts to radio/USRP fast
|
||||
// enough. Need to increase latency by one GSM frame.
|
||||
@@ -1070,8 +1083,9 @@ void Transceiver::driveTxFIFO()
|
||||
// only update latency at the defined frame interval
|
||||
if (radioClock->get() > mLatencyUpdateTime + GSM::Time(USB_LATENCY_INTRVL)) {
|
||||
mTransmitLatency = mTransmitLatency + GSM::Time(1,0);
|
||||
LOG(INFO) << "new latency: " << mTransmitLatency << " (underrun "
|
||||
<< radioClock->get() << " vs " << mLatencyUpdateTime + GSM::Time(USB_LATENCY_INTRVL) << ")";
|
||||
LOGC(DTRXCLK, INFO) << "new latency: " << mTransmitLatency << " (underrun "
|
||||
<< radioClock->get() << " vs "
|
||||
<< mLatencyUpdateTime + GSM::Time(USB_LATENCY_INTRVL) << ")";
|
||||
mLatencyUpdateTime = radioClock->get();
|
||||
}
|
||||
}
|
||||
@@ -1081,7 +1095,7 @@ void Transceiver::driveTxFIFO()
|
||||
if (mTransmitLatency > mRadioInterface->minLatency()) {
|
||||
if (radioClock->get() > mLatencyUpdateTime + GSM::Time(216,0)) {
|
||||
mTransmitLatency.decTN();
|
||||
LOG(INFO) << "reduced latency: " << mTransmitLatency;
|
||||
LOGC(DTRXCLK, INFO) << "reduced latency: " << mTransmitLatency;
|
||||
mLatencyUpdateTime = radioClock->get();
|
||||
}
|
||||
}
|
||||
@@ -1098,21 +1112,23 @@ void Transceiver::driveTxFIFO()
|
||||
|
||||
|
||||
|
||||
void Transceiver::writeClockInterface()
|
||||
bool Transceiver::writeClockInterface()
|
||||
{
|
||||
int msgLen;
|
||||
char command[50];
|
||||
// FIXME -- This should be adaptive.
|
||||
sprintf(command,"IND CLOCK %llu",(unsigned long long) (mTransmitDeadlineClock.FN()+2));
|
||||
|
||||
LOG(INFO) << "ClockInterface: sending " << command;
|
||||
LOGC(DTRXCLK, INFO) << "sending " << command;
|
||||
|
||||
msgLen = write(mClockSocket, command, strlen(command) + 1);
|
||||
if (msgLen <= 0)
|
||||
LOG(WARNING) << "mClockSocket write(" << mClockSocket << ") failed: " << msgLen;
|
||||
if (msgLen <= 0) {
|
||||
LOGC(DTRXCLK, ERROR) << "mClockSocket write(" << mClockSocket << ") failed: " << msgLen;
|
||||
return false;
|
||||
}
|
||||
|
||||
mLastClockUpdateTime = mTransmitDeadlineClock;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void *RxUpperLoopAdapter(TrxChanThParams *params)
|
||||
@@ -1126,10 +1142,12 @@ void *RxUpperLoopAdapter(TrxChanThParams *params)
|
||||
snprintf(thread_name, 16, "RxUpper%zu", num);
|
||||
set_selfthread_name(thread_name);
|
||||
|
||||
trx->setPriority(0.42);
|
||||
|
||||
while (1) {
|
||||
trx->driveReceiveFIFO(num);
|
||||
if (!trx->driveReceiveFIFO(num)) {
|
||||
LOGCHAN(num, DTRXDUL, FATAL) << "Something went wrong in thread " << thread_name << ", requesting stop";
|
||||
osmo_signal_dispatch(SS_MAIN, S_MAIN_STOP_REQUIRED, NULL);
|
||||
break;
|
||||
}
|
||||
pthread_testcancel();
|
||||
}
|
||||
return NULL;
|
||||
@@ -1139,10 +1157,12 @@ void *RxLowerLoopAdapter(Transceiver *transceiver)
|
||||
{
|
||||
set_selfthread_name("RxLower");
|
||||
|
||||
transceiver->setPriority(0.45);
|
||||
|
||||
while (1) {
|
||||
transceiver->driveReceiveRadio();
|
||||
if (!transceiver->driveReceiveRadio()) {
|
||||
LOGC(DTRXDUL, FATAL) << "Something went wrong in thread RxLower, requesting stop";
|
||||
osmo_signal_dispatch(SS_MAIN, S_MAIN_STOP_REQUIRED, NULL);
|
||||
break;
|
||||
}
|
||||
pthread_testcancel();
|
||||
}
|
||||
return NULL;
|
||||
@@ -1152,8 +1172,6 @@ void *TxLowerLoopAdapter(Transceiver *transceiver)
|
||||
{
|
||||
set_selfthread_name("TxLower");
|
||||
|
||||
transceiver->setPriority(0.44);
|
||||
|
||||
while (1) {
|
||||
transceiver->driveTxFIFO();
|
||||
pthread_testcancel();
|
||||
@@ -1173,7 +1191,11 @@ void *ControlServiceLoopAdapter(TrxChanThParams *params)
|
||||
set_selfthread_name(thread_name);
|
||||
|
||||
while (1) {
|
||||
trx->driveControl(num);
|
||||
if (!trx->driveControl(num)) {
|
||||
LOGCHAN(num, DTRXCTRL, FATAL) << "Something went wrong in thread " << thread_name << ", requesting stop";
|
||||
osmo_signal_dispatch(SS_MAIN, S_MAIN_STOP_REQUIRED, NULL);
|
||||
break;
|
||||
}
|
||||
pthread_testcancel();
|
||||
}
|
||||
return NULL;
|
||||
@@ -1190,10 +1212,12 @@ void *TxUpperLoopAdapter(TrxChanThParams *params)
|
||||
snprintf(thread_name, 16, "TxUpper%zu", num);
|
||||
set_selfthread_name(thread_name);
|
||||
|
||||
trx->setPriority(0.40);
|
||||
|
||||
while (1) {
|
||||
trx->driveTxPriorityQueue(num);
|
||||
if (!trx->driveTxPriorityQueue(num)) {
|
||||
LOGCHAN(num, DTRXDDL, FATAL) << "Something went wrong in thread " << thread_name << ", requesting stop";
|
||||
osmo_signal_dispatch(SS_MAIN, S_MAIN_STOP_REQUIRED, NULL);
|
||||
break;
|
||||
}
|
||||
pthread_testcancel();
|
||||
}
|
||||
return NULL;
|
||||
|
||||
@@ -182,7 +182,7 @@ private:
|
||||
void pushRadioVector(GSM::Time &nowTime);
|
||||
|
||||
/** Pull and demodulate a burst from the receive FIFO */
|
||||
bool pullRadioVector(size_t chan, struct trx_ul_burst_ind *ind);
|
||||
int pullRadioVector(size_t chan, struct trx_ul_burst_ind *ind);
|
||||
|
||||
/** Set modulus for specific timeslot */
|
||||
void setModulus(size_t timeslot, size_t chan);
|
||||
@@ -191,7 +191,7 @@ private:
|
||||
CorrType expectedCorrType(GSM::Time currTime, size_t chan);
|
||||
|
||||
/** send messages over the clock socket */
|
||||
void writeClockInterface(void);
|
||||
bool writeClockInterface(void);
|
||||
|
||||
int mSPSTx; ///< number of samples per Tx symbol
|
||||
int mSPSRx; ///< number of samples per Rx symbol
|
||||
@@ -216,21 +216,21 @@ private:
|
||||
bool start();
|
||||
void stop();
|
||||
|
||||
/** Protect destructor accessable stop call */
|
||||
/** Protect destructor accessible stop call */
|
||||
Mutex mLock;
|
||||
|
||||
protected:
|
||||
/** drive lower receive I/O and burst generation */
|
||||
void driveReceiveRadio();
|
||||
bool driveReceiveRadio();
|
||||
|
||||
/** drive demodulation of GSM bursts */
|
||||
void driveReceiveFIFO(size_t chan);
|
||||
bool driveReceiveFIFO(size_t chan);
|
||||
|
||||
/** drive transmission of GSM bursts */
|
||||
void driveTxFIFO();
|
||||
|
||||
/** drive handling of control messages from GSM core */
|
||||
void driveControl(size_t chan);
|
||||
bool driveControl(size_t chan);
|
||||
|
||||
/**
|
||||
drive modulation and sorting of GSM bursts from GSM core
|
||||
@@ -247,9 +247,6 @@ protected:
|
||||
|
||||
void reset();
|
||||
|
||||
/** set priority on current thread */
|
||||
void setPriority(float prio = 0.5) { mRadioInterface->setPriority(prio); }
|
||||
|
||||
void logRxBurst(size_t chan, const struct trx_ul_burst_ind *bi);
|
||||
};
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ static void neon_conv_cmplx_4n(float *x, float *h, float *y, int h_len, int len)
|
||||
}
|
||||
#endif
|
||||
|
||||
/* API: Initalize convolve module */
|
||||
/* API: Initialize convolve module */
|
||||
void convolve_init(void)
|
||||
{
|
||||
/* Stub */
|
||||
|
||||
@@ -103,7 +103,7 @@ void free_fft(struct fft_hdl *hdl)
|
||||
}
|
||||
|
||||
/*! \brief Run multiple DFT operations with the initialized plan
|
||||
* \param[in] hdl handle to an intitialized fft struct
|
||||
* \param[in] hdl handle to an initialized fft struct
|
||||
*
|
||||
* Input and output buffers are configured with init_fft().
|
||||
*/
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
/* Architecture dependant function pointers */
|
||||
/* Architecture dependent function pointers */
|
||||
struct convert_cpu_context {
|
||||
void (*convert_si16_ps_16n) (float *, const short *, int);
|
||||
void (*convert_si16_ps) (float *, const short *, int);
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
/* Architecture dependant function pointers */
|
||||
/* Architecture dependent function pointers */
|
||||
struct convolve_cpu_context {
|
||||
void (*conv_cmplx_4n) (const float *, int, const float *, int, float *,
|
||||
int, int, int);
|
||||
@@ -66,7 +66,7 @@ int _base_convolve_complex(const float *x, int x_len,
|
||||
int bounds_check(int x_len, int h_len, int y_len,
|
||||
int start, int len);
|
||||
|
||||
/* API: Initalize convolve module */
|
||||
/* API: Initialize convolve module */
|
||||
void convolve_init(void)
|
||||
{
|
||||
c.conv_cmplx_4n = (void *)_base_convolve_complex;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright 2008 Free Software Foundation, Inc.
|
||||
*
|
||||
* This software is distributed under multiple licenses; see the COPYING file in the main directory for licensing information for this specific distribuion.
|
||||
* This software is distributed under multiple licenses; see the COPYING file in the main directory for licensing information for this specific distribution.
|
||||
*
|
||||
* This use of this software may be subject to additional restrictions.
|
||||
* See the LEGAL file in the main directory for details.
|
||||
@@ -70,9 +70,6 @@ class RadioDevice {
|
||||
/** Get the Tx window type */
|
||||
virtual enum TxWindowType getWindowType()=0;
|
||||
|
||||
/** Enable thread priority */
|
||||
virtual void setPriority(float prio = 0.5) = 0;
|
||||
|
||||
/**
|
||||
Read samples from the radio.
|
||||
@param buf preallocated buf to contain read result
|
||||
@@ -80,23 +77,20 @@ class RadioDevice {
|
||||
@param overrun Set if read buffer has been overrun, e.g. data not being read fast enough
|
||||
@param timestamp The timestamp of the first samples to be read
|
||||
@param underrun Set if radio does not have data to transmit, e.g. data not being sent fast enough
|
||||
@param RSSI The received signal strength of the read result
|
||||
@return The number of samples actually read
|
||||
*/
|
||||
virtual int readSamples(std::vector<short *> &bufs, int len, bool *overrun,
|
||||
TIMESTAMP timestamp = 0xffffffff, bool *underrun = 0,
|
||||
unsigned *RSSI = 0) = 0;
|
||||
TIMESTAMP timestamp = 0xffffffff, bool *underrun = 0) = 0;
|
||||
/**
|
||||
Write samples to the radio.
|
||||
@param buf Contains the data to be written.
|
||||
@param len number of samples to write.
|
||||
@param underrun Set if radio does not have data to transmit, e.g. data not being sent fast enough
|
||||
@param timestamp The timestamp of the first sample of the data buffer.
|
||||
@param isControl Set if data is a control packet, e.g. a ping command
|
||||
@return The number of samples actually written
|
||||
*/
|
||||
virtual int writeSamples(std::vector<short *> &bufs, int len, bool *underrun,
|
||||
TIMESTAMP timestamp, bool isControl = false) = 0;
|
||||
TIMESTAMP timestamp) = 0;
|
||||
|
||||
/** Update the alignment between the read and write timestamps */
|
||||
virtual bool updateAlignment(TIMESTAMP timestamp)=0;
|
||||
@@ -134,6 +128,9 @@ class RadioDevice {
|
||||
/** sets the transmit chan gain, returns the gain setting **/
|
||||
virtual double setTxGain(double dB, size_t chan = 0) = 0;
|
||||
|
||||
/** get transmit gain */
|
||||
virtual double getTxGain(size_t chan = 0) = 0;
|
||||
|
||||
/** return maximum Tx Gain **/
|
||||
virtual double maxTxGain(void) = 0;
|
||||
|
||||
@@ -171,12 +168,17 @@ class RadioDevice {
|
||||
std::vector<std::string> tx_paths, rx_paths;
|
||||
std::vector<struct device_counters> m_ctr;
|
||||
|
||||
RadioDevice(size_t tx_sps, size_t rx_sps, InterfaceType type, size_t chans, double offset,
|
||||
RadioDevice(size_t tx_sps, size_t rx_sps, InterfaceType type, size_t chan_num, double offset,
|
||||
const std::vector<std::string>& tx_paths,
|
||||
const std::vector<std::string>& rx_paths):
|
||||
tx_sps(tx_sps), rx_sps(rx_sps), iface(type), chans(chans), lo_offset(offset),
|
||||
tx_sps(tx_sps), rx_sps(rx_sps), iface(type), chans(chan_num), lo_offset(offset),
|
||||
tx_paths(tx_paths), rx_paths(rx_paths)
|
||||
{
|
||||
if (iface == MULTI_ARFCN) {
|
||||
LOGC(DDEV, INFO) << "Multi-ARFCN: "<< chan_num << " logical chans -> 1 physical chans";
|
||||
chans = 1;
|
||||
}
|
||||
|
||||
m_ctr.resize(chans);
|
||||
for (size_t i = 0; i < chans; i++) {
|
||||
memset(&m_ctr[i], 0, sizeof(m_ctr[i]));
|
||||
@@ -190,9 +192,9 @@ class RadioDevice {
|
||||
for (i = 0; i < tx_paths.size(); i++) {
|
||||
if (tx_paths[i] == "")
|
||||
continue;
|
||||
LOG(DEBUG) << "Configuring channel " << i << " with antenna " << tx_paths[i];
|
||||
LOGCHAN(i, DDEV, DEBUG) << "Configuring Tx antenna " << tx_paths[i];
|
||||
if (!setTxAntenna(tx_paths[i], i)) {
|
||||
LOG(ALERT) << "Failed configuring channel " << i << " with antenna " << tx_paths[i];
|
||||
LOGCHAN(i, DDEV, ALERT) << "Failed configuring Tx antenna " << tx_paths[i];
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -200,9 +202,9 @@ class RadioDevice {
|
||||
for (i = 0; i < rx_paths.size(); i++) {
|
||||
if (rx_paths[i] == "")
|
||||
continue;
|
||||
LOG(DEBUG) << "Configuring channel " << i << " with antenna " << rx_paths[i];
|
||||
LOGCHAN(i, DDEV, DEBUG) << "Configuring Rx antenna " << rx_paths[i];
|
||||
if (!setRxAntenna(rx_paths[i], i)) {
|
||||
LOG(ALERT) << "Failed configuring channel " << i << " with antenna " << rx_paths[i];
|
||||
LOGCHAN(i, DDEV, ALERT) << "Failed configuring Rx antenna " << rx_paths[i];
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ std::string smpl_buf::str_status(TIMESTAMP timestamp) const
|
||||
return ost.str();
|
||||
}
|
||||
|
||||
std::string smpl_buf::str_code(ssize_t code)
|
||||
std::string smpl_buf::str_code(int code)
|
||||
{
|
||||
switch (code) {
|
||||
case ERROR_TIMESTAMP:
|
||||
@@ -166,6 +166,8 @@ std::string smpl_buf::str_code(ssize_t code)
|
||||
case ERROR_OVERFLOW:
|
||||
return "Sample buffer: Overrun";
|
||||
default:
|
||||
return "Sample buffer: Unknown error";
|
||||
std::stringstream ss;
|
||||
ss << "Sample buffer: Unknown error " << code;
|
||||
return ss.str();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
/*
|
||||
Sample Buffer - Allows reading and writing of timed samples using osmo-trx
|
||||
timestamps. Time conversions are handled
|
||||
internally or accessable through the static convert calls.
|
||||
internally or accessible through the static convert calls.
|
||||
*/
|
||||
class smpl_buf {
|
||||
public:
|
||||
@@ -68,7 +68,7 @@ public:
|
||||
@param code an error code
|
||||
@return a formatted error string
|
||||
*/
|
||||
static std::string str_code(ssize_t code);
|
||||
static std::string str_code(int code);
|
||||
|
||||
enum err_code {
|
||||
ERROR_TIMESTAMP = -1,
|
||||
|
||||
@@ -20,6 +20,10 @@
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <map>
|
||||
|
||||
#include "trx_vty.h"
|
||||
#include "Logger.h"
|
||||
#include "Threads.h"
|
||||
#include "LMSDevice.h"
|
||||
@@ -39,24 +43,88 @@ extern "C" {
|
||||
using namespace std;
|
||||
|
||||
#define MAX_ANTENNA_LIST_SIZE 10
|
||||
#define LMS_SAMPLE_RATE GSMRATE*32
|
||||
#define GSM_CARRIER_BW 270000.0 /* 270kHz */
|
||||
#define LMS_MIN_BW_SUPPORTED 2.5e6 /* 2.5mHz, minimum supported by LMS */
|
||||
#define LMS_CALIBRATE_BW_HZ OSMO_MAX(GSM_CARRIER_BW, LMS_MIN_BW_SUPPORTED)
|
||||
#define SAMPLE_BUF_SZ (1 << 20) /* Size of Rx timestamp based Ring buffer, in bytes */
|
||||
|
||||
LMSDevice::LMSDevice(size_t tx_sps, size_t rx_sps, InterfaceType iface, size_t chans, double lo_offset,
|
||||
|
||||
/* Device Name Prefixes as presented by LimeSuite API LMS_GetDeviceInfo(): */
|
||||
#define LMS_DEV_SDR_USB_PREFIX_NAME "LimeSDR-USB"
|
||||
#define LMS_DEV_SDR_MINI_PREFIX_NAME "LimeSDR-Mini"
|
||||
#define LMS_DEV_NET_MICRO_PREFIX_NAME "LimeNET-Micro"
|
||||
|
||||
/* Device parameter descriptor */
|
||||
struct dev_desc {
|
||||
/* Does LimeSuite allow switching the clock source for this device?
|
||||
* LimeSDR-Mini does not have switches but needs soldering to select
|
||||
* external/internal clock. Any call to LMS_SetClockFreq() will fail.
|
||||
*/
|
||||
bool clock_src_switchable;
|
||||
/* Does LimeSuite allow using REF_INTERNAL for this device?
|
||||
* LimeNET-Micro does not like selecting internal clock
|
||||
*/
|
||||
bool clock_src_int_usable;
|
||||
/* Device specific maximum tx levels selected by phasenoise measurements, in dB */
|
||||
double max_tx_gain;
|
||||
/* Sample rate coef (without having TX/RX samples per symbol into account) */
|
||||
double rate;
|
||||
/* Sample rate coef (without having TX/RX samples per symbol into account), if multi-arfcn is enabled */
|
||||
double rate_multiarfcn;
|
||||
/* Coefficient multiplied by TX sample rate in order to shift Tx time */
|
||||
double ts_offset_coef;
|
||||
/* Coefficient multiplied by TX sample rate in order to shift Tx time, if multi-arfcn is enabled */
|
||||
double ts_offset_coef_multiarfcn;
|
||||
/* Device Name Prefix as presented by LimeSuite API LMS_GetDeviceInfo() */
|
||||
std::string name_prefix;
|
||||
};
|
||||
|
||||
static const std::map<enum lms_dev_type, struct dev_desc> dev_param_map {
|
||||
{ LMS_DEV_SDR_USB, { true, true, 73.0, GSMRATE, MCBTS_SPACING, 8.9e-5, 7.9e-5, LMS_DEV_SDR_USB_PREFIX_NAME } },
|
||||
{ LMS_DEV_SDR_MINI, { false, true, 66.0, GSMRATE, MCBTS_SPACING, 8.9e-5, 8.2e-5, LMS_DEV_SDR_MINI_PREFIX_NAME } },
|
||||
{ LMS_DEV_NET_MICRO, { true, false, 71.0, GSMRATE, MCBTS_SPACING, 8.9e-5, 7.9e-5, LMS_DEV_NET_MICRO_PREFIX_NAME } },
|
||||
{ LMS_DEV_UNKNOWN, { true, true, 73.0, GSMRATE, MCBTS_SPACING, 8.9e-5, 7.9e-5, "UNKNOWN" } },
|
||||
};
|
||||
|
||||
static enum lms_dev_type parse_dev_type(lms_device_t *m_lms_dev)
|
||||
{
|
||||
std::map<enum lms_dev_type, struct dev_desc>::const_iterator it = dev_param_map.begin();
|
||||
|
||||
const lms_dev_info_t* device_info = LMS_GetDeviceInfo(m_lms_dev);
|
||||
|
||||
while (it != dev_param_map.end())
|
||||
{
|
||||
enum lms_dev_type dev_type = it->first;
|
||||
struct dev_desc desc = it->second;
|
||||
|
||||
if (strncmp(device_info->deviceName, desc.name_prefix.c_str(), desc.name_prefix.length()) == 0) {
|
||||
LOGC(DDEV, INFO) << "Device identified as " << desc.name_prefix;
|
||||
return dev_type;
|
||||
}
|
||||
it++;
|
||||
}
|
||||
return LMS_DEV_UNKNOWN;
|
||||
}
|
||||
|
||||
LMSDevice::LMSDevice(size_t tx_sps, size_t rx_sps, InterfaceType iface, size_t chan_num, double lo_offset,
|
||||
const std::vector<std::string>& tx_paths,
|
||||
const std::vector<std::string>& rx_paths):
|
||||
RadioDevice(tx_sps, rx_sps, iface, chans, lo_offset, tx_paths, rx_paths),
|
||||
m_lms_dev(NULL)
|
||||
RadioDevice(tx_sps, rx_sps, iface, chan_num, lo_offset, tx_paths, rx_paths),
|
||||
m_lms_dev(NULL), started(false), m_dev_type(LMS_DEV_UNKNOWN)
|
||||
{
|
||||
LOGC(DDEV, INFO) << "creating LMS device...";
|
||||
|
||||
m_lms_stream_rx.resize(chans);
|
||||
m_lms_stream_tx.resize(chans);
|
||||
rx_gains.resize(chans);
|
||||
tx_gains.resize(chans);
|
||||
|
||||
rx_buffers.resize(chans);
|
||||
|
||||
/* Set up per-channel Rx timestamp based Ring buffers */
|
||||
for (size_t i = 0; i < rx_buffers.size(); i++)
|
||||
rx_buffers[i] = new smpl_buf(SAMPLE_BUF_SZ / sizeof(uint32_t));
|
||||
|
||||
}
|
||||
|
||||
LMSDevice::~LMSDevice()
|
||||
@@ -91,7 +159,7 @@ static void lms_log_callback(int lvl, const char *msg)
|
||||
if ((unsigned int) lvl >= ARRAY_SIZE(lvl_map))
|
||||
lvl = ARRAY_SIZE(lvl_map)-1;
|
||||
|
||||
LOGLV(DLMS, lvl_map[lvl]) << msg;
|
||||
LOGLV(DDEVDRV, lvl_map[lvl]) << msg;
|
||||
}
|
||||
|
||||
static void print_range(const char* name, lms_range_t *range)
|
||||
@@ -108,7 +176,7 @@ static void print_range(const char* name, lms_range_t *range)
|
||||
int info_list_find(lms_info_str_t* info_list, unsigned int count, const std::string &args)
|
||||
{
|
||||
unsigned int i, j;
|
||||
vector<string> filters;
|
||||
std::vector<string> filters;
|
||||
|
||||
filters = comma_delimited_to_vector(args.c_str());
|
||||
|
||||
@@ -132,11 +200,11 @@ int info_list_find(lms_info_str_t* info_list, unsigned int count, const std::str
|
||||
int LMSDevice::open(const std::string &args, int ref, bool swap_channels)
|
||||
{
|
||||
lms_info_str_t* info_list;
|
||||
const lms_dev_info_t* device_info;
|
||||
lms_range_t range_sr;
|
||||
float_type sr_host, sr_rf;
|
||||
unsigned int i, n;
|
||||
int rc, dev_id;
|
||||
struct dev_desc dev_desc;
|
||||
|
||||
LOGC(DDEV, INFO) << "Opening LMS device..";
|
||||
|
||||
@@ -173,19 +241,20 @@ int LMSDevice::open(const std::string &args, int ref, bool swap_channels)
|
||||
|
||||
delete [] info_list;
|
||||
|
||||
device_info = LMS_GetDeviceInfo(m_lms_dev);
|
||||
m_dev_type = parse_dev_type(m_lms_dev);
|
||||
dev_desc = dev_param_map.at(m_dev_type);
|
||||
|
||||
if ((ref != REF_EXTERNAL) && (ref != REF_INTERNAL)){
|
||||
LOGC(DDEV, ERROR) << "Invalid reference type";
|
||||
goto out_close;
|
||||
}
|
||||
|
||||
/* if reference clock is external setup must happen _before_ calling LMS_Init */
|
||||
/* FIXME make external reference frequency configurable */
|
||||
/* if reference clock is external, setup must happen _before_ calling LMS_Init */
|
||||
if (ref == REF_EXTERNAL) {
|
||||
LOGC(DDEV, INFO) << "Setting External clock reference to 10MHz";
|
||||
/* Assume an external 10 MHz reference clock */
|
||||
if (LMS_SetClockFreq(m_lms_dev, LMS_CLOCK_EXTREF, 10000000.0) < 0)
|
||||
/* FIXME: Assume an external 10 MHz reference clock. make
|
||||
external reference frequency configurable */
|
||||
if (!do_clock_src_freq(REF_EXTERNAL, 10000000.0))
|
||||
goto out_close;
|
||||
}
|
||||
|
||||
@@ -195,22 +264,13 @@ int LMSDevice::open(const std::string &args, int ref, bool swap_channels)
|
||||
goto out_close;
|
||||
}
|
||||
|
||||
/* LimeSDR-Mini does not have switches but needs soldering to select external/internal clock */
|
||||
/* LimeNET-Micro also does not like selecting internal clock*/
|
||||
/* also set device specific maximum tx levels selected by phasenoise measurements*/
|
||||
if (strncmp(device_info->deviceName,"LimeSDR-USB",11) == 0){
|
||||
/* if reference clock is internal setup must happen _after_ calling LMS_Init */
|
||||
/* according to lms using LMS_CLOCK_EXTREF with a frequency <= 0 is the correct way to set clock to internal reference*/
|
||||
if (ref == REF_INTERNAL) {
|
||||
LOGC(DDEV, INFO) << "Setting Internal clock reference";
|
||||
if (LMS_SetClockFreq(m_lms_dev, LMS_CLOCK_EXTREF, -1) < 0)
|
||||
goto out_close;
|
||||
}
|
||||
maxTxGainClamp = 73.0;
|
||||
} else if (strncmp(device_info->deviceName,"LimeSDR-Mini",12) == 0)
|
||||
maxTxGainClamp = 66.0;
|
||||
else
|
||||
maxTxGainClamp = 71.0; /* "LimeNET-Micro", etc FIXME pciE based LMS boards?*/
|
||||
/* if reference clock is internal, setup must happen _after_ calling LMS_Init */
|
||||
if (ref == REF_INTERNAL) {
|
||||
LOGC(DDEV, INFO) << "Setting Internal clock reference";
|
||||
/* Internal freq param is not used */
|
||||
if (!do_clock_src_freq(REF_INTERNAL, 0))
|
||||
goto out_close;
|
||||
}
|
||||
|
||||
/* enable all used channels */
|
||||
for (i=0; i<chans; i++) {
|
||||
@@ -225,16 +285,22 @@ int LMSDevice::open(const std::string &args, int ref, bool swap_channels)
|
||||
goto out_close;
|
||||
print_range("Sample Rate", &range_sr);
|
||||
|
||||
LOGC(DDEV, INFO) << "Setting sample rate to " << GSMRATE*tx_sps << " " << tx_sps;
|
||||
if (LMS_SetSampleRate(m_lms_dev, GSMRATE*tx_sps, 32) < 0)
|
||||
if (iface == MULTI_ARFCN)
|
||||
sr_host = dev_desc.rate_multiarfcn * tx_sps;
|
||||
else
|
||||
sr_host = dev_desc.rate * tx_sps;
|
||||
LOGC(DDEV, INFO) << "Setting sample rate to " << sr_host << " " << tx_sps;
|
||||
if (LMS_SetSampleRate(m_lms_dev, sr_host, 32) < 0)
|
||||
goto out_close;
|
||||
|
||||
if (LMS_GetSampleRate(m_lms_dev, LMS_CH_RX, 0, &sr_host, &sr_rf))
|
||||
goto out_close;
|
||||
LOGC(DDEV, INFO) << "Sample Rate: Host=" << sr_host << " RF=" << sr_rf;
|
||||
|
||||
/* FIXME: make this device/model dependent, like UHDDevice:dev_param_map! */
|
||||
ts_offset = static_cast<TIMESTAMP>(8.9e-5 * GSMRATE * tx_sps); /* time * sample_rate */
|
||||
if (iface == MULTI_ARFCN)
|
||||
ts_offset = static_cast<TIMESTAMP>(dev_desc.ts_offset_coef_multiarfcn * sr_host);
|
||||
else
|
||||
ts_offset = static_cast<TIMESTAMP>(dev_desc.ts_offset_coef * sr_host);
|
||||
|
||||
/* configure antennas */
|
||||
if (!set_antennas()) {
|
||||
@@ -242,13 +308,7 @@ int LMSDevice::open(const std::string &args, int ref, bool swap_channels)
|
||||
goto out_close;
|
||||
}
|
||||
|
||||
/* Set up per-channel Rx timestamp based Ring buffers */
|
||||
for (size_t i = 0; i < rx_buffers.size(); i++)
|
||||
rx_buffers[i] = new smpl_buf(SAMPLE_BUF_SZ / sizeof(uint32_t));
|
||||
|
||||
started = false;
|
||||
|
||||
return NORMAL;
|
||||
return iface == MULTI_ARFCN ? MULTI_ARFCN : NORMAL;
|
||||
|
||||
out_close:
|
||||
LOGC(DDEV, FATAL) << "Error in LMS open, closing: " << LMS_GetLastErrorMessage();
|
||||
@@ -342,6 +402,43 @@ bool LMSDevice::stop()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LMSDevice::do_clock_src_freq(enum ReferenceType ref, double freq)
|
||||
{
|
||||
struct dev_desc dev_desc = dev_param_map.at(m_dev_type);
|
||||
size_t lms_clk_id;
|
||||
|
||||
switch (ref) {
|
||||
case REF_EXTERNAL:
|
||||
lms_clk_id = LMS_CLOCK_EXTREF;
|
||||
break;
|
||||
case REF_INTERNAL:
|
||||
if (!dev_desc.clock_src_int_usable) {
|
||||
LOGC(DDEV, ERROR) << "Device type " << dev_desc.name_prefix
|
||||
<< " doesn't support internal reference clock";
|
||||
return false;
|
||||
}
|
||||
/* According to lms using LMS_CLOCK_EXTREF with a
|
||||
frequency <= 0 is the correct way to set clock to
|
||||
internal reference */
|
||||
lms_clk_id = LMS_CLOCK_EXTREF;
|
||||
freq = -1;
|
||||
break;
|
||||
default:
|
||||
LOGC(DDEV, ERROR) << "Invalid reference type " << get_value_string(clock_ref_names, ref);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (dev_desc.clock_src_switchable) {
|
||||
if (LMS_SetClockFreq(m_lms_dev, lms_clk_id, freq) < 0)
|
||||
return false;
|
||||
} else {
|
||||
LOGC(DDEV, INFO) << "Device type " << dev_desc.name_prefix
|
||||
<< " doesn't support switching clock source through SW";
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* do rx/tx calibration - depends on gain, freq and bw */
|
||||
bool LMSDevice::do_calib(size_t chan)
|
||||
{
|
||||
@@ -383,7 +480,7 @@ bool LMSDevice::do_filters(size_t chan)
|
||||
|
||||
double LMSDevice::maxTxGain()
|
||||
{
|
||||
return maxTxGainClamp;
|
||||
return dev_param_map.at(m_dev_type).max_tx_gain;
|
||||
}
|
||||
|
||||
double LMSDevice::minTxGain()
|
||||
@@ -412,8 +509,9 @@ double LMSDevice::setTxGain(double dB, size_t chan)
|
||||
|
||||
if (LMS_SetGaindB(m_lms_dev, LMS_CH_TX, chan, dB) < 0)
|
||||
LOGCHAN(chan, DDEV, ERR) << "Error setting TX gain to " << dB << " dB";
|
||||
|
||||
return dB;
|
||||
else
|
||||
tx_gains[chan] = dB;
|
||||
return tx_gains[chan];
|
||||
}
|
||||
|
||||
double LMSDevice::setRxGain(double dB, size_t chan)
|
||||
@@ -427,8 +525,23 @@ double LMSDevice::setRxGain(double dB, size_t chan)
|
||||
|
||||
if (LMS_SetGaindB(m_lms_dev, LMS_CH_RX, chan, dB) < 0)
|
||||
LOGCHAN(chan, DDEV, ERR) << "Error setting RX gain to " << dB << " dB";
|
||||
else
|
||||
rx_gains[chan] = dB;
|
||||
return rx_gains[chan];
|
||||
}
|
||||
|
||||
return dB;
|
||||
void LMSDevice::log_ant_list(bool dir_tx, size_t chan, std::ostringstream& os)
|
||||
{
|
||||
lms_name_t name_list[MAX_ANTENNA_LIST_SIZE]; /* large enough list for antenna names. */
|
||||
int num_names;
|
||||
int i;
|
||||
|
||||
num_names = LMS_GetAntennaList(m_lms_dev, dir_tx, chan, name_list);
|
||||
for (i = 0; i < num_names; i++) {
|
||||
if (i)
|
||||
os << ", ";
|
||||
os << "'" << name_list[i] << "'";
|
||||
}
|
||||
}
|
||||
|
||||
int LMSDevice::get_ant_idx(const std::string & name, bool dir_tx, size_t chan)
|
||||
@@ -484,7 +597,10 @@ bool LMSDevice::setRxAntenna(const std::string & ant, size_t chan)
|
||||
|
||||
idx = get_ant_idx(ant, LMS_CH_RX, chan);
|
||||
if (idx < 0) {
|
||||
LOGCHAN(chan, DDEV, ERROR) << "Invalid Rx Antenna";
|
||||
std::ostringstream os;
|
||||
LOGCHAN(chan, DDEV, ERROR) << "Invalid Rx Antenna: " << ant;
|
||||
log_ant_list(LMS_CH_RX, chan, os);
|
||||
LOGCHAN(chan, DDEV, NOTICE) << "Available Rx Antennas: " << os;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -530,7 +646,10 @@ bool LMSDevice::setTxAntenna(const std::string & ant, size_t chan)
|
||||
|
||||
idx = get_ant_idx(ant, LMS_CH_TX, chan);
|
||||
if (idx < 0) {
|
||||
LOGCHAN(chan, DDEV, ERROR) << "Invalid Rx Antenna";
|
||||
std::ostringstream os;
|
||||
LOGCHAN(chan, DDEV, ERROR) << "Invalid Tx Antenna: " << ant;
|
||||
log_ant_list(LMS_CH_TX, chan, os);
|
||||
LOGCHAN(chan, DDEV, NOTICE) << "Available Tx Antennas: " << os;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -600,7 +719,7 @@ void LMSDevice::update_stream_stats_rx(size_t chan, bool *overrun)
|
||||
m_ctr[chan].rx_overruns += status.overrun;
|
||||
|
||||
/* Dropped packets in Rx are counted when gaps in Rx timestamps are
|
||||
detected (likely because buffer oveflow in hardware). Value count
|
||||
detected (likely because buffer overflow in hardware). Value count
|
||||
since the last call to LMS_GetStreamStatus(stream). */
|
||||
if (status.droppedPackets) {
|
||||
changed = true;
|
||||
@@ -620,7 +739,7 @@ void LMSDevice::update_stream_stats_rx(size_t chan, bool *overrun)
|
||||
|
||||
// NOTE: Assumes sequential reads
|
||||
int LMSDevice::readSamples(std::vector < short *>&bufs, int len, bool * overrun,
|
||||
TIMESTAMP timestamp, bool * underrun, unsigned *RSSI)
|
||||
TIMESTAMP timestamp, bool * underrun)
|
||||
{
|
||||
int rc, num_smpls, expect_smpls;
|
||||
ssize_t avail_smpls;
|
||||
@@ -687,8 +806,9 @@ int LMSDevice::readSamples(std::vector < short *>&bufs, int len, bool * overrun,
|
||||
for (size_t i = 0; i < rx_buffers.size(); i++) {
|
||||
rc = rx_buffers[i]->read(bufs[i], len, timestamp);
|
||||
if ((rc < 0) || (rc != len)) {
|
||||
LOGC(DDEV, ERROR) << rx_buffers[i]->str_code(rc);
|
||||
LOGC(DDEV, ERROR) << rx_buffers[i]->str_status(timestamp);
|
||||
LOGCHAN(i, DDEV, ERROR) << rx_buffers[i]->str_code(rc) << ". "
|
||||
<< rx_buffers[i]->str_status(timestamp)
|
||||
<< ", (len=" << len << ")";
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -738,8 +858,7 @@ void LMSDevice::update_stream_stats_tx(size_t chan, bool *underrun)
|
||||
}
|
||||
|
||||
int LMSDevice::writeSamples(std::vector < short *>&bufs, int len,
|
||||
bool * underrun, unsigned long long timestamp,
|
||||
bool isControl)
|
||||
bool * underrun, unsigned long long timestamp)
|
||||
{
|
||||
int rc = 0;
|
||||
unsigned int i;
|
||||
@@ -748,11 +867,6 @@ int LMSDevice::writeSamples(std::vector < short *>&bufs, int len,
|
||||
tx_metadata.waitForTimestamp = true;
|
||||
tx_metadata.timestamp = timestamp - ts_offset; /* Shift Tx time by offset */
|
||||
|
||||
if (isControl) {
|
||||
LOGC(DDEV, ERROR) << "Control packets not supported";
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (bufs.size() != chans) {
|
||||
LOGC(DDEV, ERROR) << "Invalid channel combination " << bufs.size();
|
||||
return -1;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0+
|
||||
*
|
||||
* This software is distributed under multiple licenses; see the COPYING file in
|
||||
* the main directory for licensing information for this specific distribuion.
|
||||
* the main directory for licensing information for this specific distribution.
|
||||
*
|
||||
* This use of this software may be subject to additional restrictions.
|
||||
* See the LEGAL file in the main directory for details.
|
||||
@@ -41,6 +41,13 @@
|
||||
* A^2 = 1 */
|
||||
#define LIMESDR_TX_AMPL 0.707
|
||||
|
||||
enum lms_dev_type {
|
||||
LMS_DEV_SDR_USB, /* LimeSDR-USB */
|
||||
LMS_DEV_SDR_MINI, /* LimeSDR-Mini */
|
||||
LMS_DEV_NET_MICRO, /* LimeNet-micro */
|
||||
LMS_DEV_UNKNOWN,
|
||||
};
|
||||
|
||||
/** A class to handle a LimeSuite supported device */
|
||||
class LMSDevice:public RadioDevice {
|
||||
|
||||
@@ -58,20 +65,23 @@ private:
|
||||
|
||||
TIMESTAMP ts_initial, ts_offset;
|
||||
|
||||
double rxGain;
|
||||
double maxTxGainClamp;
|
||||
std::vector<double> tx_gains, rx_gains;
|
||||
|
||||
enum lms_dev_type m_dev_type;
|
||||
|
||||
bool do_calib(size_t chan);
|
||||
bool do_filters(size_t chan);
|
||||
void log_ant_list(bool dir_tx, size_t chan, std::ostringstream& os);
|
||||
int get_ant_idx(const std::string & name, bool dir_tx, size_t chan);
|
||||
bool flush_recv(size_t num_pkts);
|
||||
void update_stream_stats_rx(size_t chan, bool *overrun);
|
||||
void update_stream_stats_tx(size_t chan, bool *underrun);
|
||||
bool do_clock_src_freq(enum ReferenceType ref, double freq);
|
||||
|
||||
public:
|
||||
|
||||
/** Object constructor */
|
||||
LMSDevice(size_t tx_sps, size_t rx_sps, InterfaceType iface, size_t chans, double lo_offset,
|
||||
LMSDevice(size_t tx_sps, size_t rx_sps, InterfaceType iface, size_t chan_num, double lo_offset,
|
||||
const std::vector<std::string>& tx_paths,
|
||||
const std::vector<std::string>& rx_paths);
|
||||
~LMSDevice();
|
||||
@@ -85,10 +95,6 @@ public:
|
||||
/** Stop the LMS */
|
||||
bool stop();
|
||||
|
||||
/** Set priority not supported */
|
||||
void setPriority(float prio = 0.5) {
|
||||
}
|
||||
|
||||
enum TxWindowType getWindowType() {
|
||||
return TX_WINDOW_LMS1;
|
||||
}
|
||||
@@ -100,24 +106,21 @@ public:
|
||||
@param overrun Set if read buffer has been overrun, e.g. data not being read fast enough
|
||||
@param timestamp The timestamp of the first samples to be read
|
||||
@param underrun Set if LMS does not have data to transmit, e.g. data not being sent fast enough
|
||||
@param RSSI The received signal strength of the read result
|
||||
@return The number of samples actually read
|
||||
*/
|
||||
int readSamples(std::vector < short *>&buf, int len, bool * overrun,
|
||||
TIMESTAMP timestamp = 0xffffffff, bool * underrun =
|
||||
NULL, unsigned *RSSI = NULL);
|
||||
NULL);
|
||||
/**
|
||||
Write samples to the LMS.
|
||||
@param buf Contains the data to be written.
|
||||
@param len number of samples to write.
|
||||
@param underrun Set if LMS does not have data to transmit, e.g. data not being sent fast enough
|
||||
@param timestamp The timestamp of the first sample of the data buffer.
|
||||
@param isControl Set if data is a control packet, e.g. a ping command
|
||||
@return The number of samples actually written
|
||||
*/
|
||||
int writeSamples(std::vector < short *>&bufs, int len, bool * underrun,
|
||||
TIMESTAMP timestamp = 0xffffffff, bool isControl =
|
||||
false);
|
||||
TIMESTAMP timestamp = 0xffffffff);
|
||||
|
||||
/** Update the alignment between the read and write timestamps */
|
||||
bool updateAlignment(TIMESTAMP timestamp);
|
||||
@@ -153,7 +156,7 @@ public:
|
||||
|
||||
/** get the current receive gain */
|
||||
double getRxGain(size_t chan = 0) {
|
||||
return rxGain;
|
||||
return rx_gains[chan];
|
||||
}
|
||||
|
||||
/** return maximum Rx Gain **/
|
||||
@@ -165,6 +168,11 @@ public:
|
||||
/** sets the transmit chan gain, returns the gain setting **/
|
||||
double setTxGain(double dB, size_t chan = 0);
|
||||
|
||||
/** get transmit gain */
|
||||
double getTxGain(size_t chan = 0) {
|
||||
return tx_gains[chan];
|
||||
}
|
||||
|
||||
/** return maximum Tx Gain **/
|
||||
double maxTxGain(void);
|
||||
|
||||
|
||||
@@ -33,11 +33,12 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#ifndef USE_UHD_3_11
|
||||
#ifdef USE_UHD_3_11
|
||||
#include <uhd/utils/log_add.hpp>
|
||||
#include <uhd/utils/thread.hpp>
|
||||
#else
|
||||
#include <uhd/utils/msg.hpp>
|
||||
#include <uhd/utils/thread_priority.hpp>
|
||||
#else
|
||||
#include <uhd/utils/thread.hpp>
|
||||
#endif
|
||||
|
||||
#define USRP_TX_AMPL 0.3
|
||||
@@ -120,12 +121,13 @@ static const std::map<dev_key, dev_desc> dev_param_map {
|
||||
{ std::make_tuple(UMTRX, 4, 4), { 2, 0.0, GSMRATE, 5.1503e-5, "UmTRX 4 SPS" } },
|
||||
{ std::make_tuple(LIMESDR, 4, 4), { 1, GSMRATE*32, GSMRATE, 8.9e-5, "LimeSDR 4 SPS" } },
|
||||
{ std::make_tuple(B2XX_MCBTS, 4, 4), { 1, 51.2e6, MCBTS_SPACING*4, B2XX_TIMING_MCBTS, "B200/B210 4 SPS Multi-ARFCN" } },
|
||||
{ std::make_tuple(OCR01, 4, 1), { 2, 26e6, GSMRATE, B2XX_TIMING_4SPS, "OCR01 4/1 Tx/Rx SPS"} },
|
||||
{ std::make_tuple(OCR01, 4, 4), { 2, 26e6, GSMRATE, B2XX_TIMING_4_4SPS, "OCR01 4/4 Tx/Rx SPS"} },
|
||||
};
|
||||
|
||||
void *async_event_loop(uhd_device *dev)
|
||||
{
|
||||
set_selfthread_name("UHDAsyncEvent");
|
||||
dev->setPriority(0.43);
|
||||
|
||||
while (1) {
|
||||
dev->recv_async_msg();
|
||||
@@ -135,23 +137,52 @@ void *async_event_loop(uhd_device *dev)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifndef USE_UHD_3_11
|
||||
#ifdef USE_UHD_3_11
|
||||
static void uhd_log_handler(const uhd::log::logging_info &info)
|
||||
{
|
||||
int level;
|
||||
|
||||
switch (info.verbosity)
|
||||
{
|
||||
case uhd::log::trace:
|
||||
case uhd::log::debug:
|
||||
level = LOGL_DEBUG;
|
||||
break;
|
||||
case uhd::log::info:
|
||||
level = LOGL_INFO;
|
||||
break;
|
||||
case uhd::log::warning:
|
||||
level = LOGL_NOTICE;
|
||||
break;
|
||||
case uhd::log::error:
|
||||
level = LOGL_ERROR;
|
||||
break;
|
||||
case uhd::log::fatal:
|
||||
level = LOGL_FATAL;
|
||||
break;
|
||||
default:
|
||||
level = LOGL_NOTICE;
|
||||
}
|
||||
|
||||
LOGSRC(DDEVDRV, level, info.file.c_str(), info.line) << "[" << info.component << "] " << info.message;
|
||||
}
|
||||
#else
|
||||
/*
|
||||
Catch and drop underrun 'U' and overrun 'O' messages from stdout
|
||||
since we already report using the logging facility. Direct
|
||||
everything else appropriately.
|
||||
*/
|
||||
void uhd_msg_handler(uhd::msg::type_t type, const std::string &msg)
|
||||
static void uhd_msg_handler(uhd::msg::type_t type, const std::string &msg)
|
||||
{
|
||||
switch (type) {
|
||||
case uhd::msg::status:
|
||||
LOGC(DDEV, INFO) << msg;
|
||||
LOGC(DDEVDRV, INFO) << msg;
|
||||
break;
|
||||
case uhd::msg::warning:
|
||||
LOGC(DDEV, WARNING) << msg;
|
||||
LOGC(DDEVDRV, NOTICE) << msg;
|
||||
break;
|
||||
case uhd::msg::error:
|
||||
LOGC(DDEV, ERROR) << msg;
|
||||
LOGC(DDEVDRV, ERROR) << msg;
|
||||
break;
|
||||
case uhd::msg::fastpath:
|
||||
break;
|
||||
@@ -160,10 +191,10 @@ void uhd_msg_handler(uhd::msg::type_t type, const std::string &msg)
|
||||
#endif
|
||||
|
||||
uhd_device::uhd_device(size_t tx_sps, size_t rx_sps,
|
||||
InterfaceType iface, size_t chans, double lo_offset,
|
||||
InterfaceType iface, size_t chan_num, double lo_offset,
|
||||
const std::vector<std::string>& tx_paths,
|
||||
const std::vector<std::string>& rx_paths)
|
||||
: RadioDevice(tx_sps, rx_sps, iface, chans, lo_offset, tx_paths, rx_paths),
|
||||
: RadioDevice(tx_sps, rx_sps, iface, chan_num, lo_offset, tx_paths, rx_paths),
|
||||
tx_gain_min(0.0), tx_gain_max(0.0),
|
||||
rx_gain_min(0.0), rx_gain_max(0.0),
|
||||
tx_spp(0), rx_spp(0),
|
||||
@@ -248,9 +279,6 @@ void uhd_device::set_rates()
|
||||
|
||||
double uhd_device::setTxGain(double db, size_t chan)
|
||||
{
|
||||
if (iface == MULTI_ARFCN)
|
||||
chan = 0;
|
||||
|
||||
if (chan >= tx_gains.size()) {
|
||||
LOGC(DDEV, ALERT) << "Requested non-existent channel" << chan;
|
||||
return 0.0f;
|
||||
@@ -282,9 +310,6 @@ double uhd_device::setTxGain(double db, size_t chan)
|
||||
|
||||
double uhd_device::setRxGain(double db, size_t chan)
|
||||
{
|
||||
if (iface == MULTI_ARFCN)
|
||||
chan = 0;
|
||||
|
||||
if (chan >= rx_gains.size()) {
|
||||
LOGC(DDEV, ALERT) << "Requested non-existent channel " << chan;
|
||||
return 0.0f;
|
||||
@@ -300,9 +325,6 @@ double uhd_device::setRxGain(double db, size_t chan)
|
||||
|
||||
double uhd_device::getRxGain(size_t chan)
|
||||
{
|
||||
if (iface == MULTI_ARFCN)
|
||||
chan = 0;
|
||||
|
||||
if (chan >= rx_gains.size()) {
|
||||
LOGC(DDEV, ALERT) << "Requested non-existent channel " << chan;
|
||||
return 0.0f;
|
||||
@@ -311,6 +333,16 @@ double uhd_device::getRxGain(size_t chan)
|
||||
return rx_gains[chan];
|
||||
}
|
||||
|
||||
double uhd_device::getTxGain(size_t chan)
|
||||
{
|
||||
if (chan >= tx_gains.size()) {
|
||||
LOGC(DDEV, ALERT) << "Requested non-existent channel " << chan;
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
return tx_gains[chan];
|
||||
}
|
||||
|
||||
/*
|
||||
Parse the UHD device tree and mboard name to find out what device we're
|
||||
dealing with. We need the window type so that the transceiver knows how to
|
||||
@@ -338,6 +370,7 @@ bool uhd_device::parse_dev_type()
|
||||
{ "USRP2", { USRP2, TX_WINDOW_FIXED } },
|
||||
{ "UmTRX", { UMTRX, TX_WINDOW_FIXED } },
|
||||
{ "LimeSDR", { LIMESDR, TX_WINDOW_FIXED } },
|
||||
{ "OCR01", { OCR01, TX_WINDOW_USRP1 } },
|
||||
};
|
||||
|
||||
// Compare UHD motherboard and device strings */
|
||||
@@ -379,10 +412,9 @@ static bool uhd_e3xx_version_chk()
|
||||
void uhd_device::set_channels(bool swap)
|
||||
{
|
||||
if (iface == MULTI_ARFCN) {
|
||||
if (dev_type != B200 && dev_type != B210)
|
||||
if (dev_type != B200 && dev_type != B210 && dev_type != OCR01)
|
||||
throw std::invalid_argument("Device does not support MCBTS");
|
||||
dev_type = B2XX_MCBTS;
|
||||
chans = 1;
|
||||
}
|
||||
|
||||
if (chans > dev_param_map.at(dev_key(dev_type, tx_sps, rx_sps)).channels)
|
||||
@@ -392,6 +424,7 @@ void uhd_device::set_channels(bool swap)
|
||||
switch (dev_type) {
|
||||
case B210:
|
||||
case E3XX:
|
||||
case OCR01:
|
||||
if (chans == 1)
|
||||
subdev_string = swap ? "A:B" : "A:A";
|
||||
else if (chans == 2)
|
||||
@@ -419,6 +452,16 @@ int uhd_device::open(const std::string &args, int ref, bool swap_channels)
|
||||
{
|
||||
const char *refstr;
|
||||
|
||||
/* Register msg handler. Different APIs depending on UHD version */
|
||||
#ifdef USE_UHD_3_11
|
||||
uhd::log::add_logger("OsmoTRX", &uhd_log_handler);
|
||||
uhd::log::set_log_level(uhd::log::debug);
|
||||
uhd::log::set_console_level(uhd::log::off);
|
||||
uhd::log::set_logger_level("OsmoTRX", uhd::log::debug);
|
||||
#else
|
||||
uhd::msg::register_handler(&uhd_msg_handler);
|
||||
#endif
|
||||
|
||||
// Find UHD devices
|
||||
uhd::device_addr_t addr(args);
|
||||
uhd::device_addrs_t dev_addrs = uhd::device::find(addr);
|
||||
@@ -527,7 +570,7 @@ int uhd_device::open(const std::string &args, int ref, bool swap_channels)
|
||||
init_gains();
|
||||
|
||||
// Print configuration
|
||||
LOGC(DDEV, INFO) << "\n" << usrp_dev->get_pp_string();
|
||||
LOGC(DDEV, INFO) << "Device configuration: " << usrp_dev->get_pp_string();
|
||||
|
||||
if (iface == MULTI_ARFCN)
|
||||
return MULTI_ARFCN;
|
||||
@@ -543,6 +586,7 @@ int uhd_device::open(const std::string &args, int ref, bool swap_channels)
|
||||
case E1XX:
|
||||
case E3XX:
|
||||
case LIMESDR:
|
||||
case OCR01:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -605,10 +649,6 @@ bool uhd_device::start()
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifndef USE_UHD_3_11
|
||||
// Register msg handler
|
||||
uhd::msg::register_handler(&uhd_msg_handler);
|
||||
#endif
|
||||
// Start asynchronous event (underrun check) loop
|
||||
async_event_thrd = new Thread();
|
||||
async_event_thrd->start((void * (*)(void*))async_event_loop, (void*)this);
|
||||
@@ -643,12 +683,6 @@ bool uhd_device::stop()
|
||||
return true;
|
||||
}
|
||||
|
||||
void uhd_device::setPriority(float prio)
|
||||
{
|
||||
uhd::set_thread_priority_safe(prio);
|
||||
return;
|
||||
}
|
||||
|
||||
int uhd_device::check_rx_md_err(uhd::rx_metadata_t &md, ssize_t num_smpls)
|
||||
{
|
||||
if (!num_smpls) {
|
||||
@@ -692,7 +726,7 @@ int uhd_device::check_rx_md_err(uhd::rx_metadata_t &md, ssize_t num_smpls)
|
||||
}
|
||||
|
||||
int uhd_device::readSamples(std::vector<short *> &bufs, int len, bool *overrun,
|
||||
TIMESTAMP timestamp, bool *underrun, unsigned *RSSI)
|
||||
TIMESTAMP timestamp, bool *underrun)
|
||||
{
|
||||
ssize_t rc;
|
||||
uhd::time_spec_t ts;
|
||||
@@ -749,7 +783,7 @@ int uhd_device::readSamples(std::vector<short *> &bufs, int len, bool *overrun,
|
||||
for (size_t i = 0; i < rx_buffers.size(); i++) {
|
||||
rc = rx_buffers[i]->write((short *) &pkt_bufs[i].front(),
|
||||
num_smpls,
|
||||
metadata.time_spec.to_ticks(rx_rate));
|
||||
ts.to_ticks(rx_rate));
|
||||
|
||||
// Continue on local overrun, exit on other errors
|
||||
if ((rc < 0)) {
|
||||
@@ -775,7 +809,7 @@ int uhd_device::readSamples(std::vector<short *> &bufs, int len, bool *overrun,
|
||||
}
|
||||
|
||||
int uhd_device::writeSamples(std::vector<short *> &bufs, int len, bool *underrun,
|
||||
unsigned long long timestamp,bool isControl)
|
||||
unsigned long long timestamp)
|
||||
{
|
||||
uhd::tx_metadata_t metadata;
|
||||
metadata.has_time_spec = true;
|
||||
@@ -785,12 +819,6 @@ int uhd_device::writeSamples(std::vector<short *> &bufs, int len, bool *underrun
|
||||
|
||||
*underrun = false;
|
||||
|
||||
// No control packets
|
||||
if (isControl) {
|
||||
LOGC(DDEV, ERROR) << "Control packets not supported";
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (bufs.size() != chans) {
|
||||
LOGC(DDEV, ALERT) << "Invalid channel combination " << bufs.size();
|
||||
return -1;
|
||||
@@ -890,15 +918,18 @@ bool uhd_device::set_freq(double freq, size_t chan, bool tx)
|
||||
std::vector<double> freqs;
|
||||
uhd::tune_result_t tres;
|
||||
uhd::tune_request_t treq = select_freq(freq, chan, tx);
|
||||
std::string str_dir;
|
||||
|
||||
if (tx) {
|
||||
tres = usrp_dev->set_tx_freq(treq, chan);
|
||||
tx_freqs[chan] = usrp_dev->get_tx_freq(chan);
|
||||
str_dir = "Tx";
|
||||
} else {
|
||||
tres = usrp_dev->set_rx_freq(treq, chan);
|
||||
rx_freqs[chan] = usrp_dev->get_rx_freq(chan);
|
||||
str_dir = "Rx";
|
||||
}
|
||||
LOGC(DDEV, INFO) << "\n" << tres.to_pp_string() << std::endl;
|
||||
LOGCHAN(chan, DDEV, INFO) << "set_freq(" << freq << ", " << str_dir << "): " << tres.to_pp_string() << std::endl;
|
||||
|
||||
if ((chans == 1) || ((chans == 2) && dev_type == UMTRX))
|
||||
return true;
|
||||
@@ -918,7 +949,7 @@ bool uhd_device::set_freq(double freq, size_t chan, bool tx)
|
||||
rx_freqs[!chan] = usrp_dev->get_rx_freq(!chan);
|
||||
|
||||
}
|
||||
LOGC(DDEV, INFO) << "\n" << tres.to_pp_string() << std::endl;
|
||||
LOGCHAN(chan, DDEV, INFO) << "set_freq(" << freq << ", " << str_dir << "): " << tres.to_pp_string() << std::endl;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -50,6 +50,7 @@ enum uhd_dev_type {
|
||||
X3XX,
|
||||
UMTRX,
|
||||
LIMESDR,
|
||||
OCR01,
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -62,7 +63,7 @@ enum uhd_dev_type {
|
||||
class uhd_device : public RadioDevice {
|
||||
public:
|
||||
uhd_device(size_t tx_sps, size_t rx_sps, InterfaceType type,
|
||||
size_t chans, double offset,
|
||||
size_t chan_num, double offset,
|
||||
const std::vector<std::string>& tx_paths,
|
||||
const std::vector<std::string>& rx_paths);
|
||||
~uhd_device();
|
||||
@@ -71,14 +72,13 @@ public:
|
||||
bool start();
|
||||
bool stop();
|
||||
bool restart();
|
||||
void setPriority(float prio);
|
||||
enum TxWindowType getWindowType() { return tx_window; }
|
||||
|
||||
int readSamples(std::vector<short *> &bufs, int len, bool *overrun,
|
||||
TIMESTAMP timestamp, bool *underrun, unsigned *RSSI);
|
||||
TIMESTAMP timestamp, bool *underrun);
|
||||
|
||||
int writeSamples(std::vector<short *> &bufs, int len, bool *underrun,
|
||||
TIMESTAMP timestamp, bool isControl);
|
||||
TIMESTAMP timestamp);
|
||||
|
||||
bool updateAlignment(TIMESTAMP timestamp);
|
||||
|
||||
@@ -97,6 +97,7 @@ public:
|
||||
double minRxGain(void) { return rx_gain_min; }
|
||||
|
||||
double setTxGain(double db, size_t chan);
|
||||
double getTxGain(size_t chan = 0);
|
||||
double maxTxGain(void) { return tx_gain_max; }
|
||||
double minTxGain(void) { return tx_gain_min; }
|
||||
|
||||
|
||||
@@ -61,16 +61,17 @@ const dboardConfigType dboardConfig = TXA_RXB;
|
||||
const double USRPDevice::masterClockRate = 52.0e6;
|
||||
|
||||
USRPDevice::USRPDevice(size_t tx_sps, size_t rx_sps, InterfaceType iface,
|
||||
size_t chans, double lo_offset,
|
||||
size_t chan_num, double lo_offset,
|
||||
const std::vector<std::string>& tx_paths,
|
||||
const std::vector<std::string>& rx_paths):
|
||||
RadioDevice(tx_sps, rx_sps, iface, chans, lo_offset, tx_paths, rx_paths)
|
||||
RadioDevice(tx_sps, rx_sps, iface, chan_num, lo_offset, tx_paths, rx_paths)
|
||||
{
|
||||
LOGC(DDEV, INFO) << "creating USRP device...";
|
||||
|
||||
decimRate = (unsigned int) round(masterClockRate/((GSMRATE) * (double) tx_sps));
|
||||
actualSampleRate = masterClockRate/decimRate;
|
||||
rxGain = 0;
|
||||
txGain = 0;
|
||||
|
||||
/*
|
||||
* Undetermined delay b/w ping response timestamp and true
|
||||
@@ -279,10 +280,11 @@ double USRPDevice::setTxGain(double dB, size_t chan)
|
||||
|
||||
if (!m_dbTx->set_gain(dB))
|
||||
LOGC(DDEV, ERR) << "Error setting TX gain";
|
||||
|
||||
else
|
||||
txGain = dB;
|
||||
writeLock.unlock();
|
||||
|
||||
return dB;
|
||||
return txGain;
|
||||
}
|
||||
|
||||
|
||||
@@ -305,10 +307,11 @@ double USRPDevice::setRxGain(double dB, size_t chan)
|
||||
|
||||
if (!m_dbRx->set_gain(dB))
|
||||
LOGC(DDEV, ERR) << "Error setting RX gain";
|
||||
|
||||
else
|
||||
rxGain = dB;
|
||||
writeLock.unlock();
|
||||
|
||||
return dB;
|
||||
return rxGain;
|
||||
}
|
||||
|
||||
bool USRPDevice::setRxAntenna(const std::string &ant, size_t chan)
|
||||
@@ -362,7 +365,7 @@ GSM::Time USRPDevice::minLatency() {
|
||||
|
||||
// NOTE: Assumes sequential reads
|
||||
int USRPDevice::readSamples(std::vector<short *> &bufs, int len, bool *overrun,
|
||||
TIMESTAMP timestamp, bool *underrun, unsigned *RSSI)
|
||||
TIMESTAMP timestamp, bool *underrun)
|
||||
{
|
||||
#ifndef SWLOOPBACK
|
||||
if (!m_uRx)
|
||||
@@ -430,8 +433,10 @@ int USRPDevice::readSamples(std::vector<short *> &bufs, int len, bool *overrun,
|
||||
*underrun = true;
|
||||
LOGC(DDEV, DEBUG) << "UNDERRUN in TRX->USRP interface";
|
||||
}
|
||||
if (RSSI) *RSSI = (word0 >> 21) & 0x3f;
|
||||
|
||||
#if 0
|
||||
/* FIXME: Do something with this ? */
|
||||
unsigned RSSI = (word0 >> 21) & 0x3f;
|
||||
#endif
|
||||
if (!isAligned) continue;
|
||||
|
||||
unsigned cursorStart = pktTimestamp - timeStart + dataStart;
|
||||
@@ -510,9 +515,8 @@ int USRPDevice::readSamples(std::vector<short *> &bufs, int len, bool *overrun,
|
||||
#endif
|
||||
}
|
||||
|
||||
int USRPDevice::writeSamples(std::vector<short *> &bufs, int len,
|
||||
bool *underrun, unsigned long long timestamp,
|
||||
bool isControl)
|
||||
int USRPDevice::writeSamplesControl(std::vector<short *> &bufs, int len,
|
||||
bool *underrun, unsigned long long timestamp, bool isControl)
|
||||
{
|
||||
writeLock.lock();
|
||||
|
||||
@@ -566,6 +570,12 @@ int USRPDevice::writeSamples(std::vector<short *> &bufs, int len,
|
||||
#endif
|
||||
}
|
||||
|
||||
int USRPDevice::writeSamples(std::vector<short *> &bufs, int len,
|
||||
bool *underrun, unsigned long long timestamp)
|
||||
{
|
||||
return writeSamplesControl(bufs, len, underrun, timestamp, false);
|
||||
}
|
||||
|
||||
bool USRPDevice::updateAlignment(TIMESTAMP timestamp)
|
||||
{
|
||||
#ifndef SWLOOPBACK
|
||||
@@ -575,7 +585,7 @@ bool USRPDevice::updateAlignment(TIMESTAMP timestamp)
|
||||
bool tmpUnderrun;
|
||||
|
||||
std::vector<short *> buf(1, data);
|
||||
if (writeSamples(buf, 1, &tmpUnderrun, timestamp & 0x0ffffffffll, true)) {
|
||||
if (writeSamplesControl(buf, 1, &tmpUnderrun, timestamp & 0x0ffffffffll, true)) {
|
||||
pingTimestamp = timestamp;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0+
|
||||
*
|
||||
* This software is distributed under multiple licenses; see the COPYING file in
|
||||
* the main directory for licensing information for this specific distribuion.
|
||||
* the main directory for licensing information for this specific distribution.
|
||||
*
|
||||
* This use of this software may be subject to additional restrictions.
|
||||
* See the LEGAL file in the main directory for details.
|
||||
@@ -80,6 +80,10 @@ private:
|
||||
unsigned long lastPktTimestamp;
|
||||
|
||||
double rxGain;
|
||||
double txGain;
|
||||
|
||||
int writeSamplesControl(std::vector<short *> &bufs, int len, bool *underrun,
|
||||
TIMESTAMP timestamp = 0xffffffff, bool isControl = false);
|
||||
|
||||
#ifdef SWLOOPBACK
|
||||
short loopbackBuffer[1000000];
|
||||
@@ -94,7 +98,7 @@ private:
|
||||
public:
|
||||
|
||||
/** Object constructor */
|
||||
USRPDevice(size_t tx_sps, size_t rx_sps, InterfaceType iface, size_t chans, double lo_offset,
|
||||
USRPDevice(size_t tx_sps, size_t rx_sps, InterfaceType iface, size_t chan_num, double lo_offset,
|
||||
const std::vector<std::string>& tx_paths,
|
||||
const std::vector<std::string>& rx_paths);
|
||||
|
||||
@@ -107,9 +111,6 @@ private:
|
||||
/** Stop the USRP */
|
||||
bool stop();
|
||||
|
||||
/** Set priority not supported */
|
||||
void setPriority(float prio = 0.5) { }
|
||||
|
||||
enum TxWindowType getWindowType() { return TX_WINDOW_USRP1; }
|
||||
|
||||
/**
|
||||
@@ -119,23 +120,20 @@ private:
|
||||
@param overrun Set if read buffer has been overrun, e.g. data not being read fast enough
|
||||
@param timestamp The timestamp of the first samples to be read
|
||||
@param underrun Set if USRP does not have data to transmit, e.g. data not being sent fast enough
|
||||
@param RSSI The received signal strength of the read result
|
||||
@return The number of samples actually read
|
||||
*/
|
||||
int readSamples(std::vector<short *> &buf, int len, bool *overrun,
|
||||
TIMESTAMP timestamp = 0xffffffff, bool *underrun = NULL,
|
||||
unsigned *RSSI = NULL);
|
||||
TIMESTAMP timestamp = 0xffffffff, bool *underrun = NULL);
|
||||
/**
|
||||
Write samples to the USRP.
|
||||
@param buf Contains the data to be written.
|
||||
@param len number of samples to write.
|
||||
@param underrun Set if USRP does not have data to transmit, e.g. data not being sent fast enough
|
||||
@param timestamp The timestamp of the first sample of the data buffer.
|
||||
@param isControl Set if data is a control packet, e.g. a ping command
|
||||
@return The number of samples actually written
|
||||
*/
|
||||
int writeSamples(std::vector<short *> &bufs, int len, bool *underrun,
|
||||
TIMESTAMP timestamp = 0xffffffff, bool isControl = false);
|
||||
TIMESTAMP timestamp = 0xffffffff);
|
||||
|
||||
/** Update the alignment between the read and write timestamps */
|
||||
bool updateAlignment(TIMESTAMP timestamp);
|
||||
@@ -173,6 +171,9 @@ private:
|
||||
/** sets the transmit chan gain, returns the gain setting **/
|
||||
double setTxGain(double dB, size_t chan = 0);
|
||||
|
||||
/** get transmit gain */
|
||||
double getTxGain(size_t chan = 0) { return txGain; }
|
||||
|
||||
/** return maximum Tx Gain **/
|
||||
double maxTxGain(void);
|
||||
|
||||
|
||||
@@ -173,11 +173,11 @@ static void sig_handler(int signo)
|
||||
action like printing */
|
||||
return;
|
||||
|
||||
fprintf(stdout, "signal %d received\n", signo);
|
||||
fprintf(stderr, "signal %d received\n", signo);
|
||||
switch (signo) {
|
||||
case SIGINT:
|
||||
case SIGTERM:
|
||||
fprintf(stdout, "shutting down\n");
|
||||
fprintf(stderr, "shutting down\n");
|
||||
gshutdown = true;
|
||||
break;
|
||||
case SIGABRT:
|
||||
@@ -334,14 +334,12 @@ static void handle_options(int argc, char **argv, struct trx_ctx* trx)
|
||||
break;
|
||||
case 'r':
|
||||
print_deprecated(option);
|
||||
trx->cfg.rtsc_set = true;
|
||||
trx->cfg.rtsc = atoi(optarg);
|
||||
if (!trx->cfg.egprs) /* Don't override egprs which sets different filler */
|
||||
trx->cfg.filler = FILLER_NORM_RAND;
|
||||
break;
|
||||
case 'A':
|
||||
print_deprecated(option);
|
||||
trx->cfg.rach_delay_set = true;
|
||||
trx->cfg.rach_delay = atoi(optarg);
|
||||
trx->cfg.filler = FILLER_ACCESS_RAND;
|
||||
break;
|
||||
@@ -383,6 +381,11 @@ static void handle_options(int argc, char **argv, struct trx_ctx* trx)
|
||||
}
|
||||
}
|
||||
|
||||
if (argc > optind) {
|
||||
LOG(ERROR) << "Unsupported positional arguments on command line";
|
||||
goto bad_config;
|
||||
}
|
||||
|
||||
/* Cmd line option specific validation & setup */
|
||||
|
||||
if (trx->cfg.num_chans > TRX_CHAN_MAX) {
|
||||
@@ -459,7 +462,9 @@ static void print_config(struct trx_ctx *trx)
|
||||
ost << " EDGE support............ " << trx->cfg.egprs << std::endl;
|
||||
ost << " Extended RACH support... " << trx->cfg.ext_rach << std::endl;
|
||||
ost << " Reference............... " << trx->cfg.clock_ref << std::endl;
|
||||
ost << " C0 Filler Table......... " << trx->cfg.filler << std::endl;
|
||||
ost << " Filler Burst Type....... " << get_value_string(filler_names, trx->cfg.filler) << std::endl;
|
||||
ost << " Filler Burst TSC........ " << trx->cfg.rtsc << std::endl;
|
||||
ost << " Filler Burst RACH Delay. " << trx->cfg.rach_delay << std::endl;
|
||||
ost << " Multi-Carrier........... " << trx->cfg.multi_arfcn << std::endl;
|
||||
ost << " Tuning offset........... " << trx->cfg.offset << std::endl;
|
||||
ost << " RSSI to dBm offset...... " << trx->cfg.rssi_offset << std::endl;
|
||||
@@ -571,20 +576,22 @@ int main(int argc, char *argv[])
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (!log_mutex_init()) {
|
||||
fprintf(stderr, "Failed to initialize log mutex!\n");
|
||||
exit(2);
|
||||
}
|
||||
#ifndef HAVE_ATOMIC_OPS
|
||||
#pragma message ("Built without atomic operation support. Using Mutex, it may affect performance!")
|
||||
printf("Built without atomic operation support. Using Mutex, it may affect performance!\n");
|
||||
#endif
|
||||
|
||||
convolve_init();
|
||||
convert_init();
|
||||
|
||||
osmo_init_logging2(tall_trx_ctx, &log_info);
|
||||
log_enable_multithread();
|
||||
osmo_stats_init(tall_trx_ctx);
|
||||
vty_init(&g_vty_info);
|
||||
logging_vty_add_cmds();
|
||||
ctrl_vty_init(tall_trx_ctx);
|
||||
trx_vty_init(g_trx_ctx);
|
||||
|
||||
logging_vty_add_cmds();
|
||||
osmo_talloc_vty_add_cmds();
|
||||
osmo_stats_vty_add_cmds();
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ bool trxd_send_burst_ind_v0(size_t chan, int fd, const struct trx_ul_burst_ind *
|
||||
if(bi->idle)
|
||||
return true;
|
||||
|
||||
/* +2: Historically (OpenBTS times), two extra non-used bytes are sent appeneded to each burst */
|
||||
/* +2: Historically (OpenBTS times), two extra non-used bytes are sent appended to each burst */
|
||||
char buf[sizeof(struct trxd_hdr_v0) + bi->nbits + 2];
|
||||
struct trxd_hdr_v0* pkt = (struct trxd_hdr_v0*)buf;
|
||||
|
||||
|
||||
@@ -66,6 +66,13 @@ struct trxd_hdr_v0 {
|
||||
uint8_t soft_bits[0];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* Downlink burst (BTS->TRX), v0 anf v1 use same format */
|
||||
struct trxd_hdr_v01_dl {
|
||||
struct trxd_hdr_common common;
|
||||
uint8_t tx_att; /* Tx Attentuation */
|
||||
uint8_t soft_bits[0];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
#define TRXD_MODULATION_GMSK(ts_set) (0b0000 | (ts_set & 0b0011))
|
||||
#define TRXD_MODULATION_8PSK(ts_set) (0b0100 | (ts_set & 0b0001))
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "radioInterface.h"
|
||||
#include "Resampler.h"
|
||||
#include <Logger.h>
|
||||
#include <Threads.h>
|
||||
|
||||
extern "C" {
|
||||
#include "convert.h"
|
||||
@@ -32,10 +33,10 @@ extern "C" {
|
||||
#define CHUNK 625
|
||||
#define NUMCHUNKS 4
|
||||
|
||||
RadioInterface::RadioInterface(RadioDevice *wRadio, size_t tx_sps,
|
||||
RadioInterface::RadioInterface(RadioDevice *wDevice, size_t tx_sps,
|
||||
size_t rx_sps, size_t chans,
|
||||
int wReceiveOffset, GSM::Time wStartTime)
|
||||
: mRadio(wRadio), mSPSTx(tx_sps), mSPSRx(rx_sps), mChans(chans),
|
||||
: mDevice(wDevice), mSPSTx(tx_sps), mSPSRx(rx_sps), mChans(chans),
|
||||
underrun(false), overrun(false), writeTimestamp(0), readTimestamp(0),
|
||||
receiveOffset(wReceiveOffset), mOn(false)
|
||||
{
|
||||
@@ -93,11 +94,11 @@ void RadioInterface::close()
|
||||
}
|
||||
|
||||
double RadioInterface::fullScaleInputValue(void) {
|
||||
return mRadio->fullScaleInputValue();
|
||||
return mDevice->fullScaleInputValue();
|
||||
}
|
||||
|
||||
double RadioInterface::fullScaleOutputValue(void) {
|
||||
return mRadio->fullScaleOutputValue();
|
||||
return mDevice->fullScaleOutputValue();
|
||||
}
|
||||
|
||||
int RadioInterface::setPowerAttenuation(int atten, size_t chan)
|
||||
@@ -112,8 +113,8 @@ int RadioInterface::setPowerAttenuation(int atten, size_t chan)
|
||||
if (atten < 0.0)
|
||||
atten = 0.0;
|
||||
|
||||
rfGain = mRadio->setTxGain(mRadio->maxTxGain() - (double) atten, chan);
|
||||
digAtten = (double) atten - mRadio->maxTxGain() + rfGain;
|
||||
rfGain = setTxGain(mDevice->maxTxGain() - (double) atten, chan);
|
||||
digAtten = (double) atten - mDevice->maxTxGain() + rfGain;
|
||||
|
||||
if (digAtten < 1.0)
|
||||
powerScaling[chan] = 1.0;
|
||||
@@ -148,12 +149,12 @@ int RadioInterface::unRadioifyVector(signalVector *newVector, size_t chan)
|
||||
|
||||
bool RadioInterface::tuneTx(double freq, size_t chan)
|
||||
{
|
||||
return mRadio->setTxFreq(freq, chan);
|
||||
return mDevice->setTxFreq(freq, chan);
|
||||
}
|
||||
|
||||
bool RadioInterface::tuneRx(double freq, size_t chan)
|
||||
{
|
||||
return mRadio->setRxFreq(freq, chan);
|
||||
return mDevice->setRxFreq(freq, chan);
|
||||
}
|
||||
|
||||
/** synchronization thread loop */
|
||||
@@ -169,7 +170,7 @@ void *AlignRadioServiceLoopAdapter(RadioInterface *radioInterface)
|
||||
}
|
||||
|
||||
void RadioInterface::alignRadio() {
|
||||
mRadio->updateAlignment(writeTimestamp+ (TIMESTAMP) 10000);
|
||||
mDevice->updateAlignment(writeTimestamp+ (TIMESTAMP) 10000);
|
||||
}
|
||||
|
||||
bool RadioInterface::start()
|
||||
@@ -178,12 +179,12 @@ bool RadioInterface::start()
|
||||
return true;
|
||||
|
||||
LOG(INFO) << "Starting radio device";
|
||||
if (mRadio->requiresRadioAlign())
|
||||
if (mDevice->requiresRadioAlign())
|
||||
mAlignRadioServiceLoopThread.start(
|
||||
(void * (*)(void*))AlignRadioServiceLoopAdapter,
|
||||
(void*)this);
|
||||
|
||||
if (!mRadio->start())
|
||||
if (!mDevice->start())
|
||||
return false;
|
||||
|
||||
for (size_t i = 0; i < mChans; i++) {
|
||||
@@ -191,11 +192,11 @@ bool RadioInterface::start()
|
||||
recvBuffer[i]->reset();
|
||||
}
|
||||
|
||||
writeTimestamp = mRadio->initialWriteTimestamp();
|
||||
readTimestamp = mRadio->initialReadTimestamp();
|
||||
writeTimestamp = mDevice->initialWriteTimestamp();
|
||||
readTimestamp = mDevice->initialReadTimestamp();
|
||||
|
||||
mRadio->updateAlignment(writeTimestamp-10000);
|
||||
mRadio->updateAlignment(writeTimestamp-10000);
|
||||
mDevice->updateAlignment(writeTimestamp-10000);
|
||||
mDevice->updateAlignment(writeTimestamp-10000);
|
||||
|
||||
mOn = true;
|
||||
LOG(INFO) << "Radio started";
|
||||
@@ -211,7 +212,7 @@ bool RadioInterface::start()
|
||||
*/
|
||||
bool RadioInterface::stop()
|
||||
{
|
||||
if (!mOn || !mRadio->stop())
|
||||
if (!mOn || !mDevice->stop())
|
||||
return false;
|
||||
|
||||
mOn = false;
|
||||
@@ -288,9 +289,9 @@ int RadioInterface::driveReceiveRadio()
|
||||
|
||||
bool RadioInterface::isUnderrun()
|
||||
{
|
||||
bool retVal = underrun;
|
||||
underrun = false;
|
||||
|
||||
bool retVal;
|
||||
/* atomically get previous value of "underrun" and set the var to false */
|
||||
retVal = osmo_trx_sync_fetch_and_and(&underrun, false);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
@@ -304,12 +305,12 @@ VectorFIFO* RadioInterface::receiveFIFO(size_t chan)
|
||||
|
||||
double RadioInterface::setRxGain(double dB, size_t chan)
|
||||
{
|
||||
return mRadio->setRxGain(dB, chan);
|
||||
return mDevice->setRxGain(dB, chan);
|
||||
}
|
||||
|
||||
double RadioInterface::getRxGain(size_t chan)
|
||||
double RadioInterface::setTxGain(double dB, size_t chan)
|
||||
{
|
||||
return mRadio->getRxGain(chan);
|
||||
return mDevice->setTxGain(dB, chan);
|
||||
}
|
||||
|
||||
/* Receive a timestamped chunk from the device */
|
||||
@@ -323,7 +324,7 @@ int RadioInterface::pullBuffer()
|
||||
return -1;
|
||||
|
||||
/* Outer buffer access size is fixed */
|
||||
numRecv = mRadio->readSamples(convertRecvBuffer,
|
||||
numRecv = mDevice->readSamples(convertRecvBuffer,
|
||||
segmentLen,
|
||||
&overrun,
|
||||
readTimestamp,
|
||||
@@ -340,7 +341,7 @@ int RadioInterface::pullBuffer()
|
||||
segmentLen * 2);
|
||||
}
|
||||
|
||||
underrun |= local_underrun;
|
||||
osmo_trx_sync_or_and_fetch(&underrun, local_underrun);
|
||||
readTimestamp += numRecv;
|
||||
return 0;
|
||||
}
|
||||
@@ -362,11 +363,11 @@ bool RadioInterface::pushBuffer()
|
||||
}
|
||||
|
||||
/* Send the all samples in the send buffer */
|
||||
numSent = mRadio->writeSamples(convertSendBuffer,
|
||||
numSent = mDevice->writeSamples(convertSendBuffer,
|
||||
segmentLen,
|
||||
&local_underrun,
|
||||
writeTimestamp);
|
||||
underrun |= local_underrun;
|
||||
osmo_trx_sync_or_and_fetch(&underrun, local_underrun);
|
||||
writeTimestamp += numSent;
|
||||
|
||||
return true;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright 2008 Free Software Foundation, Inc.
|
||||
*
|
||||
* This software is distributed under multiple licenses; see the COPYING file in the main directory for licensing information for this specific distribuion.
|
||||
* This software is distributed under multiple licenses; see the COPYING file in the main directory for licensing information for this specific distribution.
|
||||
*
|
||||
* This use of this software may be subject to additional restrictions.
|
||||
* See the LEGAL file in the main directory for details.
|
||||
@@ -36,7 +36,7 @@ protected:
|
||||
|
||||
std::vector<VectorFIFO> mReceiveFIFO; ///< FIFO that holds receive bursts
|
||||
|
||||
RadioDevice *mRadio; ///< the USRP object
|
||||
RadioDevice *mDevice; ///< the USRP object
|
||||
|
||||
size_t mSPSTx;
|
||||
size_t mSPSRx;
|
||||
@@ -48,7 +48,7 @@ protected:
|
||||
std::vector<short *> convertRecvBuffer;
|
||||
std::vector<short *> convertSendBuffer;
|
||||
std::vector<float> powerScaling;
|
||||
bool underrun; ///< indicates writes to USRP are too slow
|
||||
int underrun; ///< indicates writes to USRP are too slow
|
||||
bool overrun; ///< indicates reads from USRP are too slow
|
||||
TIMESTAMP writeTimestamp; ///< sample timestamp of next packet written to USRP
|
||||
TIMESTAMP readTimestamp; ///< sample timestamp of next packet read from USRP
|
||||
@@ -79,12 +79,12 @@ public:
|
||||
bool start();
|
||||
bool stop();
|
||||
|
||||
/** intialization */
|
||||
/** initialization */
|
||||
virtual bool init(int type);
|
||||
virtual void close();
|
||||
|
||||
/** constructor */
|
||||
RadioInterface(RadioDevice* wRadio, size_t tx_sps, size_t rx_sps,
|
||||
RadioInterface(RadioDevice* wDevice, size_t tx_sps, size_t rx_sps,
|
||||
size_t chans = 1, int receiveOffset = 3,
|
||||
GSM::Time wStartTime = GSM::Time(0));
|
||||
|
||||
@@ -107,10 +107,7 @@ public:
|
||||
virtual bool tuneRx(double freq, size_t chan = 0);
|
||||
|
||||
/** set receive gain */
|
||||
double setRxGain(double dB, size_t chan = 0);
|
||||
|
||||
/** get receive gain */
|
||||
double getRxGain(size_t chan = 0);
|
||||
virtual double setRxGain(double dB, size_t chan = 0);
|
||||
|
||||
/** drive transmission of GSM bursts */
|
||||
void driveTransmitRadio(std::vector<signalVector *> &bursts,
|
||||
@@ -127,19 +124,19 @@ public:
|
||||
/** returns the full-scale receive amplitude **/
|
||||
double fullScaleOutputValue();
|
||||
|
||||
/** set thread priority on current thread */
|
||||
void setPriority(float prio = 0.5) { mRadio->setPriority(prio); }
|
||||
|
||||
/** get transport window type of attached device */
|
||||
enum RadioDevice::TxWindowType getWindowType() { return mRadio->getWindowType(); }
|
||||
enum RadioDevice::TxWindowType getWindowType() { return mDevice->getWindowType(); }
|
||||
|
||||
/** Minimum latency that the device can achieve */
|
||||
GSM::Time minLatency() { return mRadio->minLatency(); }
|
||||
GSM::Time minLatency() { return mDevice->minLatency(); }
|
||||
|
||||
protected:
|
||||
/** drive synchronization of Tx/Rx of USRP */
|
||||
void alignRadio();
|
||||
|
||||
/** set transmit gain */
|
||||
virtual double setTxGain(double dB, size_t chan = 0);
|
||||
|
||||
friend void *AlignRadioServiceLoopAdapter(RadioInterface*);
|
||||
};
|
||||
|
||||
@@ -152,22 +149,31 @@ private:
|
||||
int pullBuffer();
|
||||
|
||||
public:
|
||||
RadioInterfaceResamp(RadioDevice* wRadio, size_t tx_sps, size_t rx_sps);
|
||||
RadioInterfaceResamp(RadioDevice* wDevice, size_t tx_sps, size_t rx_sps);
|
||||
~RadioInterfaceResamp();
|
||||
|
||||
bool init(int type);
|
||||
void close();
|
||||
};
|
||||
|
||||
struct freq_cfg_state {
|
||||
bool set;
|
||||
double freq_hz;
|
||||
};
|
||||
|
||||
class RadioInterfaceMulti : public RadioInterface {
|
||||
private:
|
||||
bool pushBuffer();
|
||||
int pullBuffer();
|
||||
bool verify_arfcn_consistency(double freq, size_t chan, bool tx);
|
||||
virtual double setTxGain(double dB, size_t chan);
|
||||
|
||||
signalVector *outerSendBuffer;
|
||||
signalVector *outerRecvBuffer;
|
||||
std::vector<signalVector *> history;
|
||||
std::vector<bool> active;
|
||||
std::vector<struct freq_cfg_state> rx_freq_state;
|
||||
std::vector<struct freq_cfg_state> tx_freq_state;
|
||||
|
||||
Resampler *dnsampler;
|
||||
Resampler *upsampler;
|
||||
@@ -184,5 +190,5 @@ public:
|
||||
|
||||
bool tuneTx(double freq, size_t chan);
|
||||
bool tuneRx(double freq, size_t chan);
|
||||
double setRxGain(double dB, size_t chan);
|
||||
virtual double setRxGain(double dB, size_t chan);
|
||||
};
|
||||
|
||||
@@ -73,6 +73,8 @@ void RadioInterfaceMulti::close()
|
||||
powerScaling.resize(0);
|
||||
history.resize(0);
|
||||
active.resize(0);
|
||||
rx_freq_state.resize(0);
|
||||
tx_freq_state.resize(0);
|
||||
|
||||
RadioInterface::close();
|
||||
}
|
||||
@@ -148,6 +150,8 @@ bool RadioInterfaceMulti::init(int type)
|
||||
mReceiveFIFO.resize(mChans);
|
||||
powerScaling.resize(mChans);
|
||||
history.resize(mChans);
|
||||
rx_freq_state.resize(mChans);
|
||||
tx_freq_state.resize(mChans);
|
||||
active.resize(MCHANS, false);
|
||||
|
||||
inchunk = RESAMP_INRATE * 4;
|
||||
@@ -238,7 +242,7 @@ int RadioInterfaceMulti::pullBuffer()
|
||||
return -1;
|
||||
|
||||
/* Outer buffer access size is fixed */
|
||||
num = mRadio->readSamples(convertRecvBuffer,
|
||||
num = mDevice->readSamples(convertRecvBuffer,
|
||||
outerRecvBuffer->size(),
|
||||
&overrun,
|
||||
readTimestamp,
|
||||
@@ -251,7 +255,7 @@ int RadioInterfaceMulti::pullBuffer()
|
||||
convert_short_float((float *) outerRecvBuffer->begin(),
|
||||
convertRecvBuffer[0], 2 * outerRecvBuffer->size());
|
||||
|
||||
underrun |= local_underrun;
|
||||
osmo_trx_sync_or_and_fetch(&underrun, local_underrun);
|
||||
readTimestamp += num;
|
||||
|
||||
channelizer->rotate((float *) outerRecvBuffer->begin(),
|
||||
@@ -288,7 +292,7 @@ int RadioInterfaceMulti::pullBuffer()
|
||||
complex *dst = history[lchan]->begin();
|
||||
float *fsrc = &buf[2 * (cLen - hLen)];
|
||||
for (i = 0; i < hLen; i++) {
|
||||
*dst = complex(fdst[0], fdst[1]);
|
||||
*dst = complex(fsrc[0], fsrc[1]);
|
||||
fsrc += 2;
|
||||
dst++;
|
||||
}
|
||||
@@ -309,6 +313,7 @@ int RadioInterfaceMulti::pullBuffer()
|
||||
/* Send a timestamped chunk to the device */
|
||||
bool RadioInterfaceMulti::pushBuffer()
|
||||
{
|
||||
bool local_underrun;
|
||||
if (sendBuffer[0]->getAvailSegments() <= 0)
|
||||
return false;
|
||||
|
||||
@@ -339,14 +344,15 @@ bool RadioInterfaceMulti::pushBuffer()
|
||||
(float *) outerSendBuffer->begin(),
|
||||
1.0 / (float) mChans, 2 * outerSendBuffer->size());
|
||||
|
||||
size_t num = mRadio->writeSamples(convertSendBuffer,
|
||||
size_t num = mDevice->writeSamples(convertSendBuffer,
|
||||
outerSendBuffer->size(),
|
||||
&underrun,
|
||||
&local_underrun,
|
||||
writeTimestamp);
|
||||
if (num != outerSendBuffer->size()) {
|
||||
LOG(ALERT) << "Transmit error " << num;
|
||||
}
|
||||
|
||||
osmo_trx_sync_or_and_fetch(&underrun, local_underrun);
|
||||
writeTimestamp += num;
|
||||
|
||||
return true;
|
||||
@@ -360,48 +366,82 @@ static bool fltcmp(double a, double b)
|
||||
return fabs(a - b) < FREQ_DELTA_LIMIT ? true : false;
|
||||
}
|
||||
|
||||
bool RadioInterfaceMulti::verify_arfcn_consistency(double freq, size_t chan, bool tx)
|
||||
{
|
||||
double freq_i;
|
||||
std::string str_dir = tx ? "Tx" : "Rx";
|
||||
std::vector<struct freq_cfg_state> &v = tx ? tx_freq_state : rx_freq_state;
|
||||
|
||||
for (size_t i = 0; i < mChans; i++) {
|
||||
if (i == chan)
|
||||
continue;
|
||||
if (!v[i].set)
|
||||
continue;
|
||||
|
||||
freq_i = v[i].freq_hz + (double) ((int)chan - (int)i) * MCBTS_SPACING;
|
||||
if (!fltcmp(freq, freq_i)) {
|
||||
LOGCHAN(chan, DMAIN, ERROR)
|
||||
<< "Setting " << str_dir << " frequency " << freq
|
||||
<< " is incompatible: already configured channel "
|
||||
<< i << " uses frequency " << v[i].freq_hz
|
||||
<< " (expected " << freq_i << ")";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
v[chan].set = true;
|
||||
v[chan].freq_hz = freq;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RadioInterfaceMulti::tuneTx(double freq, size_t chan)
|
||||
{
|
||||
if (chan >= mChans)
|
||||
return false;
|
||||
double shift;
|
||||
|
||||
double shift = (double) getFreqShift(mChans);
|
||||
if (chan >= mChans)
|
||||
return false;
|
||||
|
||||
if (!chan)
|
||||
return mRadio->setTxFreq(freq + shift * MCBTS_SPACING);
|
||||
if (!verify_arfcn_consistency(freq, chan, true))
|
||||
return false;
|
||||
|
||||
double center = mRadio->getTxFreq();
|
||||
if (!fltcmp(freq, center + (double) (chan - shift) * MCBTS_SPACING)) {
|
||||
LOG(NOTICE) << "Channel " << chan << " RF frequency offset is "
|
||||
<< freq / 1e6 << " MHz";
|
||||
}
|
||||
if (chan == 0) {
|
||||
shift = (double) getFreqShift(mChans);
|
||||
return mDevice->setTxFreq(freq + shift * MCBTS_SPACING);
|
||||
}
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RadioInterfaceMulti::tuneRx(double freq, size_t chan)
|
||||
{
|
||||
if (chan >= mChans)
|
||||
return false;
|
||||
double shift;
|
||||
|
||||
double shift = (double) getFreqShift(mChans);
|
||||
if (chan >= mChans)
|
||||
return false;
|
||||
|
||||
if (!chan)
|
||||
return mRadio->setRxFreq(freq + shift * MCBTS_SPACING);
|
||||
if (!verify_arfcn_consistency(freq, chan, false))
|
||||
return false;
|
||||
|
||||
double center = mRadio->getRxFreq();
|
||||
if (!fltcmp(freq, center + (double) (chan - shift) * MCBTS_SPACING)) {
|
||||
LOG(NOTICE) << "Channel " << chan << " RF frequency offset is "
|
||||
<< freq / 1e6 << " MHz";
|
||||
}
|
||||
if (chan == 0) {
|
||||
shift = (double) getFreqShift(mChans);
|
||||
return mDevice->setRxFreq(freq + shift * MCBTS_SPACING);
|
||||
}
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
double RadioInterfaceMulti::setRxGain(double db, size_t chan)
|
||||
{
|
||||
if (!chan)
|
||||
return mRadio->setRxGain(db);
|
||||
if (chan == 0)
|
||||
return mDevice->setRxGain(db);
|
||||
else
|
||||
return mRadio->getRxGain();
|
||||
return mDevice->getRxGain();
|
||||
}
|
||||
|
||||
double RadioInterfaceMulti::setTxGain(double dB, size_t chan)
|
||||
{
|
||||
if (chan == 0)
|
||||
return mDevice->setTxGain(dB);
|
||||
else
|
||||
return mDevice->getTxGain();
|
||||
|
||||
}
|
||||
|
||||
@@ -59,9 +59,9 @@ static size_t resamp_inchunk = 0;
|
||||
static size_t resamp_outrate = 0;
|
||||
static size_t resamp_outchunk = 0;
|
||||
|
||||
RadioInterfaceResamp::RadioInterfaceResamp(RadioDevice *wRadio,
|
||||
RadioInterfaceResamp::RadioInterfaceResamp(RadioDevice *wDevice,
|
||||
size_t tx_sps, size_t rx_sps)
|
||||
: RadioInterface(wRadio, tx_sps, rx_sps, 1),
|
||||
: RadioInterface(wDevice, tx_sps, rx_sps, 1),
|
||||
outerSendBuffer(NULL), outerRecvBuffer(NULL)
|
||||
{
|
||||
}
|
||||
@@ -171,7 +171,7 @@ int RadioInterfaceResamp::pullBuffer()
|
||||
return -1;
|
||||
|
||||
/* Outer buffer access size is fixed */
|
||||
num_recv = mRadio->readSamples(convertRecvBuffer,
|
||||
num_recv = mDevice->readSamples(convertRecvBuffer,
|
||||
resamp_outchunk,
|
||||
&overrun,
|
||||
readTimestamp,
|
||||
@@ -184,7 +184,7 @@ int RadioInterfaceResamp::pullBuffer()
|
||||
convert_short_float((float *) outerRecvBuffer->begin(),
|
||||
convertRecvBuffer[0], 2 * resamp_outchunk);
|
||||
|
||||
underrun |= local_underrun;
|
||||
osmo_trx_sync_or_and_fetch(&underrun, local_underrun);
|
||||
readTimestamp += (TIMESTAMP) resamp_outchunk;
|
||||
|
||||
/* Write to the end of the inner receive buffer */
|
||||
@@ -204,6 +204,7 @@ int RadioInterfaceResamp::pullBuffer()
|
||||
/* Send a timestamped chunk to the device */
|
||||
bool RadioInterfaceResamp::pushBuffer()
|
||||
{
|
||||
bool local_underrun;
|
||||
int rc;
|
||||
size_t numSent;
|
||||
|
||||
@@ -223,14 +224,15 @@ bool RadioInterfaceResamp::pushBuffer()
|
||||
(float *) outerSendBuffer->begin(),
|
||||
powerScaling[0], 2 * resamp_outchunk);
|
||||
|
||||
numSent = mRadio->writeSamples(convertSendBuffer,
|
||||
numSent = mDevice->writeSamples(convertSendBuffer,
|
||||
resamp_outchunk,
|
||||
&underrun,
|
||||
&local_underrun,
|
||||
writeTimestamp);
|
||||
if (numSent != resamp_outchunk) {
|
||||
LOG(ALERT) << "Transmit error " << numSent;
|
||||
}
|
||||
|
||||
osmo_trx_sync_or_and_fetch(&underrun, local_underrun);
|
||||
writeTimestamp += resamp_outchunk;
|
||||
|
||||
return true;
|
||||
|
||||
@@ -345,7 +345,7 @@ static signalVector *convolve(const signalVector *x, const signalVector *h,
|
||||
_x = x;
|
||||
|
||||
/*
|
||||
* Four convovle types:
|
||||
* Four convolve types:
|
||||
* 1. Complex-Real (aligned)
|
||||
* 2. Complex-Complex (aligned)
|
||||
* 3. Complex-Real (!aligned)
|
||||
@@ -723,7 +723,7 @@ static signalVector *mapEdgeSymbols(const BitVector &bits)
|
||||
*
|
||||
* Delay the EDGE downlink bursts by one symbol in order to match GMSK pulse
|
||||
* shaping group delay. The difference in group delay arises from the dual
|
||||
* pulse filter combination of the GMSK Laurent represenation whereas 8-PSK
|
||||
* pulse filter combination of the GMSK Laurent representation whereas 8-PSK
|
||||
* uses a single pulse linear filter.
|
||||
*/
|
||||
static signalVector *shapeEdgeBurst(const signalVector &symbols)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright 2008 Free Software Foundation, Inc.
|
||||
*
|
||||
* This software is distributed under multiple licenses; see the COPYING file in the main directory for licensing information for this specific distribuion.
|
||||
* This software is distributed under multiple licenses; see the COPYING file in the main directory for licensing information for this specific distribution.
|
||||
*
|
||||
* This use of this software may be subject to additional restrictions.
|
||||
* See the LEGAL file in the main directory for details.
|
||||
|
||||
@@ -47,7 +47,7 @@ void signalVector::operator=(const signalVector& vector)
|
||||
complex *src = vector.mData;
|
||||
for (i = 0; i < size(); i++, src++, dst++)
|
||||
*dst = *src;
|
||||
/* TODO: optimize for non non-trivially copyable types: */
|
||||
/* TODO: optimize for non non-trivially copiable types: */
|
||||
/*memcpy(mData, vector.mData, bytes()); */
|
||||
mStart = mData + vector.getStart();
|
||||
}
|
||||
@@ -70,7 +70,7 @@ size_t signalVector::updateHistory()
|
||||
complex *src = mStart + this->size() - num;
|
||||
for (i = 0; i < num; i++, src++, dst++)
|
||||
*dst = *src;
|
||||
/* TODO: optimize for non non-trivially copyable types: */
|
||||
/* TODO: optimize for non non-trivially copiable types: */
|
||||
/*memmove(mData, mStart + this->size() - num, num * sizeof(complex)); */
|
||||
|
||||
return num;
|
||||
|
||||
41
configure.ac
41
configure.ac
@@ -65,7 +65,7 @@ AC_PROG_LIBTOOL
|
||||
|
||||
dnl Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
dnl This is required for GnuRadio includes to understand endianess correctly:
|
||||
dnl This is required for GnuRadio includes to understand endianness correctly:
|
||||
AC_CHECK_HEADERS([byteswap.h])
|
||||
|
||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
@@ -75,9 +75,18 @@ AC_TYPE_SIZE_T
|
||||
AC_HEADER_TIME
|
||||
AC_C_BIGENDIAN
|
||||
|
||||
PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.12.0)
|
||||
PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.12.0)
|
||||
PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl >= 0.12.0)
|
||||
# Check if gettid is available (despite not being documented in glibc doc, it requires __USE_GNU on some systems)
|
||||
# C compiler is used since __USE_GNU seems to be always defined for g++.
|
||||
save_CPPFLAGS=$CPPFLAGS
|
||||
AC_LANG_PUSH(C)
|
||||
CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
|
||||
AC_CHECK_FUNCS([gettid])
|
||||
AC_LANG_POP(C)
|
||||
CPPFLAGS=$save_CPPFLAGS
|
||||
|
||||
PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.3.0)
|
||||
PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 1.3.0)
|
||||
PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl >= 1.3.0)
|
||||
|
||||
AC_ARG_ENABLE(sanitize,
|
||||
[AS_HELP_STRING(
|
||||
@@ -190,29 +199,39 @@ dnl Check if the compiler supports specified GCC's built-in function
|
||||
AC_DEFUN([CHECK_BUILTIN_SUPPORT], [
|
||||
AC_CACHE_CHECK(
|
||||
[whether ${CC} has $1 built-in],
|
||||
[osmo_cv_cc_has_builtin], [
|
||||
[osmo_cv_cc_has_$1], [
|
||||
AC_LINK_IFELSE([
|
||||
AC_LANG_PROGRAM([], [
|
||||
__builtin_cpu_supports("sse");
|
||||
$2
|
||||
])
|
||||
],
|
||||
[AS_VAR_SET([osmo_cv_cc_has_builtin], [yes])],
|
||||
[AS_VAR_SET([osmo_cv_cc_has_builtin], [no])])
|
||||
[AS_VAR_SET([osmo_cv_cc_has_$1], [yes])],
|
||||
[AS_VAR_SET([osmo_cv_cc_has_$1], [no])])
|
||||
]
|
||||
)
|
||||
|
||||
AS_IF([test yes = AS_VAR_GET([osmo_cv_cc_has_builtin])], [
|
||||
AS_IF([test yes = AS_VAR_GET([osmo_cv_cc_has_$1])], [
|
||||
AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_$1), 1,
|
||||
[Define to 1 if compiler has the '$1' built-in function])
|
||||
], [
|
||||
AC_MSG_WARN($2)
|
||||
AC_MSG_WARN($3)
|
||||
])
|
||||
])
|
||||
|
||||
dnl Check if the compiler supports runtime SIMD detection
|
||||
CHECK_BUILTIN_SUPPORT([__builtin_cpu_supports],
|
||||
CHECK_BUILTIN_SUPPORT([__builtin_cpu_supports], [__builtin_cpu_supports("sse");],
|
||||
[Runtime SIMD detection will be disabled])
|
||||
|
||||
dnl Check for __sync_fetch_and_add().
|
||||
CHECK_BUILTIN_SUPPORT([__sync_fetch_and_and], [int x;__sync_fetch_and_and(&x,1);],
|
||||
[Atomic operation not available, will use mutex])
|
||||
dnl Check for __sync_or_and_fetch().
|
||||
CHECK_BUILTIN_SUPPORT([__sync_or_and_fetch], [int x;__sync_or_and_fetch(&x,1);],
|
||||
[Atomic operation not available, will use mutex])
|
||||
AS_IF([test "x$osmo_cv_cc_has___sync_fetch_and_and" = "xyes" && test "x$osmo_cv_cc_has___sync_or_and_fetch" = "xyes"], [
|
||||
AC_DEFINE(HAVE_ATOMIC_OPS, 1, [Support all required atomic operations], [AC_MSG_WARN("At least one aotmic operation missing, will use mutex")])
|
||||
])
|
||||
|
||||
AM_CONDITIONAL(DEVICE_UHD, [test "x$with_uhd" != "xno"])
|
||||
AM_CONDITIONAL(DEVICE_USRP1, [test "x$with_usrp1" = "xyes"])
|
||||
AM_CONDITIONAL(DEVICE_LMS, [test "x$with_lms" = "xyes"])
|
||||
|
||||
@@ -15,7 +15,7 @@ substr() { [ -z "${2##*$1*}" ]; }
|
||||
mychroot_nocwd() {
|
||||
# LC_ALL + LANGUAGE set to avoid lots of print errors due to locale not being set inside container
|
||||
# PATH is needed to be able to reach binaries like ldconfig without logging in to root, which adds the paths to PATH.
|
||||
# PROOT_NO_SECCOMP is requried due to proot bug #106
|
||||
# PROOT_NO_SECCOMP is required due to proot bug #106
|
||||
LC_ALL=C LANGUAGE=C PATH="$PATH:/usr/sbin:/sbin" PROOT_NO_SECCOMP=1 proot -r "$ROOTFS" -w / -b /proc --root-id -q qemu-arm-static "$@"
|
||||
}
|
||||
|
||||
@@ -23,15 +23,8 @@ mychroot() {
|
||||
mychroot_nocwd -w / "$@"
|
||||
}
|
||||
|
||||
base="$PWD"
|
||||
deps="$base/deps"
|
||||
inst="$deps/install"
|
||||
export deps inst
|
||||
|
||||
if [ -z "${INSIDE_CHROOT}" ]; then
|
||||
|
||||
osmo-clean-workspace.sh
|
||||
|
||||
# Only use ARM chroot if host is not ARM and the target is ARM:
|
||||
if ! $(substr "arm" "$(uname -m)") && [ "x${INSTR}" = "x--with-neon" -o "x${INSTR}" = "x--with-neon-vfpv4" ]; then
|
||||
|
||||
@@ -69,6 +62,20 @@ if [ -z "${INSIDE_CHROOT}" ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
set -ex
|
||||
|
||||
if ! [ -x "$(command -v osmo-build-dep.sh)" ]; then
|
||||
echo "Error: We need to have scripts/osmo-deps.sh from http://git.osmocom.org/osmo-ci/ in PATH !"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
base="$PWD"
|
||||
deps="$base/deps"
|
||||
inst="$deps/install"
|
||||
export deps inst
|
||||
|
||||
osmo-clean-workspace.sh
|
||||
|
||||
mkdir "$deps" || true
|
||||
|
||||
osmo-build-dep.sh libosmocore "" "--enable-sanitize --disable-doxygen --disable-pcsc"
|
||||
|
||||
52
debian/changelog
vendored
52
debian/changelog
vendored
@@ -1,3 +1,55 @@
|
||||
osmo-trx (1.2.0) unstable; urgency=medium
|
||||
|
||||
[ Pau Espin Pedrol ]
|
||||
* osmo-trx: log to stderr on signal received
|
||||
* Drop old setPriority related code
|
||||
* Transceiver: fix segfault during init if IP addr binding fails
|
||||
* Transceiver: Check return value when binding IP addr for clock socket
|
||||
* Transceiver: Clean up receival of downlink bursts
|
||||
* Transceiver: Fix idle ul burst indications being dropped
|
||||
* Transceiver: exit process when BTS drops connection
|
||||
* Transceiver: Enable EDGE detection only on PDCH timeslots
|
||||
* lms: Log available antennas if requested antenna fails
|
||||
* device: Use LOGCHAN in set_antennas()
|
||||
* Transceiver: Fix logging TN and version
|
||||
* Transceiver: Use LOGCHAN in logRxBurst to unify log format
|
||||
* Transceiver: Log error condition no burst in pullRadioVector()
|
||||
* Transceiver: pullRadioVector(): Fix use of uninitialized value bi->tn
|
||||
* Transceiver: Don't stop TRX if pulling from OFF timeslot
|
||||
* radioInterface: Rename mRadio to mDevice
|
||||
* radioInterfaceMulti: Check equals zero explicitly
|
||||
* USRPDevice: Fix setRxGain return on error and getRxGain() returning always 0
|
||||
* USRPDevice: Return previous txGain if setting value failed
|
||||
* LMSDevice: Return previous txGain/rxGain if setting value failed
|
||||
* radioInterface: Remove unusued getRxGain()
|
||||
* radioDevice: Introduce getTxGain() API
|
||||
* radioInterfaceMulti: Override setTxGain() to avoid chan!=0 calls
|
||||
* UHDDevice: Drop unneeded MULTI_ARFCN checks
|
||||
* radioInterface{Multi,Resamp}: Fix successful writeSamples() masking underrun from readSamples()
|
||||
* radioInterface: Mark setRxGain as virtual
|
||||
* Move multi-ARFCN chan amount modification from UHDDevice to parent class
|
||||
* radioInterface: Atomically fetch and change underrun variable
|
||||
* radioInterfaceMulti: write frequency offset direction (rx/tx) in log line
|
||||
* Use new libosmocore logging lock API
|
||||
* Transceiver: Fix wrong response upon CMD HANDOVER failure
|
||||
* uhd: use value already cached in tmp variable
|
||||
* Transceiver.cpp: Introduce and use new logging categories
|
||||
|
||||
[ Timo Jacobus ]
|
||||
* Transceiver: Fixed copying of history into and from channelizer buffer.
|
||||
|
||||
[ Alexander Chemeris ]
|
||||
* vty: Don't enable random filler bursts automatically with EDGE.
|
||||
* vty: Simplify filler burst settings and improve help and readability.
|
||||
|
||||
[ Martin Hauke ]
|
||||
* Fix common misspellings and typos
|
||||
|
||||
[ Harald Welte ]
|
||||
* trx: exit() on unsupported positional arguments on command line
|
||||
|
||||
-- Pau Espin Pedrol <pespin@sysmocom.de> Fri, 03 Jan 2020 19:54:00 +0100
|
||||
|
||||
osmo-trx (1.1.1) unstable; urgency=medium
|
||||
|
||||
* UNRELEASED
|
||||
|
||||
2
debian/control
vendored
2
debian/control
vendored
@@ -14,7 +14,7 @@ Build-Depends: debhelper (>= 9),
|
||||
libtalloc-dev,
|
||||
libusrp-dev,
|
||||
liblimesuite-dev,
|
||||
libosmocore-dev (>= 0.12.0),
|
||||
libosmocore-dev (>= 1.3.0),
|
||||
osmo-gsm-manuals-dev
|
||||
Standards-Version: 3.9.6
|
||||
Vcs-Browser: http://cgit.osmocom.org/osmo-trx
|
||||
|
||||
2
debian/patches/build-for-debian8.patch
vendored
2
debian/patches/build-for-debian8.patch
vendored
@@ -7,7 +7,7 @@ index 8ff59f0..126c16a 100644
|
||||
libtalloc-dev,
|
||||
libusrp-dev,
|
||||
- liblimesuite-dev,
|
||||
libosmocore-dev (>= 0.12.0),
|
||||
libosmocore-dev (>= 1.3.0),
|
||||
osmo-gsm-manuals-dev
|
||||
Standards-Version: 3.9.6
|
||||
@@ -30,7 +29,7 @@ Package: osmo-trx-dbg
|
||||
|
||||
@@ -46,15 +46,16 @@ Multi-ARFCN support is available since osmo-trx release `0.2.0`, and it was
|
||||
added specifically in commit `76764278169d252980853251daeb9f1ba0c246e1`.
|
||||
|
||||
This feature is useful for instance if you want to run more than 1 TRX with an
|
||||
Ettus B200 device, or 2 TRX with an Ettus B210 device, since they support only 1
|
||||
and 2 physical RF channels respectively. No device from other providers or even
|
||||
other devices than B200 and B210 from Ettus are known to support this feature.
|
||||
Ettus B200 device, or more than 2 TRXs with an Ettus B210 device, since they
|
||||
support only 1 and 2 physical RF channels respectively. No device from other
|
||||
providers or even other devices than B200 and B210 from Ettus are known to
|
||||
support this feature.
|
||||
|
||||
With multi-ARFCN enabled, ARFCN spacing is fixed at 800 kHz or 4 GSM channels.
|
||||
So if TRX-0 is set to ARFCN 51, TRX-1 _must_ be set to 55, and so on. Up to
|
||||
three ARFCN's is supported for multi-TRX.
|
||||
|
||||
From BTS and BSC point of view, supporting multiple TRX through multi-ARFCN
|
||||
From BTS and BSC point of view, supporting multiple TRXs through multi-ARFCN
|
||||
feature in OsmoTRX doesn't make any difference from a regular multi-TRX setup,
|
||||
leaving apart of course the mentioned ARFCN limitations explained above and as a
|
||||
consequence physical installation and operational differences.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
This section specifies the format of USB packets used for in-band data
|
||||
transmission and signaling on the USRP1. All packets are 512-byte long, and are
|
||||
transfered using USB "bulk" transfers.
|
||||
transferred using USB "bulk" transfers.
|
||||
|
||||
IN packets are sent towards the host. OUT packets are sent away from the host.
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ B200 family and Fairwaves UmTRX family, and used to be the default backend used
|
||||
for legacy @osmo-trx@ binary when per-backend binaries didn't exist yet.
|
||||
|
||||
Any device providing generic support for UHD should theoretically be able to be
|
||||
run through this backend without much effort, but pracitcal experience showed
|
||||
run through this backend without much effort, but practical experience showed
|
||||
that some devices don't play well with it, such as the LimeSDR family of
|
||||
devices, which showed far better results when using its native interface.
|
||||
|
||||
|
||||
@@ -18,10 +18,11 @@
|
||||
<param name='terminal' doc='Write to terminal' />
|
||||
</params>
|
||||
</command>
|
||||
<command id='write file'>
|
||||
<command id='write file [PATH]'>
|
||||
<params>
|
||||
<param name='write' doc='Write running configuration to memory, network, or terminal' />
|
||||
<param name='file' doc='Write to configuration file' />
|
||||
<param name='[PATH]' doc='Set file path to store the config, or replace if already exists' />
|
||||
</params>
|
||||
</command>
|
||||
<command id='write memory'>
|
||||
@@ -96,12 +97,6 @@
|
||||
<param name='history' doc='Display the session command history' />
|
||||
</params>
|
||||
</command>
|
||||
<command id='show trx'>
|
||||
<params>
|
||||
<param name='show' doc='Show running system information' />
|
||||
<param name='trx' doc='Display information on the TRX' />
|
||||
</params>
|
||||
</command>
|
||||
<command id='logging enable'>
|
||||
<params>
|
||||
<param name='logging' doc='Configure logging' />
|
||||
@@ -193,14 +188,17 @@
|
||||
<param name='MASK' doc='List of logging categories to log, e.g. 'abc:mno:xyz'. Available log categories depend on the specific application, refer to the 'logging level' command. Optionally add individual log levels like 'abc,1:mno,3:xyz,5', where the level numbers are LOGL_DEBUG=1 LOGL_INFO=3 LOGL_NOTICE=5 LOGL_ERROR=7 LOGL_FATAL=8' />
|
||||
</params>
|
||||
</command>
|
||||
<command id='logging level (main|trxctrl|dev|lms|lglobal|llapd|linp|lmux|lmi|lmib|lsms|lctrl|lgtp|lstats|lgsup|loap|lss7|lsccp|lsua|lm3ua|lmgcp|ljibuf|lrspro) (debug|info|notice|error|fatal)'>
|
||||
<command id='logging level (main|trxclk|trxctrl|trxddl|trxdul|dev|devdrv|lglobal|llapd|linp|lmux|lmi|lmib|lsms|lctrl|lgtp|lstats|lgsup|loap|lss7|lsccp|lsua|lm3ua|lmgcp|ljibuf|lrspro) (debug|info|notice|error|fatal)'>
|
||||
<params>
|
||||
<param name='logging' doc='Configure logging' />
|
||||
<param name='level' doc='Set the log level for a specified category' />
|
||||
<param name='main' doc='Main generic category' />
|
||||
<param name='trxclk' doc='TRX Master Clock' />
|
||||
<param name='trxctrl' doc='TRX CTRL interface' />
|
||||
<param name='trxddl' doc='TRX Data interface Downlink' />
|
||||
<param name='trxdul' doc='TRX CTRL interface Uplink' />
|
||||
<param name='dev' doc='Device/Driver specific code' />
|
||||
<param name='lms' doc='Logging from within LimeSuite itself' />
|
||||
<param name='devdrv' doc='Logging from external device driver library implementing lower level specifics' />
|
||||
<param name='lglobal' doc='Library-internal global log family' />
|
||||
<param name='llapd' doc='LAPD in libosmogsm' />
|
||||
<param name='linp' doc='A-bis Intput Subsystem' />
|
||||
@@ -259,6 +257,43 @@
|
||||
<param name='force-all' doc='Release any globally forced log level set with 'logging level force-all <level>'' />
|
||||
</params>
|
||||
</command>
|
||||
<command id='logp (main|trxclk|trxctrl|trxddl|trxdul|dev|devdrv|lglobal|llapd|linp|lmux|lmi|lmib|lsms|lctrl|lgtp|lstats|lgsup|loap|lss7|lsccp|lsua|lm3ua|lmgcp|ljibuf|lrspro) (debug|info|notice|error|fatal) .LOGMESSAGE'>
|
||||
<params>
|
||||
<param name='logp' doc='Print a message on all log outputs; useful for placing markers in test logs' />
|
||||
<param name='main' doc='Main generic category' />
|
||||
<param name='trxclk' doc='TRX Master Clock' />
|
||||
<param name='trxctrl' doc='TRX CTRL interface' />
|
||||
<param name='trxddl' doc='TRX Data interface Downlink' />
|
||||
<param name='trxdul' doc='TRX CTRL interface Uplink' />
|
||||
<param name='dev' doc='Device/Driver specific code' />
|
||||
<param name='devdrv' doc='Logging from external device driver library implementing lower level specifics' />
|
||||
<param name='lglobal' doc='Library-internal global log family' />
|
||||
<param name='llapd' doc='LAPD in libosmogsm' />
|
||||
<param name='linp' doc='A-bis Intput Subsystem' />
|
||||
<param name='lmux' doc='A-bis B-Subchannel TRAU Frame Multiplex' />
|
||||
<param name='lmi' doc='A-bis Input Driver for Signalling' />
|
||||
<param name='lmib' doc='A-bis Input Driver for B-Channels (voice)' />
|
||||
<param name='lsms' doc='Layer3 Short Message Service (SMS)' />
|
||||
<param name='lctrl' doc='Control Interface' />
|
||||
<param name='lgtp' doc='GPRS GTP library' />
|
||||
<param name='lstats' doc='Statistics messages and logging' />
|
||||
<param name='lgsup' doc='Generic Subscriber Update Protocol' />
|
||||
<param name='loap' doc='Osmocom Authentication Protocol' />
|
||||
<param name='lss7' doc='libosmo-sigtran Signalling System 7' />
|
||||
<param name='lsccp' doc='libosmo-sigtran SCCP Implementation' />
|
||||
<param name='lsua' doc='libosmo-sigtran SCCP User Adaptation' />
|
||||
<param name='lm3ua' doc='libosmo-sigtran MTP3 User Adaptation' />
|
||||
<param name='lmgcp' doc='libosmo-mgcp Media Gateway Control Protocol' />
|
||||
<param name='ljibuf' doc='libosmo-netif Jitter Buffer' />
|
||||
<param name='lrspro' doc='Remote SIM protocol' />
|
||||
<param name='debug' doc='Log debug messages and higher levels' />
|
||||
<param name='info' doc='Log informational messages and higher levels' />
|
||||
<param name='notice' doc='Log noticeable messages and higher levels' />
|
||||
<param name='error' doc='Log error messages and higher levels' />
|
||||
<param name='fatal' doc='Log only fatal messages' />
|
||||
<param name='.LOGMESSAGE' doc='Arbitrary message to log on given category and log level' />
|
||||
</params>
|
||||
</command>
|
||||
<command id='show logging vty'>
|
||||
<params>
|
||||
<param name='show' doc='Show running system information' />
|
||||
@@ -272,6 +307,12 @@
|
||||
<param name='alarms' doc='Show current logging configuration' />
|
||||
</params>
|
||||
</command>
|
||||
<command id='show trx'>
|
||||
<params>
|
||||
<param name='show' doc='Show running system information' />
|
||||
<param name='trx' doc='Display information on the TRX' />
|
||||
</params>
|
||||
</command>
|
||||
<command id='show talloc-context (application|all) (full|brief|DEPTH)'>
|
||||
<params>
|
||||
<param name='show' doc='Show running system information' />
|
||||
@@ -415,12 +456,6 @@
|
||||
<param name='monitor' doc='Copy debug output to the current terminal line' />
|
||||
</params>
|
||||
</command>
|
||||
<command id='show trx'>
|
||||
<params>
|
||||
<param name='show' doc='Show running system information' />
|
||||
<param name='trx' doc='Display information on the TRX' />
|
||||
</params>
|
||||
</command>
|
||||
<command id='logging enable'>
|
||||
<params>
|
||||
<param name='logging' doc='Configure logging' />
|
||||
@@ -512,14 +547,17 @@
|
||||
<param name='MASK' doc='List of logging categories to log, e.g. 'abc:mno:xyz'. Available log categories depend on the specific application, refer to the 'logging level' command. Optionally add individual log levels like 'abc,1:mno,3:xyz,5', where the level numbers are LOGL_DEBUG=1 LOGL_INFO=3 LOGL_NOTICE=5 LOGL_ERROR=7 LOGL_FATAL=8' />
|
||||
</params>
|
||||
</command>
|
||||
<command id='logging level (main|trxctrl|dev|lms|lglobal|llapd|linp|lmux|lmi|lmib|lsms|lctrl|lgtp|lstats|lgsup|loap|lss7|lsccp|lsua|lm3ua|lmgcp|ljibuf|lrspro) (debug|info|notice|error|fatal)'>
|
||||
<command id='logging level (main|trxclk|trxctrl|trxddl|trxdul|dev|devdrv|lglobal|llapd|linp|lmux|lmi|lmib|lsms|lctrl|lgtp|lstats|lgsup|loap|lss7|lsccp|lsua|lm3ua|lmgcp|ljibuf|lrspro) (debug|info|notice|error|fatal)'>
|
||||
<params>
|
||||
<param name='logging' doc='Configure logging' />
|
||||
<param name='level' doc='Set the log level for a specified category' />
|
||||
<param name='main' doc='Main generic category' />
|
||||
<param name='trxclk' doc='TRX Master Clock' />
|
||||
<param name='trxctrl' doc='TRX CTRL interface' />
|
||||
<param name='trxddl' doc='TRX Data interface Downlink' />
|
||||
<param name='trxdul' doc='TRX CTRL interface Uplink' />
|
||||
<param name='dev' doc='Device/Driver specific code' />
|
||||
<param name='lms' doc='Logging from within LimeSuite itself' />
|
||||
<param name='devdrv' doc='Logging from external device driver library implementing lower level specifics' />
|
||||
<param name='lglobal' doc='Library-internal global log family' />
|
||||
<param name='llapd' doc='LAPD in libosmogsm' />
|
||||
<param name='linp' doc='A-bis Intput Subsystem' />
|
||||
@@ -578,6 +616,43 @@
|
||||
<param name='force-all' doc='Release any globally forced log level set with 'logging level force-all <level>'' />
|
||||
</params>
|
||||
</command>
|
||||
<command id='logp (main|trxclk|trxctrl|trxddl|trxdul|dev|devdrv|lglobal|llapd|linp|lmux|lmi|lmib|lsms|lctrl|lgtp|lstats|lgsup|loap|lss7|lsccp|lsua|lm3ua|lmgcp|ljibuf|lrspro) (debug|info|notice|error|fatal) .LOGMESSAGE'>
|
||||
<params>
|
||||
<param name='logp' doc='Print a message on all log outputs; useful for placing markers in test logs' />
|
||||
<param name='main' doc='Main generic category' />
|
||||
<param name='trxclk' doc='TRX Master Clock' />
|
||||
<param name='trxctrl' doc='TRX CTRL interface' />
|
||||
<param name='trxddl' doc='TRX Data interface Downlink' />
|
||||
<param name='trxdul' doc='TRX CTRL interface Uplink' />
|
||||
<param name='dev' doc='Device/Driver specific code' />
|
||||
<param name='devdrv' doc='Logging from external device driver library implementing lower level specifics' />
|
||||
<param name='lglobal' doc='Library-internal global log family' />
|
||||
<param name='llapd' doc='LAPD in libosmogsm' />
|
||||
<param name='linp' doc='A-bis Intput Subsystem' />
|
||||
<param name='lmux' doc='A-bis B-Subchannel TRAU Frame Multiplex' />
|
||||
<param name='lmi' doc='A-bis Input Driver for Signalling' />
|
||||
<param name='lmib' doc='A-bis Input Driver for B-Channels (voice)' />
|
||||
<param name='lsms' doc='Layer3 Short Message Service (SMS)' />
|
||||
<param name='lctrl' doc='Control Interface' />
|
||||
<param name='lgtp' doc='GPRS GTP library' />
|
||||
<param name='lstats' doc='Statistics messages and logging' />
|
||||
<param name='lgsup' doc='Generic Subscriber Update Protocol' />
|
||||
<param name='loap' doc='Osmocom Authentication Protocol' />
|
||||
<param name='lss7' doc='libosmo-sigtran Signalling System 7' />
|
||||
<param name='lsccp' doc='libosmo-sigtran SCCP Implementation' />
|
||||
<param name='lsua' doc='libosmo-sigtran SCCP User Adaptation' />
|
||||
<param name='lm3ua' doc='libosmo-sigtran MTP3 User Adaptation' />
|
||||
<param name='lmgcp' doc='libosmo-mgcp Media Gateway Control Protocol' />
|
||||
<param name='ljibuf' doc='libosmo-netif Jitter Buffer' />
|
||||
<param name='lrspro' doc='Remote SIM protocol' />
|
||||
<param name='debug' doc='Log debug messages and higher levels' />
|
||||
<param name='info' doc='Log informational messages and higher levels' />
|
||||
<param name='notice' doc='Log noticeable messages and higher levels' />
|
||||
<param name='error' doc='Log error messages and higher levels' />
|
||||
<param name='fatal' doc='Log only fatal messages' />
|
||||
<param name='.LOGMESSAGE' doc='Arbitrary message to log on given category and log level' />
|
||||
</params>
|
||||
</command>
|
||||
<command id='show logging vty'>
|
||||
<params>
|
||||
<param name='show' doc='Show running system information' />
|
||||
@@ -591,6 +666,12 @@
|
||||
<param name='alarms' doc='Show current logging configuration' />
|
||||
</params>
|
||||
</command>
|
||||
<command id='show trx'>
|
||||
<params>
|
||||
<param name='show' doc='Show running system information' />
|
||||
<param name='trx' doc='Display information on the TRX' />
|
||||
</params>
|
||||
</command>
|
||||
<command id='show talloc-context (application|all) (full|brief|DEPTH)'>
|
||||
<params>
|
||||
<param name='show' doc='Show running system information' />
|
||||
@@ -772,16 +853,6 @@
|
||||
<param name='history' doc='Display the session command history' />
|
||||
</params>
|
||||
</command>
|
||||
<command id='ctrl'>
|
||||
<params>
|
||||
<param name='ctrl' doc='Configure the Control Interface' />
|
||||
</params>
|
||||
</command>
|
||||
<command id='trx'>
|
||||
<params>
|
||||
<param name='trx' doc='Configure the TRX' />
|
||||
</params>
|
||||
</command>
|
||||
<command id='log stderr'>
|
||||
<params>
|
||||
<param name='log' doc='Configure logging sub-system' />
|
||||
@@ -861,6 +932,16 @@
|
||||
<param name='[HOSTNAME]' doc='Host name to send the GSMTAP logging to (UDP port 4729)' />
|
||||
</params>
|
||||
</command>
|
||||
<command id='ctrl'>
|
||||
<params>
|
||||
<param name='ctrl' doc='Configure the Control Interface' />
|
||||
</params>
|
||||
</command>
|
||||
<command id='trx'>
|
||||
<params>
|
||||
<param name='trx' doc='Configure the TRX' />
|
||||
</params>
|
||||
</command>
|
||||
<command id='stats reporter statsd'>
|
||||
<params>
|
||||
<param name='stats' doc='Configure stats sub-system' />
|
||||
@@ -973,14 +1054,17 @@
|
||||
<param name='[last]' doc='Log source file info at the end of a log line. If omitted, log source file info just before the log text.' />
|
||||
</params>
|
||||
</command>
|
||||
<command id='logging level (main|trxctrl|dev|lms|lglobal|llapd|linp|lmux|lmi|lmib|lsms|lctrl|lgtp|lstats|lgsup|loap|lss7|lsccp|lsua|lm3ua|lmgcp|ljibuf|lrspro) (debug|info|notice|error|fatal)'>
|
||||
<command id='logging level (main|trxclk|trxctrl|trxddl|trxdul|dev|devdrv|lglobal|llapd|linp|lmux|lmi|lmib|lsms|lctrl|lgtp|lstats|lgsup|loap|lss7|lsccp|lsua|lm3ua|lmgcp|ljibuf|lrspro) (debug|info|notice|error|fatal)'>
|
||||
<params>
|
||||
<param name='logging' doc='Configure logging' />
|
||||
<param name='level' doc='Set the log level for a specified category' />
|
||||
<param name='main' doc='Main generic category' />
|
||||
<param name='trxclk' doc='TRX Master Clock' />
|
||||
<param name='trxctrl' doc='TRX CTRL interface' />
|
||||
<param name='trxddl' doc='TRX Data interface Downlink' />
|
||||
<param name='trxdul' doc='TRX CTRL interface Uplink' />
|
||||
<param name='dev' doc='Device/Driver specific code' />
|
||||
<param name='lms' doc='Logging from within LimeSuite itself' />
|
||||
<param name='devdrv' doc='Logging from external device driver library implementing lower level specifics' />
|
||||
<param name='lglobal' doc='Library-internal global log family' />
|
||||
<param name='llapd' doc='LAPD in libosmogsm' />
|
||||
<param name='linp' doc='A-bis Intput Subsystem' />
|
||||
@@ -1179,24 +1263,10 @@
|
||||
<param name='4' doc='(null)' />
|
||||
</params>
|
||||
</command>
|
||||
<command id='test rtsc <0-7>'>
|
||||
<params>
|
||||
<param name='test' doc='Set the Random Normal Burst test mode with TSC' />
|
||||
<param name='rtsc' doc='TSC' />
|
||||
<param name='<0-7>' doc='(null)' />
|
||||
</params>
|
||||
</command>
|
||||
<command id='test rach-delay <0-68>'>
|
||||
<params>
|
||||
<param name='test' doc='Set the Random Access Burst test mode with delay' />
|
||||
<param name='rach-delay' doc='RACH delay' />
|
||||
<param name='<0-68>' doc='(null)' />
|
||||
</params>
|
||||
</command>
|
||||
<command id='clock-ref (internal|external|gpsdo)'>
|
||||
<params>
|
||||
<param name='clock-ref' doc='Set the Reference Clock' />
|
||||
<param name='internal' doc='Enable internal referece (default)' />
|
||||
<param name='internal' doc='Enable internal reference (default)' />
|
||||
<param name='external' doc='Enable external 10 MHz reference' />
|
||||
<param name='gpsdo' doc='Enable GPSDO reference' />
|
||||
</params>
|
||||
@@ -1247,10 +1317,29 @@
|
||||
<param name='<1-32>' doc='Real time priority' />
|
||||
</params>
|
||||
</command>
|
||||
<command id='filler dummy'>
|
||||
<command id='filler type (zero|dummy|random-nb-gmsk|random-nb-8psk|random-ab)'>
|
||||
<params>
|
||||
<param name='filler' doc='Enable C0 filler table' />
|
||||
<param name='dummy' doc='Dummy method' />
|
||||
<param name='filler' doc='Filler burst settings' />
|
||||
<param name='type' doc='Filler burst type (default=zero)' />
|
||||
<param name='zero' doc='Send an empty burst when there is nothing to send (default)' />
|
||||
<param name='dummy' doc='Send a dummy burst when there is nothing to send on C0 (TRX0) and empty burst on other channels. Use for OpenBTS compatibility only, don't use with OsmoBTS as it breaks encryption.' />
|
||||
<param name='random-nb-gmsk' doc='Send a GMSK modulated Normal Burst with random bits when there is nothing to send. Use for spectrum mask testing. Configure 'filler tsc' to set training sequence.' />
|
||||
<param name='random-nb-8psk' doc='Send an 8-PSK modulated Normal Burst with random bits when there is nothing to send. Use for spectrum mask testing. Configure 'filler tsc' to set training sequence.' />
|
||||
<param name='random-ab' doc='Send an Access Burst with random bits when there is nothing to send. Use for Rx/Tx alignment. Configure 'filler access-burst-delay' to introduce artificial delay.' />
|
||||
</params>
|
||||
</command>
|
||||
<command id='filler tsc <0-7>'>
|
||||
<params>
|
||||
<param name='filler' doc='Filler burst settings' />
|
||||
<param name='tsc' doc='Set the TSC for GMSK/8-PSK Normal Burst random fillers. Used only with 'random-nb-gmsk' and 'random-nb-8psk' filler types. (default=0)' />
|
||||
<param name='<0-7>' doc='TSC' />
|
||||
</params>
|
||||
</command>
|
||||
<command id='filler access-burst-delay <0-68>'>
|
||||
<params>
|
||||
<param name='filler' doc='Filler burst settings' />
|
||||
<param name='access-burst-delay' doc='Set the delay for Access Burst random fillers. Used only with 'random-ab' filler type. (default=0)' />
|
||||
<param name='<0-68>' doc='RACH delay in symbols' />
|
||||
</params>
|
||||
</command>
|
||||
<command id='ctr-error-threshold (rx_overruns|tx_underruns|rx_drop_events|rx_drop_samples|tx_drop_events|tx_drop_samples) <0-65535> (per-second|per-minute|per-hour|per-day)'>
|
||||
|
||||
@@ -146,9 +146,9 @@ struct test_vec
|
||||
float *h;
|
||||
float *y;
|
||||
|
||||
int x_len; /* Theses are in # of _floats_ ! */
|
||||
int h_len; /* Theses are in # of _floats_ ! */
|
||||
int y_len; /* Theses are in # of _floats_ ! */
|
||||
int x_len; /* These are in # of _floats_ ! */
|
||||
int h_len; /* These are in # of _floats_ ! */
|
||||
int y_len; /* These are in # of _floats_ ! */
|
||||
};
|
||||
|
||||
/* Reset test vectors */
|
||||
|
||||
Reference in New Issue
Block a user