Neels Hofmeyr | 17518fe | 2017-06-20 04:35:06 +0200 | [diff] [blame] | 1 | /*! \file gsm0502.c |
| 2 | * Paging helper code */ |
| 3 | /* |
| 4 | * (C) 2009 by Holger Hans Peter Freyther <zecke@selfish.org> |
Harald Welte | ea19c97 | 2011-06-26 14:47:16 +0200 | [diff] [blame] | 5 | * All Rights Reserved |
| 6 | * |
Harald Welte | e08da97 | 2017-11-13 01:00:26 +0900 | [diff] [blame] | 7 | * SPDX-License-Identifier: GPL-2.0+ |
| 8 | * |
Harald Welte | ea19c97 | 2011-06-26 14:47:16 +0200 | [diff] [blame] | 9 | * 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 | |
| 31 | unsigned int |
| 32 | gsm0502_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 | } |