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/+/15288
Change subject: Transceiver: Clean up receival of downlink bursts
......................................................................
Transceiver: Clean up receival of downlink bursts
Use a packed structure to clearly indicate what is contained in the
received buffer.
Change-Id: I4d8c0e3c0c717699889f79e50c778d14b6058f2d
---
M Transceiver52M/Transceiver.cpp
M Transceiver52M/proto_trxd.h
2 files changed, 28 insertions(+), 24 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/88/15288/1
diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp
index 244f372..ab87b68 100644
--- a/Transceiver52M/Transceiver.cpp
+++ b/Transceiver52M/Transceiver.cpp
@@ -930,7 +930,7 @@
int msgLen;
int burstLen;
char buffer[EDGE_BURST_NBITS + 50];
- struct trxd_hdr_common *chdr;
+ struct trxd_hdr_v01_dl *dl;
uint32_t fn;
// check data socket
@@ -940,54 +940,51 @@
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(struct trxd_hdr_v01_dl) + gSlotLen: /* GSM burst */
+ burstLen = gSlotLen;
+ break;
+ case sizeof(struct trxd_hdr_v01_dl) + EDGE_BURST_NBITS: /* EDGE burst */
+ if (mSPSTx != 4)
+ return false;
+ burstLen = EDGE_BURST_NBITS;
+ break;
+ default:
+ LOG(ERR) << "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;
+ LOG(ERR) << "Rx TRXD message with unknown header version " << dl->common.version;
return false;
}
- LOG(DEBUG) << "Rx TRXD message (hdr_ver=" << chdr->version << "): "
- << "fn=" << fn << ", tn=" << chdr->tn << ", "
+ LOG(DEBUG) << "Rx TRXD message (hdr_ver=" << dl->common.version << "): "
+ << "fn=" << fn << ", tn=" << 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->rssi, currTime);
return true;
-
-
}
void Transceiver::driveReceiveRadio()
diff --git a/Transceiver52M/proto_trxd.h b/Transceiver52M/proto_trxd.h
index 7eb5dac..d006400 100644
--- a/Transceiver52M/proto_trxd.h
+++ b/Transceiver52M/proto_trxd.h
@@ -66,6 +66,13 @@
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 rssi;
+ 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))
--
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/15288
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: I4d8c0e3c0c717699889f79e50c778d14b6058f2d
Gerrit-Change-Number: 15288
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/20190826/1d24c26e/attachment.htm>