comparison src/g23m-aci/uart/uart_txf.c @ 162:53929b40109c

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