libosmogsm  0.11.0-dirty
Osmocom GSM library
include/osmocom/gsm/gsm0502.h
Go to the documentation of this file.
00001 
00003 #pragma once
00004 
00005 #include <stdint.h>
00006 
00007 #include <osmocom/gsm/protocol/gsm_04_08.h>
00008 #include <osmocom/gsm/protocol/gsm_08_58.h>
00009 
00010 /* Table 5 Clause 7 TS 05.02 */
00011 static inline unsigned int
00012 gsm0502_get_n_pag_blocks(struct gsm48_control_channel_descr *chan_desc)
00013 {
00014         if (chan_desc->ccch_conf == RSL_BCCH_CCCH_CONF_1_C)
00015                 return 3 - chan_desc->bs_ag_blks_res;
00016         else
00017                 return 9 - chan_desc->bs_ag_blks_res;
00018 }
00019 
00020 /* Chapter 6.5.2 of TS 05.02 */
00021 static inline unsigned int
00022 gsm0502_get_ccch_group(uint64_t imsi, unsigned int bs_cc_chans,
00023                         unsigned int n_pag_blocks)
00024 {
00025         return (imsi % 1000) % (bs_cc_chans * n_pag_blocks) / n_pag_blocks;
00026 }
00027 
00028 /* Chapter 6.5.2 of TS 05.02 */
00029 static inline unsigned int
00030 gsm0502_get_paging_group(uint64_t imsi, unsigned int bs_cc_chans,
00031                          int n_pag_blocks)
00032 {
00033         return (imsi % 1000) % (bs_cc_chans * n_pag_blocks) % n_pag_blocks;
00034 }
00035 
00036 unsigned int
00037 gsm0502_calc_paging_group(struct gsm48_control_channel_descr *chan_desc, uint64_t imsi);
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines