Device Driver Architecture (Compact 7)
Device drivers link physical or virtual devices with the OS, making devices available to the OS and applications through an interface. The following diagram illustrates how a typical device driver interacts with the OS and device hardware.
As shown in this diagram, applications communicate with device drivers through the file system and the Device Manager. The Device Manager interacts with device drivers and the kernel to manage device access. Device drivers call kernel APIs to access hardware; the kernel, in turn, calls functions in the OEM Adaptation Layer (OAL) to read and write device registers. When the device generates an interrupt, the kernel intercepts the interrupt and forwards it to the device driver as an interrupt event. For more information about device driver hardware access and interrupt handling, see the Device Driver Developer Guide. For more information about the OAL, see OEM Adaptation Layer.
Windows Embedded Compact supports two primary device driver models: stream interface drivers and native device drivers. Stream interface drivers implement and expose a standard set of stream interface functions for use by applications. Any device that can be treated as if it were a special file—that is, a producer or consumer of ordered streams of bytes—is a good candidate for a stream interface driver. Native device drivers implement and expose any interface other than the stream interface functions. The APIs exposed by native device drivers are most often specifically customized to the underlying device's functionality. For more information about these device driver models, see Stream Drivers and Native Drivers
All device drivers in Windows Embedded Compact are dynamic-link libraries (DLLs). Windows Embedded Compact device drivers primarily use the standard Windows Embedded Compact APIs in their implementation. This differs from drivers on desktop Windows where drivers use the Windows Driver Model (WDM) interfaces. Any device driver in Windows Embedded Compact can use a monolithic or layered organizational model. A monolithic device driver is based on a single segment of code that exposes the hardware device’s functionality directly to the OS; monolithic device drivers access hardware devices directly. A layered device driver consists of two layers: a model device driver (MDD) upper layer, and a platform-dependent driver (PDD) lower layer. For more information about monolithic and layered device drivers, see Layered and Monolithic Drivers.