CPGuide - Generic IOCtl Commands: Difference between revisions
Line 1,113: | Line 1,113: | ||
=====Write Timeout State===== | =====Write Timeout State===== | ||
When the physical device driver processes a WRITE request packet, it can be with Normal or Infinite Timeout processing. With Normal Timeout processing if no data is given to the transmit hardware within a specified amount of time, the request is completed. With Infinite Timeout processing, the request is completed only when all the data from the request has been given to the transmit hardware. | |||
Error Alerts can be generated on the occurrence of Write Timeout, if the OS/2 Logging Facility is enabled. In order for an error alert to be generated by the physical ASYNC device driver, the appropriate mode of operation must be enabled. | |||
;Initial Value: Normal Write Timeout processing | |||
;First Level Open: No effect on Write Timeout processing | |||
;Mode Utility: User interface to set Infinite or Normal Write Timeout processing | |||
=====Write Timeout Value===== | =====Write Timeout Value===== | ||
=====XON/XOFF Characters===== | =====XON/XOFF Characters===== |
Revision as of 21:25, 26 March 2020
Reprint Courtesy of International Business Machines Corporation, © International Business Machines Corporation
OS/2 device drivers are used to access the I/O hardware. The IOCtl functions provide a method for an application, or subsystem, to send device-specific control commands to a physical device driver. These IOCtls are subfunctions that are issued through the DosDevIOCtl API function request. The DosDevIOCtl function request can be used only by OS/2 applications; the INT 21h IOCtl request can be used only by DOS applications.
The category and function fields are as follows. Each code is contained in a byte:
- Category Code
- 0xxx xxxx OS/2-defined
- 1xxx xxxx User-defined
- _xxx xxxx Code.
- Function Code
- 0xxx xxxx Return error, if unsupported
- 1xxx xxxx Ignore, if unsupported
- x0xx xxxx Intercepted by the OS/2 operating system
- x1xx xxxx Passed to driver
- xx0x xxxx Sends data and commands to device
- xx1x xxxx Queries data and information from device
- ___x xxxx Subfunction.
Notice that the send/query data bit is intended only to standardize the function set; it plays no critical role. Some functions can contain both command and query elements. Such commands are defined as sends data.
Generic IOCtl Function Table
The list of categories and functions for the generic IOCtl requests are as follows:
┌──────────┬──────────┬────────────────────────────────────────┐ │Category │Function │Description │ ├──────────┼──────────┼────────────────────────────────────────┤ │ 01h │ │Serial Device Control │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 14h │Reserved │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 34h │Reserved │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 41h │Set Bit Rate │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 42h │Set Line Characteristics (stop, parity, │ │ │ │data bits) │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 43h │Extended Set Bit Rate │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 44h │Transmit Byte Immediate │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 45h │Set Break OFF │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 46h │Set Modem Control Signals │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 47h │Behave As If XOFF Received (stop │ │ │ │transmit) │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 48h │Behave As If XON Received (start │ │ │ │transmit) │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 49h │Reserved │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 4Bh │Set Break ON │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 53h │Set Device Control Block (DCB) │ │ │ │Parameters │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 54h │Set Enhanced Mode Parameters │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 61h │Query Current Bit Rate │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 62h │Query Line Characteristics │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 63h │Extended Query Bit Rate │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 64h │Query COM Status │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 65h │Query Transmit Data Status │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 66h │Query Modem Control Output Signals │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 67h │Query Current Modem Input Signals │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 68h │Query Number of Characters in Receive │ │ │ │Queue │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 69h │Query Number of Characters in Transmit │ │ │ │Queue │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 6Dh │Query COM Error │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 72h │Query COM Event Information │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 73h │Query Device Control Block (DCB) │ │ │ │Parameters │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 74h │Query Enhanced Mode Parameters │ ├──────────┼──────────┼────────────────────────────────────────┤ │ 02h │ │Reserved │ ├──────────┼──────────┼────────────────────────────────────────┤ │ 03h │ │Video Control │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 70h │Allocate an LDT Selector │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 71h │Deallocate an LDT Selector │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 72h │Query Pointer Draw Address │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 73h │Initialize Call Vector Table │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 74h │ABIOS Pass-Through │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 75h │Allocate an LDT Selector with Offset │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 76h │Allocate an LDT Selector with Background│ │ │ │Validation Options │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 7Eh │Allocate Video Buffer │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 7Fh │Get Address to ROM Font │ ├──────────┼──────────┼────────────────────────────────────────┤ │ 04h │ │Keyboard Control │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 50h │Set Code Page │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 51h │Set Input Mode (Default ASCII) │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 52h │Set Interim Character Flags │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 53h │Set Shift State │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 54h │Set Typematic Rate and Delay │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 55h │Reserved │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 56h │Set Session Manager Hot Key │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 57h │Set KCB │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 58h │Set Code Page Number │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 59h │Set Read/Peek Notification │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 5Ah │Alter Keyboard LEDs │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 5Bh │Reserved │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 5Ch │Set NLS and Custom Code Page │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 5Dh │Create New Logical Keyboard │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 5Eh │Destroy Logical Keyboard │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 71h │Query Input Mode │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 72h │Query Interim Character Flags │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 73h │Query Shift State │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 74h │Read Character Data Records │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 75h │Peek Character Data Record │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 76h │Query Session Manager Hot Key │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 77h │Query Keyboard Type │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 78h │Query Code Page Number │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 79h │Translate Scan Code to ASCII │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 7Ah │Query Keyboard Hardware ID │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 7Bh │Query Keyboard Code Page Support │ │ │ │Information │ ├──────────┼──────────┼────────────────────────────────────────┤ │ 05h │ │Parallel Port Control │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 42h │Set Frame Control (CPL, LPI) │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 43h │Reserved │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 44h │Set Infinite Retry │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 45h │Reserved │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 46h │Initialize Parallel Port │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 47h │Reserved │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 48h │Activate Font │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 49h │Reserved │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 4Bh │Reserved │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 4Ch │Reserved │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 4Dh │Set Print-Job Title │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 4Eh │Set Parallel Port Write Time-Out Value │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 4Fh │Reserved │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 50h │Reserved │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 51h │Reserved │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 62h │Query Frame Control │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 63h │Reserved │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 64h │Query Infinite Retry │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 65h │Reserved │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 66h │Query Parallel Port Status │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 67h │Reserved │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 68h │Reserved │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 69h │Query Active Font │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 6Ah │Verify Font │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 6Bh │Reserved │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 6Ch │Reserved │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 6Dh │Reserved │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 6Eh │Query Parallel Port Write Time-Out Value│ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 6Fh │Reserved │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 70h │Reserved │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 71h │Reserved │ ├──────────┼──────────┼────────────────────────────────────────┤ │ 06h │ │Light Pen Control │ ├──────────┼──────────┼────────────────────────────────────────┤ │ 07h │ │Mouse Control │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 50h │Reserved │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 51h │Notification of Display Mode Change │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 52h │Reserved │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 53h │Reassign Current Mouse Scaling Factors │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 54h │Assign New Mouse Event Mask │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 55h │Reassign Mouse Threshold Values │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 56h │Set Pointer Shape │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 57h │Unmark Collision Area │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 58h │Mark Collision Area │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 59h │Specify/Replace Pointer Screen Position │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 5Ah │Set OS/2-Mode Pointer Draw Device Driver│ │ │ │Address │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 5Bh │Reserved │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 5Ch │Set Current Physical Mouse Device Driver│ │ │ │Status Flags │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 5Dh │Notification of Mode Switch Completion │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 60h │Query Number of Mouse Buttons Supported │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 61h │Query Mouse Device Motion Sensitivity │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 62h │Query Current Physical Mouse Device │ │ │ │Driver Status Flags │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 63h │Read Mouse Event Queue │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 64h │Query Current Event Queue Status │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 65h │Query Current Mouse Event Mask │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 66h │Query Current Mouse Scaling Factors │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 67h │Query Current Pointer Screen Position │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 68h │Query Current Pointer Shape │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 69h │Query Mouse Threshold Values │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 6Ah │Query Physical Mouse Device Driver │ │ │ │Level/Version │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 6Bh │Query Pointing Device ID │ ├──────────┼──────────┼────────────────────────────────────────┤ │ 08h │ │Logical Disk Control │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 00h │Lock Drive │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 01h │Unlock Drive │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 02h │Redetermine Media (end format) │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 03h │Set Logical Map │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 04h │Begin Format │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 20h │Block Removable │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 21h │Query Logical Map │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 22h │Reserved │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 40h │Removable Media Control │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 43h │Set Device Parameters │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 44h │Write Logical Track │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 45h │Format and Verify Track │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 5Dh │Diskette Control │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 5Eh │Reserved │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 5Fh │Reserved │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 60h │Query Media Sense │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 63h │Query Device Parameters │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 64h │Read Logical Track │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 65h │Verify Logical Track │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 66h │Status │ ├──────────┼──────────┼────────────────────────────────────────┤ │ 09h │ │Physical Disk Control │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 00h │Lock Physical Drive │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 01h │Unlock Physical Drive │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 44h │Write Physical Track │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 63h │Query Physical Device Parameters │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 64h │Read Physical Track │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 65h │Verify Physical Track │ ├──────────┼──────────┼────────────────────────────────────────┤ │ 0Ah │ │Character Device Monitor Control │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 40h │Register Monitor │ ├──────────┼──────────┼────────────────────────────────────────┤ │ 0Bh │ │General Device Control │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 01h │Flush Input Buffer │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 02h │Flush Output Buffer │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 41h │System Notifications for Physical Device│ │ │ │Drivers │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 60h │Query Monitor Support │ ├──────────┼──────────┼────────────────────────────────────────┤ │ 0Ch │ │Advanced Power Management │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 40h │Send Power Event │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 41h │Set Power Event Res │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 42h │Reserved │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 60h │Query Power Status │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 61h │Query Power Event │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 62h │Query PowerInfo │ ├──────────┼──────────┼────────────────────────────────────────┤ │ 0Dh-7Fh│ │Reserved Category Codes │ ├──────────┼──────────┼────────────────────────────────────────┤ │ 80h │ │Screen Control │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 00h │Get Current Video Memory Bank │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 01h │Set Current Video Memory Bank │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 02-07Fh│Reserved │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 08h │Return Adapter Video Configuration │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 09h │Return Manufacturer-Specific Adapter │ │ │ │Data │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 0Ah │Update Adapter Video Information │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 0Bh │Return Linear Address Mapped to Physical│ │ │ │Address │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ │Reserved │ │ │0Ch-07Fh │ │ ├──────────┼──────────┼────────────────────────────────────────┤ │ 80h │ │OEMHLP Controls │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 00h │Query OEM Adaptation Information │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 01h │Query Machine Information │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 02h │Query Display Combination Code │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 03h │Return Video Fonts │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 04h │Read EISA Configuration │ │ │ │Information-Subfunction 00 │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 04h │Read EISA Function │ │ │ │Information-Subfunction 01 │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 05h │Query ROM BIOS Information │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 06h │Query Miscellaneous Video Information │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 07h │Query Video Adapter │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 08h │Query SVGA Information │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 09h │Query Memory Information │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 0Ah │Query, Display Mode, Query, and Set │ │ │ │(DMQS) Information │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 0Bh │Access and Query PCI BIOS Information │ ├──────────┼──────────┼────────────────────────────────────────┤ │ 80h │ │Adapter Presence Check (TESTCFG.SYS) │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 40h │Get Copy of BIOS/Adapter │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 41h │Issue an IN I/O Instruction │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 42h │Issue an OUT I/O Instruction │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 60h │Get Bus Architecture │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 61h │Return all POS IDs │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 62h │Return all EISA IDs │ ├──────────┼──────────┼────────────────────────────────────────┤ │ 80h │ │Resource Manager Commands │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 01h │Get Resource Manager Node Data │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 02h │Enumerate Resource Manager Nodes │ ├──────────┼──────────┼────────────────────────────────────────┤ │ 80h │ │CD-ROM Drive and Disk Control │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 40h │Reset Drive │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 44h │Eject Disk │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 46h │Lock/Unlock Door │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 50h │Seek │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 60h │Device Status │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 61h │Identify CD-ROM Driver │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 63h │Return Sector Size │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 70h │Location of Drive Head │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 72h │Read Long │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 78h │Return Volume Size │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 79h │Get UPC │ ├──────────┼──────────┼────────────────────────────────────────┤ │ 80h │ │High-Resolution Timer Driver │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 00h │Query Version │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 01h │Get Resolution │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 02h │Set Resolution │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 03h │Get Pointer to Clock Counter │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 04h │Free Pointer to Clock Counter │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 05h │Block Until Time Elapses │ ├──────────┼──────────┼────────────────────────────────────────┤ │ 81h │ │CD-ROM Audio Control │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 40h │Audio Channel Control │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 50h │Play Audio │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 51h │Stop Audio │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 52h │Resume Audio │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 60h │Return Audio-Channel Information │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 61h │Return Audio-Disk Information │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 62h │Return Audio-Track Information │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 63h │Return Audio-Subchannel Q Information │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 65h │Return Audio-Status Information │ ├──────────┼──────────┼────────────────────────────────────────┤ │ 81h │ │Touch-Device-Dependent Driver Control │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 50h │Reserved │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 51h │Reserved │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 52h │Set Calibration Constants │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 53h │Read Data │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 54h │Set Data Mode │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 55h │Set Click-Lock Parameters │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 56h │Set Touch Thresholds │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 57h │Set Emulation XY Offset │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 58h │Set Data Report Rate │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 59h │Set Low-Pass Filter │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 5Ah │Write Memory Location │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 5Bh │Reserved │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 5Ch │Reserved │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 5Dh │Reserved │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 5Eh │Reserved │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 5Fh │Reserved │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 60h │Get Calibration Constants │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 61h │Get Data Mode │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 62h │Get Click Lock Parameters │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 63h │Get Touch Thresholds │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 64h │Get Emulation XY Offset │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 65h │Get Data Report Rate │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 66h │Get Low Pass Filter │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 67h │Read Memory Location │ ├──────────┼──────────┼────────────────────────────────────────┤ │ 81h │ │Touch-Device-Independent Driver Control │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 50h │Set Coordinate System │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 51h │Reserved │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 52h │Set Selection Mechanism │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 53h │Set Event Mask │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 54h │Set Queue Size │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 55h │Set Emulation State │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 60h │Set Coordinate System │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 61h │Reserved │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 62h │Get Selection Mechanism │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 63h │Get Event Mask │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 64h │Get Queue Size │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 65h │Get Emulation State │ ├──────────┼──────────┼────────────────────────────────────────┤ │ │ 66h │Get Read Event Queue │ └──────────┴──────────┴────────────────────────────────────────┘
Category 01h ASYNC (RS232-C) Control IOCtl Commands
Whenever an IOCtl command calls for a NULL pointer, it is the responsibility of the application to set one up for the appropriate Parameter or Data Packet pointer before calling the physical device driver. IOCtls can be interpreted differently by future releases if the pointer is not a NULL pointer. If a NULL pointer is called for and it is not received by the device driver, it is considered an invalid Parameter or Data Packet value.
The physical device driver services each communications port (COM1, COM2, and so forth) independently. IOCtls issued to the physical device driver for a given port have no effect on any other communications ports that the physical device driver is servicing. The application cannot assume a given timing relationship between when the IOCtls are executed and when data is received or transmitted by the ASYNC hardware. Data Carrier Detect (DCD) is the same signal as Receiver Line Signal Detect (RLSD).
The following is a summary of the Category 01h IOCtl Commands:
┌──────────┬──────────────────────────────────────────────────┐ │Function │Description │ ├──────────┼──────────────────────────────────────────────────┤ │ 14h │Reserved │ ├──────────┼──────────────────────────────────────────────────┤ │ 34h │Reserved │ ├──────────┼──────────────────────────────────────────────────┤ │ 41h │Set Bit Rate │ ├──────────┼──────────────────────────────────────────────────┤ │ 42h │Set Line Characteristics (stop, parity, data bits)│ ├──────────┼──────────────────────────────────────────────────┤ │ 43h │Extended Set Bit Rate │ ├──────────┼──────────────────────────────────────────────────┤ │ 44h │Transmit Byte Immediate │ ├──────────┼──────────────────────────────────────────────────┤ │ 45h │Set Break OFF │ ├──────────┼──────────────────────────────────────────────────┤ │ 46h │Set Modem Control Signals │ ├──────────┼──────────────────────────────────────────────────┤ │ 47h │Behave as if XOFF Received (stop transmit) │ ├──────────┼──────────────────────────────────────────────────┤ │ 48h │Behave as if XON Received (start transmit) │ ├──────────┼──────────────────────────────────────────────────┤ │ 49h │Reserved │ ├──────────┼──────────────────────────────────────────────────┤ │ 4Bh │Set Break ON │ ├──────────┼──────────────────────────────────────────────────┤ │ 53h │Set Device Control Block (DCB) Parameters │ ├──────────┼──────────────────────────────────────────────────┤ │ 54h │Set Enhanced Mode Parameters │ ├──────────┼──────────────────────────────────────────────────┤ │ 61h │Query Current Bit Rate │ ├──────────┼──────────────────────────────────────────────────┤ │ 62h │Query Line Characteristics │ ├──────────┼──────────────────────────────────────────────────┤ │ 63h │Extended Query Bit Rate │ ├──────────┼──────────────────────────────────────────────────┤ │ 64h │Query COM Status │ ├──────────┼──────────────────────────────────────────────────┤ │ 65h │Query Transmit Data Status │ ├──────────┼──────────────────────────────────────────────────┤ │ 66h │Query Modem Control Output Signals │ ├──────────┼──────────────────────────────────────────────────┤ │ 67h │Query Current Modem Input Signals │ ├──────────┼──────────────────────────────────────────────────┤ │ 68h │Query Number of Characters in Receive Queue │ ├──────────┼──────────────────────────────────────────────────┤ │ 69h │Query Number of Characters in Transmit Queue │ ├──────────┼──────────────────────────────────────────────────┤ │ 6Dh │Query COM Error │ ├──────────┼──────────────────────────────────────────────────┤ │ 72h │Query COM Event Information │ ├──────────┼──────────────────────────────────────────────────┤ │ 73h │Query Device Control Block (DCB) Parameters │ ├──────────┼──────────────────────────────────────────────────┤ │ 74h │Query Enhanced Mode Parameters │ └──────────┴──────────────────────────────────────────────────┘
Asynchronous (RS232-C) Communications Physical Device Driver
The Asynchronous Communications (ASYNC) device driver enables OS/2 applications to utilize the Serial Communications (RS232-C) device hardware. The physical device driver allows an application program in OS/2 session to support duplex communications while the device driver:
- Services the RS232-C port in an interrupt-driven manner
- Provides transmit and receive queues
- Provides different automatic control modes for the modem control signals
- Provides logical data stream flow control (XON/XOFF) for transmit and receive operations
The user will normally want to use the physical ASYNC device driver either in conjunction with the spooler (for serial printers only) or with an application program that uses the RS232-enabling capabilities of the physical ASYNC device driver coupled with a serial device attached to the system.
The user installs the physical ASYNC device driver by adding a DEVICE= statement to the CONFIG.SYS file.
Hardware Support
The RS232-C ASYNC communications device driver supports any personal computer system based on an 80386SX (or higher) microprocessor.
IBM PS/2 Micro Channel Adapter Support
The physical device driver supports a maximum of four ASYNC ports on a maximum of two different interrupt levels. The interrupt levels must have ABIOS support, with one unit per Logical ID (LID) for the ASYNC Device ID. The only ASYNC devices supported on IBM PS/2 and the Extended Industry Standard Architecture (EISA) machines are COM1, COM2, COM3, and COM4. These devices correspond to the first four LIDs in the ABIOS common data area that have the architected ASYNC Device ID. These devices also correspond to the first four ASYNC addresses in the ROM BIOS 40: data area.
If a device has capabilities other than ASYNC that cannot be utilized independently of the ASYNC capabilities (for example, as in the Advanced BIOS separate LID architecture), and if Advanced BIOS assigns the device the ASYNC Device ID, then that device can be used only for ASYNC in that power-on session.
If the device is assigned the ASYNC Device ID, and it has additional capabilities beyond supporting the RS232-C port (for example, a built-in modem), the physical device driver does not recognize those additional capabilities (and potential limitations). Also, the physical device driver does not inform any application program of those additional capabilities or limitations. In addition, it does not limit the control of the RS232-C interface or the device to only those modes that are acceptable to the extended hardware capabilities of that RS232-C port.
If the device is not assigned the ASYNC Device ID, it is not supported by this physical device driver. If an ASYNC device is not supported by the OS/2 operating system, but is recognized by Advanced BIOS as an ASYNC Device ID, the physical device driver can recognize and try to use that unsupported device, if it is COM1, COM2, COM3, or COM4.
AT Bus Adapter Support
The physical device driver for the IBM AT bus machines by default, supports two ASYNC ports, COM1 and COM2, each on separate levels. ASYNC ports with the following base I/O addresses are recognized by the physical device driver:
- 3F8H (must generate a level 4 interrupt)
- 2F8H (must generate a level 3 interrupt)
COM3 and COM4 are supported by the command line parameters for COM.SYS. COM3 and COM4 are supported through parameters on the DEVICE= statement in the CONFIG.SYS file. These parameters specify the desired base I/O address and interrupt levels. The physical ASYNC device driver for the AT- bus machine interfaces directly to the hardware and supports:
- IBM AT-bus serial/parallel adapter based on the NS 16450 Universal Asynchronous Receiver Transmitter (UART) device
- Other compatible adapters based on the UART architecture (NS 16550, NS 16550A)
Attachment Support
The ASYNC physical device driver does not provide any support for devices attached to the RS232-C port. The physical device driver provides enabling support for the RS232-C interface itself. Application programs, subsystems, and systems programs provide the support needed to use devices attached to the RS232-C port.
The ability to support a device can be determined by understanding the level of RS232-C interface enabling support the physical device driver provides, along with the characteristics of the attachment hardware in question and the required functions to be supported.
The OS/2 operating system provides a mechanism where one or more additional drivers can be installed to support specific COM ports. This feature might be required for the following reasons:
- To allow an application program to support a special device not adequately supportable with this ASYNC device driver
- To allow additional COM ports (besides COM1-4 on IBM PS/2) to be supported
- To enhance the level of device driver function for a given COM port (This might be required for certain subsystem support.)
RS232-C Interface
The ASYNC interface consists of separate read and transmit lines. There are two separate modem control signals whose output values can be controlled by the physical device driver:
- Data Terminal Ready (DTR)
- Request To Send (RTS)
There are four separate modem control signals whose input values are available to the physical device driver:
- Data Set Ready (DSR)
- Clear To Send (CTS)
- Data Carrier Detect (DCD), also known as Receive Line Signal Detect (RLSD)
- Ring Indicator (RI)
The receive and transmit data lines have the following hardware characteristics:
- Logical 1 (Marking). More negative than -3 Volts. This state could mean no data.
- Logical 0 (Spacing). More positive than +3 Volts. This state could mean break condition.
The modem control signal lines have the following hardware characteristics:
- Function ON, when more positive than +3 Volts.
- Function OFF, when more negative than -3 Volts.
Hardware Support for Extended Hardware Buffering
This capability is a feature of the asynchronous communications port's serial controller device. Serial controllers that support this capability, such as the NS-16550A UART, are present in many IBM PS/2 systems and on a variety of IBM and non-IBM asynchronous communications adapters.
INS 8250, INS 8250-B Considerations
The following hardware defects cannot be compensated for in the physical device driver and can cause indeterminate function when used with the OS/2 physical ASYNC device driver:
- Line Control Configurations
- These devices are known to transmit bad data when configured for 5 data bits and 1.5 stop bits.
- Receive Character Overrun Errors
- These devices are known to occasionally drop received characters without posting the RECEIVE_OVERRUN error flag. Undetected data loss can result from this hardware deficiency. Application error-correction routines can be implemented to ensure accurate data transmission when these devices are being used.
- Spurious Characters at Power-On
- These devices can transmit a single random character at power-on. The connected device must not be expecting valid data to be received until after the physical device driver initialization routine has been run.
Supported Bit Rates on 16450 and Compatibles
The NS 16450 and other compatible UART devices (including the 8250- and 16550-Series UARTs) incorporate a Programmable Baud Generator feature that is driven as a function of the following constants:
CLOCK = 1843200 ; crystal frequency CLOCK/16 = 115200 ; after divider
Given these constants, the algorithm for determining which rates are supported is explained in the following examples:
- If 900 bps is specified, the bit rate is exactly 900 because it divides evenly into 115200 (115200/900 = 128). Bit rate, returned by IOCtl ASYNC_GETBAUDRATE, is 900.
- If 901 bps is specified, the bit rate does not change, and the IOCtl fails with an invalid parameter error because it cannot be supported within .01% (115200/901 = 128, 115200/128 = 900, which gives a .1111% error).
- If 907 bps is specified, the bit rate is 907.0866 because it can be supported within .01% (115200/907 = 127, 115200/127 = 907.0866, which gives a .0095% error). Bit rate, returned by ASYNC_GETBAUDRATE, is 907.
- If 110 bps is specified, the bit rate is 110.0287, even though the error is over .01% (115200/110 = 1047, 115200/1047 = 110.0287, which gives a .0260% error). Bit rate, returned by ASYNC_GETBAUDRATE, is 110.
- Note
- Where division is performed and the quotient is not a whole integer, an integer result is obtained by rounding off the fractional part of the quotient.
ASYNC (RS232-C) Device Driver Features
The device driver supports the ASYNC interface in an interrupt-driven manner. This allows the multitasking capabilities of the OS/2 operating system to be supported while ASYNC data reception and transmission are taking place.
Warning: With any supported hardware, the physical device driver cannot absolutely guarantee accurate function, as there is a dependency on the hardware being driven. It is known, for example, that INS 8250 and INS 8250-B UART devices exhibit a number of deviations from their hardware specifications. In some cases, these deviations have been compensated for in the physical device driver design. Some of these deviations, however, cannot be resolved in software. The user must be familiar with the limitations and restrictions associated with such hardware.
When data is given to the transmit hardware, it has not yet been physically transmitted (at the RS232 interface). The data is considered completely transmitted by the transmit hardware at the physical RS232 interface when the transmit shift register of the UART is empty. The IOCtl ASYNC_GETLINESTATUS can be used to determine this information.
The device driver transmit queue is a memory buffer between the operating system and the transmit hardware. The device driver receive queue is a memory buffer between the operating system and the receive hardware. Both are considered to be owned by the physical device driver because the physical device driver controls the data movement in and out of the transmit and receive queues. Algorithms for this data movement can change between releases of the physical device driver. Changes in the ASYNC hardware can cause changes in the data movement algorithms and external interfaces.
Data that applications send (made available by Write requests) is placed in the physical device driver transmit queue. When an interrupt occurs to tell the physical device driver that the hardware is ready for more data, the driver gives the transmit hardware more data from the transmit queue.
When an interrupt occurs to tell the physical device driver that the hardware has received data, that data is placed in the physical device driver receive queue. When the physical device driver gets a Read request (READ request packet) from the application, it fills the Read request from the receive queue.
At high bit rates, such as 19200 bits-per-second, a serial device supporting full-duplex asynchronous I/O can generate an interrupt every 260 microseconds (at 10 bits-per-character and one interrupt-per-character transmitted and received). This leads to excessive interrupt-time overhead in the multitasking, interrupt-driven, device driver.
To address this problem, serial devices with Extended Hardware Buffering capabilities (FIFO or First-In-First-Out buffers) have been developed. However, many serially-attached devices that support the RS232-C interface, have been designed to operate with specific protocols that assume the system processes all data I/O one character at a time. The ASYNC physical device driver employs a software mechanism that automatically controls parameters to utilize the Extended Hardware Buffering capability, while compatibly supporting devices that use existing ASYNC device driver protocols.
The Automatic Protocol Override (system default) mode for Extended Hardware Buffering support partially utilizes only these performance advantages, while remaining fully compatible with the behavior of existing ASYNC device driver protocols (for example, Input Sensitivity using DSR). Applications and subsystems can disable certain device driver default settings in order to fully use the Extended Hardware Buffering capabilities. This results in a significant reduction of serial device interrupt processing overhead, and greatly increases the aggregate bit rates that can be supported across multiple active COM ports.
The size of the receive and transmit queues are available from the following IOCtls:
- Query Number of Characters in Receive Queue (ASYNC_GETINQUECOUNT)
- Query Number of Characters in Transmit Queue (ASYNC_GETOUTQUECOUNT)
The physical device driver services each communications port independently. Requests issued to a given port have no effect on any other communications ports that the physical device driver might be servicing. The physical device driver processes READ and WRITE request packets independently for a given port. An application can be written to support simultaneous reception and transmission of data. In addition, the device driver can process an IOCtl request simultaneously with outstanding Read and Write requests.
The physical device driver does not schedule the processing of IOCtl requests. It processes the IOCtl request when received, regardless of what else it is doing. This can cause unexpected results if, for instance, the bit rate is modified while data reception or transmission is taking place. The application should issue only one IOCtl request at a time. If it issues another IOCtl request before the first IOCtl request is completed, the results are UNDEFINED.
The device driver queues multiple READ and WRITE request packets independently and always begins processing the READ request packets in the order they are received. It also begins processing the WRITE request packets in the order they are received.
- Note
- The operating system does not guarantee that file system requests will be delivered to a device driver in the order in which they are issued by an application. This means that a request by one thread can get blocked in the operating system, thus allowing a subsequent request by a different thread for the same function (for example, DosWrite) to pass through and arrive ahead of the first thread at the physical device driver. This is true for synchronous operations performed by multiple threads or asynchronous operations performed by the same thread.
Because of thread-priority considerations and the system dynamics, the order observed by the application of completing requests of the same type might not be the order in which they were received by the device driver. The physical device driver always keeps the data in the same order in which the READ and WRITE request packets (of the same type) were received. There is no ordering or timing between different types of request packets.
The concept of a First Level Open is described in the section on States of the ASYNC Device Driver. A First Level Open occurs when the device driver receives an OPEN request packet for the port and the port is not already open (from a previous open without a matching close). A CLOSE request packet causing the physical device driver to process the next OPEN request packet as a First Level Open is called a Last Level Close. Because the requests that an application issues sometimes get out of order before they reach the device driver, an application cannot consider a close a Last Level Close until the CLOSE completes. If the application issues an Open request to the COM port before a previously issued Close request is completed, then the results are UNDEFINED.
A Flush request can be completed before all the appropriate request packets (which have been queued by the device driver) have been flushed. The appropriate request packets eventually are flushed and return to the caller, based on their priority and the system dynamics. Once the Flush request has been processed, the appropriate request packets do not cause data to be incorrectly transmitted (or received data to be moved).
The device driver supports different timeout processing characteristics and timeout settings for the Read and Write requests. Only the physical device driver is informed of when a given character is being transmitted or received at the hardware interface. Therefore, an application cannot expect to provide real-time flow control of data (in the middle of data transmission or reception) based on logical characters (XON/XOFF), or based on the state of the modem control signals by manually:
- Controlling or monitoring those modem control signals
- Monitoring the queue status
- Monitoring data moving across the link
Alternatively, the physical device driver provides optional modes of operation to control the data flow through the RS232-C port automatically. OS/2 applications use IOCtls to select which protocols are to be made active.
Output Modem Control Signals
In addition to allowing the application to directly control RTS and DTR, the physical device driver has different automatic control modes to control the value of the output modem control signals:
- Open and Close processing of DTR and RTS
- Disable/Enable DTR and RTS
- RTS toggling on transmit
- Input handshaking using DTR and RTS
These control modes are described in the section on States of the ASYNC Device Driver, and in the IOCtls description.
- Note
- The level of support provided by this device driver requires that DTR and RTS are turned on at least once, even if this puts the physical device driver in a mode where they will never be turned on again.
Input Modem Control Signals
Besides allowing the application to read directly the current state of DSR, CTS, DCD, and RI, the physical device driver has automatic modes that cause it to respond to the value that some input modem control signals can have:
- Output handshaking using CTS, DSR, DCD
- Input sensitivity using DSR
These control modes are described in the section on States of the ASYNC Device Driver and in the IOCtls description. Additional information on the state of the input modem control signals is available by using the IOCtl ASYNC_GETCOMMEVENT.
Logical Flow Control (XON/XOFF)
The application can attempt to manually control the flow of data by using the following IOCtls:
- Transmit Immediate (ASYNC_TRANSMITIMM)
- Stop Transmit Behave as if XOFF Received (ASYNC_STOPTRANSMIT)
- Start Transmit Behave as if XON Received (ASYNC_STARTTRANSMIT)
The physical device driver automatically controls the flow of transmitted data based upon the reception of XON/XOFF characters. This is referred to as Automatic Transmit Flow Control (XON/XOFF). The physical device driver also attempts to control the flow of data that is received by automatically transmitting XON/XOFF characters to the system it is communicating with, based on the amount of space left in the receive queue. This is referred to as Automatic Receive Flow Control (XON/XOFF).
Support for Extended Hardware Buffering
Another significant feature of this device driver is its exploitation of the Extended Hardware Buffering capabilities of the serial communications devices in many IBM systems and option adapters. Extended Hardware Buffering refers to the ability of the serial device servicing a COM port to buffer in hardware several characters, and to release them all at one time on the occurrence of a single transmit or receive hardware interrupt. This capability significantly reduces the interrupt-driven I/O processing overhead required to service Transmit and Receive requests on a given COM port. On the devices that support the Extended Hardware Buffering capability, this significantly improves COM I/O throughput and improves data integrity for higher data-transfer rates.
The Extended Hardware Buffering capabilities are automatically controlled under the default modes of the physical ASYNC device driver. Automatic Protocol Override is a feature of the OS/2 ASYNC device driver that automatically controls parameters relating to Extended Hardware Buffering. Systems and Adapters that incorporate the FIFO-mode hardware feature in a manner fully compatible with the NS-16550A UART are automatically enabled to run in Automatic Protocol Override mode.
Line Characteristics
IOCtls can be used to control and read the bit rate, number of stop-bits per character, number of data bits per character, and the parity characteristics of the line. See States of the ASYNC Device Driver.
Break and Error Processing
The device driver can be commanded to transmit a Break with an IOCtl (See IOCtls ASYNC_SETBREAKON and ASYNC_SETBREAKOFF). An application can detect where an error or break occurred in the input data stream by using Break Replacement Character Processing and Error Replacement Character Processing. This requires that certain binary byte combinations be reserved for this purpose.
State of the COM Port
The following IOCtls can be used to determine the state of the COM port or if a given event happened. However, the exact timing relationship between this information and the specific data being received or transmitted at the time of the event is not available.
- Query COM Event Information (ASYNC_GETCOMMEVENT)
- Query COM Status (ASYNC_GETCOMMSTATUS)
- Query COM Error (ASYNC_GETCOMMERROR)
Event Notification
The device driver does not provide any capabilities of event notification. For example, the only way for an application to know that RI changed state or that a Break condition occurred is to poll that status with the IOCtl ASYNC_GETCOMMEVENT. This should not be a problem for those applications that can use the automatic control modes of the physical device driver during the course of a communications dialog (for time-critical control functions). Polling could be adequate for non-time-critical event monitoring.
Error Alert Generation
The ASYNC physical device driver supports SNA Generic Alerts by generating Error Alerts, as defined under the OS/2 Logging Facility. Alerts are generated by the ASYNC driver whenever the OS/2 Logging Facility is enabled by the user at system initialization time.
Alerts may be generated only while the COM port is open and is processing a Write request (transmitting data). Write Timeout mode must be normal. (If Infinite Timeout mode is enabled, timeouts do not occur.) Error Alerts can be generated only when a Write Timeout occurs while waiting for:
- CTS to be asserted, when Transmit is disabled because CTS is inactive. The Output Handshaking Using CTS mode must be enabled for this alert-generating condition to occur. This mode is enabled by default in the physical ASYNC device driver.
- DSR to be asserted, when Transmit is disabled because DSR is inactive. The Output Handshaking Using DSR mode must be enabled for this alert-generating condition to occur. This mode is enabled by default in the physical ASYNC device driver.
- DCD to be asserted, when Transmit is disabled because DCD is inactive. The Output Handshaking Using DCD mode must be enabled for this alert-generating condition to occur. This mode must be enabled by an application. It is not enabled by default in the ASYNC device driver.
- An XON to be received, when Transmit is disabled because an XOFF is received. Automatic Transmit Flow Control mode must be enabled for this alert-generating condition to occur. This mode must be enabled by an application. It is not enabled by default in the ASYNC device driver.
See the Set Device Control Block (DCB) Parameters Note on the IOCtl ASYNC_SETDCBINFO.
States of the ASYNC Device Driver
The different processing states of the physical ASYNC device driver, the ASYNC hardware, and the ASYNC control signals are listed below:
- Automatic Receive Flow Control (XON/XOFF)
- Automatic Transmit Flow Control (XON/XOFF)
- Bit Rate
- Break Replacement Character
- Break Replacement Character Processing
- COM Event WORD and COM Error WORD
- Data Bits
- DTR and RTS
- DTR Control Mode
- Error Replacement Character
- Error Replacement Character Processing
- Extended Hardware Buffering
- Input Sensitivity Using DSR
- Null Stripping
- Output Handshaking Using CTS, DSR, DCD
- Parity
- RTS Control Mode
- Read Timeout State
- Read Timeout Value
- Stop Bits
- Transmit Immediate
- Transmitting Break
- Write Timeout State
- Write Timeout Value
- XON/XOFF Characters
Each of the above states are covered as follows:
- A brief description
- The initial (default) value
- The effect on the physical device driver when the physical device driver receives an OPEN request packet for the port and the port is not already open (from a previous OPEN without a matching CLOSE)
This is called a First Level Open. If applicable, the way the state of the physical device driver is affected by a CLOSE request packet.
- How the MODE utility can be used to alter the state of this item or how the MODE utility will alter the state of this item
- The effect on the physical device driver of the state of Extended Hardware Buffering
In particular, special considerations relating to Automatic Protocol Override are given where the protocol being described is affected by this feature of the physical ASYNC device driver.
Automatic Receive Flow Control (XON/XOFF)
When the physical device driver is enabled for this mode of operation, it transmits an XOFF when its receive queue gets close to full, and an XON when its receive queue is about half full.
The normal mode of Automatic Receive Flow Control causes the ASYNC device driver to stop transmitting all data after it sends an XOFF character until its receive queue lowers to about half full, when it sends the XON character. This behavior is suitable for most devices, but reduces transmit throughput significantly in Full-Duplex (Transmit and Receive) communications scenarios. By setting the Full-Duplex mode of Automatic Receive Flow Control, the physical ASYNC device driver continues to send application data after it sends the XOFF character. See IOCtl ASYNC_SETDCBINFO.
Initial Value | Automatic Receive Flow Control is disabled. |
First Level | Open There is no effect on whether the physical device driver is enabled or disabled for this mode of operation. The state of the physical device driver is reset to show that the last flow control character automatically transmitted was an XON, if it is enabled for this mode of operation. |
Close Considerations | If the last character automatically transmitted by the physical device driver was an XOFF and a CLOSE request packet is received, the physical device driver automatically transmits an XON, if possible. After processing this close request, the port is not open any more from another open without a close. |
Mode Utility | Always disables Automatic Receive Flow Control. |
Automatic Transmit Flow Control (XON/XOFF)
When the physical device driver is enabled for this mode of operation, it stops sending data to the transmit hardware when an XOFF is received, and resumes sending data to the transmit hardware when an XON is received.
If this mode is enabled, Error Alerts can be generated when the OS/2 Logging Facility is enabled. If an external device sends an XOFF, but does not send an XON, transmission of data is blocked because the device driver is waiting for the XON to be received. If the XON is not received before the Write Timeout period expires, an Error Alert is generated.
Initial Value | Automatic Receive Flow Control. |
First Level | Open There is no effect on whether the physical device driver is enabled or disabled for this mode of operation. The state of the physical device driver is reset to show that it has not received an XOFF, so it can transmit (due to automatic transmit flow control), if it is enabled for this mode of operation. |
Automatic Override | When Automatic Transmit Flow Control is enabled, the physical device driver responds to receiving the XOFF within a single character time. That is, Automatic Protocol Override controls the Extended Hardware Buffering capability so that only one character is buffered for transmit at a time, and the device generates an interrupt for every character received (Receive Trigger Level is set to 1). |
Bit Rate
The bit rate determines the hardware setting for the data transfer rate, specified in bits per second, and is the speed for which the hardware is configured. See IOCtls ASYNC_SETBAUDRATE and ASYNC_GETBAUDRATE.
- Initial Value
- 1200 bps
- First Level
- Open No effect
- Mode Utility
- User interface to change the bit rate
Break Replacement Character
The device driver uses this character value if Break Replacement Character Processing is enabled. See IOCtl ASYNC_SETDCBINFO.
- Initial Value
- 00h
- First Level
- Open Reset to 00h
- Mode Utility
- No effect
Break Replacement Character Processing
If Break Replacement Character Processing is enabled and the device driver detects a break condition, it places the break replacement character in the physical device driver receive queue. If Break Replacement Character Processing is disabled, the physical device driver does not place any character in the physical device driver receive queue when it detects a break condition.
- Initial Value
- Break replacement character processing is disabled
- First Level
- Open Break replacement character processing is disabled
- Mode Utility
- No effect
COM Event WORD and COM Error WORD
These two WORDs have bits that show the status of the COM port. When an event occurs, the appropriate bits are turned on. The bits are cleared when the WORD is read with the appropriate IOCtl. See IOCtls ASYNC_GETCOMMEVENT and ASYNC_GETCOMMERROR.
- Initial Value
- All defined bits are 0
- First Level
- Open All defined bits are 0
- Mode Utility
- Not applicable
Data Bits
This is the number of bits contained in each character transmitted or received by way of the communications hardware. See IOCtls ASYNC_SETLINECTRL and ASYNC_GETLINECTRL.
- Initial Value
- 7 data bits
- First Level
- Open No effect
- Mode Utility
- User interface to change the number of data bits
DTR and RTS
This is the value of the modem control signals Data Terminal Ready (DTR) and Request To Send (RTS) put out by the communications hardware. Each signal is controlled independently and can be either ON or OFF. See IOCtls ASYNC_SETMODEMCTRL and ASYNC_GETMODEMOUTPUT.
- Initial Value
- When the physical device driver starts the port during device driver initialization, their values are turned OFF.
- First Level
- Open The signals are normally turned ON, but there are many conditions that can cause the signals to be affected differently. See IOCtls ASYNC_SETMODEMCTRL and ASYNC_SETDCBINFO for a complete explanation.
- Close Considerations
- A Close request packet causes DTR and RTS to be turned OFF after the transmit hardware has completely transmitted all the data sent by the physical device driver. After processing this Close request, the port is no longer open from another OPEN without a CLOSE. In addition, at least 10 additional character times must have elapsed (or one second, whichever is less).
- Mode Utility
- Not applicable for direct control. Indirect effects through altering processing modes of the physical device driver are possible.
DTR Control Mode
The control modes for DTR are:
- Enable
- Disable
- Input Handshaking
The Enable and Disable control modes of DTR affect DTR processing during a First Level Open. When these control modes are set through IOCtl ASYNC_SETDCBINFO, the value of the DTR signal can be modified immediately by the physical device driver. The action depends on the previous control mode of DTR and the current value of the DTR modem control signal. If the control mode of DTR is Input Handshaking, then the device driver controls the DTR signal, depending on how full the receive queue is. The bits that control these states of the device driver are in the device control block.
- Initial Value
- Enable
- First Level
- Open No effect
- Mode Utility
- User interface to change the DTR Control Mode of the physical device driver
Error Replacement Character
The character value that the physical device driver uses, if Error Replacement Character Processing is enabled.
- Initial Value
- 00h
- First Level
- Open Reset to 00h
- Mode Utility
- No effect
Error Replacement Character Processing
The processing that the physical device driver performs when a received character has an error (parity, framing, overrun, or lack of receive queue space) is determined by whether Error Replacement Character Processing is enabled (active).
- Initial Value
- Error replacement character processing is disabled
- First Level
- Open Error replacement character processing is disabled
- Mode Utility
- No effect
Extended Hardware Buffering
The extended hardware buffering (FIFO-mode) capabilities available in supported systems apply to the NS-16550A UART device and other fully compatible devices. These serial devices are installed on many IBM PS/2 system boards, and on various ASYNC communications adapter options. Refer to Hardware Support for Extended Hardware Buffering.
On those systems that incorporate serial devices that fully and compatibly support Extended Hardware Buffering, the OS/2 ASYNC device driver provides three modes for exploiting this feature:
- Enabled
- Disabled
- Automatic Protocol Override
The default is to enable Automatic Protocol Override on that COM port. Automatic Protocol Override is an asynchronous device driver mode of operation that automatically controls various parameters of Extended Hardware Buffering, such as Receive Trigger Level and Transmit Buffer Load Count.
Automatic Protocol Override causes the Receive Trigger Level and Transmit Buffer Load Count to be adjusted according to the device driver handshaking protocols in effect. When Automatic Protocol Override mode is ON and the handshaking protocols are set to their default settings, the physical device driver partially exploits only the performance advantages of Extended Hardware Buffering. The default handshaking protocols are:
- Enabled for Input Sensitivity Using DSR
- Enabled for Output Handshaking Using CTS and DSR
- Disabled for Output Handshaking Using DCD
- Disabled for Automatic Transmit Flow Control
If both Input Sensitivity Using DSR and Output Handshaking Using CTS and DSR are disabled, the Automatic Protocol Override causes the asynchronous device driver to automatically reset internal parameters (fully exploiting the Extended Hardware Buffering capabilities to the maximum extent possible).
The physical device driver's initialization default is to set Extended Hardware Buffering capabilities to the Automatic Protocol Override mode. An application or subsystem can alternatively set Extended Hardware Buffering to DISABLED, which causes the hardware to service transmit and receive interrupts one character at a time. It can also set Extended Hardware Buffering to ENABLED, which causes the physical device driver to set certain Extended Hardware Buffering parameters to specified levels, so the serial device fully exploits its Extended Hardware Buffering capabilities to the maximum extent possible.
When Extended Hardware Buffering is set to ENABLED, the following serial device hardware capabilities are exploited for maximum performance benefit and increased receive data integrity:
- By setting the Transmit Buffer Load Count to 16, up to 16 characters are placed in the transmit hardware buffer (FIFO) during the processing of one Transmit Holding Register Empty (THRE) interrupt.
- A 16-character receive hardware buffer (FIFO) is available with the Receive Trigger Level set to 1, 4, 8, or 14 characters. The Receive Trigger Level determines when the receive hardware generates a Receive Data Available hardware interrupt.
If the physical device driver receives an Open request for a COM port that is not already open, it does not alter the Extended Hardware Buffering setting that is in effect at the time. The ASYNC physical device driver preserves this state across multiple Open and Close requests.
- Initial Value
- Automatic Protocol Override mode is on
- First Level
- Open No effect
- Mode Utility
- User interface to set the Extended Hardware Buffering mode to ENABLED, DISABLED, or to Automatic Protocol Override
Input Sensitivity Using DSR
When the physical device driver is enabled for this mode of operation and DSR is OFF, the physical device driver discards receive data.
- Initial Value
- Input Sensitivity using DSR is enabled
- First Level
- Open No effect
- Mode Utility
- User interface to enable/disable this mode of the physical device driver
- Automatic Override
- When Input Sensitivity Using DSR is enabled, the physical device driver responds to the lowering of the DSR line within a single character time. That is, the Extended Hardware Buffering (Receive Trigger Level) is adjusted so the device generates an interrupt for each character received. The full 16-character receive buffer is still available to help avoid any receive hardware overruns. The Transmit FIFO feature is also still enabled so that only one transmit interrupt occurs for every 16 characters transmitted.
- Note
- : In situations where DSR can naturally drop from O to OFF at the end of a communications session, but is not normally toggled during the session, it is most advantageous to disable Input Sensitivity Using DSR after the communications data transfer has begun. This achieves a significant performance benefit (under the control of Automatic Protocol Override), without the risk of losing valid data upon termination of the session. If, however, the DSR signal is expected to toggle frequently during a communications session, Input Sensitivity Using DSR should not be disabled, or potential data loss can result.
Null Stripping
If the physical device driver is enabled for null stripping, characters read in from the receive hardware (nonerror or nonbreak) with a value of 00h are thrown away. These null characters are stripped (not checked for Automatic Transmit Flow Control), even if the XON or XOFF character has been set to 00h, and are not placed in the physical device driver receive queue.
- Initial Value
- Null stripping is disabled
- First Level
- Open Null stripping is disabled
- Mode Utility
- No effect
Output Handshaking Using CTS, DSR, DCD
This mode of the physical device driver can be controlled independently for each modem control signal. When this mode is enabled, the physical device driver does not give data to the transmit hardware if the modem control signals are OFF (disabled). Data is not transmitted unless all the lines enabled for output handshaking are up.
If one of these modes is enabled, Error Alerts might be generated when the OS/2 Logging Facility is enabled. If an external device causes CTS, DCD, or DSR to become inactive, transmission is blocked while the device driver waits for the respective line to become active again. If the line does not become active before the Write Timeout period expires, an Error Alert is generated.
Initial Value Output handshaking using CTS and DSR is enabled. Output handshaking using DCD is disabled.
- First Level
- Open No effect.
- Mode Utility
- User interface to enable/disable this mode of the physical device driver for CTS and DSR (independently). Mode always disables this mode of operation of the physical device driver for DCD.
- Automatic Override
- When Output Handshaking using DSR, CTS, or DCD is enabled, the physical device driver responds to the dropping modem line within a single character time. That is, Automatic Protocol Override controls the Extended Hardware Buffering capability so that only one character at a time is given to the transmit hardware (Transmit Buffer Load Count is set to 1). The Receive Trigger Level is unaffected.
Parity
Determines whether a parity bit exists and, if appropriate, what algorithm determines its value. See IOCtls ASYNC_SETLINECTRL and ASYNC_GETLINECTRL.
- Initial Value
- Even parity
- First Level
- Open No effect
- Mode Utility
- User interface to change the parity characteristics
RTS Control Mode
The control modes for RTS are:
- Enable
- Disable
- Input Handshaking
- Toggling on Transmit
The Enable and Disable control modes affect RTS processing during a First Level Open. When these control modes are set using IOCtl ASYNC_SETDCBINFO, the value of the RTS signal can be immediately modified by the physical device driver. The action depends on the previous control mode of RTS and the current value of the RTS modem control signal. If the control mode of RTS is Input Handshaking, the device driver controls the RTS signal, depending on how full the receive queue is. If the control mode of RTS is Toggling on Transmit, then the physical device driver controls the RTS signal, depending on whether it is transmitting data. The bits that control these states of the physical device driver are in the device control block.
- Initial Value
- Enable
- First Level
- Open No effect
- Mode Utility
- User interface to change the RTS Control Mode of the physical device driver
Read Timeout State
When the physical device driver processes a READ request packet, it can be with Normal, No-Wait, or Wait-For-Something Timeout processing. With Normal Timeout processing, if no data is received in the specified period of time, the request is completed. With No-Wait Timeout processing, the request obtains whatever data is available in the physical device driver receive queue (at the time the request is processed by the device driver) and returns. With Wait-For-Something Timeout processing, the request acts like No-Wait Timeout processing. However, if no data is available when the device driver processes the request, the physical device driver waits until some data is available or until the request times out due to Normal Timeout processing.
- Initial Value
- Normal Read Timeout processing
- First Level Open
- The device driver is set to Normal Read Timeout processing
- Mode Utility
- No effect
Read Timeout Value
The user-specific value, in .01 seconds units (based on 0, where 0 = .01 seconds), is used for the Read Timeout processing, if Normal Read Timeout or Wait For Something Timeout processing is enabled.
- Initial Value
- 1 minute
- First Level Open
- Set to 1 minute
- Mode Utility
- No effect
Stop Bits
Determines the number of stop bits associated with each character transmitted or received by way of the communications hardware.
- Initial Value
- 1 stop bit
- First Level Open_ No effect
- Mode Utility
- User interface to change the number of stop bits
Transmit Immediate
The device driver can be told to transmit a byte immediately, bypassing the normal file system Write requests (bypassing the data to be transmitted in the transmit queue). Only one character at a time can be waiting to be transmitted immediately.
- Initial Value
- There is no character waiting to be transmitted immediately.
- First Level Open
- There is no character waiting to be transmitted immediately.
- Close Considerations
- A CLOSE request packet, when after processing this close request the port is not open any more (from another open without a close), causes the device driver to attempt to transmit the character waiting to be transmitted immediately. If the physical device driver cannot transmit the character waiting to be transmitted immediately (see IOCtl ASYNC_TRANSMITIMM), it does not try to transmit the character and proceeds with the close processing.
- Mode Utility
- Not applicable.
Transmitting Break
The device driver can be transmitting a break. See IOCtls ASYNC_SETBREAKON and ASYNC_SETBREAKOFF.
- Initial Value
- Not transmitting a break
- Close Considerations
- A CLOSE request packet, when after processing this close request the port is not open any more (from another open without a close), causes the device driver to tell the hardware not to transmit a break any more
- Mode Utility
- Not applicable
Write Timeout State
When the physical device driver processes a WRITE request packet, it can be with Normal or Infinite Timeout processing. With Normal Timeout processing if no data is given to the transmit hardware within a specified amount of time, the request is completed. With Infinite Timeout processing, the request is completed only when all the data from the request has been given to the transmit hardware.
Error Alerts can be generated on the occurrence of Write Timeout, if the OS/2 Logging Facility is enabled. In order for an error alert to be generated by the physical ASYNC device driver, the appropriate mode of operation must be enabled.
- Initial Value
- Normal Write Timeout processing
- First Level Open
- No effect on Write Timeout processing
- Mode Utility
- User interface to set Infinite or Normal Write Timeout processing
Write Timeout Value
XON/XOFF Characters
Reserved Device Names (COM1-n)
IBM PS/2 (with Micro Channel) Considerations for COM1-4
====Initialization/Resource Management