Windows NT Device Driver Development Basis (5)

zhaozj2021-02-11  205

1.3.6 buffer I / O and direct I / O

After the driver creates a device, you can set the device by setting the value of the Flags domain of DeviceObject.

Set of buffered I / O or direct I / O.

If this value is set to do_buffered_io, whenever the I / O manager receives a read and write request, it is non-division in memory.

Page area assigns the same area as the user area size, and stores the first finger pin on the IRP object .s of AssociatedIrp.s

In YSTEMBUFFER, the driver exchanges data with the user through this buffer. Whenever a read request is completed

The I / O Manager automatically copies the contents of the buffer to the user area and releases the area.

If the user area is larger than one page (4096 bytes on 80x86), the value is typically set to do_direct_io.

At this time, whenever the I / O manager receives a read and write request, lock the physical memory of the user area, then create an internal

Depict Description Table (MDL) and store the header needle of the table in MDLADDRESS of the IRP object, the driver can pass

Call MMGETSystemAddressFormDL to get the address of the user area in the system space. Whenever a read request is finished

The time I / O manager automatically unlocks the area.

1.3.7 timing

In order to prevent reading and writing request timeout when a device is present, or the status of certain devices is required to be polled

The driver needs to set some timers. There are two methods in the driver to set the timer. One is called

IOinitializetimer links a timer process Iotimer to a device object. Calling iostar

After ttimer, the system calls every second time IOTIMER until the driver calls iostoptimer. If needed

To set a smaller interval timer, you need to use a delayed process call mechanism called CustomTimTimTimerDPC.

It can set the system to place a set DPC object in the end of the DPC queue every other time, perform a finger

Timer DPC process. This time interval can be accurate to 100ns.

-

转载请注明原文地址:https://www.9cbs.com/read-3789.html

New Post(0)