Removing DMA Support From the NDIS Miniport Driver Send and Receive Functions
Other versions of this page are also available for the following:
8/28/2008
After you modify the NDIS miniport driver core functions, modify the NDIS miniport driver send and receive functions.
To remove DMA support from the NDIS miniport driver send and receive functions
In %_WINCEROOT%\Platform\%_TGTPLAT%\Drivers\CENDISMiniport, open Mp_nic.c.
Find the MpSendPacket 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 NDIS_STATUS SendStatus; #endif
Find the MpHandleRecvInterrupt function definition, and then, at the end of this function, use the
#ifndef
,#else
, and#endif
directives to remove the code related to the NdisMAllocateSharedMemoryAsync function call.The following code example shows how to use these directives to remove the surrounding code.
if (bAllocNewRfd) { // // Allocate one more RFD only if no pending new RFD allocation AND // it doesn't exceed the max RFD limit // if (!Adapter->bAllocNewRfd && Adapter->CurrNumRfd < Adapter->MaxNumRfd) { #ifndef UNDER_CE // // NdisMAllocateSharedMemoryAsync( ) is not supported in CE. // PMP_RFD TempMpRfd; NDIS_STATUS TempStatus; TempMpRfd = NdisAllocateFromNPagedLookasideList(&Adapter->RecvLookaside); if (TempMpRfd) { MP_INC_REF(Adapter); Adapter->bAllocNewRfd = TRUE; MP_SET_FLAG(TempMpRfd, fMP_RFD_ALLOC_PEND); // // Allocate the shared memory for this RFD. // TempStatus = NdisMAllocateSharedMemoryAsync( Adapter->AdapterHandle, Adapter->HwRfdSize, FALSE, TempMpRfd); // // The return value will be either NDIS_STATUS_PENDING or NDIS_STATUS_FAILURE // if (TempStatus == NDIS_STATUS_FAILURE) { MP_CLEAR_FLAGS(TempMpRfd); NdisFreeToNPagedLookasideList(&Adapter->RecvLookaside, TempMpRfd); Adapter->bAllocNewRfd = FALSE; MP_DEC_REF(Adapter); } } #else // // Since we have allocated up to MaxNumRfd, then we should never get here! // ASSERT(0); #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