diff options
author | Harald Welte <laforge@gnumonks.org> | 2011-03-05 17:30:07 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2011-03-05 17:30:07 +0100 |
commit | 5748c20be180b505385fe27b557f2bfa8bcd320c (patch) | |
tree | 0487a908a81ad24e4e37b39fe488d5e20e7ddc89 /openbsc | |
parent | d4571f41a34a606e15e593bd0ad0dbe294503a4a (diff) |
OM2000: fix generation of frequency list DIE
Diffstat (limited to 'openbsc')
-rw-r--r-- | openbsc/src/libbsc/abis_om2000.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/openbsc/src/libbsc/abis_om2000.c b/openbsc/src/libbsc/abis_om2000.c index c470f6b44..bd89dc2ce 100644 --- a/openbsc/src/libbsc/abis_om2000.c +++ b/openbsc/src/libbsc/abis_om2000.c @@ -814,6 +814,15 @@ static uint8_t pchan2comb(enum gsm_phys_chan_config pchan) } } +static int put_freq_list(uint8_t *buf, uint16_t arfcn) +{ + buf[0] = 0x00; /* TX/RX address */ + buf[1] = (arfcn >> 8); + buf[2] = (arfcn & 0xff); + + return 3; +} + /* Compute a frequency list in OM2000 fomrmat */ static int om2k_gen_freq_list(uint8_t *list, struct gsm_bts_trx_ts *ts) { @@ -822,17 +831,12 @@ static int om2k_gen_freq_list(uint8_t *list, struct gsm_bts_trx_ts *ts) if (ts->hopping.enabled) { unsigned int i; for (i = 0; i < ts->hopping.arfcns.data_len*8; i++) { - if (bitvec_get_bit_pos(&ts->hopping.arfcns, i)) { - *cur++ = 0x00; - *cur++ = i >> 8; - *cur++ = i & 0xff; - } + if (bitvec_get_bit_pos(&ts->hopping.arfcns, i)) + cur += put_freq_list(cur, i); } - } else { - *cur++ = 0x00; /* TX/RX address */ - *cur++ = ts->trx->arfcn >> 8; - *cur++ = ts->trx->arfcn && 0xff; - } + } else + cur += put_freq_list(cur, ts->trx->arfcn); + return (cur - list); } @@ -846,6 +850,7 @@ int abis_om2k_tx_ts_conf_req(struct gsm_bts_trx_ts *ts) om2k_ts_to_mo(&mo, ts); + memset(freq_list, 0, sizeof(freq_list)); freq_list_len = om2k_gen_freq_list(freq_list, ts); if (freq_list_len < 0) return freq_list_len; |