summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-12-12 17:00:57 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-12-12 17:16:17 +0100
commit59976b86753290997053e1634a4f7d9ce204a51f (patch)
tree0c5093e13c806974d99bf612ba53fd637343a4f4
parentcb00b465dab5f10d2b082ab4a01cd3aedd509f1f (diff)
si: Make sure to not overwrite orig_arfcn_hi in the range encodingon-waves/bsc-0.9.14
Andreas highlighted that the doubel assignment is not needed and wrong. Change the code to assign chan_list[0] before writing the base frequency to the header. Update the testcase to make the highest bit set and update the test result.
-rw-r--r--openbsc/src/libbsc/arfcn_range_encode.c2
-rw-r--r--openbsc/tests/si/si_test.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/openbsc/src/libbsc/arfcn_range_encode.c b/openbsc/src/libbsc/arfcn_range_encode.c
index 02a75a5..c52743e 100644
--- a/openbsc/src/libbsc/arfcn_range_encode.c
+++ b/openbsc/src/libbsc/arfcn_range_encode.c
@@ -210,10 +210,10 @@ int range_enc_range256(uint8_t *chan_list, int f0, int *w)
int range_enc_range512(uint8_t *chan_list, int f0, int *w)
{
struct gsm48_range_512 *range512;
+ chan_list[0] = 0x88;
write_orig_arfcn(chan_list, f0);
range512 = (struct gsm48_range_512 *) &chan_list[0];
- range512->form_id = chan_list[0] = 0x44;
/* W(1) */
range512->w1_hi = HIGH_BITS(w, 1, 9, 7);
diff --git a/openbsc/tests/si/si_test.c b/openbsc/tests/si/si_test.c
index 16f6ea3..fd840f3 100644
--- a/openbsc/tests/si/si_test.c
+++ b/openbsc/tests/si/si_test.c
@@ -103,7 +103,7 @@ static void test_print_encoding()
break;
}
- rc = range_enc_range512(chan_list, 0x96, w);
+ rc = range_enc_range512(chan_list, (1 << 9) | 0x96, w);
VERIFY(rc, ==, 0);
printf("Range512: %s\n", osmo_hexdump(chan_list, ARRAY_SIZE(chan_list)));