Xref: utzoo comp.sys.amiga.tech:3572 comp.sys.amiga:28745 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ulowell!cbmvax!bryce From: bryce@cbmvax.UUCP (Bryce Nesbitt) Newsgroups: comp.sys.amiga.tech,comp.sys.amiga Subject: Multiple serial article from the European Developer's Conference Message-ID: <5877@cbmvax.UUCP> Date: 2 Feb 89 18:38:21 GMT Reply-To: bryce@cbmvax.UUCP (Bryce Nesbitt) Organization: Commodore Technology, West Chester, PA Lines: 241 -------------------------------------------- -- Amiga Multiple Serial Ports: User View -- -------------------------------------------- Software -------- The current version of the Amiga has only one serial port. Since many devices can interface with a serial port, having more serial ports is an obvious improvement. New system software has been developed for the Amiga which will allow plug in cards with extra serial ports to be used. A typical setup on a four port machine might be: Port 1 - Connected to a MIDI keyboard Port 2 - connected to a modem Port 3 - connected to a printer Port 4 - connected to a home-control device Extra serial ports will also allow applications such as a multiple line bulletin board system (BBS) with several modems connected to a single computer. Such a BBS could support simultaneous users. Multiple serial ports are implemented in a way which is compatible with existing software. o Old applications that ask for the serial port will be given the "default" port. Using the Preferences tool, the user will be able to set the default to any valid port. o New programs will provide a way for the user to select the serial port to use. If the user selects the number "0" or the word "default", the program will connect to the default port which is set in Preferences. The built-in port is unit 1. Extra serial ports are numbered from two upward. o From BASIC and the CLI, ports may be directly accessed in the same manner as works today: SER: = the default port SER1: = the built-in port SER2: = the second port SER3: = the third port SER4: = the fifth port Hardware --------- In addition to the new software support, Commodore is developing a plug in card with multiple serial ports. All Commodore multiple serial port cards will have a simple installation procedure: o Insert the serial card into a slot. o Boot up with the normal Workbench disk or hard drive. o Insert the disk that comes with each serial card. o Double click on the "Install Drivers" icon. o To remove a driver, double click on the "Remove Drivers" icon. Any number of cards may be installed. Advanced users may install the driver software manually instead of using the installation icon. Commodore's design for matching ports on cards with unit numbers is simple. Port number 1 is the serial port built into each Amiga. Higher port numbers indicate extra serial ports the user has added with a plug in card. The bottom plug on a card is given the lowest unit number. --------------------------------------------------- --- Amiga Multiple Serial Ports: Device Driver --- --------------------------------------------------- A Commodre support document will be available for people who wish to write multiple serial port device drivers. The document is available by request only. We may send updates to the document, and require the name and address of a contact person. To request the support document, send your name, address, telephone number and a short description of your hardware to: CATS Commodore Business Machines 1200 West Wilson Drive West Chester, PA 19380-4231 USA ------------------------------------------------------ --- Amiga Multiple Serial Ports: Programmer's View --- ------------------------------------------------------ If you are writing serial port applications for the Amiga, you can now add support for multiple serial port cards. This is easy to do and will give your program extra power. On an Amiga with one serial port the code needed to open the serial port looks like this: error = OpenDevice("serial.device", 0, myIORequest, 0); /* * BYTE=OpenDevice(char *,ULONG,struct IORequest *,ULONG); * * "serial.device" = name of the device * 0 = unit number (unused) * myIORequest = a blank extended trackdisk IORequest * 0 = flags (unused) */ To work with multiple serial ports, just one very simple addition is required: error = OpenDevice("serial.device", myUnit, myIORequest, 0); /* * BYTE=OpenDevice(char *,ULONG,struct IORequest *,ULONG); * * "serial.device" = name of the device * myUnit = which unit to try and open * myIORequest = a blank extended trackdisk IORequest * 0 = flags (unused) */ Notice that the second parameter has changed. Under the old system, unit number was always set to 0. Now the unit number is used to identify which of the serial ports should be used. The unit assignments are: Unit 0 = default port, settable from Preferences Unit 1 = the built-in serial port Unit 2 = the first extended unit Unit n = last extended unit System support for a multiple port serial card requires changes to some of the system files on disk. These files have been changed: devs:serial.device ;exec support l:port-handler ;AmigaDOS support Preferences ;default port selector buttons User Interface -------------- Your application must allow the user to set the unit number. There are several ways to do this. o Use the TOOLTYPES field of the icon. Each icon has a TOOLTYPES field which you can fill in with UNIT=0. The user can modify the number later if needed. You could also go one more step, and add DEVICE=serial.device to this field. o Have an option that brings up a box with a "default" gadget and a string gadget for typing in a number. o Add a menu or submenu like this: --------------- | | | unit number | | ----------- ----------| default | | 1 | | 2 | | 3 | | 4 | |* 5 | | 6 | | 7 | | 8 | ----------- There are two disadvantages to this method. First, you cannot find out how many units are connected with the current serial.device. Second, the number of ports available could exceed the vertical size of a menu. Future Design Issues -------------------- Plans for the V1.4 serial.device include several sensible extensions to the current command set. For example, the best way to read under the current serial.device is: o Send a CMD_QUERY to see how many bytes are in the buffer. o If there are any bytes, get them ALL with a CMD_READ. o Else post a CMD_READ for exactly one byte. When it returns, loop back to step #1. With the old serial.device, this was the only way to get acceptable performance at high baud rates. With the new serial.device, one will be able to set a bit to request all available bytes from the serial port (up to the size of the user buffer). The request will be held by the device until at least one byte is ready. The OpenDevice() call does not support a version number check at present. In most cases there is no need to check the version number since the new serial device is backward compatible. However, if you do need to find the version number of the serial device, you should first open the device and then look at the LIB_VERSION word in the device base. Versions 36 and higher support multiple ports. Versions 35 and lower ignore the unit number field. The Amiga's built-in serial port can generate any baud rate in the range 108 to 1,000,000 baud. However, off-the-shelf serial chips usually only support the standard rates such as: 110 600 9600 150 1200 19200 300 2400 38400 Also, standard serial chips usually do not support the MIDI baud rate (31250). Since most multiple serial port cards will be using standard serial chips, the extra ports will not support all the different baud rates that the built-in serial port does. There is no way for a serial.device client to find out the capabilities of a specific serial unit at present. |\_/| . ACK!, NAK!, EOT!, SOH! {o O} . Bryce Nesbitt (") BIX: bnesbitt U USENET: cbmvax!bryce@uunet.uu.NET -or- rutgers!cbmvax!bryce -- |\_/| . ACK!, NAK!, EOT!, SOH! {O o} . Bryce Nesbitt (") BIX: bnesbitt U USENET: cbmvax!bryce@uunet.uu.NET -or- rutgers!cbmvax!bryce Disclaimer: I'm not an official, and this is not an official opinion.