📄 ne2000.h
字号:
// File: ne2000.h
// Purpose: the main include class for the ne2000 sample including the header of an ne2000 miniport
#ifndef _NE2000_H_
#define _NE2000_H_
// This macro is used along with the flags to selectively
// turn on debugging.
#if DBG
#define IF_NE2000DEBUG(f) if (Ne2000DebugFlag & (f))
extern ULONG Ne2000DebugFlag;
#define NE2000_DEBUG_LOG 0x00000004 // enable Ne2000Log
#define NE2000_DEBUG_CHECK_DUP_SENDS 0x00000008 // check for duplicate sends
#define NE2000_DEBUG_TRACK_PACKET_LENS 0x00000010 // track directed packet lens
#define NE2000_DEBUG_WORKAROUND1 0x00000020 // drop DFR/DIS packets
#define NE2000_DEBUG_CARD_BAD 0x00000040 // dump data if CARD_BAD
#define NE2000_DEBUG_CARD_TESTS 0x00000080 // print reason for failing
// Whether to use the Ne2000Log buffer to record a trace of the driver.
#define IF_LOG(A) IF_NE2000DEBUG( NE2000_DEBUG_LOG ) { A }
extern VOID Ne2000Log(UCHAR);
// Whether to do loud init failure
#define IF_INIT(A) A
// Whether to do loud card test failures
#define IF_TEST(A) IF_NE2000DEBUG( NE2000_DEBUG_CARD_TESTS ) { A }
#else
// This is not a debug build, so make everything quiet.
#define IF_LOG(A)
#define IF_INIT(A)
#define IF_TEST(A)
#endif
// Macros to extract high and low bytes of a word.
#define MSB(Value) ((UCHAR)((((ULONG)Value) >> 8) & 0xff))
#define LSB(Value) ((UCHAR)(((ULONG)Value) & 0xff))
// What we map into the reserved section of a packet.
// Cannot be more than 8 bytes (see ASSERT in ne2000.c).
typedef struct _MINIPORT_RESERVED {
PNDIS_PACKET Next; // used to link in the queues (4 bytes)
} MINIPORT_RESERVED, * PMINIPORT_RESERVED;
// Retrieve the MINIPORT_RESERVED structure from a packet.
#define RESERVED(Packet) ((PMINIPORT_RESERVED)((Packet)->MiniportReserved))
// Procedures which log errors.
typedef enum _NE2000_PROC_ID {
cardReset,
cardCopyDownPacket,
cardCopyDownBuffer,
cardCopyUp
} NE2000_PROC_ID;
// Special error log codes.
#define NE2000_ERRMSG_CARD_SETUP (ULONG)0x01
#define NE2000_ERRMSG_DATA_PORT_READY (ULONG)0x02
#define NE2000_ERRMSG_HANDLE_XMIT_COMPLETE (ULONG)0x04
// Size of the ethernet address
#define NE2000_LENGTH_OF_ADDRESS 6
// The Miniport for ne2000
class KdNe2000Miniport:public KdNdisMiniport
{
public:
KdNe2000Miniport(DWORD dwOptions = 0);
virtual ~KdNe2000Miniport();
// overridden to create the specific ne2000 adapter and specific initializations
virtual NDIS_STATUS CreateAdapter(KdNdisAdapter **pAdapter,
KdNdisConfiguration *pConf,
NDIS_HANDLE WrapperConfigurationContext);
};
#endif // _NE2000_H_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -