Removing DMA Support from the NDIS Miniport Driver Initialization Functions (Windows Embedded CE 6.0)

1/6/2010

Because the Windows Embedded CE NDIS implementation does not support DMA, remove DMA support from the NDIS miniport driver initialization functions.

To remove DMA support from the NDIS miniport driver initialization functions

  1. In %_WINCEROOT%\Platform\%_TGTPLAT%\Drivers\CENDISMiniport, open Mp_init.c.

  2. Find the NICRegTable initialization.

    The following code example shows the relevant line of code from the Windows desktop-based NDIS miniport driver NICRegTable initialization.

      {NDIS_STRING_CONST("NumRfd"), 0, MP_OFFSET(NumRfd), MP_SIZE(NumRfd), 32, NIC_MIN_RFDS, NIC_MAX_RFDS},
    
  3. Replace the line of code shown in step 2 with code appropriate for Windows Embedded CE.

    The following code example shows the appropriate replacement for Windows Embedded CE.

    #ifndef UNDER_CE
      {NDIS_STRING_CONST("NumRfd"), 0, MP_OFFSET(NumRfd), MP_SIZE(NumRfd), 32, NIC_MIN_RFDS, NIC_MAX_RFDS},
    #else
      {NDIS_STRING_CONST("NumRfd"), 0, MP_OFFSET(NumRfd), MP_SIZE(NumRfd), NIC_MAX_GROW_RFDS, NIC_MIN_RFDS, NIC_MAX_RFDS},
    #endif
    
  4. Find the MpExtractPMInfoFromPciSpace function call, and enable this call only when WINCE_PM_ENABLE is defined.

    The following code example shows how to enable the MpExtractPMInfoFromPciSpace call when WINCE_PM_ENABLE is defined.

    #ifdef WINCE_PM_ENABLE        
      MpExtractPMInfoFromPciSpace (Adapter, (PUCHAR)pPciConfig);
    #endif
    
  5. Find the MpAllocAdapterBlock function definition, and then use the #ifdef, #else, and #endif directives within the local variable declarations to remove the variables that are not needed for Windows Embedded CE.

    The following code example shows how to use these directives to remove the unused variables.

        PMP_ADAPTER     Adapter;
    #ifdef UNDER_CE
        NDIS_STATUS     Status;
    #else
        NDIS_HANDLE     PacketPoolHandle;
        NDIS_HANDLE     BufferPoolHandle;
        PNDIS_PACKET    Packet;
        PNDIS_BUFFER    Buffer;
        NDIS_STATUS     Status;
        LONG            index;
    #endif
    
  6. Find the NICAllocAdapterMemory function definition, and then use the #ifndef and #endif directives within the local variable declarations to remove the variables that are not needed for Windows Embedded CE.

    The following code example shows how to use these directives to remove the unused variables.

        NDIS_STATUS     Status;
    #ifndef UNDER_CE    
        PMP_TCB         pMpTCB;
    #endif
        PMP_TXBUF       pMpTxbuf;
        PUCHAR          pMem;
        ULONG           MemPhys;
        LONG            index;
    #ifndef UNDER_CE    
        LONG            MapRegisterCount;
    #endif
        ULONG           ErrorValue = 0;
        UINT            MaxNumBuffers;
    #if OFFLOAD
    
        BOOLEAN         OffloadSharedMemSuccess = FALSE;
        UINT            i;
    #endif
    
  7. In the NICAllocAdapterMemory function definition, use the #ifndef, #else, and #endif directives to remove the calls to the scatter/gather DMA initialization functions, and then set Status equal to NDIS_STATUS_FAILURE because the Windows Embedded CE NDIS implementation does not support scatter/gather DMA.

    The following code example shows how to use these directives to remove the calls to the scatter/gather DMA initialization functions.

    #ifndef UNDER_CE        
    #if OFFLOAD          
            Status = NdisMInitializeScatterGatherDma(
                         Adapter->AdapterHandle,
                         FALSE,
                         LARGE_SEND_OFFLOAD_SIZE);
    #else
            Status = NdisMInitializeScatterGatherDma(
                         Adapter->AdapterHandle,
                         FALSE,
                         NIC_MAX_PACKET_SIZE);
    #endif        
    #else
    
            //
            //  No scatter gather support in CE NDIS.
            //
    
            Status = NDIS_STATUS_FAILURE;
    
    #endif  //  UNDER_CE
    
  8. Find the NICAllocRfd function definition, and then use the #ifndef and #endif directives within the local variable declarations to remove the variables that are not needed for Windows Embedded CE.

    The following code example shows how to use these directives to remove the unused variables.

    #ifndef UNDER_CE    
        ULONG               HwRfdPhys;  
    #endif
    
  9. Find the NICInitializeAdapter function definition, and then use the #ifndef and #endif directives within the local variable declarations to remove the variables that are not needed for Windows Embedded CE.

    The following code example shows how to use these directives to remove the unused variables.

    #ifndef UNDER_CE    
        USHORT          EepromFlags;
    #endif
    
  10. From the IDE Build menu, choose Open Build Release Directory.

  11. Navigate to the directory containing your Windows Embedded CE NDIS miniport driver.

    Be sure your NDIS miniport driver is in %_WINCEROOT%\Platform\%_TGTPLAT%\Drivers\CENDISMiniport.

  12. Build the Windows Embedded CE NDIS miniport driver with the Build tool.

    For more information about the Build tool, see Build Tool. Microsoft recommends using the -c parameter with the Build tool to delete all object files.

See Also

Tasks

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