comparison src/g23m-aci/aci/psa_mms.c @ 1:d393cd9bb723

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