4. WDM Environment
a installation VC6.0;
b Install the DDK of the appropriate operating system (components must be selected all);
c Installation DriverStudio;
D Open compuware\driver studio\driverworks\source\vdwlibs.dsw project with VC6.0;
1) Use DriverStudio's Driverwizard to create the project
Create Regsample after the compilation error, delete the missing function, and then remove the ntstrsafe.lib link library
2) Ezdriverinstaller (driverstudio) installation inf
3) icon,-20 Yes
-5 Yes
The Hkey_local_machine/system/currentcontrolset/class of the registry can change the corresponding icon
4) Play log, Ktrace, Kdebugonlytrace, Dbgprint
USB2.0 up to 60mb/s Black or white interface, 3.0 is 600mb/s blue,
5. Communication for Drive and application
5.1 Turn on Device createFile (), with a GUID or symbolic link
Sync: File_attribute_normal
Async: File_attribute_normal | File_flag_overlapped,
Turn off device CloseHandle (), Generate Irp_mj_cleanup and irp_mj_close, application Ctrl_c forced exit and error exit both produce these two IRP
DeviceIoControl (), asynchronously calls WaitForSingleObject to wait for IO to complete
ReadFile, WriteFile,
5.2 Drive and application communication
Two methods of WDM:
1) Asynchronous completion of Irp,intrdemo DS example, did not see
2) Win32 Event (CREATEEVENT), charfilter example, not seen
6. Common Programming Techniques
6.1 String
CHAR, WCHAR, ansi_string, unicode_string
Kustring class
6.2 Memory
Nonpaged Memory M_image = new (NonPagedPool) uchar[m_size];
The Kmemory class, which serves the memory descriptor descriptor MDL,
Kheap class Memory heap, compare chunks
6.9 Cancelspinlock class, global cancellation spin lock is a bottleneck, the CPU is waiting for spin lock when nothing can dry. Use Iosetcancelroutine to replace
6.10 Kspinlock class that can block other threads
6.12 Timersample, Filethread
The instance mimics Drivermonitor to print the log
7. PnP Plug and Play routines
Start, stop, delete devices, DW automatically generate these three routines
8. Power Management
9. WMI System Management
Ten. IRP serialization
1) Driverworks provides Kdevicequeue,
KDEVICE::QUEUEIRP (), IRP queued; call Startio if queue is busy
Kdrivermanagedqueueex for managing multiple queues on its own
Startiochar_driver instances
One. WDM Filter Driver
Like normal drives, there are driverentry,adddevice, etc., layered with the device stack
Upper driver for adding additional functions
The lower driver is used to help write a bus-independent driver, such as a PCI bus, a USB bus can be unified into a bus structure of the function drive
USB Device Development
Device interface exposes one or more endpoints, four kinds: batch, control, interrupt, Sync
Endpoint No. 0: The default control method,
A transaction consists of one or more stages with three stages: token, data, handshake
adjourned
PCI device drivers
The IO address of the xp86 is 64KB, and the memory address space is 4GB
Kmemoryrange, Kiorange
Kpciconfiguration
Connect (), connecting the Interrupt object and interrupt service routines
DMA transfer
1) Example
A) PCI9054 interface card, using PLX Company's PCI9054 chip, local bus interface mode is C mode, 9054 local bus signal line and FPGA chip connected.
resources to be accessed by the device: the first two fixed operation registers for 9054, and the third is the IO mapping space for device access
b) FPGA has FIFO,DMA using block mode
c) 9054 instance process: Io instruction writes 32 bytes to FIFO, then DMA block transmits read
D) dmasample
Windows 2000/XP WDM Device Driver Development (2)