⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sendlist.cpp

📁 收集到的orion_ep93xx_wince_bsp_1-3-507红外收发驱动源码,未作测试
💻 CPP
字号:
//**********************************************************************
//                                                                      
// Filename: sendlist.cpp
//                                                                      
// Description: Contains the list of packets for sending.
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
// Copyright(c) Cirrus Logic Corporation 2001, All Rights Reserved                       
//                                                                      
//**********************************************************************

#include <windows.h>
extern "C"
{
    #include <ndis.h>
    #include <ntddndis.h>
}    
#include <linklist.h>
#include <ceddk.h>
#include "sendlist.h"

//****************************************************************************
// SendList::SendList
//****************************************************************************
// Constructor
// 
//
SendList::SendList()
{
    InitializeListHead(&m_PendingList);
}

//****************************************************************************
// SendList::AddPendingBuffer
//****************************************************************************
// Add an item to the list.
// 
//
void    SendList::AddPendingPacket
(
    PNDIS_PACKET      pNdisPacket
)
{
    InsertTailList( &m_PendingList, (LIST_ENTRY *)&(pNdisPacket->MiniportReserved));
}

//****************************************************************************
// SendList::RemoveNextBuffer
//****************************************************************************
// Remove the next item in the list.
// 
//
PNDIS_PACKET  SendList::RemoveNextPacket()
{
    LIST_ENTRY       *pListItem;
    PNDIS_PACKET    pNdisPacket = 0;
    if(!IsListEmpty(&m_PendingList))
    {
        pListItem   = RemoveTailList(&m_PendingList);
        pNdisPacket = ConvertListToSendNDISPacket(pListItem);
    }        
    return (pNdisPacket);        
}



//****************************************************************************
// SendList::MorePackets
//****************************************************************************
// Check to see if there are any more packets on the list.
// 
//
BOOL   SendList::MorePackets()
{
    return (!IsListEmpty(&m_PendingList));
}



//****************************************************************************
// ConvertListToNDISPacket
//****************************************************************************
// This routine converts the address of the list item to the address of the
// NDIS_PACKET.
//
// Important:
//   This is based on the fact that the size of MiniportReserved portion of 
//   the NDIS_PACKET is 8 characters and the LIST_ENTRY size is also 8 
//   characters.
// 
//
PNDIS_PACKET ConvertListToSendNDISPacket(LIST_ENTRY *pListEntry)
{
    return((PNDIS_PACKET)(((char *)pListEntry) - sizeof(NDIS_PACKET_PRIVATE)));
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -