📄 celansw.h
字号:
//
// Copyright (c) Renesas Technology Corp. 1999-2003 All Rights Reserved.
//
// LAN91C111 network hardware driver
//
//----------------------------------------------------------------------------
//
// FILE : CELANSW.H
// CREATED : 1998.07.22 ("ne2000sw.h", for NE2000 driver)
// MODIFIED : 2003.08.06
// AUTHOR : Renesas Technology Corp.
// HARDWARE : RENESAS HS7751RSTC01H (S1-E, ITS-DS5)
// TARGET OS : Microsoft(R) Windows(R) CE .NET 4.2
// FUNCTION : Function prototypes and structures
// HISTORY :
// 1999.04.26
// - Released as SMC91C94 LAN driver for PFM-DS6x by modifying
// NE2000 driver in PB2.12 reference drivers.
// (Detailed history for PFM-DS6x are omitted.)
// 2002.04.??
// - Diverted to LAN91C111 driver for HS7751RSTC01H without
// modification.
// 2002.09.05
// - Header style is changed and file informations are added.
/*++
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-1998 Microsoft Corporation. All rights reserved.
--*/
#ifndef _CELANSFT_
#define _CELANSFT_
#define CELAN_NDIS_MAJOR_VERSION 4
#define CELAN_NDIS_MINOR_VERSION 0
//
// This macro is used along with the flags to selectively
// turn on debugging.
//
#if DBG
#define IF_CELANDEBUG(f) if (CelanDebugFlag & (f))
extern ULONG CelanDebugFlag;
#define CELAN_DEBUG_LOUD 0x00000001 // debugging info
#define CELAN_DEBUG_VERY_LOUD 0x00000002 // excessive debugging info
#define CELAN_DEBUG_LOG 0x00000004 // enable CelanLog
#define CELAN_DEBUG_CHECK_DUP_SENDS 0x00000008 // check for duplicate sends
#define CELAN_DEBUG_TRACK_PACKET_LENS 0x00000010 // track directed packet lens
#define CELAN_DEBUG_WORKAROUND1 0x00000020 // drop DFR/DIS packets
#define CELAN_DEBUG_CARD_BAD 0x00000040 // dump data if CARD_BAD
#define CELAN_DEBUG_CARD_TESTS 0x00000080 // print reason for failing
//
// Macro for deciding whether to print a lot of debugging information.
//
#define IF_LOUD(A) IF_CELANDEBUG( CELAN_DEBUG_LOUD ) { A }
#define IF_VERY_LOUD(A) IF_CELANDEBUG( CELAN_DEBUG_VERY_LOUD ) { A }
//
// Whether to use the CelanLog buffer to record a trace of the driver.
//
#define IF_LOG(A) IF_CELANDEBUG( CELAN_DEBUG_LOG ) { A }
extern VOID CelanLog(UCHAR);
//
// Whether to do loud init failure
//
#define IF_INIT(A) A
//
// Whether to do loud card test failures
//
#define IF_TEST(A) IF_CELANDEBUG( CELAN_DEBUG_CARD_TESTS ) { A }
//
// Windows CE debug zones
//
#define ZONE_ERROR DEBUGZONE(0)
#define ZONE_WARN DEBUGZONE(1)
#define ZONE_FUNCTION DEBUGZONE(2)
#define ZONE_INIT DEBUGZONE(3)
#define ZONE_INTR DEBUGZONE(4)
#define ZONE_RCV DEBUGZONE(5)
#define ZONE_XMIT DEBUGZONE(6)
#define ZONE_COV1 DEBUGZONE(7)
#else
//
// This is not a debug build, so make everything quiet.
//
#define IF_LOUD(A)
#define IF_VERY_LOUD(A)
#define IF_LOG(A)
#define IF_INIT(A)
#define IF_TEST(A)
#endif
//
// Adapter->NumBuffers
//
// controls the number of transmit buffers on the packet.
// Choices are 1 through 12.
//
#define DEFAULT_NUMBUFFERS 12
//
// Create a macro for moving memory from place to place. Makes
// the code more readable and portable in case we ever support
// a shared memory Celan adapter.
//
#define CELAN_MOVE_MEM(dest,src,size) NdisMoveMemory(dest,src,size)
//
// The status of transmit buffers.
//
typedef enum {
EMPTY = 0x00,
FULL = 0x02
} BUFFER_STATUS;
//
// Type of an interrupt.
//
typedef enum {
RECEIVE = 0x01,
TRANSMIT = 0x02,
OVERFLOW = 0x04,
COUNTER = 0x08,
UNKNOWN = 0x10
} INTERRUPT_TYPE;
//
// Result of CelanIndicatePacket().
//
typedef enum {
INDICATE_OK,
SKIPPED,
ABORT,
CARD_BAD
} INDICATE_STATUS;
//
// Size of the ethernet header
//
#define CELAN_HEADER_SIZE 14
//
// Size of the ethernet address
//
#define CELAN_LENGTH_OF_ADDRESS 6
//
// Number of bytes allowed in a lookahead (max)
//
//#define CELAN_MAX_LOOKAHEAD (252 - CELAN_HEADER_SIZE)
#define CELAN_MAX_LOOKAHEAD (1518 - CELAN_HEADER_SIZE)
//
// Maximum number of transmit buffers on the card.
//
#define MAX_XMIT_BUFS 12
//
// Definition of a transmit buffer.
//
typedef UINT XMIT_BUF;
//
// Number of 256-byte buffers in a transmit buffer.
//
#define BUFS_PER_TX 1
//
// Size of a single transmit buffer.
//
#define TX_BUF_SIZE (BUFS_PER_TX*256)
//
// This structure contains information about the driver
// itself. There is only have one of these structures.
//
typedef struct _DRIVER_BLOCK {
//
// NDIS wrapper information.
//
NDIS_HANDLE NdisMacHandle; // returned from NdisRegisterMac
NDIS_HANDLE NdisWrapperHandle; // returned from NdisInitializeWrapper
//
// Adapters registered for this Miniport driver.
//
struct _CELAN_ADAPTER * AdapterQueue;
} DRIVER_BLOCK, * PDRIVER_BLOCK;
//
// This structure contains all the information about a single
// adapter that this driver is controlling.
//
typedef struct _CELAN_ADAPTER {
//
// This is the handle given by the wrapper for calling ndis
// functions.
//
NDIS_HANDLE MiniportAdapterHandle;
//
// Interrupt object.
//
NDIS_MINIPORT_INTERRUPT Interrupt;
//
// used by DriverBlock->AdapterQueue
//
struct _CELAN_ADAPTER * NextAdapter;
//
// This is a count of the number of receives that have been
// indicated in a row. This is used to limit the number
// of sequential receives so that one can periodically check
// for transmit complete interrupts.
//
ULONG ReceivePacketCount;
//
// Configuration information
//
//
// Number of buffer in this adapter.
//
UINT NumBuffers;
//
// Physical address of the IoBaseAddress
//
PVOID IoBaseAddr;
//
// Interrupt number this adapter is using.
//
CHAR InterruptNumber;
//
// Number of multicast addresses that this adapter is to support.
//
UINT MulticastListMax;
//
// The type of bus that this adapter is running on. Either ISA or
// MCA.
//
UCHAR BusType;
//
// InterruptType is the next interrupt that should be serviced.
//
UCHAR InterruptType;
//
// Type of celan card.
//
UINT CardType;
//
// Address of the memory window.
//
ULONG AttributeMemoryAddress;
ULONG AttributeMemorySize;
//
// Transmit information.
//
//
// The next available empty transmit buffer.
//
XMIT_BUF NextBufToFill;
//
// The next full transmit buffer waiting to transmitted. This
// is valid only if CurBufXmitting is -1
//
XMIT_BUF NextBufToXmit;
//
// This transmit buffer that is currently transmitting. If none,
// then the value is -1.
//
XMIT_BUF CurBufXmitting;
//
// TRUE if a transmit has been started, and have not received the
// corresponding transmit complete interrupt.
//
BOOLEAN TransmitInterruptPending;
//
// TRUE if a receive buffer overflow occurs while a
// transmit complete interrupt was pending.
//
BOOLEAN OverflowRestartXmitDpc;
//
// The current status of each transmit buffer.
//
BUFFER_STATUS BufferStatus[MAX_XMIT_BUFS];
//
// Used to map packets to transmit buffers and visa-versa.
//
PNDIS_PACKET Packets[MAX_XMIT_BUFS];
//
// The length of each packet in the Packets list.
//
UINT PacketLens[MAX_XMIT_BUFS];
//
// The first packet we have pending.
//
PNDIS_PACKET FirstPacket;
//
// The tail of the pending queue.
//
PNDIS_PACKET LastPacket;
//
// The address of the start of the transmit buffer space.
//
PUCHAR XmitStart;
//
// The address of the start of the receive buffer space.
PUCHAR PageStart;
//
// The address of the end of the receive buffer space.
//
PUCHAR PageStop;
//
// Status of the last transmit.
//
UCHAR XmitStatus;
//
// The value to write to the adapter for the start of
// the transmit buffer space.
//
UCHAR NicXmitStart;
//
// The value to write to the adapter for the start of
// the receive buffer space.
//
UCHAR NicPageStart;
//
// The value to write to the adapter for the end of
// the receive buffer space.
//
UCHAR NicPageStop;
//
// Receive information
//
//
// The value to write to the adapter for the next receive
// buffer that is free.
//
UCHAR NicNextPacket;
//
// The next receive buffer that will be filled.
//
UCHAR Current;
//
// Total length of a received packet.
//
UINT PacketLen;
//
// Operational information.
//
//
// Mapped address of the base io port.
//
ULONG IoPAddr;
//
// InterruptStatus tracks interrupt sources that still need to be serviced,
// it is the logical OR of all card interrupts that have been received and not
// processed and cleared. (see also INTERRUPT_TYPE definition in celan.h)
//
UCHAR InterruptStatus;
//
// The ethernet address currently in use.
//
UCHAR StationAddress[CELAN_LENGTH_OF_ADDRESS];
//
// The ethernet address that is burned into the adapter.
//
UCHAR PermanentAddress[CELAN_LENGTH_OF_ADDRESS];
//
// The adapter space address of the start of on board memory.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -