comparison src/g23m-gprs/llc/llc_t200s.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 :
4 | Modul :
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 LLC and implements all
18 | functions to handles the incoming process internal signals as
19 | described in the SDL-documentation (T200-statemachine)
20 +-----------------------------------------------------------------------------
21 */
22
23 #ifndef LLC_T200S_C
24 #define LLC_T200S_C
25 #endif
26
27 #define ENTITY_LLC
28
29 /*==== INCLUDES =============================================================*/
30
31 #include "typedefs.h" /* to get Condat data types */
32 #include "vsi.h" /* to get a lot of macros */
33 #include "macdef.h"
34 #include "gprs.h"
35 #include "gsm.h" /* to get a lot of macros */
36 #include "cnf_llc.h" /* to get cnf-definitions */
37 #include "mon_llc.h" /* to get mon-definitions */
38 #include "prim.h" /* to get the definitions of used SAP and directions */
39 #include "llc.h" /* to get the global entity definitions */
40
41 #include "llc_t200f.h" /* to get local T200 functions */
42 #include "llc_us.h" /* to get signal interface to U */
43 #include "llc_f.h" /* to get llc functions */
44
45
46 /*==== CONST ================================================================*/
47
48 /*==== LOCAL VARS ===========================================================*/
49
50 /*==== PRIVATE FUNCTIONS ====================================================*/
51
52 /*==== PUBLIC FUNCTIONS =====================================================*/
53
54
55
56 /*
57 +------------------------------------------------------------------------------
58 | Function : sig_llme_t200_assign_req
59 +------------------------------------------------------------------------------
60 | Description : Handles the internal signal SIG_LLME_T200_ASSIGN_REQ
61 |
62 | Parameters :
63 |
64 +------------------------------------------------------------------------------
65 */
66 GLOBAL void sig_llme_t200_assign_req (void)
67 {
68 TRACE_ISIG( "sig_llme_t200_assign_req" );
69
70 switch (GET_STATE(T200))
71 {
72 case T200_TLLI_UNASSIGNED:
73 SET_STATE (T200, T200_RESET);
74 break;
75 default:
76 TRACE_ERROR( "SIG_LLME_T200_ASSIGN_REQ unexpected" );
77 break;
78 }
79 } /* sig_llme_t200_assign_req() */
80
81
82
83 /*
84 +------------------------------------------------------------------------------
85 | Function : sig_llme_t200_unassign_req
86 +------------------------------------------------------------------------------
87 | Description : Handles the internal signal SIG_LLME_T200_UNASSIGN_REQ
88 |
89 | Parameters :
90 |
91 +------------------------------------------------------------------------------
92 */
93 GLOBAL void sig_llme_t200_unassign_req (void)
94 {
95 TRACE_ISIG( "sig_llme_t200_unassign_req" );
96
97 switch (GET_STATE(T200))
98 {
99 case T200_RESET:
100 SET_STATE (T200, T200_TLLI_UNASSIGNED);
101 break;
102 case T200_RUNNING:
103 t200_stop();
104
105 /*
106 * Indicate that no frame with P bit set to 1 is currently outstanding
107 */
108 llc_data->sapi->pbit_outstanding = FALSE;
109
110 SET_STATE (T200, T200_TLLI_UNASSIGNED);
111 break;
112 default:
113 TRACE_ERROR( "SIG_LLME_T200_UNASSIGN_REQ unexpected" );
114 break;
115 }
116 } /* sig_llme_t200_unassign_req() */
117
118
119
120 /*
121 +------------------------------------------------------------------------------
122 | Function : sig_u_t200_start_req
123 +------------------------------------------------------------------------------
124 | Description : Handles the internal signal SIG_U_T200_START_REQ
125 |
126 | Parameters : frame - a valid pointer to the frame that shall be associated
127 | with the timer
128 |
129 +------------------------------------------------------------------------------
130 */
131 GLOBAL void sig_u_t200_start_req
132 (
133 #ifdef LL_DESC
134 T_LL_UNITDESC_REQ *frame,
135 #else
136 T_LL_UNITDATA_REQ *frame,
137 #endif
138 UBYTE cause
139 )
140 {
141 TRACE_ISIG( "sig_u_t200_start_req" );
142
143 switch (GET_STATE(T200))
144 {
145 case T200_RESET:
146 t200_start (frame, cause, SERVICE_U);
147
148 /*
149 * Indicate that a frame with P bit set to 1 is currently outstanding
150 */
151 llc_data->sapi->pbit_outstanding = TRUE;
152
153 SET_STATE (T200, T200_RUNNING);
154 break;
155 default:
156 #ifdef LL_DESC
157 /*
158 * The descriptor contents of the primitive structure
159 * must be freed as well.
160 */
161 llc_cl_desc3_free((T_desc3*)frame->desc_list3.first);
162 #endif /* LL_DESC */
163 PFREE (frame);
164 TRACE_ERROR( "SIG_U_T200_START_REQ unexpected" );
165 break;
166 }
167 } /* sig_u_t200_start_req() */
168
169
170 /*
171 +------------------------------------------------------------------------------
172 | Function : sig_u_t200_stop_req
173 +------------------------------------------------------------------------------
174 | Description : Handles the internal signal SIG_U_T200_STOP_REQ
175 |
176 | Parameters :
177 |
178 +------------------------------------------------------------------------------
179 */
180 GLOBAL void sig_u_t200_stop_req (void)
181 {
182 TRACE_ISIG( "sig_u_t200_stop_req" );
183
184 switch (GET_STATE(T200))
185 {
186 case T200_RUNNING:
187 t200_stop();
188
189 /*
190 * Indicate that no frame with P bit set to 1 is currently outstanding
191 */
192 llc_data->sapi->pbit_outstanding = FALSE;
193
194 SET_STATE (T200, T200_RESET);
195 break;
196 default:
197 break;
198 }
199 } /* sig_u_t200_stop_req() */
200
201
202 /*
203 +------------------------------------------------------------------------------
204 | Function : sig_u_t200_expire_req
205 +------------------------------------------------------------------------------
206 | Description : Handles the internal signal SIG_U_T200_EXPIRE_REQ
207 |
208 | Parameters :
209 |
210 +------------------------------------------------------------------------------
211 */
212 GLOBAL void sig_u_t200_expire_req (void)
213 {
214 #ifndef LL_DESC
215 T_LL_UNITDATA_REQ *frame;
216 #else
217 T_LL_UNITDESC_REQ *frame;
218 #endif
219 UBYTE cause;
220 T_SERVICE originator;
221
222 TRACE_ISIG( "sig_u_t200_expire_req" );
223
224 switch (GET_STATE(T200))
225 {
226 case T200_RUNNING:
227 SET_STATE (T200, T200_RESET);
228
229 /*
230 * No frame with P bit set to 1 is currently outstanding
231 */
232 llc_data->sapi->pbit_outstanding = FALSE;
233
234 /*
235 * Get associated timer data (frame, cause, originating service)
236 * and send T200 expired signal, if originator is set. Otherwise
237 * just PFREE the frame.
238 */
239 t200_get_timer_data (&frame, &cause, &originator);
240 if (originator EQ SERVICE_U)
241 {
242 sig_t200_u_expired_ind (frame, cause, EXPIRY_REQUESTED);
243 }
244 else
245 {
246 TRACE_0_INFO("T200 expired, no service associated, frame discarded");
247 #ifdef LL_DESC
248 /*
249 * The descriptor contents of the primitive structure
250 * must be freed as well.
251 */
252 llc_cl_desc3_free((T_desc3*)frame->desc_list3.first);
253 #endif /* LL_DESC */
254 PFREE (frame);
255 }
256 break;
257
258 default:
259 TRACE_ERROR( "SIG_U_T200_EXPIRE_REQ unexpected" );
260 break;
261 }
262 } /* sig_u_t200_expire_req() */
263