comparison g23m-gsm/mm/mm_csf.c @ 0:75a11d740a02

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