Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!apple!olivea!samsung!munnari.oz.au!metro!natmlab.dap.csiro.au!ditsydh.syd.dit.CSIRO.AU!evans From: evans@syd.dit.CSIRO.AU (Bruce.Evans) Newsgroups: comp.os.minix Subject: Fix for 1.5.10 RS232 initialization (PC) Message-ID: <1990Oct18.053903.23498@syd.dit.CSIRO.AU> Date: 18 Oct 90 05:39:03 GMT Organization: CSIRO Division of Info Tech, Sydney, Australia Lines: 79 RS232 initialization was not reliable with some BIOS's (it worked better after a cold boot). See the comments in the code to explain why. #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh 'rs232.cdif' <<'END_OF_FILE' X*** /tmp/1.5/kernel/rs232.c Mon Apr 2 06:07:02 1990 X--- rs232.c Mon Oct 15 04:38:35 1990 X*************** X*** 321,324 **** X--- 321,329 ---- X /* Set up the hardware to a base state, in particular X * o turn off DTR (MC_DTR) to try to stop the external device. X+ * o be careful about the divisor latch. Some BIOS's leave it enabled X+ * here and that caused trouble (no interrupts) in version 1.5 by X+ * hiding the interrupt enable port in the next step, and worse trouble X+ * (continual interrupts) in an old version by hiding the receiver X+ * port in the first interrupt. Call rs_config() early to avoid this. X * o disable interrupts at the chip level, to force an edge transition X * on the 8259 line when interrupts are next enabled and active. X*************** X*** 326,336 **** X * mask, but there used to be trouble if the mask was set without X * handling a previous interrupt. X- * o be careful about the divisor latch. It may be enabled now, and X- * that used to cause trouble when interrupts were enabled too early X- * (see comment in rs_config()). Call rs_config() early to avoid this. X */ X istop(rs); /* sets modem_ctl_port */ X- out_byte(rs->int_enab_port, 0); X speed = rs_config(minor, DEF_BAUD, DEF_BAUD, LC_NO_PARITY, 1, 8, RAW); X X /* Clear any harmful leftover interrupts. An output interrupt is harmless X--- 331,338 ---- X * mask, but there used to be trouble if the mask was set without X * handling a previous interrupt. X */ X istop(rs); /* sets modem_ctl_port */ X speed = rs_config(minor, DEF_BAUD, DEF_BAUD, LC_NO_PARITY, 1, 8, RAW); X+ out_byte(rs->int_enab_port, 0); X X /* Clear any harmful leftover interrupts. An output interrupt is harmless END_OF_FILE if test 1774 -ne `wc -c <'rs232.cdif'`; then echo shar: \"'rs232.cdif'\" unpacked with wrong size! fi chmod +x 'rs232.cdif' # end of 'rs232.cdif' fi if test -f 'rs232.crc' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'rs232.crc'\" else echo shar: Extracting \"'rs232.crc'\" \(58 characters\) sed "s/^X//" >'rs232.crc' <<'END_OF_FILE' X27260 20246 /tmp/1.5/kernel/rs232.c X19451 20391 rs232.c END_OF_FILE if test 58 -ne `wc -c <'rs232.crc'`; then echo shar: \"'rs232.crc'\" unpacked with wrong size! fi chmod +x 'rs232.crc' # end of 'rs232.crc' fi echo shar: End of shell archive. exit 0 -- Bruce Evans evans@syd.dit.csiro.au