FreeCalypso > hg > fc-tourmaline
comparison src/g23m-gprs/grr/grr_psip.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 : GPRS (8441) | |
4 | Modul : GRR | |
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 implements primitive handler functions for service | |
18 | PSI of entity GRR. | |
19 +----------------------------------------------------------------------------- | |
20 */ | |
21 | |
22 #ifndef GRR_PSIP_C | |
23 #define GRR_PSIP_C | |
24 #endif | |
25 | |
26 #define ENTITY_GRR | |
27 | |
28 /*==== INCLUDES =============================================================*/ | |
29 | |
30 #include "typedefs.h" /* to get Condat data types */ | |
31 #include <string.h> | |
32 | |
33 #include "vsi.h" /* to get a lot of macros */ | |
34 #include "macdef.h" | |
35 #include "gprs.h" | |
36 #include "gsm.h" /* to get a lot of macros */ | |
37 #include "ccdapi.h" /* to get CCD API */ | |
38 #include "cnf_grr.h" /* to get cnf-definitions */ | |
39 #include "mon_grr.h" /* to get mon-definitions */ | |
40 #include "prim.h" /* to get the definitions of used SAP and directions */ | |
41 #include "message.h" | |
42 #include "grr.h" /* to get the global entity definitions */ | |
43 | |
44 #include "grr_f.h" /* */ | |
45 | |
46 #include "grr_psip.h" /* header file of primitives*/ | |
47 | |
48 #include "grr_psif.h" /* header file of functions*/ | |
49 | |
50 #include "grr_meass.h" /* signals exchanged between PSI and MEAS*/ | |
51 #include "grr_ctrls.h" /* header file of functions*/ | |
52 | |
53 /*==== CONST ================================================================*/ | |
54 | |
55 /*==== LOCAL VARS ===========================================================*/ | |
56 | |
57 /*==== PRIVATE FUNCTIONS ====================================================*/ | |
58 | |
59 /*==== PUBLIC FUNCTIONS =====================================================*/ | |
60 | |
61 | |
62 | |
63 /* | |
64 +------------------------------------------------------------------------------ | |
65 | Function : psi_t_60_sec | |
66 +------------------------------------------------------------------------------ | |
67 | Description : Handles the primitive T_60_SEC | |
68 | | |
69 | Parameters : void | |
70 | | |
71 +------------------------------------------------------------------------------ | |
72 */ | |
73 GLOBAL void psi_t_60_sec ( void ) | |
74 { | |
75 TRACE_FUNCTION( "t_60_sec" ); | |
76 | |
77 #ifndef _TARGET_ | |
78 | |
79 /* | |
80 * No PSI1 or PSI13 or SI13 received within 60 sec | |
81 * This will result in a cell reselection | |
82 */ | |
83 TRACE_EVENT( "No PSI1 or PSI13 or SI13 received within 60 sec" ); | |
84 | |
85 sig_psi_ctrl_psi1or_psi13_receiption_failure(); | |
86 | |
87 #else /* #ifndef _TARGET_ */ | |
88 | |
89 TRACE_EVENT( "Processing timeout of T_60_SEC disabled on target" ); | |
90 | |
91 #endif /* #ifndef _TARGET_ */ | |
92 | |
93 } /* psi_t_60_sec() */ | |
94 | |
95 | |
96 | |
97 /* | |
98 +------------------------------------------------------------------------------ | |
99 | Function : psi_t_30_sec | |
100 +------------------------------------------------------------------------------ | |
101 | Description : Handles the primitive T_30_SEC | |
102 | | |
103 | Parameters : void | |
104 | | |
105 +------------------------------------------------------------------------------ | |
106 */ | |
107 GLOBAL void psi_t_30_sec ( void) | |
108 { | |
109 TRACE_FUNCTION( "t_30_sec" ); | |
110 | |
111 /*#ifndef _TARGET_*/ | |
112 /* | |
113 * No PSI1 received within 30 sec | |
114 */ | |
115 | |
116 switch( GET_STATE( PSI ) ) | |
117 { | |
118 case PSI_TRANSFER: | |
119 if(grr_data->test_mode NEQ CGRLC_NO_TEST_MODE) | |
120 { | |
121 psi_start_30sec(); | |
122 TRACE_EVENT( "T_30_SEC received during test mode" ); | |
123 break; | |
124 } | |
125 /*lint -fallthrough*/ | |
126 case PSI_IDLE: | |
127 /* | |
128 If the mobile station has not received the PSI1 message within the last 30 seconds, | |
129 it shall attempt to receive the PSI1 message each time it is scheduled on PBCCH. | |
130 Such attempts shall be made during both packet idle and packet transfer modes. | |
131 */ | |
132 switch(psc_db->acq_type) | |
133 { | |
134 case NONE: | |
135 psc_db->acq_type = PERIODICAL_PSI1_READING; | |
136 psi_receive_psi(READ_PSI1_IN_PSI1_REPEAT_PERIODS); | |
137 break; | |
138 default: | |
139 /* | |
140 * Access to the network not allowed or complete PSI | |
141 * has not been read. Nothing to do. Acquisition is running | |
142 */ | |
143 TRACE_EVENT("PSI not complete/ access not allowed"); | |
144 break; | |
145 } | |
146 break; | |
147 case PSI_BCCH_TRANSFER: | |
148 if(grr_data->test_mode NEQ CGRLC_NO_TEST_MODE) | |
149 { | |
150 psi_start_30sec(); | |
151 TRACE_EVENT( "T_30_SEC received during test mode" ); | |
152 break; | |
153 } | |
154 /*lint -fallthrough*/ | |
155 case PSI_BCCH_IDLE: | |
156 /* | |
157 If the mobile station has received neither the SI13 nor the PSI13 message within | |
158 the last 30 seconds, it shall attempt to receive the SI13 message each time it is | |
159 scheduled on BCCH. Such attempts shall be made during both packet idle and packet | |
160 transfer modes. | |
161 */ | |
162 switch(psc_db->acq_type) | |
163 { | |
164 case NONE: | |
165 psc_db->acq_type = PERIODICAL_SI13_READING; | |
166 sig_psi_ctrl_read_si( UPDATE_SI13 ); | |
167 break; | |
168 default: | |
169 /* | |
170 * Access to the network not allowed or complete SI | |
171 * has not been read. Nothing to do. Acquisition is running | |
172 */ | |
173 TRACE_EVENT("SI not complete/ access not allowed"); | |
174 break; | |
175 } | |
176 break; | |
177 default: | |
178 TRACE_ERROR( "T_30_SEC unexpected" ); | |
179 break; | |
180 } | |
181 /*#endif*/ | |
182 } /* psi_t_30_sec() */ | |
183 | |
184 | |
185 | |
186 /* | |
187 +------------------------------------------------------------------------------ | |
188 | Function : psi_t_10_sec | |
189 +------------------------------------------------------------------------------ | |
190 | Description : Handles the primitive T_10_SEC | |
191 | | |
192 | Parameters : void | |
193 | | |
194 +------------------------------------------------------------------------------ | |
195 */ | |
196 GLOBAL void psi_t_10_sec ( void ) | |
197 { | |
198 TRACE_FUNCTION( "t_10_sec" ); | |
199 /* | |
200 * partial or complete acq has not completed within 10 seconds | |
201 */ | |
202 /*#ifndef _TARGET_*/ | |
203 | |
204 if( grr_t_status( T3174 ) > 0 ) | |
205 { | |
206 TRACE_EVENT( "psi_t_10_sec expired when t3174 is running" ); | |
207 return; | |
208 } | |
209 | |
210 switch( GET_STATE( PSI ) ) | |
211 { | |
212 case PSI_IDLE: | |
213 case PSI_TRANSFER: | |
214 psi_stop_10sec(); | |
215 /* If the mobile station has not received the required messages within 10 seconds | |
216 * after the start of the acquisition procedure, an attempt to receive a missing message | |
217 * shall be made each time the message is scheduled on the broadcast channel. | |
218 * This case should not happen -except the network goes down. Reason: | |
219 * in case of partial or complete acquisition we read all required (P)SI messages | |
220 * each time the message is scheduled on the broadcast channel. Our reading process | |
221 * continues until the 60 second expires or we receive the required messages. | |
222 * If the 60 second timer expires we should perform a cell selection | |
223 */ | |
224 psi_update_data_to_request(INIT_NOT_NEEDED ); | |
225 switch(psc_db->acq_type) | |
226 { | |
227 case COMPLETE: | |
228 psi_complete_acq(COMPLETE); | |
229 break; | |
230 case PARTIAL: | |
231 psi_partial_acq(); | |
232 psc_db->send_psi_status = TRUE; /* this parameters has meaning if the network supports PSI STATUS */ | |
233 break; | |
234 default: | |
235 TRACE_ERROR("Unknown acq_type in T_10_sec (PBCCH)"); | |
236 break; | |
237 } | |
238 break; | |
239 case PSI_BCCH_IDLE: | |
240 case PSI_BCCH_TRANSFER: | |
241 psi_stop_10sec(); | |
242 /* Please see comment above */ | |
243 switch(psc_db->acq_type) | |
244 { | |
245 case COMPLETE: | |
246 sig_psi_ctrl_read_si(COMPLETE_SI); | |
247 break; | |
248 case PARTIAL: | |
249 sig_psi_ctrl_read_si(psc_db->si_to_acquire); | |
250 break; | |
251 default: | |
252 TRACE_ERROR("Unknown acq_type in T_10_sec (BCCH)"); | |
253 break; | |
254 } | |
255 break; | |
256 default: | |
257 TRACE_ERROR( "T_10_SEC unexpected" ); | |
258 break; | |
259 | |
260 } | |
261 /*#endif*/ | |
262 } /* psi_t_10_sec() */ | |
263 | |
264 | |
265 | |
266 | |
267 | |
268 | |
269 | |
270 | |
271 | |
272 | |
273 | |
274 | |
275 | |
276 | |
277 | |
278 | |
279 | |
280 | |
281 | |
282 | |
283 | |
284 | |
285 | |
286 | |
287 /* | |
288 +------------------------------------------------------------------------------ | |
289 | Function : psi_complete_psi_read_failed | |
290 +------------------------------------------------------------------------------ | |
291 | Description : Handles the primitive PSI_COMPLETE_PSI_READ_FAILED | |
292 | | |
293 | Parameters : void | |
294 | | |
295 +------------------------------------------------------------------------------ | |
296 */ | |
297 GLOBAL void psi_complete_psi_read_failed ( void ) | |
298 { | |
299 TRACE_FUNCTION( "psi_complete_psi_read_failed" ); | |
300 /* | |
301 * reading of complete PSI within 10 sec failed | |
302 * Stop PBCCH reading if running, | |
303 * Inform CTRL, cell reselection should be performed | |
304 */ | |
305 TRACE_EVENT("reading of complete PSI within 10 sec failed"); | |
306 | |
307 if( grr_t_status( T3174 ) > 0 ) | |
308 { | |
309 TRACE_EVENT( "psi_complete_psi expired when t3174 is running" ); | |
310 return; | |
311 } | |
312 | |
313 SET_STATE( PSI, PSI_NULL ); | |
314 if(psc_db->acq_type NEQ NONE) /* acquisition has been running, so we have to stop this acq.*/ | |
315 { | |
316 TRACE_EVENT("psi_stop_psi_reading"); | |
317 psi_stop_psi_reading(NONE); | |
318 } | |
319 | |
320 psi_stop_timer(); | |
321 psi_reset_all(); | |
322 /* | |
323 * Perform CR | |
324 */ | |
325 sig_psi_ctrl_psi1or_psi13_receiption_failure(); | |
326 | |
327 } /* psi_complete_psi_read_failed() */ |