comparison src/g23m-gprs/gmm/gmm_rdyp.c @ 183:219afcfc6250

src/g23m-gprs: initial import from TCS3.2/LoCosto
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 13 Oct 2016 04:24:13 +0000
parents
children
comparison
equal deleted inserted replaced
182:f02d0a0e1849 183:219afcfc6250
1 /*
2 +-----------------------------------------------------------------------------
3 | Project : GPRS (8441)
4 | Modul : gmm_rdyp.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 primitives as described in
19 | the SDL-documentation (RDY-statemachine)
20 +-----------------------------------------------------------------------------
21 */
22
23
24 #ifndef GMM_RDYP_C
25 #define GMM_RDYP_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_kerns.h" /* to get signals */
44 #include "gmm_kernp.h" /* to get timer functions from KERN */
45 #include "gmm_kernf.h" /* to get functions from KERN */
46 #include "gmm_rdyf.h"
47
48 /*==== CONST ================================================================*/
49
50 /*==== LOCAL VARS ===========================================================*/
51
52 /*==== PRIVATE FUNCTIONS ====================================================*/
53
54 /*==== PUBLIC FUNCTIONS =====================================================*/
55
56
57 /*
58 +------------------------------------------------------------------------------
59 | Function : rdy_cgrlc_standby_state_ind
60 +------------------------------------------------------------------------------
61 | Description : Handles the primitive CGRLC_STANDBY_STATE_IND (TCS 2.1).
62 |
63 | TIMEOUT for READY´TIMER
64 |
65 | MSC: 3.17 Timer
66 | MSC: 3.17.4 T3314 time-out
67 |
68 | Parameters : *cgrlc_standby_state_ind - Ptr to primitive payload (TCS 2.1)
69 |
70 +------------------------------------------------------------------------------
71 */
72 GLOBAL void rdy_cgrlc_standby_state_ind (const T_CGRLC_STANDBY_STATE_IND *cgrlc_standby_state_ind)
73 {
74 GMM_TRACE_FUNCTION( "rdy_cgrlc_standby_state_ind" );
75 switch( GET_STATE( RDY ) )
76 {
77 default:
78 /*
79 * <R.GMM.READYTIM.M.020>
80 */
81 rdy_start_t3312();
82
83 SET_STATE ( RDY, RDY_STANDBY );
84
85 break;
86 case RDY_DEACTIVATED:
87 case RDY_STANDBY_TWICE:
88 break;
89 }
90
91 PFREE(cgrlc_standby_state_ind);
92 GMM_RETURN;
93 } /* rdy_cgrlc_standby_state_ind */
94
95
96 /*
97 +------------------------------------------------------------------------------
98 | Function : rdy_cgrlc_trigger_ind (TCS 2.1)
99 +------------------------------------------------------------------------------
100 | Description : Handles the primitive CGRLC_TRIGGER_IND (TCS 2.1)
101 |
102 | Start of the READY TIMER
103 |
104 | <R.GMM.READYTIM.M.009>
105 |
106 | Parameters : *cgrlc_trigger_ind - Ptr to primitive payload (TCS 2.1)
107 |
108 +------------------------------------------------------------------------------
109 */
110 GLOBAL void rdy_cgrlc_trigger_ind ( T_CGRLC_TRIGGER_IND *cgrlc_trigger_ind ) /* TCS 2.1 */
111 {
112 USHORT timer;
113 BOOL stop_timer=FALSE;
114 GMM_TRACE_FUNCTION( "rdy_cgrlc_trigger_ind" ); /* TCS 2.1 */
115
116 if (CGRLC_PRIM_TYPE_GMM==cgrlc_trigger_ind->prim_type) /* TCS 2.1 */
117 {
118 for ( timer=0;timer<TIMER_MAX;timer++)
119 {
120 if (gmm_data->rdy.timer_value[timer]>0)
121 {
122 T_TIME value=0;
123 if ( VSI_OK == vsi_t_status ( GMM_handle ,timer, &value )
124 && value >0 )
125 /*
126 * react only if timer has not stopped
127 */
128 {
129 TRACE_1_INFO ("value of Timer %d: %d", timer);
130 switch (timer)
131 {
132 case kern_TPOWER_OFF:
133 vsi_t_stop ( GMM_handle, kern_TPOWER_OFF);
134 kern_tpower_off();
135 stop_timer=TRUE;
136 break;
137 case kern_TLOCAL_DETACH:
138 vsi_t_stop ( GMM_handle, kern_TLOCAL_DETACH);
139 kern_tlocal_detach();
140 stop_timer=TRUE;
141 break;
142 default:
143 TRACE_1_INFO ( "START: TIMER %d" ,timer);
144 vsi_t_start ( GMM_handle ,
145 timer,
146 gmm_data->rdy.timer_value[timer]);
147 break;
148 }
149 gmm_data->rdy.timer_value[timer]=0;
150 }
151 }
152 else
153 {
154 gmm_data->rdy.timer_value[timer]=0;
155 }
156 }
157 }
158
159 /*
160 * As RR will inform MM about ongoing PS transfer using RR_ABORT_IND, no need
161 * to notify MM using this mmgmm_trigger_req primitive
162 */
163
164 switch( GET_STATE( RDY ) )
165 {
166 case RDY_READY:
167 vsi_t_stop (GMM_handle, rdy_T3312);
168 if (stop_timer)
169 {
170 SET_STATE (RDY, RDY_STANDBY );
171 }
172 break;
173 case RDY_STANDBY_TWICE:
174 SET_STATE(RDY,RDY_STANDBY);
175 {
176 PALLOC (cgrlc_force_to_standby_req, CGRLC_FORCE_TO_STANDBY_REQ);
177 PSEND ( hCommGRLC, cgrlc_force_to_standby_req );
178 }
179 break;
180 case RDY_STANDBY:
181 {
182 vsi_t_stop (GMM_handle, rdy_T3312);
183 if (stop_timer)
184 {
185 SET_STATE (RDY, RDY_STANDBY );
186 }
187 else
188 {
189 SET_STATE ( RDY, RDY_READY );
190 }
191 break;
192 }
193 case RDY_DEACTIVATED:
194 break;
195 default:
196 TRACE_ERROR( "CGRLC_TRIGGER_IND unexpected" ); /* TCS 2.1 */
197 break;
198 }
199
200 PFREE(cgrlc_trigger_ind);
201 GMM_RETURN;
202 } /* rdy_cgrlc_trigger_ind() */ /* TCS 2.1 */
203
204
205 /*
206 +------------------------------------------------------------------------------
207 | Function : rdy_cgrlc_ready_state_ind (TCS 2.1)
208 +------------------------------------------------------------------------------
209 | Description : Handles the primitive CGRLC_READY_STATE_IND (TCS 2.1)
210 |
211 | Start of the READY TIMER
212 |
213 |
214 |
215 | Parameters : *cgrlc_ready_state_ind - Ptr to primitive payload (TCS 2.1)
216 |
217 +------------------------------------------------------------------------------
218 */
219 GLOBAL void rdy_cgrlc_ready_state_ind ( const T_CGRLC_READY_STATE_IND *cgrlc_ready_state_ind ) /* TCS 2.1 */
220 {
221 GMM_TRACE_FUNCTION( "rdy_cgrlc_ready_state_ind" ); /* TCS 2.1 */
222
223 switch( GET_STATE( RDY ) )
224 {
225 case RDY_READY:
226 vsi_t_stop (GMM_handle, rdy_T3312);
227 break;
228 case RDY_STANDBY:
229 vsi_t_stop (GMM_handle, rdy_T3312);
230 SET_STATE ( RDY, RDY_READY );
231 break;
232 case RDY_DEACTIVATED:
233 case RDY_STANDBY_TWICE:
234 break;
235 default:
236 TRACE_ERROR( "CGRLC_READY_STATE_IND unexpected" ); /* TCS 2.1 */
237 break;
238
239 }
240
241 PFREE(cgrlc_ready_state_ind);
242 GMM_RETURN;
243 } /* rdy_cgrlc_ready_state_ind() */ /* TCS 2.1 */