aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/system_information.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2009-12-14 20:25:05 +0100
committerHarald Welte <laforge@gnumonks.org>2009-12-14 20:25:05 +0100
commitda760d3d19bc6da3ef676a2fbaa65fb841cd5af5 (patch)
tree1aa249b354c19a9e3b0946d280a1a958bcf209e0 /openbsc/src/system_information.c
parent1e191c59f6130c04b4e02a27dbd91900078e1c14 (diff)
[system_information] fix bit map 0 frequency list generation
Our frequency lists for GSM900 were completely wrong, as the bit map 0 encoding was not used correctly. This patch should fix it.
Diffstat (limited to 'openbsc/src/system_information.c')
-rw-r--r--openbsc/src/system_information.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/openbsc/src/system_information.c b/openbsc/src/system_information.c
index 30d15ac65..60a8219b2 100644
--- a/openbsc/src/system_information.c
+++ b/openbsc/src/system_information.c
@@ -35,21 +35,28 @@
#define GSM_MACBLOCK_LEN 23
#define GSM_MACBLOCK_PADDING 0x2b
+/* Frequency Lists as per TS 04.08 10.5.2.13 */
+
+/* 10.5.2.13.2: Bit map 0 format */
static int cchan_list_bm0_set_arfcn(u_int8_t *chan_list, unsigned int arfcn)
{
unsigned int byte, bit;
- if (arfcn > 124)
+ if (arfcn > 124 || arfcn < 1)
return -EINVAL;
+ /* the bitmask is from 1..124, not from 0..123 */
+ arfcn--;
+
byte = arfcn / 8;
bit = arfcn % 8;
- chan_list[GSM48_CELL_CHAN_DESC_SIZE-byte] |= (1 << bit);
+ chan_list[GSM48_CELL_CHAN_DESC_SIZE-1-byte] |= (1 << bit);
return 0;
}
+/* 10.5.2.13.7: Variable bit map format */
static int cchan_list_bmrel_set_arfcn(u_int8_t *chan_list, unsigned int arfcn)
{
unsigned int byte, bit;