diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/osmo-bts-trx/scheduler.c | 7 | ||||
-rw-r--r-- | src/osmo-bts-trx/tch_fr.c | 18 | ||||
-rw-r--r-- | src/osmo-bts-trx/tch_fr.h | 5 |
3 files changed, 19 insertions, 11 deletions
diff --git a/src/osmo-bts-trx/scheduler.c b/src/osmo-bts-trx/scheduler.c index d5c7bb54..f65a7025 100644 --- a/src/osmo-bts-trx/scheduler.c +++ b/src/osmo-bts-trx/scheduler.c @@ -759,9 +759,10 @@ static const ubit_t *tx_tchf_fn(struct trx_l1h *l1h, uint8_t tn, uint32_t fn, /* encode bursts (priorize FACCH) */ if (msg_facch) - tch_fr_encode(*bursts_p, msg_facch->l2h, msgb_l2len(msg_facch)); + tch_fr_encode(*bursts_p, msg_facch->l2h, msgb_l2len(msg_facch), + 1); else - tch_fr_encode(*bursts_p, msg_tch->l2h, msgb_l2len(msg_tch)); + tch_fr_encode(*bursts_p, msg_tch->l2h, msgb_l2len(msg_tch), 1); /* unlink and free message */ if (msg_tch) @@ -1079,7 +1080,7 @@ static int rx_tchf_fn(struct trx_l1h *l1h, uint8_t tn, uint32_t fn, /* decode * also shift buffer by 4 bursts for interleaving */ - rc = tch_fr_decode(tch_data, *bursts_p); + rc = tch_fr_decode(tch_data, *bursts_p, 1); memcpy(*bursts_p, *bursts_p + 464, 464); if (rc < 0) { LOGP(DL1C, LOGL_NOTICE, "Received bad TCH frame at fn=%u " diff --git a/src/osmo-bts-trx/tch_fr.c b/src/osmo-bts-trx/tch_fr.c index 16fc8541..23130e94 100644 --- a/src/osmo-bts-trx/tch_fr.c +++ b/src/osmo-bts-trx/tch_fr.c @@ -274,7 +274,7 @@ tch_fr_reorder(ubit_t *u, ubit_t *d, ubit_t *p) } int -tch_fr_decode(uint8_t *tch_data, sbit_t *bursts) +tch_fr_decode(uint8_t *tch_data, sbit_t *bursts, int network_order) { sbit_t iB[912], cB[456], h; ubit_t conv[185], b[260], d[260], p[3]; @@ -300,9 +300,12 @@ tch_fr_decode(uint8_t *tch_data, sbit_t *bursts) if (rv) return -1; - tch_fr_d_to_b(b, d); + if (network_order) { + tch_fr_d_to_b(b, d); - tch_fr_reassemble(tch_data, b); + tch_fr_reassemble(tch_data, b); + } else + tch_fr_d_to_b(tch_data, d); len = 33; } else { @@ -317,7 +320,7 @@ tch_fr_decode(uint8_t *tch_data, sbit_t *bursts) } int -tch_fr_encode(ubit_t *bursts, uint8_t *tch_data, int len) +tch_fr_encode(ubit_t *bursts, uint8_t *tch_data, int len, int network_order) { ubit_t iB[912], cB[456], h; ubit_t conv[185], b[260], d[260], p[3]; @@ -325,9 +328,12 @@ tch_fr_encode(ubit_t *bursts, uint8_t *tch_data, int len) switch (len) { case 33: /* TCH FR */ - tch_fr_disassemble(b, tch_data); + if (network_order) { + tch_fr_disassemble(b, tch_data); - tch_fr_b_to_d(d, b); + tch_fr_b_to_d(d, b); + } else + tch_fr_b_to_d(d, tch_data); osmo_crc8gen_set_bits(&tch_fr_crc3, d, 50, p); diff --git a/src/osmo-bts-trx/tch_fr.h b/src/osmo-bts-trx/tch_fr.h index 68a93185..01414572 100644 --- a/src/osmo-bts-trx/tch_fr.h +++ b/src/osmo-bts-trx/tch_fr.h @@ -1,7 +1,8 @@ #ifndef _TCH_FR_H #define _TCH_FR_H -int tch_fr_decode(uint8_t *tch_data, sbit_t *bursts); -int tch_fr_encode(ubit_t *bursts, uint8_t *tch_data, int len); +int tch_fr_decode(uint8_t *tch_data, sbit_t *bursts, int network_order); +int tch_fr_encode(ubit_t *bursts, uint8_t *tch_data, int len, + int network_order); #endif /* _TCH_FR_H */ |