This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
pespin gerrit-no-reply at lists.osmocom.orgpespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-trx/+/14646
Change subject: Transceiver: Support SETFORMAT command
......................................................................
Transceiver: Support SETFORMAT command
Only old v0 is supported so far. TRXD protocol related data/logic is
moved to its own file out of Transceiver class.
Change-Id: I5786dd44b076202c6f1a6e82405670e8605797ed
---
M Transceiver52M/Makefile.am
M Transceiver52M/Transceiver.cpp
M Transceiver52M/Transceiver.h
A Transceiver52M/proto_trxd.c
M Transceiver52M/proto_trxd.h
5 files changed, 100 insertions(+), 35 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/46/14646/1
diff --git a/Transceiver52M/Makefile.am b/Transceiver52M/Makefile.am
index 4adf474..791c586 100644
--- a/Transceiver52M/Makefile.am
+++ b/Transceiver52M/Makefile.am
@@ -47,7 +47,8 @@
Transceiver.cpp \
ChannelizerBase.cpp \
Channelizer.cpp \
- Synthesis.cpp
+ Synthesis.cpp \
+ proto_trxd.c
libtransceiver_common_la_SOURCES = \
$(COMMON_SOURCES) \
diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp
index 300ce46..b8094bd 100644
--- a/Transceiver52M/Transceiver.cpp
+++ b/Transceiver52M/Transceiver.cpp
@@ -31,7 +31,7 @@
#include "osmo_signal.h"
#include "proto_trxd.h"
-#include <osmocom/core/bits.h>
+#include <osmocom/core/utils.h>
#include <osmocom/core/socket.h>
}
@@ -125,7 +125,7 @@
rssiOffset(wRssiOffset), stackSize(wStackSize),
mSPSTx(tx_sps), mSPSRx(rx_sps), mChans(chans), mEdge(false), mOn(false), mForceClockInterface(false),
mTxFreq(0.0), mRxFreq(0.0), mTSC(0), mMaxExpectedDelayAB(0), mMaxExpectedDelayNB(0),
- mWriteBurstToDiskMask(0)
+ mWriteBurstToDiskMask(0), mVersionTRXD(0)
{
txFullScale = mRadioInterface->fullScaleInputValue();
rxFullScale = mRadioInterface->fullScaleOutputValue();
@@ -864,6 +864,18 @@
mStates[chan].chanType[timeslot] = (ChannelCombination) corrCode;
setModulus(timeslot, chan);
sprintf(response,"RSP SETSLOT 0 %d %d",timeslot,corrCode);
+ } else if (match_cmd(command, "SETFORMAT", ¶ms)) {
+ // set TRXD protocol version
+ unsigned version_recv, version_used;
+ sscanf(params, "%u", &version_recv);
+ LOGC(DTRXCTRL, INFO) << "BTS requests TRXD version switch: " << version_recv;
+ if (version_recv > TRX_DATA_FORMAT_VER)
+ version_used = TRX_DATA_FORMAT_VER;
+ else
+ version_used = version_recv;
+ LOGC(DTRXCTRL, NOTICE) << "switching to TRXD version " << version_used;
+ mVersionTRXD = version_used;
+ sprintf(response,"RSP SETFORMAT %u %u", version_used, version_recv);
} else if (match_cmd(command, "_SETBURSTTODISKMASK", ¶ms)) {
// debug command! may change or disapear without notice
// set a mask which bursts to dump to disk
@@ -967,9 +979,6 @@
void Transceiver::driveReceiveFIFO(size_t chan)
{
- int msgLen;
- int TOAint; // in 1/256 symbols
-
struct trx_ul_burst_ind bi;
if (!pullRadioVector(chan, &bi))
@@ -977,23 +986,13 @@
logRxBurst(chan, &bi);
- TOAint = (int) (bi.toa * 256.0 + 0.5); // round to closest integer
-
- char burstString[sizeof(struct trxd_hdr_v0) + bi.nbits];
- struct trxd_hdr_v0* pkt = (struct trxd_hdr_v0*)burstString;
- pkt->common.version = 0;
- pkt->common.reserved = 0;
- pkt->common.tn = bi.tn;
- osmo_store32be(bi.fn, &pkt->common.fn);
- pkt->v0.rssi = bi.rssi;
- osmo_store16be(TOAint, &pkt->v0.toa);
-
- for (unsigned i = 0; i < bi.nbits; i++)
- pkt->soft_bits[i] = (char) round(bi.rx_burst[i] * 255.0);
-
- msgLen = write(mDataSockets[chan], burstString, sizeof(struct trxd_hdr_v0) + bi.nbits);
- if (msgLen <= 0)
- LOGCHAN(chan, DTRXCTRL, WARNING) << "mDataSockets write(" << mCtrlSockets[chan] << ") failed: " << msgLen;
+ switch (mVersionTRXD) {
+ case 0:
+ trxd_send_burst_ind_v0(chan, mDataSockets[chan], &bi);
+ break;
+ default:
+ OSMO_ASSERT(false);
+ }
}
void Transceiver::driveTxFIFO()
diff --git a/Transceiver52M/Transceiver.h b/Transceiver52M/Transceiver.h
index cca9b41..ea41f78 100644
--- a/Transceiver52M/Transceiver.h
+++ b/Transceiver52M/Transceiver.h
@@ -34,18 +34,6 @@
#include "config_defs.h"
}
-#define MAX_RX_BURST_BUF_SIZE EDGE_BURST_NBITS
-
-struct trx_ul_burst_ind {
- float rx_burst[MAX_RX_BURST_BUF_SIZE]; /* soft bits normalized 0..1 */
- unsigned nbits; // number of symbols per slot in rxBurst, not counting guard periods
- uint32_t fn; // TDMA frame number
- uint8_t tn; // TDMA time-slot number
- double rssi; // in dBFS
- double toa; // in symbols
- double noise; // noise level in dBFS
-};
-
class Transceiver;
/** Channel descriptor for transceiver object and channel number pair */
@@ -228,6 +216,7 @@
unsigned mMaxExpectedDelayAB; ///< maximum expected time-of-arrival offset in GSM symbols for Access Bursts (RACH)
unsigned mMaxExpectedDelayNB; ///< maximum expected time-of-arrival offset in GSM symbols for Normal Bursts
unsigned mWriteBurstToDiskMask; ///< debug: bitmask to indicate which timeslots to dump to disk
+ unsigned mVersionTRXD; ///< Format version to use for TRXD protocol communication
std::vector<TransceiverState> mStates;
diff --git a/Transceiver52M/proto_trxd.c b/Transceiver52M/proto_trxd.c
new file mode 100644
index 0000000..f29d6ee
--- /dev/null
+++ b/Transceiver52M/proto_trxd.c
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2019 sysmocom - s.f.m.c. GmbH
+ * All Rights Reserved
+ *
+ * SPDX-License-Identifier: AGPL-3.0+
+ *
+ * Author: Pau Espin Pedrol <pespin at sysmocom.de>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * See the COPYING file in the main directory for details.
+ */
+
+#include "proto_trxd.h"
+
+
+bool trxd_send_burst_ind_v0(size_t chan, int fd, const struct trx_ul_burst_ind *bi) {
+ int rc;
+ int toa_int;
+
+ /* in 1/256 symbols, round to closest integer */
+ toa_int = (int) (bi->toa * 256.0 + 0.5);
+
+ char buf[sizeof(struct trxd_hdr_v0) + bi->nbits];
+ struct trxd_hdr_v0* pkt = (struct trxd_hdr_v0*)buf;
+ pkt->common.version = 0;
+ pkt->common.reserved = 0;
+ pkt->common.tn = bi->tn;
+ osmo_store32be(bi->fn, &pkt->common.fn);
+ pkt->v0.rssi = bi->rssi;
+ osmo_store16be(toa_int, &pkt->v0.toa);
+
+ for (unsigned i = 0; i < bi->nbits; i++)
+ pkt->soft_bits[i] = (char) round(bi->rx_burst[i] * 255.0);
+
+ rc = write(fd, buf, sizeof(struct trxd_hdr_v0) + bi->nbits);
+ if (rc <= 0) {
+ CLOGCHAN(chan, DMAIN, LOGL_NOTICE, "mDataSockets write(%d) failed: %d\n", fd, rc);
+ return false;
+ }
+ return true;
+}
diff --git a/Transceiver52M/proto_trxd.h b/Transceiver52M/proto_trxd.h
index 9da18db..ef34666 100644
--- a/Transceiver52M/proto_trxd.h
+++ b/Transceiver52M/proto_trxd.h
@@ -1,8 +1,32 @@
#pragma once
#include <stdint.h>
+#include <stdbool.h>
+#include <unistd.h>
+#include <math.h>
+
+#include <osmocom/core/bits.h>
#include <osmocom/core/endian.h>
+#include "debug.h"
+
+#define MAX_RX_BURST_BUF_SIZE 444 /* 444 = EDGE_BURST_NBITS */
+
+struct trx_ul_burst_ind {
+ float rx_burst[MAX_RX_BURST_BUF_SIZE]; /* soft bits normalized 0..1 */
+ unsigned nbits; // number of symbols per slot in rxBurst, not counting guard periods
+ uint32_t fn; // TDMA frame number
+ uint8_t tn; // TDMA time-slot number
+ double rssi; // in dBFS
+ double toa; // in symbols
+ double noise; // noise level in dBFS
+};
+
+bool trxd_send_burst_ind_v0(size_t chan, int fd, const struct trx_ul_burst_ind *bi);
+
+/* The latest supported TRXD header format version */
+#define TRX_DATA_FORMAT_VER 0
+
struct trxd_hdr_common {
#if OSMO_IS_LITTLE_ENDIAN
uint8_t tn:3,
--
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/14646
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: I5786dd44b076202c6f1a6e82405670e8605797ed
Gerrit-Change-Number: 14646
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190701/e98af4a3/attachment.htm>