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