Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!rex!ukma!dftsrv!mimsy!nocusuhs!nmrdc1!minixug!uwalt!waltje From: waltje@uwalt.nl.mugnet.org (Fred 'The Rebel' van Kempen) Newsgroups: comp.os.minix Subject: Re: [PC] Has someone run serial line w 38400 Baud ? Message-ID: <91042810552@uwalt.nl.mugnet.org> Date: 28 Apr 91 03:50:42 GMT References: <650@geyer.UUCP> Organization: MicroWalt Corporation, for MINIX Software Development Lines: 153 regn@geyer.UUCP (Robert Regn) wrote: > A real 386 PC should be able to run the serial lines with 38400 > (or higher ) Baud. But when i try it ( init.c and getty.c are changed!) > i get only garbage chars. 19200 works. Is the problem in the driver ? > (i try to log INTO the Minix PC - a HP vectra orig. with 1.5[.10] ) The standard MINIX serial driver only supports (certain) baud rates between 110 and 9600, with 19200 being defined as EXTA. Several people thought about fixing this, but that would include a complete rewrite of the ioctl() system call implementation, since it currently uses divide-by-100 encoding for the speeds. This results in a maximum of (255 * 100) == 25.5Kbps .... :-( I just finished a TTY-driver with the new ioctl() structure. For _backward_ compatibility, I added some code in the TTy driver to convert old-style ioctl()s to new-style ones. Here is my version of sgtty.h : /* The header contains data structures for ioctl(). */ #ifndef _SGTTY_H #define _SGTTY_H struct sgttyb { char sg_ispeed; /* input speed */ char sg_ospeed; /* output speed */ char sg_erase; /* erase character */ char sg_kill; /* kill character */ int sg_flags; /* mode flags */ }; struct tchars { char t_intrc; /* SIGINT char */ char t_quitc; /* SIGQUIT char */ char t_startc; /* start output (initially CTRL-Q) */ char t_stopc; /* stop output (initially CTRL-S) */ char t_eofc; /* EOF (initially CTRL-D) */ char t_brkc; /* input delimiter (like nl) */ }; /* Field names */ #define XTABS 0006000 /* do tab expansion */ #define CS8 0001400 /* 8 bits/char */ #define CS7 0001000 /* 7 bits/char */ #define CS6 0000400 /* 6 bits/char */ #define CS5 0000000 /* 5 bits/char */ #define EVENP 0000200 /* even parity */ #define ODDP 0000100 /* odd parity */ #define RAW 0000040 /* enable raw mode */ #define CRMOD 0000020 /* map lf to cr + lf */ #define ECHO 0000010 /* echo input */ #define CBREAK 0000002 /* enable cbreak mode */ #define COOKED 0000000 /* neither CBREAK nor RAW */ #define DCD 0100000 /* Data Carrier Detect */ /* Line speeds */ #define B0 0 /* code for line-hangup */ #define B50 1 #define B75 2 #define B110 3 #define B134 4 #define B150 5 #define B200 6 #define B300 7 #define B600 8 #define B1200 9 #define B1800 10 #define B2400 11 #define B3600 12 #define B4800 13 #define B7200 14 #define B9600 15 #define B19200 16 #define B38400 17 #define B115200 18 /* I/O control codes. */ #define TIOCGETP (('T'<<8) | 8) #define TIOCSETP (('T'<<8) | 9) #define TIOCGETC (('T'<<8) | 18) #define TIOCSETC (('T'<<8) | 17) #define TIOCFLUSH (('T'<<8) | 16) #define TIOCICNT (('T'<<8) | 19) /* Things Minix supports but not properly */ #define ANYP 0000300 /* Things Minix doesn't support but are fairly harmless if used */ #define NLDELAY 0001400 #define TBDELAY 0006000 #define CRDELAY 0030000 #define VTDELAY 0040000 #define BSDELAY 0100000 #define ALLDELAY 0177400 #if MACHINE == ATARI /* ST specific clock stuff */ #define DCLOCK ('D'<<8) #define DC_RBMS100 (DCLOCK|1) #define DC_RBMS200 (DCLOCK|2) #define DC_RSUPRA (DCLOCK|3) #define DC_RICD (DCLOCK|4) #define DC_WBMS100 (DCLOCK|8) #define DC_WBMS200 (DCLOCK|9) #endif /* Old-style stuff, for (temp.) backwards compatibility */ #if 1 #define OB0 0 /* code for line-hangup */ #define OB110 1 #define OB200 2 #define OB300 3 #define OB600 6 #define OB1200 12 #define OB1800 18 #define OB2400 24 #define OB3600 36 #define OB4800 48 #define OB7200 72 #define OB9600 96 #define OEXTA 192 #define OTIOCGETP (('t'<<8) | 8) #define OTIOCSETP (('t'<<8) | 9) #define OTIOCGETC (('t'<<8) | 18) #define OTIOCSETC (('t'<<8) | 17) #define OTIOCFLUSH (('t'<<8) | 16) #define OTIOCICNT (('t'<<8) | 19) #define BITS8 CS8 #define BITS7 CS7 #define BITS6 CS6 #define BITS5 CS5 #endif /* COMPAT */ #include _PROTOTYPE( int gtty, (int _fd, struct sgttyb *_argp) ); _PROTOTYPE( int ioctl, (int _fd, int _request, struct sgttyb *_argp) ); _PROTOTYPE( int stty, (int _fd, struct sgttyb *_argp) ); #endif /* _SGTTY_H */ It works well. I can now talk to "minixug" at 115Kbps, which is much better than 19K2 ! :-) Fred. -- MicroWalt Corporation, for MINIX Development waltje@uwalt.nl.mugnet.org Tel (+31) 252 230 205, Hoefbladhof 27, 2215 DV VOORHOUT, The Netherlands "An Operating System is what the _USERS_ think of it- me"