hcj@lzaz.ATT.COM (HC Johnson) (03/13/89)
Here are fixes for rs232 in my recently posted kernel with rs232. I think these will address these problems: 1. typing cu a second time screws up. Crash, panic, or worse. this is due to rs232init() when it should be rs232init(tp); 2. bad things happen if cat file > /dev/tty1 There is a problem in trying to do initial open and final close. A. I have reworked the strategy. B. The default mode for rs232 was ECHO. sending a char to an echoing device, (hayse modem), causes oscillation. I have removed ECHO. It shouldn't hurt login, as it sets echo. 3. If you want to log in thru rs232, at a speed other than 2400 baud you need to add a line to set the speed in login.c. This will be posted later. 4. I also changed the length of BREAK to conform with the UNIX(r) manual. Howard C. Johnson ATT Bell Labs att!lzaz!hcj hcj@lzaz.att.com =======================cut here cdiff follows======================== *** ../../xminix/kernel/rstty.c Thu Feb 22 09:46:00 1989 --- rstty.c Thu Mar 12 18:10:07 1989 *************** *** 81,86 **** --- 81,87 ---- #define DBG(x) printf(x); extern int dbg_flag; + extern int rs232_o_flag; /*===========================================================================* * rs232_task * *************** *** 98,103 **** --- 99,107 ---- receive(ANY, &rstty_mess); /* we would rather be general here, but not enough info is avail USE 0 */ tp = &rstty_struct[0]; + if(rs232_o_flag ==0 && rstty_mess.m_type != RS232_CLOSE) + rs232init(tp); + if(dbg_flag) printf("rstty:m_type=%d,incount=%d blocked=%d wempty=%d\n\r", rstty_mess.m_type, tp->tty_incount , Rs_blocked, Rs232_wempty); *************** *** 148,153 **** --- 152,158 ---- message *m_ptr; /* message containing pointer to char(s) */ { int minor; + (*tp->tty_open)(tp, m_ptr); return; /* we do not know how to handle this and set pgrp also */ } *** ../../xminix/kernel/rs232.c Thu Mar 12 10:19:32 1989 --- rs232.c Thu Mar 12 18:46:50 1989 *************** *** 20,26 **** #define lbolt (realtime + lost_ticks) #define RS232_DRAIN (1*HZ) /* time in ticks to drain */ ! #define RS232_BREAK 5 /* ticks */ PUBLIC int dbg_flag = 0; PRIVATE message commes; /* message used for console input chars */ --- 20,26 ---- #define lbolt (realtime + lost_ticks) #define RS232_DRAIN (1*HZ) /* time in ticks to drain */ ! #define RS232_BREAK 12 /* ticks */ PUBLIC int dbg_flag = 0; PRIVATE message commes; /* message used for console input chars */ *************** *** 31,37 **** #define COM_IN_SIZE 512 PRIVATE char com_in_buffer[COM_IN_SIZE]; ! PRIVATE int rs232_o_flag = 0; PRIVATE int Xmit_on = 0; extern struct tty_struct rstty_struct[]; --- 31,37 ---- #define COM_IN_SIZE 512 PRIVATE char com_in_buffer[COM_IN_SIZE]; ! PUBLIC int rs232_o_flag = 0; PRIVATE int Xmit_on = 0; extern struct tty_struct rstty_struct[]; *************** *** 233,239 **** if(rs232_o_flag == 0) { rs232_o_flag++; r = lock(); ! rs232init(); restore(r); } if (tp->tty_outleft == 0) --- 233,239 ---- if(rs232_o_flag == 0) { rs232_o_flag++; r = lock(); ! rs232init(tp); restore(r); } if (tp->tty_outleft == 0) *************** *** 266,271 **** --- 266,274 ---- PUBLIC siaint(which) int which; /* 0=rrdy, 1=rerr, 2=trdy, 3=terr */ { + if( dbg_flag != 0) { + printf("SIAINT(%d)\n",which); + } switch(which) { case 1: /* rerr */ printf("sia_rerr\n\r"); *************** *** 349,355 **** MFP->mf_tsr = 0; tp->tty_inhead = tp->tty_inqueue; tp->tty_intail = tp->tty_inqueue; ! tp->tty_mode = CRMOD | XTABS | ECHO ; tp->tty_erase = ERASE_CHAR; tp->tty_kill = KILL_CHAR; tp->tty_intr = INTR_CHAR; --- 352,358 ---- MFP->mf_tsr = 0; tp->tty_inhead = tp->tty_inqueue; tp->tty_intail = tp->tty_inqueue; ! tp->tty_mode = CRMOD | XTABS /* | ECHO */; tp->tty_erase = ERASE_CHAR; tp->tty_kill = KILL_CHAR; tp->tty_intr = INTR_CHAR; *************** *** 407,412 **** --- 410,418 ---- int clock; int clocka; + if( dbg_flag != 0) { + printf("SET_TIMER(%d)\n",index); + } clock = MFP->mf_tcdcr & 0x70; for(;;) { clocka = MFP->mf_tcdcr & 0x70;