[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Couldn't activate software flow control ?



Regarding CRTSCTS its defined in asm/termbits.h
in apps/hwtest/serial it works, but I guess it includes something else
that includes asm/termbits.h

For the XON/XOFF try the following untested patch:

/Johan

diff -u -p -r1.40 serial.c
--- linux/arch/cris/drivers/serial.c    14 Oct 2002 05:33:18 -0000      1.40
+++ linux/arch/cris/drivers/serial.c    1 Nov 2002 14:43:57 -0000
@@ -1227,11 +1227,21 @@ static void rs485_toggle_rts_timer_funct
 static void
 rs_stop(struct tty_struct *tty)
 {
+       struct e100_serial *info = (struct e100_serial *)tty->driver_data;
+       unsigned long flags;
+       save_flags(flags); cli();
+       e100_disable_txdma_irq(info);
+       restore_flags(flags);
 }

 static void
 rs_start(struct tty_struct *tty)
 {
+       struct e100_serial *info = (struct e100_serial *)tty->driver_data;
+       unsigned long flags;
+       save_flags(flags); cli();
+       e100_enable_txdma_irq(info);
+       restore_flags(flags);
 }

On Friday 01 November 2002 13.24, Nabil DAHER wrote:
> Hello,
>
> I have a problem to activate the software flow control on the devboard
> lx,  my function works fine on the Debian host but not in the
> board...Data continue to send by the bord when receiving XOFF ...
> Thank you for any suggestion.
> Nabil
>
>
> I use this to open the serial port  (CRTSCTS  seem to be not defined in
> the devboard environment.?)
>
> *************************************************************************
>          #include    <stdlib.h>
>         #include    <stdio.h>
>         #include    <time.h>
>         #include    <sys/times.h>
>         #include    <sys/types.h>
>         #include    <sys/select.h>
>         #include    <sys/socket.h>
>         #include    <errno.h>
>         #include    <arpa/inet.h>
>         #include    <netinet/in.h>
>         #include    <unistd.h>
>         #include    <pthread.h>
>         #include    <termios.h>
>         #include    <fcntl.h>
>
>
> int CCSP_FSerialOpen ( WORD port, HANDLE *phd )
> {
>     int     error;
>     char    buffer[ 64 ];
>     int     handle;
>     struct termios option;
>
>
>     error    = CCS_Ok;
>     *phd    = 0;
>     memset( buffer, 0, sizeof(buffer));
>     strncpy( buffer, "/dev/ttyS0", sizeof(buffer)-1);
>
>     handle = open( buffer, O_RDWR | O_NOCTTY | O_NDELAY);
>     if (handle == -1)
>     {
>         return( -1 );
>     }
>
>     // Positionner vitesse port
>     error = tcgetattr( handle, &option);
>     if( error == -1)
>     {
>         close(handle);
>         return( -1 );
>     }
>
>     cfsetispeed( &option, B38400);
>     cfsetospeed( &option, B38400);
>
>     // mode non canonic & suppression echo
>     option.c_lflag    &= ~(ICANON | ECHO | ECHOE | ISIG | ECHOK | ECHONL
>
> | NOFLSH | IEXTEN | TOSTOP);
>
>     option.c_cflag    |= (CLOCAL | CREAD );
>     option.c_cflag    &= ~PARENB;
>     option.c_cflag    &= ~CSTOPB;
>     option.c_cflag    &= ~CSIZE;
>     option.c_cflag    |= CS8;
>
>
> //    option.c_cflag    &= ~( CRTSCTS );
>     option.c_iflag    &= ~( IXANY );
>     option.c_iflag    |= (IXON | IXOFF);
>
>     option.c_oflag    &= ~(OPOST);
>
>
>     option.c_cc[ VSTART ]    = 17;
>     option.c_cc[ VSTOP ]    = 19;
>     option.c_cc[ VMIN ]    = 0;
>     option.c_cc[ VTIME ]    = 0;
>
>     // sauvegarder parametres
>     error = tcsetattr( handle, TCSANOW, &option );
>     if( error == -1)
>     {
>         close(handle);
>         return( -1 );
>     }
>
>     // flush les buffers
>     error = tcflush( handle, TCIOFLUSH );
>     if( error == -1)
>     {
>         close(handle);
>         return( -1 );
>     }
>
>     // initialiser le handler liaison
>     *phd    = handle;
>     return (error);
> }
>
> ***************************************************************************
>************
>
> Nabil DAHER wrote:
> > Hi
> >
> > I  try  to activate software controle flox (XON/XOFF) on the serial
> > port (dev/ttyS0) but data continue out when the devborad_lx receive
> > XOFF.. I do this activation with termios ( I get options with tcgetattr
> > (fd, options), and then set options.iflag |=  IXON | IXOFF | IXANY  and
> > then tcsetattr (fd, TCSANOW, &options )
> >
> > Any suggestion ? or sample code to do this.
> >
> > Thanks
> > Nabil