comparison src/g23m-gprs/grlc/grlc_rup.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 : GPRS (8441)
4 | Modul : grlc
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 | RU of entity GRLC.
19 +-----------------------------------------------------------------------------
20 */
21
22 #ifndef GRLC_RUP_C
23 #define GRLC_RUP_C
24 #endif
25
26 #define ENTITY_GRLC
27
28
29
30
31 /*==== INCLUDES =============================================================*/
32
33 #include <stdio.h>
34 #include <string.h>
35 #include "typedefs.h" /* to get Condat data types */
36 #include "vsi.h" /* to get a lot of macros */
37 #include "macdef.h"
38 #include "gprs.h"
39 #include "gsm.h" /* to get a lot of macros */
40 #include "ccdapi.h" /* to get CCD API */
41 #include "cnf_grlc.h" /* to get cnf-definitions */
42 #include "mon_grlc.h" /* to get mon-definitions */
43 #include "prim.h" /* to get the definitions of used SAP and directions */
44 #include "message.h"
45 #include "grlc.h" /* to get the global entity definitions */
46 #include "grlc_f.h"
47 #include "grlc_ruf.h"
48 #include "grlc_tms.h"
49
50 /*==== CONST ================================================================*/
51
52 /*==== LOCAL VARS ===========================================================*/
53
54 /*==== PRIVATE FUNCTIONS ====================================================*/
55
56 /*==== PUBLIC FUNCTIONS =====================================================*/
57
58 /*
59 +------------------------------------------------------------------------------
60 | Function : ru_t3164
61 +------------------------------------------------------------------------------
62 | Description : Handles the primitive T3164
63 |
64 | Parameters : *t3164 - Ptr to primitive payload
65 |
66 +------------------------------------------------------------------------------
67 */
68 GLOBAL void ru_t3164 ( void )
69 {
70 TRACE_FUNCTION( "t3164" );
71
72
73 switch( GET_STATE( RU ) )
74 {
75 case RU_ACK:
76 case RU_REL_ACK:
77 case RU_UACK:
78 case RU_REL_UACK:
79 case RU_SEND_PCA:
80 SET_STATE(RU,RU_NULL);
81 grlc_data->ru.first_usf = FALSE;
82 grlc_data->t3164_to_cnt++;
83 TRACE_EVENT_P1("timeout T3164 cnt=%d",grlc_data->t3164_to_cnt);
84 sig_ru_tm_error_ra();
85 break;
86 default:
87 TRACE_ERROR( "T3164 unexpected" );
88 TRACE_EVENT( "T3164 unexpected" );
89 break;
90 }
91
92 } /* ru_t3164() */
93
94
95
96
97 /*
98 +------------------------------------------------------------------------------
99 | Function : ru_t3166
100 +------------------------------------------------------------------------------
101 | Description : Handles the primitive T3166
102 |
103 | Parameters : *t3166 - Ptr to primitive payload
104 |
105 +------------------------------------------------------------------------------
106 */
107 GLOBAL void ru_t3166 ( void )
108 {
109 TRACE_FUNCTION( "t3166" );
110
111
112 switch( GET_STATE( RU ) )
113 {
114 case RU_ACK:
115 case RU_REL_ACK:
116 SET_STATE(RU,RU_NULL);
117 vsi_t_stop(GRLC_handle,T3180);
118 vsi_t_stop(GRLC_handle,T3182);
119 TRACE_ERROR("timeout T3166");
120 TRACE_EVENT("timeout T3166");
121 sig_ru_tm_error_ra();
122 break;
123 default:
124 TRACE_ERROR( "T3166 unexpected" );
125 break;
126 }
127
128 } /* ru_t3166() */
129
130
131
132
133 /*
134 +------------------------------------------------------------------------------
135 | Function : ru_t3180
136 +------------------------------------------------------------------------------
137 | Description : Handles the primitive T3180
138 |
139 | Parameters : *t3180 - Ptr to primitive payload
140 |
141 +------------------------------------------------------------------------------
142 */
143 GLOBAL void ru_t3180 ( void )
144 {
145 TRACE_FUNCTION( "t3180" );
146
147
148 switch( GET_STATE( RU ) )
149 {
150 case RU_ACK:
151 case RU_UACK:
152 case RU_REL_ACK:
153 case RU_REL_UACK:
154 SET_STATE(RU,RU_NULL);
155 TRACE_ERROR("timeout T3180");
156 TRACE_EVENT("timeout T3180");
157 ru_handle_n3102(PAN_DEC);
158 break;
159 default:
160 TRACE_ERROR( "T3180 unexpected" );
161 TRACE_EVENT( "T3180 unexpected" );
162 break;
163 }
164
165 } /* ru_t3180() */
166
167
168
169 /*
170 +------------------------------------------------------------------------------
171 | Function : ru_t3182
172 +------------------------------------------------------------------------------
173 | Description : Handles the primitive T3182
174 |
175 | Parameters : *t3182 - Ptr to primitive payload
176 |
177 +------------------------------------------------------------------------------
178 */
179 GLOBAL void ru_t3182 ( void )
180 {
181 TRACE_FUNCTION( "t3182" );
182
183 TRACE_EVENT_P1("timeout T3182 state=%d", grlc_data->ru.state);
184
185 switch( GET_STATE( RU ) )
186 {
187 case RU_ACK:
188 case RU_UACK:
189 /*
190 * Timeout during stall indcation
191 */
192 SET_STATE(RU,RU_NULL);
193 TRACE_ERROR("timeout T3182 ack state");
194 ru_handle_n3102(PAN_DEC);
195 break;
196 case RU_REL_ACK:
197 SET_STATE(RU,RU_NULL);
198 TRACE_ERROR("timeout T3182 rel ack");
199 sig_ru_tm_error_ra();
200 break;
201 case RU_REL_UACK:
202 SET_STATE(RU,RU_NULL);
203 TRACE_ERROR("timeout T3182 rel uack state");
204 grlc_data->tbf_ctrl[grlc_data->ul_index].end_fn = grlc_data->ul_fn;
205 grlc_data->tbf_ctrl[grlc_data->ul_index].vs_vr = grlc_data->ru.vs;
206 grlc_data->tbf_ctrl[grlc_data->ul_index].va_vq = grlc_data->ru.va;
207 grlc_data->tbf_ctrl[grlc_data->ul_index].cnt_ts = grlc_data->ru.cnt_ts;
208 grlc_trace_tbf_par ( grlc_data->ul_index );
209 /* in unack mode we need to delete the last llc pdu that constituted
210 * rlc block with cv=0. Unlike other rlc blocks in unack mode, block with
211 * cv=0 transmission will not relult in freeing of llc pdu as cv=0
212 * may have to be retransmitted 4 times.
213 * In case of timer expiry llc pdu needs to be deleted here.
214 * timer t3180 also needs to be stopped.
215 */
216 ru_delete_prims(grlc_data->ru.vs);
217 vsi_t_stop(GRLC_handle,T3180);
218 sig_ru_tm_end_of_tbf();
219 break;
220 default:
221 TRACE_ERROR( "T3182 unexpected" );
222 break;
223 }
224
225 } /* ru_t3182() */
226
227
228
229
230 /*
231 +------------------------------------------------------------------------------
232 | Function : ru_t3184
233 +------------------------------------------------------------------------------
234 | Description : Handles the primitive T3184
235 |
236 | Parameters :
237 |
238 +------------------------------------------------------------------------------
239 */
240 GLOBAL void ru_t3184 ( void )
241 {
242 TRACE_FUNCTION( "t3184" );
243
244 TRACE_EVENT_P1("timeout T3184 state=%d", grlc_data->ru.state);
245
246 switch( GET_STATE( RU ) )
247 {
248 case RU_ACK:
249 case RU_REL_ACK:
250 case RU_SEND_PCA:
251 SET_STATE(RU,RU_NULL);
252 TRACE_ERROR("timeout T3184");
253 sig_ru_tm_error_ra();
254 break;
255 default:
256 TRACE_ERROR( "T3184 unexpected" );
257 break;
258 }
259
260 } /* ru_t3184() */
261
262 /*
263 +------------------------------------------------------------------------------
264 | Function : ru_t3314
265 +------------------------------------------------------------------------------
266 | Description : Handles the primitive T3314
267 |
268 | Parameters :
269 |
270 +------------------------------------------------------------------------------
271 */
272 GLOBAL void ru_t3314 ( void )
273 {
274 TRACE_FUNCTION( "ru_t3314" );
275
276 TRACE_EVENT_P1("timeout T3314 state = %d", grlc_data->ru.state);
277
278 grlc_enter_standby_state( );
279
280 } /* ru_t3314() */