Share via


Removing DMA Support from the NDIS Miniport Driver Initialization Functions

Because the Windows 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 CE.

    The following code example shows the appropriate replacement for Windows 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 use the #ifdef, #else, and #endif directives within the local variable declarations to remove the variables that are not needed with Windows 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 use the #ifndef and #endif directives within the local variable declarations to remove the variables that are not needed with Windows 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 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 use the #ifndef and #endif directives within the local variable declarations to remove the variables that are not needed with Windows 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 use the #ifndef and #endif directives within the local variable declarations to remove the variables that are not needed with Windows 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 CE NDIS miniport driver.

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

  12. Build the Windows 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

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

 Last updated on Tuesday, May 18, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.