jerf.cat
驱动中牛
驱动中牛
  • 注册日期2002-03-30
  • 最后登录2005-09-10
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
阅读:2358回复:7

Writing Bus Drivers for Windows 2000

楼主#
更多 发布于:2002-05-30 18:47
Writing Bus Drivers for Windows 2000
 OSR Open Systems Resources, Inc.

 

Note:  It is assumed that the reader has some familiarity with Windows 2000, PNP, the concept of Functional Device Objects (FDOs) and Physical Device Objects (PDOs), and of “.INF” files

 

This article is the first in a series of articles on how to write a driver for Windows 2000 that implements the functionality of a bus driver.   A bus driver in Windows 2000 is a driver that manages a “bus” and its associated physical devices.  Of course, this could be a real, honest to goodness, hardware bus.  But what’s really cool about bus drivers is that the “bus” that they manage might not even be any sort of bus, in any conventional sense of the word.  Rather, creating a bus driver will allow one driver to easily connect with and control the number of instances of a higher-level driver in the system.

 

Consider the Microsoft Disk Class driver.  This driver actually acts as both a Function driver and a bus driver.  In its role as a Function driver, it creates a Functional Device Object (FDO) for each disk on the system.  It then proceeds to act as a bus driver, creating a Physical Device Object (PDO) for each partition on each disk.

 

So, bus drivers can really be very useful things in Win2K, when you think about them “right”.  The bus and its devices can be actual physical hardware or virtual hardware, or some abstract software construct.  In each case, the bus driver is responsible for enumerating the bus, handling bus related events (insertions, removals, etc.) and managing power state.  

 

Of course, supporting a new hardware bus will require creating a bus driver.  One of the significant changes in the Windows 2000 architecture was that the bus management functions were removed from the Hardware Abstraction Layer (HAL) and isolated into the bus drivers.  Thus, support for new buses can be added to Win2K without having to change the HAL!

 

For this article, we are going to discuss creating a Virtual Bus driver that supports the mythical Fred Bus.  Our Fred Bus is a virtual bus that supports two virtual devices, the Fred Toaster and Fred Oven devices.  Figure 1 illustrates our bus.

 


 

Figure 1
游客

返回顶部