annotate src/g23m-gsm/alr2/alr_pch.c @ 246:d25af5b7e773

etm_tmcore.c: rm trailing white space
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 09 May 2021 20:38:06 +0000
parents 3a14ee9a9843
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 +-----------------------------------------------------------------------------
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 | Project : GSM-PS
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 | Modul : ALR_PCH
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 +-----------------------------------------------------------------------------
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 | Copyright 2002 Texas Instruments Berlin, AG
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 | All rights reserved.
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 |
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 | This file is confidential and a trade secret of Texas
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 | Instruments Berlin, AG
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 | The receipt of or possession of this file does not convey
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 | any rights to reproduce or disclose its contents or to
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 | manufacture, use, or sell anything it may describe, in
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 | whole, or in part, without the specific written consent of
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 | Texas Instruments Berlin, AG.
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 +-----------------------------------------------------------------------------
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 | Purpose : This Modul defines the SDL process PCH_Control.
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 +-----------------------------------------------------------------------------
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 #ifndef ALR_PCH_C
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 #define ALR_PCH_C
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 #define ENTITY_PL
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 /*==== INCLUDES ===================================================*/
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 #include <string.h>
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 #include <stdlib.h>
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 #include <ctype.h>
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 #include "typedefs.h"
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 #include "pconst.cdg"
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 #include "mconst.cdg"
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 #include "message.h"
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 #include "ccdapi.h"
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 #include "vsi.h"
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 #include "custom.h"
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 #include "gsm.h"
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 #include "prim.h"
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 #include "cnf_alr.h"
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 #include "mon_alr.h"
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 #include "pei.h"
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 #include "tok.h"
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 #include "pcm.h"
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 #ifdef GPRS
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 #include "alr_gprs.h"
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 #endif
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 #include "alr.h"
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 #include "alr_em.h"
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 /*==== EXPORT =====================================================*/
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 /*==== PRIVAT =====================================================*/
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 /*==== VARIABLES ==================================================*/
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 UBYTE page_mode_before_hplmn_search = PGM_NORMAL;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 /*==== CONSTANTS ==================================================*/
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 #define IMSI_ODD_FLAG 8
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 #define IMSI_EVEN_FLAG 0
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59 #define IDENT_TYPE_MON 0
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 #define IDENT_TYPE_IMSI 1
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 #define IDENT_TYPE_IMEI 2
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 #define IDENT_TYPE_IMEISV 3
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 #define IDENT_TYPE_TMSI 4
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64 #define END_MARK 0xF0
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66 /*==== FUNCTIONS ==================================================*/
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68 #define TRACING
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70 #if defined (TRACING)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71 #define ALR_TRACE_PCH(a) ALR_TRACE(a)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72 #else
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73 #define ALR_TRACE_PCH(a)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74 #endif
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
75
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
76 #ifdef TRACING
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
77 #define ALR_TRACE_PCH_CONFIG(b,a,c,t,p,m) \
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
78 TRACE_EVENT_P6 ("MFRMS: %d AG_RES: %d COMB: %d GRP: %d PGRP: %d PI: %d",b,a,c,t,p,m)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
79 #define ALR_TRACE_PCH_PGM(p,x) \
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
80 TRACE_EVENT_P2 ("new_pgm: %d cur_pgm: %d",p,x)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
81 #define ALR_TRACE_PCH_IMSI() \
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
82 { for (i=0; i<alr_data->pch_data.imsi[0]+1;i++) { \
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
83 TRACE_EVENT_P2 ("imsi[%d]=%x",i,alr_data->pch_data.imsi[i]);} }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
84 #else
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
85 #define ALR_TRACE_PCH_CONFIG(b,a,c,t,p,m)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
86 #define ALR_TRACE_PCH_PGM(p,x)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
87 #define ALR_TRACE_PCH_IMSI()
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
88 #endif
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
89
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
90 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
91 +--------------------------------------------------------------------+
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
92 | PROJECT : GSM-PS (6103) MODULE : ALR_PCH |
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
93 | STATE : code ROUTINE : pch_init |
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
94 +--------------------------------------------------------------------+
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
95
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
96 PURPOSE : Initialize PCH Control Process.
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
97
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
98 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
99 GLOBAL void pch_init (void)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
100 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
101 alr_data->pch_data.saved_page_mode = PGM_REORG;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
102 alr_data->pch_data.reorg_bcch_reading = FALSE;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
103 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
104
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
105 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
106 +--------------------------------------------------------------------+
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
107 | PROJECT : GSM-PS (6103) MODULE : ALR_PCH |
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
108 | STATE : code ROUTINE : pch_start |
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
109 +--------------------------------------------------------------------+
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
110
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
111 PURPOSE : Process signal pch_start from SDL process
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
112 Main_Control.
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
113
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
114 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
115 static const UBYTE PAG_BLOCK_TABLE [2][8] =
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
116 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
117 /* not combined ccch */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
118 9,8,7,6,5,4,3,2,
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
119 /* combined ccch */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
120 3,2,1,1,1,1,1,1
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
121 };
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
122
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
123 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
124 +--------------------------------------------------------------------+
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
125 | PROJECT : GSM-PS (6103) MODULE : ALR_PCH |
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
126 | STATE : code ROUTINE : pch_configure |
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
127 +--------------------------------------------------------------------+
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
128
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
129 PURPOSE : Configutes L1 for paging.
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
130
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
131 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
132 GLOBAL void pch_configure (T_MPH_IDLE_REQ *idle, UBYTE page_mode)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
133 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
134 UBYTE pag_blocks_per_mfr;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
135
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
136 if(idle NEQ NULL)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
137 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
138
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
139 alr_data->pch_data.dlt = idle->dlt;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
140 alr_data->pch_data.act_dlt = idle->dlt;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
141
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
142 ALR_EM_SET_EM_ACT_DLT;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
143
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
144 pag_blocks_per_mfr = PAG_BLOCK_TABLE [idle->comb_ccch][idle->bs_ag_blocks_res];
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
145 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
146 * pl_idle.bs_pa_mfrms has a range from 2-9.
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
147 * MPH_IDLE_REQ codes them from 0-7
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
148 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
149 alr_data->pch_data.pl_idle.bs_pa_mfrms = (UBYTE)(idle->bs_pa_mfrms + 2);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
150 alr_data->pch_data.pl_idle.bs_ag_blks_res = idle->bs_ag_blocks_res;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
151 alr_data->pch_data.pl_idle.bcch_combined = idle->comb_ccch;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
152 alr_data->pch_data.pl_idle.ccch_group = (UBYTE)(idle->tn / 2);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
153 alr_data->pch_data.pl_idle.page_group = idle->pg;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
154 alr_data->pch_data.pl_idle.page_block_index = (UBYTE)(idle->pg % pag_blocks_per_mfr);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
155
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
156 ALR_TRACE_PCH_CONFIG(idle->bs_pa_mfrms+2, idle->bs_ag_blocks_res,
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
157 idle->comb_ccch, idle->tn/2, idle->pg,
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
158 idle->pg % pag_blocks_per_mfr);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
159 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
160
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
161 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
162 * During cell reselection reading of PCH is started hard coded with
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
163 * page mode PGM_REORG because of the lack of parameters to calculate
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
164 * the right paging group. Detection of SI3 during cell reselection
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
165 * triggers the function pch_config_resel() to reconfigure PCH reading,
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
166 * detection of a changed page mode during cell reselection is handled
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
167 * by function pch_check_page_mode_cr() which needs to know whether SI3
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
168 * is read
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
169 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
170 if (GET_STATE (STATE_MA) EQ MA_CELL_RESELECTION)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
171 alr_data->pch_data.si3_read = FALSE;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
172
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
173
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
174 /* Ensure that L1 does not get initialised with PAGING EXTENDED */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
175 switch( page_mode )
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
176 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
177 case SAVED_PGM:
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
178 if( alr_data->pch_data.saved_page_mode EQ PGM_EXTENDED )
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
179 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
180 alr_data->pch_data.saved_page_mode = PGM_REORG;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
181 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
182 page_mode = alr_data->pch_data.saved_page_mode;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
183 /*lint -fallthrough*/
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
184 default:
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
185 alr_data->pch_data.pl_idle.page_mode = page_mode;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
186 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
187 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
188
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
189 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
190 +--------------------------------------------------------------------+
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
191 | PROJECT : GSM-PS (6103) MODULE : ALR_PCH |
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
192 | STATE : code ROUTINE : pch_save_pgm |
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
193 +--------------------------------------------------------------------+
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
194 PURPOSE : Configure Paging
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
195 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
196 GLOBAL void pch_save_pgm(UBYTE mode)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
197 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
198 if(mode)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
199 alr_data->pch_data.saved_page_mode = mode;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
200 else
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
201 alr_data->pch_data.saved_page_mode = alr_data->pch_data.pl_idle.page_mode;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
202 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
203
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
204
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
205 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
206 +--------------------------------------------------------------------+
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
207 | PROJECT : GSM-PS (6103) MODULE : ALR_PCH |
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
208 | STATE : code ROUTINE : pch_start_ccch_req |
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
209 +--------------------------------------------------------------------+
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
210
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
211 PURPOSE : Configure Paging
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
212
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
213 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
214
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
215 GLOBAL void pch_start_ccch_req (void)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
216 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
217 PALLOC(pl_idle, MPHC_START_CCCH_REQ);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
218 memset(pl_idle, 0, sizeof(T_MPHC_START_CCCH_REQ));
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
219
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
220 ALR_EM_PAGE_MODE_CHANGE;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
221
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
222 switch (alr_data->pch_data.pl_idle.page_mode)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
223 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
224 case PGM_REORG:
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
225 ALR_TRACE_PCH ("config REORG");
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
226 /* dummy values */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
227 pl_idle->bs_pa_mfrms = 2;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
228 pl_idle->bs_ag_blks_res = 7;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
229 pl_idle->bcch_combined = 0;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
230 pl_idle->ccch_group = 0;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
231 pl_idle->page_group = 0;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
232 pl_idle->page_block_index = 0;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
233 pl_idle->page_mode = PGM_REORG;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
234 break;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
235 case PGM_REORG_CS:
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
236 ALR_TRACE_PCH ("config REORG_CS");
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
237
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
238 memcpy (pl_idle, &alr_data->pch_data.pl_idle,
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
239 sizeof (T_MPHC_START_CCCH_REQ));
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
240 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
241 * if the page_mode is PGM_REORG_CS then
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
242 * we have to change this to PGM_REORG
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
243 * before we send it to L1
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
244 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
245 pl_idle->page_mode = PGM_REORG;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
246 break;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
247 case PGM_EXTENDED:
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
248 ALR_TRACE_PCH ("config EXT");
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
249
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
250 memcpy (pl_idle, &alr_data->pch_data.pl_idle,
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
251 sizeof (T_MPHC_START_CCCH_REQ));
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
252 pl_idle->page_mode = PGM_EXTENDED;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
253 break;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
254 case PGM_REORG_NC_SYNC:
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
255 /*this case is the same as the default - except for the TRACE*/
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
256 ALR_TRACE_PCH ("config PGM_REORG_NC_SYNC (NORMAL)");
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
257
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
258 memcpy (pl_idle, &alr_data->pch_data.pl_idle,
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
259 sizeof (T_MPHC_START_CCCH_REQ));
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
260 pl_idle->page_mode = PGM_NORMAL;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
261 break;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
262 default:
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
263 ALR_TRACE_PCH ("config NORMAL");
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
264
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
265 memcpy (pl_idle, &alr_data->pch_data.pl_idle,
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
266 sizeof (T_MPHC_START_CCCH_REQ));
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
267 pl_idle->page_mode = PGM_NORMAL;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
268 break;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
269 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
270
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
271 SET_STATE(STATE_PCH,PCH_ACTIVE);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
272 ma_pch_start_ccch_req(pl_idle);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
273
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
274 TRACE_EVENT_P1("reorg_bcch_reading = %d",alr_data->pch_data.reorg_bcch_reading);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
275 if(alr_data->pch_data.pl_idle.page_mode EQ PGM_REORG OR
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
276 alr_data->pch_data.pl_idle.page_mode EQ PGM_REORG_CS OR
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
277 alr_data->pch_data.reorg_bcch_reading EQ TRUE)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
278 { /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
279 * if we're going into reorg paging we also need to read the BCCH
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
280 * to read possibly changed channel configuration
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
281 * XXX but not at PGM_REORG_NC_SYNC (NORMAL)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
282 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
283 ma_scell_full_nbcch();
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
284 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
285 else
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
286 { /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
287 * otherwise we stop the reading of the BCCH and start the periodic read.
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
288 * XXX but not if we have a PBCCH
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
289 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
290 #ifdef GPRS
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
291 if(alr_data->gprs_data.pbcch EQ FALSE)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
292 #endif
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
293 sc_start_periodic();
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
294 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
295 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
296
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
297
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
298
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
299
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
300 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
301 +--------------------------------------------------------------------+
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
302 | PROJECT : GSM-PS (6103) MODULE : ALR_PCH |
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
303 | STATE : code ROUTINE : pch_identity_req |
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
304 +--------------------------------------------------------------------+
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
305
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
306 PURPOSE : Get new mobile identity information from RR. Build IMSI
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
307 pattern and store TMSI.
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
308
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
309 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
310 GLOBAL void pch_identity_req (T_MPH_IDENTITY_REQ *mph_identity_req)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
311 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
312 UBYTE i;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
313
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
314 /* the IMSI in the identity request is coded as a 15byte long array
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
315 and is stored for later usage in pch_data as the message representation
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
316 of the IMSI according to GSM4.08 10.5.1.4 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
317
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
318 if (mph_identity_req->mid.len_imsi EQ 0)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
319 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
320 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
321 * limited service, no paging
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
322 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
323 memset (alr_data->pch_data.imsi, 0, IMSI_LEN);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
324 alr_data->pch_data.v_tmsi = FALSE;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
325 alr_data->pch_data.tmsi = 0L;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
326 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
327 else
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
328 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
329 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
330 * The IMSI is available
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
331 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
332 /* store length */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
333 alr_data->pch_data.imsi[0] = (UBYTE)((mph_identity_req->mid.len_imsi + 2) / 2);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
334
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
335 if (mph_identity_req->mid.len_imsi & 1)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
336 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
337 ALR_TRACE_PCH ("IMSI is odd");
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
338 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
339 * odd number of digits
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
340 * first digit + odd flag + identity type IMSI
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
341 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
342 alr_data->pch_data.imsi[1] = (UBYTE)((mph_identity_req->mid.imsi[0] << 4) +
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
343 IMSI_ODD_FLAG +
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
344 IDENT_TYPE_IMSI);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
345 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
346 else
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
347 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
348 ALR_TRACE_PCH ("IMSI is even");
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
349 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
350 * even number of digits
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
351 * first digit + even flag + identity type IMSI
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
352 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
353 alr_data->pch_data.imsi[1] = (UBYTE)((mph_identity_req->mid.imsi[0] << 4) +
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
354 IMSI_EVEN_FLAG +
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
355 IDENT_TYPE_IMSI);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
356 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
357 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
358 * fill in the rest of digits
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
359 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
360 for (i=1;i<mph_identity_req->mid.len_imsi;i++)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
361 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
362 if (i & 1)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
363 alr_data->pch_data.imsi[(i/2)+2] = (UBYTE)(END_MARK + mph_identity_req->mid.imsi[i]);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
364 else
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
365 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
366 alr_data->pch_data.imsi[(i/2)+1] &= ~END_MARK; /* remove end mark */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
367 alr_data->pch_data.imsi[(i/2)+1] = (UBYTE)(alr_data->pch_data.imsi[(i/2)+1] +
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
368 (mph_identity_req->mid.imsi[i] << 4));
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
369 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
370 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
371 alr_data->pch_data.imsi_mod_1000 = (SHORT)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
372 ( (mph_identity_req->mid.imsi[mph_identity_req->mid.len_imsi-1] +
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
373 mph_identity_req->mid.imsi[mph_identity_req->mid.len_imsi-2] * 10 +
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
374 mph_identity_req->mid.imsi[mph_identity_req->mid.len_imsi-3] * 100 ) % 1000);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
375
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
376 ALR_TRACE_PCH_IMSI();
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
377
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
378 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
379 * copy TMSI
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
380 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
381 alr_data->pch_data.v_tmsi = mph_identity_req->mid.v_tmsi;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
382 alr_data->pch_data.tmsi = mph_identity_req->mid.tmsi;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
383 #ifdef GPRS
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
384 gprs_alr_store_ptmsi(mph_identity_req->mid.v_ptmsi,
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
385 mph_identity_req->mid.ptmsi);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
386 gprs_alr_store_ptmsi2(mph_identity_req->mid.v_ptmsi2,
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
387 mph_identity_req->mid.ptmsi2);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
388 #endif
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
389 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
390 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
391
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
392 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
393 +--------------------------------------------------------------------+
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
394 | PROJECT : GSM-PS (6103) MODULE : ALR_PCH |
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
395 | STATE : code ROUTINE : pch_increment_dlt |
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
396 +--------------------------------------------------------------------+
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
397
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
398 PURPOSE : Incrementation of downlink timeout counter after receiving
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
399 a valid PCH block.
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
400
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
401 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
402 GLOBAL void pch_increment_dlt (void)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
403 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
404 if (alr_data->pch_data.act_dlt <
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
405 alr_data->pch_data.dlt)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
406 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
407 #if !defined NTRACE
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
408 trc_mon_counter_idle (alr_data->pch_data.act_dlt,
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
409 alr_data->pch_data.dlt);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
410 #endif /* (!defined NTRACE) */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
411 alr_data->pch_data.act_dlt++;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
412
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
413 ALR_EM_SET_EM_ACT_DLT;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
414
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
415 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
416 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
417
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
418 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
419 +--------------------------------------------------------------------+
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
420 | PROJECT : GSM-PS (6103) MODULE : ALR_PCH |
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
421 | STATE : code ROUTINE : pch_decrement_dlt |
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
422 +--------------------------------------------------------------------+
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
423
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
424 PURPOSE : Decrementation of downlink timeout counter after receiving
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
425 an invalid PCH block.
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
426
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
427 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
428 GLOBAL void pch_decrement_dlt (void)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
429 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
430 if (alr_data->pch_data.act_dlt > 4)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
431 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
432 #if !defined NTRACE
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
433 trc_mon_counter_idle (alr_data->pch_data.act_dlt,
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
434 alr_data->pch_data.dlt);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
435 #endif /* (!defined NTRACE) */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
436
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
437 alr_data->pch_data.act_dlt -= 4;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
438
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
439 ALR_EM_SET_EM_ACT_DLT;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
440
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
441 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
442 else
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
443 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
444 alr_data->pch_data.act_dlt = alr_data->pch_data.dlt;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
445 #if !defined NTRACE
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
446 trc_mon_counter_idle (alr_data->pch_data.act_dlt,
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
447 alr_data->pch_data.dlt);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
448 #endif
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
449
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
450 ALR_EM_SET_EM_ACT_DLT;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
451
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
452 ALR_TRACE_PCH ("downlink fail");
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
453
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
454 ma_error_ind (CS_DOWN_LINK_FAIL, alr_data->serving_cell);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
455 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
456 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
457
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
458
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
459 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
460 +--------------------------------------------------------------------+
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
461 | PROJECT : GSM-PS (6103) MODULE : ALR_PCH |
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
462 | STATE : code ROUTINE : pch_check_page_mode |
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
463 +--------------------------------------------------------------------+
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
464
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
465 PURPOSE : Check the page mode of an incoming unacknowledged
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
466 message.
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
467 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
468 static const UBYTE PAGE_MODE_CHANGE [3][4] =
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
469 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
470 /* old mode = paging normal */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
471 NONE, SWAP_TO_EXTEND, SWAP_TO_REORG, NONE,
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
472 /* old mode = extended paging */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
473 SWAP_TO_NORMAL, NONE, SWAP_TO_REORG, NONE,
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
474 /* old mode = paging reorganisation */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
475 SWAP_TO_NORMAL, SWAP_TO_EXTEND, NONE, NONE
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
476 };
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
477
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
478
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
479 GLOBAL void pch_check_page_mode (T_MPHC_DATA_IND *data_ind)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
480 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
481 UBYTE page_mode;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
482 UBYTE cur_page_mode = alr_data->pch_data.pl_idle.page_mode;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
483
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
484 page_mode = (UBYTE)(data_ind->l2_frame.content [3] & 3);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
485
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
486 ALR_TRACE_PCH_PGM(page_mode, alr_data->pch_data.pl_idle.page_mode);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
487
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
488 /*if HPLMN search is going on and we should be in REORG, we are really
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
489 in REORG_NC_SYNC (NORMAL). Otherwise we cannot synchronize to the NC's*/
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
490 if(alr_data->pch_data.pl_idle.page_mode EQ PGM_REORG_NC_SYNC)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
491 cur_page_mode = PGM_REORG;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
492
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
493 if(alr_data->pch_data.pl_idle.page_mode EQ PGM_REORG_CS)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
494 cur_page_mode = PGM_REORG;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
495
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
496 switch (PAGE_MODE_CHANGE [cur_page_mode][page_mode])
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
497 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
498 case SWAP_TO_NORMAL:
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
499 ALR_TRACE_PCH ("SWAP_TO_NORMAL");
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
500 alr_data->pch_data.pl_idle.page_mode = PGM_NORMAL;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
501 pch_start_ccch_req ();
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
502 break;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
503 case SWAP_TO_EXTEND:
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
504 ALR_TRACE_PCH ("SWAP_TO_EXT");
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
505 alr_data->pch_data.pl_idle.page_mode = PGM_EXTENDED;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
506 pch_start_ccch_req ();
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
507 break;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
508 case SWAP_TO_REORG:
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
509 ALR_TRACE_PCH ("SWAP_TO_REORG");
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
510 alr_data->pch_data.reorg_bcch_reading = TRUE;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
511 alr_data->pch_data.si_bitmap = 0;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
512 alr_data->pch_data.pl_idle.page_mode = PGM_REORG_CS;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
513 pch_start_ccch_req ();
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
514 break;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
515 default:
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
516 break;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
517 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
518 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
519
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
520 GLOBAL void pch_check_page_mode_cr (T_MPHC_DATA_IND *data_ind)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
521 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
522 UBYTE page_mode;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
523 UBYTE cur_page_mode = alr_data->pch_data.saved_page_mode;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
524 UBYTE swap = TRUE;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
525
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
526 page_mode = (UBYTE)(data_ind->l2_frame.content [3] & 3);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
527 if(alr_data->pch_data.saved_page_mode EQ PGM_REORG_CS)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
528 cur_page_mode = PGM_REORG;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
529
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
530 switch (PAGE_MODE_CHANGE [cur_page_mode][page_mode])
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
531 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
532 case SWAP_TO_NORMAL:
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
533 ALR_TRACE_PCH ("CR:SWAP_TO_NORMAL");
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
534 alr_data->pch_data.saved_page_mode = PGM_NORMAL;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
535 break;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
536
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
537 case SWAP_TO_EXTEND:
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
538 ALR_TRACE_PCH ("CR:SWAP_TO_EXT");
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
539 alr_data->pch_data.saved_page_mode = PGM_EXTENDED;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
540 break;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
541
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
542 case SWAP_TO_REORG:
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
543 ALR_TRACE_PCH ("CR:SWAP_TO_REORG");
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
544 alr_data->pch_data.saved_page_mode = PGM_REORG_CS;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
545 break;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
546
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
547 default:
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
548 swap = FALSE;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
549 break;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
550 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
551
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
552 if (swap AND alr_data->pch_data.si3_read AND
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
553 alr_data->pch_data.last_start_ccch_req.bs_pa_mfrms NEQ NOT_PRESENT_8BIT)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
554 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
555 PALLOC(pl_idle, MPHC_START_CCCH_REQ);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
556 memcpy ( pl_idle,
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
557 &(alr_data->pch_data.last_start_ccch_req),
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
558 sizeof(T_MPHC_START_CCCH_REQ));
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
559 pl_idle->page_mode = alr_data->pch_data.saved_page_mode;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
560 ma_pch_start_ccch_req (pl_idle);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
561 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
562
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
563 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
564
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
565
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
566 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
567 +--------------------------------------------------------------------+
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
568 | PROJECT : GSM-PS (6103) MODULE : ALR_PCH |
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
569 | STATE : code ROUTINE : pch_check_pag_1 |
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
570 +--------------------------------------------------------------------+
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
571
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
572 PURPOSE : The function checks a paging request type 1 message.
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
573
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
574 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
575 GLOBAL void pch_check_pag_1 (T_MPHC_DATA_IND *data_ind)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
576 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
577 UBYTE *frame = data_ind->l2_frame.content;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
578 ULONG tmsi;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
579 UBYTE i;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
580 UBYTE channel_needed;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
581 UBYTE *frame_start = data_ind->l2_frame.content;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
582 //ALR_TRACE_PCH ("p1");
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
583 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
584 * Check only if IMSI available (len NEQ 0),
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
585 * ti and pd = 0x06 and
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
586 * l2 pseudolength is greater than 5 bytes
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
587 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
588 if (alr_data->pch_data.imsi[0] AND
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
589 frame[1] EQ 0x06 AND
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
590 frame[0] > 0x15)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
591 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
592 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
593 * store channel needed type
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
594 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
595 channel_needed = frame[3];
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
596 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
597 * check type of identity for mobile identity 1
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
598 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
599 switch (frame [5] & 7)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
600 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
601 case 1:
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
602 //ALR_TRACE_PCH ("p1 IMSI");
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
603 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
604 * IMSI
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
605 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
606 if (!memcmp (alr_data->pch_data.imsi, &frame[4],
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
607 alr_data->pch_data.imsi[0]+1))
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
608 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
609 //ALR_TRACE_PCH ("p1 IMSI match");
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
610 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
611 * IMSI matches
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
612 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
613 #ifdef GPRS
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
614 if(!gprs_alr_check_packet_paging(frame_start,1))
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
615 #endif
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
616 ma_pch_paging_ind (1, (UBYTE)((channel_needed & 0x30)>>4));
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
617 #ifdef GPRS
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
618 else if(GET_STATE(STATE_MA) NEQ MA_CON_EST)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
619 ma_pch_paging_ind (ID_IMSI, CN_PACKET);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
620 #endif
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
621 return;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
622 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
623 break;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
624
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
625 case 4:
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
626 //ALR_TRACE_PCH ("p1 TMSI");
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
627 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
628 * TMSI
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
629 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
630 if (alr_data->pch_data.v_tmsi)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
631 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
632 tmsi = 0L;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
633 for (i=0;i<frame[4]-1;i++)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
634 tmsi += frame[i+6] << ((8*(frame[4]-2-i)));
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
635 if (alr_data->pch_data.tmsi EQ tmsi)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
636 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
637 //ALR_TRACE_PCH ("p1 TMSI match");
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
638 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
639 * TMSI matches
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
640 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
641 ma_pch_paging_ind (4, (UBYTE)((channel_needed & 0x30)>>4));
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
642 return;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
643 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
644 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
645 #ifdef GPRS
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
646 if(GET_STATE(STATE_MA) NEQ MA_CON_EST)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
647 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
648 tmsi = 0L;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
649 for (i=0;i<frame[4]-1;i++)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
650 tmsi += frame[i+6] << ((8*(frame[4]-2-i)));
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
651 if(gprs_alr_check_ptmsi(tmsi)) return;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
652 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
653 #endif
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
654 break;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
655 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
656 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
657 * check type of identity for mobile identity 2
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
658 * set frame pointer to start of mobile identity 2 (id tag)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
659 * old frame pointer (frame) +
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
660 * offset pseudo length etc (4) +
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
661 * length mobile identity 1 (frame [4]) +
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
662 * plus 1 byte for length field
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
663 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
664 frame = frame + 4 + frame[4] + 1;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
665 if (frame[0] EQ 0x17)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
666 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
667 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
668 * mobile identity 2 is available
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
669 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
670 switch (frame [2] & 7)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
671 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
672 case 1:
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
673 //ALR_TRACE_PCH ("p1 IMSI2");
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
674 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
675 * IMSI
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
676 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
677 if (!memcmp (alr_data->pch_data.imsi, &frame[1],
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
678 alr_data->pch_data.imsi[0]+1))
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
679 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
680 //ALR_TRACE_PCH ("p1 IMSI2 match");
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
681 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
682 * IMSI matches
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
683 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
684 #ifdef GPRS
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
685 if(! gprs_alr_check_packet_paging(frame_start,2))
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
686 #endif
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
687 ma_pch_paging_ind (1, (UBYTE)((channel_needed & 0xC0)>>6));
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
688 #ifdef GPRS
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
689 else if(GET_STATE(STATE_MA) NEQ MA_CON_EST)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
690 ma_pch_paging_ind (ID_IMSI, CN_PACKET);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
691 #endif
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
692 return;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
693 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
694 break;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
695 case 4:
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
696 // ALR_TRACE_PCH ("p1 TMSI2");
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
697 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
698 * TMSI
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
699 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
700 if (alr_data->pch_data.v_tmsi)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
701 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
702 tmsi = 0L;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
703 for (i=0;i<frame[1]-1;i++)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
704 tmsi += frame[i+3] << ((8*(frame[1]-2-i)));
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
705 if (alr_data->pch_data.tmsi EQ tmsi)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
706 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
707 ALR_TRACE_PCH ("p1 IMSI2");
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
708 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
709 * TMSI matches
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
710 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
711 ma_pch_paging_ind (4, (UBYTE)((channel_needed & 0xC0)>>6));
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
712 return;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
713 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
714 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
715 #ifdef GPRS
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
716 if(GET_STATE(STATE_MA) NEQ MA_CON_EST)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
717 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
718 tmsi = 0L;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
719 for (i=0;i<frame[4]-1;i++)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
720 tmsi += frame[i+6] << ((8*(frame[4]-2-i)));
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
721 if(gprs_alr_check_ptmsi(tmsi)) return;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
722 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
723 #endif
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
724 break;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
725 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
726 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
727 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
728 //ALR_TRACE_PCH("end p1");
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
729 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
730
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
731
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
732 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
733 +--------------------------------------------------------------------+
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
734 | PROJECT : GSM-PS (6103) MODULE : ALR_PCH |
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
735 | STATE : code ROUTINE : pch_check_pag_2 |
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
736 +--------------------------------------------------------------------+
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
737
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
738 PURPOSE : The function checks a paging request type 2 message.
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
739
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
740 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
741
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
742 GLOBAL void pch_check_pag_2 (T_MPHC_DATA_IND *data_ind)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
743 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
744 UBYTE *frame = data_ind->l2_frame.content;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
745 ULONG tmsi;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
746 UBYTE i;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
747 UBYTE channel_needed;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
748
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
749 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
750 * Check only if IMSI available (len NEQ 0) and
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
751 * ti and pd = 0x06 and
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
752 * l2 pseudolength is greater than 5 bytes
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
753 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
754 if (alr_data->pch_data.imsi[0] AND
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
755 frame[1] EQ 0x06 AND
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
756 frame[0] > 0x15)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
757 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
758 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
759 * store channel needed type
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
760 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
761 channel_needed = frame[3];
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
762 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
763 * check mobile identity 1 only if TMSI is available
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
764 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
765 if (alr_data->pch_data.v_tmsi)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
766 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
767 tmsi = 0L;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
768 for (i=0;i<4;i++)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
769 tmsi += frame[i+4] << (8*(3-i));
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
770 if (alr_data->pch_data.tmsi EQ tmsi)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
771 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
772 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
773 * TMSI matches
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
774 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
775 ma_pch_paging_ind (4, (UBYTE)((channel_needed & 0x30)>>4));
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
776 return;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
777 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
778 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
779 #ifdef GPRS
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
780 if(GET_STATE(STATE_MA) NEQ MA_CON_EST)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
781 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
782 tmsi = 0L;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
783 for (i=0;i<4;i++)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
784 tmsi += frame[i+4] << (8*(3-i));
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
785 if(gprs_alr_check_ptmsi(tmsi)) return;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
786 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
787 #endif
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
788 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
789 * check mobile identity 2 only if TMSI is available
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
790 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
791 if (alr_data->pch_data.v_tmsi)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
792 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
793 tmsi = 0L;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
794 for (i=0;i<4;i++)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
795 tmsi += frame[i+8] << (8*(3-i));
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
796 if (alr_data->pch_data.tmsi EQ tmsi)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
797 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
798 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
799 * TMSI matches
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
800 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
801 ma_pch_paging_ind (4, (UBYTE)((channel_needed & 0xC0)>>6));
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
802 return;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
803 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
804 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
805 #ifdef GPRS
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
806 if(GET_STATE(STATE_MA) NEQ MA_CON_EST)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
807 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
808 tmsi = 0L;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
809 for (i=0;i<4;i++)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
810 tmsi += frame[i+8] << (8*(3-i));
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
811 if(gprs_alr_check_ptmsi(tmsi)) return;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
812 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
813 #endif
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
814
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
815 if (frame[12] EQ 0x17)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
816 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
817 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
818 * mobile identity 3 is available
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
819 * calculation of channel needed for
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
820 * mobile identity 3 from the rest octet.
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
821 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
822 channel_needed = frame [ frame[13]+14 ];
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
823 if (channel_needed & 0x80)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
824 channel_needed = (UBYTE)((channel_needed >> 5) & 3);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
825 else
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
826 channel_needed = 0;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
827
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
828 switch (frame [14] & 7)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
829 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
830 case 1:
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
831 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
832 * IMSI
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
833 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
834 if (!memcmp (alr_data->pch_data.imsi, &frame[13],
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
835 alr_data->pch_data.imsi[0]+1))
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
836 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
837 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
838 * IMSI matches
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
839 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
840 #ifdef GPRS
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
841 if(! gprs_alr_check_packet_paging_2(frame,3))
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
842 #endif
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
843 ma_pch_paging_ind (1, (UBYTE) channel_needed);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
844 #ifdef GPRS
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
845 else if(GET_STATE(STATE_MA) NEQ MA_CON_EST)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
846 ma_pch_paging_ind (ID_IMSI, CN_PACKET);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
847 #endif
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
848 return;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
849 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
850 break;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
851 case 4:
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
852 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
853 * TMSI
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
854 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
855 if (alr_data->pch_data.v_tmsi)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
856 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
857 tmsi = 0L;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
858 for (i=0;i<frame[13]-1;i++)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
859 tmsi += frame[i+15] << ((8*(frame[13]-2-i)));
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
860 if (alr_data->pch_data.tmsi EQ tmsi)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
861 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
862 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
863 * TMSI matches
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
864 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
865 ma_pch_paging_ind (4, channel_needed);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
866 return;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
867 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
868 #ifdef GPRS
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
869 if(GET_STATE(STATE_MA) NEQ MA_CON_EST)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
870 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
871 tmsi = 0L;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
872 for (i=0;i<frame[13]-1;i++)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
873 tmsi += frame[i+15] << ((8*(frame[13]-2-i)));
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
874 if(gprs_alr_check_ptmsi(tmsi)) return;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
875 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
876 #endif
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
877 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
878 break;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
879 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
880 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
881 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
882 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
883
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
884 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
885 +--------------------------------------------------------------------+
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
886 | PROJECT : GSM-PS (6103) MODULE : ALR_PCH |
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
887 | STATE : code ROUTINE : pch_check_pag_3 |
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
888 +--------------------------------------------------------------------+
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
889
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
890 PURPOSE : The function checks a paging request type 3 message.
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
891
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
892 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
893
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
894 GLOBAL void pch_check_pag_3 (T_MPHC_DATA_IND *data_ind)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
895 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
896 UBYTE *frame = data_ind->l2_frame.content;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
897 ULONG tmsi;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
898 UBYTE i;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
899 UBYTE channel_needed;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
900
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
901 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
902 * Check only if IMSI available (len NEQ 0) and
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
903 * ti and pd = 0x06 and
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
904 * l2 pseudolength is greater than 5 bytes
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
905 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
906 if (alr_data->pch_data.imsi[0] AND
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
907 frame[1] EQ 0x06 AND
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
908 frame[0] > 0x15)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
909 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
910 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
911 * store channel needed type
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
912 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
913 channel_needed = frame[3];
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
914 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
915 * check mobile identity 1 only if TMSI is available
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
916 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
917 if (alr_data->pch_data.v_tmsi)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
918 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
919 tmsi = 0L;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
920 for (i=0;i<4;i++)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
921 tmsi += frame[i+4] << (8*(3-i));
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
922 if (alr_data->pch_data.tmsi EQ tmsi)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
923 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
924 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
925 * TMSI matches
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
926 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
927 ma_pch_paging_ind (4, (UBYTE)((channel_needed & 0x30)>>4));
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
928 return;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
929 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
930 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
931 #ifdef GPRS
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
932 if(GET_STATE(STATE_MA) NEQ MA_CON_EST)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
933 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
934 tmsi = 0L;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
935 for (i=0;i<4;i++)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
936 tmsi += frame[i+4] << (8*(3-i));
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
937 if(gprs_alr_check_ptmsi(tmsi)) return;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
938 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
939 #endif
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
940
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
941 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
942 * check mobile identity 2 only if TMSI is available
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
943 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
944 if (alr_data->pch_data.v_tmsi)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
945 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
946 tmsi = 0L;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
947 for (i=0;i<4;i++)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
948 tmsi += frame[i+8] << (8*(3-i));
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
949 if (alr_data->pch_data.tmsi EQ tmsi)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
950 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
951 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
952 * TMSI matches
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
953 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
954 ma_pch_paging_ind (4, (UBYTE)((channel_needed & 0xC0)>>6));
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
955 return;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
956 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
957 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
958 #ifdef GPRS
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
959 if(GET_STATE(STATE_MA) NEQ MA_CON_EST)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
960 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
961 tmsi = 0L;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
962 for (i=0;i<4;i++)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
963 tmsi += frame[i+8] << (8*(3-i));
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
964 if(gprs_alr_check_ptmsi(tmsi)) return;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
965 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
966 #endif
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
967 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
968 * calculation of channel needed for
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
969 * mobile identity 3 and 4 from the rest octet.
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
970 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
971 channel_needed = frame [ 20 ];
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
972 if (channel_needed & 0x80)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
973 channel_needed = (UBYTE)((channel_needed & 0x78) >> 3);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
974 else
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
975 channel_needed = 0;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
976 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
977 * check mobile identity 3 only if TMSI is available
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
978 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
979 if (alr_data->pch_data.v_tmsi)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
980 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
981 tmsi = 0L;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
982 for (i=0;i<4;i++)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
983 tmsi += frame[i+12] << (8*(3-i));
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
984 if (alr_data->pch_data.tmsi EQ tmsi)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
985 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
986 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
987 * TMSI matches
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
988 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
989 ma_pch_paging_ind (4, (UBYTE)(channel_needed >> 2));
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
990 return;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
991 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
992 #ifdef GPRS
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
993 if(GET_STATE(STATE_MA) NEQ MA_CON_EST)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
994 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
995 tmsi = 0L;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
996 for (i=0;i<4;i++)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
997 tmsi += frame[i+12] << (8*(3-i));
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
998 if(gprs_alr_check_ptmsi(tmsi)) return;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
999 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1000 #endif
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1001 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1002 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1003 * check mobile identity 4 only if TMSI is available
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1004 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1005 if (alr_data->pch_data.v_tmsi)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1006 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1007 tmsi = 0L;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1008 for (i=0;i<4;i++)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1009 tmsi += frame[i+16] << (8*(3-i));
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1010 if (alr_data->pch_data.tmsi EQ tmsi)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1011 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1012 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1013 * TMSI matches
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1014 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1015 ma_pch_paging_ind (4, (UBYTE)(channel_needed & 3));
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1016 return;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1017 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1018 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1019 #ifdef GPRS
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1020 if(GET_STATE(STATE_MA) NEQ MA_CON_EST)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1021 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1022 tmsi = 0L;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1023 for (i=0;i<4;i++)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1024 tmsi += frame[i+16] << (8*(3-i));
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1025 if(gprs_alr_check_ptmsi(tmsi)) return;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1026 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1027 #endif
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1028 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1029 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1030
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1031 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1032 +--------------------------------------------------------------------+
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1033 | PROJECT : GSM-PS (6103) MODULE : ALR_PCH |
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1034 | STATE : code ROUTINE : pch_stop |
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1035 +--------------------------------------------------------------------+
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1036
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1037 PURPOSE : The function stops paging.
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1038
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1039 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1040 GLOBAL void pch_stop(void)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1041 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1042 if(GET_STATE(STATE_PCH) EQ PCH_ACTIVE)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1043 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1044 SET_STATE(STATE_PCH,PCH_NULL);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1045 if(alr_data->pch_data.pl_idle.page_mode EQ PGM_REORG OR
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1046 alr_data->pch_data.pl_idle.page_mode EQ PGM_REORG_CS)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1047 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1048 ALR_TRACE_PCH ("stop sc for pch");
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1049 ma_stop_scell_bcch_req();
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1050 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1051
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1052 ma_pch_stop();
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1053 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1054 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1055
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1056 /*used for S13 - to stop BCCH reading*/
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1057
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1058 GLOBAL UBYTE pch_mode_reorg(void)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1059 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1060 if(alr_data->pch_data.pl_idle.page_mode EQ PGM_REORG OR
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1061 alr_data->pch_data.pl_idle.page_mode EQ PGM_REORG_CS OR
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1062 alr_data->pch_data.pl_idle.page_mode EQ PGM_REORG_NC_SYNC)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1063 return TRUE;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1064 else
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1065 return FALSE;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1066 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1067 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1068 +--------------------------------------------------------------------+
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1069 | PROJECT : GSM-PS (6103) MODULE : ALR_PCH |
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1070 | STATE : code ROUTINE : pch_no_of_paging_blocks |
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1071 +--------------------------------------------------------------------+
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1072
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1073 PURPOSE : The function configures the paging reading during cell
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1074 reselection when reveived a SI3
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1075 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1076
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1077 LOCAL SHORT pch_no_of_paging_blocks (UBYTE ccch_conf,
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1078 UBYTE bs_ag_blks_res,
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1079 UBYTE bs_pa_mfrms)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1080 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1081 /* in according to GSM 4.08 section 10.5.2.11, table 10.5.33 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1082 if (ccch_conf EQ COMB_CCCH_COMB)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1083 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1084 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1085 * combined CCCH,
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1086 *
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1087 * number of paging blocks = (3 - BS_AG_BLKS_RES) * BS_PA_MFRMS
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1088 *
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1089 * Maximum function only for security reasons, BCCH coding range is 0..7,
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1090 * but allowed is only 0..2.
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1091 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1092 return (( (1 > (UBYTE)(3 - bs_ag_blks_res) ? 1 : (UBYTE)(3 - bs_ag_blks_res)) ) *
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1093 ((UBYTE)(2 + bs_pa_mfrms)));
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1094 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1095 else
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1096 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1097 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1098 * non-combined CCCH,
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1099 *
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1100 * number of paging blocks = (9 - BS_AG_BLKS_RES) * BS_PA_MFRMS
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1101 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1102 return ((9 - bs_ag_blks_res) *
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1103 (2 + bs_pa_mfrms));
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1104 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1105 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1106 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1107 +--------------------------------------------------------------------+
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1108 | PROJECT : GSM-PS (6103) MODULE : ALR_PCH |
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1109 | STATE : code ROUTINE : pch_config_resel |
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1110 +--------------------------------------------------------------------+
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1111
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1112 PURPOSE : The function configures the L1 PCH reading during cell
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1113 reselection when reveived an SI3
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1114 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1115
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1116 GLOBAL void pch_config_resel (T_MPHC_DATA_IND *data_ind)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1117 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1118 UBYTE *p_ctrl = &(data_ind->l2_frame.content[SI_CONTENTS_MSG_T+8]);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1119 UBYTE ccch_conf,
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1120 bs_ag_blks_res,
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1121 bs_pa_mfrms,
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1122 pg,
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1123 pag_blocks_per_mfr;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1124 SHORT n, b;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1125 PALLOC(pl_idle, MPHC_START_CCCH_REQ);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1126 memset(pl_idle, 0, sizeof(T_MPHC_START_CCCH_REQ));
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1127
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1128 bs_ag_blks_res = (UBYTE)(((*p_ctrl) & 0x38) >> 3);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1129 ccch_conf = (((*p_ctrl) & 0x07) EQ 0x01) ? COMB_CCCH_COMB : COMB_CCCH_NOT_COMB;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1130 p_ctrl++;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1131 bs_pa_mfrms = (UBYTE)(((*p_ctrl) & 0x07));
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1132 /* TRACE_EVENT_P5("pch_config_resel IE: %02x %02x bs_ag_blks_res=%u ccch_conf=%u bs_pa_mfrms=%u",
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1133 data_ind->l2_frame.content[SI_CONTENTS_MSG_T+8],
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1134 *p_ctrl,
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1135 bs_ag_blks_res,
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1136 ccch_conf,
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1137 bs_pa_mfrms);*/
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1138
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1139 n = pch_no_of_paging_blocks (ccch_conf, bs_ag_blks_res, bs_pa_mfrms);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1140 b = ((ccch_conf / 2) + 1) * n;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1141 pg = (UBYTE) ((alr_data->pch_data.imsi_mod_1000 % b) % n);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1142 pag_blocks_per_mfr = PAG_BLOCK_TABLE [ccch_conf][bs_ag_blks_res];
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1143
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1144 pl_idle->bs_ag_blks_res = bs_ag_blks_res;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1145 pl_idle->bs_pa_mfrms = (UBYTE)(bs_pa_mfrms + 2);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1146 pl_idle->bcch_combined = ccch_conf;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1147 pl_idle->ccch_group = (UBYTE) ((alr_data->pch_data.imsi_mod_1000 % b) / n);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1148 pl_idle->page_group = pg;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1149 pl_idle->page_block_index = (UBYTE)(pg % pag_blocks_per_mfr);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1150 pl_idle->page_mode = (alr_data->pch_data.saved_page_mode EQ PGM_REORG_CS)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1151 ? PGM_REORG
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1152 : alr_data->pch_data.saved_page_mode;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1153
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1154 /* TRACE_EVENT_P3("n=%u b=%u page_mode=%u", n, b, pl_idle->page_mode);*/
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1155 ma_pch_start_ccch_req(pl_idle);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1156
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1157 alr_data->pch_data.si3_read = TRUE;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1158 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1159 #endif