comparison src/g23m-gprs/gmm/gmm_rdys.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 : gmm_rdys.c
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 modul is part of the entity GMM and implements all
18 | functions to handles the incoming process internal signals as
19 | described in the SDL-documentation (RDY-statemachine)
20 +-----------------------------------------------------------------------------
21 */
22
23
24 #ifndef GMM_RDYS_C
25 #define GMM_RDYS_C
26 #endif
27
28 #define ENTITY_GMM
29
30 /*==== INCLUDES =============================================================*/
31
32 #include "typedefs.h" /* to get Condat data types */
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_gmm.h" /* to get cnf-definitions */
39 #include "mon_gmm.h" /* to get mon-definitions */
40 #include "prim.h" /* to get the definitions of used SAP and directions */
41 #include "gmm.h" /* to get the global entity definitions */
42
43 #include "gmm_rdyf.h"
44 #include "gmm_kerns.h"
45
46 /*==== CONST ================================================================*/
47
48 /*==== LOCAL VARS ===========================================================*/
49
50 /*==== PRIVATE FUNCTIONS ====================================================*/
51
52 /*==== PUBLIC FUNCTIONS =====================================================*/
53
54
55
56 /*
57 +------------------------------------------------------------------------------
58 | Function : sig_kern_rdy_force_ie_req
59 +------------------------------------------------------------------------------
60 | Description : Handles the internal signal SIG_KERN_RDY_FORCE_IE_REQ
61 |
62 | Parameters : force_to_standby - parameter from the AIR message
63 |
64 +------------------------------------------------------------------------------
65 */
66 GLOBAL void sig_kern_rdy_force_ie_req ( UBYTE force_to_standby, BOOL
67 attach_complete )
68 {
69 TRACE_ISIG( "sig_kern_rdy_force_ie_req" );
70
71 switch( GET_STATE( RDY ) )
72 {
73 case RDY_READY:
74 case RDY_STANDBY_TWICE:
75 case RDY_STANDBY:
76 if ( force_to_standby == STANDBY_YES )
77 /*
78 * force to standby
79 */
80 {
81 /*
82 * Start RAU STANDBY TIMER T3312
83 * <R.GMM.RAUTIMER.M.005>, <R.GMM.READYTIM.M.012>
84 */
85 rdy_start_t3312();
86 if (attach_complete)
87 {
88 SET_STATE(RDY,RDY_STANDBY_TWICE)
89 }
90 else
91 {
92 SET_STATE ( RDY, RDY_STANDBY );
93 }
94 {
95 /* Instead of sending GMMRR_STANDBY_REQ primitive send
96 * CGRLC_FORCE_TO_STANDBY_REQ primitive. GRLC will take
97 * care for GRR standby
98 */
99 PALLOC (cgrlc_force_to_standby_req,CGRLC_FORCE_TO_STANDBY_REQ);
100 PSEND ( hCommGRLC, cgrlc_force_to_standby_req );
101 }
102 }
103 else
104 /*
105 * not force to standby
106 */
107 {
108 /*
109 * The state is kept
110 * SET_STATE ( - )
111 */
112 } /* force to standby? */
113 break;
114 case RDY_DEACTIVATED:
115 /*
116 * The state is not changed
117 * SET_STATE ( - );
118 */
119 if ( force_to_standby == STANDBY_YES )
120 /*
121 * force to standby
122 */
123 {
124 /*
125 * Allocate CGRLC_FORCE_TO_STANDBY_REQ primitive
126 */
127 PALLOC (cgrlc_force_to_standby_req,CGRLC_FORCE_TO_STANDBY_REQ);
128 PSEND ( hCommGRLC, cgrlc_force_to_standby_req );
129 }
130
131 break;
132 default:
133 TRACE_ERROR( "SIG_KERN_RDY_FORCE_IE_REQ unexpected" );
134 break;
135 }
136 } /* sig_kern_rdy_force_ie_req() */
137
138 /*
139 +------------------------------------------------------------------------------
140 | Function : sig_kern_rdy_start_t3312_req
141 +------------------------------------------------------------------------------
142 | Description : Handles the internal signal SIG_KERN_RDY_START_T3312_REQ
143 |
144 | Parameters : void
145 |
146 +------------------------------------------------------------------------------
147 */
148 GLOBAL void sig_kern_rdy_start_t3312_req ( void )
149 {
150 TRACE_ISIG( "sig_kern_rdy_start_t3312_req" );
151
152 switch( GET_STATE( RDY ) )
153 {
154 case RDY_DEACTIVATED:
155 /*
156 * <R.GMM.RAUTIMER.M021>
157 */
158 rdy_start_t3312();
159 break;
160 default:
161 break;
162 }
163 } /* sig_kern_rdy_start_t3312() */
164 /*
165 +------------------------------------------------------------------------------
166 | Function : sig_kern_rdy_cu_req
167 +------------------------------------------------------------------------------
168 | Description : Handles the internal signal SIG_KERN_RDY_CU_REQ
169 |
170 | Parameters : void
171 |
172 +------------------------------------------------------------------------------
173 */
174 GLOBAL void sig_kern_rdy_cu_req ( void )
175 {
176 TRACE_ISIG( "sig_kern_rdy_cu_req" );
177
178 switch( GET_STATE( RDY ) )
179 {
180 case RDY_READY:
181 case RDY_DEACTIVATED:
182 /*
183 * This message is used to initiated the initial cell update
184 *
185 * <R.GMM.READYTIM.M.002>
186 * <R.GMM.READYTIM.M.003>
187 * <R.GMM.READYTIM.M.025>
188 * <R.GMM.READYTIM.M.026>
189 */
190 sig_rdy_kern_cu_ind();
191 TRACE_EVENT("CU");
192 vsi_o_ttrace(VSI_CALLER TC_USER4, "CELL UPDATE");
193 break;
194 default:
195 /*
196 * if the READY timer has expired MS shall not perform
197 * the cell updating procedure when a new cell is selected
198 *
199 * <R.GMM.READYTIM.M.005>
200 */
201
202 break;
203 }
204 } /* sig_kern_rdy_cu_req() */
205
206
207 /*
208 +------------------------------------------------------------------------------
209 | Function : sig_kern_rdy_t3314_req
210 +------------------------------------------------------------------------------
211 | Description : Handles the internal signal SIG_KERN_RDY_T3314_REQ
212 | This procedure handels the negotiated ready timer comming
213 | from the ATTACH_ACCEPT and RAU_ACCEPT message
214 |
215 | MSC: 3.17 Timer
216 | MSC: 3.17.6 READY timer behaviour
217 |
218 | Parameters : v_ptmsi - flag from AIR message if PTMSI was negotiated
219 | v_ready_timer - flag from AIR message if T3314 was negotiated
220 | ready_timer - ready_timer struct from AIR message with time
221 | unit and value of the negotiated T3314
222 |
223 +------------------------------------------------------------------------------
224 */
225 GLOBAL void sig_kern_rdy_t3314_req ( BOOL v_ptmsi, BOOL v_ready_timer,
226 T_ready_timer *p_ready_timer,
227 T_rau_timer *rau_timer,
228 BOOL attach_complete )
229 {
230 TRACE_ISIG( "sig_kern_rdy_t3314_req" );
231
232 if (TIMER_DEACT == rau_timer->timer_unit)
233 {
234 gmm_data->rdy.t3312_deactivated = TRUE;
235 }
236 else
237 {
238 gmm_data->rdy.t3312_deactivated = FALSE;
239 gmm_data->rdy.t3312_val = rdy_get_timer ( rau_timer );
240 }
241
242 if (!v_ready_timer)
243 {
244 return;
245 }
246 /*
247 * <R.GMM.READYTIM.A.023>
248 */
249 if ( TIMER_DEACT == p_ready_timer->timer_unit )
250 {
251 rdy_cgrlc_ready_timer_config_req (CGRLC_DEACTIVATED) ;
252 SET_STATE ( RDY, RDY_DEACTIVATED );
253 }
254 else /* if ( p_ready_timer->timer_unit != TIMER_DEACT ) */
255 {
256 /*
257 * The value for READY TIMER T3314 is set with data from AIR
258 */
259 ULONG ready_timer = rdy_get_timer ( (T_rau_timer *)p_ready_timer );
260 /*
261 * changed due t ericsson IOT. I hope that ANITE and R&S will accept this
262 *
263 * BOOL read_timer_changed = (ready_timer!=gmm_data->rdy.t3314_val);
264 */
265 /* BOOL read_timer_negtiated = v_ready_timer; */
266
267 gmm_data->rdy.t3314_val = ready_timer;
268 rdy_cgrlc_ready_timer_config_req (gmm_data->rdy.t3314_val) ;
269
270 switch( GET_STATE( RDY ) )
271 {
272 /*
273 * LABEL READY_CONTINUE
274 */
275 case RDY_READY:
276 /*
277 * LABEL STANDBY_CONTINUE
278 */
279 case RDY_STANDBY_TWICE:
280 case RDY_STANDBY:
281
282 if ( p_ready_timer->timer_value == 0 )
283 {
284 /*
285 * <R.GMM.READYTIM.A.024>
286 */
287 rdy_start_t3312();
288 if (attach_complete)
289 {
290 SET_STATE(RDY,RDY_STANDBY_TWICE)
291 }
292 else
293 {
294 SET_STATE ( RDY, RDY_STANDBY );
295 }
296 {
297 PALLOC (cgrlc_force_to_standby_req, CGRLC_FORCE_TO_STANDBY_REQ);
298 PSEND ( hCommGRLC, cgrlc_force_to_standby_req );
299 }
300 }
301 else /* if ( p_ready_timer->timer_value != 0 ) */
302 {
303 /*
304 * v_ptmsi is an indicator for ready_timer negotiation
305 * this decision is here, because the cu will be triggered in
306 * service KERNEL by the ACCEPT message
307 */
308 if ( /*read_timer_negtiated &&*/ (GET_STATE( RDY ) == RDY_READY) && !v_ptmsi )
309 {
310 /*
311 * This message is used to initiated the initial cell update
312 *
313 * <R.GMM.READYTIM.M.025>
314 * <R.GMM.READYTIM.M.026>
315 */
316 /*
317 PALLOC (llgmm_trigger_req, LLGMM_TRIGGER_REQ);
318 llgmm_trigger_req->trigger_cause = LLGMM_TRICS_CELL_UPDATE;
319
320 PSEND ( hCommLLC, llgmm_trigger_req );
321 */
322 sig_rdy_kern_cu_ind();
323 TRACE_EVENT ("TRIGGER_REQ because of ready timer neg");
324 }
325 }
326 break;
327 case RDY_DEACTIVATED:
328 /*
329 * I think, that the new state should be READY, because there is
330 * no other way to leave the state DEACTIVATED
331 *
332 * <R.GMM.READYTIM.A.025>
333 */
334 SET_STATE ( RDY, RDY_READY );
335 break;
336 default:
337 TRACE_ERROR( "SIG_KERN_RDY_T3314_REQ unexpected" );
338 break;
339 }
340 }
341 } /* sig_kern_rdy_t3314_req() */
342
343
344 /*
345 +------------------------------------------------------------------------------
346 | Function : sig_kern_rdy_start_t3302_req
347 +------------------------------------------------------------------------------
348 | Description : Handles the internal signal SIG_KERN_RDY_START_T3302_REQ
349 | This signal let the timer T3312 not be startet in state
350 | attampting to update
351 |
352 | Parameters : void
353 |
354 +------------------------------------------------------------------------------
355 */
356 GLOBAL void sig_kern_rdy_start_t3302_req ( void )
357 {
358 TRACE_ISIG( "sig_kern_rdy_start_t3302_req" );
359 gmm_data->rdy.attempting_to_update = TRUE;
360 } /* sig_kern_rdy_start_t3302_req() */
361
362 /*
363 +------------------------------------------------------------------------------
364 | Function : sig_kern_rdy_stop_t3302_req
365 +------------------------------------------------------------------------------
366 | Description : Handles the internal signal SIG_KERN_RDY_STOP_T3302_REQ
367 | This signal let the timer T3312 not be startet in state
368 | attampting to update
369 |
370 | Parameters : void
371 |
372 +------------------------------------------------------------------------------
373 */
374 GLOBAL void sig_kern_rdy_stop_t3302_req ( void )
375 {
376 TRACE_ISIG( "sig_kern_rdy_stop_t3302_req" );
377 gmm_data->rdy.attempting_to_update = FALSE;
378 } /* sig_kern_rdy_start_t3302_req */
379
380 /*
381 +------------------------------------------------------------------------------
382 | Function : sig_kern_rdy_start_timer_req
383 +------------------------------------------------------------------------------
384 | Description : Handles the internal signal SIG_KERN_RDY_START_TIMER_REQ
385 | This signal ask rdy to start the passed timer with given value
386 | on reception of GMMRR_TRIGGER_REQ
387 |
388 | Parameters : UBYTE timer - timer
389 | ULONG value - timeout value
390 |
391 +------------------------------------------------------------------------------
392 */
393 GLOBAL void sig_kern_rdy_start_timer_req ( UBYTE timer, ULONG value )
394 {
395 TRACE_ISIG( "sig_kern_rdy_start_timer_req" );
396 TRACE_2_INFO ("START TIMER %d: %dsec",timer, (ULONG) (value/1000) );
397 gmm_data->rdy.timer_value[timer] = value;
398 vsi_t_start ( GMM_handle , timer, value);
399 return;
400 } /* sig_kern_rdy_start_timer_req */
401
402