FreeCalypso > hg > fc-tourmaline
comparison src/g23m-aci/aci/psa_l2rs.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 : GSM-PS (6147) | |
4 | Modul : PSA_L2RS | |
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 defines the signalling functions of the | |
18 | protocol stack adapter for layer 2 relay. | |
19 +----------------------------------------------------------------------------- | |
20 */ | |
21 | |
22 #ifdef DTI | |
23 | |
24 #ifndef PSA_L2RS_C | |
25 #define PSA_L2RS_C | |
26 #endif | |
27 | |
28 #include "aci_all.h" | |
29 | |
30 /*==== INCLUDES ===================================================*/ | |
31 #include "dti.h" | |
32 #include "dti_conn_mng.h" | |
33 #include "dti_cntrl_mng.h" | |
34 | |
35 #include "aci_cmh.h" | |
36 #include "ati_cmd.h" | |
37 #include "aci_cmd.h" | |
38 #include "aci.h" | |
39 | |
40 #include "psa.h" | |
41 #include "psa_l2r.h" | |
42 #include "cmh.h" | |
43 #include "aci_fd.h" | |
44 #include "cmh_ra.h" | |
45 #include "cmh_l2r.h" | |
46 #include "psa_uart.h" | |
47 | |
48 #if defined (FF_WAP) || defined (FF_GPF_TCPIP) || defined (FF_SAT_E) | |
49 #include "wap_aci.h" | |
50 #include "psa_ppp_w.h" | |
51 #endif /* defined (FF_WAP) || defined (FF_GPF_TCPIP) */ | |
52 #include "aci_lst.h" | |
53 | |
54 #include "aci_lst.h" | |
55 | |
56 #ifdef FF_PSI | |
57 #include "psa_psi.h" | |
58 #include "cmh_psi.h" | |
59 #include "ati_src_psi.h" | |
60 #endif /*FF_PSI*/ | |
61 #include "psa_util.h" | |
62 | |
63 /*==== CONSTANTS ==================================================*/ | |
64 | |
65 | |
66 /*==== TYPES ======================================================*/ | |
67 | |
68 | |
69 /*==== EXPORT =====================================================*/ | |
70 | |
71 | |
72 /*==== VARIABLES ==================================================*/ | |
73 | |
74 | |
75 /*==== FUNCTIONS ==================================================*/ | |
76 | |
77 | |
78 /* | |
79 +-------------------------------------------------------------------+ | |
80 | PROJECT : GSM-PS (6147) MODULE : PSA_L2R | | |
81 | ROUTINE : psaL2R_Activate | | |
82 +-------------------------------------------------------------------+ | |
83 | |
84 PURPOSE : Activate L2R. | |
85 | |
86 */ | |
87 | |
88 GLOBAL SHORT psaL2R_Activate(UBYTE owner) | |
89 { | |
90 #define X l2rShrdPrm.set_prm[owner] | |
91 | |
92 TRACE_FUNCTION ("psaL2R_Activate()"); | |
93 | |
94 /* owner belongs to PSA and not to CMH */ | |
95 l2rShrdPrm.owner = owner; | |
96 | |
97 switch (l2rShrdPrm.state) | |
98 { | |
99 case L2R_DEACTIVATED: | |
100 { | |
101 PALLOC (l2r_activate_req, L2R_ACTIVATE_REQ); | |
102 | |
103 l2r_activate_req->k_ms_iwf = X.k_ms_iwf; | |
104 l2r_activate_req->k_iwf_ms = X.k_iwf_ms; | |
105 l2r_activate_req->t1 = X.t1; | |
106 l2r_activate_req->t2 = L2R_T2_DEF; | |
107 l2r_activate_req->n2 = X.n2; | |
108 l2r_activate_req->pt = L2R_PT_DEF; | |
109 l2r_activate_req->p0 = X.p0; | |
110 l2r_activate_req->p1 = X.p1; | |
111 l2r_activate_req->p2 = X.p2; | |
112 l2r_activate_req->uil2p = X.uil2p; | |
113 l2r_activate_req->bytes_per_prim = L2R_BYTES_PER_PRIM_DEF; | |
114 l2r_activate_req->buffer_size = L2R_BUFFER_SIZE_DEF; | |
115 l2r_activate_req->rate = X.rate; | |
116 | |
117 l2rShrdPrm.set_prm[l2rShrdPrm.owner].reset = 0; | |
118 | |
119 memcpy (&X, &l2rShrdPrm.set_prm_use, sizeof (T_L2R_SET_PRM)); | |
120 | |
121 l2rShrdPrm.state = L2R_ACTIVATE; | |
122 | |
123 PSENDX (L2R, l2r_activate_req); | |
124 | |
125 break; | |
126 } | |
127 | |
128 default: | |
129 { | |
130 cmhL2R_Failure(); | |
131 | |
132 return -1; | |
133 } | |
134 } | |
135 | |
136 return 0; | |
137 | |
138 #undef X | |
139 } | |
140 | |
141 /* | |
142 +-------------------------------------------------------------------+ | |
143 | PROJECT : GSM-PS (6147) MODULE : PSA_L2R | | |
144 | ROUTINE : psaL2R_Deactivate | | |
145 +-------------------------------------------------------------------+ | |
146 | |
147 PURPOSE : Deactivate L2R. | |
148 | |
149 */ | |
150 | |
151 GLOBAL SHORT psaL2R_Deactivate(void) | |
152 { | |
153 TRACE_FUNCTION ("psaL2R_Deactivate()"); | |
154 | |
155 switch (l2rShrdPrm.state) | |
156 { | |
157 case L2R_ENABLED: | |
158 { | |
159 T_DTI_CONN_LINK_ID link_id = dti_cntrl_get_link_id( DTI_ENTITY_L2R, DTI_INSTANCE_NOTPRESENT, DTI_SUB_NO_NOTPRESENT ); | |
160 PALLOC (l2r_dti_req, L2R_DTI_REQ); | |
161 | |
162 l2r_dti_req->dti_conn = L2R_DISCONNECT_DTI; | |
163 l2rShrdPrm.uart_conn = L2R_DISCONNECT_DTI; | |
164 l2r_dti_req->link_id = link_id; | |
165 l2rShrdPrm.state = L2R_DETACH; | |
166 | |
167 PSENDX (L2R, l2r_dti_req); | |
168 break; | |
169 } | |
170 | |
171 case L2R_CONNECTED: | |
172 case L2R_ENABLE: | |
173 case L2R_ACTIVATE: | |
174 case L2R_CONNECT: | |
175 { | |
176 PALLOC (l2r_deactivate_req, L2R_DEACTIVATE_REQ); | |
177 | |
178 l2rShrdPrm.state = L2R_DEACTIVATE; | |
179 | |
180 PSENDX (L2R, l2r_deactivate_req); | |
181 break; | |
182 } | |
183 | |
184 /* Changed for OMAPS00049111 */ | |
185 #if defined (FF_SAT_E) || defined (_SIMULATION_) | |
186 case L2R_DEACTIVATED: | |
187 return -1; | |
188 #endif /* FF_SAT_E */ | |
189 } | |
190 | |
191 return 0; | |
192 } | |
193 | |
194 /* | |
195 +-------------------------------------------------------------------+ | |
196 | PROJECT : GSM-PS (6147) MODULE : PSA_L2R | | |
197 | ROUTINE : psaL2R_Enable | | |
198 +-------------------------------------------------------------------+ | |
199 | |
200 PURPOSE : Enable L2R. | |
201 | |
202 */ | |
203 | |
204 GLOBAL SHORT psaL2R_Enable( T_DTI_CONN_LINK_ID link_id, UBYTE peer ) | |
205 { | |
206 UBYTE dti_id = EXTRACT_DTI_ID( link_id ); | |
207 | |
208 TRACE_EVENT ("psaL2R_Enable()"); | |
209 | |
210 switch (l2rShrdPrm.state) | |
211 { | |
212 case L2R_CONNECTED: | |
213 { | |
214 PALLOC (l2r_dti_req, L2R_DTI_REQ); | |
215 | |
216 l2r_dti_req->dti_conn = L2R_CONNECT_DTI; | |
217 l2rShrdPrm.uart_conn = L2R_CONNECT_DTI; | |
218 l2r_dti_req->link_id = link_id; | |
219 | |
220 l2rShrdPrm.state = L2R_ENABLE; | |
221 | |
222 #if defined (FF_WAP) || defined (FF_GPF_TCPIP) || defined (FF_SAT_E) | |
223 if (Wap_Call) | |
224 { | |
225 strcpy((char*)l2r_dti_req->entity_name, PPP_NAME); | |
226 l2r_dti_req->dti_direction = DTI_CHANNEL_TO_HIGHER_LAYER; | |
227 } | |
228 else | |
229 { | |
230 #endif /* FF_WAP OR FF_GPF_TCPIP or SAT E */ | |
231 if (IS_SRC_BT(dti_id)) | |
232 { | |
233 TRACE_EVENT("psa_l2rs - BT_ADAPTER Act"); | |
234 strcpy((char*)l2r_dti_req->entity_name, BTI_NAME); | |
235 l2r_dti_req->dti_direction = DTI_CHANNEL_TO_HIGHER_LAYER; | |
236 } | |
237 else if ((peer EQ DTI_ENTITY_PPPC) OR | |
238 (peer EQ DTI_ENTITY_AAA) | |
239 #ifdef FF_SAT_E | |
240 OR (peer EQ DTI_ENTITY_SIM) | |
241 #endif /* FF_SAT_E */ | |
242 ) | |
243 { | |
244 strcpy((char*)l2r_dti_req->entity_name, dti_entity_name[peer].name); | |
245 l2r_dti_req->dti_direction = DTI_CHANNEL_TO_HIGHER_LAYER; | |
246 } | |
247 else | |
248 { | |
249 if (peer EQ DTI_ENTITY_UART) | |
250 strcpy((char*)l2r_dti_req->entity_name,UART_NAME); | |
251 else | |
252 strcpy((char*)l2r_dti_req->entity_name,PSI_NAME); | |
253 l2r_dti_req->dti_direction = DTI_CHANNEL_TO_LOWER_LAYER; | |
254 } | |
255 #if defined (FF_WAP) || defined (FF_GPF_TCPIP) || defined (FF_SAT_E) | |
256 } | |
257 #endif /* FF_WAP || FF_GPF_TCPIP || SAT E */ | |
258 | |
259 if (dti_cntrl_set_conn_parms(link_id, DTI_ENTITY_L2R, DTI_INSTANCE_NOTPRESENT, DTI_SUB_NO_NOTPRESENT) EQ FALSE) | |
260 { | |
261 return -1; | |
262 } | |
263 | |
264 PSENDX (L2R, l2r_dti_req); | |
265 | |
266 break; | |
267 } | |
268 | |
269 case L2R_ENABLE: | |
270 { | |
271 PALLOC (l2r_disc_req, L2R_DISC_REQ); | |
272 | |
273 l2rShrdPrm.state = L2R_DISCONNECT; | |
274 | |
275 cmhL2R_Failure(); | |
276 | |
277 PSENDX (L2R, l2r_disc_req); | |
278 | |
279 break; | |
280 } | |
281 | |
282 case L2R_ACTIVATE: | |
283 case L2R_CONNECT: | |
284 { | |
285 PALLOC (l2r_deactivate_req, L2R_DEACTIVATE_REQ); | |
286 | |
287 l2rShrdPrm.state = L2R_DEACTIVATE; | |
288 | |
289 cmhL2R_Failure(); | |
290 | |
291 PSENDX (L2R, l2r_deactivate_req); | |
292 | |
293 break; | |
294 } | |
295 | |
296 default: | |
297 { | |
298 cmhL2R_Failure(); | |
299 | |
300 return -1; | |
301 } | |
302 } | |
303 | |
304 return 0; | |
305 } | |
306 | |
307 /* | |
308 +-------------------------------------------------------------------+ | |
309 | PROJECT : GSM-PS (6147) MODULE : PSA_L2R | | |
310 | ROUTINE : psaL2R_Disable | | |
311 +-------------------------------------------------------------------+ | |
312 | |
313 PURPOSE : Disable L2R. | |
314 | |
315 */ | |
316 | |
317 /* Not sure whether this function is needed or not !! | |
318 | |
319 GLOBAL SHORT psaL2R_Disable(void) | |
320 { | |
321 TRACE_FUNCTION ("psaL2R_Disable()"); | |
322 | |
323 switch (l2rShrdPrm.state) | |
324 { | |
325 case L2R_ENABLED: | |
326 { | |
327 PALLOC (l2r_dti_req, L2R_DTI_REQ); | |
328 | |
329 l2r_dti_req->dti_conn = L2R_DISCONNECT_DTI; | |
330 l2rShrdPrm.uart_conn = L2R_DISCONNECT_DTI; | |
331 | |
332 l2rShrdPrm.state = L2R_DISABLE; | |
333 | |
334 PSENDX (L2R, l2r_dti_req); | |
335 | |
336 break; | |
337 } | |
338 | |
339 case L2R_CONNECTED: | |
340 case L2R_ENABLE: | |
341 { | |
342 PALLOC (l2r_disc_req, L2R_DISC_REQ); | |
343 | |
344 l2rShrdPrm.state = L2R_DISCONNECT; | |
345 | |
346 cmhL2R_Failure(); | |
347 | |
348 PSENDX (L2R, l2r_disc_req); | |
349 | |
350 break; | |
351 } | |
352 | |
353 case L2R_ACTIVATE: | |
354 case L2R_CONNECT: | |
355 { | |
356 PALLOC (l2r_deactivate_req, L2R_DEACTIVATE_REQ); | |
357 | |
358 l2rShrdPrm.state = L2R_DEACTIVATE; | |
359 | |
360 cmhL2R_Failure(); | |
361 | |
362 PSENDX (L2R, l2r_deactivate_req); | |
363 | |
364 break; | |
365 } | |
366 | |
367 default: | |
368 { | |
369 cmhL2R_Failure(); | |
370 | |
371 return -1; | |
372 } | |
373 } | |
374 | |
375 return 0; | |
376 } */ | |
377 | |
378 | |
379 | |
380 /* | |
381 +-------------------------------------------------------------------+ | |
382 | PROJECT : GSM-PS (6147) MODULE : PSA_L2R | | |
383 | ROUTINE : psaL2R_ESC | | |
384 +-------------------------------------------------------------------+ | |
385 | |
386 PURPOSE : ESC. | |
387 | |
388 */ | |
389 | |
390 GLOBAL SHORT psaL2R_ESC( UBYTE src_id ) | |
391 { | |
392 #ifdef FF_PSI | |
393 T_ACI_DTI_PRC_PSI *src_infos = find_element (psi_src_params, src_id, cmhPSItest_srcId); | |
394 #endif /*FF_PSI*/ | |
395 TRACE_EVENT ("psaL2R_ESC()"); | |
396 | |
397 | |
398 switch (l2rShrdPrm.state) | |
399 { | |
400 case L2R_ENABLED: | |
401 { | |
402 T_DTI_ENTITY_ID entity_list[] = {DTI_ENTITY_ACI}; | |
403 #ifdef FF_PSI | |
404 if (src_infos NEQ NULL) | |
405 dti_cntrl_est_dpath_indirect ( src_id, | |
406 entity_list, | |
407 1, | |
408 SPLIT, | |
409 atiPSI_dti_cb, | |
410 DTI_CPBLTY_CMD, | |
411 DTI_CID_NOTPRESENT); | |
412 else | |
413 #endif /*FF_PSI*/ | |
414 dti_cntrl_est_dpath_indirect ( src_id, | |
415 entity_list, | |
416 1, | |
417 SPLIT, | |
418 atiUART_dti_cb, | |
419 DTI_CPBLTY_CMD, | |
420 DTI_CID_NOTPRESENT); | |
421 | |
422 l2rShrdPrm.state = L2R_ESCAPE; | |
423 break; | |
424 } | |
425 case L2R_CONNECTED: | |
426 case L2R_ENABLE: | |
427 { | |
428 PALLOC (l2r_disc_req, L2R_DISC_REQ); | |
429 | |
430 l2rShrdPrm.state = L2R_DISCONNECT; | |
431 | |
432 cmhL2R_Failure(); | |
433 | |
434 PSENDX (L2R, l2r_disc_req); | |
435 | |
436 break; | |
437 } | |
438 | |
439 case L2R_ACTIVATE: | |
440 case L2R_CONNECT: | |
441 { | |
442 PALLOC (l2r_deactivate_req, L2R_DEACTIVATE_REQ); | |
443 | |
444 l2rShrdPrm.state = L2R_DEACTIVATE; | |
445 | |
446 cmhL2R_Failure(); | |
447 | |
448 PSENDX (L2R, l2r_deactivate_req); | |
449 | |
450 break; | |
451 } | |
452 | |
453 default: | |
454 { | |
455 cmhL2R_Failure(); | |
456 | |
457 break; | |
458 } | |
459 } | |
460 | |
461 return 0; | |
462 } | |
463 | |
464 #endif /* DTI */ | |
465 /*==== EOF ========================================================*/ |