Presentation is loading. Please wait.

Presentation is loading. Please wait.

EMB432 Developing Bus Agnostic Drivers for Windows CE David G. Heil Chief Engineer Solutions Division CalAmp Corporation.

Similar presentations


Presentation on theme: "EMB432 Developing Bus Agnostic Drivers for Windows CE David G. Heil Chief Engineer Solutions Division CalAmp Corporation."— Presentation transcript:

1 EMB432 Developing Bus Agnostic Drivers for Windows CE David G. Heil Chief Engineer Solutions Division CalAmp Corporation

2

3 Agnostic Doubtful or noncommittal Uncertain of all claims to knowledge

4 Bus A vehicle carrying many passengers; used for public transport An electrical conductor that makes a common connection between several circuits

5 Driver The operator of a motor vehicle A program that determines how a computer will communicate with a peripheral device

6 Bus Agnostic Driver An operator of a vehicle carrying many passengers that has commitment issues A program that determines how a computer will communicate with a peripheral device over a common electrical connection that makes no claims to knowledge

7 Bus Agnostic Driver “A bus agnostic driver is a standard driver that is relatively simple to implement and can be shared by various bus implementations for the same hardware chipset.” – Windows CE 5.0 Help

8 Obtain Registry Handle HKEY OpenDeviceKey( LPCTSTR ActiveKey ); This function opens the device registry key specified by the ActiveKey parameter. The caller of OpenDeviceKey is responsible for closing the registry handle it returns.

9 Obtain Window Information DWORD WINAPI DDKReg_GetWindowInfo( HKEY hk, PDDKWINDOWINFO pwi ); This function fills the DDKWINDOWINFO structure with information it reads from the registry. This information includes everything a driver must have to map its memory (and I/O) windows.

10 Structure Contents DDKWINDOWINFO Bus number that your device was found on Bus type (PCI, PCMCIA, Cardbus, etc…) Array of I/O windows (Each element contains the base address & length) Array of memory windows (Each element contains the base address & length)

11 Obtain Interrupt Information DWORD WINAPI DDKReg_GetIsrInfo( HKEY hk, PDDKISRINFO pii ); This function populates a DDKISRINFO structure with information from the registry. This information includes everything a driver must have to activate an interrupt service thread.

12 Structure Contents DDKISRINFO The hardware interrupt number The software interrupt identifier or SYSINTR number A string containing the path to the Installable ISR (IISR) DLL A string containing the name of the interrupt handler function within the IISR DLL

13 Obtain A Virtual Address BOOL BusTransBusAddrToVirtual ( HANDLE hBusAccess, INTERFACE_TYPE InterfaceType, ULONG BusNumber, PHYSICAL_ADDRESS BusAddress, ULONG Length, PULONG AddressSpace, PPVOID MappedAddress ); This function translates a bus address to a virtual system address.

14 Obtain A Static Address BOOL BusTransBusAddrToStatic ( IN HANDLE hBusAccess, IN INTERFACE_TYPE InterfaceType, IN ULONG BusNumber, IN PHYSICAL_ADDRESS BusAddress, IN ULONG Length, IN OUT PULONG AddressSpace, OUT PPVOID MappedAddress ); This function translates a bus address to a system address. Then, it creates a static, process independent, virtual address mapping for that address.

15 Interrupt Handler Chaining HANDLE LoadIntChainHandler( LPCWSTR lpFilename, LPCWSTR lpszFunctionName, BYTE bIRQ); This function is called by a driver to install an ISR to handle a particular interrupt.

16 Plug Handler Into Kernel BOOL KernelLibIoControl( HANDLE hModule, DWORD dwIoControlCode, LPVOID lpInBuf, DWORD nInBufSize, LPVOID lpOutBuf, DWORD nOutBufSize, LPDWORD lpBytesReturned); This function is called with the IOCTL_GIISR_INFO parameter to tell the kernel to handle a particular interrupt with an IISR.

17 Structure Contents GIISR_INFO The system interrupt (SYSINTR) ID Whether or not to check a status port Whether that port is an I/O port Whether or not to check a mask register The address of the interrupt status port The size of the status port (in bytes) The interrupt bit mask The address of the mask register

18 PCI/PC Card Entries PCI & PC Card (bus-agnostic) driver entries are entered in a “match template” area [HKLM\Drivers\BuiltIn\PCI\Template\<…>] “VendorID” (string or multi-string) Contains the PCI vendor identifier(s) of the cards that this driver services. “DeviceID” (string or multi-string) Contains the PCI device identifier(s) of the cards that this driver services.

19 PCMCIA Entries PCMCIA Card (bus-agnostic) driver entries are entered in a “plug and play” area [HKLM\Drivers\PCCARD\PCMCIA\PNP\<PNP-ID>] The PNP-ID is generated based on the CIS structure of the target card The PNP-ID is a concatenation of the product information, manufacturer identifier, and product identifier tuples

20 GIISR Entries The GIISR mechanism is configured by registry entries included under the template or PNP keys. “IsrDLL” (string) This value contains the path to the GIISR DLL for your driver If the DLL is in the standard search path you can just use the filename here “IsrHandler” (string) This value contains the name of the ISR handler function

21 GIISR Entries (cont.) “CheckPort” (dword) Set to “1” if GIISR should check bits of interrupt status register before passing this interrupt on to the interrupt thread “PortIsIo” (dword) Set to “1” if GIISR should use an I/O access to check the interrupt status register “PortAddr” (dword) Contains the system address of the interrupt status register “PortSize” (dword) Contains the size (byte (1), word (2), dword (4)) of the interrupt status register

22 GIISR Entries (cont.) “Mask” (dword) This value will be logically ANDed with the value of the status register “UseMaskReg” (dword) Set to “1” if GIISR should read the mask from a register instead of using the “Mask” value from the registry “MaskAddr” (dword) Contains the system address of the interrupt mask register

23 CElite

24 What is CELite? CELite is a patch to the Windows CE kernel that allows it to run on microprocessors without memory management units. Key contributors James Y. Wilson David G. Heil http://celite.sourceforge.net

25 © 2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.


Download ppt "EMB432 Developing Bus Agnostic Drivers for Windows CE David G. Heil Chief Engineer Solutions Division CalAmp Corporation."

Similar presentations


Ads by Google