move gsm 05.02 related calculations into libosmocore

This commit is contained in:
Harald Welte 2011-06-26 14:41:58 +02:00
parent 457a081379
commit bc82f92a8d
3 changed files with 3 additions and 28 deletions

View File

@ -66,9 +66,6 @@ int rsl_ipacc_pdch_activate(struct gsm_bts_trx_ts *ts, int act);
int abis_rsl_rcvmsg(struct msgb *msg);
unsigned int get_paging_group(uint64_t imsi, unsigned int bs_cc_chans,
int n_pag_blocks);
unsigned int n_pag_blocks(int bs_ccch_sdcch_comb, unsigned int bs_ag_blks_res);
uint64_t str_to_imsi(const char *imsi_str);
int rsl_release_request(struct gsm_lchan *lchan, uint8_t link_id, uint8_t reason);

View File

@ -144,29 +144,6 @@ uint64_t str_to_imsi(const char *imsi_str)
return ret;
}
/* Table 5 Clause 7 TS 05.02 */
unsigned int n_pag_blocks(int bs_ccch_sdcch_comb, unsigned int bs_ag_blks_res)
{
if (!bs_ccch_sdcch_comb)
return 9 - bs_ag_blks_res;
else
return 3 - bs_ag_blks_res;
}
/* Chapter 6.5.2 of TS 05.02 */
unsigned int get_ccch_group(uint64_t imsi, unsigned int bs_cc_chans,
unsigned int n_pag_blocks)
{
return (imsi % 1000) % (bs_cc_chans * n_pag_blocks) / n_pag_blocks;
}
/* Chapter 6.5.2 of TS 05.02 */
unsigned int get_paging_group(uint64_t imsi, unsigned int bs_cc_chans,
int n_pag_blocks)
{
return (imsi % 1000) % (bs_cc_chans * n_pag_blocks) % n_pag_blocks;
}
static struct msgb *rsl_msgb_alloc(void)
{
return msgb_alloc_headroom(RSL_ALLOC_SIZE, RSL_ALLOC_HEADROOM,

View File

@ -40,6 +40,7 @@
#include <osmocom/core/talloc.h>
#include <osmocom/gsm/gsm48.h>
#include <osmocom/gsm/gsm0502.h>
#include <openbsc/paging.h>
#include <openbsc/debug.h>
@ -64,8 +65,8 @@ static unsigned int calculate_group(struct gsm_bts *bts, struct gsm_subscriber *
bs_cc_chans = rsl_ccch_conf_to_bs_cc_chans(ccch_conf);
/* code word + 2, as 2 channels equals 0x0 */
blocks = gsm48_number_of_paging_subchannels(&bts->si_common.chan_desc);
group = get_paging_group(str_to_imsi(subscr->imsi),
bs_cc_chans, blocks);
group = gsm0502_get_paging_group(str_to_imsi(subscr->imsi),
bs_cc_chans, blocks);
return group;
}