site logo  PDDHeader

HomePage | Categories |* BLOG *| RecentChanges | RecentlyCommented | Login/Register

Physical Device Driver Header


The first data segment of a physical device driver must contain a device header as the first item. The structure of a physical device driver header is shown in the following table.

Field Length
Far Pointer to Next Device Header DWORD
Device Attribute WORD
16 Bit Offset to Strategy Routine WORD
16 Bit Offset to IDC Entry Point WORD
Driver Name or Units (if block device) 8 BYTES
Reserved 8 BYTES
Capabilities Bit Strip (only in level 3 device driver) DWORD


Next Device Pointer

This pointer is set at the time the physical device driver is loaded. This field should be set to -1.

Note: For a character device driver that supports multiple devices, the data segment must contain a device header for each device. These headers must be linked together and the link pointer in the last header must be set to -1. The first WORD is an offset; the second WORD is the segment.

Device Attribute Field

Describes the characteristics of the physical device driver to the system. The format of the OS/2 device attribute field is:

devatt
The attributes are:

CHR (Bit 15) Set, if the physical device driver operates in character mode. Bit 15 is the device type bit. Use bit 15 to tell the system if the device driver is a block or character device. For block device drivers, bit 15 is 0. For character device drivers, bit 15 is 1.

IDC (Bit 14) Set, if the physical device driver participates in inter-device-driver communication (IDC). Bit 14 is the IDC bit and indicates that the offset to the IDC entry point in the physical device driver header is set.

IBM (Bit 13) Set, if non-IBM block format (block device drivers only). For block device drivers, bit 13 indicates the method the physical device driver uses to determine the media type. If a block device driver uses information in the BIOS Parameter Block (BPB) to determine the media type, bit 13 should be set to 1. If the physical device driver uses the media descriptor byte to determine the media type, bit 13 must be 0.

SHR (Bit 12) Set, if the device driver supports shared-device access-checking (character devices). Bit 12 is the shared bit. It is set if the device name is not to be protected by the sharer. Bit 12 has no meaning for block device drivers and must be 0. If clear (default), file system sharing rules do not apply to the device, and the physical device driver provides contention control. If set, file system sharing rules apply to the device, just as they apply to any other file system name. In addition, any given physical device can have only one logical name. (Devices cannot have aliases.)

OPN (Bit 11) Set, if the device driver supports removable media (block devices) or device open/close (character devices). For block device drivers, bit 11 is the removable media bit. If set, this bit indicates that the physical device driver handles removable media. For character device drivers, bit 11 is the open/close bit. If set, this bit indicates that the physical device driver must receive OPEN and CLOSE request packets.

devatt1

Strategy Routine Offset

Contains the 16-bit offset from the start of the first code segment to the device driver's strategy entry point. The OS/2 operating system uses this offset to call the strategy routine.

IDC Entry Point Offset

The 16-bit offset from the start of the first code segment of the physical device driver to the entry point, which is callable by other device drivers.

Device Name

Contains the 8-character name of a character device supported by the character device driver or the number of units supported by the block device driver.

For a character device driver, the name of the device must be uppercase ASCII characters and left-justified with the remaining spaces set to blanks. The device name is used by applications to identify the device for I/O. A character device driver should consider the following rule when selecting a physical device driver name. To avoid conflicts with file names, a character device driver should choose a character string with some unusual character (such as a $ sign) as the last character.

A device name takes precedence over a file name in a DosOpen function. This means that files cannot have the same name as a character device. The DosOpen function always opens the device, rather than the file.

Capabilities Bit Strip

Level 3 device drivers have an additional DWORD field appended to the device header. Each bit of this new field is a flag indicating whether or not a particular feature is supported. The flags in this field are:

There are no comments on this page. [Add comment]

Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by Wikka Wakka Wiki 1.1.6.7
Page was generated in 0.6032 seconds