comparison src/g23m-gsm/mm/mm_csf.c @ 104:27a4235405c6

src/g23m-gsm: import from LoCosto source
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 04 Oct 2016 18:24:05 +0000
parents
children
comparison
equal deleted inserted replaced
103:76d139c7a25e 104:27a4235405c6
1 /*
2 +-----------------------------------------------------------------------------
3 | Project : GSM-PS (8410)
4 | Modul : MM_CSF
5 +-----------------------------------------------------------------------------
6 | Copyright 2002 Texas Instruments Berlin, AG
7 | All rights reserved.
8 |
9 | This file is confidential and a trade secret of Texas
10 | Instruments Berlin, AG
11 | The receipt of or possession of this file does not convey
12 | any rights to reproduce or disclose its contents or to
13 | manufacture, use, or sell anything it may describe, in
14 | whole, or in part, without the specific written consent of
15 | Texas Instruments Berlin, AG.
16 +-----------------------------------------------------------------------------
17 | Purpose : This Modul defines the functions for the csf
18 | capability of the module Mobility Management.
19 +-----------------------------------------------------------------------------
20 */
21
22 #ifndef MM_CSF_C
23 #define MM_CSF_C
24
25 #define ENTITY_MM
26
27 /*==== INCLUDES ===================================================*/
28 #if defined (NEW_FRAME)
29
30 #include <string.h>
31 #include <stdlib.h>
32 #include <stddef.h>
33 #include "typedefs.h"
34 #include "pcm.h"
35 #include "pconst.cdg"
36 #include "mconst.cdg"
37 #include "message.h"
38 #include "ccdapi.h"
39 #include "vsi.h"
40 #include "custom.h"
41 #include "gsm.h"
42 #include "prim.h"
43 #include "cnf_mm.h"
44 #include "mon_mm.h"
45 #include "pei.h"
46 #include "tok.h"
47 #include "mm.h"
48 #include "cl_imei.h" /* IMEI common library */
49
50 #else
51
52 #include <string.h>
53 #include <stdlib.h>
54 #include <stddef.h>
55 #include "stddefs.h"
56 #include "pcm.h"
57 #include "pconst.cdg"
58 #include "mconst.cdg"
59 #include "message.h"
60 #include "ccdapi.h"
61 #include "custom.h"
62 #include "gsm.h"
63 #include "prim.h"
64 #include "cnf_mm.h"
65 #include "mon_mm.h"
66 #include "vsi.h"
67 #include "pei.h"
68 #include "tok.h"
69 #include "mm.h"
70 #include "cl_imei.h" /* IMEI common library */
71
72 #endif
73
74 /*==== EXPORT =====================================================*/
75
76 /*==== PRIVAT =====================================================*/
77
78 /*==== VARIABLES ==================================================*/
79
80 /*==== FUNCTIONS ==================================================*/
81
82 /*
83 * -------------------------------------------------------------------
84 * Procedures
85 * -------------------------------------------------------------------
86 */
87
88 /*
89 +--------------------------------------------------------------------+
90 | PROJECT : GSM-PS (6147) MODULE : MM_CSF |
91 | STATE : code ROUTINE : csf_read_imei |
92 +--------------------------------------------------------------------+
93
94 PURPOSE :
95
96 */
97
98 GLOBAL void csf_read_imei (T_imsi_struct *imei_struct)
99 {
100 UBYTE buf[CL_IMEI_SIZE];
101
102 TRACE_FUNCTION ("csf_read_imei()");
103
104 imei_struct->v_mid = V_MID_PRES;
105 imei_struct->id_type = 2; /*TYPE_IMEI*/
106 imei_struct->tmsi_dig = 0L;
107
108 /*
109 * Get IMEISV from IMEI common library
110 */
111 cl_get_imeisv(CL_IMEI_SIZE, buf, CL_IMEI_GET_SECURE_IMEI);
112 imei_struct->id[0] = (buf [0] >> 4) & 0x0F; /* TAC 8 byte */
113 imei_struct->id[1] = buf [0] & 0x0F;
114 imei_struct->id[2] = (buf [1] >> 4) & 0x0F;
115 imei_struct->id[3] = buf [1] & 0x0F;
116 imei_struct->id[4] = (buf [2] >> 4) & 0x0F;
117 imei_struct->id[5] = buf [2] & 0x0F;
118 imei_struct->id[6] = (buf [3] >> 4) & 0x0F;
119 imei_struct->id[7] = buf [3] & 0x0F;
120 imei_struct->id[8] = (buf [4] >> 4) & 0x0F; /* SNR 6 byte */
121 imei_struct->id[9] = buf [4] & 0x0F;
122 imei_struct->id[10] = (buf [5] >> 4) & 0x0F;
123 imei_struct->id[11] = buf [5] & 0x0F;
124 imei_struct->id[12] = (buf [6] >> 4) & 0x0F;
125 imei_struct->id[13] = buf [6] & 0x0F;
126 imei_struct->id[14] = (buf [7] >> 4) & 0x0F; /* SV 2 byte */
127 imei_struct->id[15] = buf [7] & 0x0F;
128 TRACE_EVENT_P8("MM INFO IMEI: TAC %1x%1x%1x%1x%1x%1x%1x%1x",
129 imei_struct->id[0], imei_struct->id[1],
130 imei_struct->id[2], imei_struct->id[3],
131 imei_struct->id[4], imei_struct->id[5],
132 imei_struct->id[6], imei_struct->id[7]);
133 TRACE_EVENT_P6("MM INFO IMEI: SNR %1x%1x%1x%1x%1x%1x",
134 imei_struct->id[8], imei_struct->id[9],
135 imei_struct->id[10], imei_struct->id[11],
136 imei_struct->id[12], imei_struct->id[13]);
137 TRACE_EVENT_P2("MM INFO IMEI: SV %1x%1x", imei_struct->id[14],
138 imei_struct->id[15]);
139 }
140
141 /*
142 +--------------------------------------------------------------------+
143 | PROJECT : GSM-PS (6147) MODULE : MM_CSF |
144 | STATE : code ROUTINE : csf_read_mobile_class_1 |
145 +--------------------------------------------------------------------+
146
147 PURPOSE : Read classmark 1.
148
149 */
150
151 GLOBAL void csf_read_mobile_class_1 (T_mob_class_1 *mob_class_1)
152 {
153 /*
154 * The classmarks got from RR are valid after RR becomes active.
155 * That applies to the case of simulation too, because RR checks the existence
156 * and validity of the RF capabilities before filling the structure and read
157 * it as necessary.
158 */
159 #if 1
160 EXTERN UBYTE rr_csf_get_classmark1 (T_mob_class_1 *mob_class_1);
161 rr_csf_get_classmark1 (mob_class_1);
162 #else
163 UBYTE version;
164 UBYTE buf[SIZE_EF_CLASS2];
165 int result;
166
167 TRACE_FUNCTION ("csf_read_mobile_class_1()");
168
169 memset (mob_class_1, 0, sizeof (T_mob_class_1));
170
171 result = pcm_ReadFile ((UBYTE *)EF_CLASS2_ID, SIZE_EF_CLASS2, buf, &version);
172
173 TRACE_EVENT_P1 ("Mobile Class 1: %02X", buf[0]);
174 TRACE_EVENT_P1 ("Result = %d", result);
175
176 /* mob_class_1->spare_1 = GET_BITS (buf[0], 7, 1); */
177 mob_class_1->rev_lev = GET_BITS (buf[0], 5, 2);
178 mob_class_1->es_ind = GET_BITS (buf[0], 4, 1);
179 mob_class_1->a5_1 = GET_BITS (buf[0], 3, 1);
180 mob_class_1->rf_pow_cap = GET_BITS (buf[0], 0, 3);
181 #endif /* else, #ifndef WIN32 */
182 }
183
184 /*
185 +--------------------------------------------------------------------+
186 | PROJECT : GSM-PS (6147) MODULE : MM_CSF |
187 | STATE : code ROUTINE : csf_read_mobile_class_2 |
188 +--------------------------------------------------------------------+
189
190 PURPOSE : Read classmark 2. Power may not be valid as this is
191 delivered by RR after cell selection appropriately for
192 the selected band.
193
194 */
195
196 GLOBAL void csf_read_mobile_class_2 (T_mob_class_2 *mob_class_2)
197 {
198 /*
199 * The classmarks got from RR are valid after RR becomes active.
200 * That applies to the case of simulation too, because RR checks the existence
201 * and validity of the RF capabilities before filling the structure and read
202 * it as necessary.
203 */
204 #if 1
205 EXTERN UBYTE rr_csf_get_classmark2 (T_mob_class_2 *mob_class_2);
206 rr_csf_get_classmark2 (mob_class_2);
207 #else
208 UBYTE version;
209 UBYTE buf[SIZE_EF_CLASS2];
210 int result;
211
212 TRACE_FUNCTION ("csf_read_mobile_class_2()");
213
214 memset (mob_class_2, 0, sizeof (T_mob_class_2));
215
216 result = pcm_ReadFile ((UBYTE *)EF_CLASS2_ID, SIZE_EF_CLASS2, buf, &version);
217
218 TRACE_EVENT_P3 ("Mobile Class 2: %02X %02X %02X", buf[0], buf[1], buf[2]);
219 TRACE_EVENT_P1 ("Result = %d", result);
220
221 /* mob_class_2->spare_1 = GET_BITS (buf[0], 7, 1); */
222 mob_class_2->rev_lev = GET_BITS (buf[0], 5, 2);
223 mob_class_2->es_ind = GET_BITS (buf[0], 4, 1);
224 mob_class_2->a5_1 = GET_BITS (buf[0], 3, 1);
225 mob_class_2->rf_pow_cap = GET_BITS (buf[0], 0, 3);
226
227 /* mob_class_2->spare_2 = GET_BITS (buf[1], 7, 1); */
228 mob_class_2->ps = GET_BITS (buf[1], 6, 1);
229 mob_class_2->ss_screen = GET_BITS (buf[1], 4, 2);
230 mob_class_2->mt_pp_sms = GET_BITS (buf[1], 3, 1);
231 mob_class_2->vbs = GET_BITS (buf[1], 2, 1);
232 mob_class_2->vgcs = GET_BITS (buf[1], 1, 1);
233 mob_class_2->egsm = GET_BITS (buf[1], 0, 1);
234
235 /* mob_class_2->class3 = GET_BITS (buf[2], 7, 1); */
236 mob_class_2->class3 = SUPPORTED;
237 /* mob_class_2->spare_3 = GET_BITS (buf[2], 6, 1); */
238 mob_class_2->lcsva = GET_BITS (buf[2], 5, 1);
239 mob_class_2->ucs2_treat = GET_BITS (buf[2], 4, 1);
240 mob_class_2->solsa = GET_BITS (buf[2], 3, 1);
241 mob_class_2->cmsp = GET_BITS (buf[2], 2, 1);
242 mob_class_2->a5_3 = GET_BITS (buf[2], 1, 1);
243 mob_class_2->a5_2 = GET_BITS (buf[2], 0, 1);
244 #endif /* else, #ifndef WIN32 */
245 }
246
247 /* N950 Memory Optimization - Implements Measure #39*/
248 /* Removed unused Function*/
249 #endif
250