DOCUMENT ID:  1552-02

SYNOPSIS:     Patching The Asy To Use Alternative Baud Rates

OS RELEASE:   2.4, 2.5 

PRODUCT:      Solaris x86

KEYWORDS:     asy ports baud communication driver

DESCRIPTION:

Overview

The asy driver table allows 15 baud rates to be set by utility pro-
grams at any one time.  This is due to the "termio" interface which has
become a Unix standard.  The table contains the most common his- toric
baud rates.  Nonstandard baud rates of the reader's choice may be
substituted for one of the common "useless" values.  The procedure will
involve changing a table entry using adb.  Generally available common
port circuit cards use a frequency of 1.8432 Mhz to generate baud rates. 
Not all cards or internal modems are suitable for high baud rates.  The
background section should be studied before trying to use any
nonstandard baud rates.  A provided table will ease the baud rate setup. 
Modems are rated at the effective transfer rate and don't necessarily
need to be interfaced to the computer at the specified baud rate. 

Background

Serial ports generically known as "COM1", "COM2", etc., are implemented
using integrated circuits of the 8250, 16450 and 16550 family.  Some
other less commonly known circuits, following the same programming
standards, are also in use.  Remember all clones are not created
equally.  Only a circuit assuring full 16550 functionally should be
considered.  Baud rates are derived by providing divisors to baud rate
generators fed by a crystal-controlled master clock.  Five master
crystal frequencies, in megahertz, are: 1.8432, 3.072, 8, 18.432, and
24.  An inherent divide by sixteen feature present in baud rate
generators requires any selected divisor to be multi- plied by sixteen
before division.  For example, using 1.8432 Mhz, 9600 baud is obtained
by a divisor of 192 (12 times 16).  The formula utilized in calculating
baud rate divisors follow National Semiconductor recommendations. 

Each frequency requires a set of distinct divisors to produce common
baud rates, while remembering that the accuracy of the baud rates is
determined by the quality of the crystal used.  The included tables
provide divisors for common baud rates. 

 **********************************************************************
 *
 *    RED FLAG WARNINGS----RED FLAG WARNINGS----RED FLAG WARNINGS
 *
 **********************************************************************

>> The use of 8250's and 16450's is not recommended for high throughput
   (>4800 baud) communications tasks.  The nature of multitasking operating
   systems have latency in the interrupt servicing resulting in lost
   characters.  There is folk lore indicating high throughput success using
   these devices, not realizing operation is on the edge of failure.  IBM
   recommends that at least a 16450 be include in an "AT class" machine. 
   The 16550 family, having the first-in-first-out silos on both send and
   receive sides, is the most reliable solution. 

>> Reliable data transfers are VERY hardware dependant.

>> The documentation of these procedures doesn't imply support or warranty
   of success by SunSoft. The reader assumes all risks when making changes.
   Mistakes may be made in entering the adb script contents, choice of
   startup script location and many other unforseen misfortunes.
   The desired behavior may be obtained or it may not. 

>> The driver cannot be tested at every possible baud rate.

>> All divisors are initially based on the 1.8324 Mhz rate.  Divisors of
   1 or zero are not recommend by National Semiconductor documentation. 
   Some 16550's may be operated beyond a 24 Mhz clock rate. 

**********************************************************************
**********************************************************************

Asy Driver Internal Structure
     
The baud rate counts are implemented in an unsigned short integer globle
table "asyspdtab".  In less technospeak, values that have a range of 0 -
65535.  The first value position should not be consider as it a
significate meaning within the driver. 
 
Patching Procedures

The general purpose debugger "adb" is used to patch the running kernel
after the driver has been "attached".  Root access is required to patch
the kernel.  It should be noted the sequence "here->" is representive of
a shell prompt and is NOT entered.  Command switches for adb are:

 k operate on kernel memory
 w enable write mode
 
1) Verify the current table using sample adb command sequence:

   here->  adb -k

   Current registers belong to a snapshot of
   kernel thread at: 0xf5ca0a80 on cpu[0] at: 0xe0108d38
   Use thread_addr$t or proc_addr$p to change the snapshot.
   asyspdtab?10d
   asyspdtab:
   asyspdtab:      0       2304    1536    1047    857     768     576     384
                 192       96
     $q

   here->

2) Enter the script into a file named adb.asyspdtab 
  (this makes 50 baud an alias for 14400 baud).

  asyspdtab+2?wt 8
  $q

3) test the script by entering:

  here-> adb -kw /dev/null

  Nothing should happen except another "here->"

4) Observe the results by using the sequence in step one.

5) Pick a run level start up directory. As an example /etc/rc2.d will be
   chosen. Create a file Sbaudchange in this directory with the command
   entered in step 3 as the contents.

6) Use the selected "standard baud reference" in all utility commands.
   In the sample case 50 is really 14400.

              Baud Rate Divisor Table
 ________________________________________________________________________________________
   Baud | 1.8432  % err | 3.0720  % err | 8.0000  % err | 18.4320  % err | 24.0000  % err|
=========================================================================================
    50  |  2304         |  3840         | 10000         |  23040         |  30000        |
-----------------------------------------------------------------------------------------
    75  |  1536         |  2560         |  6666         |  15360         |  20000        |
-----------------------------------------------------------------------------------------
   110  |  1047         |  1745         |  4545         |  10472         |  13636        |
-----------------------------------------------------------------------------------------
   134  |   856         |  1427         |  3717         |   8565         |  11152        |
-----------------------------------------------------------------------------------------
   150  |   768         |  1280         |  3333         |   7680         |  10000        |
-----------------------------------------------------------------------------------------
   300  |   384         |   640         |  1666         |   3840         |   5000        |
-----------------------------------------------------------------------------------------
   600  |   192         |   320         |   833         |   1920         |   2500        |
-----------------------------------------------------------------------------------------
  1200  |    96         |   160         |   416         |    960         |   1250        |
-----------------------------------------------------------------------------------------
  1800  |    64         |   106         |   277         |    640         |    833        |
-----------------------------------------------------------------------------------------
  2000  |    57         |    96         |   250         |    576         |    750        |
-----------------------------------------------------------------------------------------
  2400  |    48         |    80         |   208         |    480         |    625        |
-----------------------------------------------------------------------------------------
  3600  |    32         |    53         |   138         |    320         |    416        |
-----------------------------------------------------------------------------------------
  4800  |    24         |    40         |   104         |    240         |    312        |
-----------------------------------------------------------------------------------------
  7200  |    16         |    26   2.49  |    69         |    160         |    208        |
-----------------------------------------------------------------------------------------
  9600  |    12         |    20         |    52         |    120         |    156        |
-----------------------------------------------------------------------------------------
 14400  |     8         |    13   2.50  |    34   2.07  |     80         |    104        |
-----------------------------------------------------------------------------------------
 19200  |     6         |    10         |    26         |     60         |     78        |
-----------------------------------------------------------------------------------------
 23040  |     5         |     8   4.00  |    21   3.23  |     50         |     65        |
-----------------------------------------------------------------------------------------
 25600  |               |     7   6.66  |    19   2.72  |     45         |     58        |
-----------------------------------------------------------------------------------------
 28800  |     4         |               |    17   2.08  |     40         |     52        |
-----------------------------------------------------------------------------------------
 38400  |     3         |     5         |    13         |     30         |     39        |
-----------------------------------------------------------------------------------------
 57600  |     2         |               |     8   7.84  |     20         |     26        |
-----------------------------------------------------------------------------------------
 64000  |               |     3         |               |     18         |     23        |
-----------------------------------------------------------------------------------------
 96000  |               |     2         |     5   4.00  |     12         |     15   4.00 |
-----------------------------------------------------------------------------------------
100000  |               |               |     5         |     11   4.51  |     15        |
-----------------------------------------------------------------------------------------
115200  |     1         |               |     4   7.84  |     10         |     13        |
-----------------------------------------------------------------------------------------
128000  |               |               |               |      9         |     11   6.13 |
-----------------------------------------------------------------------------------------
192000  |               |     1         |               |      6         |               |
-----------------------------------------------------------------------------------------
250000  |               |               |     2         |                |      6        |
-----------------------------------------------------------------------------------------
375000  |               |               |               |      3   2.34  |      4        |
=========================================================================================


DATE APPROVED: 11/27/95