Jump to content

PDDREF:Generic IOCtl Commands

From EDM2
Physical Device Driver Reference
  1. Introduction
  2. Physical Device Driver Overview
  3. Physical Device Driver Architecture and Structure
  4. OS/2 Physical Device Driver Operations
  5. OS/2 Physical Device Driver Design Issues
  6. Character Device Monitors
  7. Installation of External Loadable Device Drivers
  8. Physical Device Driver Strategy Commands
  9. Device Helper (DevHlp) Services
  10. Resource Management
  11. Linking Resource Manager Services
  12. Generic IOCtl Commands
Appendixes
OS/2 Version Compatibility Considerations
Running OS/2 Version 1.3 16-Bit PDDs on OS/2
Using Advanced Bios
Notices
Glossary

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 Example

The DosDevIOCtl function sends the request to the physical device driver request packet. The physical device driver receives the request packet, and looks for the Command Code (Command 16 is the generic IOCtl command) to identify the request. Notice that each device driver can define the structure of the Data Packet and the Parameter Packet, but all device drivers use the same request header.

The 16-bit calling sequence for DosDevIOCtl is shown below:

EXTRN   DosDevIOCtl:Far

PUSH@   OTHER  Data        ; Data Packet address
PUSH@   OTHER  ParmList    ; Parameter Packet address
PUSH    WORD   Function    ; Function code
PUSH    WORD   Category    ; Category code
PUSH    WORD   DevHandle   ; User's device driver file handle

CALL    DosDevIOCtl

The 32-bit calling sequence for DosDevIOCtl is shown below:

PUSH@   DWORD  DataLengthInOut   ; Data Length Address
PUSH    DWORD  DataLengthMAX     ; Max size of Data Packet
PUSH@   OTHER  Data              ; Data Packet Address
PUSH@   DWORD  ParmLengthInOut   ; Parm Length Address
PUSH    DWORD  ParmLengthMax     ; Max size of Parm List
PUSH@   OTHER  ParmList          ; Parameter Packet Address
PUSH    DWORD  Function          ; Function Code
PUSH    DWORD  Category          ; Category Code
PUSH    DWORD  DevHandle         ; User's device driver file handle

Call DOSDevIOCtl

DosDevIOCtl2 performs the same function as DosDevIOCtl, and also provides Length fields for the Data and Parameter List buffers. These Length fields should be passed to the Device Helper service VerifyAccess when the physical device driver is determining whether it has access to the application's Data and Parameter List buffers. The Length fields also tell physical network device drivers the amount of data residing in these buffers for the transfer to other network nodes.

The 16-bit calling sequence for DosDevIOCtl2 is shown below:

EXTRN   DosDevIOCtl2:Far

PUSH@   OTHER  Data        ; Data Packet address
PUSH    WORD   DataLength  ; Data Packet length
PUSH@   OTHER  ParmList    ; Parameter Packet address
PUSH    WORD   ParmLength  ; Parameter Packet length
PUSH    WORD   Function    ; Function code
PUSH    WORD   Category    ; Category code
PUSH    WORD   DevHandle   ; User's device driver file handle

CALL    DosDevIOCtl2

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
             52h    Set Parallel Port Communication Mode
             53h    Set Parallel Port Data Transfer Mode
             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
             72h    Query Parallel Port Communication Mode
             73h    Query Parallel Port Data Transfer Mode
             74h    Query Parallel Port Device ID
    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/Read/Verify Track
             45h    Format and Verify Track
             5Dh    Diskette Control
             5Eh    Reserved
             5Fh    Reserved
             60h    Query Media Sense
             63h    Query Device Parameters
             66h    Status
    09h             Physical Disk Control
             00h    Lock Physical Drive
             01h    Unlock Physical Drive
             44h    Physical Write Track
             63h    Query Physical Device Parameters
             64h    Physical Read Track
             65h    Physical Verify 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
          0Ch-07Fh  Reserved
    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 PCI BIOS
             0Bh    Query PCI BIOS - Subfunction 00h
             0Bh    Find PCI Device - Subfunction 01h
             0Bh    Find PCI Class Code - Subfunction 02h
             0Bh    Read PCI Configuration Space - Subfunction 03h
             0Bh    Write PCI Configuration Space - Subfunction 04h
    80h             TESTCFG.SYS
             40h    Obtain a Copy of BIOS/Adapter Memory
             41h    Issue an "IN" I/O Instruction
             42h    Issue an "OUT" I/O Instruction
             60h    Query Bus Architecture Function
             61h    Return All POS IDs
             62h    Return All EISA IDs
    80h             Resource Manager
             01h    Get Resource Manager Node Information
             02h    Enumerate Resource Manager Nodes
    80h             CD-ROM Drive and Disc Control
             40h    Reset Drive
             44h    Eject Disk
             45h    Close Tray
             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
    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-Disc 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                    ³

Category 03h Video Control IOCtl Commands

The following is a summary of the Category 03h Video Control IOCtl Commands:

Function  Description
³   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                           ³

Category 04h Keyboard Control IOCtl Commands

The following is a summary of the Category 04h IOCtl Commands:

Function  Description

³   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 a New Logical Keyboard                     ³
³   5Eh    ³Destroy a 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      ³

Category 05h Parallel Port Control IOCtl Commands

The following is a summary of Category 05h IOCtl Commands:

³Function  ³Description                                       ³
³   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 Timeout Value             ³
³   4Fh    ³Reserved                                          ³
³   50h    ³Reserved                                          ³
³   51h    ³Reserved                                          ³
³   52h    ³Set Parallel Port Communication Mode              ³
³   53h    ³Set Parallel Port Data Transfer Mode              ³
³   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 Timeout Value           ³
³   6Fh    ³Reserved                                          ³
³   70h    ³Reserved                                          ³
³   71h    ³Reserved                                          ³
³   72h    ³Query Parallel Port Communication Mode            ³
³   73h    ³Query Parallel Port Data Transfer Mode            ³
³   74h    ³Query Parallel Port Device ID                     ³

Category 07h Mouse Control IOCtl Commands

The following is a summary of Category 07h IOCtl Commands:

Function  ³Description
   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  ³
³          ³Number                                            ³
   6Bh    ³Query Pointing Device ID

Category 08h Logical Disk Control IOCtl Commands

The following is a summary of Category 08h IOCtl Commands:

ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³Function            ³Description                             ³
   00h              ³Lock Drive                              ³
   01h              ³Unlock Drive                            ³
   02h              ³Redetermine Media                       ³
   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

Category 09h Physical Disk Control IOCtl Commands

Category 09h is used to access physical partitionable hard disks. The handle used for Category 09h command is returned by the DosPhysicalDisk (Function 2) API function. (See the OS/2 Control Program Programming Reference for more information). This handle is used to tell the system which physical disk is accessed by the IOCtl command.

The Physical Disk Control commands relate to the entire partitionable hard disk. Direct track and sector I/O start at the beginning of the physical drive. PDSK_GETPHYSDEVICEPARAMS, describes the entire physical device.

The following is a summary of Category 09h IOCtl Commands:

Function       Description
   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

Category 0Ah Character Device Monitor IOCtl Command

The following is the Category 0Ah IOCtl Command:

Function  Description
   40h    Register Monitor

Category 0Bh General Device Control IOCtl Commands

The following is a summary of Category 0Bh IOCtl Commands:

Function  Description
   01h    Flush Input Buffer
   02h    Flush Output Buffer
   41h    System Notifications for Physical Device Drivers
   60h    Query Monitor Support

Category 0Ch Advanced Power Management

Function  Description
40h       Send Power Event
41h       Set Power Event Resource
42h - 44h Reserved
45h       OEM APM Function
60h       Query Power Status
61h       Query Power Event
62h       Query Power Information
63h       Query Power State

Category 80h Screen Control IOCtl Commands

The following video IOCtls are defined and supported by the SCREENDD$ device driver, by way of the DosDevIOCtl call. The IOCtl category code is 80h (defined as SCREENDD_CATEGORY).

The function codes within the SCREENDD_CATEGORY are:

Function  Description
00h       Get Current Video Memory Bank
01h       Set Current Video Memory Bank
02h-07h   Reserved
08h       Return Adapter Video Configuration
09h       Return Manufacturer-Specific Adapter Data
0Ah       Update Adapter Video Memory Information
0Bh       Return Linear Address Mapped to Physical Address
0Ch-7Fh   Reserved

An example of the DosDevIOCtl calling convention for the Screen IOCtls follows:

int PASCAL near videoIoctl(VOID *data,VOID *parm,USHORT function)
{
  unsigned hScreenDD;                  /* handle of SCREENDD$ dev driver */
  unsigned OpenAction;                 /* action taken to open device    */
  unsigned rc;                         /* function return code           */

  if (!(rc = DosOpen(SCREENDD_NAME, (PHFILE)&hScreenDD, (PUSHORT)&OpenAction,
     NO_SIZE, NO_ATTRIBUTES, OPEN_IF_EXISTS, NO_INHERIT+DENY_NONE+READ_WRITE,
     RESERVED_LONG)))
  {
    rc = DosDevIOCtl(data,
                     parm,
                     function,
                     SCREENDD_CATEGORY,
                     (HFILE)hScreenDD);
    DosClose(hScreenDD);
  }
  return (rc);

Category 80h OEMHLP IOCtls

The OEMHLP interface was originally designed to allow Original Equipment Manufacturers (OEMs) to modify and adapt the OS/2 operating system to run on their hardware. In the past, IBM supported the OS/2 operating system on IBM hardware only. Therefore, OEMs had to build modified versions of the OS/2 operating system. The OEMHLP interface facilitated this process.

IBM currently tests the OS/2 operating system on a wide variety of OEM hardware. It is no longer necessary for OEMs to adapt the OS/2 operating system to their machines. Now the OEMHLP interface can be used to obtain real-mode information. This information can be passed to applications and device drivers running in protect mode. Applications and physical device drivers running in protect mode cannot access BIOS through the INT interface. The OEMHLP interface allows access to BIOS information and functions that are essential to these programs.

For example, you might want to issue INT 15h calls from your device driver initialization code to determine if an Extended Industry Standard Architecture (EISA) adapter is present. The following examples show the methods to determine if a specific EISA or Micro Channel adapter is present.

Using the Query Adapter ID to Verify EISA Adapter

The following example uses the OEMHLP IOCtl interface to verify the EISA card ID:

USHORT FindMyEISACard(void)
{
  HFILE filehandle;
  USHORT action;

  EISAFunctionInfo.efi_SubFunc = OEM_GET_SLOT_INFO; /* EISA Get Slot Info */
  EISAFunctionInfo.efi_Slot    = 0;                 /* Slot 0             */

  rc = DosOpen("OEMHLP$",
               &filehandle,
               &action,
               0L,
               0,
               1,
               0x40,
               0L);
  if (rc == 0)
    {
    for(index=1;index<CFG_MAX_EISA_SLOTS;index++)   /* For each slot      */
      {
      EISAFunctionInfo.efi_Slot    = (UCHAR) index; /* Slot Number        */
      EISASlotInfo.esi_CardID  = 0;                 /* Reset Card ID value*/
      rc = DosDevIOCtl((PVOID)&EISASlotInfo,        /* Data Packet */
                       (PVOID)&EISAFunctionInfo,    /* Parm Packet */
                       (USHORT)OEMHLP_QUERYEISACONFIG,
                       (USHORT)OEMHLP_CATEGORY,
                       (HFILE)filehandle);
      /* If IOCtl successful and slot has adapter, then store away
         the adapter ID, otherwise mark as empty with a zero.
       */
      if((rc==0)&&(EISASlotInfo.esi_Error==0))
        {
        if (EISASlotInfo.esi_CardID == MYCARDID)
           DosClose(filehandle);        /* Close handle to OEMHLP$ */
           return(FOUND);
        }
      }
      DosClose(filehandle);             /* Close handle to OEMHLP$ */
    }
   return(NOTFOUND);
}
Using the DevHlp_ABIOSCall to Verify Micro Channel Adapter

The following example uses the DevHlp_ABIOSCall to verify the Micro Channel POS ID:

USHORT FindMyMicroChannelCard(void)
{
  USHORT i,rc;             /* Index and return code    */
  USHORT LID;              /* Logical ID               */

  if (GetLIDEntry(POS,0,1,&LID))
     return(NOTFOUND);

  /* Get length of RB to use for reading POS data. */

  POSLenRB.rb.RBLen = sizeof(POSLENRB);
  POSLenRB.rb.Func  = 0x01;
  POSLenRB.rb.LID   = LID;
  POSLenRB.rb.Unit  = 0;
  POSLenRB.rb.Resv1 = 0;
  POSLenRB.rb.Resv2 = 0;
  POSLenRB.Rsv1     = 0;
  POSLenRB.Rsv2     = 0;
  POSLenRB.Rsv3     = 0;
  rc = ABIOSCall( LID, &POSLenRB, 0);

  /*Is my request block big enough? */

  if ((rc==0) && (sizeof(POSRB) >= POSLenRB.RBLen))
     {
       RB.rb.RBLen = POSLenRB.RBLen;       /* request block length        */
       RB.rb.Func  = 0x0b;                 /* read stored POS data to mem */
       RB.rb.LID   = LID;                  /* Logical ID                  */
       RB.rb.Unit  = 0;
       RB.DataBuf  = (ULONG)(FARPOINTER)&POSData;

       for(i=0;i<=CFG_MAX_POS_SLOTS;i++)   /* For each slot, get POS ID   */
          {
           RB.Slot = (UCHAR)i;
           rc = ABIOSCall(LID,&RB,0);
           if((rc==0)&&(RB.rb.RetCode==0))
             if (RB.AdapterID == MYCARD)
                {
                  FreeLIDEntry(LID);
                  return(FOUND);
                }
          }
     }

  FreeLIDEntry(LID);             /* Release LID Entry */
  return(NOTFOUND);
}
OEMHLP IOCtls Summary

The following is a summary of Category 80h OEMHLP IOCtl Commands:

Function  Description
00h       Query OEM Adaptation Information
01h       Query Machine Information
02h       Query Display Combination Code
03h       Return Video Fonts
04h       Read EISA Slot Configuration Information     - Subfunction 00
04h       Read EISA Function Configuration 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 PCI BIOS Information
0Bh       Query PCI BIOS Information - Subfunction 00h
0Bh       Find PCI Device - Subfunction 01h
0Bh       Find PCI Class Code - Subfunction 02h
0Bh       Read PCI Configuration Space - Subfunction 03h
0Bh       Write PCI Configuration Space - Subfunction 04h

Category 80h Adapter Presence-Check Services (TESTCFG.SYS)

The TESTCFG device driver provides services for automatic detection of Original Equipment Manufacturer (OEM) hardware interfaces. Functions provided by this driver are accessed entirely by opening the device name TESTCFG$ and using the following Category 80h IOCtls.

Function  Description
40H       Get Copy of BIOS/Adapter Memory
41H       Issue an "IN" I/O Instruction
42H       Issue an "OUT" I/O Instruction
60H       Get Bus Architecture Function
61H       Return All POS IDs
62H       Return All EISA IDs

Category 80h Resource Manager IOCtl Commands

RESOURCE.SYS provides two IOCtls that allow a ring 3 application to obtain a "snapshot" of the Resource Management data structures. Obtaining a snapshot of the Resource Management data structures consists of the following two steps:

1.- A data structure representing a depth-first traversal of the Resource Manager node structure is obtained.

2.- For each node traversed, the following information is provided:

  • A Resource Manager handle to access the node.
  • The depth of the node in the tree structure.

3.- A copy of each Resource Manager node can be obtained by supplying the node handle returned in Step 1.

  Function  Description
  01h       Get Resource Manager Node Data
  02h       Enumerate Resource Manager Nodes

Category 80h CD-ROM Drive and Disc IOCtl Commands

The OS/2 CD-ROM Device Manager provides an interface through generic IOCtls.

The CD-ROM device driver returns error values in the range of hex FF00 through FF14. DOS DevIOCtl return codes are described in the OS/2 Programming Reference manuals.

Function  Description
40h       Reset Drive
44h       Eject Disc
45h       Close Tray
46h       Lock/Unlock Door
50h       Seek
60h       Return Device Status
61h       Identify CD-ROM Driver
63h       Return Sector Size
70h       Report Location of Drive Head
72h       Read Long
78h       Return Volume Size
79h       Get UPC

Category 81h CD-ROM Audio IOCtl Commands

The OS/2 CD-ROM Device Manager provides an interface through generic IOCtls.

The CD-ROM device driver returns error values in the range of hex FF00 through FF14. DOSDevIOCtl return codes are described in the OS/2 Programming Reference manuals.

Function  Description
40h       Set 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

Category 81h Touch Device-Dependent Driver

All Touch device driver IOCtl commands share Category 81h commands, which are distinguished by the device name used in the device Open (PDITOU$ for the device-dependent driver, TOUCH$ for the device-independent driver).

Device-Dependent Device Driver Command Summary

The following table describes the Category 81h Touch Device-Dependent Driver IOCtl commands:

Function Description
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

Category 81h Touch Device-Independent Driver

All Touch device driver IOCtl commands share Category 81h commands, which are distinguished by the device name used in the device Open (PDITOU$ for the device-dependent driver, TOUCH$ for the device-independent driver).

The following lists and describes the Category 81h Touch Device-Independent Driver:

Function Description
50h       Set Coordinate System
51h       Reserved
52h       Set Selection Mechanism
53h       Set Event Mask
54h       Set Queue Size
55h       Set Emulation State
60h       Get 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