comparison g23m-aci/uart/uart_txf.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 :
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 : This modul is part of the entity UART and implements all
18 | procedures and functions as described in the
19 | SDL-documentation (TX-statemachine)
20 +-----------------------------------------------------------------------------
21 */
22
23 #ifndef UART_TXF_C
24 #define UART_TXF_C
25 #endif /* !UART_TXF_C */
26
27 #include "config.h"
28 #include "fixedconf.h"
29 #include "condat-features.h"
30
31 #define ENTITY_UART
32
33 #ifndef FF_MULTI_PORT
34 /*==== INCLUDES =============================================================*/
35
36 #ifdef WIN32
37 #include "nucleus.h"
38 #endif /* WIN32 */
39 #include "typedefs.h" /* to get Condat data types */
40 #include "vsi.h" /* to get a lot of macros */
41 #include "macdef.h" /* to get a lot of macros */
42 #include "custom.h"
43 #include "gsm.h" /* to get a lot of macros */
44 #include "cnf_uart.h" /* to get cnf-definitions */
45 #include "mon_uart.h" /* to get mon-definitions */
46 #include "prim.h" /* to get the definitions of used SAP and directions */
47 #ifdef DTILIB
48 #include "dti.h" /* to get dti lib */
49 #endif /* DTILIB */
50 #include "pei.h" /* to get PEI interface */
51 #ifdef _TARGET_
52 #include "../../serial/serialswitch.h"
53 #include "../../serial/traceswitch.h"
54 #else /* _TARGET_ */
55 #include "serial_dat.h" /* to get definitions of serial driver */
56 #endif /* _TARGET_ */
57 #include "uart.h" /* to get the global entity definitions */
58
59 #ifdef _SIMULATION_
60 #include <stdio.h> /* to get sprintf */
61 #endif /* _SIMULATION_ */
62 #include <string.h> /* JK, delete warnings: to get memcpy */
63
64 /*==== CONST ================================================================*/
65
66 /*==== LOCAL VARS ===========================================================*/
67
68 /*==== PRIVATE FUNCTIONS ====================================================*/
69
70 /*==== PUBLIC FUNCTIONS =====================================================*/
71
72
73
74 /*
75 +------------------------------------------------------------------------------
76 | Function : tx_proc_output
77 +------------------------------------------------------------------------------
78 | Description : The function tx_proc_output() is the actual callback function
79 | to write data into the send buffer.
80 |
81 | Parameters : uart_device - database for the affected UART device
82 |
83 +------------------------------------------------------------------------------
84 */
85 LOCAL void tx_proc_output(T_UART_DATA* uart_device)
86 {
87 USHORT i, len, pos;
88 T_DLC *dlc; /* used Data Link Connection */
89 UBYTE transmit_state; /* state of transmission */
90 T_desc2* cur_desc; /* currently used descriptor */
91 UBYTE temp_field; /* multi purpose value */
92 UBYTE frame_size; /* numbr of octets in Information field */
93 UBYTE fcs; /* Frame Check Sequence */
94 SHORT error_code; /* Error code returned from a function */
95
96 TRACE_FUNCTION( "tx_proc_output" );
97
98 if(uart_device->tx.dlc_instance EQ UART_EMPTY_INSTANCE)
99 {
100 /*
101 * Raw Data
102 */
103 /*
104 * use entry 0 for raw data
105 */
106 dlc = &uart_device->dlc_table[UART_CONTROL_INSTANCE];
107 cur_desc = dlc->transmit_data;
108 /*
109 * search next descriptor that includes data
110 */
111 while((cur_desc) &&
112 (dlc->transmit_pos >= cur_desc->len))
113 {
114 cur_desc = (T_desc2*)cur_desc->next;
115 dlc->transmit_pos = 0;
116 }
117 /*
118 * for each ring buffer segment
119 */
120 for (i=0; i < uart_device->tx.ndest; i++)
121 {
122 pos = 0;
123 /*
124 * while ring buffer segment is not yet full and
125 * there are still data to send
126 */
127 while((uart_device->tx.size[i] > 0) && (cur_desc))
128 {
129 /*
130 * determine length to copy
131 */
132 len = cur_desc->len - dlc->transmit_pos;
133 if(len > uart_device->tx.size[i])
134 len = uart_device->tx.size[i];
135 /*
136 * copy data
137 */
138 memcpy((char*) &uart_device->tx.dest[i][pos],
139 (char*) &cur_desc->buffer[dlc->transmit_pos],
140 len);
141 /*
142 * updata values
143 */
144 uart_device->tx.size[i]-= len;
145 dlc->transmit_pos += len;
146 pos += len;
147 /*
148 * if current descriptor completly send
149 * then move to next descriptor
150 */
151 while((cur_desc) &&
152 (dlc->transmit_pos >= cur_desc->len))
153 {
154 cur_desc = (T_desc2*)cur_desc->next;
155 dlc->transmit_pos = 0;
156 }
157 }
158 }
159 }
160 else
161 {
162 /*
163 * Multiplexer Data
164 */
165 dlc = &uart_device->dlc_table[uart_device->tx.dlc_instance];
166 cur_desc = dlc->transmit_data;
167 temp_field = 0;
168 /*
169 * search next descriptor that includes data
170 */
171 while((cur_desc) &&
172 (dlc->transmit_pos >= cur_desc->len))
173 {
174 cur_desc = (T_desc2*)cur_desc->next;
175 dlc->transmit_pos = 0;
176 }
177 if(cur_desc)
178 {
179 /*
180 * initiailze destination values
181 */
182 i = 0;
183 while((i < uart_device->tx.ndest) && (uart_device->tx.size[i] EQ 0))
184 {
185 i++;
186 }
187 pos = 0;
188 /*
189 * send start HDLC Flag
190 */
191 uart_device->tx.dest[i][pos] = UART_HDLC_FLAG;
192 fcs = UART_INITFCS;
193 transmit_state = UART_TX_ADDRESS;
194 frame_size = 0;
195 /*
196 * increase destination position
197 */
198 pos++;
199 uart_device->tx.size[i]--;
200 while((i < uart_device->tx.ndest) &&
201 (uart_device->tx.size[i] EQ 0))
202 {
203 pos = 0;
204 i++;
205 }
206 while(transmit_state NEQ UART_TX_END)
207 {
208 switch(transmit_state)
209 {
210 case UART_TX_ADDRESS:
211 /*
212 * send Address field
213 */
214 if(uart_device->tx.dlc_instance EQ UART_CONTROL_INSTANCE)
215 {
216 /*
217 * at Control Channel the address field
218 * is included in source data
219 */
220 temp_field = cur_desc->buffer[dlc->transmit_pos];
221 /*
222 * if current descriptor completly send
223 * then move to next descriptor
224 */
225 dlc->transmit_pos++;
226 while((cur_desc) &&
227 (dlc->transmit_pos >= cur_desc->len))
228 {
229 cur_desc = (T_desc2*)cur_desc->next;
230 dlc->transmit_pos = 0;
231 }
232 }
233 else
234 {
235 /*
236 * at Data Channel the address field
237 * is calculated with the DLCI
238 */
239 temp_field = (dlc->dlci << UART_DLCI_POS) | UART_EA;
240 }
241 /*
242 * calculate FCS
243 */
244 fcs = uart_device->fcstab[fcs ^ temp_field];
245 /*
246 * next field is Control field
247 */
248 transmit_state = UART_TX_CONTROL;
249 break;
250
251 case UART_TX_CONTROL:
252 /*
253 * send Control field
254 */
255 if(uart_device->tx.dlc_instance EQ UART_CONTROL_INSTANCE)
256 {
257 /*
258 * at Control Channel the control field
259 * is included in source data
260 */
261 temp_field = cur_desc->buffer[dlc->transmit_pos];
262 /*
263 * if current descriptor completly send
264 * then move to next descriptor
265 */
266 dlc->transmit_pos++;
267 while((cur_desc) &&
268 (dlc->transmit_pos >= cur_desc->len))
269 {
270 cur_desc = (T_desc2*)cur_desc->next;
271 dlc->transmit_pos = 0;
272 }
273 }
274 else
275 {
276 /*
277 * at Data Channel the control field
278 * is always an UIH frame with P/F bit set to 0
279 */
280 temp_field = UART_UIH_DATA_FRAME;
281 }
282 /*
283 * calculate FCS
284 */
285 fcs = uart_device->fcstab[fcs ^ temp_field];
286 /*
287 * if there are still data to send the
288 * next field is Information field
289 * otherwise next field is FCS field
290 */
291 if(cur_desc)
292 transmit_state = UART_TX_INFORMATION;
293 else
294 transmit_state = UART_TX_FCS;
295 break;
296
297 case UART_TX_INFORMATION:
298 /*
299 * send Information field
300 */
301 temp_field = cur_desc->buffer[dlc->transmit_pos];
302 /*
303 * check if there is still data in the current descriptor and
304 * the maximum frame size is not yet reached
305 */
306 dlc->transmit_pos++;
307 frame_size++;
308 if((frame_size >= uart_device->n1) ||
309 (dlc->transmit_pos >= cur_desc->len))
310 {
311 /*
312 * if current descriptor completly send
313 * then move to next descriptor
314 */
315 while((cur_desc) &&
316 (dlc->transmit_pos >= cur_desc->len))
317 {
318 cur_desc = (T_desc2*)cur_desc->next;
319 dlc->transmit_pos = 0;
320 }
321 /*
322 * if no more data to send available or
323 * maximum frame size is reached then
324 * the next field is FCS field
325 */
326 if((frame_size >= uart_device->n1) ||
327 (cur_desc EQ NULL))
328 transmit_state = UART_TX_FCS;
329 }
330 break;
331
332 case UART_TX_FCS:
333 /*
334 * send FCS field
335 */
336 #ifdef _SIMULATION_
337 /*
338 * clear FCS field in simulation mode
339 */
340 temp_field = UART_GOODFCS;
341 #else /* _SIMULATION_ */
342 temp_field = (0xff - fcs);
343 #endif /* _SIMULATION_ */
344 /*
345 * frame complete
346 */
347 transmit_state = UART_TX_END;
348 break;
349 default:
350 TRACE_EVENT_P1("Warning: Unexpected TX ISR state %d", transmit_state);
351 break;
352 }
353 if((temp_field EQ UART_HDLC_FLAG) ||
354 (temp_field EQ UART_HDLC_ESCAPE) ||
355 (temp_field EQ uart_device->xon) ||
356 (temp_field EQ uart_device->xoff))
357 {
358 /*
359 * send Control Escape and map character
360 */
361 /*lint -e661 (Warning -- access of out-of-bounds pointer) */
362 uart_device->tx.dest[i][pos] = UART_HDLC_ESCAPE;
363 /*lint +e661 (Warning -- access of out-of-bounds pointer) */
364 temp_field ^= 0x20;
365 /*
366 * increase destination position
367 */
368 pos++;
369 uart_device->tx.size[i]--;
370 while((i < uart_device->tx.ndest) &&
371 (uart_device->tx.size[i] EQ 0))
372 {
373 pos = 0;
374 i++;
375 }
376 }
377 /*
378 * send character
379 */
380 /*lint -e661 -e662 (Warning -- access/creation of out-of-bounds pointer) */
381 uart_device->tx.dest[i][pos] = temp_field;
382 /*lint +e661 +e662 (Warning -- access/creation of out-of-bounds pointer) */
383 /*
384 * increase destination position
385 */
386 pos++;
387 uart_device->tx.size[i]--;
388 while((i < uart_device->tx.ndest) &&
389 (uart_device->tx.size[i] EQ 0))
390 {
391 pos = 0;
392 i++;
393 }
394 }
395 /*
396 * send stop HDLC Flag
397 */
398 /*lint -e661 -e662 (Warning -- access/creation of out-of-bounds pointer) */
399 uart_device->tx.dest[i][pos] = UART_HDLC_FLAG;
400 /*lint +e661 +e662 (Warning -- access/creation of out-of-bounds pointer) */
401 /*
402 * update size value
403 */
404 uart_device->tx.size[i]--;
405 }
406 }
407 /*
408 * write current descriptor back to table
409 */
410 dlc->transmit_data = cur_desc;
411
412 #ifndef _SIMULATION_
413 PSIGNAL(hCommUART, UART_DRIVER_SENT_IND, uart_device);
414 #endif /* !_SIMULATION_ */
415 *uart_device->tx.reInstall = rm_noInstall;
416
417 /*
418 * update pointer in UART driver
419 */
420 if((error_code = UF_OutpAvail (uart_device->device)) < 0)
421 {
422 TRACE_ERROR_P2("UF Driver: data pointer update failed, [%d], uart_txf.c(%d)",
423 error_code, __LINE__);
424 }
425
426 } /* tx_proc_output() */
427
428
429
430 /*
431 +------------------------------------------------------------------------------
432 | Function : tx_init
433 +------------------------------------------------------------------------------
434 | Description : The function tx_init() initializes the TX service.
435 |
436 | Parameters : no parameters
437 |
438 +------------------------------------------------------------------------------
439 */
440 GLOBAL void tx_init ()
441 {
442 #ifndef _SIMULATION_
443 #ifdef WIN32
444 #ifndef _TARGET_
445 char buf[80];
446 #endif /* !_TARGET_ */
447 STATUS sts;
448 #endif /* WIN32 */
449 #endif /* !_SIMULATION_ */
450
451 TRACE_FUNCTION( "tx_init" );
452
453 #ifndef _SIMULATION_
454 #ifdef WIN32
455 sts = NU_Create_HISR (&uart_data->tx.tx_HISR,
456 "TX_HISR",
457 tx_proc_output,
458 2,
459 uart_data->HISR_stack,
460 HISR_STACK_SIZE);
461 #ifndef _TARGET_
462 sprintf (buf, "NU_Create_HISR(TX) = %d", sts);
463 TRACE_EVENT (buf);
464 #endif /* !_TARGET_ */
465 #endif /* WIN32 */
466 #endif /* !_SIMULATION_ */
467
468 uart_data->tx.lines = 0x80000000; /* invalid */
469 uart_data->tx.dlc_instance = UART_EMPTY_INSTANCE;
470 uart_data->tx.p_zero = 0;
471 uart_data->tx.send_state = UART_TX_NOT_SENDING;
472
473 INIT_STATE( UART_SERVICE_TX , TX_DEAD );
474 } /* tx_init() */
475
476
477
478 /*
479 +------------------------------------------------------------------------------
480 | Function : tx_flushUart
481 +------------------------------------------------------------------------------
482 | Description : The function tx_flushUart() flush the output buffer of the
483 | UART driver.
484 |
485 | Parameters : no parameters
486 |
487 +------------------------------------------------------------------------------
488 */
489 GLOBAL void tx_flushUart ()
490 {
491 #ifndef _TARGET_
492 USHORT oa; /* output available */
493 #endif /* !_TARGET_ */
494 #ifndef ALR
495 T_UFRET mt;
496 #endif /* ALR */
497 USHORT counter;
498
499 TRACE_FUNCTION( "tx_flushUart" );
500
501 counter = 0;
502 while(
503 #ifndef ALR
504 ((mt = UF_CheckXEmpty(uart_data->device)) == UF_NOT_READY) ||
505 #endif /* !ALR */
506 (UF_OutpAvail (uart_data->device) < UF_MAX_BUFFER_SIZE))
507 {
508 #ifndef _TARGET_
509 oa = UF_OutpAvail (uart_data->device);
510 TRACE_EVENT_P1("waiting - output not flushed oa:%d",oa);
511 #endif /* !_TARGET_ */
512 /*
513 * poll permanent in the first 500ms
514 * after that poll 1 minute only every second
515 * after that give up
516 */
517 if(counter < 50)
518 {
519 if(vsi_t_sleep (VSI_CALLER ONE_FRAME) NEQ VSI_OK)
520 {
521 TRACE_ERROR_P1("VSI entity: Can't suspend thread, uart_txf.c(%d)",
522 __LINE__);
523 }
524 }
525 else if(counter < 110)
526 {
527 if(vsi_t_sleep (VSI_CALLER 1000) NEQ VSI_OK)
528 {
529 TRACE_ERROR_P1("VSI entity: Can't suspend thread, uart_txf.c(%d)",
530 __LINE__);
531 }
532 }
533 else
534 {
535 break;
536 }
537 counter++;
538 }
539 } /* tx_flushUart() */
540
541
542
543 /*
544 +------------------------------------------------------------------------------
545 | Function : tx_next_send_allowed
546 +------------------------------------------------------------------------------
547 | Description : The function tx_next_send_allowed() determines which dlc is the
548 | next dlc allow to send. The result of the calculation is stored
549 | in dlc_instance.
550 |
551 | Parameters : no parameters
552 |
553 +------------------------------------------------------------------------------
554 */
555 GLOBAL void tx_next_send_allowed ()
556 {
557 UBYTE diff;
558 UBYTE inst;
559 UBYTE next_inst;
560 T_DLC* dlc;
561
562 TRACE_FUNCTION( "tx_next_send_allowed" );
563
564 diff = 255;
565 next_inst = UART_EMPTY_INSTANCE;
566 for(inst = 0; inst <= UART_MAX_NUMBER_OF_CHANNELS; inst++)
567 {
568 dlc = &uart_data->dlc_table[inst];
569 if(dlc->transmit_data)
570 {
571 if(dlc->p_counter EQ uart_data->tx.p_zero)
572 {
573 uart_data->tx.dlc_instance = inst;
574 return;
575 }
576 if(diff > (dlc->p_counter - uart_data->tx.p_zero))
577 {
578 diff = dlc->p_counter - uart_data->tx.p_zero;
579 next_inst = inst;
580 }
581 }
582 }
583 uart_data->tx.p_zero+= diff;
584 uart_data->tx.dlc_instance = next_inst;
585 } /* tx_next_send_allowed() */
586
587
588
589 /*
590 +------------------------------------------------------------------------------
591 | Function : tx_writeInFunc_0
592 +------------------------------------------------------------------------------
593 | Description : The function tx_writeInFunc_0() is the official callback
594 | function to write data into the send buffer of UART device 0.
595 | It just copies the parameters and calls then the actual
596 | function.
597 |
598 | Parameters : cldFromIrq - called from interrupt
599 | reInstall - reinstallation mode
600 | ndest - number of destination pointers
601 | dest - array of destination pointers
602 | size - array of sizes for every destinition pointer
603 |
604 +------------------------------------------------------------------------------
605 */
606 GLOBAL void tx_writeInFunc_0 (BOOL cldFromIrq,
607 T_reInstMode *reInstall,
608 UBYTE ndest,
609 UBYTE *dest[],
610 USHORT *size)
611 {
612 #ifndef _SIMULATION_
613 #ifndef _TARGET_
614 char buf[40];
615 #endif /* !_TARGET_ */
616 #endif /* !_SIMULATION_ */
617 T_UART_DATA* uart_device;
618
619 TRACE_FUNCTION( "tx_writeInFunc_0" );
620
621 /*
622 * select UART device 0
623 */
624 uart_device = &(uart_data_base[0]);
625
626 /*
627 * store parameters
628 */
629 uart_device->tx.cldFromIrq = cldFromIrq;
630 uart_device->tx.ndest = ndest;
631 uart_device->tx.dest[0] = dest[0];
632 uart_device->tx.dest[1] = dest[1];
633 uart_device->tx.size = size;
634 uart_device->tx.reInstall = reInstall;
635
636 #ifndef _SIMULATION_
637 #ifdef WIN32
638 if (cldFromIrq)
639 {
640 STATUS sts;
641 /*
642 * interrupt context of the UART driver -> activate the HISR
643 */
644 sts = NU_Activate_HISR (&uart_device->tx.tx_HISR);
645 #ifndef _TARGET_
646 sprintf (buf, "NU_Activate_HISR(TX) = %d", sts);
647 TRACE_EVENT (buf);
648 #endif /* !_TARGET_ */
649 }
650 else
651 #endif /* WIN32 */
652 #endif /* !_SIMULATION_ */
653 {
654 /*
655 * normal callback from UF_WriteData
656 */
657 tx_proc_output(uart_device);
658
659 #ifdef _SIMULATION_
660 {
661 /*
662 * trace output
663 */
664 UBYTE* trace_dest[2];
665 USHORT trace_size[2];
666 USHORT i;
667 USHORT pos;
668 char buf[90];
669
670
671 trace_dest[0] = dest[0];
672 trace_dest[1] = dest[1];
673
674 trace_size[0] = size[0];
675 trace_size[1] = size[1];
676
677 trace_size[0]-= uart_device->tx.size[0];
678 trace_size[1]-= uart_device->tx.size[1];
679
680 if((trace_size[0]) ||
681 (trace_size[1]))
682 {
683
684 TRACE_EVENT("=== OUTRAW");
685 i = 0;
686 pos = 0;
687 while(pos < trace_size[0])
688 {
689 i+= sprintf(&buf[i], "0x%02x, ", trace_dest[0][pos]);
690 pos++;
691 if(i > 80)
692 {
693 TRACE_EVENT( buf );
694 i = 0;
695 }
696 else if(pos >= trace_size[0])
697 {
698 TRACE_EVENT( buf );
699 }
700 }
701 i = 0;
702 pos = 0;
703 while(pos < trace_size[1])
704 {
705 i+= sprintf(&buf[i], "0x%02x, ", trace_dest[1][pos]);
706 pos++;
707 if(i > 80)
708 {
709 TRACE_EVENT( buf );
710 i = 0;
711 }
712 else if(pos >= trace_size[1])
713 {
714 TRACE_EVENT( buf );
715 }
716 }
717 }
718 }
719 #endif /* _SIMULATION_ */
720 }
721 } /* tx_writeInFunc_0() */
722
723
724
725 #ifdef FF_TWO_UART_PORTS
726 /*
727 +------------------------------------------------------------------------------
728 | Function : tx_writeInFunc_1
729 +------------------------------------------------------------------------------
730 | Description : The function tx_writeInFunc_1() is the official callback
731 | function to write data into the send buffer of UART device 0.
732 | It just copies the parameters and calls then the actual
733 | function.
734 |
735 | Parameters : cldFromIrq - called from interrupt
736 | reInstall - reinstallation mode
737 | ndest - number of destination pointers
738 | dest - array of destination pointers
739 | size - array of sizes for every destinition pointer
740 |
741 +------------------------------------------------------------------------------
742 */
743 GLOBAL void tx_writeInFunc_1 (BOOL cldFromIrq,
744 T_reInstMode *reInstall,
745 UBYTE ndest,
746 UBYTE *dest[],
747 USHORT *size)
748 {
749 #ifndef _SIMULATION_
750 #ifndef _TARGET_
751 char buf[40];
752 #endif /* !_TARGET_ */
753 #endif /* !_SIMULATION_ */
754 T_UART_DATA* uart_device;
755
756 TRACE_FUNCTION( "tx_writeInFunc_1" );
757
758 /*
759 * select UART device 1
760 */
761 uart_device = &(uart_data_base[1]);
762
763 /*
764 * store parameters
765 */
766 uart_device->tx.cldFromIrq = cldFromIrq;
767 uart_device->tx.ndest = ndest;
768 uart_device->tx.dest[0] = dest[0];
769 uart_device->tx.dest[1] = dest[1];
770 uart_device->tx.size = size;
771 uart_device->tx.reInstall = reInstall;
772
773 #ifndef _SIMULATION_
774 #ifdef WIN32
775 if (cldFromIrq)
776 {
777 STATUS sts;
778 /*
779 * interrupt context of the UART driver -> activate the HISR
780 */
781 sts = NU_Activate_HISR (&uart_device->tx.tx_HISR);
782 #ifndef _TARGET_
783 sprintf (buf, "NU_Activate_HISR(TX) = %d", sts);
784 TRACE_EVENT (buf);
785 #endif /* !_TARGET_ */
786 }
787 else
788 #endif /* WIN32 */
789 #endif /* !_SIMULATION_ */
790 {
791 /*
792 * normal callback from UF_WriteData
793 */
794 tx_proc_output(uart_device);
795
796 #ifdef _SIMULATION_
797 {
798 /*
799 * trace output
800 */
801 UBYTE* trace_dest[2];
802 USHORT trace_size[2];
803 USHORT i;
804 USHORT pos;
805 char buf[90];
806
807
808 trace_dest[0] = dest[0];
809 trace_dest[1] = dest[1];
810
811 trace_size[0] = size[0];
812 trace_size[1] = size[1];
813
814 trace_size[0]-= uart_device->tx.size[0];
815 trace_size[1]-= uart_device->tx.size[1];
816
817 if((trace_size[0]) ||
818 (trace_size[1]))
819 {
820
821 TRACE_EVENT("=== OUTRAW");
822 i = 0;
823 pos = 0;
824 while(pos < trace_size[0])
825 {
826 i+= sprintf(&buf[i], "0x%02x, ", trace_dest[0][pos]);
827 pos++;
828 if(i > 80)
829 {
830 TRACE_EVENT( buf );
831 i = 0;
832 }
833 else if(pos >= trace_size[0])
834 {
835 TRACE_EVENT( buf );
836 }
837 }
838 i = 0;
839 pos = 0;
840 while(pos < trace_size[1])
841 {
842 i+= sprintf(&buf[i], "0x%02x, ", trace_dest[1][pos]);
843 pos++;
844 if(i > 80)
845 {
846 TRACE_EVENT( buf );
847 i = 0;
848 }
849 else if(pos >= trace_size[1])
850 {
851 TRACE_EVENT( buf );
852 }
853 }
854 }
855 }
856 #endif /* _SIMULATION_ */
857 }
858 } /* tx_writeInFunc_1() */
859 #endif /* FF_TWO_UART_PORTS */
860 #endif /* !FF_MULTI_PORT */