1 #ifndef OSMOCOM_GSM_0502_H
2 #define OSMOCOM_GSM_0502_H
6 #include <osmocom/gsm/protocol/gsm_04_08.h>
7 #include <osmocom/gsm/protocol/gsm_08_58.h>
9 /* Table 5 Clause 7 TS 05.02 */
10 static inline unsigned int
11 gsm0502_get_n_pag_blocks(struct gsm48_control_channel_descr *chan_desc)
13 if (chan_desc->ccch_conf == RSL_BCCH_CCCH_CONF_1_C)
14 return 3 - chan_desc->bs_ag_blks_res;
16 return 9 - chan_desc->bs_ag_blks_res;
19 /* Chapter 6.5.2 of TS 05.02 */
20 static inline unsigned int
21 gsm0502_get_ccch_group(uint64_t imsi, unsigned int bs_cc_chans,
22 unsigned int n_pag_blocks)
24 return (imsi % 1000) % (bs_cc_chans * n_pag_blocks) / n_pag_blocks;
27 /* Chapter 6.5.2 of TS 05.02 */
28 static inline unsigned int
29 gsm0502_get_paging_group(uint64_t imsi, unsigned int bs_cc_chans,
32 return (imsi % 1000) % (bs_cc_chans * n_pag_blocks) % n_pag_blocks;
36 gsm0502_calc_paging_group(struct gsm48_control_channel_descr *chan_desc, uint64_t imsi);