comparison src/g23m-aci/aci/psa_mmf.c @ 1:fa8dc04885d8

src/g23m-*: import from Magnetite
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 16 Oct 2020 06:25:50 +0000
parents
children
comparison
equal deleted inserted replaced
0:4e78acac3d88 1:fa8dc04885d8
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 = 0xFF;
124 mmShrdPrm.deregCs = 0xFF;
125 mmShrdPrm.usedPLMN.v_plmn = INVLD_PLMN;
126 mmShrdPrm.PLMNLst[0].v_plmn = INVLD_PLMN;
127 mmShrdPrm.owner = (T_OWN)CMD_SRC_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 mmShrdPrm.pnn_read_cnt = 0;
137
138 /* temporary, because of the changes in psaSAT_BuildEnvCC(),
139 this is necessary to pass the ACISAT test cases */
140 #ifdef _SIMULATION_
141 mmShrdPrm.lac = 0x0100;
142 mmShrdPrm.cid = 0x0100;
143 mmShrdPrm.usedPLMN.mcc[0] = 0x02;
144 mmShrdPrm.usedPLMN.mcc[1] = 0x06;
145 mmShrdPrm.usedPLMN.mcc[2] = 0x02;
146 mmShrdPrm.usedPLMN.mnc[0] = 0x00;
147 mmShrdPrm.usedPLMN.mnc[1] = 0x01;
148 mmShrdPrm.usedPLMN.mnc[2] = 0x0F;
149 #endif
150
151 mmShrdPrm.slctPLMN.v_plmn = INVLD_PLMN;
152
153 psaMM_ClrPLMNLst();
154 }
155
156 /*
157 +-------------------------------------------------------------------+
158 | PROJECT : GSM-PS (6147) MODULE : PSA_MMF |
159 | ROUTINE : psaMM_shrPrmDump |
160 +-------------------------------------------------------------------+
161
162 PURPOSE : this function dumps the shared parameter to the debug
163 output.
164 */
165
166 #ifdef TRACING
167 GLOBAL void psaMM_shrPrmDump ( void )
168 {
169 char lnBuf [80]; /* holds buffer for output line */
170 char mccBuf[SIZE_MCC + 1]; /* MCC converted to printable C-string */
171 char mncBuf[SIZE_MNC + 1]; /* MNC converted to printable C-string */
172 SHORT chrNr; /* holds number of processed chars */
173 SHORT cnt; /* holds a counter */
174
175 /* --- PLMN list ------------------------------------------------*/
176 for( cnt = 0; cnt<MAX_PLMN_ID AND
177 mmShrdPrm.PLMNLst[cnt].v_plmn NEQ INVLD_PLMN; cnt++ )
178 {
179 chrNr = sprintf( lnBuf, "%*.*s[%2d]", HDR_WDT, HDR_WDT, " PLMN list",cnt );
180 utl_BCD2String (mccBuf, mmShrdPrm.PLMNLst[cnt].mcc, SIZE_MCC);
181 utl_BCD2String (mncBuf, mmShrdPrm.PLMNLst[cnt].mnc, SIZE_MNC);
182 chrNr += sprintf( lnBuf+chrNr, "%*s %*s",
183 ITM_WDT/2, ITM_WDT/2, mccBuf, mncBuf);
184 TRACE_EVENT( lnBuf );
185 }
186
187 /* --- used PLMN ------------------------------------------------*/
188 chrNr = sprintf( lnBuf, "%*.*s", HDR_WDT, HDR_WDT, " used PLMN" );
189 if( mmShrdPrm.usedPLMN.v_plmn EQ VLD_PLMN )
190 {
191 utl_BCD2String (mccBuf, mmShrdPrm.usedPLMN.mcc, SIZE_MCC);
192 utl_BCD2String (mncBuf, mmShrdPrm.usedPLMN.mnc, SIZE_MNC);
193 chrNr += sprintf( lnBuf+chrNr, "%*s %*s",
194 ITM_WDT/2, ITM_WDT/2, mccBuf, mncBuf);
195 }
196 else
197 {
198 chrNr += sprintf( lnBuf+chrNr, "%*s", ITM_WDT, "none" );
199 }
200 TRACE_EVENT( lnBuf );
201
202 /* --- registration mode ----------------------------------------*/
203 chrNr = sprintf( lnBuf, "%*.*s", HDR_WDT, HDR_WDT, "rgstr mode" );
204 chrNr += sprintf( lnBuf+chrNr, "%*hd", ITM_WDT,
205 mmShrdPrm.setPrm[0].regMode );
206 TRACE_EVENT( lnBuf );
207
208 /* --- registration status --------------------------------------*/
209 chrNr = sprintf( lnBuf, "%*.*s", HDR_WDT, HDR_WDT, "rgstr stat" );
210 chrNr += sprintf( lnBuf+chrNr, "%*hd", ITM_WDT,
211 mmShrdPrm.regStat );
212 TRACE_EVENT( lnBuf );
213
214 /* --- search result --------------------------------------------*/
215 chrNr = sprintf( lnBuf, "%*.*s", HDR_WDT, HDR_WDT, " srch rslt" );
216 chrNr += sprintf( lnBuf+chrNr, "%*hd", ITM_WDT,
217 mmShrdPrm.srchRslt );
218 TRACE_EVENT( lnBuf );
219
220 /* --- de-registration cause ------------------------------------*/
221 chrNr = sprintf( lnBuf, "%*.*s", HDR_WDT, HDR_WDT, "dereg caus" );
222 chrNr += sprintf( lnBuf+chrNr, "%*X", ITM_WDT,
223 mmShrdPrm.deregCs );
224 TRACE_EVENT( lnBuf );
225 }
226 #endif /* of #ifdef TRACING */
227
228 /*==== EOF ========================================================*/
229