comparison g23m/condat/ms/src/aci/psa_gmmp.c @ 0:509db1a7b7b8

initial import: leo2moko-r1
author Space Falcon <falcon@ivan.Harhan.ORG>
date Mon, 01 Jun 2015 03:24:05 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:509db1a7b7b8
1 /*
2 +-----------------------------------------------------------------------------
3 | Project :
4 | Modul :
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 module defines the processing functions for the
18 | primitives send to the protocol stack adapter by the
19 | registrations part of GPRS mobility management ( GMM ).
20 +-----------------------------------------------------------------------------
21 */
22
23 #if defined (GPRS) && defined (DTI)
24
25 #ifndef PSA_GMMP_C
26 #define PSA_GMMP_C
27 #endif
28
29 #include "aci_all.h"
30 /*==== INCLUDES ===================================================*/
31 #include "dti.h" /* functionality of the dti library */
32 #include "aci_cmh.h"
33 #include "ati_cmd.h"
34 #include "aci_cmd.h"
35
36 #include "aci.h"
37
38 #include "dti.h"
39 #include "dti_conn_mng.h"
40 #include "dti_cntrl_mng.h"
41
42 #include "gaci.h"
43 #include "gaci_cmh.h"
44 #include "psa.h"
45 #include "psa_gmm.h"
46 #include "psa_mm.h"
47 #include "cmh.h"
48 #include "cmh_gmm.h"
49
50 /*==== CONSTANTS ==================================================*/
51
52 /*==== TYPES ======================================================*/
53
54
55 /*==== EXPORT =====================================================*/
56
57
58 /*==== VARIABLES ==================================================*/
59
60
61 /*==== FUNCTIONS ==================================================*/
62
63 /*
64 +-------------------------------------------------------------------+
65 | PROJECT : GPRS (8441) MODULE : PSA_GMMP |
66 | ROUTINE : psa_gmmreg_attach_cnf |
67 +-------------------------------------------------------------------+
68
69 PURPOSE : processes the GMMREG_ATTACH_CNF primitive send by GMM.
70 this confirms a successful attach.
71 */
72 GLOBAL const void psa_gmmreg_attach_cnf ( T_GMMREG_ATTACH_CNF *gmmreg_attach_cnf )
73 {
74
75 TRACE_FUNCTION ("psa_gmmreg_attach_cnf()");
76
77 GMM_PRIM_TRACE_2("ATT_CNF",dbg_attachType(gmmreg_attach_cnf->attach_type),
78 dbg_searchRunning(gmmreg_attach_cnf->search_running));
79 /*
80 *-------------------------------------------------------------------
81 * notify ACI
82 *-------------------------------------------------------------------
83 */
84 cmhGMM_setPLMN(&gmmreg_attach_cnf->plmn);
85 gmmShrdPrm.lac = gmmreg_attach_cnf->lac;
86 gmmShrdPrm.cid = gmmreg_attach_cnf->cid;
87
88 /* ACI-SPR-17218: Map gprs_indicator to ACI state */
89 switch( gmmreg_attach_cnf->gprs_indicator )
90 {
91 case GMM_GPRS_SUPP_NO:
92 gmmShrdPrm.gprs_indicator = P_CREG_GPRS_Not_Supported;
93 break;
94 case GMM_GPRS_SUPP_LIMITED:
95 gmmShrdPrm.gprs_indicator = P_CREG_GPRS_Supported_Limited_Serv;
96 break;
97 case GMM_GPRS_SUPP_YES:
98 gmmShrdPrm.gprs_indicator = P_CREG_GPRS_Supported;
99 break;
100 default:
101 gmmShrdPrm.gprs_indicator = P_CREG_GPRS_Support_Unknown;
102 break;
103 }
104
105 TRACE_EVENT_P2("NEW ! gmmShrdPrm.lac: %04X, gmmShrdPrm.cid: %04X", gmmShrdPrm.lac, gmmShrdPrm.cid);
106
107 psaGMM_NetworkRegistrationStatus(GMMREG_ATTACH_CNF, gmmreg_attach_cnf);
108
109 cmhGMM_Attached( gmmreg_attach_cnf->attach_type, &gmmreg_attach_cnf->plmn, gmmreg_attach_cnf->search_running );
110
111 switch ( gmmreg_attach_cnf->attach_type )
112 {
113 case GMMREG_AT_GPRS:
114 break;
115 case GMMREG_AT_COMB:
116 case GMMREG_AT_IMSI:
117 {
118 PALLOC (mmr_reg_cnf, MMR_REG_CNF);
119 memcpy(&mmr_reg_cnf->plmn, &gmmreg_attach_cnf->plmn, sizeof(T_plmn));
120 mmr_reg_cnf->lac = gmmreg_attach_cnf->lac;
121 mmr_reg_cnf->cid = gmmreg_attach_cnf->cid;
122 psa_mmr_reg_cnf(mmr_reg_cnf);
123 }
124 break;
125 }
126
127 /*
128 *-------------------------------------------------------------------
129 * free the primitive buffer
130 *-------------------------------------------------------------------
131 */
132 PFREE (gmmreg_attach_cnf);
133 }
134
135 /*
136 +-------------------------------------------------------------------+
137 | PROJECT : GPRS (8441) MODULE : PSA_GMMP |
138 | ROUTINE : psa_gmmreg_attach_rej |
139 +-------------------------------------------------------------------+
140
141 PURPOSE : processes the GMMREG_ATTACH_REJ primitive send by GMM.
142 this confirms a failed attach.
143 */
144 GLOBAL const void psa_gmmreg_attach_rej ( T_GMMREG_ATTACH_REJ *gmmreg_attach_rej )
145 {
146
147 TRACE_FUNCTION ("psa_gmmreg_attach_rej()");
148
149 GMM_PRIM_TRACE_2("ATT_REJ",dbg_detachType(gmmreg_attach_rej->detach_type),
150 dbg_searchRunning(gmmreg_attach_rej->search_running));
151 /*
152 *-------------------------------------------------------------------
153 * notify ACI
154 *-------------------------------------------------------------------
155 */
156 psaGMM_NetworkRegistrationStatus(GMMREG_ATTACH_REJ, gmmreg_attach_rej);
157
158 cmhGMM_NoAttach (gmmreg_attach_rej->detach_type,gmmreg_attach_rej->service,
159 gmmreg_attach_rej->search_running );
160
161 switch ( gmmreg_attach_rej->detach_type )
162 {
163 case GMMREG_DT_COMB:
164 case GMMREG_DT_IMSI:
165 /*
166 * No MM information, if
167 * IMSI wasn' t registered and wasn' t requested
168 */
169 if ( ( gmmShrdPrm.last_attach_type EQ ATTACH_TYPE_DETACHED || /* wasn' t registered */
170 gmmShrdPrm.last_attach_type EQ GMMREG_AT_GPRS ) &&
171 ( gmmShrdPrm.requested_attach_type EQ ATTACH_TYPE_DETACHED || /* wasn' t requested */
172 gmmShrdPrm.requested_attach_type EQ GMMREG_AT_GPRS ) )
173 break;
174
175 /* else walk through */
176 /*FALLTHROUGH*/
177 case GMMREG_DT_LIMITED_SERVICE:
178 case GMMREG_DT_SIM_REMOVED:
179 {
180 PALLOC (mmr_nreg_ind, MMR_NREG_IND); /* T_MMR_NREG_IND */
181 mmr_nreg_ind->cause = gmmreg_attach_rej->cause;
182 mmr_nreg_ind->service =
183 cmhGMM_translate_gmm_cause_to_nreg_cs(gmmreg_attach_rej->service);
184 mmr_nreg_ind->search_running = gmmreg_attach_rej->search_running;
185 psa_mmr_nreg_ind(mmr_nreg_ind);
186 }
187 break;
188 case GMMREG_DT_POWER_OFF:
189 case GMMREG_DT_GPRS:
190 case GMMREG_DT_DISABLE_GPRS:
191 default:
192 break;
193 }
194
195 /*
196 *-------------------------------------------------------------------
197 * free the primitive buffer
198 *-------------------------------------------------------------------
199 */
200 PFREE (gmmreg_attach_rej);
201
202 }
203
204 /*
205 +-------------------------------------------------------------------+
206 | PROJECT : GPRS (8441) MODULE : PSA_GMMP |
207 | ROUTINE : psa_gmmreg_detach_cnf |
208 +-------------------------------------------------------------------+
209
210 PURPOSE : processes the GMMREG_DETACH_CNF primitive send by GMM.
211 this confirms a successful detach.
212 */
213 GLOBAL const void psa_gmmreg_detach_cnf ( T_GMMREG_DETACH_CNF *gmmreg_detach_cnf )
214 {
215 TRACE_FUNCTION ("psa_gmmreg_detach_cnf()");
216
217 GMM_PRIM_TRACE_1("DET_CNF",
218 dbg_detachType(gmmreg_detach_cnf->detach_type));
219
220 /*
221 *-------------------------------------------------------------------
222 * notify ACI
223 *-------------------------------------------------------------------
224 */
225 psaGMM_NetworkRegistrationStatus(GMMREG_DETACH_CNF, gmmreg_detach_cnf);
226
227 cmhGMM_Detached( gmmreg_detach_cnf->detach_type );
228
229 switch ( gmmreg_detach_cnf->detach_type )
230 {
231 case GMMREG_DT_SOFT_OFF:
232 {
233 PALLOC (mmr_nreg_cnf, MMR_NREG_CNF);
234 mmr_nreg_cnf->detach_cause = CS_SOFT_OFF;
235 psa_mmr_nreg_cnf(mmr_nreg_cnf);
236 }
237 break;
238
239 case GMMREG_DT_POWER_OFF:
240 {
241 PALLOC (mmr_nreg_cnf, MMR_NREG_CNF);
242 mmr_nreg_cnf->detach_cause = CS_POW_OFF;
243 psa_mmr_nreg_cnf(mmr_nreg_cnf);
244 }
245 break;
246
247 case GMMREG_DT_COMB: /* is set for e.g. AT+COPS=2 or AT%NRG=0,2 */
248 case GMMREG_DT_SIM_REMOVED:
249 {
250 PALLOC (mmr_nreg_cnf, MMR_NREG_CNF);
251 mmr_nreg_cnf->detach_cause = CS_SIM_REM;
252 psa_mmr_nreg_cnf(mmr_nreg_cnf);
253 }
254 break;
255
256 case GMMREG_DT_GPRS:
257 case GMMREG_DT_IMSI:
258 case GMMREG_DT_DISABLE_GPRS:
259 case GMMREG_DT_LIMITED_SERVICE:
260 break;
261 }
262
263 /*
264 *-------------------------------------------------------------------
265 * free the primitive buffer
266 *-------------------------------------------------------------------
267 */
268 PFREE (gmmreg_detach_cnf);
269 }
270
271 /*
272 +-------------------------------------------------------------------+
273 | PROJECT : GPRS (8441) MODULE : PSA_GMMP |
274 | ROUTINE : psa_gmmreg_detach_ind |
275 +-------------------------------------------------------------------+
276
277 PURPOSE : processes the GMMREG_DETACH_IND primitive send by GMM.
278 the network initiated detach.
279 */
280 GLOBAL const void psa_gmmreg_detach_ind ( T_GMMREG_DETACH_IND *gmmreg_detach_ind )
281 {
282
283 TRACE_FUNCTION ("psa_gmmreg_detach_ind()");
284
285 GMM_PRIM_TRACE_2("DET_IND",dbg_detachType(gmmreg_detach_ind->detach_type),
286 dbg_searchRunning(gmmreg_detach_ind->search_running));
287
288 /*
289 *-------------------------------------------------------------------
290 * notify ACI
291 *-------------------------------------------------------------------
292 */
293 psaGMM_NetworkRegistrationStatus(GMMREG_DETACH_IND, gmmreg_detach_ind);
294
295 cmhGMM_NetDetach( gmmreg_detach_ind->detach_type,gmmreg_detach_ind->service,
296 gmmreg_detach_ind->search_running );
297
298 switch ( gmmreg_detach_ind->detach_type )
299 {
300 case GMMREG_DT_COMB:
301 case GMMREG_DT_IMSI:
302 case GMMREG_DT_LIMITED_SERVICE:
303 {
304 PALLOC (mmr_nreg_ind, MMR_NREG_IND);
305 mmr_nreg_ind->cause = gmmreg_detach_ind->cause;
306 mmr_nreg_ind->service =
307 cmhGMM_translate_gmm_cause_to_nreg_cs(gmmreg_detach_ind->service);
308 mmr_nreg_ind->search_running = gmmreg_detach_ind->search_running;
309 psa_mmr_nreg_ind(mmr_nreg_ind);
310 }
311 break;
312 case GMMREG_DT_POWER_OFF:
313 case GMMREG_DT_SIM_REMOVED:
314 case GMMREG_DT_GPRS:
315 case GMMREG_DT_DISABLE_GPRS:
316 cmhGMM_send_NetworkRegistrationStatus( CGREG_STAT_NOT_REG, P_CGREG_STAT_NOT_REG );
317 default:
318 break;
319 }
320
321 /*
322 *-------------------------------------------------------------------
323 * free the primitive buffer
324 *-------------------------------------------------------------------
325 */
326 PFREE (gmmreg_detach_ind);
327
328 }
329
330 /*
331 +-------------------------------------------------------------------+
332 | PROJECT : GPRS (8441) MODULE : PSA_GMMP |
333 | ROUTINE : psa_gmmreg_plmn_ind |
334 +-------------------------------------------------------------------+
335
336 PURPOSE : processes the GMMREG_PLMN_IND primitive send by GMM.
337 this indicate a PLMN list to the MMI.
338 */
339
340 GLOBAL const void psa_gmmreg_plmn_ind ( T_GMMREG_PLMN_IND *gmmreg_plmn_ind )
341 {
342 short i;
343 TRACE_FUNCTION ("psa_gmmreg_plmn_ind()");
344
345 /*
346 *-------------------------------------------------------------------
347 * copy primitive for MM and update shared parameter from GMM
348 *-------------------------------------------------------------------
349 */
350 {
351 PALLOC (mmr_plmn_ind, MMR_PLMN_IND); /* T_MMR_PLMN_IND */
352
353 mmr_plmn_ind->cause = gmmreg_plmn_ind->cause;
354
355 for (i = 0; i < MAX_PLMN_ID; i++)
356 {
357 mmr_plmn_ind->plmn[i] = gmmreg_plmn_ind->plmn[i];
358 mmr_plmn_ind->forb_ind[i] = gmmreg_plmn_ind->forb_ind[i];
359 mmr_plmn_ind->rxlevel[i] = gmmreg_plmn_ind->rxlevel[i];
360 mmr_plmn_ind->lac_list[i] = gmmreg_plmn_ind->lac_list[i];
361 /* shared parameter */
362 gmmShrdPrm.gprs_status[i] = gmmreg_plmn_ind->gprs_status[i];
363
364 if ( mmr_plmn_ind->plmn[i].v_plmn EQ INVLD_PLMN )
365 break;
366 }
367
368 /*
369 *-------------------------------------------------------------------
370 * call MM primitive handler for update shared parameter and notify ACI
371 *-------------------------------------------------------------------
372 */
373 psa_mmr_plmn_ind(mmr_plmn_ind);
374 }
375 /*
376 *-------------------------------------------------------------------
377 * notify ACI
378 *-------------------------------------------------------------------
379 */
380 cmhGMM_Plmn();
381
382 /*
383 *-------------------------------------------------------------------
384 * free the primitive buffer
385 *-------------------------------------------------------------------
386 */
387 PFREE (gmmreg_plmn_ind);
388 }
389
390 /*
391 +-------------------------------------------------------------------+
392 | PROJECT : GPRS (8441) MODULE : PSA_GMMP |
393 | ROUTINE : psa_gmmreg_suspend_ind |
394 +-------------------------------------------------------------------+
395
396 PURPOSE : processes the GMMREG_SUSPEND_IND primitive send by GMM.
397 this inform MMI if whether full service or limited service is available.
398 */
399 GLOBAL const void psa_gmmreg_suspend_ind( T_GMMREG_SUSPEND_IND *gmmreg_suspend_ind )
400 {
401
402 TRACE_FUNCTION ("psa_gmmreg_suspend_ind()");
403
404 GMM_PRIM_TRACE_1("SUS_IND",dbg_cellState(gmmreg_suspend_ind->cell_state));
405
406 /*
407 *-------------------------------------------------------------------
408 * notify ACI
409 *-------------------------------------------------------------------
410 */
411 psaGMM_NetworkRegistrationStatus(GMMREG_SUSPEND_IND, gmmreg_suspend_ind);
412
413 cmhGMM_Suspend( gmmreg_suspend_ind->cell_state );
414
415 /*
416 *-------------------------------------------------------------------
417 * free the primitive buffer
418 *-------------------------------------------------------------------
419 */
420 PFREE (gmmreg_suspend_ind);
421
422 }
423
424 /*
425 +-------------------------------------------------------------------+
426 | PROJECT : GPRS (8441) MODULE : PSA_GMMP |
427 | ROUTINE : psa_gmmreg_resume_ind |
428 +-------------------------------------------------------------------+
429
430 PURPOSE : processes the GMMREG_RESUME_IND primitive send by GMM.
431 this inform MMI that GPRS full service is now available.
432 */
433 GLOBAL const void psa_gmmreg_resume_ind( T_GMMREG_RESUME_IND *gmmreg_resume_ind )
434 {
435
436 TRACE_FUNCTION ("psa_gmmreg_resume_ind()");
437
438 /*
439 *-------------------------------------------------------------------
440 * notify ACI
441 *-------------------------------------------------------------------
442 */
443 psaGMM_NetworkRegistrationStatus(GMMREG_RESUME_IND, gmmreg_resume_ind);
444
445 cmhGMM_Resume();
446
447 /*
448 *-------------------------------------------------------------------
449 * free the primitive buffer
450 *-------------------------------------------------------------------
451 */
452 PFREE (gmmreg_resume_ind);
453
454 }
455
456 /*
457 +-------------------------------------------------------------------+
458 | PROJECT : GPRS (8441) MODULE : PSA_GMMP |
459 | ROUTINE : psa_gmmreg_info_ind |
460 +-------------------------------------------------------------------+
461
462 PURPOSE : processes the GMMREG_INFO_IND primitive send by GMM.
463 this transmit the information provided by the GMM INFORMATION message to the MMI.
464 */
465 GLOBAL const void psa_gmmreg_info_ind( T_GMMREG_INFO_IND *gmmreg_info_ind )
466 {
467
468 TRACE_FUNCTION ("psa_gmmreg_info_ind()");
469
470 /*
471 *-------------------------------------------------------------------
472 * notify ACI
473 *-------------------------------------------------------------------
474 */
475 {
476 PALLOC (mmr_info_ind, MMR_INFO_IND);
477 memcpy (&(mmr_info_ind->plmn), &(gmmreg_info_ind->plmn), sizeof (T_plmn));
478 memcpy (&(mmr_info_ind->full_name), &(gmmreg_info_ind->full_net_name_gmm), sizeof (T_full_net_name_gmm));
479 memcpy (&(mmr_info_ind->short_name), &(gmmreg_info_ind->short_net_name_gmm), sizeof (T_short_net_name_gmm));
480 memcpy (&(mmr_info_ind->ntz), &(gmmreg_info_ind->net_time_zone), sizeof (T_net_time_zone));
481 memcpy (&(mmr_info_ind->time), &(gmmreg_info_ind->net_time), sizeof (T_net_time));
482
483 psa_mmr_info_ind(mmr_info_ind);
484 }
485
486 /*cmhGMM_Info();*/
487
488 /*
489 *-------------------------------------------------------------------
490 * free the primitive buffer
491 *-------------------------------------------------------------------
492 */
493 PFREE (gmmreg_info_ind);
494
495 }
496
497
498 /*
499 +-------------------------------------------------------------------+
500 | PROJECT : GPRS (8441) MODULE : PSA_GMMP |
501 | ROUTINE : psa_gmmreg_ciphering_ind|
502 +-------------------------------------------------------------------+
503
504 PURPOSE : processes the GMMREG_CIPHERING_IND primitive send by GMM.
505 */
506 GLOBAL const void psa_gmmreg_ciphering_ind(T_GMMREG_CIPHERING_IND *gmmreg_ciphering_ind)
507 {
508
509 TRACE_FUNCTION ("psa_gmmreg_ciphering_ind()");
510
511 cmhGMM_CipheringInd (gmmreg_ciphering_ind->gsm_ciph,gmmreg_ciphering_ind->gprs_ciph);
512
513
514 /*
515 *-------------------------------------------------------------------
516 * free the primitive buffer
517 *-------------------------------------------------------------------
518 */
519 PFREE (gmmreg_ciphering_ind);
520
521 }
522
523 /*
524 +-------------------------------------------------------------------+
525 | PROJECT : GPRS (8441) MODULE : PSA_GMMP |
526 | ROUTINE : psa_gmmreg_ahplmn_ind |
527 +-------------------------------------------------------------------+
528
529 PURPOSE : processes the GMMREG_AHPLMN_IND primitive send by GMM.
530 */
531 GLOBAL const void psa_gmmreg_ahplmn_ind(T_GMMREG_AHPLMN_IND *gmmreg_ahplmn_ind)
532 {
533 TRACE_FUNCTION("psa_gmmreg_ahplmn_ind()");
534
535 {
536 PALLOC(mmr_ahplmn_ind, MMR_AHPLMN_IND);
537 mmr_ahplmn_ind->ahplmn = gmmreg_ahplmn_ind->ahplmn;
538 psa_mmr_ahplmn_ind(mmr_ahplmn_ind);
539 }
540
541 psaGMM_NetworkRegistrationStatus(GMMREG_AHPLMN_IND, gmmreg_ahplmn_ind);
542
543 PFREE(gmmreg_ahplmn_ind);
544 }
545
546
547 #endif /* GPRS */
548 /*==== EOF =========================================================*/