From 55dbafc497a1406a3bfa9c87c5e7337d6e127249 Mon Sep 17 00:00:00 2001 From: Vadim Yanitskiy Date: Mon, 8 Jul 2019 10:34:33 +0700 Subject: osmo-bts-trx/trx_if.c: encode actual TRXD header version Both TRX2L1 (Uplink) and L12TRX (Downlink) messages should use the same TRXD header format (and version) as was negotiated. Change-Id: Idbc598ef7c1871ee8da830f3fbe0a5cc386f873d Related: OS#4006 --- src/osmo-bts-trx/trx_if.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/osmo-bts-trx/trx_if.c b/src/osmo-bts-trx/trx_if.c index 3e53fdb7..b966bbef 100644 --- a/src/osmo-bts-trx/trx_if.c +++ b/src/osmo-bts-trx/trx_if.c @@ -1054,6 +1054,7 @@ static int trx_data_read_cb(struct osmo_fd *ofd, unsigned int what) int trx_if_send_burst(struct trx_l1h *l1h, uint8_t tn, uint32_t fn, uint8_t pwr, const ubit_t *bits, uint16_t nbits) { + uint8_t hdr_ver = l1h->config.trxd_hdr_ver_use; uint8_t buf[TRX_DATA_MSG_MAX_LEN]; if ((nbits != GSM_BURST_LEN) && (nbits != EGPRS_BURST_LEN)) { @@ -1061,9 +1062,23 @@ int trx_if_send_burst(struct trx_l1h *l1h, uint8_t tn, uint32_t fn, uint8_t pwr, return -1; } - LOGPPHI(l1h->phy_inst, DTRX, LOGL_DEBUG, "TX burst tn=%u fn=%u pwr=%u\n", tn, fn, pwr); + LOGPPHI(l1h->phy_inst, DTRX, LOGL_DEBUG, + "Tx burst (hdr_ver=%u): tn=%u fn=%u pwr=%u\n", + hdr_ver, tn, fn, pwr); - buf[0] = tn; + switch (hdr_ver) { + case 0: + case 1: + /* Both versions have the same header format */ + break; + + default: + LOGPPHI(l1h->phy_inst, DTRX, LOGL_ERROR, + "Requested TRXD header version %u is not supported\n", hdr_ver); + return -ENOTSUP; + } + + buf[0] = ((hdr_ver & 0x0f) << 4) | tn; buf[1] = (fn >> 24) & 0xff; buf[2] = (fn >> 16) & 0xff; buf[3] = (fn >> 8) & 0xff; -- cgit v1.2.3