Removing DMA Support From the NDIS Miniport Driver Send and Receive Functions (Windows CE 5.0)

Send Feedback

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

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

  2. 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 CE.

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

    #ifndef UNDER_CE    
        NDIS_STATUS     SendStatus;
    #endif
    
  3. 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
    
            }
        }
    
  4. From the IDE Build menu, choose Open Build Release Directory.

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

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

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

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.