How to Migrate a Windows-based Desktop NDIS Miniport Driver to Windows CE (Windows CE 5.0)
You can migrate a Network Driver Interface Specification (NDIS) miniport driver from a Windows-based desktop platform to Windows CE with a minimal amount of changes. Many of the changes involve conditionally compiling NDIS miniport driver functionality that Windows CE does not support. For portability between Windows-based desktop platforms and Windows CE, Microsoft recommends that you make changes to your driver to enable it to build in the Microsoft® Platform Builder development tool and with a driver development kit (DDK) for Windows-based desktop platforms.
The NDIS wrapper is a dynamic-link library (DLL) that facilitates developing and migrating NDIS miniport drivers by abstracting portions of the OS and by providing supporting functions.
To complete the following procedure, Microsoft used a Windows-based desktop driver that supports the Intel EtherExpress PRO/100+** Ethernet PCI adapter and Intel EtherExpress PRO/100B** PCI adapter (E100BEX). You can obtain the sample source code for the E100BEX driver by installing the Windows XP DDK.
Note Beginning with Windows CE 5.0, a Windows CE driver for the E100BEX driver is included with the operating system. The steps in this how-to document are largely illustrative.
These are the major differences between the NDIS miniport drivers for the Windows-based desktop platforms and Windows CE:
- Windows CE NDIS miniport drivers are .dll files, but NDIS miniport drivers for Windows-based desktop platforms are .sys files.
- Windows CE NDIS miniport drivers must expose the DriverEntry function.
- Windows CE does not use the lower 64 KB of the I/O address space.
Do not use 16 bit values for I/O port addresses.
- The Windows CE NDIS implementation does not support the EISA or MCA busses.
Do not use the NdisOverRideBusNumber and NdisReadMcaPosInformation functions.
- The Windows CE NDIS implementation does not support direct memory access (DMA).
Do not use the NdisSetupDmaTransfer, NdisCompleteDmaTransfer, NdisMRegisterDmaChannel, NdisMDeregisterDmaChannel, NdisMAllocateMapRegisters, NdisMFreeMapRegisters, NdisMReadDmaCounter, and NdisGetSharedDataAlignment functions.
- In Windows CE, the NdisInitializeEvent function requires the NdisFreeEvent function, and the NdisInitializeReadWriteLock function requires the NdisFreeReadWriteLock function.
- In Windows CE, avoid unaligned I/O and memory access.
You might need to rearrange structures or conditionally define another type with the
- In Windows CE, for delays greater than 50 microseconds, use the NdisMSleep function, rather than the NdisStallExecution function. NdisStallExecution requires a QueryPerformanceCounter implementation for your target device.
Hardware and Software Assumptions
- You have a Windows-based desktop NDIS miniport driver. For more information, see Miniports, Intermediate Drivers, and Protocol Drivers.
- You have created an OS design within Platform Builder. For more information, see How to Use the IDE to Create, Customize, and Build a Run-Time Image.
- Your target device has one Ethernet card for downloading the run-time image and one Ethernet card for product Ethernet, and you intend to use the NDIS miniport driver for the product Ethernet card. For more information, see Ethernet Connection Options.
- You are familiar with downloading run-time images to a target device. For more information, see How to Configure and Download a Run-Time Image to a CEPC.
To track your progress in the following table, select the check box next to each step.
|1. Add the Wired Local Area Network Catalog item to your OS design.
||Adding an Item from the Catalog|
|2. Exclude Vmini.dll from the OS design by setting the BSP_NOSHAREETH and IMGNOSHAREETH environment variables.||Setting or Clearing an Environment Variable|
|3. Add the Windows-based Desktop NDIS miniport driver to your run-time image build.||Adding the Windows-based Desktop NDIS Miniport Driver to the Run-Time Image Build|
|4. Add debug zones to the NDIS miniport driver initialization functions.||Adding Debug Zones to the NDIS Miniport Driver Initialization Functions|
|5. Remove DMA support from the NDIS miniport driver initialization functions.||Removing DMA Support from the NDIS Miniport Driver Initialization Functions|
|6. Remove unused local variables from the NDIS miniport driver core functions.||Removing Unused Local Variables from the NDIS Miniport Driver Core Functions|
|7. Add a DllMain entry point to the NDIS miniport driver core functions.||Adding a DllMain Entry Point to the NDIS Miniport Driver Core Functions|
|8. Remove DMA support from the NDIS miniport driver send and receive functions.||Removing DMA Support From the NDIS Miniport Driver Send and Receive Functions|
|9. Remove Windows Management Instrumentation (WMI) support from and conditionally defining power management for the NDIS miniport driver object identifier functions.||Removing WMI Support From the NDIS Miniport Driver Object Identifier Functions|
|10. Conditionally define power management in the NDIS miniport driver object identifier functions.||Conditionally Defining Power Management in the NDIS Miniport Driver Object Identifier Functions|
|11. Filter local variables in the NDIS miniport driver PhyDetect and SetupPhy functions.||Filtering Local Variables in the NDIS Miniport Driver PhyDetect and SetupPhy Functions|
|12. Build the run-time image.||Building a Run-Time Image|
|13. Download the run-time image to the target device.||Downloading a Run-Time Image|
|14. Test the NDIS miniport driver with the CETK.
If you also want to check the network connection through the NDIS miniport driver, you can do so by browsing the Web or another type of network. You may have to configure your Internet settings to use a proxy server.
|How to Use the CETK to Test a Driver|
**The non-Microsoft software and hardware referenced in these documents are included for illustrative purposes only.
Illustrations that use such third-party software and hardware as examples are not intended to be an endorsement or recommendation of any of these products.
We provide this information only as a convenience for our customers for purposes of explaining a practical application and do not provide warranties of any kind, whether express, implied or statutory, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.
Send Feedback on this topic to the authors