How to Migrate a Windows-based Desktop NDIS Miniport Driver to Windows Embedded CE (Windows Embedded CE 6.0)

1/6/2010

You can migrate a Network Driver Interface Specification (NDIS) miniport driver from a Windows-based desktop platform to Windows Embedded CE with a minimal amount of changes. Many of the changes involve conditionally compiling NDIS miniport driver functionality that Windows Embedded CE does not support. For portability between Windows-based desktop platforms and Windows Embedded 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 Embedded 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 Embedded CE:

  • Windows Embedded CE NDIS miniport drivers are .dll files, but NDIS miniport drivers for Windows-based desktop platforms are .sys files.
  • Windows Embedded CE NDIS miniport drivers must expose the DriverEntry function.
  • Windows Embedded 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 Embedded CE NDIS implementation does not support the EISA or MCA busses.
    Do not use the NdisOverRideBusNumber and NdisReadMcaPosInformation functions.
  • The Windows Embedded CE NDIS implementation does not support direct memory access (DMA).
    Do not use the NdisSetupDmaTransfer, NdisCompleteDmaTransfer, NdisMRegisterDmaChannel, NdisMDeregisterDmaChannel, NdisMAllocateMapRegisters, NdisMFreeMapRegisters, NdisMReadDmaCounter, and NdisGetSharedDataAlignment functions.
    Use the NdisMAllocateSharedMemory and NdisMFreeSharedMemory functions for PCI bus master DMA transfers.
  • In Windows Embedded CE, the NdisInitializeEvent function requires the NdisFreeEvent function, and the NdisInitializeReadWriteLock function requires the NdisFreeReadWriteLock function.
  • In Windows Embedded CE, avoid unaligned I/O and memory access.
    You might need to rearrange structures or conditionally define another type with the UNALIGNED keyword.
  • In Windows Embedded 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

Steps

Step Topic

1. Add the Wired Local Area Network Catalog item to your OS design.

  • You can add the Catalog item either from the Catalog or by setting the environment variable SYSGEN_ETHERNET.

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 (Visual Studio)

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 OS design into a run-time image.

Building a Run-Time Image

13. In the Output window, on the Output tab, verify that the build contains no errors.

Build Error Debugging Process

14. Choose a download service appropriate for the connection hardware. The download service will download a run-time image to the target device.

Download Service Selection

15. Set up and configure the connection hardware required for the download service. That hardware connects the target device to the development workstation, on which Platform Builder is installed. Examples of connection hardware include cables, a hub, or Ethernet network adapters.

Hardware Configuration

16. If you selected Serial Download Service in step 14, configure the HyperTerminal terminal emulation application to display the serial debug output from the serial port on the target device.

This configuration requires a null-modem cable connected to a serial port, such as COM1.

Configuring HyperTerminal for BSPs

17. Turn on the target device so that it becomes active on the Ethernet network or over the serial connection, and Platform Builder can discover it.

Not applicable

18. Configure the connection to the target device.

Choose the appropriate topic based on whether the development workstation and the target device are connected by an Ethernet network or a serial port connection.

Configuring an Ethernet Remote Connection

Configuring a Serial Remote Connection

19. Download the run-time image to the target device through the configured connection.

Downloading a Run-Time Image

20. 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.

See Also

Tasks

Troubleshooting a Device Driver

Concepts

Miniports, Intermediate Drivers, and Protocol Drivers

Other Resources

Network Driver Migration
Network Drivers