comparison g23m-aci/aci/psa_mms.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 signalling functions of the
18 | protocol stack adapter for the registration part of
19 | mobility management.
20 +-----------------------------------------------------------------------------
21 */
22
23 #include "config.h"
24 #include "fixedconf.h"
25 #include "condat-features.h"
26 #include "aci_conf.h"
27
28 #if !defined (DTI) || !defined(GPRS)
29
30 #ifndef PSA_MMS_C
31 #define PSA_MMS_C
32 #endif
33
34 #include "aci_all.h"
35 #ifdef DTI
36 #include "dti.h"
37 #include "dti_conn_mng.h"
38 #endif
39 /*==== INCLUDES ===================================================*/
40 #include "aci_cmh.h"
41 #include "ati_cmd.h"
42 #include "aci_cmd.h"
43 #include "aci.h"
44 #include "psa.h"
45 #include "psa_mm.h"
46
47 #include "aci_ext_pers.h"
48 #include "aci_slock.h"
49 #include "cmh.h"
50 #include "psa_sim.h"
51 #include "cmh_sim.h"
52
53 /*==== CONSTANTS ==================================================*/
54
55 /*==== TYPES ======================================================*/
56
57
58 /*==== EXPORT =====================================================*/
59
60
61 /*==== VARIABLES ==================================================*/
62 LOCAL BOOL frstFlg = TRUE; /* flags first attempt */
63
64 /*==== FUNCTIONS ==================================================*/
65
66
67 /*
68 +-------------------------------------------------------------------+
69 | PROJECT : GSM-PS (6147) MODULE : PSA_MMS |
70 | ROUTINE : psaMM_Registrate |
71 +-------------------------------------------------------------------+
72
73 PURPOSE : start network registration
74
75 */
76
77 GLOBAL SHORT psaMM_Registrate ( void )
78 {
79 TRACE_FUNCTION ("psaMM_Registrate()");
80
81
82 /*
83 *-------------------------------------------------------------------
84 * check owner id
85 *-------------------------------------------------------------------
86 */
87 if(!psa_IsVldOwnId(mmShrdPrm.owner))
88
89 return( -1 );
90
91 /*
92 * Set automatic registration mode in MM
93 */
94 psaMM_SetRegMode ( MODE_AUTO );
95
96 /*
97 *-------------------------------------------------------------------
98 * create and send primitive for network registration
99 *-------------------------------------------------------------------
100 */
101 {
102 PALLOC (mmr_reg_req, MMR_REG_REQ);
103 /* mmr_reg_req->service_mode = SERVICE_MODE_FULL; */
104 /* OVK Set proper service mode dependent on Sim lock state */
105 #ifdef SIM_PERS
106 if (AciSLockShrd.blocked EQ TRUE)
107 {
108 mmr_reg_req->service_mode = SERVICE_MODE_LIMITED;
109 }
110 else
111 #endif
112 if (simShrdPrm.imei_blocked EQ TRUE)
113 {
114 mmr_reg_req->service_mode = SERVICE_MODE_LIMITED;
115 }
116 else
117 {
118 mmr_reg_req->service_mode = SERVICE_MODE_FULL;
119 }
120
121
122
123 PSENDX (MM, mmr_reg_req);
124 }
125
126 frstFlg = FALSE;
127 return 0;
128 }
129
130 /*
131 +-------------------------------------------------------------------+
132 | PROJECT : GSM-PS (6147) MODULE : PSA_MMS |
133 | ROUTINE : psaMM_DeRegistrate |
134 +-------------------------------------------------------------------+
135
136 PURPOSE : start network de-registration
137
138 */
139
140 GLOBAL SHORT psaMM_DeRegistrate ( void )
141 {
142
143 TRACE_FUNCTION ("psaMM_DeRegistrate()");
144
145 /*
146 *-------------------------------------------------------------------
147 * create and send primitive for deregistration
148 *-------------------------------------------------------------------
149 */
150 {
151 PALLOC (mmr_nreg_req, MMR_NREG_REQ); /* T_MMR_NREG_REQ */
152
153 mmr_nreg_req->detach_cause = mmShrdPrm.nrgCs;
154
155 PSENDX (MM, mmr_nreg_req);
156 }
157
158 frstFlg = TRUE;
159 return 0;
160 }
161
162 /*
163 +-------------------------------------------------------------------+
164 | PROJECT : GSM-PS (6147) MODULE : PSA_MMS |
165 | ROUTINE : psaMM_NetSrch |
166 +-------------------------------------------------------------------+
167
168 PURPOSE : request network search
169
170 */
171
172 GLOBAL SHORT psaMM_NetSrch ( void )
173 {
174 TRACE_FUNCTION ("psaMM_NetSrch()");
175
176 /*
177 *-------------------------------------------------------------------
178 * check owner id
179 *-------------------------------------------------------------------
180 */
181 if(!psa_IsVldOwnId(mmShrdPrm.owner))
182
183 return( -1 );
184
185 /*
186 * set manual registration mode in MM
187 */
188 psaMM_SetRegMode ( MODE_MAN );
189
190 /*
191 *-------------------------------------------------------------------
192 * create and send primitive for network search
193 *-------------------------------------------------------------------
194 */
195 if( frstFlg EQ TRUE
196 #ifdef FF_DUAL_SIM
197 AND CFUNfun EQ CFUN_FUN_Full
198 #endif /*FF_DUAL_SIM*/
199 )
200 {
201 PALLOC (mmr_reg_req, MMR_REG_REQ);
202 mmr_reg_req->service_mode = SERVICE_MODE_FULL;
203 PSENDX (MM, mmr_reg_req);
204 frstFlg = FALSE;
205 }
206 else
207 {
208 PALLOC (mmr_net_req, MMR_NET_REQ);
209 PSENDX (MM, mmr_net_req);
210 frstFlg = FALSE;
211 }
212
213 return 0;
214 }
215
216 /*
217 +-------------------------------------------------------------------+
218 | PROJECT : GSM-PS (6147) MODULE : PSA_MMS |
219 | ROUTINE : psaMM_NetSel |
220 +-------------------------------------------------------------------+
221
222 PURPOSE : select a network
223
224 */
225
226 GLOBAL SHORT psaMM_NetSel ( void )
227 {
228 TRACE_FUNCTION ("psaMM_NetSel()");
229
230 /*
231 *-------------------------------------------------------------------
232 * check owner id
233 *-------------------------------------------------------------------
234 */
235 if(!psa_IsVldOwnId(mmShrdPrm.owner))
236
237 return( -1 );
238
239 /*
240 * set manual registration mode in MM
241 */
242 psaMM_SetRegMode ( MODE_MAN );
243
244 /*
245 *-------------------------------------------------------------------
246 * create and send primitive for network select
247 *-------------------------------------------------------------------
248 */
249 {
250 PALLOC (mmr_plmn_res, MMR_PLMN_RES);
251
252 /* fill in primitive parameter: selected PLMN */
253 mmr_plmn_res -> plmn = mmShrdPrm.slctPLMN;
254
255 PSENDX (MM, mmr_plmn_res);
256 }
257
258 frstFlg = FALSE;
259
260 return 0;
261 }
262
263 /*
264 +-------------------------------------------------------------------+
265 | PROJECT : GSM-PS (6147) MODULE : PSA_MMS |
266 | ROUTINE : psaMM_SetRegMode |
267 +-------------------------------------------------------------------+
268
269 PURPOSE : set the registration mode
270
271 */
272
273 GLOBAL SHORT psaMM_SetRegMode ( UBYTE mode )
274 {
275 TRACE_FUNCTION ("psaMM_SetRegMode()");
276
277 /*
278 *-------------------------------------------------------------------
279 * create and send primitive for registration mode
280 *-------------------------------------------------------------------
281 */
282 {
283 PALLOC (mmr_plmn_mode_req, MMR_PLMN_MODE_REQ); /* T_MMR_PLMN_MODE_REQ */
284 mmr_plmn_mode_req -> mode = mode;
285 PSENDX (MM, mmr_plmn_mode_req);
286 }
287
288 return 0;
289 }
290 #endif /* DTI */
291
292 /*==== EOF ========================================================*/
293