Compare commits

...

19 Commits

Author SHA1 Message Date
Jack Lee
33445944de trx: Fix tx/rx-sps 4 for USRP1 devices
The existing code sets the pingOffset variable to -7231(269 - 7500)
with tx-sps = 4. The (apparent) correct value for pingOffset for
tx/rx-sps 4 is 272.

While I'm not completely sure how this patch works to fix the increased
sps value, my theory is that the original OpenBTS TRX  only supported
a split sps setup(tx-sps=4, rx_sps=1 for sps=4), which created
differing decimation rates between Tx and Rx on the board.
In this case, apparently you needed to account for an advance in the
timestamp for a correct output.

With tx_sps == rx_sps, the decimation/sample rates will be the same,
and(I guess) this advance doesn't need to be accounted for.

Also changed a line in the initialization of the Rx end of the USRP
device to use the correct decimation rate when tx/rx-sps == 4.

Since osmo-trx won't allow nonequal values for tx-sps and rx-sps, I
commented out the logic that selected pingOffset based on sps.
I left it visible in the file for reference however.

Tested & working on the URAN-1, a USRP1 clone designed for GSM.

Change-Id: I3b08c23a3e7d4a226cd23b9fe42558f596a63257
2025-10-22 14:24:52 -06:00
Pau Espin Pedrol
1d4117faf4 lms: Use define LMS_LOG_CRITICAL instead of value
The define is available since v20.01.0 [1]

[1] https://github.com/myriadrf/LimeSuite/pull/275

Change-Id: Ie5bb99a76580c5780a24f190682700c5e69b3d85
2025-07-17 11:18:46 +02:00
Pau Espin Pedrol
a0e1b20939 Drop use of deprecated vty is_config_node() cb
This callback was drepecated and is not ever called since
libosmocore.git 70ce871532ab21955e0955d7e230eae65438f047 (release 1.3.0).

See also libosmocore.git d31de237582f6fe3315d61bb9a488d4cda92654e.

Change-Id: I1bbaa455c018ba9c0943ac3cf1ae5511ebb4b723
2025-03-04 18:05:35 +01:00
Oliver Smith
0d155a130f Bump version: 1.7.0.2-8a71 → 1.7.1
Change-Id: Iad491e6608206f21e5ed8a95d2985fa53db4dd20
2025-02-12 12:43:25 +01:00
Neels Hofmeyr
8a71a7dd5d comma_delimited_to_vector() optimization CID#465430
(I am not sure about this, just doing as coverity says.)

Change-Id: I30e57c6a9df39552bc4f8c18d27bc421f5c60f49
2025-01-16 18:29:43 +01:00
Oliver Smith
3642b5956c contrib/jenkins: remove broken chroot + qemu code
The mirror where it would download images from is not online anymore,
and it looks like this whole block has not been executed in years (we
always test the arm builds on native arm machines nowadays, and run all
builds in docker).

Replace the whole block with a simple check that ensures when arm flags
are used, that the build is actually running on an arm machine.

Change-Id: I2e204e4a0a7dfcf32f011ed6fb403b564f8155a7
2024-09-12 09:59:09 +02:00
Oliver Smith
4f6e9eb4cf Bump version: 1.6.0.34-24f9 → 1.7.0
Change-Id: Ie522da30fc777d90c304c1cd93d41098bda13633
2024-07-24 16:23:32 +02:00
Oliver Smith
24f938bfa5 contrib/systemd/osmo-trx-uhd: fix HOME=
With recent changes, osmo-trx-uhd does not run as root anymore. Change
HOME=%h, which evaluates to HOME=/root, to HOME=%S/osmocom which
evaluates to HOME=/var/lib/osmocom. This is the StateDirectory that is
owned by the osmocom user.

Fix for:
  osmo-trx-uhd[4013]: terminate called after throwing an instance of 'boost::filesystem::filesystem_error'
  osmo-trx-uhd[4013]:   what():  boost::filesystem::status: Permission denied: "/root/.config/uhd.conf"
  osmo-trx-uhd[4013]: signal 6 received

Fixes: OS#6495
Change-Id: Ic6f020dd800eedc5e56c7d71e65521ec831d8c64
2024-06-26 12:04:00 +02:00
Vadim Yanitskiy
132ec7452d README.md: cosmetic: fix a typo
Change-Id: I7956cf01ea1944990d05cd76938698b333bd0e67
2024-06-05 18:34:07 +07:00
Oliver Smith
553d6b0b51 contrib/systemd: run as osmocom user
I have verified that with AmbientCapabilities=CAP_SYS_NICE, setting
scheduling policy as described in the manual still works as expected.

Related: OS#4107
Change-Id: I3e0e5978992dac0a0c76c6f0e859576aa3eb72eb
2024-05-15 11:24:58 +02:00
Oliver Smith
a7f5826351 contrib: remove rpm spec file
Related: https://osmocom.org/news/255
Related: OS#6446
Change-Id: I0cc8d753b26648efa7c9fb5798f7c4227c328547
2024-05-08 14:41:10 +02:00
Eric Wild
75cf9254a3 transceiver: use log level cache
This uses the newly added log level caching in libosmocore, which
prevents lock contention during the massive amount of usually disabled
but concurrent (threads) log statements.

Depends: libosmocore.git I539872fc9e3c50b407e6bc388f1e091fa2c826c3
Change-Id: Ic9f0e81c89827f2696ce046a3396f041703d6ae5
2024-05-07 08:04:25 +00:00
Pau Espin Pedrol
c5f623f966 doc: Introduce documentation for osmo-trx-ipc and its IPC interface
Related: SYS#6861
Change-Id: Id6863731f9398720030b16efaaf559e05f2444ed
2024-03-27 13:35:39 +01:00
Pau Espin Pedrol
8fd51cb7c9 code-architecture.adoc: Fix missing alignment in digraph
Change-Id: I9077590f6786833c9a86c3e844fc2dd07b404d58
2024-03-26 18:14:55 +01:00
Harald Welte
e6dc78e5c5 README.md: Remove stray apostrophe
Change-Id: I236a3aa66824759bf23b4331a22fa1d9ec25c5bf
2024-03-23 12:31:16 +01:00
Harald Welte
9982b33597 Add funding link to github mirror
see https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/displaying-a-sponsor-button-in-your-repository

Change-Id: If81f350017e51733cf13934e8481095eafe44a4f
2024-03-23 12:30:10 +01:00
Harald Welte
52ef221657 README.md: Add Forum and Issue Tracker links
Change-Id: Ib85f4e82d314cbab1c844497fb82dbda230589a5
2024-03-23 12:29:40 +01:00
Harald Welte
ec13193cae README.md: Improve markdown formatting
Change-Id: Ic5764aab323db87015da8c461dec136e57dd9c8f
2024-03-23 12:29:25 +01:00
Eric Wild
3d8598d460 ms: disabe uhd ms build
This won't build, and has been in a untested non working state for a
year, but might still be useful after fixing it up in the future in case
someone needs it.

Change-Id: I9db1740b5c399a02a41b1d07792c645cf7d1bd1b
2024-03-21 09:55:16 +01:00
27 changed files with 704 additions and 357 deletions

1
.github/FUNDING.yml vendored Normal file
View File

@@ -0,0 +1 @@
open_collective: osmocom

View File

@@ -28,7 +28,7 @@ std::vector<std::string> comma_delimited_to_vector(const char* opt)
{
std::string substr;
getline(ss, substr, ',');
result.push_back(substr);
result.push_back(std::move(substr));
}
return result;
}

View File

@@ -781,17 +781,6 @@ DEFUN(show_trx, show_trx_cmd,
return CMD_SUCCESS;
}
static int trx_vty_is_config_node(struct vty *vty, int node)
{
switch (node) {
case TRX_NODE:
case CHAN_NODE:
return 1;
default:
return 0;
}
}
static int trx_vty_go_parent(struct vty *vty)
{
switch (vty->node) {
@@ -829,7 +818,6 @@ struct vty_app_info g_vty_info = {
.version = PACKAGE_VERSION,
.copyright = trx_copyright,
.go_parent_cb = trx_vty_go_parent,
.is_config_node = trx_vty_is_config_node,
};
struct trx_ctx *vty_trx_ctx_alloc(void *talloc_ctx)

View File

@@ -54,7 +54,6 @@ EXTRA_DIST = \
LEGAL \
COPYING \
README.md \
contrib/osmo-trx.spec.in \
debian \
git-version-gen \
$(NULL)

View File

@@ -4,17 +4,17 @@ About OsmoTRX
OsmoTRX is a software-defined radio transceiver that implements the Layer 1
physical layer of a BTS comprising the following 3GPP specifications:
* TS 05.01 "Physical layer on the radio path"
* TS 05.02 "Multiplexing and Multiple Access on the Radio Path"
* TS 05.04 "Modulation"
* TS 05.10 "Radio subsystem synchronization"
* TS 05.01 *Physical layer on the radio path*
* TS 05.02 *Multiplexing and Multiple Access on the Radio Path*
* TS 05.04 *Modulation*
* TS 05.10 *Radio subsystem synchronization*
OsmoTRX is originally based on the transceiver code from the
[OpenBTS](https://osmocom.org/projects/osmobts/wiki/OpenBTS) project, but setup
to operate independently with the purpose of using with non-OpenBTS software and
projects, specifically within the Osmocom stack. Used together with
[OsmoBTS](https://osmocom.org/projects/osmobts/wiki) you can get a pretty
standard GSM BTS with Abis interface as per the relevant 3GPP specifications.
standard GSM/GPRS/EGPRS BTS with Abis interface as per the relevant 3GPP specifications.
Homepage
--------
@@ -27,7 +27,7 @@ GIT Repository
You can clone from the official osmo-trx.git repository using
git clone https://gitea.osmocom.org/cellular-infrastructure/osmo-trx`
git clone https://gitea.osmocom.org/cellular-infrastructure/osmo-trx
There is a web interface at <https://gitea.osmocom.org/cellular-infrastructure/osmo-trx>
@@ -39,6 +39,13 @@ also available online for each of the sub-libraries at User Manual for OsmoTRX
can be generated during the build process, and is also available online at
<https://ftp.osmocom.org/docs/latest/osmotrx-usermanual.pdf>.
Forum
-----
We welcome any osmo-trx related discussions in the
[Cellular Network Infrastructure -> 2 RAN (GERAN)](https://discourse.osmocom.org/c/cni/geran)
section of the osmocom discourse (web based Forum).
Mailing List
------------
@@ -50,13 +57,20 @@ Please observe the [Osmocom Mailing List
Rules](https://osmocom.org/projects/cellular-infrastructure/wiki/Mailing_List_Rules)
when posting.
Issue Tracker
-------------
We use the [issue tracker of the osmo-trx project on osmocom.org](https://osmocom.org/projects/osmotrx/issues) for
tracking the state of bug reports and feature requests. Feel free to submit any issues you may find, or help
us out by resolving existing issues.
Contributing
------------
Our coding standards are described at
<https://osmocom.org/projects/cellular-infrastructure/wiki/Coding_standards>
We us a gerrit based patch submission/review process for managing contributions.
We use a Gerrit based patch submission/review process for managing contributions.
Please see <https://osmocom.org/projects/cellular-infrastructure/wiki/Gerrit>
for more details

View File

@@ -0,0 +1,9 @@
# When cleaning up this file: bump API version in corresponding Makefile.am and rename corresponding debian/lib*.install
# according to https://osmocom.org/projects/cellular-infrastructure/wiki/Make_a_new_release
# In short: https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html#Updating-version-info
# LIBVERSION=c:r:a
# If the library source code has changed at all since the last update, then increment revision: c:r + 1:a.
# If any interfaces have been added, removed, or changed since the last update: c + 1:0:a.
# If any interfaces have been added since the last public release: c:r:a + 1.
# If any interfaces have been removed or changed since the last public release: c:r:0.
#library what description / commit summary line

View File

@@ -127,16 +127,16 @@ osmo_trx_uhd_LDADD = \
$(UHD_LIBS)
osmo_trx_uhd_CPPFLAGS = $(AM_CPPFLAGS) $(UHD_CFLAGS)
if ENABLE_MS_TRX
bin_PROGRAMS += osmo-trx-ms-uhd
osmo_trx_ms_uhd_SOURCES = $(MS_LOWER_SRC) $(MS_UPPER_SRC)
osmo_trx_ms_uhd_LDADD = \
$(builddir)/device/uhd/libdevice.la \
$(COMMON_LDADD) \
$(UHD_LIBS) \
$(TRXCON_LDADD)
osmo_trx_ms_uhd_CPPFLAGS = $(AM_CPPFLAGS) $(UHD_CFLAGS) -DBUILDUHD
endif
#if ENABLE_MS_TRX
#bin_PROGRAMS += osmo-trx-ms-uhd
#osmo_trx_ms_uhd_SOURCES = $(MS_LOWER_SRC) $(MS_UPPER_SRC)
#osmo_trx_ms_uhd_LDADD = \
# $(builddir)/device/uhd/libdevice.la \
# $(COMMON_LDADD) \
# $(UHD_LIBS) \
# $(TRXCON_LDADD)
#osmo_trx_ms_uhd_CPPFLAGS = $(AM_CPPFLAGS) $(UHD_CFLAGS) -DBUILDUHD
#endif
endif
if DEVICE_USRP1

View File

@@ -150,7 +150,7 @@ static void lms_log_callback(int lvl, const char *msg)
{
/* map lime specific log levels */
static const int lvl_map[5] = {
[0] = LOGL_FATAL,
[LMS_LOG_CRITICAL] = LOGL_FATAL,
[LMS_LOG_ERROR] = LOGL_ERROR,
[LMS_LOG_WARNING] = LOGL_NOTICE,
[LMS_LOG_INFO] = LOGL_INFO,

View File

@@ -75,18 +75,19 @@ USRPDevice::USRPDevice(InterfaceType iface, const struct trx_cfg *cfg) : RadioDe
* split sample rate Tx/Rx - 4/1 sps we need to need to
* compensate for advance rather than delay.
*/
if (tx_sps == 1)
pingOffset = 272;
else if (tx_sps == 4)
pingOffset = 269 - 7500;
else
pingOffset = 0;
pingOffset = 272;
/* Split SPS (4/1) unsupported on USRP1
* if(tx_sps == 4 && rx_sps == 1)
* pingOffset = 269 - 7500;
*/
#ifdef SWLOOPBACK
samplePeriod = 1.0e6/actualSampleRate;
loopbackBufferSize = 0;
gettimeofday(&lastReadTime,NULL);
firstRead = false;
pingOffset = 0;
#endif
}
@@ -101,7 +102,7 @@ int USRPDevice::open()
m_uRx.reset();
try {
m_uRx = usrp_standard_rx_sptr(usrp_standard_rx::make(
0, decimRate * tx_sps, 1, -1,
0, decimRate, 1, -1,
usrp_standard_rx::FPGA_MODE_NORMAL,
1024, 16 * 8, rbf));
m_uRx->set_fpga_master_clock_freq(masterClockRate);

View File

@@ -645,6 +645,7 @@ int main(int argc, char *argv[])
osmo_init_logging2(tall_trx_ctx, &log_info);
log_enable_multithread();
log_cache_enable();
osmo_stats_init(tall_trx_ctx);
vty_init(&g_vty_info);
logging_vty_add_cmds();

View File

@@ -82,10 +82,10 @@ AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_C_BIGENDIAN
PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.9.0)
PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 1.9.0)
PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl >= 1.9.0)
PKG_CHECK_MODULES(LIBOSMOCODING, libosmocoding >= 1.9.0)
PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.10.0)
PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 1.10.0)
PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl >= 1.10.0)
PKG_CHECK_MODULES(LIBOSMOCODING, libosmocoding >= 1.10.0)
AC_ARG_ENABLE(sanitize,
[AS_HELP_STRING(
@@ -240,7 +240,6 @@ AS_IF([test "x$with_sse" != "xno"], [
AM_CONDITIONAL(HAVE_SSE4_1, false)
])
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],
@@ -380,6 +379,5 @@ AC_CONFIG_FILES([\
contrib/Makefile \
contrib/systemd/Makefile \
doc/manuals/Makefile \
contrib/osmo-trx.spec \
])
AC_OUTPUT

View File

@@ -9,60 +9,19 @@
#
set -ex
substr() { [ -z "${2##*$1*}" ]; }
#apt-get install qemu qemu-user-static qemu-system-arm debootstrap fakeroot proot
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 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 "$@"
}
mychroot() {
mychroot_nocwd -w / "$@"
}
if [ -z "${INSIDE_CHROOT}" ]; then
# 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
OSMOTRX_DIR="$PWD" # we assume we are called as contrib/jenkins.sh
ROOTFS_PREFIX="${ROOTFS_PREFIX:-$HOME}"
ROOTFS="${ROOTFS_PREFIX}/qemu-img"
mkdir -p "${ROOTFS_PREFIX}"
# Prepare chroot:
if [ ! -d "$ROOTFS" ]; then
mkdir -p "$ROOTFS"
if [ "x${USE_DEBOOTSTRAP}" = "x1" ]; then
fakeroot qemu-debootstrap --foreign --include="linux-image-armmp-lpae" --arch=armhf stretch "$ROOTFS" http://ftp.de.debian.org/debian/
# Hack to avoid debootstrap trying to mount /proc, as it will fail with "no permissions" and anyway proot takes care of it:
sed -i "s/setup_proc//g" "$ROOTFS/debootstrap/suite-script"
mychroot /debootstrap/debootstrap --second-stage --verbose http://ftp.de.debian.org/debian/
else
YESTERDAY=$(python -c 'import datetime ; print((datetime.datetime.now() - datetime.timedelta(days=1)).strftime("%Y%m%d"))')
wget -nc -q "https://uk.images.linuxcontainers.org/images/debian/stretch/armhf/default/${YESTERDAY}_22:42/rootfs.tar.xz"
tar -xf rootfs.tar.xz -C "$ROOTFS/" || true
echo "nameserver 8.8.8.8" > "$ROOTFS/etc/resolv.conf"
fi
mychroot -b /dev apt-get update
mychroot apt-get -y install build-essential dh-autoreconf pkg-config libuhd-dev libusb-1.0-0-dev libusb-dev git libtalloc-dev libgnutls28-dev stow
fi
# Run jenkins.sh inside the chroot:
INSIDE_CHROOT=1 mychroot_nocwd \
-w /osmo-trx \
-b "$OSMOTRX_DIR:/osmo-trx" \
-b "$(which osmo-clean-workspace.sh):/usr/bin/osmo-clean-workspace.sh" \
-b "$(which osmo-build-dep.sh):/usr/bin/osmo-build-dep.sh" \
-b "$(which osmo-deps.sh):/usr/bin/osmo-deps.sh" \
./contrib/jenkins.sh
exit 0
fi
fi
set -ex
case "$INSTR" in
"--with-neon"*)
case "$(arch)" in
arm*)
;;
*)
set +x
echo "ERROR: trying to build with INSTR=$INSTR but not running on a 32-bit arm machine! (arch=$(arch))"
exit 1
;;
esac
;;
esac
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 !"

View File

@@ -1,254 +0,0 @@
#
# spec file for package osmo-trx
#
# Copyright (c) 2017, Martin Hauke <mardnh@gmx.de>
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
Name: osmo-trx
Version: @VERSION@
Release: 0
Summary: SDR transceiver that implements Layer 1 of a GSM BTS
License: AGPL-3.0-or-later
Group: Productivity/Telephony/Servers
URL: https://osmocom.org/projects/osmotrx
Source: %{name}-%{version}.tar.xz
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: fdupes
BuildRequires: gcc-c++
BuildRequires: libtool
BuildRequires: pkgconfig >= 0.20
%if 0%{?suse_version}
BuildRequires: systemd-rpm-macros
%endif
%if ! 0%{?centos_ver}
BuildRequires: pkgconfig(LimeSuite)
BuildRequires: pkgconfig(usrp) >= 3.3
%endif
BuildRequires: pkgconfig(fftw3f)
BuildRequires: pkgconfig(libosmocoding) >= 1.9.0
BuildRequires: pkgconfig(libosmocore) >= 1.9.0
BuildRequires: pkgconfig(libosmoctrl) >= 1.9.0
BuildRequires: pkgconfig(libosmovty) >= 1.9.0
BuildRequires: pkgconfig(libusb-1.0)
BuildRequires: pkgconfig(uhd)
%{?systemd_requires}
%if 0%{?suse_version} > 1325
BuildRequires: libboost_program_options-devel
BuildRequires: libboost_system-devel
BuildRequires: libboost_test-devel
BuildRequires: libboost_thread-devel
%else
BuildRequires: boost-devel
%endif
%description
OsmoTRX is a software-defined radio transceiver that implements the Layer 1
physical layer of a BTS comprising the following 3GPP specifications:
TS 05.01 "Physical layer on the radio path"
TS 05.02 "Multiplexing and Multiple Access on the Radio Path"
TS 05.04 "Modulation"
TS 05.10 "Radio subsystem synchronization"
In this context, BTS is "Base transceiver station". It's the stations that
connect mobile phones to the mobile network.
3GPP is the "3rd Generation Partnership Project" which is the collaboration
between different telecommunication associations for developing new
generations of mobile phone networks. (post-2G/GSM)
%package uhd
Summary: SDR transceiver that implements Layer 1 of a GSM BTS (UHD)
Group: Productivity/Telephony/Servers
Requires: uhd-firmware
%description uhd
OsmoTRX is a software-defined radio transceiver that implements the Layer 1
physical layer of a BTS comprising the following 3GPP specifications:
TS 05.01 "Physical layer on the radio path"
TS 05.02 "Multiplexing and Multiple Access on the Radio Path"
TS 05.04 "Modulation"
TS 05.10 "Radio subsystem synchronization"
In this context, BTS is "Base transceiver station". It's the stations that
connect mobile phones to the mobile network.
3GPP is the "3rd Generation Partnership Project" which is the collaboration
between different telecommunication associations for developing new
generations of mobile phone networks. (post-2G/GSM)
%if ! 0%{?centos_ver}
%package usrp1
Summary: SDR transceiver that implements Layer 1 of a GSM BTS (USRP1)
Group: Productivity/Telephony/Servers
%description usrp1
OsmoTRX is a software-defined radio transceiver that implements the Layer 1
physical layer of a BTS comprising the following 3GPP specifications:
TS 05.01 "Physical layer on the radio path"
TS 05.02 "Multiplexing and Multiple Access on the Radio Path"
TS 05.04 "Modulation"
TS 05.10 "Radio subsystem synchronization"
In this context, BTS is "Base transceiver station". It's the stations that
connect mobile phones to the mobile network.
3GPP is the "3rd Generation Partnership Project" which is the collaboration
between different telecommunication associations for developing new
generations of mobile phone networks. (post-2G/GSM)
%package lms
Summary: SDR transceiver that implements Layer 1 of a GSM BTS (LimeSuite)
Group: Productivity/Telephony/Servers
%description lms
OsmoTRX is a software-defined radio transceiver that implements the Layer 1
physical layer of a BTS comprising the following 3GPP specifications:
TS 05.01 "Physical layer on the radio path"
TS 05.02 "Multiplexing and Multiple Access on the Radio Path"
TS 05.04 "Modulation"
TS 05.10 "Radio subsystem synchronization"
In this context, BTS is "Base transceiver station". It's the stations that
connect mobile phones to the mobile network.
3GPP is the "3rd Generation Partnership Project" which is the collaboration
between different telecommunication associations for developing new
generations of mobile phone networks. (post-2G/GSM)
%endif
%package ipc
Summary: SDR transceiver that implements Layer 1 of a GSM BTS (IPC)
Group: Productivity/Telephony/Servers
%description ipc
OsmoTRX is a software-defined radio transceiver that implements the Layer 1
physical layer of a BTS comprising the following 3GPP specifications:
TS 05.01 "Physical layer on the radio path"
TS 05.02 "Multiplexing and Multiple Access on the Radio Path"
TS 05.04 "Modulation"
TS 05.10 "Radio subsystem synchronization"
In this context, BTS is "Base transceiver station". It's the stations that
connect mobile phones to the mobile network.
3GPP is the "3rd Generation Partnership Project" which is the collaboration
between different telecommunication associations for developing new
generations of mobile phone networks. (post-2G/GSM)
%package ipc-test
Summary: SDR transceiver that implements Layer 1 of a GSM BTS (IPC) driver test utility
Group: Productivity/Telephony/Servers
%description ipc-test
OsmoTRX is a software-defined radio transceiver that implements the Layer 1
physical layer of a BTS comprising the following 3GPP specifications:
This package include the test tools for osmo-trx-ipc
%prep
%setup -q
%build
echo "%{version}" >.tarball-version
autoreconf -fi
%if 0%{?centos_ver}
%configure \
--docdir=%{_docdir}/%{name} \
--with-systemdsystemunitdir=%{_unitdir} \
--without-lms \
--with-uhd \
--without-usrp1 \
--with-ipc
%else
%configure \
--docdir=%{_docdir}/%{name} \
--with-systemdsystemunitdir=%{_unitdir} \
--with-lms \
--with-uhd \
--with-usrp1 \
--with-ipc
%endif
make %{?_smp_mflags} V=1
%check
make %{?_smp_mflags} check || (find . -name testsuite.log -exec cat {} +)
%install
%make_install
%fdupes -s %{buildroot}/%{_datadir}
%if 0%{?suse_version}
%pre lms %service_add_pre osmo-trx-lms.service
%post lms %service_add_post osmo-trx-lms.service
%preun lms %service_del_preun osmo-trx-lms.service
%postun lms %service_del_postun osmo-trx-lms.service
%pre uhd %service_add_pre osmo-trx-uhd.service
%post uhd %service_add_post osmo-trx-uhd.service
%preun uhd %service_del_preun osmo-trx-uhd.service
%postun uhd %service_del_postun osmo-trx-uhd.service
%pre usrp1 %service_add_pre osmo-trx-usrp1.service
%post usrp1 %service_add_post osmo-trx-usrp1.service
%preun usrp1 %service_del_preun osmo-trx-usrp1.service
%postun usrp1 %service_del_postun osmo-trx-usrp1.service
%pre ipc %service_add_pre osmo-trx-ipc.service
%post ipc %service_add_post osmo-trx-ipc.service
%preun ipc %service_del_preun osmo-trx-ipc.service
%postun ipc %service_del_postun osmo-trx-ipc.service
%endif
%files
%license COPYING
%doc README.md
%doc %{_docdir}/%{name}/examples
%if ! 0%{?centos_ver}
%files lms
%{_bindir}/osmo-trx-lms
%dir %{_sysconfdir}/osmocom
%config(noreplace) %{_sysconfdir}/osmocom/osmo-trx-lms.cfg
%{_unitdir}/osmo-trx-lms.service
%endif
%files uhd
%{_bindir}/osmo-trx-uhd
%dir %{_sysconfdir}/osmocom
%config(noreplace) %{_sysconfdir}/osmocom/osmo-trx-uhd.cfg
%{_unitdir}/osmo-trx-uhd.service
%if ! 0%{?centos_ver}
%files usrp1
%{_bindir}/osmo-trx-usrp1
%dir %{_datadir}/usrp
%dir %{_datadir}/usrp/rev2
%dir %{_datadir}/usrp/rev4
%{_datadir}/usrp/rev2/std_inband.rbf
%{_datadir}/usrp/rev4/std_inband.rbf
%{_unitdir}/osmo-trx-usrp1.service
%endif
%files ipc
%{_bindir}/osmo-trx-ipc
%dir %{_sysconfdir}/osmocom
%config(noreplace) %{_sysconfdir}/osmocom/osmo-trx-ipc.cfg
%{_unitdir}/osmo-trx-ipc.service
%files ipc-test
%{_bindir}/ipc-driver-test
%changelog

View File

@@ -8,8 +8,11 @@ Type=simple
Restart=always
StateDirectory=osmocom
WorkingDirectory=%S/osmocom
User=osmocom
Group=osmocom
ExecStart=/usr/bin/osmo-trx-ipc -C /etc/osmocom/osmo-trx-ipc.cfg
RestartSec=2
AmbientCapabilities=CAP_SYS_NICE
# CPU scheduling policy:
CPUSchedulingPolicy=rr
# For real-time scheduling policies an integer between 1 (lowest priority) and 99 (highest priority):

View File

@@ -8,8 +8,11 @@ Type=simple
Restart=always
StateDirectory=osmocom
WorkingDirectory=%S/osmocom
User=osmocom
Group=osmocom
ExecStart=/usr/bin/osmo-trx-lms -C /etc/osmocom/osmo-trx-lms.cfg
RestartSec=2
AmbientCapabilities=CAP_SYS_NICE
# CPU scheduling policy:
CPUSchedulingPolicy=rr
# For real-time scheduling policies an integer between 1 (lowest priority) and 99 (highest priority):

View File

@@ -8,9 +8,12 @@ Type=simple
Restart=always
StateDirectory=osmocom
WorkingDirectory=%S/osmocom
Environment=HOME=%h
Environment=HOME=%S/osmocom
User=osmocom
Group=osmocom
ExecStart=/usr/bin/osmo-trx-uhd -C /etc/osmocom/osmo-trx-uhd.cfg
RestartSec=2
AmbientCapabilities=CAP_SYS_NICE
# CPU scheduling policy:
CPUSchedulingPolicy=rr
# For real-time scheduling policies an integer between 1 (lowest priority) and 99 (highest priority):

View File

@@ -8,8 +8,11 @@ Type=simple
Restart=always
StateDirectory=osmocom
WorkingDirectory=%S/osmocom
User=osmocom
Group=osmocom
ExecStart=/usr/bin/osmo-trx-usrp1 -C /etc/osmocom/osmo-trx-usrp1.cfg
RestartSec=2
AmbientCapabilities=CAP_SYS_NICE
# CPU scheduling policy:
CPUSchedulingPolicy=rr
# For real-time scheduling policies an integer between 1 (lowest priority) and 99 (highest priority):

62
debian/changelog vendored
View File

@@ -1,3 +1,65 @@
osmo-trx (1.7.1) unstable; urgency=medium
[ Oliver Smith ]
* contrib/jenkins: remove broken chroot + qemu code
[ Neels Hofmeyr ]
* comma_delimited_to_vector() optimization CID#465430
-- Oliver Smith <osmith@sysmocom.de> Wed, 12 Feb 2025 12:43:24 +0100
osmo-trx (1.7.0) unstable; urgency=medium
[ Eric ]
* ms: adjust ts advance
* ms: reduce rx burst queue size
* ms: init blade with fpga control
* devices: fix wrong gain to power mapping
* ms: get rid of std::thread
* ms: add demod test tool and data
[ Vadim Yanitskiy ]
* osmo-trx-ms: bump osmocom-bb submodule commit
* Transceiver::ctrl_sock_handle_rx(): fix copy-pasted comments
* build: include version files into the release tarball
* doc/examples: fix missing config files in release tarballs
* README.md: cosmetic: fix a typo
[ Harald Welte ]
* osmo-trx-uhd: Make sure HOME environment variable is set
* README.md: Improve markdown formatting
* README.md: Add Forum and Issue Tracker links
* Add funding link to github mirror
* README.md: Remove stray apostrophe
[ Andreas Eversberg ]
* Use uniform log format for default config files
[ Eric Wild ]
* ms: do not set the blade tuning mode
* ms: hard preswapped VA gsm bits
* ms: add sigproclib demod
* ms: fix up template deduction failure
* ms: update osmocom-bb submodule
* ms: disabe uhd ms build
* transceiver: use log level cache
[ Oliver Smith ]
* gitignore: add .version
* debian/rules: make configure args diff friendly
* debian: add osmo-trx-ms-blade
* contrib/jenkins: make configure args diff friendly
* contrib/jenkins: add --with-bladerf
* contrib: remove rpm spec file
* contrib/systemd: run as osmocom user
* contrib/systemd/osmo-trx-uhd: fix HOME=
[ Pau Espin Pedrol ]
* code-architecture.adoc: Fix missing alignment in digraph
* doc: Introduce documentation for osmo-trx-ipc and its IPC interface
-- Oliver Smith <osmith@sysmocom.de> Wed, 24 Jul 2024 15:57:14 +0200
osmo-trx (1.6.0) unstable; urgency=medium
[ Vadim Yanitskiy ]

4
debian/control vendored
View File

@@ -15,8 +15,8 @@ Build-Depends: debhelper (>= 10),
libusrp-dev,
liblimesuite-dev,
libbladerf-dev,
libosmocore-dev (>= 1.9.0),
osmo-gsm-manuals-dev (>= 1.5.0)
libosmocore-dev (>= 1.10.0),
osmo-gsm-manuals-dev (>= 1.6.0)
Standards-Version: 3.9.6
Vcs-Browser: https://gitea.osmocom.org/cellular-infrastructure/osmo-trx
Vcs-Git: https://gitea.osmocom.org/cellular-infrastructure/osmo-trx

38
debian/osmo-trx-ipc.postinst vendored Executable file
View File

@@ -0,0 +1,38 @@
#!/bin/sh -e
case "$1" in
configure)
# Create the osmocom group and user (if it doesn't exist yet)
if ! getent group osmocom >/dev/null; then
groupadd --system osmocom
fi
if ! getent passwd osmocom >/dev/null; then
useradd \
--system \
--gid osmocom \
--home-dir /var/lib/osmocom \
--shell /sbin/nologin \
--comment "Open Source Mobile Communications" \
osmocom
fi
# Fix permissions of previous (root-owned) install (OS#4107)
if dpkg --compare-versions "$2" le "1.13.0"; then
if [ -e /etc/osmocom/osmo-trx-ipc.cfg ]; then
chown -v osmocom:osmocom /etc/osmocom/osmo-trx-ipc.cfg
chmod -v 0660 /etc/osmocom/osmo-trx-ipc.cfg
fi
if [ -d /etc/osmocom ]; then
chown -v root:osmocom /etc/osmocom
chmod -v 2775 /etc/osmocom
fi
mkdir -p /var/lib/osmocom
chown -R -v osmocom:osmocom /var/lib/osmocom
fi
;;
esac
# dh_installdeb(1) will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#

38
debian/osmo-trx-lms.postinst vendored Executable file
View File

@@ -0,0 +1,38 @@
#!/bin/sh -e
case "$1" in
configure)
# Create the osmocom group and user (if it doesn't exist yet)
if ! getent group osmocom >/dev/null; then
groupadd --system osmocom
fi
if ! getent passwd osmocom >/dev/null; then
useradd \
--system \
--gid osmocom \
--home-dir /var/lib/osmocom \
--shell /sbin/nologin \
--comment "Open Source Mobile Communications" \
osmocom
fi
# Fix permissions of previous (root-owned) install (OS#4107)
if dpkg --compare-versions "$2" le "1.13.0"; then
if [ -e /etc/osmocom/osmo-trx-lms.cfg ]; then
chown -v osmocom:osmocom /etc/osmocom/osmo-trx-lms.cfg
chmod -v 0660 /etc/osmocom/osmo-trx-lms.cfg
fi
if [ -d /etc/osmocom ]; then
chown -v root:osmocom /etc/osmocom
chmod -v 2775 /etc/osmocom
fi
mkdir -p /var/lib/osmocom
chown -R -v osmocom:osmocom /var/lib/osmocom
fi
;;
esac
# dh_installdeb(1) will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#

38
debian/osmo-trx-uhd.postinst vendored Executable file
View File

@@ -0,0 +1,38 @@
#!/bin/sh -e
case "$1" in
configure)
# Create the osmocom group and user (if it doesn't exist yet)
if ! getent group osmocom >/dev/null; then
groupadd --system osmocom
fi
if ! getent passwd osmocom >/dev/null; then
useradd \
--system \
--gid osmocom \
--home-dir /var/lib/osmocom \
--shell /sbin/nologin \
--comment "Open Source Mobile Communications" \
osmocom
fi
# Fix permissions of previous (root-owned) install (OS#4107)
if dpkg --compare-versions "$2" le "1.13.0"; then
if [ -e /etc/osmocom/osmo-trx-uhd.cfg ]; then
chown -v osmocom:osmocom /etc/osmocom/osmo-trx-uhd.cfg
chmod -v 0660 /etc/osmocom/osmo-trx-uhd.cfg
fi
if [ -d /etc/osmocom ]; then
chown -v root:osmocom /etc/osmocom
chmod -v 2775 /etc/osmocom
fi
mkdir -p /var/lib/osmocom
chown -R -v osmocom:osmocom /var/lib/osmocom
fi
;;
esac
# dh_installdeb(1) will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#

38
debian/osmo-trx-usrp1.postinst vendored Executable file
View File

@@ -0,0 +1,38 @@
#!/bin/sh -e
case "$1" in
configure)
# Create the osmocom group and user (if it doesn't exist yet)
if ! getent group osmocom >/dev/null; then
groupadd --system osmocom
fi
if ! getent passwd osmocom >/dev/null; then
useradd \
--system \
--gid osmocom \
--home-dir /var/lib/osmocom \
--shell /sbin/nologin \
--comment "Open Source Mobile Communications" \
osmocom
fi
# Fix permissions of previous (root-owned) install (OS#4107)
if dpkg --compare-versions "$2" le "1.13.0"; then
if [ -e /etc/osmocom/osmo-trx-usrp1.cfg ]; then
chown -v osmocom:osmocom /etc/osmocom/osmo-trx-usrp1.cfg
chmod -v 0660 /etc/osmocom/osmo-trx-usrp1.cfg
fi
if [ -d /etc/osmocom ]; then
chown -v root:osmocom /etc/osmocom
chmod -v 2775 /etc/osmocom
fi
mkdir -p /var/lib/osmocom
chown -R -v osmocom:osmocom /var/lib/osmocom
fi
;;
esac
# dh_installdeb(1) will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#

View File

@@ -9,7 +9,7 @@ digraph hierarchy {
node[shape=record,style=filled,fillcolor=gray95]
edge[dir=back, arrowtail=empty]
2[label = "{Transceiver|+ constructor()\l+ destructor()\l+ init()\l+ numChans()\l+ receiveFIFO()\l+ setSignalHandler()}"]
2[label = "{Transceiver|+ constructor()\l+ destructor()\l+ init()\l+ numChans()\l+ receiveFIFO()\l+ setSignalHandler()\l}"]
3[label = "{RadioInterface|...}"]
4[label = "{RadioInterfaceResamp|...}"]
5[label = "{RadioInterfaceMulti|...}"]
@@ -17,6 +17,7 @@ edge[dir=back, arrowtail=empty]
7[label = "{UHDDevice|...}"]
8[label = "{LMSDevice|...}"]
9[label = "{USRPDevice|...}"]
10[label = "{IPCDevice|...}"]
2->3[arrowtail=odiamond]
3->4[constraint=false]
@@ -25,6 +26,7 @@ edge[dir=back, arrowtail=empty]
6->7
6->8
6->9
6->10
}
----

View File

@@ -0,0 +1,301 @@
[[ipc_if]]
== osmo-trx-ipc IPC Interface
This interface is the one used by _osmo_trx_ipc_ backend to communicate to a
third party process in charge of driving the lowest layer device-specific bits
(from now on the Driver).
It consists of a set of Unix Domain (UD) sockets for the control plane, plus a
shared memory region for the data plane.
Related code can be found in the
https://gitea.osmocom.org/cellular-infrastructure/osmo-trx/src/branch/master/Transceiver52M/device/ipc[Transceiver52M/device/ipc/]
directory in _osmo-trx.git_.
If you are a potential driver implementator, the
various primitives and data structures are publicly available in header file
https://gitea.osmocom.org/cellular-infrastructure/osmo-trx/src/branch/master/Transceiver52M/device/ipc/shm.h[Transceiver52M/device/ipc/shm.h].
=== Control plane
Control plane protocol is transmitted over Unix Domain (UD) sockets using
message based primitives. Each primitive has a type identified by an integer,
and each type of primitive has a number of extra attributes attached to it. The
IPC interface consists of 2 types of UD sockets:
* _Master_ UD socket: One per osmo-trx-ipc process.
* _Channel_ UD socket: One for each channel managed by osmo-trx-ipc process.
The _Driver_ is in all cases expected to take the server role when creating UD
sockets, while _osmo-trx-ipc_ takes the client role and connects to sockets
provided by the driver.
=== Master UD socket
During startup, _osmo-trx-ipc_ will try connecting to the _Driver_ Master UD
socket located in the path provided by its own (VTY) configuration. As a result,
it means the _Driver_ process must be running and listening on the Master UD
socket before _osmo-trx-ipc_ is started, otherwise _osmo-trx-ipc_ will fail and
exit.
Once connected, _osmo-trx-ipc_ will submit a `GREETING_REQ` message primitive
announcing the maximum supported protocol version (first version ever is `1`,
increasing over time).
The _Driver_ shall then answer in `GREETING_CNF` message primitive with its own
maximum supported version (`<=` version received), providing 0 if none is
supported.
If _osmo-trx-ipc_ receives back the requested version, then both sides agreed
on the protocol version to use.
If _osmo-trx-ipc_ receives back a lower version, it shall decide to continue
with version negotiation using a lower version, until a supported version or 0
is received. If finally 0 is received, _osmo-trx-ipc_ will disconnect and exit
with failure.
Once the version is negotiated (`v1` as of current date), _osmo-trx-ipc_ will
ask for device information and available characeristics to the _Driver_ using
the `INFO_REQ` message primitive.
The _Driver_ shall then answer with a `INFO_CNF` message
containing information, such as:
* String containing device description
* Available reference clocks,
* {rx,tx} I/Q scaling factors
* Maximum number of channels supported
* for each channel:
** List of available {rx,tx} paths/antennas.
** {min,max}{rx,tx} gains
** Nominal transmit power
All the information received from the _Driver_ during `INFO_CNF` will be used by
_osmo-trx-ipc_ to decide whether it can fullfil the requested configuration from
the user, and proceed to open the device, or exit with a failure (for instance
number of channels, referece clock or tx/rx antenna selected by the user cannot
be fullfilled).
_osmo-trx-ipc_ will then proceed to open the device and do an initial
configuration using an `OPEN_REQ` message, where it will provide the _Driver_
with the desired selected configuration (such as number of channels, rx/tx
paths, clock reference, bandwidth filters, etc.).
The _Driver_ shall then configure the device and send back a `OPEN_CNF` with:
* `return_code` integer attribute set to `0` on success or `!0` on error.
* Name of the Posix Shared Memory region where data plane is going to be
transmitted.
* One path for each channel, containing the just-created UD socket to manage
that channel (for instance by taking Master UD socket path and appending
`_$chan_idx`).
* Path Delay: this is the loopback path delay in samples (= used as a timestamp
offset internally by _osmo-trx-ipc_), this value contains the analog delay as
well as the delay introduced by the digital filters in the fpga in the sdr
devices, and is therefore device type and bandwidth/sample rate dependant. This
can not be omitted, wrong values will lead to a _osmo-trx-ipc_ that just doesn't
detect any bursts.
Finally, _osmo-trx-ipc_ will connect to each channel's UD socket (see next
section).
Upon _osmo-trx-ipc_ closing the UD master socket connection, the _Driver_ shall
go into _closed_ state: stop all processing and instruct the device to power
off.
TIP: See
https://gitea.osmocom.org/cellular-infrastructure/osmo-trx/src/branch/master/Transceiver52M/device/ipc/shm.h[Transceiver52M/device/ipc/shm.h]
for the detailed definition of all the related message primitives and data
types for this socket.
=== Channel UD Socket
This socket can be used by _osmo-trx-ipc_ to start/stop data plane processing or
change channel's parameters such as Rx/Tx Frequency, Rx/Tx gains, etc.
A channel can be either in _started_ or _stopped_ state. When a channel is
created (during `OPEN_REQ` in the Master UD Socket), it's by default in
_stopped_ state. `START_REQ` and `STOP_REQ` messages control this state, and
eventual failures can be reported through `START_CNF` and `STOP_CNF` by the
_Driver_.
The message `START_REQ` instructs the _Driver_ to start processing data in the
data plane. Similary, `STOP_REQ` instructs the _Driver_ to stop processing data
in the data plane.
Some parameters are usually changed only when the channel is in stopped mode,
for instance Rx/Tx Frequency.
TIP: See
https://gitea.osmocom.org/cellular-infrastructure/osmo-trx/src/branch/master/Transceiver52M/device/ipc/shm.h[Transceiver52M/device/ipc/shm.h]
for the detailed definition of all the related message primitives and data
types for this socket.
=== Data Plane
Data plane protocol is implemented by means of a ring buffer structure on top of
Posix Shared Memory (see `man 7 shm_overview`) between _osmo-trx-ipc_ process
and the _Driver_.
The Posix Shared Memory region is created and its memory structure prepared by
the _Driver_ and its name shared with _osmo-trx-ipc_ during _OPEN_CNF_ message
in the Master UD Socket from the Control Plane. Resource allocation for the
shared memory area and cleanup is up to the ipc server, as is mutex
initialization for the buffers.
==== Posix Shared Memory structure
[[fig-shm-structure]]
.General overview of Posix Shared Memory structure
[graphviz]
----
digraph hierarchy {
node[shape=record,style=filled,fillcolor=gray95]
edge[dir=back, arrowtail=empty]
SHM[label = "{Posix Shared Memory region|+ num_chans\l+ Channels[]\l}"]
CHAN0[label = "{Channel 0|...}"]
CHAN1[label = "{Channel 1|...}"]
CHANN[label = "{Channel ...|}"]
STREAM0_UL[label = "{UL Stream|+ semaphore\l+ read_next\l+ write_next\l+ buffer_size /* In samples */\l+ num_buffers\l+ sample_buffers[]\l}"]
STREAM0_DL[label = "{DL Stream|+ semaphore\l+ read_next\l+ write_next\l+ buffer_size /* In samples */\l+ num_buffers\l+ sample_buffers[]\l}"]
STREAM1_UL[label = "{UL Stream|...}"]
STREAM1_DL[label = "{DL Stream|...}"]
STREAMN_UL[label = "{UL Stream|...}"]
STREAMN_DL[label = "{DL Stream|...}"]
BUF_0DL0[label = "{DL Sample Buffer 0|+ timestamp\l+ buffer_size /* In samples */\l+ samples[] = [16bit I + 16bit Q,...]\l}"]
BUF_0DLN[label = "{DL Sample Buffer ....|...}"]
BUF_0UL0[label = "{UL Sample Buffer 0|+ timestamp\l+ buffer_size /* In samples */\l+ samples[] = [16bit I + 16bit Q,...]\l}"]
BUF_0ULN[label = "{UL Sample Buffer ...|...}"]
SHM->CHAN0
SHM->CHAN1
SHM->CHANN
CHAN0->STREAM0_DL
CHAN0->STREAM0_UL
STREAM0_DL->BUF_0DL0
STREAM0_DL->BUF_0DLN
STREAM0_UL->BUF_0UL0
STREAM0_UL->BUF_0ULN
CHAN1->STREAM1_UL
CHAN1->STREAM1_DL
CHANN->STREAMN_UL
CHANN->STREAMN_DL
}
----
The Posix Shared Memory region contains an array of _Channels_.
Each _Channel_ contains 2 Streams:
* Downlink _Stream_
* Uplink _Stream_
Each _Stream_ handles a ring buffer, which is implemented as:
* An array of pointers to _Sample Buffer_ structures.
* Variables containing the number of buffers in the array, as well as the
maximum size in samples for each Sample Buffer.
* Variables containing `next_read` and `next_write` _Sample Buffer_ (its index
in the array of pointers).
* Unnamed Posix semaphores to do the required locking while using the ring
buffer.
Each _Sample Buffer_ contains:
* A `timestamp` variable, containing the position in the stream of the first
sample in the buffer
* A `data_len` variable, containing the amount of samples available to process
in the buffer
* An array of samples of size specified by the stream struct it is part of.
==== Posix Shared Memory format
The Posix Shared memory region shall be formatted applying the following
considerations:
* All pointers in the memory region are encoded as offsets from the start
address of the region itself, to allow different processes with different
address spaces to decode them.
* All structs must be force-aligned to 8 bytes
* Number of buffers must be power of 2 (2,4,8,16,...) - 4 appears to be plenty
* IQ samples format: One (complex) sample consists of 16bit i + 16bit q, so the
buffer size is number of IQ pairs.
* A reasonable per-buffer size (in samples) is 2500, since this happens to be
the ususal TX (downlink) buffer size used by _osmo-trx-ipc_ with the b210 (rx
over-the-wire packet size for the b210 is 2040 samples, so the larger value of
both is convenient).
TIP: See
https://gitea.osmocom.org/cellular-infrastructure/osmo-trx/src/branch/master/Transceiver52M/device/ipc/shm.h[Transceiver52M/device/ipc/shm.h]
for the detailed definition of all the objects being part of the Posix Shared
memory region structure
==== Posix Shared Memory procedures
The queue in the shared memory area is not supposed to be used for actual
buffering of data, only for exchange, so the general expectation is that it is
mostly empty. The only exception to that might be minor processing delays, and
during startup.
Care must be taken to ensure that only timed waits for the mutex protecting it
and the condition variables are used, in order to ensure that no deadlock occurs
should the other side die/quit.
Thread cancellation should be disabled during reads/writes from/to the queue. In
general a timeout can be considered a non recoverable error during regular
processing after startup, at least with the current timeout value of one second.
Should over- or underflows occur a corresponding message should be sent towards
_osmo-trx-ipc_.
Upon **read** of `N` samples, the reader does something like:
. Acquire the semaphore in the channel's stream object.
. Read `stream->next_read`, if `next_read==next_write`, become blocked in
another sempahore (unlocking the previous one) until writer signals us, then
`buff = stream->buffers[next_read]`
. Read `buff->data_len` samples, reset the buffer data (`data_len=0`),
increment `next_read` and if read samples is `<N`, continue with next buffer
until `next_read==next_write`, then block again or if timeout elapsed, then we
reach conditon buffer underflow and `return len < N`.
. Release the semaphore
Upon **write** of `N` samples, the writer does something like:
. Acquire the semapore in the channel's stream object.
. Write samples to `buff = stream->buffers[next_write]`. If `data_len!=0`,
signal `buffer_overflow` (increase field in stream object) and probably
increase next_read`.
. Increase `next_write`.
. If `next_write` was `== next_read`, signal the reader through the other
semaphore that it can continue reading.

View File

@@ -71,3 +71,103 @@ with a memory buffer. In this mode, data written to the USRP is actually stored
in a buffer, and read commands to the USRP simply pull data from this buffer.
This was very useful in early testing, and still may be useful in testing basic
Transceiver and radioInterface functionality.
[[backend_ipc]]
=== `osmo-trx-ipc` Inter Process Communication backend
This OsmoTRX model provides its own Inter Process Communication (IPC) interface
to drive the radio device driver (from now on the Driver), allowing for third
party processes to implement the lowest layer device-specific bits without being
affected by copyleft licenses of OsmoTRX.
For more information on such interface, see section <<ipc_if>>.
[[fig-backend-ipc]]
.Architecture with _osmo-trx-ipc_ and its IPC _Driver_
[graphviz]
----
digraph G {
rankdir=LR;
MS0 [label="MS"];
MS1 [label="MS"];
OsmoTRX [label="osmo-trx-ipc", color=red];
BTS;
subgraph cluster_ipc_driver {
label = "IPC Driver";
color=red;
RE [label = "Radio Equipment"];
REC [label="Radio Equipment Controller"];
RE->REC;
}
REC->OsmoTRX [label="IPC Interface", color=red];
MS0->RE [label="Um"];
MS1->RE [label="Um"];
OsmoTRX->BTS [label="bursts over UDP"];
}
----
A sample config file for this OsmoTRX model can be found in _osmo-trx.git_ https://gitea.osmocom.org/cellular-infrastructure/osmo-trx/src/branch/master/doc/examples/osmo-trx-ipc/osmo-trx-ipc.cfg[doc/examples/osmo-trx-ipc/osmo-trx-ipc.cfg]
In the config file, the following VTY command can be used to set up the IPC UD Master Socket _osmo-trx-ipc_ will connect to at startup:
.Example: _osmo-trx-ipc_ will connect to UD Master Socket /tmp/ipc_sock0 upon startup
----
dev-args ipc_msock=/tmp/ipc_sock0
----
==== ipc-device-test
When built with `--with-ipc --with-uhd` configure options, _osmo-trx.git_ will
build the test program called _ipc-driver-test_. This program implements the
_Driver_ side of the osmo-trx-ipc interface (see <<ipc_if>> for more
information) on one side, and also interacts internally with UHD (eg B210 as
when using osmo-trx-uhd).
You can use this small program as a reference to:
* Test and experiment with _osmo-trx-ipc_.
* Write your own IPC _Driver_ connecting to osmo-trx-ipc.
[[fig-backend-ipc-device-test]]
.Architecture with _osmo-trx-ipc_ and ipc-device-test as IPC _Driver_
[graphviz]
----
digraph G {
rankdir=LR;
MS0 [label="MS"];
MS1 [label="MS"];
SDR;
ipc_device_test[label = "ipc-device-test", color=red];
OsmoTRX [label="osmo-trx-ipc", color=red];
BTS;
MS0->SDR [label="Um"];
MS1->SDR [label="Um"];
SDR->ipc_device_test [label="UHD"];
ipc_device_test->OsmoTRX [label="IPC Interface", color=red];
OsmoTRX->BTS [label="bursts over UDP"];
}
----
The code for this app is found here:
* https://gitea.osmocom.org/cellular-infrastructure/osmo-trx/src/branch/master/Transceiver52M/device/ipc/ipc-driver-test.h[Transceiver52M/device/ipc/ipc-driver-test.h]
* https://gitea.osmocom.org/cellular-infrastructure/osmo-trx/src/branch/master/Transceiver52M/device/ipc/ipc-driver-test.c[Transceiver52M/device/ipc/ipc-driver-test.c]
Those files use the server-side (_Driver_ side) code to operate the Posix Shared
Memory region implemented in files `shm.c`, `shm.h`, `ipc_shm.c` and `ipc_shm.h`
in the same directory.
Most of the code in that same directory is deliverately released under a BSD
license (unlike most of _osmo-trx.git_), allowing third parties to reuse/recycle
the code on their implemented _Driver_ program no matter it being proprietary or
under an open license. However, care must be taken with external dependencies,
as for instance shm.c uses the talloc memory allocator, which is GPL licensed
and hence cannot be used in a proprietary driver.

View File

@@ -35,6 +35,8 @@ include::./common/chapters/vty_cpu_sched.adoc[]
include::./common/chapters/trx_if.adoc[]
include::{srcdir}/chapters/ipc_if.adoc[]
include::./common/chapters/port_numbers.adoc[]
include::./common/chapters/bibliography.adoc[]