SIO Technical Reference Manual: Difference between revisions

From OS2World.Com Wiki
Jump to navigation Jump to search
Created page with "By Ray Gwinn ;Date: January 1, 1997 ==INTRODUCTION== Documentation of software is often more difficult than writing the program itself (at least it is for this author)...."
 
Jugbogdan (talk | contribs)
mNo edit summary
 
(10 intermediate revisions by 2 users not shown)
Line 2: Line 2:
;Date: January 1, 1997
;Date: January 1, 1997


==Introduction==
Documentation of software is often more difficult than writing the program itself (at least it is for this author). I will do my best though.


==INTRODUCTION==
But who do I document for? The user that is setting up a BBS just wants to get SIO installed and to move on to more important things.
Documentation of software is often more difficult than writing the
The user that is having problems needs information about serial I/O communications in general and the PC specifically. The application developer (programmer) needs detailed information about each individual function and the information generated.
program itself (at least it is for this author).  I will do my best
though.


But who do I document for?  The user that is setting up a BBS just
The answer is, more than one manual is needed. This manual is intended as a reference for use by application programmers that desires to use SIO. A separate Users Manual is included in the distribution file(s).
wants to get SIO installed and to move on to more important things.  
The user that is having problems needs information about serial I/O
communications in general and the PC specifically.  The application
developer (programmer) needs detailed information about each
individual function and the information generated.


The answer is, more than one manual is needed.  This manual is
This manual and the software described is provided as is and with no guarantees. Use at your own risk.
    intended as a reference for use by application programmers that
    desires to use SIO. A separate Users Manual is included in the
    distribution file(s).


    This manual and the software described is provided as is and with no
==What is SIO==
    guarantees.  Use at your own risk.
SIO is a Serial Input/Output (SIO) communications character device driver. It provides an interface between application programs and the serial communications hardware.


SIO had been designed as a high performance replacement for the OS/2 device driver COM.SYS. This manual documents the known differences between COM.SYS and SIO.SYS.


SIO only works with 8250 (type) serial I/O devices. Such devices include, but is not limited to the 8250A, 16450, 16550, 16550A and the 82510. If you have a PC that is an IBM or near compatible which has a serial communication port, it is likely that it contains one of these devices. SIO will identify the type of serial devices that it finds at load time.


    ii
Like other Device Drivers, SIO will do very little standing alone. There must be an application(s) program that makes use of SIO's functions before one will benefit from the use of SIO.
 
 
    WHAT IS SIO . . . . . . . . . . . . . . . . . . . . . . . . . . .    1
 
 
    Development and Debugging Tools . . . . . . . . . . . . . . . . .    4
          The Poor Man's Line Monitor (PMLM.EXE) . . . . . . . . . . .    4
          VIEWPMLM.EXE . . . . . . . . . . . . . . . . . . . . . . . .    5
          SIO's Utility (SU.EXE) . . . . . . . . . . . . . . . . . . .    5
              IRQs that currently free for use  . . . . . . . . . . .    5
 
    File System Requests  . . . . . . . . . . . . . . . . . . . . . .    6
          Driver Initialization  . . . . . . . . . . . . . . . . . . .    6
          Read . . . . . . . . . . . . . . . . . . . . . . . . . . . .    6
          Input Status . . . . . . . . . . . . . . . . . . . . . . . .    6
          Input Flush  . . . . . . . . . . . . . . . . . . . . . . . .    7
          Write  . . . . . . . . . . . . . . . . . . . . . . . . . . .    7
          Output Status  . . . . . . . . . . . . . . . . . . . . . . .    7
          Output Flush . . . . . . . . . . . . . . . . . . . . . . . .    7
          Open . . . . . . . . . . . . . . . . . . . . . . . . . . . .    7
              Initial Open  . . . . . . . . . . . . . . . . . . . . .    7
              Additional Open . . . . . . . . . . . . . . . . . . . .    8
          Close  . . . . . . . . . . . . . . . . . . . . . . . . . . .    8
              Intermediate Close  . . . . . . . . . . . . . . . . . .    8
              Last Close  . . . . . . . . . . . . . . . . . . . . . .    8
 
    Device I/O Control (IOCtl) Commands . . . . . . . . . . . . . . .    9
          IOCtl Functions From a DOS Session . . . . . . . . . . . . .  10
          41h - Set Bit Rate . . . . . . . . . . . . . . . . . . . . .  11
          42h - Set Line Characteristics . . . . . . . . . . . . . . .  12
          43h - Extended Set Bit Rate  . . . . . . . . . . . . . . . .  13
          44h - Transmit Byte Immediate  . . . . . . . . . . . . . . .  14
          45h - Set Break Off  . . . . . . . . . . . . . . . . . . . .  14
          46h - Set Modem Control Signals  . . . . . . . . . . . . . .  15
          47h - Hold Transmit  . . . . . . . . . . . . . . . . . . . .  16
          48h - Start Transmit . . . . . . . . . . . . . . . . . . . .  16
          4Bh - Set Break on . . . . . . . . . . . . . . . . . . . . .  17
          53h - Write Device Control Block (DCB)  . . . . . . . . . .  17
          54h - Write Extended Mode Parameters . . . . . . . . . . . .  20
          61h - Query Current Bit Rate . . . . . . . . . . . . . . . .  21
          62h - Query Line Characteristics . . . . . . . . . . . . . .  21
          63h - Query Extended Bit Rate  . . . . . . . . . . . . . . .  22
          64h - Query SIO Status . . . . . . . . . . . . . . . . . . .  23
          65h - Query Transmit Data Status . . . . . . . . . . . . . .  24
          66h - Query Current Modem Output Control Signals . . . . . .  25
          67h - Query Current Modem Input Signals  . . . . . . . . . .  25
          68h - Query Number of Characters in Receive Buffer . . . . .  26
          6Dh - Query SIO Error  . . . . . . . . . . . . . . . . . . .  27
          72h - Query SIO Event Information  . . . . . . . . . . . . .  28
 
 
 
                                                                        iii
 
          73h - Read Device Control Block (DCB)  . . . . . . . . . . .  29
          74h - Read Enhanced Mode Parameters  . . . . . . . . . . . .  29
 
    Differences between SIO/VSIO and COM/VCOM . . . . . . . . . . . .  30
 
    Appendix A, Hardware Port and IRQ Assignments . . . . . . . . . .  31
          Addresses and IRQs for COM1 and COM2 . . . . . . . . . . . .  31
          Defacto standard for COM3 and COM4 . . . . . . . . . . . . .  31
          Addresses and IRQ for COM3 through COM8 on the PS/2  . . . .  31
 
    Appendix B, SIO Chips . . . . . . . . . . . . . . . . . . . . . .  32
          8250 . . . . . . . . . . . . . . . . . . . . . . . . . . . .  32
          8250A  . . . . . . . . . . . . . . . . . . . . . . . . . . .  32
          16450  . . . . . . . . . . . . . . . . . . . . . . . . . . .  33
          16C451 . . . . . . . . . . . . . . . . . . . . . . . . . . .  33
          16550 (Non A)  . . . . . . . . . . . . . . . . . . . . . . .  33
          16550A . . . . . . . . . . . . . . . . . . . . . . . . . . .  33
          16550AF  . . . . . . . . . . . . . . . . . . . . . . . . . .  33
          16550AFN . . . . . . . . . . . . . . . . . . . . . . . . . .  33
          16550s Made by Western Digital . . . . . . . . . . . . . . .  34
          16C551 . . . . . . . . . . . . . . . . . . . . . . . . . . .  34
          16C552 . . . . . . . . . . . . . . . . . . . . . . . . . . .  34
          16C554 . . . . . . . . . . . . . . . . . . . . . . . . . . .  34
          82510  . . . . . . . . . . . . . . . . . . . . . . . . . . .  34
          16650  . . . . . . . . . . . . . . . . . . . . . . . . . . .  35
          16750 from Texas Instruments . . . . . . . . . . . . . . . .  35
          ComBic . . . . . . . . . . . . . . . . . . . . . . . . . . .  36
 
    Appendix C, Multi-Port Serial I/0 Cards . . . . . . . . . . . . .  37
          Hayes ESP  . . . . . . . . . . . . . . . . . . . . . . . . .  37
              ESP in Compatibility Mode . . . . . . . . . . . . . . .  37
          Telcor Tport . . . . . . . . . . . . . . . . . . . . . . . .  37
 
    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  38
          Gtek BBS550  . . . . . . . . . . . . . . . . . . . . . . . .  38
          Neotech Quad Serial (MCA bus)  . . . . . . . . . . . . . . .  39
 
    Appendix D, Advanced SIO Options  . . . . . . . . . . . . . . . .  40
          Protection . . . . . . . . . . . . . . . . . . . . . . . . .  40
          Locked Baud Rate . . . . . . . . . . . . . . . . . . . . . .  40
          IRQ Reflection to DOS Process  . . . . . . . . . . . . . . .  40
          I/O Port Mapping to DOS Process  . . . . . . . . . . . . . .  40
 
    Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  41
 
 
==WHAT IS SIO==
 
    SIO is a Serial Input/Output (SIO) communications character device
    driver.  It provides an interface between application programs and the
    serial communications hardware.
 
    SIO had been designed as a high performance replacement for the OS/2
    device driver COM.SYS.  This manual documents the known differences
    between COM.SYS and SIO.SYS.
 
    SIO only works with 8250 (type) serial I/O devices.  Such devices
    include, but is not limited to the 8250A, 16450, 16550, 16550A and the
    82510.  If you have a PC that is an IBM or near compatible which has a
    serial communication port, it is likely that it contains one of these
    devices.  SIO will identify the type of serial devices that it finds
    at load time.
 
    Like other Device Drivers, SIO will do very little standing alone.  
    There must be an application(s) program that makes use of SIO's
    functions before one will benefit from the use of SIO.


==Development and Debugging Tools==
==Development and Debugging Tools==
===The Poor Man's Line Monitor (PMLM.EXE)===
PMLM is basically of interest to developers of comm applications and those providing technical support for those applications. This SIO utility is released largely (in self defense) in the hope that some users can diagnose their own problems. PMLM's feature of saving trace information to disk will only work with registered and beta versions of SIO.


    The Poor Man's Line Monitor (PMLM.EXE)
PMLM provides basic line monitoring for OS/2, DOS and Windows comm programs. All characters sent or received by application programs are displayed in the upper portion of the screen. Receive characters are displayed as "white on blue" and transmitted characters are displayed "yellow on violet". Line signals, such as CTS are displayed as "dim white on red" when turned off and "bright white on red" when turned on. In addition, a signals transition to OFF is displayed in lower case and a signals transition to ON is displayed in upper case.
 
    PMLM is basically of interest to developers of comm applications and
    those providing technical support for those applications.  This SIO
    utility is released largely (in self defense) in the hope that some
    users can diagnose their own problems.  PMLM's feature of saving trace
    information to disk will only work with registered and beta versions
    of SIO.
 
    PMLM provides basic line monitoring for OS/2, DOS and Windows comm
    programs. All characters sent or received by application programs are
    displayed in the upper portion of the screen. Receive characters are
    displayed as "white on blue" and transmitted characters are displayed
    "yellow on violet". Line signals, such as CTS are displayed as "dim
    white on red" when turned off and "bright white on red" when turned
    on. In addition, a signals transition to OFF is displayed in lower
    case and a signals transition to ON is displayed in upper case.
 
    Status information is displayed in the lower part of the screen.  A
    bright white display means the signal is on, a dim white indicates
    that the signal is off.  In addition, when bright,  Rxoff and Txoff
    indicate the SIO has sent (Txoff) or received (Rxoff) an Xoff, and an
    Xon is pending.
 
    When a DOS or Windows session uses a comm port, an additional line of
    signal status appears.  This status line shows the state of the
    virtual UART's signals.  Only the signals which MAY be different from
    the real UART's signals are shown.
 
    "Rx Chars" and "Tx Chars" reflects the number of characters in SIO's
    receive and transmit buffers respectively.
 
    The last line on the screen shows the keys (from the keyboard) that
    PMLM will recognize.  The bright character shows the key to hit for
    the associated function.  The font keys will not work in a windowed
    OS/2 session.
 
    PMLM's command line requires one parameter, the comm port number, and
    optionally accepts an additional parameter giving a save trace file
    name.  For example, PMLM 1 COM1INFO.TEC will monitor COM1 and save ALL
    of the communications traffic in the file COM1INFO.TRC.  The trace
    files created by PMLM contain exactly the same information that is
    displayed by PMLM, video attributes and all.
 
 
 
                                                                          5


Status information is displayed in the lower part of the screen. A bright white display means the signal is on, a dim white indicates that the signal is off. In addition, when bright, Rxoff and Txoff indicate the SIO has sent (Txoff) or received (Rxoff) an Xoff, and an Xon is pending.


    VIEWPMLM.EXE may be used to view trace files created by PMLM.
When a DOS or Windows session uses a comm port, an additional line of signal status appears. This status line shows the state of the virtual UART's signals. Only the signals which MAY be different from the real UART's signals are shown.
    VIEWPMLM.EXE requires one parameter, the trace file name. The user
    can use the keys UP, DOWN, PAGEUP, PAGEDOWN, HOME, and END to navigate
    the saved trace file.  Registered SIO users may send VIEWPMLM.EXE
    (along with saved trace files) to anyone for technical support
    purposes.


    VIEWPMLM can be used in native DOS, in DOS sessions under OS/2, and in
"Rx Chars" and "Tx Chars" reflects the number of characters in SIO's receive and transmit buffers respectively.
    OS/2 sessions.  This means that even those developers and support
    people need not have OS/2 to view the captured communications data
    created by PMLM.


    SIO's Utility (SU.EXE)
The last line on the screen shows the keys (from the keyboard) that PMLM will recognize. The bright character shows the key to hit for the associated function. The font keys will not work in a windowed OS/2 session.


    This utility program has several useful commands.  You can obtain a
PMLM's command line requires one parameter, the comm port number, and optionally accepts an additional parameter giving a save trace file name. For example, PMLM 1 COM1INFO.TEC will monitor COM1 and save ALL of the communications traffic in the file COM1INFO.TRC. The trace files created by PMLM contain exactly the same information that is displayed by PMLM, video attributes and all.
    list of the available commands by typing SU at any command line prompt
    without any parameters. One very useful command is SU IRQS. This
    command will show IRQs that currently free for use. Commands are
    provided allowing user control (missing from MODE) are available.  
    Status commands provide a wealth of diagnostic information.


===VIEWPMLM.EXE===
VIEWPMLM.EXE may be used to view trace files created by PMLM. VIEWPMLM.EXE requires one parameter, the trace file name. The user can use the keys UP, DOWN, PAGEUP, PAGEDOWN, HOME, and END to navigate the saved trace file. Registered SIO users may send VIEWPMLM.EXE (along with saved trace files) to anyone for technical support purposes.


VIEWPMLM can be used in native DOS, in DOS sessions under OS/2, and in OS/2 sessions. This means that even those developers and support people need not have OS/2 to view the captured communications data created by PMLM.


    6
===SIO's Utility (SU.EXE)===
This utility program has several useful commands. You can obtain a list of the available commands by typing SU at any command line prompt without any parameters. One very useful command is SU IRQS. This command will show IRQs that currently free for use. Commands are provided allowing user control (missing from MODE) are available. Status commands provide a wealth of diagnostic information.


                              File System Requests
==File System Requests==
SIO processes all file system requests made to it in one way or another. The following file system requests and how SIO processes them may be of use to the application programmer.
*INIT          Driver initialization.
*Read          Data transfer from driver to program.
*Input Status  Get input status.
*Input Flush    Terminate all pending input requests.
*Write          Data transfer from program to driver.
*Output Status  Get output status.
*Output Flush  Terminate all pending output requests.
*Open          Open the device for use.
*Close          Close the device.
*IOCTL          Device I/O control commands.
Each of these file system requests are discussed in more detail in the following.


    SIO processes all file system requests made to it in one way or
===Driver Initialization===
    another.  The following file system requests and how SIO processes
During device driver initialization the command line is parsed, memory for data and control buffers is allocated and the system environment is examined.
    them may be of use to the application programmer.


    INIT          Driver initialization.
Buffers are allocated for the maximum number of ports that the installed version of SIO can support (up to 16).
    Read          Data transfer from driver to program.
    Input Status  Get input status.
    Input Flush    Terminate all pending input requests.
    Write          Data transfer from program to driver.
    Output Status  Get output status.
    Output Flush  Terminate all pending output requests.
    Open          Open the device for use.
    Close          Close the device.
    IOCTL          Device I/O control commands.


    Each of these file system requests are discussed in more detail in the
The mouse port is determined and if it is a serial mouse, that port is excluded from use by SIO.
    following.


                              Driver Initialization
In the absence of any command line parameters, SIO will only support (look for) COM1 and COM2 at the standard addresses. COM3 and up will not be supported (or looked at) unless they are specifically identified in the SIO command line.


    During device driver initialization the command line is parsed, memory
===Read===
    for data and control buffers is allocated and the system environment
If another read is already in progress, the process issuing the additional read is blocked (suspended) until the previous read command completes. When a read is started, that read is not interrupted by additional reads. If multiple reads are issued, they are not necessarily processed in the order they were issued. Thus, applications may not see the read requests complete in the order in which they were issued.
    is examined.


    Buffers are allocated for the maximum number of ports that the
The conditions that control when the read will complete are controlled by the active (current) DCB when the read is started.
    installed version of SIO can support (up to 16).


    The mouse port is determined and if it is a serial mouse, that port is
===Input Status===
    excluded from use by SIO.
This function returns with "device busy" set if there is no data in the receive buffer. That is, busy is returned if the process may be blocked if the application issues a read command.


    In the absence of any command line parameters, SIO will only support
===Input Flush===
    (look for) COM1 and COM2 at the standard addresses. COM3 and up will
This function causes the receive buffer to be cleared (made empty). Any threads that are blocked, waiting for a read, will be restarted when this function is issued.
    not be supported (or looked at) unless they are specifically
    identified in the SIO command line.


                                      Read
===Write===
If another write is already in progress, the process issuing the additional write is blocked (suspended) until the previous write command completes. When a write is started, that write is not interrupted by additional writes. If multiple writes are issued, they are not necessarily processed in the order they were issued. Thus, applications may not see the write requests complete in the order in which they were issued.


    If another read is already in progress, the process issuing the
The conditions that control when the write will complete are controlled by the current DCB when the write is started.
    additional read is blocked (suspended) until the previous read command
    completes.  When a read is started, that read is not interrupted by
    additional reads.  If multiple reads are issued, they are not
    necessarily processed in the order they were issued.  Thus,
    applications may not see the read requests complete in the order in
    which they were issued.


    The conditions that control when the read will complete are controlled
===Output Status===
    by the active (current) DCB when the read is started.
This function returns with "device busy" set if the output buffer is more than three quarters full. That is, busy is returned if the process may be blocked if the application issues a write command.


                                  Input Status
===Output Flush===
This function causes the transmit buffer to be cleared (made empty). Any threads that are blocked, waiting for a write, will be restarted when this function is issued.


    This function returns with "device busy" set if there is no data in
===Open===
    the receive buffer. That is, busy is returned if the process may be
There are basically two kinds of open. They are an Initial Open and Additional (shared) Opens. The IBM documentation calls the initial open a First Level Open.  An Initial Open is an open that occurs when no other process has the communications port open. An Additional Open is when an open occurs and another process already has the communications port open. For an Additional Open to occur, the Initial Opener must have issued an open allowing shared access to the port.
    blocked if the application issues a read command.


====Initial Open====
The IRQ associated with the comm port is claimed (taken) when the
Initial Open occurs.  If the associated IRQ is not available a "Port
in Use" error is returned.  At the time of this writing, the IRQ is
claimed allowing sharing.  However, the shared IRQ claiming is done to
circumvent anomalies in the OS, and in actuality SIO will not
concurrently share an IRQ with another device driver.  The author
found it necessary to claim (reset) all interrupts directed to the
interrupt service routine in order to prevent lock ups of a
communications port.  The IRQ mess may be cleaned up at a future date
when the OS problems are corrected.


During Initial Opens, DTR and RTS are set in accordance with the
current Device Control Block (DCB) settings.  If DTR Control Mode is
the "Enabled" option ( bits 1 and 0 of the DCB Flags1 byte equal 01),
then DTR is turned on.  Otherwise, DTR is unchanged by the Initial
Open.  Similarly, if RTS Control Mode is the "Enabled" option ( bits 7
and 6 of the DCB Flags1 byte equal 01), then RTS is turned on.
Otherwise, RTS is unchanged by the Initial Open.


                                                                          7
The following actions also occur during an Initial Open:
*The Xon and Xoff characters are set to 11h and 13h respectively.
*The transmit and receive buffers and structures are cleared and re-initialized.
*Status bits are reset.
If the Initial Opener is an OS/2 process (not a DOS process) then the Read time out processing is set to "Normal" in the current DCB.


                                  Input Flush
====Additional Open====
A count of active opens is incremented. No changes are made to current comm settings.


    This function causes the receive buffer to be cleared (made empty).  
===Close===
    Any threads that are blocked, waiting for a read, will be restarted
There are two basic kinds of closes. They are an Intermediate Close and a Last Close.
    when this function is issued.


====Intermediate Close====
An intermediate close occurs when a process issues a close and other processes still have the communications port opened. This type of
close simply decrements an open count and returns. No action or changes take place at the communications port.


                                      Write
====Last Close====
The last close occurs when a process issues a close and no other
process has the communications port open. If there are any writes
pending or incomplete, the process is blocked (suspended) until the
writes complete or time out. If 60 seconds pass with no activity at
the communications port, the port is forced to close and all writes
are terminated. If any processes are blocked (suspended) waiting on a
read, they are forced to return to the process that issued the read.


    If another write is already in progress, the process issuing the
If either DTR Control Mode or RTS Control Mode are set to "Enabled" by
    additional write is blocked (suspended) until the previous write
the current DCB, then the appropriate signal(s) is turned off.
    command completes.  When a write is started, that write is not
    interrupted by additional writes.  If multiple writes are issued, they
    are not necessarily processed in the order they were issued.  Thus,
    applications may not see the write requests complete in the order in
    which they were issued.


    The conditions that control when the write will complete are
Finally, the IRQ is released back to the OS.
    controlled by the current DCB when the write is started.


==Device I/O Control (IOCtl) Commands==
The following Generic IOCtl functions are supported by SIO.
:41h - Set Bit Rate
:42h - Set Line Characteristics
:43h - Extended Set Bit Rate
:44h - Transmit Byte Immediate
:45h - Set Break Off
:46h - Set Modem Control Signals
:47h - Hold Transmit
:48h - Start Transmit (after hold)
:4Bh - Set Break On
:53h - Write Device Control Block (DCB)
:54h - Write Extended Mode Parameters
:61h - Query Current Bit Rate
:62h - Query Line Characteristics
:63h - Query Extended Bit Rate
:64h - Query SIO Status
:65h - Query Transmit Data Status
:66h - Query Current Modem Output Control Signals
:67h - Query Current Modem Input Signals
:68h - Query Number of Characters in Receive Buffer
:69h - Query Number of Characters in Transmit Buffer
:6Dh - Query SIO Error
:72h - Query SIO Event Information
:73h - Read Device Control Block (DCB)
:74h - Read Enhanced Mode Parameters
Each of these IOCtl commands are described in detail on the following pages.


                                  Output Status
All IOCtl functions are called with a uniform set of parameters. This uniform set of parameters is:
DWORD  Address of a data packet.
WORD  Size of the data packet in bytes.
DWORD  Address of the parameter packet.
WORD  Size of the parameter packet in bytes.
WORD  Function code.
WORD  Category code (01 for SIO).
WORD  Handle for the opened device.
Each IOCtl function may or may not have a data or parameter packet. If a given IOCtl function specifies a NULL parameter or data packet, the address of the appropriate item must be NULL (zero) in the parameters. Passing an invalid data or parameter packet may result in a General Protection Fault.


    This function returns with "device busy" set if the output buffer is
===IOCtl Functions From a DOS Session===
    more than three quarters full. That is, busy is returned if the
Additionally the following describes how to call an IOCtl function in
     process may be blocked if the application issues a write command.
an OS/2 driver from a DOS session (VDM). The "handle" is obtained
simply by issuing a normal DOS open of the device, ie COM1. The Data
Packets (DataPkt below) and Parameter Packets (PrmPkt below) are
different for each IOCtl function. The structure and contents of
these packets are described in the following pages.
<pre>
push    ds              ;save ds
mov    bx,handle      ;file handle to bx
mov    ch,1            ;category, 1=serial device control
mov    cl,41h          ;func code, 41h=extended set bit rate
mov    dx,Seg DataPkt  ;get segment of the data packet
  mov    ds,dx          ;load ds with seg of the data packet
lea    dx,DataPkt     ;data packet address to ds:dx
mov    si,Seg PrmPkt  ;segment of command packet to si
lea    di,PrmPkt      ;offset of command packet to di
mov    ax,440ch        ;IOCtl function call, handle based
int    21h            ;issue IOCtl to OS/2 driver.
pop    ds              ;restore ds
jc      error          ;jump if error returned
</pre>


                                  Output Flush
===41h - Set Bit Rate===
Parameter Packet
┌──────────────────────────────────────┐
│        Item                Type    │
├───────────────────────────┬──────────┤
│ Bit/Baud Rate            │ WORD    │
└───────────────────────────┴──────────┘
"Bit Rate" is any number from 1 to 65535.  SIO does not attempt
to validate a given bit rate.  The minimum bit rate accepted by
SIO is 50, the maximum for this IOCtl function is 65535.


    This function causes the transmit buffer to be cleared (made empty).  
Note that the hardware may not be able to generate the given bit
    Any threads that are blocked, waiting for a write, will be restarted
rate. For example, if a computer has a standard communications
    when this function is issued.
card installed and if a bit rate of 65500 is specified, the
nearest bit rate that can be generated will be set, 57600 in this
case.


To set bit rates in excess of 57600, see IOCtl function 43h,
Extended Set Bit Rate.


                                      Open
Some commonly used bit rates that can be set with this function are:
  50      2000
  75      2400
  110      3600
  150      4800
  300      7200
  600      9600
1200      19200
1800      28800
2000      38400
2400      57600
Data Packet - None


    There are basically two kinds of open. They are an Initial Open and
===42h - Set Line Characteristics===
    Additional (shared) Opens. The IBM documentation calls the initial
Parameter Packet
    open a First Level Open. An Initial Open is an open that occurs when
┌──────────────────────────────────────┐
    no other process has the communications port open. An Additional Open
│        Item                Type    │
    is when an open occurs and another process already has the
  ├───────────────────────────┬──────────┤
    communications port open. For an Additional Open to occur, the
│ Data Bits Per Character  │ BYTE    │
    Initial Opener must have issued an open allowing shared access to the
  ├───────────────────────────┼──────────┤
    port.
  │ Parity Setting            │ BYTE    │
├───────────────────────────┼──────────┤
  │ Stop Bit Setting          │ BYTE    │
└───────────────────────────┴──────────┘
Data Bits Per Character may be 5, 7, or 8, all other values are invalid.


    Initial Open
Parity Setting may have the following values, all other values are invalid:
0 - No parity bit.
1 - Odd parity.
2 - Even parity.
3 - Mark parity (1).
4 - Space parity (0).
Stop Bit Setting may have the following values, all other values are invalid:
0 - 1 stop bit.
1 - 1.5 stop bit (valid with 5 data bit characters).
2 - 2 stop bits.
Data Packet - None


    The IRQ associated with the comm port is claimed (taken) when the
===43h - Extended Set Bit Rate===
    Initial Open occurs. If the associated IRQ is not available a "Port
Parameter Packet
    in Use" error is returnedAt the time of this writing, the IRQ is
┌──────────────────────────────────────┐
    claimed allowing sharing.  However, the shared IRQ claiming is done to
│        Item                Type    │
    circumvent anomalies in the OS, and in actuality SIO will not
├───────────────────────────┬──────────┤
    concurrently share an IRQ with another device driver. The author
│ Bit/Baud Rate            │ DWORD    │
    found it necessary to claim (reset) all interrupts directed to the
├───────────────────────────┼──────────┤
    interrupt service routine in order to prevent lock ups of a
│ Fraction                  │ BYTE    │
  └───────────────────────────┴──────────┘
"Bit Rate" is the desired bit/baud rateThe maximum bit rate
supported by SIO is determined by the installed hardware. The
IOCtl function "63h - Query Extended Bit Rate" can be used to
determine the maximum bit rate allowed for the associated
hardware.


SIO does not attempt to validate a given bit rate.  This means
that the hardware may not be able to generate the given bit rate.
For example, if a computer has a standard communications card
installed and if a bit rate of 65500 is specified, the nearest
bit rate that can be generated will be set, 57600 in this case.


"Fraction" is used to set the fractional part of the bit rate
when a high degree of accuracy is needed.  As of this writing,
SIO does not support a "Fraction" other than zero.


     8
Some commonly used bit rates that can be set with this function are:
  110      3600     115200
  150      4800      230400
  300      7200      460800
  600      9600      921600
1200      19200
1800      28800
2000      38400
2400      57600
Data Packet - None


    communications portThe IRQ mess may be cleaned up at a future date
=== 44h - Transmit Byte Immediate===
    when the OS problems are corrected.
Parameter Packet
┌──────────────────────────────────────┐
│        Item                Type    │
├───────────────────────────┬──────────┤
│ Character to Transmit    │ BYTE    │
└───────────────────────────┴──────────┘
"Character to Transmit" will be the next character loaded into
the UART for transmissionIf a previous transmit immediate byte
is still pending, it is lost. This function does not wait for
the character to transmit before returning.


    During Initial Opens, DTR and RTS are set in accordance with the
This function may be used by an application program as one of a
    current Device Control Block (DCB) settings.  If DTR Control Mode is
set of functions to implement its own Xon/Xoff type handshaking.
    the "Enabled" option ( bits 1 and 0 of the DCB Flags1 byte equal 01),
    then DTR is turned on.  Otherwise, DTR is unchanged by the Initial
    Open.  Similarly, if RTS Control Mode is the "Enabled" option ( bits 7
    and 6 of the DCB Flags1 byte equal 01), then RTS is turned on.
    Otherwise, RTS is unchanged by the Initial Open.


    The following actions also occur during an Initial Open:
Data Packet - None


          The Xon and Xoff characters are set to 11h and 13h respectively.
===45h - Set Break Off===
Parameter Packet - None


          The transmit and receive buffers and structures are cleared and
Look!! No Parameter Packet!
          re-initialized.


          Status bits are reset.
Data Packet
┌──────────────────────────────────────┐
│        Item                Type    │
├───────────────────────────┬──────────┤
│ SIO Error Word            │ WORD    │
└───────────────────────────┴──────────┘
See function 6Dh "Query SIO Error" for a description of the SIO
Error Word. This function does not reset any bits in the SIO
Error Word.


     If the Initial Opener is an OS/2 process (not a DOS process) then the
===46h - Set Modem Control Signals===
    Read time out processing is set to "Normal" in the current DCB.
Parameter Packet
┌──────────────────────────────────────┐
│        Item                Type    │
├───────────────────────────┬──────────┤
│ DTR and RTS on mask      │ BYTE    │
├───────────────────────────┼──────────┤
│ DTR and RTS off mask     │ BYTE    │
└───────────────────────────┴──────────┘
Attempted changes in the the setting of signals that are used as
flow control signals are ignored.  The current DCB determines if
either or both RTS and DTR are used as a flow control signal.


    Additional Open
The setting of bit 0 affects DTR and the setting of bit 1 affects
RTS.  Ones in the "on mask" specifies which of the two signals
are to be turned on, and zeros in the "off mask" specify which of
the two signals are to be turned off.


     A count of active opens is incremented. No changes are made to
Some examples are:
    current comm settings.
On Mask        Off Mask
01h            0FFh     Turn DTR on
00h            0FEh      Turn DTR off
02h            0FFh      Turn RTS on
00h            0FDh      Turn RTS off
03h            0FFh      Turn RTS and DTR on
  00h            0FCh      Turn RTS and DTR off
If both on and off are specified for the setting of a signal, the
result is undefined.


                                      Close
Data Packet
┌──────────────────────────────────────┐
│        Item                Type    │
├───────────────────────────┬──────────┤
│ SIO Error Word            │ WORD    │
└───────────────────────────┴──────────┘
See function 6Dh "Query SIO Error" for a description of the SIO
Error Word. This function does not reset any bits in the SIO
Error Word.


    There are two basic kinds of closes.  They are an Intermediate Close
===47h - Hold Transmit===
    and a Last Close.
Parameter Packet - None


    Intermediate Close
Data Packet - None


    An intermediate close occurs when a process issues a close and other
This function will disable the transmitter. The transmitter will not be enabled again unless IOCtl function 48h is issued. If the transmitter is already disabled, this call has no effect.
    processes still have the communications port opened. This type of
    close simply decrements an open count and returns. No action or
    changes take place at the communications port.


    Last Close
This function can be used as part of a set that allows an
application to implement its own Xon/Xoff type handshaking.


    The last close occurs when a process issues a close and no other
Note that this is different from how COM.SYS implements this function. COM.SYS will re-enable the transmitter if an Xon is received while SIO will not.
    process has the communications port open. If there are any writes
    pending or incomplete, the process is blocked (suspended) until the
    writes complete or time out. If 60 seconds pass with no activity at
    the communications port, the port is forced to close and all writes
    are terminated.  If any processes are blocked (suspended) waiting on a
    read, they are forced to return to the process that issued the read.


    If either DTR Control Mode or RTS Control Mode are set to "Enabled" by
===48h - Start Transmit===
    the current DCB, then the appropriate signal(s) is turned off.
Parameter Packet - None


    Finally, the IRQ is released back to the OS.
Data Packet - None


This function will enable the transmitter, usually following an
IOCtl function 47h.  If the transmitter is already enabled, this
call has no effect.


This function can be used as part of a set that allows an
application to implement its own Xon/Xoff type handshaking.


                                                                          9
===4Bh - Set Break on===
Parameter Packet - None


                      Device I/O Control (IOCtl) Commands
Look!! No Parameter Packet!


    The following Generic IOCtl functions are supported by SIO.
Data Packet
          41h - Set Bit Rate
┌──────────────────────────────────────┐
          42h - Set Line Characteristics
│        Item                Type    │
          43h - Extended Set Bit Rate
├───────────────────────────┬──────────┤
          44h - Transmit Byte Immediate
SIO Error Word            │ WORD    │
          45h - Set Break Off
└───────────────────────────┴──────────┘
          46h - Set Modem Control Signals
See function 6Dh "Query SIO Error" for a description of the SIO
          47h - Hold Transmit
Error Word. This function does not reset any bits in the SIO
          48h - Start Transmit (after hold)
Error Word.
          4Bh - Set Break On
          53h - Write Device Control Block (DCB)
          54h - Write Extended Mode Parameters
          61h - Query Current Bit Rate
          62h - Query Line Characteristics
          63h - Query Extended Bit Rate
          64h - Query SIO Status
          65h - Query Transmit Data Status
          66h - Query Current Modem Output Control Signals
          67h - Query Current Modem Input Signals
          68h - Query Number of Characters in Receive Buffer
          69h - Query Number of Characters in Transmit Buffer
          6Dh - Query SIO Error
          72h - Query SIO Event Information
          73h - Read Device Control Block (DCB)
          74h - Read Enhanced Mode Parameters


    Each of these IOCtl commands are described in detail on the following
===53h - Write Device Control Block (DCB) ===
    pages.
This is where the action is!  See also function 73h (Read DCB).


Parameter Packet
┌──────────────────────────────────────┐
│        Item                Type    │
├───────────────────────────┬──────────┤
│ Write Timeout            │ WORD    │
├───────────────────────────┼──────────┤
│ Read Timeout              │ WORD    │
├───────────────────────────┼──────────┤
│ Flags1                    │ BYTE    │
├───────────────────────────┼──────────┤
│ Flags2                    │ BYTE    │
├───────────────────────────┼──────────┤
│ Flags3                    │ BYTE    │
├───────────────────────────┼──────────┤
│ Error Replacement Byte    │ BYTE    │
├───────────────────────────┼──────────┤
│ Break Replacement Byte    │ BYTE    │
├───────────────────────────┼──────────┤
│ Xon Character            │ BYTE    │
├───────────────────────────┼──────────┤
│ Xoff Character            │ BYTE    │
└───────────────────────────┴──────────┘
"Write Timeout"  The write timeout is given in hundredths of a
second, relative to zero.  That is, 0 specifies 0.01 seconds and
1 specifies 0.02 seconds.


"Read Timeout" The read timeout is given in hundredths of a
second, relative to zero.  That is, 0 specifies 0.01 seconds and 1 specifies 0.02 seconds.


    10
"Flags1" is a bit flag.  The bits in the flag specify the following:
 
 
    All IOCtl functions are called with a uniform set of parameters.  This
    uniform set of parameters is:
          DWORD    Address of a data packet.
          WORD      Size of the data packet in bytes.
          DWORD    Address of the parameter packet.
          WORD      Size of the parameter packet in bytes.
          WORD      Function code.
          WORD      Category code (01 for SIO).
          WORD      Handle for the opened device.
 
    Each IOCtl function may or may not have a data or parameter packet.
    If a given IOCtl function specifies a NULL parameter or data packet,
    the address of the appropriate item must be NULL (zero) in the
    parameters.  Passing an invalid data or parameter packet may result in
    a General Protection Fault.
 
    IOCtl Functions From a DOS Session
 
    Additionally the following describes how to call an IOCtl function in
    an OS/2 driver from a DOS session (VDM).  The "handle" is obtained
    simply by issuing a normal DOS open of the device, ie COM1.  The Data
    Packets (DataPkt below) and Parameter Packets (PrmPkt below) are
    different for each IOCtl function.  The structure and contents of
    these packets are described in the following pages.
 
            push    ds              ;save ds
            mov    bx,handle      ;file handle to bx
            mov    ch,1            ;category, 1=serial device control
            mov    cl,41h          ;func code, 41h=extended set bit rate
            mov    dx,Seg DataPkt  ;get segment of the data packet
            mov    ds,dx          ;load ds with seg of the data packet
            lea    dx,DataPkt      ;data packet address to ds:dx
            mov    si,Seg PrmPkt  ;segment of command packet to si
            lea    di,PrmPkt      ;offset of command packet to di
            mov    ax,440ch        ;IOCtl function call, handle based
            int    21h            ;issue IOCtl to OS/2 driver.
            pop    ds              ;restore ds
            jc      error          ;jump if error returned
 
 
 
                                                                        11
 
 
                              41h - Set Bit Rate
 
    Parameter Packet
 
          ┌──────────────────────────────────────┐
          │        Item                Type    │
          ├───────────────────────────┬──────────┤
          │ Bit/Baud Rate            │ WORD    │
          └───────────────────────────┴──────────┘
 
          "Bit Rate" is any number from 1 to 65535.  SIO does not attempt
          to validate a given bit rate.  The minimum bit rate accepted by
          SIO is 50, the maximum for this IOCtl function is 65535.
 
          Note that the hardware may not be able to generate the given bit
          rate.  For example, if a computer has a standard communications
          card installed and if a bit rate of 65500 is specified, the
          nearest bit rate that can be generated will be set, 57600 in this
          case.
 
          To set bit rates in excess of 57600, see IOCtl function 43h,
          Extended Set Bit Rate.
 
          Some commonly used bit rates that can be set with this function
          are:
 
          50        2000
          75        2400
          110      3600
          150      4800
          300      7200
          600      9600
          1200      19200
          1800      28800
          2000      38400
          2400      57600
 
 
    Data Packet - None
 
 
 
    12
 
 
                        42h - Set Line Characteristics
 
    Parameter Packet
 
          ┌──────────────────────────────────────┐
          │        Item                Type    │
          ├───────────────────────────┬──────────┤
          │ Data Bits Per Character  │ BYTE    │
          ├───────────────────────────┼──────────┤
          │ Parity Setting            │ BYTE    │
          ├───────────────────────────┼──────────┤
          │ Stop Bit Setting          │ BYTE    │
          └───────────────────────────┴──────────┘
 
          Data Bits Per Character may be 5, 7, or 8, all other values are
          invalid.
 
          Parity Setting may have the following values, all other values
          are invalid:
              0 - No parity bit.
              1 - Odd parity.
              2 - Even parity.
              3 - Mark parity (1).
              4 - Space parity (0).
 
 
          Stop Bit Setting may have the following values, all other values
          are invalid:
              0 - 1 stop bit.
              1 - 1.5 stop bit (valid with 5 data bit characters).
              2 - 2 stop bits.
 
 
    Data Packet - None
 
 
 
                                                                        13
 
 
                          43h - Extended Set Bit Rate
 
    Parameter Packet
 
          ┌──────────────────────────────────────┐
          │        Item                Type    │
          ├───────────────────────────┬──────────┤
          │ Bit/Baud Rate            │ DWORD    │
          ├───────────────────────────┼──────────┤
          │ Fraction                  │ BYTE    │
          └───────────────────────────┴──────────┘
 
 
          "Bit Rate" is the desired bit/baud rate.  The maximum bit rate
          supported by SIO is determined by the installed hardware. The
          IOCtl function "63h - Query Extended Bit Rate" can be used to
          determine the maximum bit rate allowed for the associated
          hardware.
 
          SIO does not attempt to validate a given bit rate.  This means
          that the hardware may not be able to generate the given bit rate.
          For example, if a computer has a standard communications card
          installed and if a bit rate of 65500 is specified, the nearest
          bit rate that can be generated will be set, 57600 in this case.
 
          "Fraction" is used to set the fractional part of the bit rate
          when a high degree of accuracy is needed.  As of this writing,
          SIO does not support a "Fraction" other than zero.
 
          Some commonly used bit rates that can be set with this function
          are:
 
          110      3600      115200
          150      4800      230400
          300      7200      460800
          600      9600      921600
          1200      19200
          1800      28800
          2000      38400
          2400      57600
 
    Data Packet - None
 
 
 
    14
 
 
                          44h - Transmit Byte Immediate
 
    Parameter Packet
 
          ┌──────────────────────────────────────┐
          │        Item                Type    │
          ├───────────────────────────┬──────────┤
          │ Character to Transmit    │ BYTE    │
          └───────────────────────────┴──────────┘
 
          "Character to Transmit" will be the next character loaded into
          the UART for transmission.  If a previous transmit immediate byte
          is still pending, it is lost.  This function does not wait for
          the character to transmit before returning.
 
          This function may be used by an application program as one of a
          set of functions to implement its own Xon/Xoff type handshaking.
 
    Data Packet - None
 
 
                              45h - Set Break Off
 
    Parameter Packet - None
 
          Look!! No Parameter Packet!
 
    Data Packet
 
          ┌──────────────────────────────────────┐
          │        Item                Type    │
          ├───────────────────────────┬──────────┤
          │ SIO Error Word            │ WORD    │
          └───────────────────────────┴──────────┘
 
          See function 6Dh "Query SIO Error" for a description of the SIO
          Error Word.  This function does not reset any bits in the SIO
          Error Word.
 
 
 
                                                                        15
 
 
                        46h - Set Modem Control Signals
 
    Parameter Packet
 
          ┌──────────────────────────────────────┐
          │        Item                Type    │
          ├───────────────────────────┬──────────┤
          │ DTR and RTS on mask      │ BYTE    │
          ├───────────────────────────┼──────────┤
          │ DTR and RTS off mask      │ BYTE    │
          └───────────────────────────┴──────────┘
 
          Attempted changes in the the setting of signals that are used as
          flow control signals are ignored.  The current DCB determines if
          either or both RTS and DTR are used as a flow control signal.
 
          The setting of bit 0 affects DTR and the setting of bit 1 affects
          RTS.  Ones in the "on mask" specifies which of the two signals
          are to be turned on, and zeros in the "off mask" specify which of
          the two signals are to be turned off.
 
          Some examples are:
              On Mask        Off Mask
              01h            0FFh      Turn DTR on
              00h            0FEh      Turn DTR off
              02h            0FFh      Turn RTS on
              00h            0FDh      Turn RTS off
              03h            0FFh      Turn RTS and DTR on
              00h            0FCh      Turn RTS and DTR off
 
          If both on and off are specified for the setting of a signal, the
          result is undefined.
 
    Data Packet
 
          ┌──────────────────────────────────────┐
          │        Item                Type    │
          ├───────────────────────────┬──────────┤
          │ SIO Error Word            │ WORD    │
          └───────────────────────────┴──────────┘
 
          See function 6Dh "Query SIO Error" for a description of the SIO
          Error Word.  This function does not reset any bits in the SIO
          Error Word.
 
 
 
    16
 
 
                              47h - Hold Transmit
 
    Parameter Packet - None
 
    Data Packet - None
 
          This function will disable the transmitter.  The transmitter will
          not be enabled again unless IOCtl function 48h is issued.  If the
          transmitter is already disabled, this call has no effect.
 
          This function can be used as part of a set that allows an
          application to implement its own Xon/Xoff type handshaking.
 
          Note that this is different from how COM.SYS implements this
          function.  COM.SYS will re-enable the transmitter if an Xon is
          received while SIO will not.
 
 
                              48h - Start Transmit
 
    Parameter Packet - None
 
    Data Packet - None
 
          This function will enable the transmitter, usually following an
          IOCtl function 47h.  If the transmitter is already enabled, this
          call has no effect.
 
          This function can be used as part of a set that allows an
          application to implement its own Xon/Xoff type handshaking.
 
 
 
                                                                        17
 
 
                              4Bh - Set Break on
 
    Parameter Packet - None
 
          Look!! No Parameter Packet!
 
    Data Packet
 
          ┌──────────────────────────────────────┐
          │        Item                Type    │
          ├───────────────────────────┬──────────┤
          │ SIO Error Word            │ WORD    │
          └───────────────────────────┴──────────┘
 
          See function 6Dh "Query SIO Error" for a description of the SIO
          Error Word.  This function does not reset any bits in the SIO
          Error Word.
 
 
                    53h - Write Device Control Block (DCB)
 
    This is where the action is!  See also function 73h (Read DCB).
 
    Parameter Packet
 
          ┌──────────────────────────────────────┐
          │        Item                Type    │
          ├───────────────────────────┬──────────┤
          │ Write Timeout            │ WORD    │
          ├───────────────────────────┼──────────┤
          │ Read Timeout              │ WORD    │
          ├───────────────────────────┼──────────┤
          │ Flags1                    │ BYTE    │
          ├───────────────────────────┼──────────┤
          │ Flags2                    │ BYTE    │
          ├───────────────────────────┼──────────┤
          │ Flags3                    │ BYTE    │
          ├───────────────────────────┼──────────┤
          │ Error Replacement Byte    │ BYTE    │
          ├───────────────────────────┼──────────┤
          │ Break Replacement Byte    │ BYTE    │
          ├───────────────────────────┼──────────┤
          │ Xon Character            │ BYTE    │
          ├───────────────────────────┼──────────┤
          │ Xoff Character            │ BYTE    │
          └───────────────────────────┴──────────┘
 
 
          "Write Timeout"  The write timeout is given in hundredths of a
          second, relative to zero.  That is, 0 specifies 0.01 seconds and
          1 specifies 0.02 seconds.
 
          "Read Timeout" The read timeout is given in hundredths of a
          second, relative to zero.  That is, 0 specifies 0.01 seconds and
 
 
 
    18
 
          1 specifies 0.02 seconds.
 
          "Flags1" is a bit flag.  The bits in the flag specify the
          following:


           Bits 1 and 0        DTR Control Mode.
           Bits 1 and 0        DTR Control Mode.
Line 839: Line 456:
           Bit 7,    Must be zero.
           Bit 7,    Must be zero.


    ─────────────────────────────────────
"Flags2" is a bit flag.  The bits in the flag specify the following:
 
:Bit 0,    SIO is to honor Xon/XOff received from remote.
          "Flags2" is a bit flag.  The bits in the flag specify the
:Bit 1,    SIO may send Xon/Xoff to the remote.
          following:
:Bit 2,    Enable error replacement character. Not supported by SIO.
 
:Bit 3,    Enable null stripping.  Not supported by SIO.
          Bit 0,    SIO is to honor Xon/XOff received from remote.
:Bit 4,    Enable break replacement character. Not supported by SIO.
          Bit 1,    SIO may send Xon/Xoff to the remote.
:Bit 5,    Enable Full duplex.  Half duplex is not supported by SIO.
          Bit 2,    Enable error replacement character. Not supported by
:Bits 7 and 6 RTS Control Mode
                    SIO.
::00 - Disable changing RTS during Open and Close.
 
::01 - Enable Changing RTS during Open and Close.
          Bit 3,    Enable null stripping.  Not supported by SIO.
::10 - RTS used for input handshaking.
          Bit 4,    Enable break replacement character. Not supported by
::11 - Toggle on transmit (half duplex). Not supported by SIO.
                    SIO.
"Flags3" is a bit flag.  The bits in the flag specify the following:
 
:Bit 0,    Enable infinite write timeout processing. When set, a write timeout will not occur.
          Bit 5,    Enable Full duplex.  Half duplex is not supported by
:Bits 2 and 1 Read timeout processing
                    SIO.
::00 - Invalid.
 
::01 - Normal read time out.
          Bits 7 and 6       RTS Control Mode
::10 - Wait for something.  Reads will return before a timeout occurs if something received.
                    00 - Disable changing RTS during Open and Close.
::11 - No Wait.  Reads will return immediately with any available data.
                    01 - Enable Changing RTS during Open and Close.
:Bits 4 and 3 FIFO Control
                    10 - RTS used for input handshaking.
::00 - No change in FIFO state.
                    11 - Toggle on transmit (half duplex). Not supported
::01 - Disable FIFO buffers.
                        by SIO.
::10 - Enable FIFO buffers.
::11 - Dynamic enabling and disabling of FIFOS.
 
:: **Note, SIO forces bits 4 and 3 to "10".
 
:Bits 6 and 5 Set receive trigger level
 
::00 - 1 character.
                                                                        19
::01 - 4 characters.
 
::10 - 8 characters.
 
::11 - 14 characters.
          "Flags3" is a bit flag.  The bits in the flag specify the
:: **Note, SIO forces bits 6 and 5 to "10".
          following:
:Bit 7 Transmit load count
 
::0 -  Load 1 character.
          Bit 0,    Enable infinite write timeout processing. When set, a
::1 -  Load 16 characters.
                    write timeout will not occur.
:: **Note, SIO forces bit 7 to "1".
 
          Bits 2 and 1       Read timeout processing
                    00 - Invalid.
                    01 - Normal read time out.
                    10 - Wait for something.  Reads will return before a
                        timeout occurs if something received.
                    11 - No Wait.  Reads will return immediately with any
                        available data.
 
          Bits 4 and 3       FIFO Control
                    00 - No change in FIFO state.
                    01 - Disable FIFO buffers.
                    10 - Enable FIFO buffers.
                    11 - Dynamic enabling and disabling of FIFOS.
 
              **Note, SIO forces bits 4 and 3 to "10".
 
          Bits 6 and 5       Set receive trigger level
                    00 - 1 character.
                    01 - 4 characters.
                    10 - 8 characters.
                    11 - 14 characters.
 
              **Note, SIO forces bits 6 and 5 to "10".
 
          Bit 7               Transmit load count
                    0 -  Load 1 character.
                    1 -  Load 16 characters.
 
              **Note, SIO forces bit 7 to "1".
 
          "Error Replacement Byte" Not supported by SIO.
 
          "Break Replacement Byte" Not supported by SIO
 
          "Xon Character" Any value, default is 11h.
 
          "Xoff Character" Any value, default is 13h.
 
    Data Packet - None
 
 
 
    20
 
 
                      54h - Write Extended Mode Parameters
 
    Parameter Packet
 
          ┌──────────────────────────────────────┐
          │        Item                Type    │
          ├───────────────────────────┬──────────┤
          │ Enhanced Flags1          │ BYTE    │
          ├───────────────────────────┼──────────┤
          │ Reserved                  │ DWORD    │
          └───────────────────────────┴──────────┘
 
          This function is not supported (ignored) by SIO.  However the
          bits are defined here for completeness.
 
          Enhanced Flags1
          Bit 0 -  Enhanced mode hardware available (Query only 74h).
          Bit 1 -  Enable enhanced mode.
          Bits 3 and 2        DMA Receive Operation
              00 - Disable DMA receive capability.
              01 - Enable DMA receive capability.
              10 - Dedicate a DMA channel to receive.
              11 - Reserved.
 
          Bits 5 and 4        DMA Transmit Operation
              00 - Disable DMA transmit capability.
              01 - Enable DMA transmit capability
              10 - Dedicate a DMA channel to transmit.
              11 - Reserved.
 
          Bit 6 -  Receive in DMA mode (Query only, 74h).
          Bit 7 -  Transmit in DMA mode (Query only, 74h).
 
    Data Packet - None.
 
 
 
                                                                        21
 
 
                          61h - Query Current Bit Rate
 
    Parameter Packet - None.
 
    Data Packet
 
          ┌──────────────────────────────────────┐
          │        Item                Type    │
          ├───────────────────────────┬──────────┤
          │ Bit/Baud Rate            │ WORD    │
          └───────────────────────────┴──────────┘
 
          See function 41h for more information.
 
 
                        62h - Query Line Characteristics
 
    Parameter Packet - None.
 
 
    Data Packet
 
 
          ┌──────────────────────────────────────┐
          │        Item                Type    │
          ├───────────────────────────┬──────────┤
          │ Data Bits Per Character  │ BYTE    │
          ├───────────────────────────┼──────────┤
          │ Parity Setting            │ BYTE    │
          ├───────────────────────────┼──────────┤
          │ Stop Bit Setting          │ BYTE    │
          ├───────────────────────────┼──────────┤
          │ Transmitting Break        │ BYTE    │
          └───────────────────────────┴──────────┘
 
          See function 42h for a definition of Data, Parity and Stop Bits.
 
          "Transmitting Break" is set to 1 if a break is being transmitted.
          Otherwise, it is set to zero.
 
 
 
    22
 
 
                          63h - Query Extended Bit Rate
 
    Parameter Packet - None
 
 
    Data Packet
 
          ┌──────────────────────────────────────┐
          │        Item                Type    │
          ├───────────────────────────┬──────────┤
          │ Current Bit/Baud Rate    │ DWORD    │
          ├───────────────────────────┼──────────┤
          │ Fraction of Current      │ BYTE    │
          ├───────────────────────────┼──────────┤
          │ Minimum Bit/Baud Rate    │ DWORD    │
          ├───────────────────────────┼──────────┤
          │ Fraction of Minimum      │ BYTE    │
          ├───────────────────────────┼──────────┤
          │ Maximum Bit/Baud Rate    │ DWORD    │
          ├───────────────────────────┼──────────┤
          │ Fraction of Maximum      │ BYTE    │
          └───────────────────────────┴──────────┘
 
          "Current Bit/Baud Rate" is a 32 bit integer defining the current
          bit rate.
 
          "Fraction of Current" is always 0 when returned by SIO.
 
          "Minimum Bit/Baud Rate" is the minimum value that can be passed
          to SIO as a bit/baud rate.
 
          "Fraction of Minimum" is always 0 when returned by SIO.
 
          "Maximum Bit/Baud Rate" is the maximum value that can be passed
          to SIO as a bit/baud rate.
 
          "Fraction of Maximum" is always 0 when returned by SIO.
 
 
 
                                                                        23
 
 
                            64h - Query SIO Status
 
    Parameter Packet - None
 
    Data Packet
 
          ┌──────────────────────────────────────┐
          │        Item                Type    │
          ├───────────────────────────┬──────────┤
          │ SIO Status Byte          │ BYTE    │
          └───────────────────────────┴──────────┘
 
          "SIO Status Byte" is a bit flag.  The bits have the following
          meanings:
 
          Bit 0 -  Set if SIO is waiting for CTS before transmitting.
          Bit 1 -  Set if SIO is waiting for DSR before transmitting.
          Bit 2 -  Set if SIO is waiting for DCD before transmitting.
          Bit 3 -  Set if SIO is waiting because Xoff received or
                    transmitter is disabled (see function 47h).
 
          Bit 4 -  Reserved, not used by SIO.
          Bit 5 -  Set if SIO is waiting because break is being sent.
          Bit 6 -  Set if a transmit immediate is pending.
          Bit 7 -  Reserved, not used by SIO.
 
 
 
    24
 
 
                        65h - Query Transmit Data Status
 
    Parameter Packet - None.
 
    Data Packet
 
          ┌──────────────────────────────────────┐
          │        Item                Type    │
          ├───────────────────────────┬──────────┤
          │ Transmit Status          │ BYTE    │
          └───────────────────────────┴──────────┘
 
          "SIO Status Byte" is a bit flag.  The bits have the following
          meanings:
 
          Bit 0 -  Set if write in progress or pending.
          Bit 1 -  Set if any data is in the transmit buffer.
          Bit 2 -  Set if UART is currently transmitting.
          Bit 3 -  Set if a transmit immediate is pending.
          Bit 4 -  Set if an Xon needs to be sent.
          Bit 5 -  Set if an Xoff needs to be sent.
          Bit 6 -  Reserved
          Bit 7 -  Reserved
 
 
 
                                                                        25
 
 
                66h - Query Current Modem Output Control Signals
 
 
    Parameter Packet - None.
 
    Data Packet
 
          ┌──────────────────────────────────────┐
          │        Item                Type    │
          ├───────────────────────────┬──────────┤
          │ Modem Output Signals      │ BYTE    │
          └───────────────────────────┴──────────┘
 
          "Modem Output Signals" is a bit flag.  The bits have the
          following meanings:
 
          Bit 0 -  Set if DTR is currently on.
          Bit 1 -  Set if RTS is currently on.
          Bits 2-7  Reserved, set to zero by SIO.
 
 
                    67h - Query Current Modem Input Signals
 
    Parameter Packet - None.
 
    Data Packet
 
          ┌──────────────────────────────────────┐
          │        Item                Type    │
          ├───────────────────────────┬──────────┤
          │ Modem Input Signals      │ BYTE    │
          └───────────────────────────┴──────────┘
 
          "Modem Output Signals" is a bit flag.  The bits have the
          following meanings:
 
          Bits 0-3  Reserved, set to zero by SIO.
          Bit 4 -  Clear To Send (CTS) is active.
          Bit 5 -  Data Set Ready (DSR) is active.
          Bit 6 -  Ring Indicator (RI), trailing edge detected.
          Bit 7 -  Data Carrier Detect (DCD) is active.
 
 
 
    26
 
 
              68h - Query Number of Characters in Receive Buffer
 
    Parameter Packet - None.
 
    Data Packet
 
          ┌──────────────────────────────────────┐
          │        Item                Type    │
          ├───────────────────────────┬──────────┤
          │ Number of Bytes Buffered  │ WORD    │
          ├───────────────────────────┼──────────┤
          │ Byte Size of the Buffer  │ WORD    │
          └───────────────────────────┴──────────┘
 
          Self explaining.
 
 
              69h - Query Number of Characters in Transmit Buffer
 
    Parameter Packet - None.
 
    Data Packet
 
          ┌──────────────────────────────────────┐
          │        Item                Type    │
          ├───────────────────────────┬──────────┤
          │ Number of Bytes Buffered  │ WORD    │
          ├───────────────────────────┼──────────┤
          │ Byte Size of the Buffer  │ WORD    │
          └───────────────────────────┴──────────┘
 
          Self explaining.
 
 
 
                                                                        27
 
 
                              6Dh - Query SIO Error
 
 
    Parameter Packet - None.
 
    Data Packet
 
          ┌──────────────────────────────────────┐
          │        Item                Type    │
          ├───────────────────────────┬──────────┤
          │ SIO Error Word            │ WORD    │
          └───────────────────────────┴──────────┘
 
          "SIO Error Word" is a bit flag.  The bits have the following
          meaning:
 
          Bit 0 -  Set if a buffer overrun has occurred.
          Bit 1 -  Set if an overrun occurred at the UART.
          Bit 2 -  Set if the UART detected a parity error.
          Bit 3 -  Set if the UART detected a framing error.
          Bits 4-15 Reserved, set to zero by SIO.
 
          All bits of the SIO Error Word are reset prior to returning to
          the caller.
 
 
 
    28
 
 
                        72h - Query SIO Event Information
 
    Parameter Packet - None.
 
    Data Packet
 
          ┌──────────────────────────────────────┐
          │        Item                Type    │
          ├───────────────────────────┬──────────┤
          │ SIO Event Word            │ WORD    │
          └───────────────────────────┴──────────┘
 
          "SIO Event Word" is a bit flag.  The bits have the following
          meaning:
 
          Bit 0 -  Set when a receive character is transferred from the
                    UART to the receive buffer.
          Bit 1 -  Set when a receive (Read) timeout occurs.
          Bit 2 -  Set if the transmit buffer is empty.
          Bit 3 -  Set if Clear To Send (CTS) has changed state.
          Bit 4 -  Set if Data Set Ready (DSR) has changed state.
          Bit 5 -  Set if Data Carrier Detect (DCD) has changed state.
          Bit 6 -  Set if a break has been detected.
          Bit 7 -  Set if a framing, parity, or overrun error has
                    occurred.
          Bit 8 -  Set if trailing edge of Ring Indicator (RI) has
                    occurred.
          Bits 9-15 Reserved, set to zero by SIO.
 
          All bits are reset prior to returning to the caller.
 
 
 
                                                                        29
 
 
                      73h - Read Device Control Block (DCB)
 
    Parameter Packet - None.
 
 
    Data Packet
 
          ┌──────────────────────────────────────┐
          │        Item                Type    │
          ├───────────────────────────┬──────────┤
          │ Write Timeout            │ WORD    │
          ├───────────────────────────┼──────────┤
          │ Read Timeout              │ WORD    │
          ├───────────────────────────┼──────────┤
          │ Flags1                    │ BYTE    │
          ├───────────────────────────┼──────────┤
          │ Flags2                    │ BYTE    │
          ├───────────────────────────┼──────────┤
          │ Flags3                    │ BYTE    │
          ├───────────────────────────┼──────────┤
          │ Error Replacement Byte    │ BYTE    │
          ├───────────────────────────┼──────────┤
          │ Break Replacement Byte    │ BYTE    │
          ├───────────────────────────┼──────────┤
          │ Xon Character            │ BYTE    │
          ├───────────────────────────┼──────────┤
          │ Xoff Character            │ BYTE    │
          └───────────────────────────┴──────────┘
 
          See function 53h for a description of the parameters.
 
 
                      74h - Read Enhanced Mode Parameters
 
    Parameter Packet - None.
 
    Data Packet
 
          ┌──────────────────────────────────────┐
          │        Item                Type    │
          ├───────────────────────────┬──────────┤
          │ Enhanced Flags1          │ BYTE    │
          ├───────────────────────────┼──────────┤
          │ Reserved                  │ DWORD    │
          └───────────────────────────┴──────────┘
 
          See function 54h for a description of the Flags1 Byte.
 
 
 
    30
 
                    Differences between SIO/VSIO and COM/VCOM
    What follows is some of the differences between SIO/VSIO and COM/VCOM
    that are known to the author.
 
    1 -  COM.SYS will automatically seek out and support four comm
          ports, COM1 through COM4.  SIO.SYS will automatically seek
          out and support only COM1 and COM2.  If SIO.SYS is to
          support more than two comm ports, they must be defined in
          the command line that loads SIO.SYS.  For example,
          DEVICE=SIO.SYS (COM3) (COM4) will cause SIO.SYS to support
          four comm ports.
 
    2 -  In the absence of overrides in the command line, COM.SYS
          will seek out four comm ports in the sequence of I/O ports
          3F8h, 2F8h, 3E8h and 2E8h.  The first port found in this
          sequence is given the logical name COM1, the second is COM2
          etc.  This means that the comm port at 2F8h could become
          COM1.  In the opinion of the author, this confuses some
          users to frustration.
 
          With no command line overrides, SIO.SYS uses a fixed I/O
          port concept.  That is, COM1 is always at I/O port 3F8h,
          COM2 is always at 2F8h, etc.  Another way of looking at this
          is;  if no comm port exists at port 3F8h, then you do not
          have a COM1.  SIO.SYS will not move another (found) comm
          port into the logical COM1 slot.
 
    3 -  VSIO opens a comm port for a DOS session with sharing allowed.
          VCOM uses an "exclusive use" open for DOS sessions.
 
    4 -  SIO.SYS will accept any number from 50 up as a valid baud rate.
          For example, if an application program attempts to set a baud
          rate of 9990 bps, COM.SYS will reject it and SIO.SYS will accept
          it.
 
    5 -  SIO/VSIO execute faster than COM/VCOM.  This means that some
          applications, that are timing dependent, may not work under
          SIO/VSIO that do work under COM/VCOM.
 
    6 -  SIO/VSIO provides more reliable active flow control for DOS
          sessions.  For example, if RTS/CTS handshaking is in use, VSIO
          virtualizes the RTS settings by the DOS program while SIO
          completely controls the real RTS signal.  COM/VCOM simply passes
          the RTS signal directly to the hardware.
 
    7 -  COM.SYS will block an application until a write completes.  SIO
          will return to the application program immediately if all of the
          write data will fit into SIO's internal buffers.
 
 
 
                                                                        31
 
                  Appendix A, Hardware Port and IRQ Assignments
 
    I have obtained the following information from various sources.
    Accuracy is not guaranteed.  In fact, nothing in this document is
    guaranteed.
 
    Addresses and IRQs for COM1 and COM2
 
          COM1 uses 03F8h and IRQ4
          COM2 uses 02F8h and IRQ3
 
    Defacto standard for COM3 and COM4 for PC, XT and AT
 
          COM3 uses 03E8h and IRQ4
          COM4 uses 02E8h and IRQ3
 
    Addresses and IRQ for COM3 through COM8 on the PS/2
 
          COM3 uses 3220h and IRQ3
          COM4 uses 3228h and IRQ3
          COM5 uses 4220h and IRQ3
          COM6 uses 4228h and IRQ3
          COM7 uses 5220h and IRQ3
          COM8 uses 5228h and IRQ3
 
    All PCs (known to the author) prior to the PS/2 and EISA only use 10
    bits to address hardware I/0 ports.  Systems prior to the PS/2 and
    EISA can not address the standard PS/2 addresses for COM3 through
    COM8.  If an AT or below attempts to address COM3 through COM8 using
    the PS/2 addresses, only the low 10 bits of the address are used.
    That is, the high 6 bits of the address will be ignored by the
    hardware.  This means that any reference to COM3 through COM8 will
    actually address ports 220h through 22Fh on older PCs.
 
    One should avoid expansion boards that use ports 220h through 22Fh
    unless the expansion board is a serial I/O board.
 
    SIO will (attempt to) determine the hardware architecture (ISA/EISA
    and PS/2) that it is being executed on and use the appropriate
    hardware port addresses for COM1 thru COM4 as defaults.
 
 
 
    32
 
                              Appendix B, SIO Chips
 
 
    The following is a collection of comments developed from hearsay,
    random documents, experience, and technical specifications. So, take
    it with a grain of salt.  Order information from the various
    manufactures if you want accurate information.
 
    Very good reference books are available from National Semiconductor
    Corporation.  They cover most of the SIO devices (also called UARTs)
    that you will find in many PCs and clones.  I am not sure that books
    can be ordered directly from National Semiconductor. They may require
    that you get it from a distributor.  In any case, the address on the
    back of the one manual is:
 
          National Semiconductor Corporation
          2900 Semiconductor Drive
          P.O. Box 58090
          Santa Clara, CA 95052-8090
 
          Tel:(408)721-5000
          TWX:(910)339-9240
 
    8250
 
    As best I known, the 8250 was the first SIO chip (integrated circuit)
    that was used by the IBM PC and many clones.  In my opinion, it was a
    poor choice on the part of IBM.  I feel many superior devices, at
    comparable prices, were readily available.  At that time, I feel the
    8251A or the 8530 would have been better choices.  But, they used the
    8250 and therefore we must use it.
 
    From a hardware standpoint the 8250 is a relatively slow device.  It
    is advisable that programmers not perform successive inputs or outputs
    to this device.  It seems that software programs can load the various
    registers of the 8250 faster than it can process the information.  The
    8250 had a total of 7 registers.  The specifications state that 56kb
    is the maximum baud rate.
 
    8250A
 
    I believe the 8250A is the 8250 with some bug fixes.  I have no idea
    what the bugs may have been.  A quick glance at the specifications
    shows the speed of the 8250 and 8250A to be much the same.  The 8250A
    added an 8th register.  This additional register enables software to
    detect if an 8250 is installed.  The specifications state that 56kb is
    the maximum baud rate.
 
 
 
                                                                        33
 
    16450
 
    The 16450 seems to be a speeded up version of the 8250A.  There is no
    direct way (that I know of) for software to detect the difference
    between an 8250A and a 16450.  I believe the 16450 was developed to
    eliminate the need for software to insert delays between successive
    accesses to the device.  The specifications indicate the 16450 is a
    much faster device than its predecessors.  The additional speed is
    only the speed at which the processor can access the device.  The
    maximum baud rate for the 16450 is still stated at 56kb.  However, I
    have been told by some people that they have run the 16450
    successfully at much higher speeds. I do not believe there was ever a
    16450A.
 
    16C451
 
    The 16C451 is a CMOS version of the 16450.  CMOS is a term for the
    material and manufacturing process used to make the part.  CMOS
    typically uses less power than other technologies.  If you are not
    designing hardware, you should view the 16C451 as a 16450.
 
    16550 (Non A)
 
    It is hard to find a 16550 (Non A).  I was told by National
    Semiconductor that they did everything they could to get all 16550s
    back.  SIO will detect a 16550 and tell you if you have one.  I am
    told that the 16550 was installed in early PS/2 systems.
 
    The 16550 was the first shot at a FIFOed version of the 8250 family
    from National semiconductor.  However, I was told by National
    Semiconductor that the FIFOs of the 16550 are not reliable and they
    should not be enabled.  SIO will treat a 16550 like a 16450.  In this
    mode, they are reliable.  National Semiconductor would not provide me
    with a specification for the 16550.  However, I suspect its maximum
    baud rate is the same as the 16550A which is 256kb.
 
    16550A, 16550AF and 16550AFN


    In the manuals that I have, National Semiconductor does not explain
"Error Replacement Byte" Not supported by SIO.
    the differences between the 16550A and the 16550AF.  I suspect the AF
    part may have a few bug fixes.  I believe the N in AFN describes
    packaging, ceramic versus plastic, DIP versus surface mount etc.


    In the opinion of the author, there is no substitute for the 16550A
"Break Replacement Byte" Not supported by SIO
    (and its successors) in the 8250 type series.  The 16550A is
    compatible with most software written for the entire family of 8250
    type devices.  Programs that are 16550A aware can provide much
    improved performance over previous devices.


"Xon Character" Any value, default is 11h.


    The maximum baud rate for the 16550A is specified at 256kb.  However,
"Xoff Character" Any value, default is 13h.
    due to the hardware design of the PC et al, 115kb is the maximum baud
    rate that can be programmed by software.


    The 16550A can be plugged into the same socket that contains an 8250,
Data Packet - None


===54h - Write Extended Mode Parameters===
Parameter Packet
┌──────────────────────────────────────┐
│        Item                Type    │
├───────────────────────────┬──────────┤
│ Enhanced Flags1          │ BYTE    │
├───────────────────────────┼──────────┤
│ Reserved                  │ DWORD    │
└───────────────────────────┴──────────┘
This function is not supported (ignored) by SIO. However the bits are defined here for completeness.


Enhanced Flags1
:Bit 0 -  Enhanced mode hardware available (Query only 74h).
:Bit 1 -  Enable enhanced mode.
:Bits 3 and 2        DMA Receive Operation
::00 - Disable DMA receive capability.
::01 - Enable DMA receive capability.
::10 - Dedicate a DMA channel to receive.
::11 - Reserved.
:Bits 5 and 4        DMA Transmit Operation
::00 - Disable DMA transmit capability.
::01 - Enable DMA transmit capability
::10 - Dedicate a DMA channel to transmit.
::11 - Reserved.
:Bit 6 -  Receive in DMA mode (Query only, 74h).
:Bit 7 -  Transmit in DMA mode (Query only, 74h).


    34
Data Packet - None.


    8250A or 16450.  If your SIO expansion board has the SIO chips in
===61h - Query Current Bit Rate===
    sockets, you can upgrade to the 16550A by simply removing the old
Parameter Packet - None.
    chips and replacing them with 16550As.


    The key to the performance increase of the 16550A is its FIFOs. It
Data Packet
    has 16 byte FIFOs for both transmit and receive data.
┌──────────────────────────────────────┐
│        Item                Type    │
├───────────────────────────┬──────────┤
│ Bit/Baud Rate            │ WORD    │
  └───────────────────────────┴──────────┘
See function 41h for more information.


    16550s Made by Western Digital
62h - Query Line Characteristics


    I have been told, but I have not verified for myself, that 16550s made
Parameter Packet - None.
    by Western Digital have a problem with their FIFOs when working at
    2400 baud or below.


    16C551
Data Packet
┌──────────────────────────────────────┐
│        Item                Type    │
├───────────────────────────┬──────────┤
│ Data Bits Per Character  │ BYTE    │
├───────────────────────────┼──────────┤
│ Parity Setting            │ BYTE    │
├───────────────────────────┼──────────┤
│ Stop Bit Setting          │ BYTE    │
├───────────────────────────┼──────────┤
│ Transmitting Break        │ BYTE    │
└───────────────────────────┴──────────┘
See function 42h for a definition of Data, Parity and Stop Bits.


    The 16C551 is a CMOS version of the 16550AF. See the above
"Transmitting Break" is set to 1 if a break is being transmitted.  
    description of the 16C451 for a discussion of CMOS.  Do not feel you
Otherwise, it is set to zero.
    need to upgrade from a 16550A or AF to a 16C551.  There is no gain
    from an existing users point of view.


    16C552
===63h - Query Extended Bit Rate===
Parameter Packet - None


    The 16C552 is two 16C551s on a single chip.
Data Packet
┌──────────────────────────────────────┐
│        Item                Type    │
├───────────────────────────┬──────────┤
│ Current Bit/Baud Rate    │ DWORD    │
├───────────────────────────┼──────────┤
│ Fraction of Current      │ BYTE    │
├───────────────────────────┼──────────┤
│ Minimum Bit/Baud Rate    │ DWORD    │
├───────────────────────────┼──────────┤
│ Fraction of Minimum      │ BYTE    │
├───────────────────────────┼──────────┤
│ Maximum Bit/Baud Rate    │ DWORD    │
├───────────────────────────┼──────────┤
│ Fraction of Maximum      │ BYTE    │
└───────────────────────────┴──────────┘
"Current Bit/Baud Rate" is a 32 bit integer defining the current bit rate.


    16C554
"Fraction of Current" is always 0 when returned by SIO.


    The 16C554 is four 16C551s on a single chip.
"Minimum Bit/Baud Rate" is the minimum value that can be passed to SIO as a bit/baud rate.


    82510
"Fraction of Minimum" is always 0 when returned by SIO.


    I believe Intel is the only company that manufactures the 82510.  The
"Maximum Bit/Baud Rate" is the maximum value that can be passed to SIO as a bit/baud rate.
    82510 is feature rich with several modes of operation.  Its default
    mode is to operate as a 16450.  The 82510 has a 4 byte FIFO for both
    transmit and receive data.  A 4 byte FIFO is sufficient to provide
    significant performance over a basic 16450.


    The 82510 is small in size.  Therefore, it is found in many lap tops.
"Fraction of Maximum" is always 0 when returned by SIO.


    The 82510 is somewhat of a sleeper.  I believe it would be much more
===64h - Query SIO Status===
    widely used if Intel had promoted it more.  However, given a choice
Parameter Packet - None
    between the 82510 and the 16550A, I would select the 16550A.


Data Packet
┌──────────────────────────────────────┐
│        Item                Type    │
├───────────────────────────┬──────────┤
│ SIO Status Byte          │ BYTE    │
└───────────────────────────┴──────────┘
"SIO Status Byte" is a bit flag. The bits have the following meanings:
:Bit 0 -  Set if SIO is waiting for CTS before transmitting.
:Bit 1 -  Set if SIO is waiting for DSR before transmitting.
:Bit 2 -  Set if SIO is waiting for DCD before transmitting.
:Bit 3 -  Set if SIO is waiting because Xoff received or transmitter is disabled (see function 47h).
:Bit 4 -  Reserved, not used by SIO.
:Bit 5 -  Set if SIO is waiting because break is being sent.
:Bit 6 -  Set if a transmit immediate is pending.
:Bit 7 -  Reserved, not used by SIO.


===65h - Query Transmit Data Status===
Parameter Packet - None.


                                                                        35
Data Packet
┌──────────────────────────────────────┐
│        Item                Type    │
├───────────────────────────┬──────────┤
│ Transmit Status          │ BYTE    │
└───────────────────────────┴──────────┘
"SIO Status Byte" is a bit flag. The bits have the following meanings:
:Bit 0 -  Set if write in progress or pending.
:Bit 1 -  Set if any data is in the transmit buffer.
:Bit 2 -  Set if UART is currently transmitting.
:Bit 3 -  Set if a transmit immediate is pending.
:Bit 4 -  Set if an Xon needs to be sent.
:Bit 5 -  Set if an Xoff needs to be sent.
:Bit 6 -  Reserved
:Bit 7 -  Reserved


===66h - Query Current Modem Output Control Signals===
Parameter Packet - None.


     16650
Data Packet
┌──────────────────────────────────────┐
│        Item                Type    │
├───────────────────────────┬──────────┤
│ Modem Output Signals     │ BYTE    │
└───────────────────────────┴──────────┘
"Modem Output Signals" is a bit flag. The bits have the following meanings:
:Bit 0 -  Set if DTR is currently on.
:Bit 1 -  Set if RTS is currently on.
:Bits 2-7  Reserved, set to zero by SIO.


    The 16650 by Startech seems a good logical step in the evolution of
===67h - Query Current Modem Input Signals===
    the 8250 type UARTs.  One of the many flavors of the 16650 is a
Parameter Packet - None.
    package that is pin compatible with the 40 pin (DIP) 16550s.  This
    means that the 16650 can be placed into the same socket as any 16550,
    8250, etc.


    The 16650 has enhanced the FIFOs to 32 bytes, added on chip flow
Data Packet
    control ability, and increases the maximum bit rate to 460800. The on
┌──────────────────────────────────────┐
    chip flow control is a really nice feature. On chip flow control
│        Item                Type    │
    practically eliminates the possibility of missed receive characters.  
├───────────────────────────┬──────────┤
    On chip flow control also means that some devices that require
│ Modem Input Signals      │ BYTE    │
    immediate attention when it sends Xoff, like the Seiko Label Printer,
└───────────────────────────┴──────────┘
    will work much better in environments like OS/2 and Windows.
"Modem Output Signals" is a bit flag.  The bits have the following meanings:
:Bits 0-3  Reserved, set to zero by SIO.
:Bit 4 -  Clear To Send (CTS) is active.
:Bit 5 -  Data Set Ready (DSR) is active.
:Bit 6 -  Ring Indicator (RI), trailing edge detected.
:Bit 7 -  Data Carrier Detect (DCD) is active.


    The 32 byte FIFOs of the 16650 is an improvement over the 16550, but
===68h - Query Number of Characters in Receive Buffer===
    is still a disappointment.  I feel that 1k, or larger, FIFOs would
Parameter Packet - None.
    have been a much better choice.  When I quizzed Startech about this,
    they replied that the 32 byte FIFOs were chosen to keep the cost down.
    They added that if the 16650 is successful, they plan a 16750 with
    larger FIFOs.


    The 16650 powers up in a 16550 compatible mode, meaning most software
Data Packet
    written for the 16550 should work. I have discovered a serious
  ┌──────────────────────────────────────┐
    incompatibility in the current (Oct 1994) versions of the 16650. All
  │        Item                Type    │
    previous UARTS in the 8250 family will issue only a single transmit
├───────────────────────────┬──────────┤
    interrupt if no additional data is sent to the UART. The 16650 on the
  │ Number of Bytes Buffered  │ WORD    │
    other hand, will issue continuous transmit interrupts making it
├───────────────────────────┼──────────┤
    necessary to mask the transmit interrupt. I quizzed Startech about
  │ Byte Size of the Buffer  │ WORD    │
    this and was told that a new revision of the chip would be available
└───────────────────────────┴──────────┘
    within a few months that would correct this incompatibility.
Self explaining.


    16750 from Texas Instruments
===69h - Query Number of Characters in Transmit Buffer===
Parameter Packet - None.


    The 16750 from TI is an improvement over the 16550, but the omission
Data Packet
    of software flow control (Xon/Xoff) makes it inferior to the 16650, in
┌──────────────────────────────────────┐
    the opinion of the author. The 16750 has a 64 byte fifo and hardware
│        Item                Type    │
    flow control. It is a good choice for a uart.
├───────────────────────────┬──────────┤
│ Number of Bytes Buffered  │ WORD    │
├───────────────────────────┼──────────┤
│ Byte Size of the Buffer  │ WORD    │
  └───────────────────────────┴──────────┘
Self explaining.


===6Dh - Query SIO Error===
Parameter Packet - None.


Data Packet
┌──────────────────────────────────────┐
│        Item                Type    │
├───────────────────────────┬──────────┤
│ SIO Error Word            │ WORD    │
└───────────────────────────┴──────────┘
"SIO Error Word" is a bit flag.  The bits have the following meaning:
:Bit 0 -  Set if a buffer overrun has occurred.
:Bit 1 -  Set if an overrun occurred at the UART.
:Bit 2 -  Set if the UART detected a parity error.
:Bit 3 -  Set if the UART detected a framing error.
:Bits 4-15 Reserved, set to zero by SIO.
All bits of the SIO Error Word are reset prior to returning to the caller.


    36
===72h - Query SIO Event Information===
Parameter Packet - None.


Data Packet
┌──────────────────────────────────────┐
│        Item                Type    │
├───────────────────────────┬──────────┤
│ SIO Event Word            │ WORD    │
└───────────────────────────┴──────────┘
"SIO Event Word" is a bit flag. The bits have the following meaning:
:Bit 0 - Set when a receive character is transferred from the UART to the receive buffer.
:Bit 1 - Set when a receive (Read) timeout occurs.
:Bit 2 - Set if the transmit buffer is empty.
:Bit 3 - Set if Clear To Send (CTS) has changed state.
:Bit 4 - Set if Data Set Ready (DSR) has changed state.
:Bit 5 - Set if Data Carrier Detect (DCD) has changed state.
:Bit 6 - Set if a break has been detected.
:Bit 7 - Set if a framing, parity, or overrun error has occurred.
:Bit 8 - Set if trailing edge of Ring Indicator (RI) has occurred.
:Bits 9-15 Reserved, set to zero by SIO.


    ComBic
All bits are reset prior to returning to the caller.


    The ComBic is a very impressive UART used on the Hayes ESP card and
===73h - Read Device Control Block (DCB)===
    some others.  The ComBic is basically a 16550 UART with on chip flow
Parameter Packet - None.
    control and 1k FIFOs and a maximum bit rate of 921600.  Like the
    16650, on chip flow control practically eliminates the possibility of
    missed receive characters.  On chip flow control also means that some
    devices that require immediate attention when it sends Xoff, like the
    Seiko Label Printer, will work much better in environments like OS/2
    and Windows.


    The ComBic has two modes of operation, compatibility mode and enhanced
Data Packet
    mode. In compatibility mode, the UART acts as a 16550. However, when
┌──────────────────────────────────────┐
    in compatibility mode, the 1k FIFOs and on chip flow control can still
│        Item                Type    │
    be used. In enhanced mode, software gains the ability to look into
├───────────────────────────┬──────────┤
    the FIFOs and determine the exact number of bytes loaded. This
│ Write Timeout            │ WORD    │
    feature enables software the use block input and output to the ComBic
├───────────────────────────┼──────────┤
    which greatly reduces processor overhead.
│ Read Timeout              │ WORD    │
├───────────────────────────┼──────────┤
│ Flags1                    │ BYTE    │
├───────────────────────────┼──────────┤
│ Flags2                    │ BYTE    │
├───────────────────────────┼──────────┤
│ Flags3                    │ BYTE    │
├───────────────────────────┼──────────┤
│ Error Replacement Byte    │ BYTE    │
├───────────────────────────┼──────────┤
│ Break Replacement Byte    │ BYTE    │
  ├───────────────────────────┼──────────┤
  │ Xon Character            │ BYTE    │
├───────────────────────────┼──────────┤
  │ Xoff Character            │ BYTE    │
  └───────────────────────────┴──────────┘
See function 53h for a description of the parameters.


===74h - Read Enhanced Mode Parameters===
Parameter Packet - None.


Data Packet
┌──────────────────────────────────────┐
│        Item                Type    │
├───────────────────────────┬──────────┤
│ Enhanced Flags1          │ BYTE    │
├───────────────────────────┼──────────┤
│ Reserved                  │ DWORD    │
└───────────────────────────┴──────────┘
See function 54h for a description of the Flags1 Byte.


                                                                        37
==Differences between SIO/VSIO and COM/VCOM==
What follows is some of the differences between SIO/VSIO and COM/VCOM that are known to the author.


1 -  COM.SYS will automatically seek out and support four comm
ports, COM1 through COM4.  SIO.SYS will automatically seek
out and support only COM1 and COM2.  If SIO.SYS is to
support more than two comm ports, they must be defined in
the command line that loads SIO.SYS.  For example,
DEVICE=SIO.SYS (COM3) (COM4) will cause SIO.SYS to support
four comm ports.


                    Appendix C, Multi-Port Serial I/0 Cards
2 -  In the absence of overrides in the command line, COM.SYS
will seek out four comm ports in the sequence of I/O ports
3F8h, 2F8h, 3E8h and 2E8h.  The first port found in this
sequence is given the logical name COM1, the second is COM2
etc.  This means that the comm port at 2F8h could become
COM1.  In the opinion of the author, this confuses some
users to frustration.


    I have received many requests for information about multi-port serial
With no command line overrides, SIO.SYS uses a fixed I/O
    I/O cardI will describe the boards that I know about (or have heard
port concept.  That is, COM1 is always at I/O port 3F8h,
    about) hereI will add to the list as I receive precise information
COM2 is always at 2F8h, etcAnother way of looking at this
    from manufactures, users, or I develop it myself.
is;  if no comm port exists at port 3F8h, then you do not
have a COM1SIO.SYS will not move another (found) comm
port into the logical COM1 slot.


    Hayes ESP
3 -  VSIO opens a comm port for a DOS session with sharing allowed.
VCOM uses an "exclusive use" open for DOS sessions.


    The original ESP (ESP V1) is not supported. The SIO command line must
4 - SIO.SYS always controls the FIFOs of the 16550 UART.  SIO.SYS
    contain the ESP's enhanced I/O port address. For bit rates exceeding
will not allow an application program (OS2 or DOS) to disable the
    180000bps the IRQ MUST be specified for the master port. For lower
FIFOs of a real 16550.  The application may specify the transmit
    data rates NONE may be specified for the IRQ.  SIO does not search for
fifo load count.
    the ESP ports as the Hayes drivers do under DOS/Windows. This
    searching can (will) break things under OS/2.  The SIO command line
    for an ESP at I/O port 180h using IRQ14 would be as follows:


    DEVICE=path\SIO.SYS (COM1,180,IRQ14) (COM2,188,NONE)
5 -  SIO.SYS will accept any number between 50 and 115200 (921600 if a
Hayes ESP) as a valid baud rate.  For example, if an application
program attempts to set a baud rate of 9990 bps, COM.SYS will
reject it and SIO.SYS will accept it.


    If you would like the above reflected to DOS sessions as a standard
6 -  SIO/VSIO execute faster than COM/VCOM.  This means that some
    COM1 and COM2, then use the following command line:
applications, that are timing dependent, may not work under
SIO/VSIO that do work under COM/VCOM.


    DEVICE=path\SIO.SYS (COM1,180:3F8,IRQ14:IRQ4) (COM2,188:2F8,NONE:IRQ3)
7 -  SIO/VSIO provides more reliable active flow control for DOS
sessions. For example, if RTS/CTS handshaking is in use, VSIO
processes the RTS settings by the DOS program while SIO
completely controls the real RTS signal.  COM/VCOM simply passes
the RTS signal directly to the hardware.


    Note that the numbers after the colons ":" are the address and IRQ of
8 -  COM.SYS will block an application until a write completesSIO
    where the port appears to DOS software running under OS/2.
will return to the application program immediately if all of the
    Any IRQ specified for an ESP slave port is ignoredFor those that
write data will fit into SIO's internal buffers.
    like to have a clean looking CONFIG.SYS, SIO will accept NONE as the
    IRQ specification of an ESP slave port.


    If you wish to use the ESP in Compatibility Mode, simply specify the
==Appendix A, Hardware Port and IRQ Assignments==
    base port address that the ESP's compatibility mode is configured for
I have obtained the following information from various sources. Accuracy is not guaranteed. In fact, nothing in this document is guaranteed.
    (ie 3F8 when configured for COM1).


    Telcor Tport
Addresses and IRQs for COM1 and COM2
COM1 uses 03F8h and IRQ4
COM2 uses 02F8h and IRQ3


    The Telcor Tport is supported in both burst mode and 16450 emulation
Defacto standard for COM3 and COM4 for PC, XT and AT
    mode.  When in burst mode, the Tport's 16k FIFOs are enabled.
  COM3 uses 03E8h and IRQ4
    Additionally in burst mode, no IRQ is used by the Tport. In burst
  COM4 uses 02E8h and IRQ3
    mode, any IRQ specified for the Tport is ignored.  For those that like
    to have a clean looking CONFIG.SYS, SIO will accept NONE as the IRQ
    specification of a Tport. An example command line defining a Tport
    card to be used in burst mode; and that is configured for COM1
    follows:


    DEVICE=path\SIO.SYS (COM1,Tport@3F8,NONE:IRQ4)
Addresses and IRQ for COM3 through COM8 on the PS/2
:COM3 uses 3220h and IRQ3
:COM4 uses 3228h and IRQ3
:COM5 uses 4220h and IRQ3
:COM6 uses 4228h and IRQ3
:COM7 uses 5220h and IRQ3
:COM8 uses 5228h and IRQ3


    The Tport's 16450 Emulation mode simply uses a normal SIO command
All PCs (known to the author) prior to the PS/2 and EISA only use 10
    line. eg:
bits to address hardware I/0 ports.  Systems prior to the PS/2 and
EISA can not address the standard PS/2 addresses for COM3 through
COM8.  If an AT or below attempts to address COM3 through COM8 using
the PS/2 addresses, only the low 10 bits of the address are used.
That is, the high digit of the hexadecimal address will be ignored.
This means that any reference to COM3 through COM8 will actually
address ports 220h through 22Fh on older PCs.


    DEVICE=path\SIO.SYS (COM1,3F8,IRQ4:IRQ4)
One should avoid expansion boards that use ports 220h through 22Fh
unless the expansion board is a serial I/O board.  


    In both examples the "IRQ4" following the colon above, means that the
SIO will (attempt to) determine the hardware architecture (ISA/EISA
    virtual IRQs are to be sent to a VDM on IRQ4.
and PS/2) that it is being executed on and use the appropriate
hardware port addresses for COM1 thru COM4 as defaults.


==Appendix B, SIO Chips==
The following is a collection of comments developed from hearsay,
random documents, experience, and technical specifications. So, take
it with a grain of salt.  Order information from the various
manufactures if you want accurate information.


Very good reference books are available from National Semiconductor
Corporation.  They cover most of the SIO devices (also called UARTs)
that you will find in many PCs and clones.  I am not sure that books
can be ordered directly from National semiconductor. They may require
that you get it from a distributor.  In any case, the address on the
back of the one manual is:


    38
:;National Semiconductor Corporation
:2900 Semiconductor Drive
:P.O. Box 58090
:Santa Clara, CA 95052-8090


    STB 4COM  (ISA bus)
:Tel:(408)721-5000
:TWX:(910)339-9240


    I am very impressed with the STB 4COM card, they have almost got it.
===8250===
    Yes, it's the same company that makes the VGA cardsThe 4COM card
As best that I know, the 8250 was the first SIO chip (integrated
    uses a 16554 which is the equivalent of four 16550AComm ports can
circuit) that was used by the IBM PC and many clonesIn my opinion,
    use IRQs 2/9, 3, 4, 5, 10, 11, 12, and 15Any or all ports can share
it was a poor choice on the part of IBMI feel many superior
    IRQs, and they have done this rightI tested SIO with all four ports
devices, at comparable prices, were readily availableAt that time,
    of the 4COM on IRQ12 and they worked correctly.  The user can select
I feel the 8251A or the 8530 would have been better choicesBut,
    any of the following I/O port address for a comm port: 3F8, 2F8, 3E8,
they used the 8250 and therefore we must use it.
    2E8, 1A8, 1E8, 1F8, 2A8.


    The 4COM card is priced at $110 and I ordered mine from Prerapture
From a hardware standpoint the 8250 is a relatively slow device.  It
    Solutions which can be reached by telephone at 1-919-286-1502 for
is advisable that programmers not perform successive inputs or outputs
    information and foreign callersIn the US orders can be placed by
to this device.  It seems that software programs can load the various
    calling 1-800-735-5266Their mailing address is:
registers of the 8250 faster than it can process the information.  The
          Prerapture Solutions
8250 had a total of 7 registersThe specifications state that 56kb
          1806 Albany St.
is the maximum baud rate.
          Durham NC 27705-3135


    Gtek BBS550 (ISA bus)
===8250A===
I believe the 8250A is the 8250 with some bug fixes.  I have no idea
what the bugs may have been.  A quick glance at the specifications
shows the speed of the 8250 and 8250A to be much the same.  The 8250A
added an 8th register.  This additional register enables software to
detect if an 8250 is installed.  The specifications state that 56kb is
the maximum baud rate.


    The Gtek BBS550 is a communications card with the equivalent of 8
===16450===
    16550s (in reality two 16554s) UARTS. Where were these cards 5 years
The 16450 seems to be a speeded up version of the 8250A. There is no direct way (that I know of) for software to detect the difference between an 8250A and a 16450. I believe the 16450 was developed to eliminate the need for software to insert delays between successive accesses to the device. The specifications indicate the 16450 is a much faster device than its predecessors. The additional speed is only the speed at which the processor can access the device. The maximum baud rate for the 16450 is still stated at 56kb. However, I have been told by some people that they have run the 16450 successfully at much higher speeds. I do not believe there was ever a 16450A.
    ago!  Like the STB 4COM, I am very impressed with the BBS550. It has
    a wide range of selectable I/O port address, some in the 16 bit range
    (above 3FFh) which can be very useful. I tested the board with all 8
    ports installed using IRQ3 (although I never had more than 3 ports
    active at the same time). The board performed well using shared IRQs.


    The BBS550 has 8 RJ-45 connectors (10 pin), 6 of which comes directly
===16C451===
    off the back of the cardThe other two RJ-45 connectors are internal
The 16C451 is a CMOS version of the 16450.  CMOS is a term for the
    and special cables with grommets are supplier for these 2 portsThe
material and manufacturing process used to make the partCMOS
    cables supplied with the BBS550 expands the RJ-45 out to standard DB-
typically uses less power than other technologiesIf you are not
    25 connectors.
designing hardware, you should view the 16C451 as a 16450.


    Gtek is located in St. Louis MississippiTheir phone number is 800-
===16550 (Non A)===
    282-4835 or 601-467-8048.
It is hard to find a 16550 (Non A).  I was told by National
Semiconductor that they did everything they could to get all 16550s
back. SIO will detect a 16550 and tell you if you have oneI am
told that the 16550 was installed in early PS/2 systems.


The 16550 was the first shot at a FIFOed version of the 8250 family
from National semiconductor.  However, I was told by National
Semiconductor that the FIFOs of the 16550 are not reliable and they
should not be enabled.  SIO will treat a 16550 like a 16450.  In this
mode, they are reliable.  National Semiconductor would not provide me
with a specification for the 16550.  However, I suspect its maximum
baud rate is the same as the 16550A which is 256kb.


===16550A, 16550AF and 16550AFN===
In the manuals that I have, National Semiconductor does not explain
the differences between the 16550A and the 16550AF.  I suspect the AF
part may have a few bug fixes.  I believe the N in AFN describes
packaging, ceramic versus plastic, DIP versus surface mount etc.


                                                                        39
In the opinion of the author, there is no substitute for the 16550A
(and its successors) in the 8250 type series.  The 16550A is
compatible with most software written for the entire family of 8250
type devices.  Programs that are 16550A aware can provide much
improved performance over previous devices.


    Neotech Quad Serial (MCA bus)
The maximum baud rate for the 16550A is specified at 256kb.  However,
due to the hardware design of the PC et al, 115kb is the maximum baud
rate that can be programmed by software.


    Well, I just got my first PS/2 system (for testing of SIO) and I am
The 16550A can be plugged into the same socket that contains an 8250,
    using the NeoTech Quad Serial card in that system.  What can I say, it
8250A or 16450If your SIO expansion board has the SIO chips in
    works beautifully and interrupt sharing has never been a problem on
sockets, you can upgrade to the 16550A by simply removing the old
    MCA systemsThis card (as shipped) came with four individual 16450
chips and replacing them with 16550As.
    chips installed, but they were in sockets so I installed 16550 UARTS
    before I installed the card.  The card has one large connector on the
    back of the card and the supplied cable expands that to 4 standard DB-
    25 connectors. Those of you needing a 4 port card for an MCA system
    contact:


          Neotech Inc
The key to the performance increase of the 16550A is its FIFOs.  It
          30295 Solon Industrial Pkwy.
has 16 byte FIFOs for both transmit and receive data.
          Solon, Ohio 44139


          Voice    (216) 248-4114
===16550s Made by Western Digital===
          FAX      (216) 248-5701
I have been told, but I have not verified for myself, that 16550s made by Western Digital have a problem with their FIFOs when working at 2400 baud or below.


===16C551===
The 16C551 is a CMOS version of the 16550AF. See the above description of the 16C451 for a discussion of CMOS. Do not feel you need to upgrade from a 16550A or AF to a 16C551. There is no gain from an existing users point of view.


===16C552===
The 16C552 is two 16C551s on a single chip.


    40
===16C554===
The 16C554 is four 16C551s on a single chip.


                        Appendix D, Advanced SIO Options
===82510===
I believe Intel is the only company that manufactures the 82510. The 82510 is feature rich with several modes of operation. Its default mode is to operate as a 16450. The 82510 has a 4 byte FIFO for both transmit and receive data. A 4 byte FIFO is sufficient to provide significant performance over a basic 16450.


The 82510 is small in size. Therefore, it is found in many lap tops.


    The following is provided for the experienced user. Inexperienced
The 82510 is somewhat of a sleeper. I believe it would be much more widely used if Intel had promoted it more. However, given a choice between the 82510 and the 16550A, I would select the 16550A.
    users get themselves into a lot of trouble when trying to use these
    options and they cause an inordinate number of support problems.
    Therefore, the following are unsupported options.  If you use them,
    you must work out the problems yourself or ask a friend how they got
    it working.


    Protection
===16650===
The 16650 by Startech seems a good logical step in the evolution of the 8250 type UARTs. One of the many flavors of the 16650 is a package that is pin compatible with the 40 pin (DIP) 16550s. This means that the 16650 can be placed into the same socket as any 16550, 8250, etc.


    Placing a dash "-" or a plus "+" in the fourth parameter position, eg
The 16650 has enhanced the FIFOs to 32 bytes, added on chip flow control ability, and increases the maximum bit rate to 460800. The on chip flow control is a really nice featureOn chip flow control practically eliminates the possibility of missed receive characters. On chip flow control also means that some devices that require immediate attention when it sends Xoff, like the Seiko Label Printer, will work much better in environments like OS/2 and Windows.
    (COM1,3F8,IRQ4,-),  causes SIO not to provide any protection for that
    port. The OS may still protect the port somewhatWhen the dash
    parameter is used the port is wide open (like DOS) for any process to
    access it.  If the plus is used, then DOS/Windows sessions are
    inhibited from turning DTR off.


    Locked Baud Rate
The 32 byte FIFOs of the 16650 is an improvement over the 16550, but is still a disappointment. I feel that 1k, or larger, FIFOs would have been a much better choice. When I quizzed Startech about this, they replied that the 32 byte FIFOs were chosen to keep the cost down. They added that if the 16650 is successful, they plan a 16750 with larger FIFOs.


    Placing a colon and a baud rate following the communications port, eg
The 16650 powers up in a 16550 compatible mode, meaning most software written for the 16550 should work.
    (COM1:38400,3F8,IRQ4), causes the port to be locked at that baud rate.
    No program, OS2 or DOS, is allowed to change the baud rate.


    IRQ Reflection to DOS Process
===16750 from Texas Instruments===
The 16750 from TI is an improvement over the 16550, but the omission of software flow control (Xon/Xoff) makes it inferior to the 16650, in the opinion of the author. The 16750 has a 64 byte fifo and hardware flow control. It is a good choice for a uart.


    Normally the IRQ that is reflected to a DOS process is the same as the
===ComBic===
    actual hardware IRQ. Placing a colon and an additional IRQ following
The ComBic is a very impressive UART used on the Hayes ESP card and some others. The ComBic is basically a 16550 UART with on chip flow control and 1k FIFOs and a maximum bit rate of 921600. Like the 16650, on chip flow control practically eliminates the possibility of missed receive characters. On chip flow control also means that some devices that require immediate attention when it sends Xoff, like the Seiko Label Printer, will work much better in environments like OS/2 and Windows.
    the normal IRQ, eg (COM1,3F8,IRQ12:IRQ4), causes SIO/VSIO to reflect
    the IRQ to a DOS process on IRQ4 (in this example) even though the
    real hardware IRQ is IRQ12. If one wishes SIO to automatically locate
    the hardware IRQ, then the following construct can be used:
    (COM1,3F8,:IRQ4).  Notice that the hardware IRQ is simply NOT
    specified.


    I/O Port Mapping to DOS Process
The ComBic has two modes of operation, compatibility mode and enhanced mode. In compatibility mode, the UART acts as a 16550. However, when in compatibility mode, the 1k FIFOs and on chip flow control can still be used. In enhanced mode, software gains the ability to look into the FIFOs and determine the exact number of bytes loaded. This feature enables software the use block input and output to the ComBic which greatly reduces processor overhead.


    Some DOS programs, such as CompuServe's CIM, insist that COM1 be at
[[Category:SIO]]
    I/O port 03F8, COM2 at 02F8, etc.  On OS/2 systems, comm ports can
    have any I/O port address as specified by a command line.  If COM1 is
    not at I/O port 03F8 for some DOS programs, then COM1 can not be used
    by the DOS program.  The SIO command line allows the I/O ports to be
    mapped to a different address for DOS sessions, eg
    (COM1,FF80:03F8,IRQ12:IRQ4).  In this example, the real COM1 is at
    FF80 on IRQ12, but is reflected to DOS processes on I/O ports 03F8 at
    IRQ4.  It is NOT necessary to map both the I/O port address and the
    IRQ.  When the I/O port is mapped to a DOS session, the UART will
    appear at BOTH I/O port addresses (FF80 and 03F8 in the given
    example).

Latest revision as of 15:16, 29 September 2022

By Ray Gwinn

Date
January 1, 1997

Introduction

Documentation of software is often more difficult than writing the program itself (at least it is for this author). I will do my best though.

But who do I document for? The user that is setting up a BBS just wants to get SIO installed and to move on to more important things. The user that is having problems needs information about serial I/O communications in general and the PC specifically. The application developer (programmer) needs detailed information about each individual function and the information generated.

The answer is, more than one manual is needed. This manual is intended as a reference for use by application programmers that desires to use SIO. A separate Users Manual is included in the distribution file(s).

This manual and the software described is provided as is and with no guarantees. Use at your own risk.

What is SIO

SIO is a Serial Input/Output (SIO) communications character device driver. It provides an interface between application programs and the serial communications hardware.

SIO had been designed as a high performance replacement for the OS/2 device driver COM.SYS. This manual documents the known differences between COM.SYS and SIO.SYS.

SIO only works with 8250 (type) serial I/O devices. Such devices include, but is not limited to the 8250A, 16450, 16550, 16550A and the 82510. If you have a PC that is an IBM or near compatible which has a serial communication port, it is likely that it contains one of these devices. SIO will identify the type of serial devices that it finds at load time.

Like other Device Drivers, SIO will do very little standing alone. There must be an application(s) program that makes use of SIO's functions before one will benefit from the use of SIO.

Development and Debugging Tools

The Poor Man's Line Monitor (PMLM.EXE)

PMLM is basically of interest to developers of comm applications and those providing technical support for those applications. This SIO utility is released largely (in self defense) in the hope that some users can diagnose their own problems. PMLM's feature of saving trace information to disk will only work with registered and beta versions of SIO.

PMLM provides basic line monitoring for OS/2, DOS and Windows comm programs. All characters sent or received by application programs are displayed in the upper portion of the screen. Receive characters are displayed as "white on blue" and transmitted characters are displayed "yellow on violet". Line signals, such as CTS are displayed as "dim white on red" when turned off and "bright white on red" when turned on. In addition, a signals transition to OFF is displayed in lower case and a signals transition to ON is displayed in upper case.

Status information is displayed in the lower part of the screen. A bright white display means the signal is on, a dim white indicates that the signal is off. In addition, when bright, Rxoff and Txoff indicate the SIO has sent (Txoff) or received (Rxoff) an Xoff, and an Xon is pending.

When a DOS or Windows session uses a comm port, an additional line of signal status appears. This status line shows the state of the virtual UART's signals. Only the signals which MAY be different from the real UART's signals are shown.

"Rx Chars" and "Tx Chars" reflects the number of characters in SIO's receive and transmit buffers respectively.

The last line on the screen shows the keys (from the keyboard) that PMLM will recognize. The bright character shows the key to hit for the associated function. The font keys will not work in a windowed OS/2 session.

PMLM's command line requires one parameter, the comm port number, and optionally accepts an additional parameter giving a save trace file name. For example, PMLM 1 COM1INFO.TEC will monitor COM1 and save ALL of the communications traffic in the file COM1INFO.TRC. The trace files created by PMLM contain exactly the same information that is displayed by PMLM, video attributes and all.

VIEWPMLM.EXE

VIEWPMLM.EXE may be used to view trace files created by PMLM. VIEWPMLM.EXE requires one parameter, the trace file name. The user can use the keys UP, DOWN, PAGEUP, PAGEDOWN, HOME, and END to navigate the saved trace file. Registered SIO users may send VIEWPMLM.EXE (along with saved trace files) to anyone for technical support purposes.

VIEWPMLM can be used in native DOS, in DOS sessions under OS/2, and in OS/2 sessions. This means that even those developers and support people need not have OS/2 to view the captured communications data created by PMLM.

SIO's Utility (SU.EXE)

This utility program has several useful commands. You can obtain a list of the available commands by typing SU at any command line prompt without any parameters. One very useful command is SU IRQS. This command will show IRQs that currently free for use. Commands are provided allowing user control (missing from MODE) are available. Status commands provide a wealth of diagnostic information.

File System Requests

SIO processes all file system requests made to it in one way or another. The following file system requests and how SIO processes them may be of use to the application programmer.

  • INIT Driver initialization.
  • Read Data transfer from driver to program.
  • Input Status Get input status.
  • Input Flush Terminate all pending input requests.
  • Write Data transfer from program to driver.
  • Output Status Get output status.
  • Output Flush Terminate all pending output requests.
  • Open Open the device for use.
  • Close Close the device.
  • IOCTL Device I/O control commands.

Each of these file system requests are discussed in more detail in the following.

Driver Initialization

During device driver initialization the command line is parsed, memory for data and control buffers is allocated and the system environment is examined.

Buffers are allocated for the maximum number of ports that the installed version of SIO can support (up to 16).

The mouse port is determined and if it is a serial mouse, that port is excluded from use by SIO.

In the absence of any command line parameters, SIO will only support (look for) COM1 and COM2 at the standard addresses. COM3 and up will not be supported (or looked at) unless they are specifically identified in the SIO command line.

Read

If another read is already in progress, the process issuing the additional read is blocked (suspended) until the previous read command completes. When a read is started, that read is not interrupted by additional reads. If multiple reads are issued, they are not necessarily processed in the order they were issued. Thus, applications may not see the read requests complete in the order in which they were issued.

The conditions that control when the read will complete are controlled by the active (current) DCB when the read is started.

Input Status

This function returns with "device busy" set if there is no data in the receive buffer. That is, busy is returned if the process may be blocked if the application issues a read command.

Input Flush

This function causes the receive buffer to be cleared (made empty). Any threads that are blocked, waiting for a read, will be restarted when this function is issued.

Write

If another write is already in progress, the process issuing the additional write is blocked (suspended) until the previous write command completes. When a write is started, that write is not interrupted by additional writes. If multiple writes are issued, they are not necessarily processed in the order they were issued. Thus, applications may not see the write requests complete in the order in which they were issued.

The conditions that control when the write will complete are controlled by the current DCB when the write is started.

Output Status

This function returns with "device busy" set if the output buffer is more than three quarters full. That is, busy is returned if the process may be blocked if the application issues a write command.

Output Flush

This function causes the transmit buffer to be cleared (made empty). Any threads that are blocked, waiting for a write, will be restarted when this function is issued.

Open

There are basically two kinds of open. They are an Initial Open and Additional (shared) Opens. The IBM documentation calls the initial open a First Level Open. An Initial Open is an open that occurs when no other process has the communications port open. An Additional Open is when an open occurs and another process already has the communications port open. For an Additional Open to occur, the Initial Opener must have issued an open allowing shared access to the port.

Initial Open

The IRQ associated with the comm port is claimed (taken) when the Initial Open occurs. If the associated IRQ is not available a "Port in Use" error is returned. At the time of this writing, the IRQ is claimed allowing sharing. However, the shared IRQ claiming is done to circumvent anomalies in the OS, and in actuality SIO will not concurrently share an IRQ with another device driver. The author found it necessary to claim (reset) all interrupts directed to the interrupt service routine in order to prevent lock ups of a communications port. The IRQ mess may be cleaned up at a future date when the OS problems are corrected.

During Initial Opens, DTR and RTS are set in accordance with the current Device Control Block (DCB) settings. If DTR Control Mode is the "Enabled" option ( bits 1 and 0 of the DCB Flags1 byte equal 01), then DTR is turned on. Otherwise, DTR is unchanged by the Initial Open. Similarly, if RTS Control Mode is the "Enabled" option ( bits 7 and 6 of the DCB Flags1 byte equal 01), then RTS is turned on. Otherwise, RTS is unchanged by the Initial Open.

The following actions also occur during an Initial Open:

  • The Xon and Xoff characters are set to 11h and 13h respectively.
  • The transmit and receive buffers and structures are cleared and re-initialized.
  • Status bits are reset.

If the Initial Opener is an OS/2 process (not a DOS process) then the Read time out processing is set to "Normal" in the current DCB.

Additional Open

A count of active opens is incremented. No changes are made to current comm settings.

Close

There are two basic kinds of closes. They are an Intermediate Close and a Last Close.

Intermediate Close

An intermediate close occurs when a process issues a close and other processes still have the communications port opened. This type of close simply decrements an open count and returns. No action or changes take place at the communications port.

Last Close

The last close occurs when a process issues a close and no other process has the communications port open. If there are any writes pending or incomplete, the process is blocked (suspended) until the writes complete or time out. If 60 seconds pass with no activity at the communications port, the port is forced to close and all writes are terminated. If any processes are blocked (suspended) waiting on a read, they are forced to return to the process that issued the read.

If either DTR Control Mode or RTS Control Mode are set to "Enabled" by the current DCB, then the appropriate signal(s) is turned off.

Finally, the IRQ is released back to the OS.

Device I/O Control (IOCtl) Commands

The following Generic IOCtl functions are supported by SIO.

41h - Set Bit Rate
42h - Set Line Characteristics
43h - Extended Set Bit Rate
44h - Transmit Byte Immediate
45h - Set Break Off
46h - Set Modem Control Signals
47h - Hold Transmit
48h - Start Transmit (after hold)
4Bh - Set Break On
53h - Write Device Control Block (DCB)
54h - Write Extended Mode Parameters
61h - Query Current Bit Rate
62h - Query Line Characteristics
63h - Query Extended Bit Rate
64h - Query SIO Status
65h - Query Transmit Data Status
66h - Query Current Modem Output Control Signals
67h - Query Current Modem Input Signals
68h - Query Number of Characters in Receive Buffer
69h - Query Number of Characters in Transmit Buffer
6Dh - Query SIO Error
72h - Query SIO Event Information
73h - Read Device Control Block (DCB)
74h - Read Enhanced Mode Parameters

Each of these IOCtl commands are described in detail on the following pages.

All IOCtl functions are called with a uniform set of parameters. This uniform set of parameters is:

DWORD  Address of a data packet.
WORD   Size of the data packet in bytes.
DWORD  Address of the parameter packet.
WORD   Size of the parameter packet in bytes.
WORD   Function code.
WORD   Category code (01 for SIO).
WORD   Handle for the opened device.

Each IOCtl function may or may not have a data or parameter packet. If a given IOCtl function specifies a NULL parameter or data packet, the address of the appropriate item must be NULL (zero) in the parameters. Passing an invalid data or parameter packet may result in a General Protection Fault.

IOCtl Functions From a DOS Session

Additionally the following describes how to call an IOCtl function in an OS/2 driver from a DOS session (VDM). The "handle" is obtained simply by issuing a normal DOS open of the device, ie COM1. The Data Packets (DataPkt below) and Parameter Packets (PrmPkt below) are different for each IOCtl function. The structure and contents of these packets are described in the following pages.

 push    ds              ;save ds
 mov     bx,handle       ;file handle to bx
 mov     ch,1            ;category, 1=serial device control
 mov     cl,41h          ;func code, 41h=extended set bit rate
 mov     dx,Seg DataPkt  ;get segment of the data packet
 mov     ds,dx           ;load ds with seg of the data packet
 lea     dx,DataPkt      ;data packet address to ds:dx
 mov     si,Seg PrmPkt   ;segment of command packet to si
 lea     di,PrmPkt       ;offset of command packet to di
 mov     ax,440ch        ;IOCtl function call, handle based
 int     21h             ;issue IOCtl to OS/2 driver.
 pop     ds              ;restore ds
 jc      error           ;jump if error returned

41h - Set Bit Rate

Parameter Packet

┌──────────────────────────────────────┐
│         Item                Type     │
├───────────────────────────┬──────────┤
│ Bit/Baud Rate             │ WORD     │
└───────────────────────────┴──────────┘

"Bit Rate" is any number from 1 to 65535. SIO does not attempt to validate a given bit rate. The minimum bit rate accepted by SIO is 50, the maximum for this IOCtl function is 65535.

Note that the hardware may not be able to generate the given bit rate. For example, if a computer has a standard communications card installed and if a bit rate of 65500 is specified, the nearest bit rate that can be generated will be set, 57600 in this case.

To set bit rates in excess of 57600, see IOCtl function 43h, Extended Set Bit Rate.

Some commonly used bit rates that can be set with this function are:

  50       2000
  75       2400
 110       3600
 150       4800
 300       7200
 600       9600
1200      19200
1800      28800
2000      38400
2400      57600

Data Packet - None

42h - Set Line Characteristics

Parameter Packet

┌──────────────────────────────────────┐
│         Item                Type     │
├───────────────────────────┬──────────┤
│ Data Bits Per Character   │ BYTE     │
├───────────────────────────┼──────────┤
│ Parity Setting            │ BYTE     │
├───────────────────────────┼──────────┤
│ Stop Bit Setting          │ BYTE     │
└───────────────────────────┴──────────┘

Data Bits Per Character may be 5, 7, or 8, all other values are invalid.

Parity Setting may have the following values, all other values are invalid:

0 - No parity bit.
1 - Odd parity.
2 - Even parity.
3 - Mark parity (1).
4 - Space parity (0).

Stop Bit Setting may have the following values, all other values are invalid:

0 - 1 stop bit.
1 - 1.5 stop bit (valid with 5 data bit characters).
2 - 2 stop bits.

Data Packet - None

43h - Extended Set Bit Rate

Parameter Packet

┌──────────────────────────────────────┐
│         Item                Type     │
├───────────────────────────┬──────────┤
│ Bit/Baud Rate             │ DWORD    │
├───────────────────────────┼──────────┤
│ Fraction                  │ BYTE     │
└───────────────────────────┴──────────┘

"Bit Rate" is the desired bit/baud rate. The maximum bit rate supported by SIO is determined by the installed hardware. The IOCtl function "63h - Query Extended Bit Rate" can be used to determine the maximum bit rate allowed for the associated hardware.

SIO does not attempt to validate a given bit rate. This means that the hardware may not be able to generate the given bit rate. For example, if a computer has a standard communications card installed and if a bit rate of 65500 is specified, the nearest bit rate that can be generated will be set, 57600 in this case.

"Fraction" is used to set the fractional part of the bit rate when a high degree of accuracy is needed. As of this writing, SIO does not support a "Fraction" other than zero.

Some commonly used bit rates that can be set with this function are:

 110       3600      115200
 150       4800      230400
 300       7200      460800
 600       9600      921600
1200      19200
1800      28800
2000      38400
2400      57600

Data Packet - None

44h - Transmit Byte Immediate

Parameter Packet

┌──────────────────────────────────────┐
│         Item                Type     │
├───────────────────────────┬──────────┤
│ Character to Transmit     │ BYTE     │
└───────────────────────────┴──────────┘

"Character to Transmit" will be the next character loaded into the UART for transmission. If a previous transmit immediate byte is still pending, it is lost. This function does not wait for the character to transmit before returning.

This function may be used by an application program as one of a set of functions to implement its own Xon/Xoff type handshaking.

Data Packet - None

45h - Set Break Off

Parameter Packet - None

Look!! No Parameter Packet!

Data Packet

┌──────────────────────────────────────┐
│         Item                Type     │
├───────────────────────────┬──────────┤
│ SIO Error Word            │ WORD     │
└───────────────────────────┴──────────┘

See function 6Dh "Query SIO Error" for a description of the SIO Error Word. This function does not reset any bits in the SIO Error Word.

46h - Set Modem Control Signals

Parameter Packet

┌──────────────────────────────────────┐
│         Item                Type     │
├───────────────────────────┬──────────┤
│ DTR and RTS on mask       │ BYTE     │
├───────────────────────────┼──────────┤
│ DTR and RTS off mask      │ BYTE     │
└───────────────────────────┴──────────┘

Attempted changes in the the setting of signals that are used as flow control signals are ignored. The current DCB determines if either or both RTS and DTR are used as a flow control signal.

The setting of bit 0 affects DTR and the setting of bit 1 affects RTS. Ones in the "on mask" specifies which of the two signals are to be turned on, and zeros in the "off mask" specify which of the two signals are to be turned off.

Some examples are:

On Mask        Off Mask
01h            0FFh      Turn DTR on
00h            0FEh      Turn DTR off
02h            0FFh      Turn RTS on
00h            0FDh      Turn RTS off
03h            0FFh      Turn RTS and DTR on
00h            0FCh      Turn RTS and DTR off

If both on and off are specified for the setting of a signal, the result is undefined.

Data Packet

┌──────────────────────────────────────┐
│         Item                Type     │
├───────────────────────────┬──────────┤
│ SIO Error Word            │ WORD     │
└───────────────────────────┴──────────┘

See function 6Dh "Query SIO Error" for a description of the SIO Error Word. This function does not reset any bits in the SIO Error Word.

47h - Hold Transmit

Parameter Packet - None

Data Packet - None

This function will disable the transmitter. The transmitter will not be enabled again unless IOCtl function 48h is issued. If the transmitter is already disabled, this call has no effect.

This function can be used as part of a set that allows an application to implement its own Xon/Xoff type handshaking.

Note that this is different from how COM.SYS implements this function. COM.SYS will re-enable the transmitter if an Xon is received while SIO will not.

48h - Start Transmit

Parameter Packet - None

Data Packet - None

This function will enable the transmitter, usually following an IOCtl function 47h. If the transmitter is already enabled, this call has no effect.

This function can be used as part of a set that allows an application to implement its own Xon/Xoff type handshaking.

4Bh - Set Break on

Parameter Packet - None

Look!! No Parameter Packet!

Data Packet

┌──────────────────────────────────────┐
│         Item                Type     │
├───────────────────────────┬──────────┤
│ SIO Error Word            │ WORD     │
└───────────────────────────┴──────────┘

See function 6Dh "Query SIO Error" for a description of the SIO Error Word. This function does not reset any bits in the SIO Error Word.

53h - Write Device Control Block (DCB)

This is where the action is! See also function 73h (Read DCB).

Parameter Packet

┌──────────────────────────────────────┐
│         Item                Type     │
├───────────────────────────┬──────────┤
│ Write Timeout             │ WORD     │
├───────────────────────────┼──────────┤
│ Read Timeout              │ WORD     │
├───────────────────────────┼──────────┤
│ Flags1                    │ BYTE     │
├───────────────────────────┼──────────┤
│ Flags2                    │ BYTE     │
├───────────────────────────┼──────────┤
│ Flags3                    │ BYTE     │
├───────────────────────────┼──────────┤
│ Error Replacement Byte    │ BYTE     │
├───────────────────────────┼──────────┤
│ Break Replacement Byte    │ BYTE     │
├───────────────────────────┼──────────┤
│ Xon Character             │ BYTE     │
├───────────────────────────┼──────────┤
│ Xoff Character            │ BYTE     │
└───────────────────────────┴──────────┘

"Write Timeout" The write timeout is given in hundredths of a second, relative to zero. That is, 0 specifies 0.01 seconds and 1 specifies 0.02 seconds.

"Read Timeout" The read timeout is given in hundredths of a second, relative to zero. That is, 0 specifies 0.01 seconds and 1 specifies 0.02 seconds.

"Flags1" is a bit flag. The bits in the flag specify the following:

         Bits 1 and 0        DTR Control Mode.
                   00 - Disable changing DTR during Open and Close.
                   01 - Enable Changing DTR during Open and Close.
                   10 - DTR used for input handshaking (not supported by
                        SIO).
                   11 - Invalid
         Bit 2,    Must be zero
         Bit 3,    Off to ignore CTS.  Forced on if RTS is handshake.
         Bit 4,    DSR is handshake.  Not supported by SIO.
         Bit 5,    DCD required to transmit.  Not supported by SIO.
         Bit 6,    DSR required to receive.
         Bit 7,    Must be zero.

"Flags2" is a bit flag. The bits in the flag specify the following:

Bit 0, SIO is to honor Xon/XOff received from remote.
Bit 1, SIO may send Xon/Xoff to the remote.
Bit 2, Enable error replacement character. Not supported by SIO.
Bit 3, Enable null stripping. Not supported by SIO.
Bit 4, Enable break replacement character. Not supported by SIO.
Bit 5, Enable Full duplex. Half duplex is not supported by SIO.
Bits 7 and 6 RTS Control Mode
00 - Disable changing RTS during Open and Close.
01 - Enable Changing RTS during Open and Close.
10 - RTS used for input handshaking.
11 - Toggle on transmit (half duplex). Not supported by SIO.

"Flags3" is a bit flag. The bits in the flag specify the following:

Bit 0, Enable infinite write timeout processing. When set, a write timeout will not occur.
Bits 2 and 1 Read timeout processing
00 - Invalid.
01 - Normal read time out.
10 - Wait for something. Reads will return before a timeout occurs if something received.
11 - No Wait. Reads will return immediately with any available data.
Bits 4 and 3 FIFO Control
00 - No change in FIFO state.
01 - Disable FIFO buffers.
10 - Enable FIFO buffers.
11 - Dynamic enabling and disabling of FIFOS.
**Note, SIO forces bits 4 and 3 to "10".
Bits 6 and 5 Set receive trigger level
00 - 1 character.
01 - 4 characters.
10 - 8 characters.
11 - 14 characters.
**Note, SIO forces bits 6 and 5 to "10".
Bit 7 Transmit load count
0 - Load 1 character.
1 - Load 16 characters.
**Note, SIO forces bit 7 to "1".

"Error Replacement Byte" Not supported by SIO.

"Break Replacement Byte" Not supported by SIO

"Xon Character" Any value, default is 11h.

"Xoff Character" Any value, default is 13h.

Data Packet - None

54h - Write Extended Mode Parameters

Parameter Packet

┌──────────────────────────────────────┐
│         Item                Type     │
├───────────────────────────┬──────────┤
│ Enhanced Flags1           │ BYTE     │
├───────────────────────────┼──────────┤
│ Reserved                  │ DWORD    │
└───────────────────────────┴──────────┘

This function is not supported (ignored) by SIO. However the bits are defined here for completeness.

Enhanced Flags1

Bit 0 - Enhanced mode hardware available (Query only 74h).
Bit 1 - Enable enhanced mode.
Bits 3 and 2 DMA Receive Operation
00 - Disable DMA receive capability.
01 - Enable DMA receive capability.
10 - Dedicate a DMA channel to receive.
11 - Reserved.
Bits 5 and 4 DMA Transmit Operation
00 - Disable DMA transmit capability.
01 - Enable DMA transmit capability
10 - Dedicate a DMA channel to transmit.
11 - Reserved.
Bit 6 - Receive in DMA mode (Query only, 74h).
Bit 7 - Transmit in DMA mode (Query only, 74h).

Data Packet - None.

61h - Query Current Bit Rate

Parameter Packet - None.

Data Packet

┌──────────────────────────────────────┐
│         Item                Type     │
├───────────────────────────┬──────────┤
│ Bit/Baud Rate             │ WORD     │
└───────────────────────────┴──────────┘

See function 41h for more information.

62h - Query Line Characteristics

Parameter Packet - None.

Data Packet

┌──────────────────────────────────────┐
│         Item                Type     │
├───────────────────────────┬──────────┤
│ Data Bits Per Character   │ BYTE     │
├───────────────────────────┼──────────┤
│ Parity Setting            │ BYTE     │
├───────────────────────────┼──────────┤
│ Stop Bit Setting          │ BYTE     │
├───────────────────────────┼──────────┤
│ Transmitting Break        │ BYTE     │
└───────────────────────────┴──────────┘

See function 42h for a definition of Data, Parity and Stop Bits.

"Transmitting Break" is set to 1 if a break is being transmitted. Otherwise, it is set to zero.

63h - Query Extended Bit Rate

Parameter Packet - None

Data Packet

┌──────────────────────────────────────┐
│         Item                Type     │
├───────────────────────────┬──────────┤
│ Current Bit/Baud Rate     │ DWORD    │
├───────────────────────────┼──────────┤
│ Fraction of Current       │ BYTE     │
├───────────────────────────┼──────────┤
│ Minimum Bit/Baud Rate     │ DWORD    │
├───────────────────────────┼──────────┤
│ Fraction of Minimum       │ BYTE     │
├───────────────────────────┼──────────┤
│ Maximum Bit/Baud Rate     │ DWORD    │
├───────────────────────────┼──────────┤
│ Fraction of Maximum       │ BYTE     │
└───────────────────────────┴──────────┘

"Current Bit/Baud Rate" is a 32 bit integer defining the current bit rate.

"Fraction of Current" is always 0 when returned by SIO.

"Minimum Bit/Baud Rate" is the minimum value that can be passed to SIO as a bit/baud rate.

"Fraction of Minimum" is always 0 when returned by SIO.

"Maximum Bit/Baud Rate" is the maximum value that can be passed to SIO as a bit/baud rate.

"Fraction of Maximum" is always 0 when returned by SIO.

64h - Query SIO Status

Parameter Packet - None

Data Packet

┌──────────────────────────────────────┐
│         Item                Type     │
├───────────────────────────┬──────────┤
│ SIO Status Byte           │ BYTE     │
└───────────────────────────┴──────────┘

"SIO Status Byte" is a bit flag. The bits have the following meanings:

Bit 0 - Set if SIO is waiting for CTS before transmitting.
Bit 1 - Set if SIO is waiting for DSR before transmitting.
Bit 2 - Set if SIO is waiting for DCD before transmitting.
Bit 3 - Set if SIO is waiting because Xoff received or transmitter is disabled (see function 47h).
Bit 4 - Reserved, not used by SIO.
Bit 5 - Set if SIO is waiting because break is being sent.
Bit 6 - Set if a transmit immediate is pending.
Bit 7 - Reserved, not used by SIO.

65h - Query Transmit Data Status

Parameter Packet - None.

Data Packet

┌──────────────────────────────────────┐
│         Item                Type     │
├───────────────────────────┬──────────┤
│ Transmit Status           │ BYTE     │
└───────────────────────────┴──────────┘

"SIO Status Byte" is a bit flag. The bits have the following meanings:

Bit 0 - Set if write in progress or pending.
Bit 1 - Set if any data is in the transmit buffer.
Bit 2 - Set if UART is currently transmitting.
Bit 3 - Set if a transmit immediate is pending.
Bit 4 - Set if an Xon needs to be sent.
Bit 5 - Set if an Xoff needs to be sent.
Bit 6 - Reserved
Bit 7 - Reserved

66h - Query Current Modem Output Control Signals

Parameter Packet - None.

Data Packet

┌──────────────────────────────────────┐
│         Item                Type     │
├───────────────────────────┬──────────┤
│ Modem Output Signals      │ BYTE     │
└───────────────────────────┴──────────┘

"Modem Output Signals" is a bit flag. The bits have the following meanings:

Bit 0 - Set if DTR is currently on.
Bit 1 - Set if RTS is currently on.
Bits 2-7 Reserved, set to zero by SIO.

67h - Query Current Modem Input Signals

Parameter Packet - None.

Data Packet

┌──────────────────────────────────────┐
│         Item                Type     │
├───────────────────────────┬──────────┤
│ Modem Input Signals       │ BYTE     │
└───────────────────────────┴──────────┘

"Modem Output Signals" is a bit flag. The bits have the following meanings:

Bits 0-3 Reserved, set to zero by SIO.
Bit 4 - Clear To Send (CTS) is active.
Bit 5 - Data Set Ready (DSR) is active.
Bit 6 - Ring Indicator (RI), trailing edge detected.
Bit 7 - Data Carrier Detect (DCD) is active.

68h - Query Number of Characters in Receive Buffer

Parameter Packet - None.

Data Packet

┌──────────────────────────────────────┐
│         Item                Type     │
├───────────────────────────┬──────────┤
│ Number of Bytes Buffered  │ WORD     │
├───────────────────────────┼──────────┤
│ Byte Size of the Buffer   │ WORD     │
└───────────────────────────┴──────────┘

Self explaining.

69h - Query Number of Characters in Transmit Buffer

Parameter Packet - None.

Data Packet

┌──────────────────────────────────────┐
│         Item                Type     │
├───────────────────────────┬──────────┤
│ Number of Bytes Buffered  │ WORD     │
├───────────────────────────┼──────────┤
│ Byte Size of the Buffer   │ WORD     │
└───────────────────────────┴──────────┘

Self explaining.

6Dh - Query SIO Error

Parameter Packet - None.

Data Packet

┌──────────────────────────────────────┐
│         Item                Type     │
├───────────────────────────┬──────────┤
│ SIO Error Word            │ WORD     │
└───────────────────────────┴──────────┘

"SIO Error Word" is a bit flag. The bits have the following meaning:

Bit 0 - Set if a buffer overrun has occurred.
Bit 1 - Set if an overrun occurred at the UART.
Bit 2 - Set if the UART detected a parity error.
Bit 3 - Set if the UART detected a framing error.
Bits 4-15 Reserved, set to zero by SIO.

All bits of the SIO Error Word are reset prior to returning to the caller.

72h - Query SIO Event Information

Parameter Packet - None.

Data Packet

┌──────────────────────────────────────┐
│         Item                Type     │
├───────────────────────────┬──────────┤
│ SIO Event Word            │ WORD     │
└───────────────────────────┴──────────┘

"SIO Event Word" is a bit flag. The bits have the following meaning:

Bit 0 - Set when a receive character is transferred from the UART to the receive buffer.
Bit 1 - Set when a receive (Read) timeout occurs.
Bit 2 - Set if the transmit buffer is empty.
Bit 3 - Set if Clear To Send (CTS) has changed state.
Bit 4 - Set if Data Set Ready (DSR) has changed state.
Bit 5 - Set if Data Carrier Detect (DCD) has changed state.
Bit 6 - Set if a break has been detected.
Bit 7 - Set if a framing, parity, or overrun error has occurred.
Bit 8 - Set if trailing edge of Ring Indicator (RI) has occurred.
Bits 9-15 Reserved, set to zero by SIO.

All bits are reset prior to returning to the caller.

73h - Read Device Control Block (DCB)

Parameter Packet - None.

Data Packet

┌──────────────────────────────────────┐
│         Item                Type     │
├───────────────────────────┬──────────┤
│ Write Timeout             │ WORD     │
├───────────────────────────┼──────────┤
│ Read Timeout              │ WORD     │
├───────────────────────────┼──────────┤
│ Flags1                    │ BYTE     │
├───────────────────────────┼──────────┤
│ Flags2                    │ BYTE     │
├───────────────────────────┼──────────┤
│ Flags3                    │ BYTE     │
├───────────────────────────┼──────────┤
│ Error Replacement Byte    │ BYTE     │
├───────────────────────────┼──────────┤
│ Break Replacement Byte    │ BYTE     │
├───────────────────────────┼──────────┤
│ Xon Character             │ BYTE     │
├───────────────────────────┼──────────┤
│ Xoff Character            │ BYTE     │
└───────────────────────────┴──────────┘

See function 53h for a description of the parameters.

74h - Read Enhanced Mode Parameters

Parameter Packet - None.

Data Packet

┌──────────────────────────────────────┐
│         Item                Type     │
├───────────────────────────┬──────────┤
│ Enhanced Flags1           │ BYTE     │
├───────────────────────────┼──────────┤
│ Reserved                  │ DWORD    │
└───────────────────────────┴──────────┘

See function 54h for a description of the Flags1 Byte.

Differences between SIO/VSIO and COM/VCOM

What follows is some of the differences between SIO/VSIO and COM/VCOM that are known to the author.

1 - COM.SYS will automatically seek out and support four comm ports, COM1 through COM4. SIO.SYS will automatically seek out and support only COM1 and COM2. If SIO.SYS is to support more than two comm ports, they must be defined in the command line that loads SIO.SYS. For example, DEVICE=SIO.SYS (COM3) (COM4) will cause SIO.SYS to support four comm ports.

2 - In the absence of overrides in the command line, COM.SYS will seek out four comm ports in the sequence of I/O ports 3F8h, 2F8h, 3E8h and 2E8h. The first port found in this sequence is given the logical name COM1, the second is COM2 etc. This means that the comm port at 2F8h could become COM1. In the opinion of the author, this confuses some users to frustration.

With no command line overrides, SIO.SYS uses a fixed I/O port concept. That is, COM1 is always at I/O port 3F8h, COM2 is always at 2F8h, etc. Another way of looking at this is; if no comm port exists at port 3F8h, then you do not have a COM1. SIO.SYS will not move another (found) comm port into the logical COM1 slot.

3 - VSIO opens a comm port for a DOS session with sharing allowed. VCOM uses an "exclusive use" open for DOS sessions.

4 - SIO.SYS always controls the FIFOs of the 16550 UART. SIO.SYS will not allow an application program (OS2 or DOS) to disable the FIFOs of a real 16550. The application may specify the transmit fifo load count.

5 - SIO.SYS will accept any number between 50 and 115200 (921600 if a Hayes ESP) as a valid baud rate. For example, if an application program attempts to set a baud rate of 9990 bps, COM.SYS will reject it and SIO.SYS will accept it.

6 - SIO/VSIO execute faster than COM/VCOM. This means that some applications, that are timing dependent, may not work under SIO/VSIO that do work under COM/VCOM.

7 - SIO/VSIO provides more reliable active flow control for DOS sessions. For example, if RTS/CTS handshaking is in use, VSIO processes the RTS settings by the DOS program while SIO completely controls the real RTS signal. COM/VCOM simply passes the RTS signal directly to the hardware.

8 - COM.SYS will block an application until a write completes. SIO will return to the application program immediately if all of the write data will fit into SIO's internal buffers.

Appendix A, Hardware Port and IRQ Assignments

I have obtained the following information from various sources. Accuracy is not guaranteed. In fact, nothing in this document is guaranteed.

Addresses and IRQs for COM1 and COM2

COM1 uses 03F8h and IRQ4
COM2 uses 02F8h and IRQ3

Defacto standard for COM3 and COM4 for PC, XT and AT

COM3 uses 03E8h and IRQ4
COM4 uses 02E8h and IRQ3

Addresses and IRQ for COM3 through COM8 on the PS/2

COM3 uses 3220h and IRQ3
COM4 uses 3228h and IRQ3
COM5 uses 4220h and IRQ3
COM6 uses 4228h and IRQ3
COM7 uses 5220h and IRQ3
COM8 uses 5228h and IRQ3

All PCs (known to the author) prior to the PS/2 and EISA only use 10 bits to address hardware I/0 ports. Systems prior to the PS/2 and EISA can not address the standard PS/2 addresses for COM3 through COM8. If an AT or below attempts to address COM3 through COM8 using the PS/2 addresses, only the low 10 bits of the address are used. That is, the high digit of the hexadecimal address will be ignored. This means that any reference to COM3 through COM8 will actually address ports 220h through 22Fh on older PCs.

One should avoid expansion boards that use ports 220h through 22Fh unless the expansion board is a serial I/O board.

SIO will (attempt to) determine the hardware architecture (ISA/EISA and PS/2) that it is being executed on and use the appropriate hardware port addresses for COM1 thru COM4 as defaults.

Appendix B, SIO Chips

The following is a collection of comments developed from hearsay, random documents, experience, and technical specifications. So, take it with a grain of salt. Order information from the various manufactures if you want accurate information.

Very good reference books are available from National Semiconductor Corporation. They cover most of the SIO devices (also called UARTs) that you will find in many PCs and clones. I am not sure that books can be ordered directly from National semiconductor. They may require that you get it from a distributor. In any case, the address on the back of the one manual is:

National Semiconductor Corporation
2900 Semiconductor Drive
P.O. Box 58090
Santa Clara, CA 95052-8090
Tel:(408)721-5000
TWX:(910)339-9240

8250

As best that I know, the 8250 was the first SIO chip (integrated circuit) that was used by the IBM PC and many clones. In my opinion, it was a poor choice on the part of IBM. I feel many superior devices, at comparable prices, were readily available. At that time, I feel the 8251A or the 8530 would have been better choices. But, they used the 8250 and therefore we must use it.

From a hardware standpoint the 8250 is a relatively slow device. It is advisable that programmers not perform successive inputs or outputs to this device. It seems that software programs can load the various registers of the 8250 faster than it can process the information. The 8250 had a total of 7 registers. The specifications state that 56kb is the maximum baud rate.

8250A

I believe the 8250A is the 8250 with some bug fixes. I have no idea what the bugs may have been. A quick glance at the specifications shows the speed of the 8250 and 8250A to be much the same. The 8250A added an 8th register. This additional register enables software to detect if an 8250 is installed. The specifications state that 56kb is the maximum baud rate.

16450

The 16450 seems to be a speeded up version of the 8250A. There is no direct way (that I know of) for software to detect the difference between an 8250A and a 16450. I believe the 16450 was developed to eliminate the need for software to insert delays between successive accesses to the device. The specifications indicate the 16450 is a much faster device than its predecessors. The additional speed is only the speed at which the processor can access the device. The maximum baud rate for the 16450 is still stated at 56kb. However, I have been told by some people that they have run the 16450 successfully at much higher speeds. I do not believe there was ever a 16450A.

16C451

The 16C451 is a CMOS version of the 16450. CMOS is a term for the material and manufacturing process used to make the part. CMOS typically uses less power than other technologies. If you are not designing hardware, you should view the 16C451 as a 16450.

16550 (Non A)

It is hard to find a 16550 (Non A). I was told by National Semiconductor that they did everything they could to get all 16550s back. SIO will detect a 16550 and tell you if you have one. I am told that the 16550 was installed in early PS/2 systems.

The 16550 was the first shot at a FIFOed version of the 8250 family from National semiconductor. However, I was told by National Semiconductor that the FIFOs of the 16550 are not reliable and they should not be enabled. SIO will treat a 16550 like a 16450. In this mode, they are reliable. National Semiconductor would not provide me with a specification for the 16550. However, I suspect its maximum baud rate is the same as the 16550A which is 256kb.

16550A, 16550AF and 16550AFN

In the manuals that I have, National Semiconductor does not explain the differences between the 16550A and the 16550AF. I suspect the AF part may have a few bug fixes. I believe the N in AFN describes packaging, ceramic versus plastic, DIP versus surface mount etc.

In the opinion of the author, there is no substitute for the 16550A (and its successors) in the 8250 type series. The 16550A is compatible with most software written for the entire family of 8250 type devices. Programs that are 16550A aware can provide much improved performance over previous devices.

The maximum baud rate for the 16550A is specified at 256kb. However, due to the hardware design of the PC et al, 115kb is the maximum baud rate that can be programmed by software.

The 16550A can be plugged into the same socket that contains an 8250, 8250A or 16450. If your SIO expansion board has the SIO chips in sockets, you can upgrade to the 16550A by simply removing the old chips and replacing them with 16550As.

The key to the performance increase of the 16550A is its FIFOs. It has 16 byte FIFOs for both transmit and receive data.

16550s Made by Western Digital

I have been told, but I have not verified for myself, that 16550s made by Western Digital have a problem with their FIFOs when working at 2400 baud or below.

16C551

The 16C551 is a CMOS version of the 16550AF. See the above description of the 16C451 for a discussion of CMOS. Do not feel you need to upgrade from a 16550A or AF to a 16C551. There is no gain from an existing users point of view.

16C552

The 16C552 is two 16C551s on a single chip.

16C554

The 16C554 is four 16C551s on a single chip.

82510

I believe Intel is the only company that manufactures the 82510. The 82510 is feature rich with several modes of operation. Its default mode is to operate as a 16450. The 82510 has a 4 byte FIFO for both transmit and receive data. A 4 byte FIFO is sufficient to provide significant performance over a basic 16450.

The 82510 is small in size. Therefore, it is found in many lap tops.

The 82510 is somewhat of a sleeper. I believe it would be much more widely used if Intel had promoted it more. However, given a choice between the 82510 and the 16550A, I would select the 16550A.

16650

The 16650 by Startech seems a good logical step in the evolution of the 8250 type UARTs. One of the many flavors of the 16650 is a package that is pin compatible with the 40 pin (DIP) 16550s. This means that the 16650 can be placed into the same socket as any 16550, 8250, etc.

The 16650 has enhanced the FIFOs to 32 bytes, added on chip flow control ability, and increases the maximum bit rate to 460800. The on chip flow control is a really nice feature. On chip flow control practically eliminates the possibility of missed receive characters. On chip flow control also means that some devices that require immediate attention when it sends Xoff, like the Seiko Label Printer, will work much better in environments like OS/2 and Windows.

The 32 byte FIFOs of the 16650 is an improvement over the 16550, but is still a disappointment. I feel that 1k, or larger, FIFOs would have been a much better choice. When I quizzed Startech about this, they replied that the 32 byte FIFOs were chosen to keep the cost down. They added that if the 16650 is successful, they plan a 16750 with larger FIFOs.

The 16650 powers up in a 16550 compatible mode, meaning most software written for the 16550 should work.

16750 from Texas Instruments

The 16750 from TI is an improvement over the 16550, but the omission of software flow control (Xon/Xoff) makes it inferior to the 16650, in the opinion of the author. The 16750 has a 64 byte fifo and hardware flow control. It is a good choice for a uart.

ComBic

The ComBic is a very impressive UART used on the Hayes ESP card and some others. The ComBic is basically a 16550 UART with on chip flow control and 1k FIFOs and a maximum bit rate of 921600. Like the 16650, on chip flow control practically eliminates the possibility of missed receive characters. On chip flow control also means that some devices that require immediate attention when it sends Xoff, like the Seiko Label Printer, will work much better in environments like OS/2 and Windows.

The ComBic has two modes of operation, compatibility mode and enhanced mode. In compatibility mode, the UART acts as a 16550. However, when in compatibility mode, the 1k FIFOs and on chip flow control can still be used. In enhanced mode, software gains the ability to look into the FIFOs and determine the exact number of bytes loaded. This feature enables software the use block input and output to the ComBic which greatly reduces processor overhead.