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