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