阅读:1166回复:1
Win 2000 Device Drivers Tutorial 3
Plug and Play
Before you can use a peripheral, you must install its driver. When you add new hardware to your computer, you typically have to turn it off, install the hardware, and then turn it back on. In older operating systems you would need to insert the diskette or CDROM with the drivers into your system and run some setup or install program, which would do the required installation actions: such as, for example, copying driver executables to the right directories, setting up configuration files with the right information, and adding required entries to the Windows Registry. But in newer OS\'s, you have Plug and Play. Plug and Play is a Microsoft term for the ability to automatically detect new hardware and to prompt the user for its drivers. It was first introduced with Windows 98, and it has been added to all modern flavors of Windows, including Windows 2000, Windows XP and Windows Millenium. Note that Windows NT does not support Plug and Play. In Microsoft parlance, Plug and Play is also known as PnP. The PnP spec includes protocols to asynchronously warn the OS when new hardware is added to the machine. This hardware autodetection will trigger a sequence of actions by the PnP Manager, including the recognition and allocation of hardware resources needed by the peripheral, such as for example interrupt vectors, DMA channels, memory addressing space or i/o ports. Eventually the OS will run a Wizard to ask the user to supply the drivers and other installation information for that new piece of hardware. Once you give the wizard all the specifications it needs (such as which drivers you want to use, where are they located, and so on), the OS will install the drivers for you. Addition of new hardware can be done with the machine switched off, in which case the new hardware is detected at boot time, or it can be done in a live manner for \"hot pluggable\" items such as USB or Firewire devices. Try it ! Run Windows 2000, XP or Millenium, get yourself an USB Mouse or diskette, plug it into your live machine, and watch the PnP wizard in action. Or, if you already have an USB peripheral in your machine, remove it and watch it disappear, then plug it in and watch it appear back in the system, alive and well. Driver Architecture and Models The above discussion on PnP has highlighted the fact that there are two different architectural models for drivers in Windows: PnP and non-PnP. While drivers for Windows NT do not require or support PnP, more modern flavors of Windows support PnP. In Windows NT, you must write a non-PnP driver, while in Windows 2000, Windows XP and Windows Millenium you have the choice of writing PnP or non-PnP drivers. Note also that you will hear people talking about \"legacy\" drivers meaning non-PnP Windows NT style device drivers. The two models are similar, and we could say that the non-PnP model is really a subset of the newer PnP-supporting Windows Driver Model. This WDM standard is an evolution of the older Windows NT driver model that accomodates support for Plug and Play features, including automatic detection of new hardware and real-time handling of hot pluggable devices. The WDM standard also includes support for Power Management , which is the ability of machines to put currently unused peripherals in a low power consumption hardware mode. This is fundamentally important in laptops, but it is also of growing importance in desktop machines, because it lowers the energy bill of companies and organizations that own lots of computers. Because of the need to support Plug and Play and Power Management, the WDM model feels a little more restrictive to the programmer than the older Windows NT driver model. If you want to stay on the safe side, you might want to use WDM for any real peripheral you want to add to your system. However you probably should use the Windows NT model if you want a kernel module that can handle machine hardware or operating system features, but that really has no associated I/O device. In other words, WDM should be used to support real devices and real peripherals, while kernel modules with more abstract functions may be easier to be written within the older NT driver model. |
|
最新喜欢:![]() |
沙发#
发布于:2002-06-27 14:45
辛苦了!
|
|
|