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