FreeCalypso > hg > freecalypso-citrine
comparison g23m-aci/aci/sap_dti.c @ 0:75a11d740a02
initial import of gsm-fw from freecalypso-sw rev 1033:5ab737ac3ad7
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 09 Jun 2016 00:02:41 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:75a11d740a02 |
---|---|
1 /* | |
2 +----------------------------------------------------------------------------- | |
3 | Project : GSM-PS | |
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 : MUX for DTI primitives | |
18 | | |
19 | Different entities sends the same DTI primitives. In this | |
20 | file the correct PSA function will call | |
21 +----------------------------------------------------------------------------- | |
22 */ | |
23 /*==== INCLUDES ===================================================*/ | |
24 | |
25 #include "config.h" | |
26 #include "fixedconf.h" | |
27 #include "condat-features.h" | |
28 #include "aci_conf.h" | |
29 | |
30 #ifdef DTI | |
31 | |
32 #ifndef SAP_DTI_C | |
33 #define SAP_DTI_C | |
34 #endif | |
35 | |
36 #include "aci_all.h" | |
37 /*==== INCLUDES ===================================================*/ | |
38 #include "line_edit.h" | |
39 #include "aci_cmh.h" | |
40 #include "ati_cmd.h" | |
41 #include "aci_cmd.h" | |
42 #include "dti.h" /* functionality of the dti library */ | |
43 | |
44 #include "aci.h" | |
45 #include "aci_lst.h" | |
46 | |
47 #include "dti_conn_mng.h" | |
48 #include "dti_cntrl_mng.h" | |
49 | |
50 #ifdef UART | |
51 #include "psa_uart.h" | |
52 #include "cmh_uart.h" | |
53 #endif | |
54 | |
55 #ifdef FF_PSI | |
56 #include "psa_psi.h" | |
57 #include "cmh_psi.h" | |
58 #include "ati_src_psi.h" | |
59 #endif /*FF_PSI*/ | |
60 #include "aci_mem.h" | |
61 #ifdef UART | |
62 #include "ati_src_uart.h" | |
63 #endif | |
64 | |
65 | |
66 #include "sap_dti.h" | |
67 #include "psa.h" | |
68 #include "cmh.h" | |
69 | |
70 #ifdef FF_BAT | |
71 #include "p_bat.h" | |
72 #include "aci_bat.h" | |
73 #ifdef _SIMULATION_ | |
74 #include "ati_bat.h" | |
75 #endif | |
76 #endif | |
77 | |
78 EXTERN T_ACI_LIST *ati_src_list; | |
79 | |
80 /*==== CONSTANTS ==================================================*/ | |
81 | |
82 | |
83 /*==== TYPES ======================================================*/ | |
84 | |
85 | |
86 /*==== EXPORT =====================================================*/ | |
87 | |
88 | |
89 /*==== VARIABLES ==================================================*/ | |
90 | |
91 | |
92 /*==== FUNCTIONS ==================================================*/ | |
93 | |
94 | |
95 /* LOCAL FUNCTIONS */ | |
96 | |
97 | |
98 /* | |
99 +------------------------------------------------------------------------------ | |
100 | Function : sig_dti_connection_opened_ind | |
101 +------------------------------------------------------------------------------ | |
102 | PURPOSE : dti connection to UART/PSI has been opened | |
103 +------------------------------------------------------------------------------ | |
104 */ | |
105 LOCAL void sig_dti_connection_opened_ind(UBYTE src_id) | |
106 { | |
107 T_DTI_CONN_LINK_ID link_id; | |
108 #ifdef FF_PSI | |
109 T_ACI_DTI_PRC_PSI *src_infos = find_element (psi_src_params, src_id, cmhPSItest_srcId); | |
110 #endif /*FF_PSI*/ | |
111 /* for tracing of establishing of CMD channels for dual port version */ | |
112 #ifdef RMV_15_04_03 | |
113 extern CHAR gob_tst_buf[]; | |
114 #endif | |
115 | |
116 TRACE_FUNCTION("sig_dti_connection_opened_ind()"); | |
117 | |
118 link_id = dti_cntrl_get_link_id( DTI_ENTITY_ACI, src_id, DTI_SUB_NO_NOTPRESENT ); | |
119 | |
120 /* for tracing of establishing of CMD channels for dual port version */ | |
121 #ifdef RMV_15_04_03 | |
122 sprintf(gob_tst_buf+strlen(gob_tst_buf), "oi:%d ", link_id); | |
123 #endif | |
124 | |
125 dti_cntrl_entity_connected( link_id, DTI_ENTITY_ACI, DTI_OK ); | |
126 | |
127 aci_src_dti_params[src_id].isDtiConnected = TRUE; | |
128 | |
129 if (aci_src_dti_params[src_id].dtxState EQ READY) | |
130 { | |
131 /* send buffered data */ | |
132 #ifdef FF_PSI | |
133 if (src_infos NEQ NULL) | |
134 psi_send_buffer_data(src_id); | |
135 else | |
136 #endif /*FF_PSI*/ | |
137 uart_send_buffer_data(src_id); | |
138 } | |
139 } | |
140 | |
141 | |
142 /* | |
143 +------------------------------------------------------------------------------ | |
144 | Function : sig_dti_connection_closed_ind | |
145 +------------------------------------------------------------------------------ | |
146 | PURPOSE : dti connection to UART/PSI has been closed down | |
147 +------------------------------------------------------------------------------ | |
148 */ | |
149 LOCAL void sig_dti_connection_closed_ind(UBYTE src_id) | |
150 { | |
151 T_DTI_CONN_LINK_ID link_id; | |
152 | |
153 TRACE_FUNCTION("sig_dti_connection_closed_ind()"); | |
154 | |
155 link_id = dti_cntrl_get_link_id( DTI_ENTITY_ACI, src_id, DTI_SUB_NO_NOTPRESENT ); | |
156 | |
157 dti_cntrl_entity_disconnected( link_id, DTI_ENTITY_ACI ); | |
158 | |
159 aci_src_dti_params[src_id].isDtiConnected = FALSE; | |
160 } | |
161 | |
162 | |
163 /* | |
164 +------------------------------------------------------------------------------ | |
165 | Function : sig_dti_data_received_ind | |
166 +------------------------------------------------------------------------------ | |
167 | PURPOSE : process reason parameter REASON_DATA_RECEIVED | |
168 +------------------------------------------------------------------------------ | |
169 */ | |
170 | |
171 GLOBAL void sig_dti_data_received_ind(UBYTE src_id, | |
172 T_DTI2_DATA_IND *dti_data_ind) | |
173 { | |
174 USHORT tot_len; | |
175 SHORT pos = 0; | |
176 T_desc2 *p_desc, | |
177 *old_desc; | |
178 UBYTE *chars_received; | |
179 BOOL get_data = TRUE; | |
180 USHORT new_len = 0; | |
181 T_ACI_DTI_PRC *src_infos = find_element (uart_src_params, src_id, cmhUARTtest_srcId); | |
182 #ifdef FF_PSI | |
183 T_ACI_DTI_PRC_PSI *src_infos_psi = find_element (psi_src_params, src_id, cmhPSItest_srcId); | |
184 #endif /*FF_PSI*/ | |
185 TRACE_FUNCTION("sig_dti_data_received_ind()"); | |
186 | |
187 /* prevent dti library from automatically sending | |
188 getdata primitives */ | |
189 #ifdef FF_PSI | |
190 if (src_infos EQ NULL AND src_infos_psi EQ NULL) | |
191 #else | |
192 if (src_infos EQ NULL) | |
193 #endif /*FF_PSI*/ | |
194 { | |
195 TRACE_EVENT_P1("[ERR] sig_dti_data_received_ind: link_id=%d not found", | |
196 dti_data_ind->link_id) ; | |
197 return ; | |
198 } | |
199 | |
200 if (src_infos NEQ NULL) | |
201 { | |
202 #ifndef FF_ATI_BAT /* we came from gdd_aci_send_data() --> faked DTI primitive */ | |
203 dti_stop (aci_hDTI, src_id, DTI_ENTITY_UART, ACI_DTI_DN_CHANNEL); | |
204 #endif | |
205 if(src_infos->RecState EQ READY_REC) | |
206 { | |
207 src_infos->RecState = RECEIVING; | |
208 } | |
209 if (dti_data_ind->parameters.st_lines.st_line_sa EQ DTI_SA_ON) | |
210 { | |
211 BITFIELD_SET (src_infos->data_cntr, UART_DTI_SA_BIT); | |
212 } | |
213 else | |
214 { | |
215 BITFIELD_CLEAR (src_infos->data_cntr, UART_DTI_SA_BIT); | |
216 } | |
217 } | |
218 #ifdef FF_PSI | |
219 else if (src_infos_psi NEQ NULL) | |
220 { | |
221 #ifndef FF_ATI_BAT /* we came from gdd_aci_send_data() --> faked DTI primitive */ | |
222 dti_stop (aci_hDTI, src_id, DTI_ENTITY_UART, ACI_DTI_DN_CHANNEL); | |
223 #endif | |
224 | |
225 if(src_infos_psi->RecState EQ READY_REC) | |
226 { | |
227 src_infos_psi->RecState = RECEIVING; | |
228 } | |
229 if (dti_data_ind->parameters.st_lines.st_line_sa EQ DTI_SA_ON) | |
230 { | |
231 BITFIELD_SET (src_infos_psi->data_cntr, PSI_DTI_SA_BIT); | |
232 } | |
233 else | |
234 { | |
235 BITFIELD_CLEAR (src_infos_psi->data_cntr, PSI_DTI_SA_BIT); | |
236 } | |
237 } | |
238 #endif /*FF_PSI*/ | |
239 tot_len = dti_data_ind -> desc_list2.list_len; | |
240 p_desc = (T_desc2 *)dti_data_ind -> desc_list2.first; | |
241 | |
242 if ( aci_src_dti_params[src_id].isDtiConnected EQ FALSE ) | |
243 { | |
244 TRACE_EVENT ("DTI2_DATA_IND: line not connected"); | |
245 PFREE(dti_data_ind); | |
246 return; | |
247 } | |
248 | |
249 #ifdef FF_BAT | |
250 /* we want only to see data from src_infos_psi */ | |
251 if (aci_cmd_src_mode_get((T_ACI_CMD_SRC)src_id) EQ CMD_MODE_BAT) | |
252 { | |
253 #if defined _SIMULATION_ && FF_ATI_BAT | |
254 /* | |
255 * Simulation of BAT with ATI as application has the following problem: | |
256 * test cases uses the TST and UART source, but BAT needs a PSI source maintenance. | |
257 * Therefore there is in parallel to the TST or UART source a PSI source maintenance and | |
258 * the TST/UART source has been set to CMD_MODE_BAT. | |
259 * When the TAP sends an ASCII AT command string the command must be processed | |
260 * at first with uart_src_proc_chars(). On ATI level we use the BAT lib and the special | |
261 * BAT adapter GDD_ACI will call this function once again, because we have to simulate | |
262 * an incoming DTI primitive. This DTI primitive carries now a BAT command. | |
263 * That's why we have to check the bytes to distinuish between BAT and ASCII commands. | |
264 */ | |
265 T_desc2 *tmp = p_desc; | |
266 int i = 0; | |
267 get_data = TRUE; /* we use this boolean here to check for valid ASCII AT command chars */ | |
268 while (i < tmp->len-1) | |
269 { | |
270 if ((p_desc->buffer[i] < 0x20) OR (p_desc->buffer[i] > 0x7F)) | |
271 { | |
272 if (at.S[3] EQ p_desc->buffer[i]) /* CR */ | |
273 continue; | |
274 if (at.S[4] EQ p_desc->buffer[i]) /* LF */ | |
275 continue; | |
276 if (at.S[5] EQ p_desc->buffer[i]) /* BS */ | |
277 continue; | |
278 if (0x1a EQ p_desc->buffer[i]) /* CTRL-Z = SMS end */ | |
279 continue; | |
280 | |
281 get_data = FALSE; /* not a V25.ter, 07.07 char, so very likely a BAT command */ | |
282 break; | |
283 } | |
284 i++; | |
285 } | |
286 if (get_data EQ FALSE) | |
287 { | |
288 #endif /* _SIMULATION_ && FF_ATI_BAT */ | |
289 aci_bat_rcv(src_infos_psi,dti_data_ind); | |
290 | |
291 /* clean up the DTI primitive after BAT processing */ | |
292 while(p_desc NEQ NULL) | |
293 { | |
294 old_desc = p_desc; | |
295 p_desc = (T_desc2 *)p_desc->next; | |
296 ACI_MFREE( old_desc ); | |
297 } | |
298 PFREE(dti_data_ind); | |
299 return; | |
300 #if defined _SIMULATION_ && FF_ATI_BAT | |
301 } | |
302 #endif /* _SIMULATION && FF_ATI_BAT */ | |
303 } | |
304 #endif /* FF_BAT */ | |
305 | |
306 | |
307 ACI_MALLOC(chars_received, tot_len + 1); | |
308 while(p_desc NEQ NULL) | |
309 { | |
310 new_len += p_desc -> len; | |
311 if( new_len > tot_len) | |
312 { | |
313 TRACE_EVENT("inconsistance in datas received from DTI: ACI cannot process"); | |
314 ACI_MFREE(chars_received); | |
315 return; | |
316 } | |
317 memcpy(chars_received+pos,p_desc -> buffer,p_desc -> len); | |
318 /* trace_buffer (p_desc->buffer, p_desc->len);*/ | |
319 pos = new_len; | |
320 | |
321 old_desc = p_desc; /* save to free descriptor at the end */ | |
322 p_desc = (T_desc2 *)p_desc -> next; /* point to next one */ | |
323 ACI_MFREE( old_desc ); | |
324 } | |
325 | |
326 if (tot_len > 0) | |
327 { | |
328 if (src_infos NEQ NULL) | |
329 get_data = uart_src_proc_chars (chars_received, pos, src_infos); | |
330 #ifdef FF_PSI | |
331 else | |
332 get_data = psi_src_proc_chars (chars_received, pos, src_infos_psi); | |
333 #endif /*FF_PSI*/ | |
334 } | |
335 else | |
336 { | |
337 get_data = TRUE; | |
338 } | |
339 | |
340 ACI_MFREE( chars_received ); | |
341 chars_received = NULL; | |
342 | |
343 #ifdef FF_ATI_BAT | |
344 #ifdef _SIMULATION_ | |
345 if (aci_cmd_src_mode_get(src_id) EQ CMD_MODE_BAT) /* simulation with BAT library */ | |
346 { | |
347 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, src_id, search_ati_src_id); | |
348 T_ACI_DTI_PRC_PSI *src_infos_psi = find_element (psi_src_params, src_id, cmhPSItest_srcId); | |
349 while (ledit_ctrl(src_params->src_id,LEDIT_CTRL_MORE_CMDS, NULL) EQ LEDIT_CMPL) | |
350 { | |
351 ati_bat_response_simulation(&(src_infos_psi->res)); /* intermediate response */ | |
352 } | |
353 if (src_params->cmd_state NEQ CMD_IDLE) | |
354 { | |
355 if (src_infos_psi->res.response) | |
356 { | |
357 ati_bat_response_simulation(&(src_infos_psi->res)); /* final response */ | |
358 Perform_ati_bat_maint(src_id); | |
359 } | |
360 } | |
361 } | |
362 #endif /* _SIMULATION_ */ | |
363 #endif /* FF_ATI_BAT */ | |
364 | |
365 if( get_data ) | |
366 { | |
367 if (src_infos NEQ NULL) | |
368 cmhUART_getdata( (T_ACI_CMD_SRC)src_id ); | |
369 #ifdef FF_PSI | |
370 else if (src_infos_psi NEQ NULL) | |
371 cmhPSI_getdata ((T_ACI_CMD_SRC)src_id); | |
372 #endif /*FF_PSI*/ | |
373 } | |
374 PFREE(dti_data_ind); | |
375 } | |
376 | |
377 | |
378 /* | |
379 +------------------------------------------------------------------------------ | |
380 | Function : sig_dti_tx_buffer_full_ind | |
381 +------------------------------------------------------------------------------ | |
382 | PURPOSE : | |
383 +------------------------------------------------------------------------------ | |
384 */ | |
385 GLOBAL void sig_dti_tx_buffer_full_ind(UBYTE src_id) | |
386 { | |
387 TRACE_FUNCTION("sig_dti_tx_buffer_full_ind"); | |
388 | |
389 aci_src_dti_params[src_id].dtxState = NOT_READY; | |
390 } | |
391 | |
392 | |
393 /* | |
394 +------------------------------------------------------------------------------ | |
395 | Function : sig_dti_tx_buffer_ready_ind | |
396 +------------------------------------------------------------------------------ | |
397 | PURPOSE : | |
398 +------------------------------------------------------------------------------ | |
399 */ | |
400 GLOBAL void sig_dti_tx_buffer_ready_ind(UBYTE src_id) | |
401 { | |
402 T_ACI_DTI_PRC *src_infos = NULL; | |
403 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, src_id, search_ati_src_id); | |
404 #ifdef FF_PSI | |
405 T_ACI_DTI_PRC_PSI *src_infos_psi = NULL; | |
406 T_DTI_ENTITY_ID entity_list[2]; | |
407 #endif /*FF_PSI*/ | |
408 TRACE_FUNCTION("sig_dti_tx_buffer_ready_ind()"); | |
409 | |
410 aci_src_dti_params[src_id].dtxState = READY; | |
411 | |
412 if (aci_src_dti_params[src_id].isDtiConnected) | |
413 { | |
414 src_infos = find_element (uart_src_params, src_id, cmhUARTtest_srcId); | |
415 #ifdef FF_PSI | |
416 src_infos_psi = find_element (psi_src_params, src_id, cmhPSItest_srcId); | |
417 #endif /*FF_PSI*/ | |
418 /* | |
419 * send data which may have been stored .. | |
420 */ | |
421 if (src_infos NEQ NULL) | |
422 { | |
423 /* Need to return only when the data_list is not NULL so that the CMUX | |
424 part of the code will get executed. */ | |
425 if (src_infos->data_buffer.data_list NEQ NULL) | |
426 { | |
427 uart_send_buffer_data(src_id); | |
428 if (src_infos->data_buffer.data_list EQ NULL) | |
429 { | |
430 switch(src_params->curAtCmd) | |
431 { | |
432 case AT_CMD_COPN: | |
433 cmd_PlusCOPN_CB(src_id); | |
434 break; | |
435 | |
436 case AT_CMD_CPBR: | |
437 cmd_PlusCPBR_CB(src_id); | |
438 break; | |
439 | |
440 default:; /* Do nothing */ | |
441 } | |
442 } | |
443 return; | |
444 } | |
445 } | |
446 #ifdef FF_PSI | |
447 if (src_infos_psi NEQ NULL) | |
448 { | |
449 if (src_infos_psi->data_buffer.data_list NEQ NULL) | |
450 { | |
451 #ifdef FF_BAT | |
452 if (aci_cmd_src_mode_get((T_ACI_CMD_SRC)src_id) EQ CMD_MODE_BAT) | |
453 { | |
454 aci_bat_send_buffer_dti_data(src_id); | |
455 | |
456 /* | |
457 * CPBR and similar BAT commands | |
458 */ | |
459 aci_bat_check_for_multi_line_response_command(src_id); | |
460 } | |
461 else | |
462 #endif | |
463 { | |
464 psi_send_buffer_data(src_id); | |
465 } | |
466 if(src_infos_psi->data_buffer.data_list EQ NULL) | |
467 { | |
468 switch(src_params->curAtCmd) | |
469 { | |
470 case AT_CMD_COPN: | |
471 cmd_PlusCOPN_CB(src_id); | |
472 break; | |
473 | |
474 case AT_CMD_CPBR: | |
475 cmd_PlusCPBR_CB(src_id); | |
476 break; | |
477 | |
478 default:; /* Do nothing */ | |
479 } | |
480 } | |
481 return; | |
482 } | |
483 } | |
484 #endif /*FF_PSI*/ | |
485 { | |
486 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, src_id, search_ati_src_id); | |
487 if (uartEntcurCmd[src_id] EQ AT_CMD_CMUX) | |
488 { | |
489 if (cmhUART_CMUX ((T_ACI_CMD_SRC)src_id) EQ FALSE) | |
490 { | |
491 /* | |
492 * if we are here, we have a problem, because it has been sent an OK in advance to the source, | |
493 * which works according to GSM 27.010 | |
494 * So, how to inform the source, that the muxer has not been started ? | |
495 * see sAT_PlusCMUX() in cmh_uarts.c | |
496 */ | |
497 TRACE_EVENT("[ERR] sig_dti_tx_buffer_ready_ind(): UART muxer not ready"); | |
498 } | |
499 uartEntcurCmd[src_id] = AT_CMD_NONE; | |
500 } | |
501 #ifdef FF_PSI | |
502 else | |
503 { | |
504 if((psi_ato.last_cmd EQ AT_CMD_O) AND (src_infos_psi NEQ NULL)) | |
505 { | |
506 entity_list[0] = psi_ato.entity_to_conn; | |
507 dti_cntrl_est_dpath_indirect (psi_ato.src_id, | |
508 entity_list, | |
509 psi_ato.num_entities, | |
510 psi_ato.mode, | |
511 psi_ato.cb, | |
512 psi_ato.capability, | |
513 psi_ato.cid); | |
514 memset(&psi_ato,0,sizeof(T_ACI_PSI_CALL_TYPE)); | |
515 } | |
516 } | |
517 #endif /*FF_PSI*/ | |
518 } | |
519 } | |
520 } | |
521 | |
522 | |
523 | |
524 | |
525 | |
526 /* GLOBAL FUNCTIONS */ | |
527 | |
528 | |
529 /* | |
530 +-----------------------------------------------------------------------+ | |
531 | PROJECT : GSM-F&D (8411) MODULE : SAP_DTI | | |
532 | STATE : code ROUTINE : dti_lib_dti_dti_connect_cnf | | |
533 +-----------------------------------------------------------------------+ | |
534 | |
535 PURPOSE : | |
536 */ | |
537 GLOBAL void dti_lib_dti_dti_connect_cnf ( | |
538 T_DTI2_CONNECT_CNF *dti_connect_cnf) | |
539 { | |
540 TRACE_FUNCTION("dti_lib_dti_dti_connect_cnf()"); | |
541 dti_dti_connect_cnf(aci_hDTI, dti_connect_cnf); | |
542 } | |
543 | |
544 | |
545 /* | |
546 +-----------------------------------------------------------------------+ | |
547 | PROJECT : GSM-F&D (8411) MODULE : SAP_DTI | | |
548 | STATE : code ROUTINE : dti_lib_dti_dti_connect_ind | | |
549 +-----------------------------------------------------------------------+ | |
550 | |
551 PURPOSE : | |
552 */ | |
553 GLOBAL void dti_lib_dti_dti_connect_ind ( | |
554 T_DTI2_CONNECT_IND *dti_connect_ind) | |
555 { | |
556 TRACE_FUNCTION("dti_lib_dti_dti_connect_ind()"); | |
557 dti_dti_connect_ind(aci_hDTI, dti_connect_ind); | |
558 } | |
559 | |
560 | |
561 /* | |
562 +-----------------------------------------------------------------------+ | |
563 | PROJECT : GSM-F&D (8411) MODULE : SAP_DTI | | |
564 | STATE : code ROUTINE : dti_lib_dti_dti_disconnect_ind| | |
565 +-----------------------------------------------------------------------+ | |
566 | |
567 PURPOSE : | |
568 */ | |
569 GLOBAL void dti_lib_dti_dti_disconnect_ind ( | |
570 T_DTI2_DISCONNECT_IND *dti_disconnect_ind) | |
571 { | |
572 TRACE_FUNCTION("dti_lib_dti_dti_disconnect_ind()"); | |
573 dti_dti_disconnect_ind (aci_hDTI, dti_disconnect_ind); | |
574 } | |
575 | |
576 | |
577 /* | |
578 +-----------------------------------------------------------------------+ | |
579 | PROJECT : GSM-F&D (8411) MODULE : SAP_DTI | | |
580 | STATE : code ROUTINE : dti_lib_dti_dti_data_ind | | |
581 +-----------------------------------------------------------------------+ | |
582 | |
583 PURPOSE : | |
584 */ | |
585 GLOBAL void dti_lib_dti_dti_data_ind ( | |
586 T_DTI2_DATA_IND *dti_data_ind) | |
587 { | |
588 TRACE_FUNCTION("dti_lib_dti_dti_data_ind()"); | |
589 dti_dti_data_ind (aci_hDTI, dti_data_ind); | |
590 } | |
591 | |
592 | |
593 /* | |
594 +-----------------------------------------------------------------------+ | |
595 | PROJECT : GSM-F&D (8411) MODULE : SAP_DTI | | |
596 | STATE : code ROUTINE : dti_lib_dti_dti_ready_ind | | |
597 +-----------------------------------------------------------------------+ | |
598 | |
599 PURPOSE : | |
600 */ | |
601 GLOBAL void dti_lib_dti_dti_ready_ind ( | |
602 T_DTI2_READY_IND *dti_ready_ind) | |
603 { | |
604 TRACE_FUNCTION("dti_lib_dti_dti_ready_ind()"); | |
605 dti_dti_ready_ind (aci_hDTI, dti_ready_ind); | |
606 } | |
607 | |
608 | |
609 #ifdef _SIMULATION_ | |
610 /* | |
611 +-----------------------------------------------------------------------+ | |
612 | PROJECT : GSM-F&D (8411) MODULE : SAP_DTI | | |
613 | STATE : code ROUTINE : dti_lib_dti_dti_data_test_ind | | |
614 +-----------------------------------------------------------------------+ | |
615 | |
616 PURPOSE : | |
617 */ | |
618 GLOBAL const void dti_lib_dti_dti_data_test_ind ( | |
619 T_DTI2_DATA_TEST_IND *dti_data_test_ind) | |
620 { | |
621 TRACE_FUNCTION("dti_lib_dti_dti_data_test_ind()"); | |
622 dti_dti_data_test_ind (aci_hDTI, dti_data_test_ind); | |
623 } | |
624 #endif /* _SIMULATION_ */ | |
625 | |
626 | |
627 | |
628 /* | |
629 +-----------------------------------------------------------------------+ | |
630 | PROJECT : GSM-F&D (8411) MODULE : SAP_DTI | | |
631 | STATE : code ROUTINE : psaACI_Init | | |
632 +-----------------------------------------------------------------------+ | |
633 | |
634 PURPOSE : | |
635 */ | |
636 GLOBAL void psaACI_Init() | |
637 { | |
638 UBYTE i; | |
639 | |
640 TRACE_FUNCTION("psaACI_Init()"); | |
641 | |
642 for (i=0; i<CMD_SRC_MAX; i++) | |
643 { | |
644 aci_src_dti_params[i].isDtiConnected = FALSE; | |
645 aci_src_dti_params[i].dtxState = NOT_READY; | |
646 } | |
647 } | |
648 | |
649 | |
650 /* | |
651 +-----------------------------------------------------------------------+ | |
652 | PROJECT : GSM-F&D (8411) MODULE : SAP_DTI | | |
653 | STATE : code ROUTINE : aci_pei_sig_callback | | |
654 +-----------------------------------------------------------------------+ | |
655 | |
656 PURPOSE : | |
657 */ | |
658 GLOBAL void aci_pei_sig_callback(U8 instance, U8 interfac, U8 channel, | |
659 U8 reason, T_DTI2_DATA_IND *dti_data_ind) | |
660 { | |
661 UBYTE src_id = instance; | |
662 | |
663 TRACE_FUNCTION("aci_pei_sig_callback()"); | |
664 | |
665 | |
666 #ifdef _SIMULATION_ | |
667 if(channel NEQ ACI_DTI_DN_CHANNEL) | |
668 { | |
669 TRACE_ERROR("[DTI_MNG_SIG_CALLBACK] channel not valid!"); | |
670 return; /* error, not found */ | |
671 } | |
672 #endif /* _SIMULATION_ */ | |
673 | |
674 if (aci_hDTI NEQ D_NO_DATA_BASE) | |
675 { | |
676 switch (reason) | |
677 { | |
678 case DTI_REASON_CONNECTION_OPENED: | |
679 sig_dti_connection_opened_ind(src_id); | |
680 break; | |
681 | |
682 case DTI_REASON_CONNECTION_CLOSED: | |
683 sig_dti_connection_closed_ind(src_id); | |
684 break; | |
685 | |
686 case DTI_REASON_DATA_RECEIVED: | |
687 sig_dti_data_received_ind(src_id, dti_data_ind); | |
688 break; | |
689 | |
690 case DTI_REASON_TX_BUFFER_FULL: | |
691 sig_dti_tx_buffer_full_ind(src_id); | |
692 break; | |
693 | |
694 case DTI_REASON_TX_BUFFER_READY: | |
695 sig_dti_tx_buffer_ready_ind(src_id); | |
696 break; | |
697 | |
698 default: | |
699 TRACE_ERROR("unknown DTILIB reason parameter"); | |
700 break; | |
701 } /* end switch */ | |
702 } /* end if */ | |
703 else | |
704 { | |
705 TRACE_ERROR("Pointer to DTILIB database not existing"); | |
706 } | |
707 } /* dti_cntrl_mng_cb() */ | |
708 | |
709 | |
710 /* | |
711 +-----------------------------------------------------------------------+ | |
712 | PROJECT : GSM-F&D (8411) MODULE : PSA_ACI | | |
713 | STATE : code ROUTINE : psaACI_Dti_Req | | |
714 +-----------------------------------------------------------------------+ | |
715 | |
716 PURPOSE : | |
717 */ | |
718 GLOBAL BOOL psaACI_Dti_Req ( T_DTI_CONN_LINK_ID link_id, | |
719 T_DTI_ENTITY_ID peer_ent_id, | |
720 UBYTE dti_conn) | |
721 { | |
722 T_DTI_CNTRL info; | |
723 | |
724 TRACE_FUNCTION("psaACI_Dti_Req()"); | |
725 | |
726 | |
727 if (dti_cntrl_get_info_from_dti_id( EXTRACT_DTI_ID(link_id), &info) EQ FALSE) | |
728 { | |
729 TRACE_EVENT_P1("cannot find info for dti_id=%d", EXTRACT_DTI_ID(link_id)); | |
730 return FALSE; | |
731 } | |
732 | |
733 if (dti_conn EQ ACI_CONNECT_DTI) | |
734 { | |
735 aci_src_dti_params[info.src_id].dtxState = NOT_READY; | |
736 | |
737 if (dti_cntrl_set_conn_parms(link_id, DTI_ENTITY_ACI, info.src_id, DTI_SUB_NO_NOTPRESENT) EQ FALSE) | |
738 { | |
739 return FALSE; | |
740 } | |
741 if( !dti_open( | |
742 aci_hDTI, /* hDTI */ | |
743 info.src_id, /* instance */ | |
744 (U8)peer_ent_id, /* interface */ | |
745 ACI_DTI_DN_CHANNEL, /* channel */ | |
746 /* Since DTI-buffering wastes memory we have to implement our own buffers */ | |
747 /* This is vital for large outputs like AT+COPN, so please do not modify! */ | |
748 /* 0, */ /* queue_size */ | |
749 1, /* limit to 1 DTI buffer */ | |
750 DTI_CHANNEL_TO_LOWER_LAYER, /* direction */ | |
751 /* DTI_QUEUE_UNBOUNDED, */ /* link_options */ | |
752 DTI_QUEUE_WATERMARK, /* to enable ACI Buffers */ | |
753 DTI_VERSION_10, /* version */ | |
754 (UBYTE*)dti_entity_name[peer_ent_id].name, /* neighbor_entity */ | |
755 link_id /* link_id */ | |
756 )) | |
757 return FALSE; | |
758 } | |
759 else | |
760 { | |
761 dti_close | |
762 ( | |
763 aci_hDTI, /* hDTI */ | |
764 info.src_id, /* instance */ | |
765 (U8)peer_ent_id, /* interface */ | |
766 ACI_DTI_DN_CHANNEL, /* channel */ | |
767 TRUE /* flush */ | |
768 ); | |
769 } | |
770 | |
771 return TRUE; | |
772 } | |
773 #endif /* DTI */ |