comparison src/g23m-gprs/llc/llc_txp.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 :
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 primitives as described in
19 | the SDL-documentation (TX-statemachine)
20 +-----------------------------------------------------------------------------
21 */
22
23 #ifndef LLC_TXP_C
24 #define LLC_TXP_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_txf.h" /* to get local TX functions */
42 #include "llc_txl.h" /* to get local TX labels */
43 #include "llc_uitxs.h" /* to get signal interface to UITX */
44 #include "llc_itxs.h" /* to get ITX signal definitions */
45
46
47 /*==== CONST ================================================================*/
48
49 /*==== LOCAL VARS ===========================================================*/
50
51 /*==== PRIVATE FUNCTIONS ====================================================*/
52
53 /*==== PUBLIC FUNCTIONS =====================================================*/
54
55
56 /*
57 +------------------------------------------------------------------------------
58 | Function : tx_grlc_ready_ind
59 +------------------------------------------------------------------------------
60 | Description : Handles the primitive GRLC_READY_IND
61 |
62 | Parameters : *grlc_ready_ind - Ptr to primitive payload
63 |
64 +------------------------------------------------------------------------------
65 */
66 GLOBAL void tx_grlc_ready_ind ( T_GRLC_READY_IND *grlc_ready_ind )
67 {
68 T_GRLC_DATA_REQ *grlc_data_req;
69 T_GRLC_UNITDATA_REQ *grlc_unitdata_req;
70 T_PRIM_TYPE prim_type;
71 T_SERVICE rx_service;
72 UBYTE sapi;
73
74
75 TRACE_FUNCTION( "tx_grlc_ready_ind" );
76
77 if (llc_data->grlc_suspended == TRUE)
78 {
79 /*
80 * Ignore it, may be it's due to a collision isse
81 */
82 PFREE (grlc_ready_ind);
83 TRACE_0_INFO("GRLC_READY_IND ignored");
84 }
85 else switch( GET_STATE( TX ) )
86 {
87 case TX_TLLI_UNASSIGNED_NOT_READY:
88 PFREE (grlc_ready_ind);
89 SET_STATE (TX, TX_TLLI_UNASSIGNED_READY);
90 break;
91
92 case TX_TLLI_ASSIGNED_NOT_READY:
93 PFREE (grlc_ready_ind);
94
95 do {
96 tx_get_next_frame (&grlc_data_req, &grlc_unitdata_req, &prim_type,
97 &rx_service, &sapi);
98
99 switch (prim_type)
100 {
101 case PRIM_DATA:
102 /*
103 * Label S_DATA
104 */
105 tx_label_s_data (rx_service, grlc_data_req);
106 break;
107 case PRIM_UNITDATA:
108 /*
109 * Label S_UNITDATA
110 */
111 tx_label_s_unitdata (rx_service, grlc_unitdata_req);
112 break;
113 case PRIM_REMOVED:
114 /*
115 * Label S_REMOVED
116 */
117 tx_label_s_removed (rx_service, sapi);
118 break;
119 default: /* NO_PRIM */
120 SET_STATE (TX, TX_TLLI_ASSIGNED_READY);
121 break;
122 }
123 } while (prim_type == PRIM_REMOVED);
124 break;
125
126 default:
127 PFREE (grlc_ready_ind);
128 TRACE_ERROR( "GRLC_READY_IND unexpected" );
129 break;
130 }
131
132 } /* tx_grlc_ready_ind() */
133
134 /*
135 +------------------------------------------------------------------------------
136 | Function : tx_grlc_suspend_ready_ind
137 +------------------------------------------------------------------------------
138 | Description : Handles the primitive GRLC_SUSPEND_READY_IND
139 |
140 | Parameters : *grlc_suspend_ready_ind - Ptr to primitive payload
141 |
142 +------------------------------------------------------------------------------
143 */
144 GLOBAL void tx_grlc_suspend_ready_ind ( T_GRLC_SUSPEND_READY_IND *grlc_suspend_ready_ind )
145 {
146 T_GRLC_DATA_REQ *grlc_data_req;
147 T_GRLC_UNITDATA_REQ *grlc_unitdata_req;
148 T_PRIM_TYPE prim_type;
149 T_SERVICE rx_service;
150 UBYTE sapi;
151
152
153 TRACE_FUNCTION( "tx_grlc_suspend_ready_ind" );
154
155 if (llc_data->grlc_suspended == FALSE)
156 {
157 /*
158 * Ignore it, may be it's due to a collision isse
159 */
160 PFREE (grlc_suspend_ready_ind);
161 TRACE_0_INFO("GRLC_SUSPEND_READY_IND ignored");
162 }
163 else switch( GET_STATE( TX ) )
164 {
165 case TX_TLLI_UNASSIGNED_NOT_READY:
166 PFREE (grlc_suspend_ready_ind);
167 SET_STATE (TX, TX_TLLI_UNASSIGNED_READY);
168 break;
169
170 case TX_TLLI_ASSIGNED_NOT_READY:
171 PFREE (grlc_suspend_ready_ind);
172
173 do {
174 tx_get_next_frame (&grlc_data_req, &grlc_unitdata_req, &prim_type,
175 &rx_service, &sapi);
176
177 switch (prim_type)
178 {
179 case PRIM_DATA:
180 /*
181 * Label S_DATA
182 */
183 tx_label_s_data (rx_service, grlc_data_req);
184 break;
185 case PRIM_UNITDATA:
186 /*
187 * Label S_UNITDATA
188 */
189 tx_label_s_unitdata (rx_service, grlc_unitdata_req);
190 break;
191 case PRIM_REMOVED:
192 /*
193 * Label S_REMOVED
194 */
195 tx_label_s_removed (rx_service, sapi);
196 break;
197 default: /* NO_PRIM */
198 SET_STATE (TX, TX_TLLI_ASSIGNED_READY);
199 break;
200 }
201 } while (prim_type == PRIM_REMOVED);
202 break;
203
204 default:
205 PFREE (grlc_suspend_ready_ind);
206 TRACE_ERROR( "GRLC_SUSPEND_READY_IND unexpected" );
207 break;
208 }
209 } /* tx_grlc_suspend_ready_ind() */
210
211
212 /*
213 +------------------------------------------------------------------------------
214 | Function : tx_cci_cipher_cnf
215 +------------------------------------------------------------------------------
216 | Description : Handles the primitive CCI_CIPHER_CNF.
217 | Note: GRLC_DATA_REQ type is used instead to avoid PPASS.
218 |
219 | Parameters : *grlc_data_req - Ptr to primitive payload
220 |
221 +------------------------------------------------------------------------------
222 */
223 GLOBAL void tx_cci_cipher_cnf (T_GRLC_DATA_REQ *grlc_data_req)
224 {
225 T_GRLC_UNITDATA_REQ *grlc_unitdata_req;
226 T_PRIM_TYPE prim_type;
227 T_SERVICE rx_service;
228 UBYTE sapi;
229
230
231 TRACE_FUNCTION( "tx_cci_cipher_cnf" );
232
233 switch( GET_STATE( TX ) )
234 {
235 case TX_TLLI_ASSIGNED_NOT_READY:
236 tx_store_buffer (grlc_data_req);
237 break;
238 case TX_TLLI_ASSIGNED_READY:
239 tx_store_buffer (grlc_data_req);
240
241 do {
242 tx_get_next_frame (&grlc_data_req, &grlc_unitdata_req, &prim_type,
243 &rx_service, &sapi);
244
245 switch (prim_type)
246 {
247 case PRIM_DATA:
248 /*
249 * Label S_DATA
250 */
251 tx_label_s_data (rx_service, grlc_data_req);
252 break;
253 case PRIM_UNITDATA:
254 /*
255 * Label S_UNITDATA
256 */
257 tx_label_s_unitdata (rx_service, grlc_unitdata_req);
258 break;
259 case PRIM_REMOVED:
260 /*
261 * Label S_REMOVED
262 */
263 tx_label_s_removed (rx_service, sapi);
264 break;
265 default: /* NO_PRIM */
266 break;
267 }
268 } while (prim_type == PRIM_REMOVED);
269 break;
270 default:
271 PFREE (grlc_data_req);
272 TRACE_ERROR( "CCI_CIPHER_CNF unexpected" );
273 break;
274 }
275 } /* tx_cci_cipher_cnf() */