aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2019-02-19 18:10:12 +0100
committerMax <msuraev@sysmocom.de>2019-02-19 18:58:04 +0100
commitbd5647ee92bac90f01000ecdc68e7a2de5ce1f64 (patch)
treeb8a0262b73617f180b828a24461e95127a5436cc
parent23c0e018e4cb957f8501b5430f920b0e6f4b9d35 (diff)
Rewrite EGPRS Packet Uplink IA Rest Octets for MBA
Use bitvec_set_*() directly without external write pointer tracking to simplify the code. This is part of IA Rest Octets (3GPP TS 44.018 ยง10.5.2.16) which is the last part of the message so it should not interfere with the rest of encoding functions. That's partially based on reverted commit 529ce885450946d85d1920fb3d1a994c3efe5849. Change-Id: I19cc4226e7e831e7d7f70212b2078f5589a87ff0 Related: OS#3014
-rw-r--r--src/encoding.cpp26
1 files changed, 11 insertions, 15 deletions
diff --git a/src/encoding.cpp b/src/encoding.cpp
index e7e13ac1..ba0e4744 100644
--- a/src/encoding.cpp
+++ b/src/encoding.cpp
@@ -258,26 +258,21 @@ static int write_ia_rest_uplink_mba(const gprs_rlcmac_ul_tbf *tbf, bitvec *dest,
return rc;
}
-static int write_ia_rest_egprs_uplink_mba(bitvec * dest, uint32_t fn, uint8_t alpha, uint8_t gamma, unsigned& wp)
+static int write_ia_rest_egprs_uplink_mba(bitvec * dest, uint32_t fn, uint8_t alpha, uint8_t gamma)
{
int rc = 0;
- bitvec_write_field(dest, &wp, 0, 1); /* multiblock allocation */
+ SET_0(dest); /* Multi Block Allocation */
- if (alpha) {
- bitvec_write_field(dest, &wp, 0x1, 1); /* ALPHA =yes */
- bitvec_write_field(dest, &wp, alpha, 4); /* ALPHA */
- } else {
- bitvec_write_field(dest, &wp, 0x0, 1); /* ALPHA = no */
- }
+ rc = write_alpha_gamma(dest, alpha, gamma);
+ CHECK(rc);
- bitvec_write_field(dest, &wp, gamma, 5); /* GAMMA power contrl */
- bitvec_write_field(dest, &wp, (fn / (26 * 51)) % 32, 5);/* T1' */
- bitvec_write_field(dest, &wp, fn % 51, 6); /* T3 */
- bitvec_write_field(dest, &wp, fn % 26, 5); /* T2 */
- bitvec_write_field(dest, &wp, 0, 2); /* Radio block allocation */
+ rc = write_tbf_start_time(dest, fn);
+ CHECK(rc);
- bitvec_write_field(dest, &wp, 0, 1);
+ SET_0(dest); /* NUMBER OF RADIO BLOCKS ALLOCATED: */
+ SET_0(dest); /* 1 radio block reserved for uplink transmission */
+ SET_0(dest); /* No P0 */
return rc;
}
@@ -483,7 +478,8 @@ int Encoding::write_immediate_assignment(
if (as_ul_tbf(tbf) != NULL) {
rc = write_ia_rest_egprs_uplink_sba(as_ul_tbf(tbf), dest, usf, alpha, gamma, wp);
} else {
- rc = write_ia_rest_egprs_uplink_mba(dest, fn, alpha, gamma, wp);
+ dest->cur_bit = wp;
+ rc = write_ia_rest_egprs_uplink_mba(dest, fn, alpha, gamma);
}
} else {
OSMO_ASSERT(!tbf || !tbf->is_egprs_enabled());