home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD v1.2 / amidev_cd_12.iso / reference / amiga_mail_vol1 / serparcia / newmultiserial next >
Text File  |  1990-01-26  |  7KB  |  187 lines

  1. (c)  Copyright 1989 Commodore-Amiga, Inc.   All rights reserved.
  2. The information contained herein is subject to change without notice, and 
  3. is provided "as is" without warranty of any kind, either expressed or implied.  
  4. The entire risk as to the use of this information is assumed by the user.
  5.  
  6.  
  7.  
  8.                      Amiga Multiple Serial Ports
  9.  
  10.                           by Bryce Nesbitt
  11.  
  12.  
  13. The current version of the Amiga has only one serial port.  Since many 
  14. devices can interface with a serial port, having more serial ports is an 
  15. obvious improvement.  
  16.  
  17. New system software has been developed for the Amiga which will allow
  18. plug in cards with extra serial ports to be used.   A typical setup on a 
  19. four port machine might be:
  20.  
  21.     Port 1 - Connected to a MIDI keyboard
  22.     Port 2 - connected to a modem
  23.     Port 3 - connected to a printer
  24.     Port 4 - connected to a home-control device 
  25.  
  26. Extra serial ports will also allow applications such as a multiple line 
  27. bulletin board system (BBS) with several modems connected to a single 
  28. computer.  Such a BBS could support simultaneous users.
  29.             
  30.  
  31.  
  32. Multiple serial ports are implemented in a way which is compatible with
  33. existing software.
  34.  
  35.     o  Old applications that ask for the serial port will be given 
  36.        the "default" port.  Using the Preferences tool, the user will
  37.        be able to set the default to any valid port.
  38.  
  39.     o  New programs will provide a way for the user to select the serial
  40.        port to use.   If the user selects the number "0" or the word 
  41.        "default", the program will connect to the default port which is set 
  42.        in Preferences.  The built-in port is unit 1.  Extra serial ports
  43.        are numbered from two upward.  
  44.  
  45.     o  From BASIC and the CLI, ports may be directly accessed in the
  46.        same manner as works today:
  47.  
  48.             SER:    = the default port 
  49.             SER1:   = the built-in port
  50.             SER2:   = the second port
  51.             SER3:   = the third port
  52.             SER4:   = the fourth port
  53.  
  54. New Hardware
  55.  
  56. In addition to the new software support, Commodore is developing a plug in
  57. card with multiple serial ports.  All Commodore multiple serial port cards 
  58. will have a simple installation procedure:
  59.  
  60.     o  Insert the serial card into a slot.
  61.     o  Boot up with the normal Workbench disk or hard drive.
  62.     o  Insert the disk that comes with each serial card.
  63.     o  Double click on the "Install Drivers" icon.
  64.     o  To remove a driver, double click on the "Remove Drivers" icon.
  65.  
  66. Any number of cards may be installed.  Advanced users may install the 
  67. driver software manually instead of using the installation icon.
  68.  
  69. Commodore's design for matching ports on cards with unit numbers is simple.
  70. Port number 1 is the serial port built into each Amiga.  Higher port numbers 
  71. indicate extra serial ports the user has added with a plug in card.
  72. The bottom plug on a card is given the lowest unit number.
  73.  
  74.  
  75. Applications Software
  76.  
  77. If you are writing serial port applications for the Amiga, you can now
  78. add support for multiple serial port cards.  This is easy to do and
  79. will give your program extra power.
  80.  
  81. On an Amiga with one serial port the code needed to open the serial port 
  82. looks like this:
  83.  
  84.     error = OpenDevice("serial.device", 0, myIORequest, 0);
  85.     /*
  86.      *        BYTE=OpenDevice(char *,ULONG,struct IORequest *,ULONG);
  87.      *
  88.      *        "serial.device" = name of the device
  89.      *        0            = unit number (unused)
  90.      *        myIORequest     = a blank extended trackdisk IORequest
  91.      *        0            = flags (unused)
  92.      */
  93.  
  94. To work with multiple serial ports, just two very simple additions are
  95. required:
  96.  
  97.     error = OpenDevice(myName, myUnit, myIORequest, 0);
  98.     /*
  99.      *        BYTE=OpenDevice(char *,ULONG,struct IORequest *,ULONG);
  100.      *
  101.      *        myName        = name of the device ("serial.device" default)
  102.      *        myUnit        = which unit to try and open (0 default)
  103.      *        myIORequest     = a blank extended trackdisk IORequest
  104.      *        0            = flags (unused)
  105.      */
  106.  
  107.  
  108. Notice that the device name and unit number have changed.  Under the old 
  109. system the unit number was always set to 0.  Now the unit number is used to
  110. identify which of the serial ports should be used.  The unit assignments are:
  111.  
  112.  
  113.     Unit 0  =    default port, settable from Preferences
  114.     Unit 1  =    the built-in serial port
  115.     Unit 2  =    the first extended unit
  116.     Unit n  =   last extended unit
  117.  
  118. To add system support for a multiple port serial card, some of three system 
  119. files on the Workbench disk had to be changed:
  120.  
  121.     devs:serial.device    ;exec support
  122.     l:port-handler        ;AmigaDOS support
  123.     Preferences        ;default port selector buttons
  124.  
  125.  
  126.  
  127.  
  128. User Interface
  129.  
  130. If you decide to provide a TOOLTYPES interface for setting the default,
  131. please use the following labels:
  132.  
  133.         UNIT=0
  134.         DEVICE=serial.device
  135.  
  136. See the Workbench chapter in the ROM Kernel Manual for information on
  137. processing tooltypes.
  138.  
  139.  
  140. Future Design Issues
  141.  
  142. Plans for the V1.4 serial.device include several sensible extensions to the
  143. current command set.  For example, the best way to read under the current 
  144. serial.device is:
  145.  
  146.     o  Send a CMD_QUERY to see how many bytes are in the buffer.
  147.  
  148.     o  If there are any bytes, get them ALL with a CMD_READ.
  149.  
  150.     o  Else post a CMD_READ for exactly one byte.  When it returns,
  151.        loop back to step #1.
  152.  
  153.  
  154. With the old serial.device, this was the only way to get acceptable 
  155. performance at high baud rates.  With the new serial.device, one will be 
  156. able to set a bit to request all available bytes from the serial port 
  157. (up to the size of the user buffer).  The request will be held by the 
  158. device until at least one byte is ready.
  159.  
  160. The OpenDevice() call does not support a version number check at present.  
  161. In most cases there is no need to check the version number since the new 
  162. serial device is backward compatible.  However, if you do need to find the 
  163. version number of the serial device, you should first open the device and 
  164. then look at the LIB_VERSION word in the device base.  Versions 36 and higher 
  165. support multiple ports.  Versions 35 and lower ignore the unit number field.
  166.  
  167. The Amiga's built-in serial port can generate any baud rate in the range
  168. 108 to 1,000,000 baud.  However, off-the-shelf serial chips usually only
  169. support the standard rates such as:
  170.  
  171.              110      600       9600     
  172.              150     1200      19200
  173.              300     2400      38400
  174.  
  175. Also, standard serial chips usually do not support the MIDI baud rate (31250).
  176. Since most multiple serial port cards will be using standard serial chips,
  177. the extra ports will not support all the different baud rates that the
  178. built-in serial port does.  There is no way for a serial.device client to
  179. find out the capabilities of a specific serial unit at present.
  180.  
  181. The ability to add more serial ports combined with the Amiga's multi-tasking
  182. operating system makes powerful new applications possible.  In particular,
  183. when a low-cost multi-user solution is appropriate, the Amiga can now do the 
  184. job easily. 
  185.  
  186.  
  187.