blob: 6b69893895ad99559322df0ec5bd1de298c44469 [file] [log] [blame]
Neels Hofmeyr17518fe2017-06-20 04:35:06 +02001/*! \file gsm0502.c
2 * Paging helper code */
3/*
4 * (C) 2009 by Holger Hans Peter Freyther <zecke@selfish.org>
Harald Welteea19c972011-06-26 14:47:16 +02005 * All Rights Reserved
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#include <stdint.h>
23
24#include <osmocom/gsm/protocol/gsm_04_08.h>
25#include <osmocom/gsm/gsm0502.h>
26#include <osmocom/gsm/gsm48.h>
27#include <osmocom/gsm/rsl.h>
28
29unsigned int
30gsm0502_calc_paging_group(struct gsm48_control_channel_descr *chan_desc, uint64_t imsi)
31{
32 int ccch_conf;
33 int bs_cc_chans;
34 int blocks;
35 unsigned int group;
36
37 ccch_conf = chan_desc->ccch_conf;
38 bs_cc_chans = rsl_ccch_conf_to_bs_cc_chans(ccch_conf);
39 /* code word + 2, as 2 channels equals 0x0 */
40 blocks = gsm48_number_of_paging_subchannels(chan_desc);
41 group = gsm0502_get_paging_group(imsi, bs_cc_chans, blocks);
42
43 return group;
44}