fixeria has submitted this change. (
https://gerrit.osmocom.org/c/osmocom-bb/+/30254 )
Change subject: trxcon: make burst pointer in trxcon_phyif_burst_ind const
......................................................................
trxcon: make burst pointer in trxcon_phyif_burst_ind const
The trx_data_rx_cb() needs to be modified because it's accessing and
modifying the receive buffer via the bi.burst pointer, which
becomes const after this patch.
Change-Id: I68773d247725a6dc2cbbc58b63c0fd19ffdb1a16
Related: OS#5599
---
M src/host/trxcon/include/osmocom/bb/trxcon/phyif.h
M src/host/trxcon/src/trx_if.c
2 files changed, 13 insertions(+), 10 deletions(-)
Approvals:
Jenkins Builder: Verified
laforge: Looks good to me, approved
pespin: Looks good to me, but someone else must approve
diff --git a/src/host/trxcon/include/osmocom/bb/trxcon/phyif.h
b/src/host/trxcon/include/osmocom/bb/trxcon/phyif.h
index 775c278..a2bc9ce 100644
--- a/src/host/trxcon/include/osmocom/bb/trxcon/phyif.h
+++ b/src/host/trxcon/include/osmocom/bb/trxcon/phyif.h
@@ -84,7 +84,7 @@
uint8_t tn;
int16_t toa256;
int8_t rssi;
- sbit_t *burst;
+ const sbit_t *burst;
unsigned int burst_len;
};
diff --git a/src/host/trxcon/src/trx_if.c b/src/host/trxcon/src/trx_if.c
index 388d82b..563af61 100644
--- a/src/host/trxcon/src/trx_if.c
+++ b/src/host/trxcon/src/trx_if.c
@@ -631,6 +631,7 @@
struct trxcon_phyif_burst_ind bi;
uint8_t buf[TRXD_BUF_SIZE];
ssize_t read_len;
+ sbit_t *burst;
read_len = read(ofd->fd, buf, sizeof(buf));
if (read_len <= 0) {
@@ -644,23 +645,25 @@
return -EINVAL;
}
+ burst = (sbit_t *)&buf[8];
+
+ /* Convert ubits {254..0} to sbits {-127..127} in-place */
+ for (unsigned int i = 0; i < bi.burst_len; i++) {
+ if (buf[8 + i] == 255)
+ burst[i] = -127;
+ else
+ burst[i] = 127 - buf[8 + i];
+ }
+
bi = (struct trxcon_phyif_burst_ind) {
.tn = buf[0],
.fn = osmo_load32be(buf + 1),
.rssi = -(int8_t) buf[5],
.toa256 = (int16_t) (buf[6] << 8) | buf[7],
- .burst = (sbit_t *)&buf[8],
+ .burst = burst,
.burst_len = 148,
};
- /* Copy and convert bits {254..0} to sbits {-127..127} */
- for (unsigned int i = 0; i < bi.burst_len; i++) {
- if (buf[8 + i] == 255)
- bi.burst[i] = -127;
- else
- bi.burst[i] = 127 - buf[8 + i];
- }
-
if (bi.tn >= 8) {
LOGPFSMSL(trx->fi, DTRXD, LOGL_ERROR, "Illegal TS %d\n", bi.tn);
return -EINVAL;
--
To view, visit
https://gerrit.osmocom.org/c/osmocom-bb/+/30254
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: I68773d247725a6dc2cbbc58b63c0fd19ffdb1a16
Gerrit-Change-Number: 30254
Gerrit-PatchSet: 4
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged