Removing DMA Support from the NDIS Miniport Driver Initialization Functions
Other versions of this page are also available for the following:
8/28/2008
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
In %_WINCEROOT%\Platform\%_TGTPLAT%\Drivers\CENDISMiniport, open Mp_init.c.
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},
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
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
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
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
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
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
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
From the IDE Build menu, choose Open Build Release Directory.
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.
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