Published on

Published in: Business, Economy & Finance
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • WinCE

    1. 1. Windows CE Driver Architecture Jay Loney Program Manager Windows CE Drivers JayLoney @
    2. 2. Agenda <ul><li>Driver Architecture </li></ul><ul><ul><li>Device, Regenum, Loading Model, Power management </li></ul></ul><ul><ul><li>Windows CE versus WDM </li></ul></ul><ul><li>Memory and CEDDK </li></ul><ul><li>Basic Interrupt Architecture </li></ul><ul><li>Windows CE .NET’s Installable ISRs (IISR) </li></ul><ul><li>Bus Drivers </li></ul>
    3. 3. Windows CE Architecture OEM Hardware Embedded Shell Applications WIN32 APIs COREDLL, WINSOCK, OLE, COMMCTRL, COMMDLG, WININET, TAPI Windows CE Shell Services Remote Connectivity Kernel Library IrDA GWES Device Manager File Manager TCP/IP OAL Bootloader Drivers Device drivers File drivers Microsoft OEM ISV Network drivers
    4. 4. What Is A Driver In Windows CE <ul><li>Simply a DLL with a well defined set of entry points </li></ul><ul><li>Hosted by a Device Manager process space (sometimes GWES) </li></ul><ul><li>Interface to apps via CreateFile (Streams – optional) </li></ul><ul><li>Typically handle interrupts via dedicated thread (IST) </li></ul><ul><li>Synchronization between apps and ISTs via criticalsections and mutexes </li></ul><ul><li>Driver can have multiple simultaneous threads active </li></ul>
    5. 5. Driver Architecture
    6. 6. Types Of Drivers
    7. 7. Native Versus Stream Loading Mechanism <ul><li>Generally Native device drivers are loaded in the GWES process space by registry keys </li></ul><ul><li>Bus drivers loaded by Device.exe using registry </li></ul><ul><li>Installable, Stream, and Hybrid drivers in Device.exe by either bus driver or Registry Enumerator </li></ul>
    8. 8. Device Manager <ul><li>User-level process that runs continously </li></ul><ul><li>Separate application that interacts with the kernel, the registry and stream interface driver DLLs </li></ul><ul><li>Provides ActivateDevice and DeactivateDevice APIs </li></ul>
    9. 9. Device Manager <ul><li>Contains the IO Resource Manager </li></ul><ul><li>Loads the registry enumerator (RegEnum.dll) which in turn loads the drivers based on the registry </li></ul><ul><li>Provides power notification callbacks </li></ul><ul><ul><li>Tracks all loaded devices and issues device interface notifications for insertion and removal </li></ul></ul>
    10. 10. Device Manager <ul><li>Device Driver Loading Process </li></ul>DEVICE.EXE Kernel I/O Resource Manager (part of Device.exe) REGENUM.DLL PCIBUS.DLL loads loads loads DEVICE.EXE I/O Resource Manager (part of Device.exe) REGENUM.DLL PCIBUS.DLL
    11. 11. Registry Enumerator <ul><li>Registry Enumerator is RegEnum.dll </li></ul><ul><li>Device.exe loads the Registry Enumerator from HKEY_LOCAL_MACHINEDriversRootKey </li></ul><ul><li>Registry Enumerator scans the registry for more drivers to load </li></ul><ul><li>Registry Enumerator is re-entrant and supports hierarchical usage </li></ul><ul><li>When it gets unloaded, it also unloads anything it directly loaded </li></ul><ul><li>Registry Enumerator examines the first level of keys just below the key passed to it, according to Order </li></ul><ul><li>Registry Enumerator invokes ActivateDeviceEx on each subkey it finds </li></ul>
    12. 12. Driver Registry Keys <ul><li>Registry Enumerator examines the SubKeys as defined below </li></ul><ul><ul><li>Order – Smallest value gets loaded first </li></ul></ul><ul><ul><li>dll – Which DLL to load </li></ul></ul><ul><ul><li>Prefix – Three letter stream interface name, used only with drivers that expose a stream interface </li></ul></ul><ul><ul><li>Index – Identifier when multiple instances are present, between 0 and 9, inclusively </li></ul></ul><ul><ul><li>Flags – Modifies the default behavior of the enumerator </li></ul></ul>
    13. 13. ActivateDeviceEx <ul><li>Exposed by Device.exe </li></ul><ul><li>Bus Drivers call ActivateDeviceEx when they load device drivers </li></ul><ul><li>ActivateDeviceEx also locks the stream interface driver into working RAM </li></ul><ul><li>This prevents code pages from being discarded </li></ul><ul><li>Registry Enumerator calls ActivateDeviceEx on each built-in subkey it finds </li></ul><ul><li>ActivateDeviceEx loads driver and updates registry </li></ul>
    14. 14. Driver Loading <ul><li>Registry Enumerator is key to loading drivers </li></ul><ul><ul><li>Device Manager loads Registry Enumerator </li></ul></ul><ul><ul><li>Scans registry and loads drivers </li></ul></ul><ul><ul><li>publiccommonoakdrivers egenum </li></ul></ul><ul><li>Driver loading process </li></ul><ul><ul><li>RegEnum scans registry, loads bus drivers </li></ul></ul><ul><ul><li>Bus driver scans the bus and locates devices </li></ul></ul><ul><ul><li>Searches the registry for device information </li></ul></ul><ul><ul><li>Finds a match and loads appropriate driver </li></ul></ul><ul><ul><ul><li>Action for not finding a match differs with each bus </li></ul></ul></ul><ul><ul><li>Sends notification that interface is available </li></ul></ul>
    15. 15. Registry Key Example <ul><li>[HKEY_LOCAL_MACHINEDrivers] </li></ul><ul><li>&quot;RootKey&quot;=&quot;DriversuiltIn” </li></ul><ul><li>[HKEY_LOCAL_MACHINEDriversBuiltIn] </li></ul><ul><li>&quot;Dll&quot;=&quot;RegEnum.dll“ </li></ul><ul><li>[HKEY_LOCAL_MACHINEDriversCSPSerial] </li></ul><ul><li>&quot;Dll&quot;=&quot;Com16550.Dll&quot; </li></ul><ul><li>&quot;Order&quot;=dword:0 </li></ul><ul><li>&quot;Irq&quot;=dword:3 </li></ul><ul><li>&quot;MemBase&quot;=dword:FFBFC000 </li></ul><ul><li>&quot;MemLen&quot;=dword:8 </li></ul><ul><li>&quot;SysIntr&quot;=dword:13 </li></ul><ul><li>&quot;Prefix&quot;=&quot;COM&quot; </li></ul><ul><li>&quot;DeviceArrayIndex&quot;=dword:0 </li></ul><ul><li>&quot;Priority&quot;=dword:0 </li></ul>
    16. 16. Interface Classes <ul><li>Drivers are characterized by their interface </li></ul><ul><ul><li>Each IClass has a GUID and a Name </li></ul></ul><ul><ul><li>GUID describes the generic device interface </li></ul></ul><ul><ul><li>Name identifies the instance of an interface </li></ul></ul><ul><ul><ul><li>COM1:, DSK1: and so on </li></ul></ul></ul><ul><li>Exposing a driver’s interface </li></ul><ul><ul><li>IClass subkey in the registry </li></ul></ul><ul><ul><li>Drivers publish interface – AdvertiseInterface </li></ul></ul><ul><li>Apps query interface – RequestDeviceNotifications </li></ul><ul><li>Pre-defined GUIDs for existing interfaces </li></ul><ul><ul><li>A32942B7-920C-486b-B0E6-92A702A99B35 </li></ul></ul>
    17. 17. I/O Resource Manager <ul><li>IORM is an intrinsic part of Device Manager </li></ul><ul><li>Tracks available I/O resources ( IRQ and I/O base address ) </li></ul><ul><li>OEM pre-allocates resources for built-in devices </li></ul><ul><li>Bus drivers request resources when loading a client driver on their bus </li></ul><ul><ul><li>ResourceRequest </li></ul></ul><ul><ul><li>ResourceRelease </li></ul></ul><ul><ul><li>ResourceCreateList </li></ul></ul><ul><li>IORM fails ResourceRequest when there is a conflict </li></ul>
    18. 18. Registry Helper Routines <ul><li>Reads resource configuration from the registry </li></ul><ul><ul><li>OpenDeviceKey </li></ul></ul><ul><ul><li>DDKReg_GetIsrInfo </li></ul></ul><ul><ul><li>DDKReg_GetWindowInfo </li></ul></ul><ul><ul><li>DDKReg_GetPciInfo </li></ul></ul><ul><ul><li>APIs in COREDLL </li></ul></ul><ul><ul><li>Prototyped in < devload.h > and < ddkreg.h > </li></ul></ul><ul><li>Samples in publiccommonoakdrivers </li></ul><ul><ul><li>wavedevpddes1371wavepdd.cpp -> GetRegistryConfig </li></ul></ul>
    19. 19. Contrast: Windows XP WDM Loading Model <ul><li>Drivers are loaded in the kernel address space as a .sys file </li></ul><ul><li>In Windows XP, everything is PNP </li></ul><ul><ul><li>Boot time: BIOS tells you ACPI table which tells you which drivers to load, including busses </li></ul></ul><ul><ul><li>Windows CE walks through the registry </li></ul></ul><ul><ul><li>Run time: PNP manager is informed of added devices by the bus drivers. PNP manager asks bus driver who it is, PNP Man. loads the driver based on inf database. CE’s bus drivers detect PNP devices, scan registry for driver and request driver loading from Device Manager </li></ul></ul><ul><li>Driver entry is called DriverEntry </li></ul><ul><ul><li>In CE it’s xxx_Init </li></ul></ul><ul><li>Then the other driver entry points are specified for read/write/IOCTL/power </li></ul><ul><ul><li>In CE it’s the rest of the streams interface </li></ul></ul><ul><li>Drivers are re-entrant </li></ul><ul><li>PDO device objects (handle), provided by bus driver, to handle multiple instances </li></ul>
    20. 20. Power Management <ul><li>Power Manager </li></ul><ul><ul><li>Flexible infrastructure for system-level and peripheral-level power management </li></ul></ul><ul><ul><li>Lets devices intelligently manage their own power </li></ul></ul><ul><ul><li>Acts as a mediator between the devices and system/applications </li></ul></ul><ul><ul><li>Enables OEMs to modify the code surrounding calls to PowerOffSystem() </li></ul></ul>
    21. 21. Power Management <ul><li>System-level power states </li></ul><ul><li>Device (peripheral) level power states </li></ul>Suspend User Idle System Idle On D2 Standby D4 Off D1 Low Performance D3 Sleep D0 Fully Powered
    22. 22. Power Manager Architecture Drivers Power Manager (pm.dll) PM APIs Application Notification Message Queue Driver APIs Application APIs
    23. 23. Contrast: WDM Power Management <ul><li>Similar structure, different implementation </li></ul><ul><li>Power manager lives in the Kernel (in Windows CE it’s in DeviceMan) </li></ul><ul><li>S0-S5 system states (CE has OEMIdle and OEMPowerDown) </li></ul><ul><li>WDM Power manager negotiates with all active drivers whether a system state can be entered </li></ul><ul><li>WDM Power Manager walks the device tree, tells the drivers that the system is in a certain state. The driver then makes its own decision as to what Device state (D-state) the device should be in </li></ul><ul><ul><li>(CE has D0-D5, but is extensible) </li></ul></ul><ul><li>Driver can veto a System state because it is working </li></ul><ul><li>Battery Critical off has the highest precedent and will override any driver working </li></ul>
    24. 24. Physical Memory 64 MB RAM 32 MB Flash Dbg Serial Port 2 GB User 512 MB Uncached 512 MB Cached 64 MB RAM 32 MB Flash 64 MB RAM 32 MB Flash Physical Memory Kernel Virtual Address Reserved 04000000 82000000 80000000 80000000 A0000000 C0000000 0
    25. 25. Virtual Address Space Not Used Slot 0 Slot 32 64 KB 32 MB 64 MB 2 GB 3 GB 4 GB Memory mapped files Above 2G-3G Mapped to physical memory Virtual address space Slot 1 Slot 32 NULL pointers 0x80000000 0xA0000000 Accessable via MmMapiIoSpace 512M Cached 512M Non-Cached
    26. 26. Memory Management Functions <ul><li>Device drivers are user-mode modules </li></ul><ul><ul><li>Necessary to map physical memory to virtual memory </li></ul></ul><ul><li>VirtualAlloc, VirtualFree: reserve, free virtual memory </li></ul><ul><ul><li>MEM_RESERVE </li></ul></ul><ul><li>VirtualCopy: Maps a physical memory range to a virtual memory range </li></ul><ul><ul><li>PAGE_NOCACHE </li></ul></ul><ul><ul><li>PAGE_PHYSICAL </li></ul></ul>
    27. 27. Driver Memory Access – Mapped Pointers <ul><li>MapPtrToProcess </li></ul><ul><ul><li>Allows you to map a pointer from one address space to another </li></ul></ul><ul><li>GetCurrentProcess </li></ul><ul><ul><li>Retrieves a process identifier to be used with the MapPtrToProcess function </li></ul></ul><ul><li>SetProcPermissions </li></ul><ul><ul><li>Gives the current process access to other processes’ address spaces </li></ul></ul>
    28. 28. Driver Memory Access – Mapped Pointers App Calls DeviceIOControl DM mapped into Slot 0 App is mapped into Slot 0 DM Calls xxx_IoControl DM Sets permissions to App space APP DM Slot 0 APP APP Mapped pointer Driver Calls MapPtrToProcess Driver returns from xxx_IoControl DM Re-Sets permissions to App space App is mapped into Slot 0 APP DM APP Original pointer DM APP
    29. 29. Contrast: WDM Basic Memory Management <ul><li>Windows XP drivers are in kernel address space </li></ul><ul><li>XP Drivers can access all kernel address space </li></ul><ul><li>Can access the User space of the context from which they’re called </li></ul><ul><ul><li>In Windows CE, drivers have to map through virtual memory to get to their physical port/memory </li></ul></ul><ul><li>Driver’s communicate in 2 ways </li></ul><ul><ul><li>Buffered IO </li></ul></ul><ul><ul><li>Direct IO (suggested only if packet is bigger then 1 page) </li></ul></ul><ul><li>MMMapIOSpace maps physical devices into kernel address space </li></ul><ul><ul><li>Windows CE does this with OEMAddressTable in the OAL </li></ul></ul>
    30. 30. CEDDK <ul><li>CE v2.1x and later supports a platform independent I/O scheme </li></ul><ul><li>Left up to the OEM and driver writer to actually use them </li></ul><ul><li>CEDDK.DLL </li></ul><ul><ul><li>BUS Management </li></ul></ul><ul><ul><li>Memory Management </li></ul></ul><ul><ul><li>I/O Management </li></ul></ul><ul><li>CEDDK APIs taken from NTDDK </li></ul><ul><ul><li>Not documented until V2.12 </li></ul></ul><ul><ul><li>But most available in V2.00 </li></ul></ul>
    31. 31. CEDDK Abstraction <ul><li>Device drivers use CEDDK </li></ul><ul><li>Properly written drivers are binary compatible across platforms </li></ul><ul><ul><li>Source code compatible across CPUs </li></ul></ul>Device Manager Device Driver CEDDK.DLL Hardware
    32. 32. CEDDK Internals READ_REGISTER_XXXX WRITE_REGISTER_XXXX READ_PORT_XXXX WRITE_PORT_XXXX I/O Access XXXX => UCHAR/USHORT/ULONG MmMapIOSpace – MmUnmapIOSpace HalAllocateCommonBuffer Memory Management HalGetBusDataByOffset() HalGetBusData() HalSetBusDataByOffset() HalSetBusData() HalTranslateBusAddress() HalTranslateSystemAddress() Bus Management Function Examples Coverage
    33. 33. Contrast: WDM Advanced Memory Management <ul><li>The CEDDK-like functions aren’t used anymore in WDM </li></ul><ul><li>Bus drivers are now controlling the DMA for their own busses </li></ul><ul><li>PNP Manager asks the bus driver what resources the driver needs and arbitrates the resources including DMA channel requests </li></ul><ul><li>PNP Manager can arbitrate conflicts (“resource rebalancing”) </li></ul><ul><ul><li>Ex. Device1 can use irq 10 or 11 and gets 10, device2 comes later and can only use 10, PNP Manager will shuffle device1 to 11 and restart him </li></ul></ul><ul><li>In CE, always use shared interrupts to help avoid this problem. In the example above, you’re stuck </li></ul>
    34. 34. Interrupt Architecture <ul><li>Interrupt is just a particular exception </li></ul><ul><ul><li>Caught by kernel code </li></ul></ul><ul><ul><li>Dealt with prior to resuming user code </li></ul></ul><ul><ul><li>But hardware is independent of OS </li></ul></ul><ul><li>CE uses two stage Interrupt Service model </li></ul><ul><ul><li>Lightweight code to quiet interrupt </li></ul></ul><ul><ul><li>Scheduled code to service hardware </li></ul></ul><ul><li>OS provides API for enabling IRQ signals, prioritization, etc. </li></ul><ul><li>Hardware specific operations done in OAL and device driver code </li></ul>
    35. 35. CE 3.0 Interrupt Handling User Mode HW All None Device Driver IST Processing Set Event EOI Except. Handler ISR Enable App IRQ Masked All IRQ Enabled WFSO WFSO on Event Application Resumes Kernel OAL Higher Priority PSR SYSINTR_ ID
    36. 36. Notes On ISRs And ISTs <ul><li>ISTs are plain old user mode code </li></ul><ul><ul><li>Full CE .NET API and CRT library available </li></ul></ul><ul><ul><li>CE .NET scheduler controls IST execution based on thread priority </li></ul></ul><ul><ul><li>Run-time binding to SYSINTR </li></ul></ul><ul><li>ISRs are called from Exception Handler </li></ul><ul><ul><li>No OS services available </li></ul></ul><ul><ul><li>Stack space is limited </li></ul></ul><ul><ul><li>May be reentrant (OAL choice) </li></ul></ul><ul><ul><li>Assembly language on MIPS, SHx </li></ul></ul>
    37. 37. ISR Observations <ul><li>IRQ priorities CPU architecture dependent </li></ul><ul><ul><li>PIC hardware handles this on x86 </li></ul></ul><ul><ul><li>OAL arrays IntrPriority, IntrMask on MIPS </li></ul></ul><ul><li>OAL could add real-time feature allowing IST processing to preempt ISR service </li></ul><ul><li>Under CE 3.0, all ISR code part of OAL </li></ul><ul><ul><li>Not particularly expandable </li></ul></ul><ul><ul><li>IRQs bound to event IDs in OEMInit </li></ul></ul><ul><ul><li>No Support for PNP, IRQ sharing (PCI bus) </li></ul></ul><ul><li>CE .NET addresses these limitations with Installable ISR (IISR) chain </li></ul>
    38. 38. CE .NET Installable ISRs <ul><li>Preferable Extension to CE 3.0 ISR architecture </li></ul><ul><li>DLL code, bound at run time </li></ul><ul><li>Source code can be CPU independent </li></ul><ul><ul><li>Typically coded in “C” </li></ul></ul><ul><ul><li>Some restrictions apply </li></ul></ul><ul><ul><ul><li>No calls to CRT, Windows API, or other DLLs </li></ul></ul></ul><ul><li>Run-to-completion ISR, or IST dispatch </li></ul><ul><li>Support for hardware IRQ sharing </li></ul><ul><ul><li>Distinct SYSINTR ID from same IRQ </li></ul></ul>
    39. 39. CE .NET Interrupt Handling IISR Kernel OAL Driver HW Set Event SYSINTR_ ID IRQ Masked IST None Except. Handler ISR Higher Priority IRQs Enabled PSR SYSINTR_xx SYSINTR_NOP IISR 1 NKCallIntChain(IRQ) IISR n SYSINTR_CHAIN IISR 2
    40. 40. IISR Control Flow <ul><li>Driver registers IISR DLL with the Kernel with the call to LoadIntChainHandler() </li></ul><ul><ul><li>Data passed to IISR via KernelLibIoControl() </li></ul></ul><ul><li>OAL ISR decodes IRQ from hardware, calls kernel NkCallIntChain(dwIRQ) to query IISRs </li></ul><ul><ul><li>IISRs called in binding order </li></ul></ul><ul><li>IISR return value indicates status </li></ul><ul><ul><li>SYSINTR_CHAIN indicates IRQ not recognized </li></ul></ul><ul><ul><ul><li>OAL ISR translates IRQ to SYSINTR as before </li></ul></ul></ul><ul><ul><li>SYSINTR_NOP indicates IISR run-to-completion </li></ul></ul><ul><ul><ul><li>IISR must make IRQ go away! </li></ul></ul></ul><ul><ul><li>Other values indicate IISR owns interrupt </li></ul></ul><ul><ul><ul><li>OAL ISR code must set PIC IRQ mask </li></ul></ul></ul><ul><li>OAL ISR handles PIC EOI, returns ID </li></ul>
    41. 41. Interrupt Service Thread <ul><li>Is user-mode thread of device drivers for built-in devices </li></ul><ul><li>Does the actual processing of the interrupt </li></ul><ul><li>Creates an event object associated with the logical interrupt by calling CreateEvent function </li></ul><ul><li>IST remains idle most of the time, awakened when the kernel signals the event object </li></ul><ul><li>IST usually runs at above-normal priority, boost priority with CeSetThreadPriority function </li></ul>
    42. 42. Interrupt Service Thread <ul><li>InterruptInitialize </li></ul><ul><ul><li>Call InterruptInitialize to link the Event with the Interrupt ID of the ISR </li></ul></ul><ul><li>WaitForSingleObject </li></ul><ul><ul><li>Can be used to wait for an event to be signaled </li></ul></ul><ul><ul><li>This call is usually inside a loop so that when interrupt is processed, the IST gets back to this call waiting for the next interrupt to be handled </li></ul></ul><ul><li>InterruptDone </li></ul><ul><ul><li>After the interrupt data is processed, the IST must call the InterruptDone function to instruct the kernel to enable the hardware interrupt related to this thread </li></ul></ul>
    43. 43. Typical IST Start struct ISTData // Declare the Strucure to pass to the IST { HANDLE hThread; // IST Handle DWORD sysIntr; // Logical ID HANDLE hEvent; // handle to the event to wait for interrupt volatile BOOL abort; // flag to test to exit the IST }; ISTData g_KeypadISTData; // Create event to link to IST g_KeypadISTData.hEvent = CreateEvent(NULL, FALSE, FALSE, NULL); // Translate IRQ to an logical ID (x86 CEPC) g_KeypadISTData.sysIntr =Mapirq2Sysintr(5); // start the thread g_KeypadISTData.hThread = CreateThread(NULL,0,&KeypadIST, &g_KeypadISTData, 0, NULL);
    44. 44. Typical IST Start <ul><li>Set the IST Thread Priority </li></ul><ul><li>Disconnect any previous events from the associated ISR </li></ul><ul><li>Connect to the associated ISR </li></ul>//Change the threads priority CeSetThreadPriority(g_KeypadISTData.hThread,0); //disconnect any previous event from logical ID InterruptDisable(g_KeypadISTData.sysIntr); // Connect Logical ID with Event InterruptInitialize(g_KeypadISTData.sysIntr, g_KeypadISTData. hEvent,NULL,0);
    45. 45. Typical IST Start DWORD KeypadIST(void *dat) { ISTData* pData= (ISTData*)dat; // loop until told to stop While(!pData->abort) { // wait for the interrupt event... WaitForSingleObject(pData->hEvent, INFINITE) if(pData->abort) break; // Handle the interrupt... // Let OS know the interrupt processing is done InterruptDone(pData->sysIntr); } Return 0; }
    46. 46. Typical IST Stop <ul><li>Set a flag that will cancel the IST loop </li></ul><ul><li>Call InterruptDisable to disconnect the triggering event from the logical ID </li></ul><ul><li>Close the Thread Add Reference for the code </li></ul>// set abort flag to true to let thread know // that it should exit g_KeypadISTData.abort =TRUE; //disconnect event from logical ID //this internally sets g_KeypadISTData.sysIntr which in turn //sets g_KeypadISTData.hEvent through the kernel InterruptDisable(g_KeypadISTData.sysIntr); //wait for thread to exit WaitForSingleObject(g_KeypadISTData.hEvent,INFINITE); CloseHandle(g_KeypadISTData.hEvent); CloseHandle(g_KeypadISTData.hThread);
    47. 47. Contrast: WDM Interrupts <ul><li>Driver is assigned interrupt by the PNP manager </li></ul><ul><li>Driver registers with kernel it’s ISR </li></ul><ul><li>When IRQ fires, IDT table links the IRQ to the ISR </li></ul><ul><li>ISR routines run in arbitrary thread context because all applications share the kernel space </li></ul><ul><li>ISR runs immediately </li></ul><ul><li>Priority by hardware first, then IRQL (levels) 0-31, 3-28 are hardware devices </li></ul><ul><li>Queue Deferred Procedure Calls to do extended read/write work when IRQL drops to 2, this queue is drained in FIFO order </li></ul><ul><li>Threads (spell-checker) run when IRQL hits 0 </li></ul><ul><ul><li>DPCs are similar to CE ISTs, however CE ISTs are prioritized </li></ul></ul>
    48. 48. Bus Drivers Overview <ul><li>PCMCIA </li></ul><ul><ul><li>I82365 (ISA) </li></ul></ul><ul><ul><li>TI-1250 (PCI) </li></ul></ul><ul><li>USB Host </li></ul><ul><ul><li>Multiple Host Controllers </li></ul></ul><ul><ul><ul><li>OHCI and UHCI (PCI) </li></ul></ul></ul>
    49. 49. PCMCIA Host <ul><li>PCMCIA bus driver has three main threads </li></ul><ul><ul><li>Status change thread (card insertion/removal) </li></ul></ul><ul><ul><li>Interrupt thread (handles card functional interrupt requests) </li></ul></ul><ul><ul><li>Callback thread (notifies card clients of events) </li></ul></ul><ul><li>Bus driver supports a subset of Card Serv. messages, delivered as callbacks from the callback thread </li></ul><ul><li>Interrupts are delivered to client drivers as callbacks </li></ul><ul><li>Newly inserted cards are scanned for identifying PnP tuples and compared with entries in the registry </li></ul><ul><li>If no match is found, candidate drivers can run “detect” routines to card-specific mechanisms to ID the card </li></ul><ul><ul><li>May display a dialog box asking for the name of the DLL </li></ul></ul>
    50. 50. USB Host <ul><li>USB Version 1.1 compliant </li></ul><ul><li>OHCI and UHCI fully supported </li></ul><ul><li>Support for all transfer types </li></ul><ul><ul><li>Isoch, bulk, interrupt, control </li></ul></ul><ul><li>USBD supports multiplexing between multiple HC </li></ul><ul><li>Client drivers are typically loaded using LoadDriver and use USBD operations to communicate with the HC </li></ul><ul><li>Client drivers can optionally call ActivateDeviceEx() on themselves to expose a stream interface to apps </li></ul><ul><li>Detects and identifies newly attached devices </li></ul><ul><li>Loads drivers as described in the registry </li></ul><ul><ul><li>May display a dialog box asking for the name of the DLL </li></ul></ul>
    51. 52. Community Resources <ul><li> </li></ul><ul><li>Community Sites </li></ul><ul><ul><li> </li></ul></ul><ul><li>List of Newsgroups </li></ul><ul><ul><li> </li></ul></ul><ul><li>Attend a free chat or webcast </li></ul><ul><ul><li> </li></ul></ul><ul><ul><li> </li></ul></ul><ul><li>Locate a local user group(s) </li></ul><ul><ul><li> </li></ul></ul><ul><li>Non-Microsoft Community Sites </li></ul><ul><ul><li> </li></ul></ul>