Changeset 69
- Timestamp:
- 05/05/09 06:30:51 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/csctapi/io_serial.c
r68 r69 696 696 nByte=0; 697 697 length= size * (_in_echo_read ? (1+io_serial_need_dummy_char) : 1); 698 #ifdef DEBUG_IO 699 printf("size = %d\n", size); 700 printf("length = %d\n", length); 701 printf("timeout = %d\n", timeout); 698 699 if((io->com!=RTYP_SCI) && (io->wr>0)) 700 { 701 BYTE buf[256]; 702 int n = io->wr; 703 io->wr = 0; 704 705 if(!IO_Serial_Read_MacOSX (io, timeout, n, buf)) 706 { 707 return FALSE; 708 } 709 } 710 711 #ifdef DEBUG_IO 712 printf ("IO: IO_Serial_Read_MacOSX\n"); 713 printf ("IO: Receiving %d byte(s): ",size); 714 fflush (stdout); 702 715 #endif 703 716 while(TRUE) … … 710 723 if(m_timeout==timeout) 711 724 { 725 #ifdef DEBUG_IO 726 printf ("TIMEOUT\n"); 727 fflush (stdout); 728 #endif 712 729 tcflush (io->fd, TCIFLUSH); 713 730 return FALSE; … … 718 735 m_timeout=0; 719 736 #ifdef DEBUG_IO 720 printf("value read : %c\n",c);721 737 printf ("%02X ", c); 738 fflush (stdout); 722 739 #endif 723 740 data[_in_echo_read ? totalRead/(1+io_serial_need_dummy_char) : totalRead] = c; 724 741 totalRead+=nByte; 725 #ifdef DEBUG_IO726 printf("value totalRead : %d\n",totalRead);727 728 #endif729 742 if(length == totalRead) 730 743 break; … … 732 745 } 733 746 747 _in_echo_read = 0; 748 749 #ifdef DEBUG_IO 750 printf ("\n"); 751 fflush (stdout); 734 752 printf("exiting IO_Serial_Read_MacOSX [true]\n" ); 753 #endif 735 754 return TRUE; 736 755 } … … 747 766 int i_w; 748 767 unsigned count, to_send; 768 769 #ifdef DEBUG_IO 770 unsigned i; 771 printf ("IO: IO_Serial_Write_MacOSX\n"); 772 printf ("IO: Sending %d byte(s) : ",size); 773 fflush (stdout); 774 #endif 749 775 750 776 m_delay=0; … … 770 796 { 771 797 tcflush (io->fd, TCIFLUSH); 798 if(io->com!=RTYP_SCI) 799 io->wr += nByte; 800 801 #ifdef DEBUG_IO 802 printf ("ERROR\n"); 772 803 printf("exiting IO_Serial_Write_MacOSX [false]\n" ); 804 fflush (stdout); 805 #endif 773 806 return FALSE; 774 807 } 775 808 if(delay) 776 809 usleep(delay*1000L); 810 811 if(io->com!=RTYP_SCI) 812 io->wr += to_send; 813 814 #ifdef DEBUG_IO 815 for (i=0; i<(1+io_serial_need_dummy_char)*to_send; i++) 816 printf ("%02 X ", data_w[count + i]); 817 fflush (stdout); 818 #endif 777 819 778 820 } 779 821 822 #ifdef DEBUG_IO 823 printf ("\n"); 824 fflush (stdout); 825 #endif 780 826 return TRUE; 781 827 } 828 782 829 783 830
Note:
See TracChangeset
for help on using the changeset viewer.