?? smsc111.h
字號:
//
// Copyright(C) Renesas Technology Corp. 2005. All rights reserved.
//
// LAN91C111 Network Driver for ITS-DS7
//
// FILE : smsc111.h
// CREATED : 2005.05.10
// MODIFIED :
// AUTHOR : Renesas Technology Corp.
// HARDWARE : RENESAS ITS-DS7
// HISTORY :
// 2005.05.10
// - Created release code.
// (based on SMSC100FD NETCARD driver for PUBLIC for WCE5.0)
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// Use of this source code is subject to the terms of the Microsoft 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 LICENSE.RTF on your
// install media.
//
/****************************************************************
* *
* SMSC111 Ethernet Driver for Windows CE. *
* *
****************************************************************/
#ifndef _SMSC111_H_
#define _SMSC111_H_
//
// The Version of NDIS that the driver is compatible with
//
#define SMSC111_NDIS_MAJOR_VERSION 4
#define SMSC111_NDIS_MINOR_VERSION 0
//
// Windows CE debug zones
//
#if DBG
#define ZONE_ERROR_BIT 0
#define ZONE_WARN_BIT 1
#define ZONE_FUNCTION_BIT 2
#define ZONE_INIT_BIT 3
#define ZONE_INTR_BIT 4
#define ZONE_RCV_BIT 5
#define ZONE_XMIT_BIT 6
#define ZONE_LINK_BIT 7
#define ZONE_ERROR_MASK (1 << ZONE_ERROR_BIT)
#define ZONE_WARN_MASK (1 << ZONE_WARN_BIT)
#define ZONE_FUNCTION_MASK (1 << ZONE_FUNCTION_BIT)
#define ZONE_INIT_MASK (1 << ZONE_INIT_BIT)
#define ZONE_INTR_MASK (1 << ZONE_INTR_BIT)
#define ZONE_RCV_MASK (1 << ZONE_RCV_BIT)
#define ZONE_XMIT_MASK (1 << ZONE_XMIT_BIT)
#define ZONE_LINK_MASK (1 << ZONE_LINK_BIT)
#define ZONE_ERROR DEBUGZONE(ZONE_ERROR_BIT)
#define ZONE_WARN DEBUGZONE(ZONE_WARN_BIT)
#define ZONE_FUNCTION DEBUGZONE(ZONE_FUNCTION_BIT)
#define ZONE_INIT DEBUGZONE(ZONE_INIT_BIT)
#define ZONE_INTR DEBUGZONE(ZONE_INTR_BIT)
#define ZONE_RCV DEBUGZONE(ZONE_RCV_BIT)
#define ZONE_XMIT DEBUGZONE(ZONE_XMIT_BIT)
#define ZONE_LINK DEBUGZONE(ZONE_LINK_BIT)
#endif
//
// Interrupt request for SMSC111
//
//#define SMSC111Irq (SYSINTR_ETHER - SYSINTR_FIRMWARE)
//
// Size of the ethernet header
//
#define ETHER_HEADER_SIZE 14
//
// Read and Write word macros for accessing the SMSC111 Registers
//
//#define ReadWord(wOffset) (*((UINT16 volatile *)((pAdapter->pVirtualRegisterBase) + (wOffset))))
//#define ReadDWord(wOffset) (*((UINT volatile *)((pAdapter->pVirtualRegisterBase) + (wOffset))))
//#define WriteWord(wOffset, Value) (*((UINT16 volatile *)((pAdapter->pVirtualRegisterBase) + (wOffset))) = (Value))
//
// Size of the ethernet address
//
#define ETHER_LENGTH_OF_ADDRESS 6
//
// Maximum number of bytes in a packet
//
#define MAX_PACKET 1518
//
// Number of bytes allowed in a lookahead (max)
//
#define MAX_LOOKAHEAD (MAX_PACKET - ETHER_HEADER_SIZE)
//
// Valid value ranges for the InterruptNumber.
//
#define MAX_IRQ (SYSINTR_MAXIMUM - SYSINTR_FIRMWARE)
//
// Default value for maximum number of multicast addrersses
//
#define DEFAULT_MULTICASTLISTMAX 8
//
// Maximum amount of time to wait for MMU
//
#define MMU_WAIT_LOOP 1000000
//
// Configuration strings
//
#define INTERRUPT NDIS_STRING_CONST("InterruptNumber")
//
// This structure contains information about the driver
// itself. There is only one of these.
//
typedef struct _DRIVER_BLOCK
{
//
// NDIS wrapper information.
//
NDIS_HANDLE NdisWrapperHandle; // returned from NdisInitializeWrapper
//
// Adapters registered for this Miniport driver.
//
struct _SMSC111_ADAPTER *AdapterQueue;
} DRIVER_BLOCK, *PDRIVER_BLOCK;
//
// This structure contains all the information about a single
// adapter that this driver is controlling.
//
typedef struct _SMSC111_ADAPTER
{
//
// This is the handle given by the wrapper for calling NDIS functions.
//
NDIS_HANDLE hMiniportAdapterHandle;
//
// used by DriverBlock->AdapterQueue
//
struct _SMSC111_ADAPTER *NextAdapter;
//
// The Virtual address of the SMSC111 registers
//
PBYTE pVirtualRegisterBase;
//
// Address MultiPlier
//
UINT uMultiplier;
//
// Interrupt object.
//
NDIS_MINIPORT_INTERRUPT Interrupt;
//
// Interrupt number this adapter is using.
//
UCHAR ucInterruptNumber;
//
//
ULONG ulIoBaseAddress;
//
// The Ethernet address currently in use.
//
UCHAR ucStationAddress[ETHER_LENGTH_OF_ADDRESS];
UCHAR ucPermanentAddress[ETHER_LENGTH_OF_ADDRESS];
//
// The current packet filter in use.
//
ULONG ulPacketFilter;
//
// Statistics used by Set/QueryInformation.
//
ULONG ulFramesXmitGood; // Good Frames Transmitted
ULONG ulFramesRcvGood; // Good Frames Received
ULONG ulFramesXmitBad; // Bad Frames Transmitted
ULONG ulFramesXmitOneCollision; // Frames Transmitted with one collision
ULONG ulFramesXmitManyCollisions; // Frames Transmitted with > 1 collision
ULONG ulFrameAlignmentErrors; // FAE errors counted
ULONG ulCrcErrors; // CRC errors counted
ULONG ulMissedPackets; // Missed packets counted
//
// Images of card registers, to be restored after a reset.
//
UCHAR ucNicMulticastRegs[8]; // Contents of multicast registers
USHORT usNicReceiveConfig; // Contents of the RCR
USHORT usNicTransmitConfig; // Contents of the TCR
USHORT usNicInterruptMask; // Contents of the IMR
//
// The lookahead buffer size in use.
//
ULONG ulMaxLookAhead;
//
// Lookahead buffer
//
USHORT usLookahead[((MAX_LOOKAHEAD + ETHER_HEADER_SIZE + 1) / sizeof (USHORT))];
//
// List of multicast addresses in use.
//
UCHAR ucAddresses[DEFAULT_MULTICASTLISTMAX][ETHER_LENGTH_OF_ADDRESS];
} SMSC111_ADAPTER, *PSMSC111_ADAPTER;
//
// Structure describing Registry values
//
typedef struct _REG_VALUE_DESCR {
LPWSTR val_name;
DWORD val_type;
PBYTE val_data;
} REG_VALUE_DESCR, *PREG_VALUE_DESCR;
//
#define IOADDRESS NDIS_STRING_CONST("IoBaseAddress")
#define INTERRUPT NDIS_STRING_CONST("InterruptNumber")
#define IOMULTIPLIER NDIS_STRING_CONST("IoMultiplier")
#define BUS_TYPE NDIS_STRING_CONST("BusType")
//
// Forward References
//
BOOL AddKeyValues (LPWSTR KeyName, PREG_VALUE_DESCR Vals);
LPWSTR Install_Driver (LPWSTR lpPnpId, LPWSTR lpRegPath, DWORD cRegPathSize);
VOID CardBlockInterrupts (IN PSMSC111_ADAPTER Adapter);
VOID CardUnblockInterrupts (IN PSMSC111_ADAPTER Adapter);
VOID CardStop (IN PSMSC111_ADAPTER pAdapter);
VOID CardReadEthernetAddress (IN PSMSC111_ADAPTER pAdapter);
VOID CardStart (IN PSMSC111_ADAPTER pAdapter);
VOID CardFillMulticastRegs (IN PSMSC111_ADAPTER pAdapter);
VOID CardGetMulticastBit(IN UCHAR ucAddress[ETHER_LENGTH_OF_ADDRESS], OUT PUCHAR pByte, OUT PUCHAR pValue);
BOOLEAN CardReset (IN PSMSC111_ADAPTER pAdapter);
BOOLEAN CardInitialize (IN PSMSC111_ADAPTER pAdapter);
BOOLEAN CardSetup (IN PSMSC111_ADAPTER pAdapter);
ULONG CardComputeCrc (IN PUCHAR pBuffer, IN UINT uiLength);
BOOLEAN SyncCardSetAllMulticast (IN PVOID pSynchronizeContext);
BOOLEAN SyncCardCopyMulticastRegs (IN PVOID pSynchronizeContext);
BOOLEAN SyncCardSetReceiveConfig (IN PVOID pSynchronizeContext);
VOID Smsc111Isr (OUT PBOOLEAN pbInterruptRecognized, OUT PBOOLEAN pbQueueDpc, IN PVOID pContext);
VOID Smsc111HandleInterrupt (IN NDIS_HANDLE hMiniportAdapterContext);
VOID Smsc111EnableInterrupt (IN NDIS_HANDLE MiniportAdapterContext);
VOID Smsc111DisableInterrupt (IN NDIS_HANDLE MiniportAdapterContext);
VOID Smsc111Halt (IN NDIS_HANDLE MiniportAdapterContext);
VOID Smsc111Shutdown (IN NDIS_HANDLE MiniportAdapterContext);
NDIS_STATUS Smsc111Initialize (OUT PNDIS_STATUS OpenErrorStatus, OUT PUINT puiSelectedMediumIndex, IN PNDIS_MEDIUM MediumArray, IN UINT uiMediumArraySize, IN NDIS_HANDLE MiniportAdapterHandle, IN NDIS_HANDLE ConfigurationHandle);
NDIS_STATUS Smsc111RegisterAdapter (IN PSMSC111_ADAPTER pAdapter, IN NDIS_HANDLE ConfigurationHandle, IN BOOLEAN bConfigError, IN ULONG ulConfigErrorValue);
NDIS_STATUS Smsc111Reset (OUT PBOOLEAN pbAddressingReset, IN NDIS_HANDLE MiniportAdapterContext);
NDIS_STATUS Smsc111QueryInformation (IN NDIS_HANDLE MiniportAdapterContext, IN NDIS_OID Oid, IN PVOID pInformationBuffer, IN ULONG ulInformationBufferLength, OUT PULONG pulBytesWritten, OUT PULONG pulBytesNeeded);
NDIS_STATUS Smsc111Send (IN NDIS_HANDLE hMiniportAdapterContext, IN PNDIS_PACKET pPacket, IN UINT uiFlags);
NDIS_STATUS DispatchSetPacketFilter (IN PSMSC111_ADAPTER pAdapter);
NDIS_STATUS DispatchSetMulticastAddressList (IN PSMSC111_ADAPTER pAdapter);
VOID Smsc111WritePhy (IN PSMSC111_ADAPTER pAdapter, USHORT usPhyRegister, USHORT usPhyData);
USHORT Smsc111ReadPhy (IN PSMSC111_ADAPTER pAdapter, USHORT usPhyRegister);
void LAN91C111Init(IN PSMSC111_ADAPTER pAdapter);
void PHYDiag(IN PSMSC111_ADAPTER pAdapter);
#endif // _SMSC111_H_
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -