[comp.os.minix] minix/st fixes for rs232 driver

hcj@lzaz.ATT.COM (HC Johnson) (01/05/89)

This shar file fixes speed setting in the previously posted rs232 files
for minix/st.
============================================================
echo extracting 'rs232_fix.cdif'
sed -e 's/^X//' >rs232_fix.cdif <<'SHAR_EOF'
X*** ../kernel/rstty.c	Mon Jan  2 15:17:52 1989
X--- rstty.c	Wed Jan  4 03:12:30 1989
X***************
X*** 549,564 ****
X    r = OK;
X    flags = 0;
X    erki = 0;
X    switch(m_ptr->TTY_REQUEST) {
X       case TIOCSETP:
X  	/* Set erase, kill, and flags. */
X- 	baud = (char) ((m_ptr->TTY_SPEK >> 16) & BYTE);	/* ispeed  */
X  	tp->tty_baud = (char) ((m_ptr->TTY_SPEK >> 16) & BYTE);	/* ispeed  */
X  	tp->tty_erase = (char) ((m_ptr->TTY_SPEK >> 8) & BYTE);	/* erase  */
X  	tp->tty_kill  = (char) ((m_ptr->TTY_SPEK >> 0) & BYTE);	/* kill  */
X  	tp->tty_mode  = (int) m_ptr->TTY_FLAGS;	/* mode word */
X- 	if(baud != tp->tty_baud)
X- 		r = (*tp->tty_ioctl)(tp, m_ptr);
X  	break;
X  
X       case TIOCSETC:
X--- 549,562 ----
X    r = OK;
X    flags = 0;
X    erki = 0;
X+   baud = tp->tty_baud; /* save old */
X    switch(m_ptr->TTY_REQUEST) {
X       case TIOCSETP:
X  	/* Set erase, kill, and flags. */
X  	tp->tty_baud = (char) ((m_ptr->TTY_SPEK >> 16) & BYTE);	/* ispeed  */
X  	tp->tty_erase = (char) ((m_ptr->TTY_SPEK >> 8) & BYTE);	/* erase  */
X  	tp->tty_kill  = (char) ((m_ptr->TTY_SPEK >> 0) & BYTE);	/* kill  */
X  	tp->tty_mode  = (int) m_ptr->TTY_FLAGS;	/* mode word */
X  	break;
X  
X       case TIOCSETC:
X***************
X*** 613,629 ****
X  	tp->tty_mode  = (int) m_ptr->TTY_FLAGS;	/* mode word */
X  	break;
X       case TCSBRK:  /* drain output, send a break */
X- 	r = (*tp->tty_ioctl)(tp, m_ptr);
X- 	break;
X       case TCXONC:  /* start/stop output arg ==0 stop, ==1 start */	
X- 	r = (*tp->tty_ioctl)(tp, m_ptr);
X-      	break;
X       case TCFLSH:  /* flush: 0==input 1==output 2=both */
X  	r = (*tp->tty_ioctl)(tp, m_ptr);
X  	break;
X  
X       default:
X  	r = EINVAL;
X    }
X  
X    /* Send the reply. */
X--- 611,634 ----
X  	tp->tty_mode  = (int) m_ptr->TTY_FLAGS;	/* mode word */
X  	break;
X       case TCSBRK:  /* drain output, send a break */
X       case TCXONC:  /* start/stop output arg ==0 stop, ==1 start */	
X       case TCFLSH:  /* flush: 0==input 1==output 2=both */
X+      case TCFLOW:  /* set TOS flow to arg 0 = off, 1=xon/off 2=rts/cts */
X+      case TCFLOWON:  /* set TOS flow XON to char == arg*/
X+      case TCFLOWOFF:  /* set TOS flow XOFFto char == arg*/
X  	r = (*tp->tty_ioctl)(tp, m_ptr);
X  	break;
X+      case TCBAUD:  /* set the baud; really reserved for internal use */
X+ 	r = (*tp->tty_ioctl)(tp, m_ptr);
X+ 	tp->tty_baud = baud; 
X+ 	break;
X  
X       default:
X  	r = EINVAL;
X+   }
X+   if(baud != tp->tty_baud) {
X+   	m_ptr->TTY_REQUEST = TCBAUD;
X+ 	r = (*tp->tty_ioctl)(tp, m_ptr);
X    }
X  
X    /* Send the reply. */
X*** ../kernel/rs232.c	Fri Dec 30 07:03:19 1988
X--- rs232.c	Wed Jan  4 03:22:25 1989
X***************
X*** 140,153 ****
X  		break;
X  	}
X  	return(OK);
X    }
X  }
X  
X  PUBLIC rs232charint()
X  {
X  	/* Build and send the interrupt message. */
X- if(dbg_flag)
X- printf("sia_rrdy charint msg n=%d\n\r",rs232ring.i_head - rs232ring.i_tail);
X  	commes.m_type = TTY_CHAR_INT;
X  	commes.ADDRESS = (char *)0 ;
X  	interrupt(RS232, &commes);	/* send message to tty task */
X--- 140,164 ----
X  		break;
X  	}
X  	return(OK);
X+      case TCBAUD:  /* change the baud */
X+ 		set_timer(tp->tty_baud);
X+ 		break;
X+ 		return(OK);
X+      case TCFLOW:  /* set TOS flow to arg 0 = off, 1=xon/off 2=rts/cts */
X+ 		rs232ring.rtscts =  (int)m_ptr->TTY_SPEK;
X+ 		return(OK);
X+      case TCFLOWON:  /* set TOS flow XON to char == arg*/
X+ 		rs232ring.xon_char =  (int)m_ptr->TTY_SPEK;
X+ 		return(OK);
X+      case TCFLOWOFF:  /* set TOS flow XOFFto char == arg*/
X+ 		rs232ring.xoff_char =  (int)m_ptr->TTY_SPEK;
X+ 		return(OK);
X    }
X  }
X  
X  PUBLIC rs232charint()
X  {
X  	/* Build and send the interrupt message. */
X  	commes.m_type = TTY_CHAR_INT;
X  	commes.ADDRESS = (char *)0 ;
X  	interrupt(RS232, &commes);	/* send message to tty task */
X***************
X*** 176,183 ****
X  
X  	if (tp->tty_outleft == 0)
X  		return(1);
X- if(dbg_flag)
X- printf("Start left=%d\n\r",tp->tty_outleft);
X  	do {
X  		if((r = rs232put( *(char*)tp->tty_phys)) == 0)
X  			break;
X--- 187,192 ----
X*** ../h/sgtty.h	Wed Dec 28 05:06:36 1988
X--- sgtty.h	Wed Jan  4 03:14:44 1989
X***************
X*** 73,77 ****
X--- 73,81 ----
X  #define	TCXONC	(TC_RS232|6)
X  #define	TCFLSH	(TC_RS232|7)
X  #define	TCDSET	(TC_RS232|32)
X+ #define	TCFLOW	(TC_RS232|33)
X+ #define	TCFLOWON	(TC_RS232|34)
X+ #define	TCFLOWOFF	(TC_RS232|35)
X+ #define	TCBAUD	(TC_RS232|99)	/* used by rstty.c internally */
X  #endif
SHAR_EOF
===============================================
Howard Johnson
ATT-BL
lzaz!hcj