Block Device Drivers

Block device drivers are for devices that allow data to be read or written only in blocks of a fixed size. Block devices do not allow individual bytes of data to be read or written. Block sizes tend to be one or a few kilobytes; some common sizes are 512 bytes, 1 KB, 2 KB, and 4 KB. Block devices are ideally suited to mass storage and persistent storage applications, such as disk and tape drives or non-volatile RAM disks.

The most common block devices used with Windows CE are those that use linear flash memory chips to implement persistent storage. The material in this section, however, applies to drivers for any type of block device. Some common types of block devices are hard disks and ATA-style flash ram disks in miniature card, PC Card, and compact flash card form factors. Block devices that conform to the industry standard ATA specification work with the Microsoft ATADisk driver included with Windows CE.

Block device drivers for Windows CE are typically implemented using the stream interface driver model. These drivers are managed by the Device Manager, and expose file I/O functions in order to interact with applications. The most important of those functions for block device drivers is the driver’s DSK_IOControl function, which handles all I/O requests to block devices. The specific I/O control codes for DSK_IOControl are the same ones that Windows CE uses to interact with the FAT file system driver.

Block device drivers are not required to use the stream interface driver model. They can use the file system driver model if the device that they control is to be used for file storage. OEMs or independent hardware vendors (IHVs) may also use the file system driver model to implement other functionality, such as secure encrypted file systems or extended file system name spaces.