From 04b14c49f0df55bba8784d3302429b5ab8f1185b Mon Sep 17 00:00:00 2001 From: Vadim Yanitskiy Date: Thu, 24 Nov 2022 11:46:40 +0700 Subject: [PATCH] trxcon: trx_data_rx_cb(): support parsing 8-PSK modulated bursts Change-Id: I78b1a79c329299ab65eb339e9447a47382983cd9 --- src/host/trxcon/src/trx_if.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/host/trxcon/src/trx_if.c b/src/host/trxcon/src/trx_if.c index c938fc0ba..078f71b28 100644 --- a/src/host/trxcon/src/trx_if.c +++ b/src/host/trxcon/src/trx_if.c @@ -43,6 +43,9 @@ #include #include +#define TRXDv0_HDR_LEN 8 +#define GMSK_BURST_LEN 148 + #define S(x) (1 << (x)) static void trx_fsm_cleanup_cb(struct osmo_fsm_inst *fi, @@ -642,7 +645,7 @@ static int trx_data_rx_cb(struct osmo_fd *ofd, unsigned int what) return read_len; } - if (read_len < (8 + 148)) { /* TRXDv0 header + GMSK burst */ + if (read_len < (TRXDv0_HDR_LEN + GMSK_BURST_LEN)) { LOGPFSMSL(trx->fi, DTRXD, LOGL_ERROR, "Got data message with invalid length '%zd'\n", read_len); return -EINVAL; @@ -661,8 +664,8 @@ static int trx_data_rx_cb(struct osmo_fd *ofd, unsigned int what) .fn = osmo_load32be(buf + 1), .rssi = -(int8_t) buf[5], .toa256 = (int16_t) (buf[6] << 8) | buf[7], - .burst = burst, - .burst_len = 148, + .burst = burst, /* at least GMSK_BURST_LEN */ + .burst_len = read_len - TRXDv0_HDR_LEN, }; /* Convert ubits {254..0} to sbits {-127..127} in-place */