52964.fb2 Writing Windows WDM Device Drivers - читать онлайн бесплатно полную версию книги . Страница 26

Writing Windows WDM Device Drivers - читать онлайн бесплатно полную версию книги . Страница 26

Appendix BPC 99

PC 99 is a hardware and software specification for various types of PCs: Consumer PCs, Office PCs, and Entertainment PCs, including mobile PCs. Windows CE portables are not covered.

Certified PC 99 compliance gets you a nice "Designed for Microsoft Windows" logo on your box.

Drivers

Software plays a large part in achieving PC 99 compliance. Having a driver for both Windows 98 and Windows 2000 is a requirement for all PC types. If a driver is bundled with a PC when it is sold, it must pass the PC 99 compliance tests.

The PC 99 specification says that a driver must not use INI files, just the registry. INF style installation must be used, if possible. Drivers must be installed in the correct directories. A driver must not use the same filename as a system driver. A driver must be installable without user input. If a driver has any special parameters, a help file for these must be provided.

WDM drivers must fit in with all the bus specifications and device class driver specs.

The Specification

The PC 99 specification is in the MSDN Library CD Books section. It has many useful appendices and checklists. There are required, recommended, and optional features.

The specification is also available in book form. The PC 99 System Design Guide, version 1.0 is available from Microsoft Press (ISBN 0-7356-0518-1).

The general drift of the specification is to move PCs away from the traditional IBM-compatible PC to one dominated by PCI, SCSI, USB, and IEEE 1394 devices. No ISA slots are now allowed!

For each PC type, it defines what standard devices must be available and what are the possible options. For example, a basic PC (a 300Mhz Pentium with MMX with 32Mb memory) must have hard disk, keyboard, mouse, serial, and parallel ports, V.90 modem, a graphics adapter, and two USB ports. If possible, most external devices should use the USB bus.

Standard PC options include wireless operation, DVD drive, network card, floppy disk, audio, MPEG-2, video input and capture, and a TV tuner.

A PC should attempt to reduce the Total Cost of Ownership (TCO) by supporting Plug and Play and OnNow Power Management.

Plug and Play uses the ACPI specification to ease the management of resources as devices are added or removed from the system. Insertions or removals while the power is on (hot-swapping) is supported on appropriate buses.

The OnNow initiative aims to make PCs start up quicker. The PC can be put to sleep, in effect, rather than turned off completely.

It is recommended that the physical design and software support the accessibility initiatives.

IBM-Compatible PCs

The core hardware specification for PCs has hardly changed in years (i.e., it should be hardware compatible with the IBM AT specification).

This original specification defines standard hardware peripherals, either on the system motherboard or on plug-in cards. A PC needed a timer, keyboard controller, interrupt controller, real-time clock, two DMA controllers and page registers, serial ports and parallel ports.

Other peripherals soon became standard (e.g., IDE disk drives, CD-ROM drives, sound cards, and network cards).

These original devices had standard places where they had to live (e.g., they had set I/O port addresses, IRQ levels, and DMA lines). These are listed in Tables B.1, B.2, and B.3.

These devices were originally implemented by a host of different chips on the motherboard. Soon, chipsets appeared that combined all these devices.

Table B.1 Legacy ISA hardware system I/O (PC 99)

I/O AddressDefault system function
0000-000FSlave DMA
0010-0018System
0001FSystem
0020-0021Master 8259
0040-0043 0048-004BProgrammable interrupt timer (PIT) #1, PIT #2
0050-0052System
0060Keyboard/mouse controller
0061System control port B
0064Keyboard/mouse status
0070-0071Nonmaskable Interrupt (NMI) enable/real-time clock
0081-008BDMA page registers
0090-0091System
0092System control port A
0093-009FSystem
00A0-00A1Slave interrupt controller
00C0-00DEMaster DMA controller
00F0-00F1Coprocessor busy clear/reset
0170-0177Secondary IDE controller
01F0-01F7Primary IDE controller
0201Joystick interface
0220-022FSound Blaster
0278-027ALPT 2 (XT parallel port 3)
02E8-02EFAlternate COM (4)
02F8-02FFCOM2
0330-0331MPU-401
0376IDE Controller
0378-037ALPT1 (XT parallel port 2)
0388-038BFrequency modulation (FM) synthesis
03B0-03BBMDA, EGA/video graphics array (VGA)
03BC-03BELPT 3 (XT parallel port 1)
03C0-03DFEGA/VGA
03E0-03E7PCIC PCMCIA controllers
03E8-03EFAlternate COM (3)
03F0-03F7FDC
03F8-03FFCOM1
0534-0537Windows Sound System-compatible
0CF8-0CFBPeripheral Component Interconnect (PCI) ports

Table B.2 Legacy hardware IRQ assignment (PC 99)

Hardware IRQDefault assignment
IRQ 0System timer
IRQ 1Keyboard
IRQ 2Second programmable interrupt controller (PIC) cascade
IRQ 3COM2
IRQ 4COM1
IRQ 5Sometimes LPT 2 — not considered fixed
IRQ 6Standard floppy disk controller (FDC)
IRQ 7LPT1
IRQ 8Real-time clock/CMOS
IRQ 9
IRQ 10Sometimes COM 4 — not considered fixed
IRQ 11Sometimes COM 3 — not considered fixed
IRQ 12PC/2-style mouse
IRQ 13Coprocessor
IRQ 14Primary Integrated Device Electronics (IDE) controller
IRQ 15Secondary IDE controller

Table B.3 Legacy ISA hardware DMA considered fixed (PC 99)

Hardware DMASystem function (default)
DMA 0ISA expansion
DMA 1
DMA 2FDC
DMA 3extended capabilities port (ECP) parallel port on LPT 1
DMA 4DMA controller cascading
DMA 5
DMA 6
DMA 7

Over the years, various hardware developments have seen the light of day, such as MCA, EISA, PCI, and SCSI buses, with Plug and Play capability. Not all these developments have won market support.

PC 99 still supports all these "legacy" peripherals, if they are present in the system.

PCs have a Basic I/O System (BIOS) in ROM that runs when the computer is first switched on. This ROM finds the relevant operating system and runs its boot loader to start DOS, Windows 98, Windows 2000, or whatever.

Changing World

Most programs that are used nowadays run using Win32 (or at least Win16) functions. These routines do not allow direct access to I/O ports, etc. For example, when keyboard input is required, W98 or W2000 carries out the necessary operation. In the IBM-compatible environment, it interacts with the keyboard controller using techniques dating from time immemorial.

Less DOS applications are being run. In W98, NT, and W2000, these do not get direct access to the hardware. Instead, a Virtual Device Driver arbitrates access to these peripherals, allowing multiple DOS and Windows applications to run at the same time.

These two developments allow the Windows operating systems to move away from the original IBM-compatible specification. As long as the right keystroke messages get through to user programs, it does not matter where in hardware they come from. For old DOS programs that do try to access the actual hardware, virtual device drivers on faster new machines can emulate the required functionality.

The new wisdom is that the USB and IEEE 1394 (originally called FireWire) devices represent an easier way for users to connect assorted peripherals to the system, including standard system components such as a keyboard and a mouse. The idea is that any devices can be plugged in easily (even when the computer is on) and — within limits — daisy chained together. USB and IEEE 1394 devices cope with being plugged in anywhere. The Windows Plug and Play system sorts out any resource allocations on the fly.

Whether users will take to the new doctrine remains to be seen. Plugging a new USB device in will certainly be easier than dismantling a case, fiddling with jumpers, and inserting a card. The new Device Bay specification will allow easy insertion of cards within the chassis of the PC.

USB's 12Mbs is designed for slower-speed devices, such as keyboards, mice, joysticks, printers, modems, telephones, and monitors. IEEE 1394 runs faster, at 100 Mbs or more, and is more useful for devices such as scanners, storage units, and audio/visual kit, such as digital cameras.

ACPI, OnNow, and Plug and Play

New PCs aim to use less power and switch on more quickly, as well as supporting Plug and Play. Windows and new BIOS chips use the Advanced Configuration and Power Interface (ACPI) specification to help with these tasks.

ACPI-based hardware knows how to turn off or reduce power to some devices. Windows drivers can now help in this process by using the Power Management IRPs and routines, and the power management routines that are relevant for its device class. The aim of the OnNow initiative is that a PC may appear to be off, when in fact it is just "sleeping", waiting for a soft power on button to be pressed. As the operating system and drivers are already loaded into memory, it takes less time to start up the system. Devices simply need to be powered up for the user to get started. A remote control handset or incoming modem call may similarly be used to wake the system up.

Both Windows 98 and Windows 2000 can now take full use of the Plug and Play hardware facilities to allow easy device insertion and removal. Again, drivers need to help in this process, allocating and releasing resources only as instructed by the Plug and Play Manager.

PC 99 specifies that ACPI, OnNow, and Plug and Play must be supported.:

PC 99 Conformance

Microsoft can certify your hardware and software as PC 99 compatible. To do this, contact their Windows Hardware Quality Labs at http://www.microsoft.com/hwtest/ or e-mail to whqlinfo@microsoft.com. When your driver passes these tests, Microsoft gives you a digital signature catalog file that you should include in your driver's INF file.

The Windows DDK includes a simplified version of Microsoft's own tests on their Hardware Compatibility Tests (HCT) CDs. Check out your driver with these tests before submitting your driver for full testing.