FreeCalypso > hg > leo2moko-debug
comparison g23m/condat/ms/src/aci/psa_mmf.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 : GSM-PS (6147) | |
4 | Modul : PSA_MM | |
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 functions for the protocol | |
18 | stack adapter for the registration part of mobility | |
19 | management. | |
20 +----------------------------------------------------------------------------- | |
21 */ | |
22 | |
23 #ifndef PSA_MMF_C | |
24 #define PSA_MMF_C | |
25 #endif | |
26 | |
27 #include "aci_all.h" | |
28 | |
29 #undef TRACING | |
30 | |
31 /*==== INCLUDES ===================================================*/ | |
32 #include "aci_cmh.h" | |
33 #include "ati_cmd.h" | |
34 #include "aci_cmd.h" | |
35 #include "aci.h" | |
36 #include "psa.h" | |
37 #include "psa_mm.h" | |
38 #include "psa_util.h" | |
39 /*==== CONSTANTS ==================================================*/ | |
40 | |
41 #define ITM_WDT (14) /* item width in chars */ | |
42 #define HDR_WDT (10) /* header width in chars */ | |
43 | |
44 /*==== TYPES ======================================================*/ | |
45 | |
46 | |
47 /*==== EXPORT =====================================================*/ | |
48 | |
49 | |
50 /*==== VARIABLES ==================================================*/ | |
51 | |
52 /*==== FUNCTIONS ==================================================*/ | |
53 | |
54 /* | |
55 +-------------------------------------------------------------------+ | |
56 | PROJECT : GSM-PS (6147) MODULE : PSA_MMF | | |
57 | ROUTINE : psaMM_ClrPLMNLst | | |
58 +-------------------------------------------------------------------+ | |
59 | |
60 PURPOSE : clears all entries for the PLMN list | |
61 */ | |
62 | |
63 GLOBAL void psaMM_ClrPLMNLst ( void ) | |
64 { | |
65 int lstIdx; | |
66 | |
67 for( lstIdx = 0; lstIdx < MAX_PLMN_ID; lstIdx++ ) | |
68 { | |
69 mmShrdPrm.PLMNLst[lstIdx].v_plmn = INVLD_PLMN; | |
70 mmShrdPrm.FRBLst[lstIdx] = NOT_PRESENT_8BIT; | |
71 } | |
72 } | |
73 | |
74 | |
75 /* | |
76 +-------------------------------------------------------------------+ | |
77 | PROJECT : GSM-PS (6147) MODULE : PSA_MMF | | |
78 | ROUTINE : psaMM_CpyPLMNLst | | |
79 +-------------------------------------------------------------------+ | |
80 | |
81 PURPOSE : copies all used entries of a PLMN list into shared | |
82 parameter area. | |
83 */ | |
84 | |
85 GLOBAL void psaMM_CpyPLMNLst ( T_plmn * pPLMNLst, UBYTE * pFRBLst, USHORT * pLACLst) | |
86 { | |
87 int lstIdx; | |
88 | |
89 psaMM_ClrPLMNLst (); | |
90 | |
91 for( lstIdx = 0; lstIdx < MAX_PLMN_ID; lstIdx++ ) | |
92 { | |
93 if( pPLMNLst -> v_plmn EQ INVLD_PLMN ) | |
94 break; | |
95 mmShrdPrm.PLMNLst[lstIdx] = *pPLMNLst++; | |
96 mmShrdPrm.FRBLst[lstIdx] = *pFRBLst++; | |
97 mmShrdPrm.LACLst[lstIdx] = *pLACLst++; | |
98 } | |
99 } | |
100 | |
101 /* | |
102 +-------------------------------------------------------------------+ | |
103 | PROJECT : GSM-PS (6147) MODULE : PSA_MM | | |
104 | ROUTINE : psaMM_Init | | |
105 +-------------------------------------------------------------------+ | |
106 | |
107 PURPOSE : initialize the protocol stack adapter for MM. | |
108 | |
109 */ | |
110 | |
111 GLOBAL void psaMM_Init ( void ) | |
112 { | |
113 | |
114 /* | |
115 *------------------------------------------------------------------- | |
116 * set default parms | |
117 *------------------------------------------------------------------- | |
118 */ | |
119 mmShrdPrm.regStat = NO_VLD_RS; | |
120 mmShrdPrm.regMode = DEF_REG_MODE; | |
121 mmShrdPrm.regModeBeforeAbort = DEF_REG_MODE; | |
122 mmShrdPrm.regModeAutoBack = FALSE; | |
123 mmShrdPrm.srchRslt = NO_ENTRY; | |
124 mmShrdPrm.deregCs = NO_ENTRY; | |
125 mmShrdPrm.usedPLMN.v_plmn = INVLD_PLMN; | |
126 mmShrdPrm.PLMNLst[0].v_plmn = INVLD_PLMN; | |
127 mmShrdPrm.owner = OWN_NONE; | |
128 mmShrdPrm.creg_status = CREG_STAT_NoSearch; | |
129 mmShrdPrm.tz = INVLD_TZ; | |
130 mmShrdPrm.PNNLst.plmn.v_plmn = INVLD_PLMN; | |
131 mmShrdPrm.PNNLst.pnn_rec_num = 0; | |
132 mmShrdPrm.PNNLst.next = NULL; | |
133 mmShrdPrm.COPSmode = COPS_MOD_Auto; | |
134 mmShrdPrm.COPSmodeBeforeAbort = COPS_MOD_Auto; | |
135 mmShrdPrm.ActingHPLMN.v_plmn = INVLD_PLMN; | |
136 | |
137 /* temporary, because of the changes in psaSAT_BuildEnvCC(), | |
138 this is necessary to pass the ACISAT test cases */ | |
139 #ifdef _SIMULATION_ | |
140 mmShrdPrm.lac = 0x0100; | |
141 mmShrdPrm.cid = 0x0100; | |
142 mmShrdPrm.usedPLMN.mcc[0] = 0x02; | |
143 mmShrdPrm.usedPLMN.mcc[1] = 0x06; | |
144 mmShrdPrm.usedPLMN.mcc[2] = 0x02; | |
145 mmShrdPrm.usedPLMN.mnc[0] = 0x00; | |
146 mmShrdPrm.usedPLMN.mnc[1] = 0x01; | |
147 mmShrdPrm.usedPLMN.mnc[2] = 0x0F; | |
148 #endif | |
149 | |
150 mmShrdPrm.slctPLMN.v_plmn = INVLD_PLMN; | |
151 | |
152 psaMM_ClrPLMNLst(); | |
153 } | |
154 | |
155 /* | |
156 +-------------------------------------------------------------------+ | |
157 | PROJECT : GSM-PS (6147) MODULE : PSA_MMF | | |
158 | ROUTINE : psaMM_shrPrmDump | | |
159 +-------------------------------------------------------------------+ | |
160 | |
161 PURPOSE : this function dumps the shared parameter to the debug | |
162 output. | |
163 */ | |
164 | |
165 #ifdef TRACING | |
166 GLOBAL void psaMM_shrPrmDump ( void ) | |
167 { | |
168 char lnBuf [80]; /* holds buffer for output line */ | |
169 char mccBuf[SIZE_MCC + 1]; /* MCC converted to printable C-string */ | |
170 char mncBuf[SIZE_MNC + 1]; /* MNC converted to printable C-string */ | |
171 SHORT chrNr; /* holds number of processed chars */ | |
172 SHORT cnt; /* holds a counter */ | |
173 | |
174 /* --- PLMN list ------------------------------------------------*/ | |
175 for( cnt = 0; cnt<MAX_PLMN_ID AND | |
176 mmShrdPrm.PLMNLst[cnt].v_plmn NEQ INVLD_PLMN; cnt++ ) | |
177 { | |
178 chrNr = sprintf( lnBuf, "%*.*s[%2d]", HDR_WDT, HDR_WDT, " PLMN list",cnt ); | |
179 utl_BCD2String (mccBuf, mmShrdPrm.PLMNLst[cnt].mcc, SIZE_MCC); | |
180 utl_BCD2String (mncBuf, mmShrdPrm.PLMNLst[cnt].mnc, SIZE_MNC); | |
181 chrNr += sprintf( lnBuf+chrNr, "%*s %*s", | |
182 ITM_WDT/2, ITM_WDT/2, mccBuf, mncBuf); | |
183 TRACE_EVENT( lnBuf ); | |
184 } | |
185 | |
186 /* --- used PLMN ------------------------------------------------*/ | |
187 chrNr = sprintf( lnBuf, "%*.*s", HDR_WDT, HDR_WDT, " used PLMN" ); | |
188 if( mmShrdPrm.usedPLMN.v_plmn EQ VLD_PLMN ) | |
189 { | |
190 utl_BCD2String (mccBuf, mmShrdPrm.usedPLMN.mcc, SIZE_MCC); | |
191 utl_BCD2String (mncBuf, mmShrdPrm.usedPLMN.mnc, SIZE_MNC); | |
192 chrNr += sprintf( lnBuf+chrNr, "%*s %*s", | |
193 ITM_WDT/2, ITM_WDT/2, mccBuf, mncBuf); | |
194 } | |
195 else | |
196 { | |
197 chrNr += sprintf( lnBuf+chrNr, "%*s", ITM_WDT, "none" ); | |
198 } | |
199 TRACE_EVENT( lnBuf ); | |
200 | |
201 /* --- registration mode ----------------------------------------*/ | |
202 chrNr = sprintf( lnBuf, "%*.*s", HDR_WDT, HDR_WDT, "rgstr mode" ); | |
203 chrNr += sprintf( lnBuf+chrNr, "%*hd", ITM_WDT, | |
204 mmShrdPrm.setPrm[0].regMode ); | |
205 TRACE_EVENT( lnBuf ); | |
206 | |
207 /* --- registration status --------------------------------------*/ | |
208 chrNr = sprintf( lnBuf, "%*.*s", HDR_WDT, HDR_WDT, "rgstr stat" ); | |
209 chrNr += sprintf( lnBuf+chrNr, "%*hd", ITM_WDT, | |
210 mmShrdPrm.regStat ); | |
211 TRACE_EVENT( lnBuf ); | |
212 | |
213 /* --- search result --------------------------------------------*/ | |
214 chrNr = sprintf( lnBuf, "%*.*s", HDR_WDT, HDR_WDT, " srch rslt" ); | |
215 chrNr += sprintf( lnBuf+chrNr, "%*hd", ITM_WDT, | |
216 mmShrdPrm.srchRslt ); | |
217 TRACE_EVENT( lnBuf ); | |
218 | |
219 /* --- de-registration cause ------------------------------------*/ | |
220 chrNr = sprintf( lnBuf, "%*.*s", HDR_WDT, HDR_WDT, "dereg caus" ); | |
221 chrNr += sprintf( lnBuf+chrNr, "%*X", ITM_WDT, | |
222 mmShrdPrm.deregCs ); | |
223 TRACE_EVENT( lnBuf ); | |
224 } | |
225 #endif /* of #ifdef TRACING */ | |
226 | |
227 /*==== EOF ========================================================*/ | |
228 |