FreeCalypso > hg > fc-tourmaline
comparison src/g23m-aci/aci/sap_dti.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 | |
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 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((T_ACI_CMD_SRC)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( (T_ACI_CMD_SRC)src_id ); | |
364 #ifdef FF_PSI | |
365 else if (src_infos_psi NEQ NULL) | |
366 cmhPSI_getdata ((T_ACI_CMD_SRC)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 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 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 /* Need to return only when the data_list is not NULL so that the CMUX | |
419 part of the code will get executed. */ | |
420 if (src_infos->data_buffer.data_list NEQ NULL) | |
421 { | |
422 uart_send_buffer_data(src_id); | |
423 if (src_infos->data_buffer.data_list EQ NULL) | |
424 { | |
425 switch(src_params->curAtCmd) | |
426 { | |
427 case AT_CMD_COPN: | |
428 cmd_PlusCOPN_CB(src_id); | |
429 break; | |
430 | |
431 case AT_CMD_CPBR: | |
432 cmd_PlusCPBR_CB(src_id); | |
433 break; | |
434 | |
435 default:; /* Do nothing */ | |
436 } | |
437 } | |
438 return; | |
439 } | |
440 } | |
441 #ifdef FF_PSI | |
442 if (src_infos_psi NEQ NULL) | |
443 { | |
444 if (src_infos_psi->data_buffer.data_list NEQ NULL) | |
445 { | |
446 #ifdef FF_BAT | |
447 if (aci_cmd_src_mode_get((T_ACI_CMD_SRC)src_id) EQ CMD_MODE_BAT) | |
448 { | |
449 aci_bat_send_buffer_dti_data(src_id); | |
450 | |
451 /* | |
452 * CPBR and similar BAT commands | |
453 */ | |
454 aci_bat_check_for_multi_line_response_command(src_id); | |
455 } | |
456 else | |
457 #endif | |
458 { | |
459 psi_send_buffer_data(src_id); | |
460 } | |
461 if(src_infos_psi->data_buffer.data_list EQ NULL) | |
462 { | |
463 switch(src_params->curAtCmd) | |
464 { | |
465 case AT_CMD_COPN: | |
466 cmd_PlusCOPN_CB(src_id); | |
467 break; | |
468 | |
469 case AT_CMD_CPBR: | |
470 cmd_PlusCPBR_CB(src_id); | |
471 break; | |
472 | |
473 default:; /* Do nothing */ | |
474 } | |
475 } | |
476 return; | |
477 } | |
478 } | |
479 #endif /*FF_PSI*/ | |
480 { | |
481 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, src_id, search_ati_src_id); | |
482 if (uartEntcurCmd[src_id] EQ AT_CMD_CMUX) | |
483 { | |
484 if (cmhUART_CMUX ((T_ACI_CMD_SRC)src_id) EQ FALSE) | |
485 { | |
486 /* | |
487 * if we are here, we have a problem, because it has been sent an OK in advance to the source, | |
488 * which works according to GSM 27.010 | |
489 * So, how to inform the source, that the muxer has not been started ? | |
490 * see sAT_PlusCMUX() in cmh_uarts.c | |
491 */ | |
492 TRACE_EVENT("[ERR] sig_dti_tx_buffer_ready_ind(): UART muxer not ready"); | |
493 } | |
494 uartEntcurCmd[src_id] = AT_CMD_NONE; | |
495 } | |
496 #ifdef FF_PSI | |
497 else | |
498 { | |
499 if((psi_ato.last_cmd EQ AT_CMD_O) AND (src_infos_psi NEQ NULL)) | |
500 { | |
501 entity_list[0] = psi_ato.entity_to_conn; | |
502 dti_cntrl_est_dpath_indirect (psi_ato.src_id, | |
503 entity_list, | |
504 psi_ato.num_entities, | |
505 psi_ato.mode, | |
506 psi_ato.cb, | |
507 psi_ato.capability, | |
508 psi_ato.cid); | |
509 memset(&psi_ato,0,sizeof(T_ACI_PSI_CALL_TYPE)); | |
510 } | |
511 } | |
512 #endif /*FF_PSI*/ | |
513 } | |
514 } | |
515 } | |
516 | |
517 | |
518 | |
519 | |
520 | |
521 /* GLOBAL FUNCTIONS */ | |
522 | |
523 | |
524 /* | |
525 +-----------------------------------------------------------------------+ | |
526 | PROJECT : GSM-F&D (8411) MODULE : SAP_DTI | | |
527 | STATE : code ROUTINE : dti_lib_dti_dti_connect_cnf | | |
528 +-----------------------------------------------------------------------+ | |
529 | |
530 PURPOSE : | |
531 */ | |
532 GLOBAL void dti_lib_dti_dti_connect_cnf ( | |
533 T_DTI2_CONNECT_CNF *dti_connect_cnf) | |
534 { | |
535 TRACE_FUNCTION("dti_lib_dti_dti_connect_cnf()"); | |
536 dti_dti_connect_cnf(aci_hDTI, dti_connect_cnf); | |
537 } | |
538 | |
539 | |
540 /* | |
541 +-----------------------------------------------------------------------+ | |
542 | PROJECT : GSM-F&D (8411) MODULE : SAP_DTI | | |
543 | STATE : code ROUTINE : dti_lib_dti_dti_connect_ind | | |
544 +-----------------------------------------------------------------------+ | |
545 | |
546 PURPOSE : | |
547 */ | |
548 GLOBAL void dti_lib_dti_dti_connect_ind ( | |
549 T_DTI2_CONNECT_IND *dti_connect_ind) | |
550 { | |
551 TRACE_FUNCTION("dti_lib_dti_dti_connect_ind()"); | |
552 dti_dti_connect_ind(aci_hDTI, dti_connect_ind); | |
553 } | |
554 | |
555 | |
556 /* | |
557 +-----------------------------------------------------------------------+ | |
558 | PROJECT : GSM-F&D (8411) MODULE : SAP_DTI | | |
559 | STATE : code ROUTINE : dti_lib_dti_dti_disconnect_ind| | |
560 +-----------------------------------------------------------------------+ | |
561 | |
562 PURPOSE : | |
563 */ | |
564 GLOBAL void dti_lib_dti_dti_disconnect_ind ( | |
565 T_DTI2_DISCONNECT_IND *dti_disconnect_ind) | |
566 { | |
567 TRACE_FUNCTION("dti_lib_dti_dti_disconnect_ind()"); | |
568 dti_dti_disconnect_ind (aci_hDTI, dti_disconnect_ind); | |
569 } | |
570 | |
571 | |
572 /* | |
573 +-----------------------------------------------------------------------+ | |
574 | PROJECT : GSM-F&D (8411) MODULE : SAP_DTI | | |
575 | STATE : code ROUTINE : dti_lib_dti_dti_data_ind | | |
576 +-----------------------------------------------------------------------+ | |
577 | |
578 PURPOSE : | |
579 */ | |
580 GLOBAL void dti_lib_dti_dti_data_ind ( | |
581 T_DTI2_DATA_IND *dti_data_ind) | |
582 { | |
583 TRACE_FUNCTION("dti_lib_dti_dti_data_ind()"); | |
584 dti_dti_data_ind (aci_hDTI, dti_data_ind); | |
585 } | |
586 | |
587 | |
588 /* | |
589 +-----------------------------------------------------------------------+ | |
590 | PROJECT : GSM-F&D (8411) MODULE : SAP_DTI | | |
591 | STATE : code ROUTINE : dti_lib_dti_dti_ready_ind | | |
592 +-----------------------------------------------------------------------+ | |
593 | |
594 PURPOSE : | |
595 */ | |
596 GLOBAL void dti_lib_dti_dti_ready_ind ( | |
597 T_DTI2_READY_IND *dti_ready_ind) | |
598 { | |
599 TRACE_FUNCTION("dti_lib_dti_dti_ready_ind()"); | |
600 dti_dti_ready_ind (aci_hDTI, dti_ready_ind); | |
601 } | |
602 | |
603 | |
604 #ifdef _SIMULATION_ | |
605 /* | |
606 +-----------------------------------------------------------------------+ | |
607 | PROJECT : GSM-F&D (8411) MODULE : SAP_DTI | | |
608 | STATE : code ROUTINE : dti_lib_dti_dti_data_test_ind | | |
609 +-----------------------------------------------------------------------+ | |
610 | |
611 PURPOSE : | |
612 */ | |
613 GLOBAL const void dti_lib_dti_dti_data_test_ind ( | |
614 T_DTI2_DATA_TEST_IND *dti_data_test_ind) | |
615 { | |
616 TRACE_FUNCTION("dti_lib_dti_dti_data_test_ind()"); | |
617 dti_dti_data_test_ind (aci_hDTI, dti_data_test_ind); | |
618 } | |
619 #endif /* _SIMULATION_ */ | |
620 | |
621 | |
622 | |
623 /* | |
624 +-----------------------------------------------------------------------+ | |
625 | PROJECT : GSM-F&D (8411) MODULE : SAP_DTI | | |
626 | STATE : code ROUTINE : psaACI_Init | | |
627 +-----------------------------------------------------------------------+ | |
628 | |
629 PURPOSE : | |
630 */ | |
631 GLOBAL void psaACI_Init() | |
632 { | |
633 UBYTE i; | |
634 | |
635 TRACE_FUNCTION("psaACI_Init()"); | |
636 | |
637 for (i=0; i<CMD_SRC_MAX; i++) | |
638 { | |
639 aci_src_dti_params[i].isDtiConnected = FALSE; | |
640 aci_src_dti_params[i].dtxState = NOT_READY; | |
641 } | |
642 } | |
643 | |
644 | |
645 /* | |
646 +-----------------------------------------------------------------------+ | |
647 | PROJECT : GSM-F&D (8411) MODULE : SAP_DTI | | |
648 | STATE : code ROUTINE : aci_pei_sig_callback | | |
649 +-----------------------------------------------------------------------+ | |
650 | |
651 PURPOSE : | |
652 */ | |
653 GLOBAL void aci_pei_sig_callback(U8 instance, U8 interfac, U8 channel, | |
654 U8 reason, T_DTI2_DATA_IND *dti_data_ind) | |
655 { | |
656 UBYTE src_id = instance; | |
657 | |
658 TRACE_FUNCTION("aci_pei_sig_callback()"); | |
659 | |
660 | |
661 #ifdef _SIMULATION_ | |
662 if(channel NEQ ACI_DTI_DN_CHANNEL) | |
663 { | |
664 TRACE_ERROR("[DTI_MNG_SIG_CALLBACK] channel not valid!"); | |
665 return; /* error, not found */ | |
666 } | |
667 #endif /* _SIMULATION_ */ | |
668 | |
669 if (aci_hDTI NEQ D_NO_DATA_BASE) | |
670 { | |
671 switch (reason) | |
672 { | |
673 case DTI_REASON_CONNECTION_OPENED: | |
674 sig_dti_connection_opened_ind(src_id); | |
675 break; | |
676 | |
677 case DTI_REASON_CONNECTION_CLOSED: | |
678 sig_dti_connection_closed_ind(src_id); | |
679 break; | |
680 | |
681 case DTI_REASON_DATA_RECEIVED: | |
682 sig_dti_data_received_ind(src_id, dti_data_ind); | |
683 break; | |
684 | |
685 case DTI_REASON_TX_BUFFER_FULL: | |
686 sig_dti_tx_buffer_full_ind(src_id); | |
687 break; | |
688 | |
689 case DTI_REASON_TX_BUFFER_READY: | |
690 sig_dti_tx_buffer_ready_ind(src_id); | |
691 break; | |
692 | |
693 default: | |
694 TRACE_ERROR("unknown DTILIB reason parameter"); | |
695 break; | |
696 } /* end switch */ | |
697 } /* end if */ | |
698 else | |
699 { | |
700 TRACE_ERROR("Pointer to DTILIB database not existing"); | |
701 } | |
702 } /* dti_cntrl_mng_cb() */ | |
703 | |
704 | |
705 /* | |
706 +-----------------------------------------------------------------------+ | |
707 | PROJECT : GSM-F&D (8411) MODULE : PSA_ACI | | |
708 | STATE : code ROUTINE : psaACI_Dti_Req | | |
709 +-----------------------------------------------------------------------+ | |
710 | |
711 PURPOSE : | |
712 */ | |
713 GLOBAL BOOL psaACI_Dti_Req ( T_DTI_CONN_LINK_ID link_id, | |
714 T_DTI_ENTITY_ID peer_ent_id, | |
715 UBYTE dti_conn) | |
716 { | |
717 T_DTI_CNTRL info; | |
718 | |
719 TRACE_FUNCTION("psaACI_Dti_Req()"); | |
720 | |
721 | |
722 if (dti_cntrl_get_info_from_dti_id( EXTRACT_DTI_ID(link_id), &info) EQ FALSE) | |
723 { | |
724 TRACE_EVENT_P1("cannot find info for dti_id=%d", EXTRACT_DTI_ID(link_id)); | |
725 return FALSE; | |
726 } | |
727 | |
728 if (dti_conn EQ ACI_CONNECT_DTI) | |
729 { | |
730 aci_src_dti_params[info.src_id].dtxState = NOT_READY; | |
731 | |
732 if (dti_cntrl_set_conn_parms(link_id, DTI_ENTITY_ACI, info.src_id, DTI_SUB_NO_NOTPRESENT) EQ FALSE) | |
733 { | |
734 return FALSE; | |
735 } | |
736 if( !dti_open( | |
737 aci_hDTI, /* hDTI */ | |
738 info.src_id, /* instance */ | |
739 (U8)peer_ent_id, /* interface */ | |
740 ACI_DTI_DN_CHANNEL, /* channel */ | |
741 /* Since DTI-buffering wastes memory we have to implement our own buffers */ | |
742 /* This is vital for large outputs like AT+COPN, so please do not modify! */ | |
743 /* 0, */ /* queue_size */ | |
744 1, /* limit to 1 DTI buffer */ | |
745 DTI_CHANNEL_TO_LOWER_LAYER, /* direction */ | |
746 /* DTI_QUEUE_UNBOUNDED, */ /* link_options */ | |
747 DTI_QUEUE_WATERMARK, /* to enable ACI Buffers */ | |
748 DTI_VERSION_10, /* version */ | |
749 (UBYTE*)dti_entity_name[peer_ent_id].name, /* neighbor_entity */ | |
750 link_id /* link_id */ | |
751 )) | |
752 return FALSE; | |
753 } | |
754 else | |
755 { | |
756 dti_close | |
757 ( | |
758 aci_hDTI, /* hDTI */ | |
759 info.src_id, /* instance */ | |
760 (U8)peer_ent_id, /* interface */ | |
761 ACI_DTI_DN_CHANNEL, /* channel */ | |
762 TRUE /* flush */ | |
763 ); | |
764 } | |
765 | |
766 return TRUE; | |
767 } | |
768 #endif /* DTI */ |