Neels Hofmeyr | 17518fe | 2017-06-20 04:35:06 +0200 | [diff] [blame] | 1 | /*! \file gsm0502.h */ |
| 2 | |
Sylvain Munaut | 12ba778 | 2014-06-16 10:13:40 +0200 | [diff] [blame] | 3 | #pragma once |
Harald Welte | 94df39e | 2011-06-26 14:33:57 +0200 | [diff] [blame] | 4 | |
| 5 | #include <stdint.h> |
| 6 | |
| 7 | #include <osmocom/gsm/protocol/gsm_04_08.h> |
| 8 | #include <osmocom/gsm/protocol/gsm_08_58.h> |
| 9 | |
| 10 | /* Table 5 Clause 7 TS 05.02 */ |
| 11 | static inline unsigned int |
| 12 | gsm0502_get_n_pag_blocks(struct gsm48_control_channel_descr *chan_desc) |
| 13 | { |
| 14 | if (chan_desc->ccch_conf == RSL_BCCH_CCCH_CONF_1_C) |
| 15 | return 3 - chan_desc->bs_ag_blks_res; |
| 16 | else |
| 17 | return 9 - chan_desc->bs_ag_blks_res; |
| 18 | } |
| 19 | |
| 20 | /* Chapter 6.5.2 of TS 05.02 */ |
| 21 | static inline unsigned int |
| 22 | gsm0502_get_ccch_group(uint64_t imsi, unsigned int bs_cc_chans, |
| 23 | unsigned int n_pag_blocks) |
| 24 | { |
| 25 | return (imsi % 1000) % (bs_cc_chans * n_pag_blocks) / n_pag_blocks; |
| 26 | } |
| 27 | |
| 28 | /* Chapter 6.5.2 of TS 05.02 */ |
| 29 | static inline unsigned int |
| 30 | gsm0502_get_paging_group(uint64_t imsi, unsigned int bs_cc_chans, |
| 31 | int n_pag_blocks) |
| 32 | { |
| 33 | return (imsi % 1000) % (bs_cc_chans * n_pag_blocks) % n_pag_blocks; |
| 34 | } |
| 35 | |
Harald Welte | ea19c97 | 2011-06-26 14:47:16 +0200 | [diff] [blame] | 36 | unsigned int |
| 37 | gsm0502_calc_paging_group(struct gsm48_control_channel_descr *chan_desc, uint64_t imsi); |