Just as multiple devices on the same controller need to coordinate their hardware access, so it is that devices that perform DMA need an orderly way to share system DMA resources. The I/O Manager uses adapter objects to prevent arguments over DMA hardware. There is one adapter object for each DMA data transfer channel on the system. Like a controller object, an adapter object can be owned by only one device at a time. Before starting a DMA transfer, the Start I/O routine asks for ownership of the adapter object. If the hardware is free, ownership is granted. If not, the device's request is put on hold until the current owner releases the hardware. Obviously, if the device supports only programmed I/O, it has no need for an adapter object. The life cycle of the adapter object is described below.
Another important function of the adapter object is to manage mapping registers. The HAL uses these registers to map the standard physical pages of a user's buffer onto the contiguous range of addresses required by most DMA hardware. The complete mechanics of DMA transfers are covered in detail in chapter 12. Layout of an Adapter ObjectFigure 4.5 illustrates the relationship of adapter objects to other structures. As the diagram shows, the adapter object is completely opaque and has no externally visible fields. When working with DMA devices, the pointer to the adapter object, as well as the number of mapping registers it supports, should be stored in the device extension or controller extension structure. Figure 4.5. The adapter object
Manipulating Adapter ObjectsBoth the HAL and the I/O Manager export functions that can be used to manipulate adapter objects. Table 4.9 lists the more common adapter functions.
|