MDSIO Multidrop RS-422/485 driver for FreeBSD and 8250-family UARTS. ---------------------------------------------------------------------------- (c) 1995,1996 Michael Smith and Genesis Software msmith@atrad.adelaide.edu.au Release 2 INTRODUCTION ============ This is the fourth public release of the 'mdsio' driver for FreeBSD 2.1.x/2.2. This driver provides an interface for user programs to communicate on multidrop networks using the standard 9-bit protocol. (Other modes can be supported with minor modifications). Both 2- and 4-wire operation is supported. In 2-wire mode, cards with automatic transmit control (eg. the Advantech PCL-74x series) or ordinary 8250-based serial interfaces with external interface hardware can be used. Either DTR or RTS can be used for external drive control, in either 'normal' (assert to transmit) or 'inverted' (assert to receive) modes. INSTALLATION ============ Enough chatter; you want to get things happening. The driver can be built for FreeBSD 2.1.x or FreeBSD 2.2. The following instructions only cover 2.2; if you are installing it on 2.1.x it is assumed that you know what you are doing. The distribution consists of the following files : -rw-r--r-- 1 msmith users 3471 Jun 6 20:43 README -rw-r--r-- 1 msmith users 70 Jun 6 20:41 files.i386.add -rw-r--r-- 1 msmith users 3638 Jun 6 20:37 mdcat.c -rw-r--r-- 1 msmith users 6928 Jun 6 20:37 mdsio.4 -rw-r--r-- 1 msmith users 31573 Jun 6 20:37 mdsio.c -rw-r--r-- 1 msmith users 2167 Jun 6 20:37 mdsio.h Install these as : /usr/share/man/man4/mdsio.4 /sys/i386/isa/mdsio.c /sys/i386/include/mdsio.h Keep mdcat somewhere safe for now; you'll want it later. The mdsio.h file should be included by applications that want to use the ioctls to set the port speed; it's visible as . Add this line to /sys/i386/conf/files.i386 : i386/isa/mdsio.c optional mdsio device-driver These to /sys/i386/conf/options.i386 : MDSIO_RXBUF opt_mdsio.h MDSIO_TXBUF opt_mdsio.h MDSIO_DEBUG opt_mdsio.h Then add the following lines to your kernel config : device mdsio0 at isa? port "IO_COM3" tty flags 0x0020 irq 10 vector mdsiointr The former assumes a card at the COM3: address on IRQ 10. The flags specify a 2-wire interface and no drive control, so a card with automatic Tx/Rx control is required. See the manpage for details on what the flags do. The RXBUF and TXBUF options can be tweaked to alter the default receive and transmit buffer sizes, and if defined, MDSIO_DEBUG will result in some extra debugging information being emitted. eg. options "MDSIO_RXBUF=4096" will allocate a 4K receive buffer instead of the standard 1K. Now config and build the kernel as normal. Note that you cannot have an sio driver and an mdsio driver overlapping. Normally you should put the mdsio device after any sio devices in the config file - this is less of an issue nowadays as the sio probe is less intrusive. Once you've built the kernel and booted it to make sure it finds your ports OK (and if the sio probe did, it should too), you need to make some devices. In /dev, say : mknod mdsioN c 20 N Where N is the port number, starting with 0. TESTING ======= The mdcat program is used for testing the driver. First, build it : gcc -o mdcat mdcat.c Then run it : ./mdcat /dev/mdsio0 It will print in hex each byte it receives from the driver, and accept characters from the keyboard to send. Because it doesn't do anything fancy with stdin, you have to hit to send what you've typed. For 2-wire interfaces you will need two ports to be able to talk to yourself. Address markers are indicated by a newline and an asterisk preceeding the hex output, and can be generated by hitting before typing a character. BUGS ==== Few enough that we're using this driver on a production basis. There is a possible interrupt/timeout conflict in the driver, but this has not been observed to cause any problems. FEEDBACK ======== Please! I can't fix it if I don't know it's broke! Send any and all questions/suggestions/bugreports to msmith@atrad.adelaide.edu.au.