blob: 53259a42dd89bca88427d69ee4257142700c3bb2 [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 *
Harald Weltee08da972017-11-13 01:00:26 +09007 * SPDX-License-Identifier: GPL-2.0+
8 *
Harald Welteea19c972011-06-26 14:47:16 +02009 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 *
22 */
23
24#include <stdint.h>
25
26#include <osmocom/gsm/protocol/gsm_04_08.h>
27#include <osmocom/gsm/gsm0502.h>
28#include <osmocom/gsm/gsm48.h>
29#include <osmocom/gsm/rsl.h>
30
31unsigned int
32gsm0502_calc_paging_group(struct gsm48_control_channel_descr *chan_desc, uint64_t imsi)
33{
34 int ccch_conf;
35 int bs_cc_chans;
36 int blocks;
37 unsigned int group;
38
39 ccch_conf = chan_desc->ccch_conf;
40 bs_cc_chans = rsl_ccch_conf_to_bs_cc_chans(ccch_conf);
41 /* code word + 2, as 2 channels equals 0x0 */
42 blocks = gsm48_number_of_paging_subchannels(chan_desc);
43 group = gsm0502_get_paging_group(imsi, bs_cc_chans, blocks);
44
45 return group;
46}