FreeCalypso > hg > fc-tourmaline
comparison src/g23m-aci/aci/ati_src_uart_io.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 : | |
| 4 | Modul : J:\g23m-aci\aci\ati_src_uart_io.c | |
| 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 : | |
| 18 +----------------------------------------------------------------------------- | |
| 19 */ | |
| 20 | |
| 21 #ifdef UART | |
| 22 | |
| 23 #ifndef ATI_SRC_UART_IO_C | |
| 24 #define ATI_SRC_UART_IO_C | |
| 25 #endif | |
| 26 | |
| 27 #include "aci_all.h" | |
| 28 /*==== INCLUDES ===================================================*/ | |
| 29 #include "aci_cmh.h" | |
| 30 #include "ati_cmd.h" | |
| 31 #include "aci_cmd.h" | |
| 32 #include "dti.h" /* functionality of the dti library */ | |
| 33 | |
| 34 #include "aci_lst.h" | |
| 35 #include "dti_conn_mng.h" | |
| 36 | |
| 37 #include "psa_uart.h" | |
| 38 #include "cmh_uart.h" | |
| 39 | |
| 40 #ifdef _SIMULATION_ | |
| 41 #include "aci.h" | |
| 42 #include "ati_src_tst.h" | |
| 43 | |
| 44 # ifdef SMI | |
| 45 # undef hCommMMI | |
| 46 # define hCommMMI hCommSMI | |
| 47 # endif | |
| 48 | |
| 49 EXTERN T_ACI_LIST *ati_src_list; | |
| 50 #endif | |
| 51 | |
| 52 #include "aci_io.h" | |
| 53 #include "ati_io.h" | |
| 54 #include "aci_mem.h" | |
| 55 #include "ati_src_uart.h" | |
| 56 #include "aci.h" | |
| 57 #include "sap_dti.h" | |
| 58 | |
| 59 /*==== CONSTANTS ==================================================*/ | |
| 60 #define MAX_NORMAL_BUFFER_LEN (100-4) // Since Malloc uses 4 additional internal bytes of the Blocks | |
| 61 #ifdef GPRS | |
| 62 #define MAX_LARGE_BUFFER_LEN (600-4) | |
| 63 #else | |
| 64 #define MAX_LARGE_BUFFER_LEN (400-4) | |
| 65 #endif | |
| 66 /*==== TYPES ======================================================*/ | |
| 67 | |
| 68 /*==== EXPORT =====================================================*/ | |
| 69 | |
| 70 /*==== VARIABLES ==================================================*/ | |
| 71 /*==== FUNCTIONS ==================================================*/ | |
| 72 LOCAL void io_DTIsendString (UBYTE *string, USHORT string_len, | |
| 73 T_ACI_DTI_PRC *src_infos, | |
| 74 T_ATI_OUTPUT_TYPE output_type); | |
| 75 | |
| 76 /* LOCAL void uart_buffer_data(T_ACI_DTI_PRC * src_infos, T_desc2 * send_data); */ | |
| 77 | |
| 78 #ifdef _SIMULATION_ | |
| 79 LOCAL BOOL get_source_type( UBYTE src_id, T_ATI_SRC_TYPE *src_type ); | |
| 80 #endif | |
| 81 /*=================================================================*/ | |
| 82 | |
| 83 | |
| 84 GLOBAL void uart_src_result_cb (UBYTE src_id, | |
| 85 T_ATI_OUTPUT_TYPE output_type, | |
| 86 UBYTE *output, | |
| 87 USHORT output_len) | |
| 88 { | |
| 89 T_ACI_DTI_PRC *src_infos; | |
| 90 TRACE_FUNCTION("uart_src_result_cb()"); | |
| 91 | |
| 92 #ifdef RMV_01_04_03 | |
| 93 #ifdef FF_TWO_UART_PORTS | |
| 94 /* disable output to UART on data channel */ | |
| 95 if (src_id EQ UART_DATA_CHANNEL) | |
| 96 { | |
| 97 return; | |
| 98 } | |
| 99 #endif | |
| 100 #endif | |
| 101 src_infos = find_element (uart_src_params, (UBYTE)src_id, cmhUARTtest_srcId); | |
| 102 if (src_infos EQ NULL) | |
| 103 { | |
| 104 TRACE_EVENT_P1("[ERR] uart_src_result_cb: src_id=%d not found", src_id) ; | |
| 105 return ; | |
| 106 } | |
| 107 | |
| 108 switch (src_infos->LineState) | |
| 109 { | |
| 110 case LINE_CONNECTING: | |
| 111 case LINE_CONNECTED: | |
| 112 case LINE_TMP_CONNECTED: | |
| 113 break; | |
| 114 | |
| 115 case LINE_TMP_DISCONNECTING: | |
| 116 case LINE_TMP_DISCONNECTED: | |
| 117 if (IS_FORCED_OUTPUT (output_type) || IS_CONFIRM_OUTPUT (output_type)) | |
| 118 { | |
| 119 break; | |
| 120 } | |
| 121 return; | |
| 122 | |
| 123 case LINE_DISCONNECTED: | |
| 124 return; | |
| 125 } | |
| 126 | |
| 127 if (src_infos->first_output EQ TRUE) | |
| 128 { | |
| 129 src_infos->first_output = FALSE; | |
| 130 output_type |= ATI_BEGIN_CRLF_OUTPUT; | |
| 131 } | |
| 132 io_DTIsendString (output, output_len, src_infos, output_type); | |
| 133 } | |
| 134 | |
| 135 | |
| 136 GLOBAL void uart_src_line_state_cb (UBYTE src_id, | |
| 137 T_ATI_LINE_STATE_TYPE line_state_type, | |
| 138 ULONG line_state_param) | |
| 139 { | |
| 140 T_ACI_DTI_PRC *src_infos; | |
| 141 | |
| 142 TRACE_FUNCTION("uart_src_line_state_cb()"); | |
| 143 | |
| 144 src_infos = find_element (uart_src_params, (UBYTE)src_id, cmhUARTtest_srcId); | |
| 145 if (src_infos EQ NULL) | |
| 146 { | |
| 147 TRACE_EVENT ("[ERR] uart_src_line_state_cb: src_id not found"); | |
| 148 return; | |
| 149 } | |
| 150 | |
| 151 /* tlu: */ | |
| 152 /* | |
| 153 switch (src_infos->LineState) | |
| 154 { | |
| 155 case LINE_TMP_DISCONNECTED: | |
| 156 case LINE_DISCONNECTED: | |
| 157 return; | |
| 158 } | |
| 159 */ | |
| 160 | |
| 161 switch (line_state_type) | |
| 162 { | |
| 163 case ATI_LINE_STATE_OUTPUT_TYPE: | |
| 164 TRACE_EVENT_P1 ("output type: %d",line_state_param); | |
| 165 src_infos->run_cmd = TRUE; | |
| 166 src_infos->first_output = TRUE; | |
| 167 | |
| 168 if( line_state_param EQ ATI_OUTPUT_TYPE_LARGE ) | |
| 169 { | |
| 170 src_infos->large_type = TRUE; | |
| 171 } | |
| 172 else | |
| 173 { | |
| 174 src_infos->large_type = FALSE; | |
| 175 } | |
| 176 break; | |
| 177 | |
| 178 case ATI_LINE_STATE_DCD: | |
| 179 | |
| 180 if(line_state_param EQ IO_DCD_ON) | |
| 181 { | |
| 182 BITFIELD_SET (src_infos->data_cntr, UART_DTI_SB_BIT); | |
| 183 } | |
| 184 else | |
| 185 { | |
| 186 BITFIELD_CLEAR (src_infos->data_cntr, UART_DTI_SB_BIT); | |
| 187 } | |
| 188 /* tlu: */ | |
| 189 /* | |
| 190 if (src_infos->LineState EQ LINE_CONNECTED) | |
| 191 { | |
| 192 psaUART_DCDreq( src_id, (UBYTE)line_state_param ); | |
| 193 } | |
| 194 */ | |
| 195 psaUART_DCDreq( src_id, (UBYTE)line_state_param ); | |
| 196 | |
| 197 break; | |
| 198 | |
| 199 case ATI_LINE_STATE_RNG: | |
| 200 { | |
| 201 T_IO_RING_PARAMS rng_params; | |
| 202 #ifdef RMV_01_04_03 | |
| 203 #ifdef FF_TWO_UART_PORTS | |
| 204 /* disable RING on data channel */ | |
| 205 if (src_id EQ UART_DATA_CHANNEL) | |
| 206 { | |
| 207 break; | |
| 208 } | |
| 209 #endif | |
| 210 #endif | |
| 211 memcpy (&rng_params, (T_IO_RING_PARAMS*)line_state_param, | |
| 212 sizeof(T_IO_RING_PARAMS)); | |
| 213 psaUART_RINGreq( src_id, (UBYTE)rng_params.ring_stat ); | |
| 214 break; | |
| 215 } | |
| 216 | |
| 217 case ATI_LINE_STATE_START: | |
| 218 break; | |
| 219 | |
| 220 case ATI_LINE_STATE_END: | |
| 221 src_infos->run_cmd = FALSE; | |
| 222 break; | |
| 223 | |
| 224 default: | |
| 225 { | |
| 226 TRACE_EVENT_P1("[WRN] uart_src_line_state_cb (): "\ | |
| 227 "UNKNOWN line_state_type = %d", line_state_type); | |
| 228 break; | |
| 229 } | |
| 230 } | |
| 231 } | |
| 232 | |
| 233 LOCAL T_desc2 *get_last_buffer (T_desc2 *data_head) | |
| 234 { | |
| 235 T_desc2 *next_data; | |
| 236 | |
| 237 if (data_head EQ NULL) | |
| 238 { | |
| 239 return (NULL); | |
| 240 } | |
| 241 | |
| 242 next_data = data_head; | |
| 243 while ((T_desc2*)next_data->next NEQ NULL) | |
| 244 { | |
| 245 next_data = (T_desc2*)next_data->next; | |
| 246 } | |
| 247 | |
| 248 return (next_data); | |
| 249 } | |
| 250 | |
| 251 | |
| 252 LOCAL T_desc2 *get_new_buffer (BOOL large_type, USHORT *max_buffer_size) | |
| 253 { | |
| 254 T_desc2 *new_buffer; | |
| 255 | |
| 256 if (large_type EQ TRUE) | |
| 257 *max_buffer_size = MAX_LARGE_BUFFER_LEN; | |
| 258 else | |
| 259 *max_buffer_size = MAX_NORMAL_BUFFER_LEN; | |
| 260 | |
| 261 ACI_MALLOC (new_buffer, *max_buffer_size); | |
| 262 *max_buffer_size -= (sizeof(T_desc2) - 1); | |
| 263 | |
| 264 new_buffer->next = (ULONG)NULL; | |
| 265 new_buffer->len = 0; | |
| 266 new_buffer->size = *max_buffer_size; | |
| 267 new_buffer->offset = 0; | |
| 268 | |
| 269 return (new_buffer); | |
| 270 } | |
| 271 | |
| 272 LOCAL void free_data_buffer (T_ACI_DTI_DATA_BUF *data_buffer) | |
| 273 { | |
| 274 T_desc2 *p_desc=NULL,*p_desc_next=NULL; | |
| 275 | |
| 276 if (data_buffer->data_list EQ NULL) | |
| 277 { | |
| 278 return; | |
| 279 } | |
| 280 | |
| 281 p_desc = data_buffer->data_list; | |
| 282 if (p_desc NEQ NULL) | |
| 283 { | |
| 284 p_desc_next = (T_desc2 *)p_desc->next; | |
| 285 } | |
| 286 | |
| 287 while (p_desc NEQ NULL) | |
| 288 { | |
| 289 ACI_MFREE (p_desc); | |
| 290 | |
| 291 p_desc = p_desc_next; | |
| 292 if (p_desc NEQ NULL) | |
| 293 { | |
| 294 p_desc_next = (T_desc2 *)p_desc->next; | |
| 295 } | |
| 296 } | |
| 297 | |
| 298 data_buffer->data_list = NULL; | |
| 299 data_buffer->max_buffer_size = 0; | |
| 300 data_buffer->create_time = 0; | |
| 301 } | |
| 302 | |
| 303 | |
| 304 GLOBAL void uart_buffer_data (T_ACI_DTI_PRC *src_infos, T_desc2 *send_data) | |
| 305 { | |
| 306 T_desc2 *active_buffer, *last_buffer; | |
| 307 USHORT i, j; | |
| 308 T_TIME current_time; | |
| 309 TRACE_FUNCTION("uart_buffer_data()"); | |
| 310 | |
| 311 last_buffer = get_last_buffer(src_infos->data_buffer.data_list); | |
| 312 active_buffer = last_buffer; | |
| 313 | |
| 314 if (last_buffer EQ NULL) | |
| 315 { | |
| 316 active_buffer = get_new_buffer (src_infos->large_type, | |
| 317 &src_infos->data_buffer.max_buffer_size); | |
| 318 src_infos->data_buffer.data_list = active_buffer; | |
| 319 last_buffer = active_buffer; | |
| 320 /* store the creation time for the data buffer */ | |
| 321 vsi_t_time (VSI_CALLER &src_infos->data_buffer.create_time); | |
| 322 } | |
| 323 else | |
| 324 { | |
| 325 /* | |
| 326 If no device is connected to UART it is possible that the buffer | |
| 327 use all available memory. | |
| 328 Solution: | |
| 329 When the line is connected, check the life time of the | |
| 330 data buffer. Remove the buffer if the live time is greater than | |
| 331 30 sec. (only if line is in data mode (line is disconnected)). | |
| 332 */ | |
| 333 // if (src_infos->LineState EQ LINE_CONNECTED) // line is always connected | |
| 334 { | |
| 335 vsi_t_time (VSI_CALLER ¤t_time); | |
| 336 if ((current_time - src_infos->data_buffer.create_time) > MAX_DATA_BUFFER_LIFE_TIME) | |
| 337 { | |
| 338 TRACE_EVENT_P1 ("[WRN] uart_buffer_data(): life time expired, buffer deleted (%d)", | |
| 339 current_time - src_infos->data_buffer.create_time); | |
| 340 free_data_buffer (&src_infos->data_buffer); | |
| 341 return; | |
| 342 } | |
| 343 } | |
| 344 } | |
| 345 | |
| 346 i = 0; | |
| 347 while (i < send_data->len) | |
| 348 { | |
| 349 if (active_buffer->len EQ active_buffer->size) // (src_infos->data_buffer.max_buffer_size)) | |
| 350 { | |
| 351 active_buffer = get_new_buffer (src_infos->large_type, | |
| 352 &src_infos->data_buffer.max_buffer_size); | |
| 353 last_buffer->next = (ULONG)active_buffer; | |
| 354 last_buffer = active_buffer; | |
| 355 } | |
| 356 // Optimize for Speed | |
| 357 j = MINIMUM((active_buffer->size - active_buffer->len), (send_data->len - i)); | |
| 358 if (j>1) | |
| 359 { | |
| 360 memcpy((char *)&active_buffer->buffer[active_buffer->len], (char *)&send_data->buffer[i], j);/*lint !e670 (Warning: Possible access beyond array for function)*/ | |
| 361 active_buffer->len += j; | |
| 362 i += j; | |
| 363 } | |
| 364 else | |
| 365 active_buffer->buffer[active_buffer->len++] = send_data->buffer[i++]; | |
| 366 } | |
| 367 } | |
| 368 | |
| 369 | |
| 370 GLOBAL void uart_send_buffer_data (UBYTE src_id) | |
| 371 { | |
| 372 T_ACI_DTI_PRC *src_infos = NULL; | |
| 373 | |
| 374 TRACE_FUNCTION("uart_send_buffer_data()"); | |
| 375 | |
| 376 /* dti_id should be supported by DTI_ENTITY_ID or something, here.. */ | |
| 377 src_infos = find_element (uart_src_params, src_id, | |
| 378 cmhUARTtest_srcId); | |
| 379 #ifdef DTI | |
| 380 if (aci_src_dti_params[src_id].isDtiConnected EQ FALSE) | |
| 381 { | |
| 382 TRACE_EVENT ("DTI_READY_IND: line not connected"); | |
| 383 return; | |
| 384 } | |
| 385 #endif /* DTI */ | |
| 386 /* | |
| 387 * send data which may have been stored .. | |
| 388 */ | |
| 389 if (src_infos->data_buffer.data_list NEQ NULL) | |
| 390 { | |
| 391 #ifdef DTI | |
| 392 #ifdef _SIMULATION_ | |
| 393 { | |
| 394 T_ATI_SRC_TYPE src_type; | |
| 395 | |
| 396 if(get_source_type(src_infos->srcId, &src_type)) | |
| 397 { | |
| 398 if( ATI_SRC_TYPE_TST EQ src_type ) | |
| 399 { | |
| 400 ati_src_tst_sendString(src_infos->data_buffer.data_list, src_infos->srcId); | |
| 401 } | |
| 402 else | |
| 403 { | |
| 404 psaDTI_data_req (src_infos->data_buffer.data_list, src_infos, DTI_ENTITY_UART); | |
| 405 } | |
| 406 } | |
| 407 } | |
| 408 #else | |
| 409 psaDTI_data_req (src_infos->data_buffer.data_list, src_infos, DTI_ENTITY_UART); | |
| 410 #endif /* _SIMULATION_ */ | |
| 411 #endif /* DTI */ | |
| 412 src_infos->data_buffer.data_list = NULL; | |
| 413 src_infos->data_buffer.max_buffer_size = 0; | |
| 414 src_infos->data_buffer.create_time = 0; | |
| 415 } | |
| 416 | |
| 417 /* this is wrong here, moved to ati_src_uart.c */ | |
| 418 /* | |
| 419 if (uartShrdPrm.dtr_clearcall EQ TRUE) | |
| 420 { | |
| 421 T_ACI_RETURN ret; | |
| 422 | |
| 423 ret = sAT_H(src_infos->srcId); | |
| 424 if (ret != AT_EXCT && ret != AT_CMPL) | |
| 425 { | |
| 426 uartShrdPrm.dtr_clearcall = FALSE; | |
| 427 TRACE_ERROR("sAT_H() error"); | |
| 428 } | |
| 429 } | |
| 430 */ | |
| 431 } | |
| 432 | |
| 433 | |
| 434 LOCAL T_desc2 *make_send_data (UBYTE *data, USHORT data_len, | |
| 435 T_ATI_OUTPUT_TYPE output_type) | |
| 436 { | |
| 437 T_desc2 *send_data; | |
| 438 USHORT send_len = 0; | |
| 439 #if !defined (_SIMULATION_) OR defined(ACIDTI_TEST_SIM) | |
| 440 static UBYTE formated_output[MAX_CMD_LEN+5]; | |
| 441 USHORT formated_len; | |
| 442 | |
| 443 formated_len = format_output (data, data_len, formated_output, output_type); | |
| 444 send_len = sizeof(T_desc2) - 1 + formated_len; | |
| 445 | |
| 446 ACI_MALLOC(send_data, send_len); | |
| 447 send_data->next = (ULONG)NULL; | |
| 448 send_data->len = formated_len; | |
| 449 send_data->size = formated_len; | |
| 450 send_data->offset = 0; | |
| 451 memcpy(send_data->buffer, formated_output, formated_len); | |
| 452 | |
| 453 #else /* _SIMULATION_ */ | |
| 454 | |
| 455 send_len = sizeof(T_desc2) - 1 + data_len; | |
| 456 | |
| 457 ACI_MALLOC(send_data, send_len); | |
| 458 send_data->next = (ULONG)NULL; | |
| 459 send_data->len = data_len; | |
| 460 send_data->size = data_len; | |
| 461 send_data->offset = 0; | |
| 462 memcpy(send_data->buffer, data, data_len); | |
| 463 | |
| 464 #endif /* _SIMULATION_ */ | |
| 465 | |
| 466 return (send_data); | |
| 467 } | |
| 468 | |
| 469 | |
| 470 /* | |
| 471 +-------------------------------------------------------------------+ | |
| 472 | PROJECT : GSM-PS (6147) MODULE : CMH_DTIS | | |
| 473 | ROUTINE : io_DTIsendString | | |
| 474 +-------------------------------------------------------------------+ | |
| 475 | |
| 476 PURPOSE : format output string and send to the UART through DTI | |
| 477 */ | |
| 478 | |
| 479 LOCAL void io_DTIsendString (UBYTE *string, USHORT string_len, | |
| 480 T_ACI_DTI_PRC *src_infos, | |
| 481 T_ATI_OUTPUT_TYPE output_type) | |
| 482 { | |
| 483 T_desc2 *send_data; | |
| 484 #ifdef _SIMULATION_ | |
| 485 T_ATI_SRC_TYPE src_type; | |
| 486 | |
| 487 /* | |
| 488 * get_source_type() writes an trace_event in the error case. | |
| 489 */ | |
| 490 if(!get_source_type(src_infos->srcId, &src_type)) | |
| 491 return; | |
| 492 #endif /* _SIMULATION_ */ | |
| 493 | |
| 494 TRACE_FUNCTION("io_DTIsendString"); | |
| 495 if (!IS_ECHO_OUTPUT (output_type)) | |
| 496 { | |
| 497 #ifdef _SIMULATION_ | |
| 498 if( ATI_SRC_TYPE_TST NEQ src_type ) | |
| 499 #endif /* _SIMULATION_ */ | |
| 500 { | |
| 501 trace_cmd_line ("OUT:", (CHAR*)string, src_infos->srcId, string_len); | |
| 502 } | |
| 503 } | |
| 504 | |
| 505 if (string_len > MAX_LARGE_BUFFER_LEN) | |
| 506 { | |
| 507 TRACE_ERROR ("String too large for io_DTIsendString!"); | |
| 508 TRACE_EVENT_P2 ("Truncating string from %d to %d", string_len, MAX_LARGE_BUFFER_LEN); | |
| 509 string_len = MAX_LARGE_BUFFER_LEN; | |
| 510 } | |
| 511 | |
| 512 send_data = make_send_data (string, string_len, output_type); | |
| 513 | |
| 514 #ifdef DTI | |
| 515 if ((aci_src_dti_params[src_infos->srcId].isDtiConnected) AND | |
| 516 (aci_src_dti_params[src_infos->srcId].dtxState EQ READY)) | |
| 517 { | |
| 518 #ifdef _SIMULATION_ | |
| 519 if( ATI_SRC_TYPE_TST EQ src_type ) | |
| 520 { | |
| 521 ati_src_tst_sendString(send_data, src_infos->srcId); | |
| 522 ACI_MFREE(send_data); | |
| 523 } | |
| 524 else | |
| 525 { | |
| 526 psaDTI_data_req (send_data, src_infos, DTI_ENTITY_UART); | |
| 527 } | |
| 528 #else | |
| 529 /* send message through DTI */ | |
| 530 psaDTI_data_req (send_data, src_infos, DTI_ENTITY_UART); | |
| 531 #endif /* _SIMULATION_ */ | |
| 532 } | |
| 533 else | |
| 534 { | |
| 535 /* buffer these datas */ | |
| 536 uart_buffer_data (src_infos, send_data); | |
| 537 ACI_MFREE (send_data); | |
| 538 } | |
| 539 #else | |
| 540 ACI_MFREE (send_data); | |
| 541 #endif /* DTI */ | |
| 542 } | |
| 543 | |
| 544 #ifdef _SIMULATION_ | |
| 545 | |
| 546 /* | |
| 547 +-------------------------------------------------------------------+ | |
| 548 | PROJECT : GSM-PS (6147) MODULE : ATI_SRC_UART_IO_C | | |
| 549 | ROUTINE : get_source_type | | |
| 550 +-------------------------------------------------------------------+ | |
| 551 | |
| 552 PURPOSE : provides the source type for a source ID | |
| 553 | |
| 554 returns FALSE if source ID is not registered | |
| 555 */ | |
| 556 LOCAL BOOL get_source_type( UBYTE src_id, T_ATI_SRC_TYPE *src_type ) | |
| 557 { | |
| 558 T_ATI_SRC_PARAMS *src_params = NULL; | |
| 559 | |
| 560 src_params = find_element (ati_src_list, src_id, search_ati_src_id); | |
| 561 if (src_params EQ NULL) | |
| 562 { | |
| 563 TRACE_EVENT_P1("[ERR] get_source_type: source ID %d not found", src_id); | |
| 564 *src_type = ATI_SRC_TYPE_UNKNOWN; | |
| 565 return FALSE; | |
| 566 } | |
| 567 | |
| 568 *src_type = src_params->src_type; | |
| 569 return TRUE; | |
| 570 } | |
| 571 | |
| 572 /* | |
| 573 +--------------------------------------------------------------------+ | |
| 574 | PROJECT : GSM-PS (6147) MODULE : ATI_SRC_UART_IO_C | | |
| 575 | ROUTINE : uart_src_test_sendString | | |
| 576 +--------------------------------------------------------------------+ | |
| 577 | |
| 578 PURPOSE : Provides the io_DTIsendString() for the test-source-callback | |
| 579 and apends a separator to the message. | |
| 580 The separator is needed to isolates the messages in the | |
| 581 case of buffering messages during UART is not connected | |
| 582 with ACI | |
| 583 */ | |
| 584 GLOBAL void uart_src_test_sendString (UBYTE *string, USHORT string_len, | |
| 585 T_ACI_DTI_PRC *src_infos, | |
| 586 T_ATI_OUTPUT_TYPE output_type) | |
| 587 { | |
| 588 UBYTE *tmp; | |
| 589 | |
| 590 ACI_MALLOC(tmp, string_len + 1); | |
| 591 strncpy(tmp, string, string_len); | |
| 592 tmp[string_len] = (UBYTE) ATI_TEST_SRC_SEPARATOR; | |
| 593 | |
| 594 io_DTIsendString(tmp, (USHORT) (string_len + 1), src_infos, output_type); | |
| 595 | |
| 596 ACI_MFREE(tmp); | |
| 597 } | |
| 598 #endif | |
| 599 | |
| 600 #endif /* UART */ |
