ITek_init.h
资源名称:mac.zip [点击查看]
上传用户:cnfair
上传日期:2007-01-07
资源大小:32k
文件大小:6k
源码类别:
驱动编程
开发平台:
Visual C++
- //
- // ITEK MAC driver initialization header file
- //
- #ifndef _ITEK_INIT_H_
- #define _ITEK_INIT_H_
- #define ITEK_DESCRIPTION "ImpressTek MAC Driver"
- #define ITEK_DRIVER_MAJOR 0x03
- #define ITEK_DRIVER_MINOR 0x00
- #define ITEK_VENDOR_ID (0x0000)
- #define ITEK_DEVICE_ID (0x0000)
- #define NIC_TOTAL_BITRATE (10) //in Mbps
- //lookahead and pdu size definition (tightly bound to Ethernet topology)
- #define ITEK_ADDRESS_SIZE (6)
- #define ITEK_PDU_HDRSIZE (14)
- #define ITEK_SDU_MAXSIZE (1500)
- #define ITEK_TX_MAXSIZE (1520) //
- #define ITEK_TX_MINSIZE (526) //
- #define ITEK_MAX_LOOKAHEAD (ITEK_SDU_MAXSIZE)
- #define ITEK_MOD_INC(x,y) (((x)+1) % (y))
- #define ITEK_MULTICASTLIST_MAX (10)
- #define ITEK_TIMEOUT_MSEC (2000)
- struct _ITEK_OPEN;
- // Mac reserved data structure, total size of 16 bytes
- typedef struct {
- struct _ITEK_OPEN *pITekOpen;
- PNDIS_PACKET pNextPacket; //Next Packet to be sent
- } ITEK_RESERVED_STRU, *PITEK_RESERVED_STRU;
- #define ITEK_RESERVED(pNdisPacket) ((PITEK_RESERVED_STRU)(pNdisPacket)->MacReserved)
- extern NDIS_PHYSICAL_ADDRESS HighestPhysicalAddress;
- typedef struct _DRIVER_BLOCK {
- //
- // NDIS wrapper information.
- //
- NDIS_HANDLE NdisMacHandle; // returned from NdisRegisterMac
- NDIS_HANDLE NdisWrapperHandle; // returned from NdisInitializeWrapper
- NDIS_MAC_CHARACTERISTICS MacCharacteristics;
- PDRIVER_OBJECT DriverObject;
- //
- // Adapters registered for this Mac driver.
- //
- struct _ITEK_ADAPTER *NextITek;
- } DRIVER_BLOCK, *PDRIVER_BLOCK;
- extern DRIVER_BLOCK gDriverBlock;
- // ITEK NIC driver object
- typedef struct _ITEK_ADAPTER {
- // NIC status
- NIC_STATUS NicStatus;
- //Spin Lock
- NDIS_SPIN_LOCK Lock; //For Windows95, set to ZERO
- //MacAdapter handle
- NDIS_HANDLE ITekAdapterHandle;
- //Configuration handle
- NDIS_HANDLE ConfigurationHandle;
- //Wrapper Handle
- NDIS_HANDLE WrapperHandle;
- //Bus type - ???NdisInterfaceInternal
- NDIS_INTERFACE_TYPE AdapterType;
- //Multicast List Max
- UINT MulticastListMax;
- //ITEK NIC parameters
- USHORT VendorID;
- USHORT DeviceID;
- //Packet Filter
- UCHAR PermanentAddress[ITEK_ADDRESS_SIZE];
- UCHAR CurrentAddress[ITEK_ADDRESS_SIZE];
- UCHAR DestinationAddress[ITEK_ADDRESS_SIZE];
- PETH_FILTER FilterDB;
- #ifdef ITEK_TIMER
- NDIS_TIMER NdisTimer;
- #endif
- PNDIS_PACKET pHeadPacket;
- PNDIS_PACKET pTailPacket;
- struct _ITEK_ADAPTER *NextITek;
- UINT ReferenceCount;
- struct _ITEK_OPEN *NextOpen;
- } ITEK_ADAPTER, *PITEK_ADAPTER;
- typedef struct _ITEK_OPEN {
- // NDIS wrapper information.
- NDIS_HANDLE NdisBindingContext; // passed to MacOpenAdapter
- UINT OpenOptions;
- PSTRING AddressingInformation; // not used currently
- // Links to our adapter.
- PITEK_ADAPTER pITekAdapter;
- struct _ITEK_OPEN *NextOpen;
- // Links to our MAC.
- PDRIVER_BLOCK pDriverBlock;
- // Index of this adapter in the filter database.
- NDIS_HANDLE NdisFilterHandle;
- // Indication information
- UINT MaxLookAhead;
- ULONG PacketFilter;
- // Reset/Close information.
- UINT ReferenceCount;
- BOOLEAN Closing; // is a close pending
- //NDIS_REQUEST CloseFilterRequest; // Holds Requests for pending close op
- //NDIS_REQUEST CloseAddressRequest;// Holds Requests for pending close op
- UINT ProtOptionFlags; //Holds the value of OID_GENERAL_PROTOCOL_OPTIONS
- } ITEK_OPEN, *PITEK_OPEN;
- // prototypes of our callbacks
- #ifdef __cplusplus
- extern "C" {
- #endif
- NTSTATUS NDIS_API
- DriverEntry(
- IN PDRIVER_OBJECT DriverObject, // NULL in Windows95 CHICAGO
- IN PUNICODE_STRING RegistryPath // NULL in Windows95 CHICAGO
- );
- NDIS_STATUS NDIS_API
- ITekAddAdapter(
- IN NDIS_HANDLE MacMacContext,
- IN NDIS_HANDLE ConfigurationHandle,
- IN PNDIS_STRING AdapterName
- );
- VOID NDIS_API
- ITekRemoveAdapter(
- IN PVOID MacAdapterContext
- );
- NDIS_STATUS NDIS_API
- ITekOpenAdapter(
- OUT PNDIS_STATUS OpenErrorStatus,
- OUT NDIS_HANDLE * MacBindingHandle,
- OUT PUINT SelectedMediumIndex,
- IN PNDIS_MEDIUM MediumArray,
- IN UINT MediumArraySize,
- IN NDIS_HANDLE NdisBindingContext,
- IN NDIS_HANDLE MacAdapterContext,
- IN UINT OpenOptions,
- IN PSTRING AddressingInformation OPTIONAL
- );
- NDIS_STATUS NDIS_API
- ITekCloseAdapter(
- IN NDIS_HANDLE MacBindingHandle
- );
- NDIS_STATUS NDIS_API
- ITekReset(
- IN NDIS_HANDLE MacBindingHandle
- );
- NDIS_STATUS NDIS_API
- ITekRequest(
- IN NDIS_HANDLE MacBindingHandle,
- IN PNDIS_REQUEST NdisRequest
- );
- NDIS_STATUS NDIS_API
- ITekQueryGlobalStatistics(
- IN NDIS_HANDLE MacBindingHandle,
- IN PNDIS_REQUEST NdisRequest
- );
- VOID NDIS_API
- ITekUnload(
- IN NDIS_HANDLE MacMacContext
- );
- NDIS_STATUS NDIS_API
- ITekTransferData(
- IN NDIS_HANDLE MacBindingHandle,
- IN NDIS_HANDLE MacReceiveContext,
- IN UINT ByteOffset,
- IN UINT BytesToTransfer,
- OUT PNDIS_PACKET Packet,
- OUT PUINT BytesTransferred
- );
- NDIS_STATUS NDIS_API
- ITekSend(
- IN NDIS_HANDLE MacBindingHandle,
- IN PNDIS_PACKET Packet
- );
- NDIS_STATUS NDIS_API
- ITekQueryInformation(
- IN NDIS_HANDLE ITekAdapterContext,
- IN NDIS_HANDLE ITekOpenContext,
- IN NDIS_OID Oid,
- IN PVOID InformationBuffer,
- IN ULONG InformationBufferLength,
- OUT PULONG BytesWritten,
- OUT PULONG BytesNeeded
- );
- NDIS_STATUS NDIS_API
- ITekSetInformation(
- IN NDIS_HANDLE ITekAdapterContext,
- IN NDIS_HANDLE ITekOpenContext,
- IN PNDIS_REQUEST NdisRequest,
- IN NDIS_OID Oid,
- IN PVOID InformationBuffer,
- IN ULONG InformationBufferLength,
- OUT PULONG BytesRead,
- OUT PULONG BytesNeeded
- );
- NDIS_STATUS NDIS_API
- ITekAddressChangeAction(
- IN UINT OldFilterCount,
- IN CHAR OldAddresses[][ETH_LENGTH_OF_ADDRESS],
- IN UINT NewFilterCount,
- IN CHAR NewAddresses[][ETH_LENGTH_OF_ADDRESS],
- IN NDIS_HANDLE MacBindingHandle,
- IN PNDIS_REQUEST NdisRequest,
- IN BOOLEAN Set
- );
- NDIS_STATUS NDIS_API
- ITekFilterChangeAction(
- IN UINT OldFilterClasses,
- IN UINT NewFilterClasses,
- IN NDIS_HANDLE MacBindingHandle,
- IN PNDIS_REQUEST NdisRequest,
- IN BOOLEAN Set
- );
- VOID NDIS_API
- ITekCloseAction(
- IN NDIS_HANDLE MacBindingHandle
- );
- #ifdef __cplusplus
- }
- #endif
- #endif /* _ITEK_INIT_H_ */