summaryrefslogtreecommitdiffstats
path: root/openbsc/tests/gsm0408/gsm0408_test.c
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2014-01-14 10:42:58 +0100
committerJacob Erlbeck <jerlbeck@sysmocom.de>2014-01-16 12:04:30 +0100
commit45014a0cadfd1f28d68d61b5160ee18fa391c4ba (patch)
tree428329d79af34cf66fb8aae804b90d2859ad8214 /openbsc/tests/gsm0408/gsm0408_test.c
parent131406c86dc1c589af8dea91e772eac01340ac94 (diff)
si: Fix range1024 encoding
f0 is currently set to arfcns[0] in range_enc_determine_range(), while GSM 04.08 requires f0 to be ARFCN 0 in range1024 encoding. This patch modifies range_enc_determine_range() to force f0 to be 0 if this encoding is used. This way the case distinction in range_enc_filter_arfcns() is not longer necessary. Sponsored-by: On-Waves ehf
Diffstat (limited to 'openbsc/tests/gsm0408/gsm0408_test.c')
-rw-r--r--openbsc/tests/gsm0408/gsm0408_test.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/openbsc/tests/gsm0408/gsm0408_test.c b/openbsc/tests/gsm0408/gsm0408_test.c
index 3a6bbddff..894eb0fb5 100644
--- a/openbsc/tests/gsm0408/gsm0408_test.c
+++ b/openbsc/tests/gsm0408/gsm0408_test.c
@@ -152,12 +152,12 @@ static int test_single_range_encoding(int range, const int *orig_arfcns,
arfcns_used = arfcns_num;
memmove(arfcns, orig_arfcns, sizeof(arfcns));
- f0 = arfcns[0];
+ f0 = range == ARFCN_RANGE_1024 ? 0 : arfcns[0];
/*
* Manipulate the ARFCN list according to the rules in J4 depending
* on the selected range.
*/
- arfcns_used = range_enc_filter_arfcns(range, arfcns, arfcns_used,
+ arfcns_used = range_enc_filter_arfcns(arfcns, arfcns_used,
f0, &f0_included);
memset(w, 0, sizeof(w));
@@ -354,28 +354,28 @@ static void test_arfcn_filter()
/* check that the arfcn is taken out. f0_included is only set for Range1024 */
f0_included = 24;
- res = range_enc_filter_arfcns(ARFCN_RANGE_512, arfcns, ARRAY_SIZE(arfcns),
+ res = range_enc_filter_arfcns(arfcns, ARRAY_SIZE(arfcns),
arfcns[0], &f0_included);
VERIFY(res, ==, ARRAY_SIZE(arfcns) - 1);
- VERIFY(f0_included, ==, 0);
+ VERIFY(f0_included, ==, 1);
for (i = 0; i < res; ++i)
VERIFY(arfcns[i], ==, ((i+2) * 2) - (2+1));
- /* check with range1024 */
+ /* check with range1024, ARFCN 0 is included */
for (i = 0; i < ARRAY_SIZE(arfcns); ++i)
- arfcns[i] = (i + 1) * 2;
- res = range_enc_filter_arfcns(ARFCN_RANGE_1024, arfcns, ARRAY_SIZE(arfcns),
- arfcns[0], &f0_included);
+ arfcns[i] = i * 2;
+ res = range_enc_filter_arfcns(arfcns, ARRAY_SIZE(arfcns),
+ 0, &f0_included);
VERIFY(res, ==, ARRAY_SIZE(arfcns) - 1);
VERIFY(f0_included, ==, 1);
for (i = 0; i < res; ++i)
- VERIFY(arfcns[i], ==, ((i + 2) * 2) - 1);
+ VERIFY(arfcns[i], ==, (i + 1) * 2 - 1);
- /* check with range1024, not included */
+ /* check with range1024, ARFCN 0 not included */
for (i = 0; i < ARRAY_SIZE(arfcns); ++i)
arfcns[i] = (i + 1) * 2;
- res = range_enc_filter_arfcns(ARFCN_RANGE_1024, arfcns, ARRAY_SIZE(arfcns),
- 11, &f0_included);
+ res = range_enc_filter_arfcns(arfcns, ARRAY_SIZE(arfcns),
+ 0, &f0_included);
VERIFY(res, ==, ARRAY_SIZE(arfcns));
VERIFY(f0_included, ==, 0);
for (i = 0; i < res; ++i)