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

📄 irmacutl.h

📁 Ep93XX TionProV2 BSP
💻 H
字号:
//**********************************************************************
//                                                                      
// Filename: irmacutl.h
//                                                                      
// Description: 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.
//
// 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.
//
// Use of this source code is subject to the terms of the Cirrus end-user
// license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
// If you did not accept the terms of the EULA, you are not authorized to 
// use this source code. For a copy of the EULA, please see the 
// EULA.RTF on your install media.
//
// Copyright(c) Cirrus Logic Corporation 2005, All Rights Reserved                       
//                                                                      
//**********************************************************************

#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 + -