## Physical Device Driver Reference

[prev][next][parent][TOC]

### Application I/O to Devices

The primary interface to a physical device driver is the OS/2 request packet interface. File I/O and IOCtl requests from OS/2 applications and INT 21h requests from DOS applications running in a DOS session are translated into request packets that are sent to the physical device driver for processing. The actual format of these request packets is discussed in OS/2 Physical Device Driver Design Issues.

OS/2 device drivers are the standard interface for applications to use for manipulating devices. However, if this interface is insufficient, both OS/ 2 and DOS applications can:

Access a device directly by sending data to, or receiving data from, a specific port address through I/O instructions. Notice that 32-bit protect -mode applications cannot issue I/O. Only 16-bit protect-mode applications can issue I/O from the Ring 2 code segment.

Manipulate the state of the hardware interrupts (disable/enable interrupts ) through CLI/STI instructions.

Any DOS application can perform direct register I/O with a device from its code segment. OS/2 applications and subsystems can perform direct register I/O only through IOPL code segments. For DOS applications, I/O direct to the hardware is dependent on which virtual device driver is installed. The virtual device driver can register and hook the particular port for I/O. If a virtual device driver hooks a particular port, subsequent direct access to that particular port will be trapped by the virtual device driver .

The following figure illustrates how DOS and OS/2 applications communicate with a device.