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

📄 irmacutl.h

📁 收集到的orion_ep93xx_wince_bsp_1-3-507红外收发驱动源码,未作测试
💻 H
字号:
/*++
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) 1995-2000 Microsoft Corporation.  All rights reserved.

Module Name:

    irmacutl.h

Abstract:

    This file implements the IrDA NDIS MAC utility library function
    prototypes. This is provided as a sample to platform writers and is
    expected to be able to be used without modification on most (if not
    all) hardware platforms.

Functions:

    ComputeCumulativeFCS
    GetIrdaPacketInfo

Notes:


--*/

#ifndef _IRMACUTL_H_
#define _IRMACUTL_H_

#ifdef __cplusplus
extern "C"
{
#endif // __cplusplus

#include <windows.h>
#include <ndis.h>
#include <ntddndis.h>
#include "settings.h"

#ifdef DEBUG
#include "decdirda.h"
#endif // DEBUG

extern const USHORT fcsTable[256];

// Prototypes.

USHORT
ComputeFCS(
    LPBYTE lpData,
    DWORD  cbData
    );

BOOL
NdisToIrPacket(
    IN     PNDIS_PACKET pNdisPacket,
    IN     DWORD        cbTatBofs,
       OUT LPBYTE       pIrPacket,
    IN OUT LPDWORD      lpcbIrPacket
    );

// Inline functions.

/*++

 Function:       ComputeCumulativeFCS

 Description:    Computes FCS cumulatively. (i.e. doesn't have entire block
                 of data to compute FCS for entire chunk).

 Arguments:

    fcs     - Current FCS.
    
    byte    - Byte to compute FCS and modify current FCS.

 Returns:

    USHORT  - new FCS.

 Comments:

    This is the FCS (CRC-CCITT 16 bit) computation function. 

--*/

__inline USHORT 
ComputeCumulativeFCS(USHORT fcs, BYTE byte)
{
    return ( (fcs >> 8) ^ fcsTable[(fcs ^ byte) & 0xff]);
}

/*++

 Function:       GetIrdaPacketInfo

 Description:    Gets a pointer to the IrDA packet info in an NDIS packet.

 Arguments:

    pNdisPacket - Pointer to an NDIS packet.

 Returns:

    PNDIS_IRDA_PACKET_INFO.

 Comments:

--*/

__inline PNDIS_IRDA_PACKET_INFO 
GetIrdaPacketInfo(PNDIS_PACKET pNdisPacket)
{
    MEDIA_SPECIFIC_INFORMATION *pMediaInfo;
    UINT size;
    NDIS_GET_PACKET_MEDIA_SPECIFIC_INFO(pNdisPacket, (void **)&pMediaInfo, &size);
    return (PNDIS_IRDA_PACKET_INFO)pMediaInfo->ClassInformation;
}

#ifdef __cplusplus
}
#endif // __cplusplus

#endif  _IRMACUTL_H_

⌨️ 快捷键说明

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