📄 dm9isa.h
字号:
//========================================================================
// Class Name : DM9ISA
// Purpose :
// Autor : Richard Chuang
// Email :
// Description :
// Reference :
// Copyright : Copyright (c) 2000-2007 Davicom Inc. All rights reserved.
// -----------------------------------------------------------------------
// Version : 3.0.0.2
// Update : 2008-01-17
// Modified : Richard Chung
// Description :
// -----------------------------------------------------------------------
// How to use:
//
#ifndef _DAVICOM_DM9ISA_H_
#define _DAVICOM_DM9ISA_H_
#include "stdafx.h"
#include "device.h"
#include "driver.h"
#define IMPL_FLOW_CONTROL
//(+)20080110 By Joseph
//#define IMPL_GIGABIT_ETHERNET //for GIGA-RICHARD, WIST-JUDES-RON
//(-)20080110 By Joseph
// .{typedef enum . DM9000_REGISTER_TYPE}
//(+)20080110 By Joseph
#define DM9KS_LINK_INTR 0x20
//(-)20080110 By Joseph
enum VLAN_GROUP
{
VLAN_GROUP0=0xb0,
VLAN_GROUP1=0xb1,
VLAN_GROUP2=0xb2,
VLAN_GROUP3=0xb3,
VLAN_GROUP4=0xb4,
VLAN_GROUP5=0xb5,
VLAN_GROUP6=0xb6,
VLAN_GROUP7=0xb7,
VLAN_GROUP8=0xb8,
VLAN_GROUP9=0xb9,
VLAN_GROUP10=0xba,
VLAN_GROUP11=0xbb,
VLAN_GROUP12=0xbc,
VLAN_GROUP13=0xbd,
VLAN_GROUP14=0xbe,
VLAN_GROUP15=0xbf,
};
/******************************************************************************************
*
* Definition of C_DM9000
*
*******************************************************************************************/
#define DM9_MULTICAST_LIST 64
typedef struct _DM9_RX_DESCRIPTOR_
{
U8 bState;
U8 bStatus;
U16 nLength;
} DM9_RX_DESCRIPTOR, *PDM9_RX_DESCRIPTOR;
/*******************************************************************************
*
* Device DM9ISA characteristics
*
* - ISA device, program IO.
* Note: The theoretical maximum transfer rate of one ISA is only 8MBps.
* - On chip 16K byte memory, 3K for TX and 13K for RX.
* - MAC is responsible to maintain the buffer chain.
* - Provide word-level interface for EEPROM and PHY access.
*
*******************************************************************************/
class DM9ISA : public NIC_DEVICE_OBJECT
{
public:
BYTE m_JJ_PrintMessage_control;
public:
//==========================================================================
// Constructor/Destrcutor
//==========================================================================
DM9ISA::DM9ISA(NIC_DRIVER_OBJECT *pUpper,PVOID pVoid);
//==========================================================================
// Member functions
//==========================================================================
public:
// Device control routines
void DbgDump(DWORD dwPort);
void DbgDumpDBL(DWORD dwPortH, DWORD dwPortL);
void DbgDumpChip(void);
virtual void DbgDUMP_REGs(TCHAR *CFN);
virtual void DeviceStart( void);
virtual void DeviceReset( void);
virtual void DeviceEnableInterrupt( void);
virtual void DeviceDisableInterrupt( void);
virtual U32 DeviceGetInterruptStatus( void);
virtual U32 DeviceSetInterruptStatus( U32);
virtual U32 DeviceGetReceiveStatus( void);
virtual U32 DeviceHardwareStatus(void);
virtual void DeviceEnableReceive(void);
virtual void DeviceDisableReceive(void);
//virtual BOOL DeviceCheckForHang(void); // JJ(+)
protected:
DWORD GetChipID(void); // Get ChipID from Register(abstract function)
virtual DWORD GetDriverRevision(void)= 0; // Get Driver Revision
virtual DWORD GetChipRevision(void)= 0; // Get Driver Revision
// overwrite routines with exception
virtual void InitialHardware(int);
void InitialChip(void);
//void InitialLinkProg(int n);
// Device attributes and characteristics
PCONFIG_PARAMETER GetConfigureParameters(void);
virtual void ValidateConfigurations(void);
void InitialEepromFieldPosition(void); //DeviceSetEepromFormat(void);
//--------------------------------------------------------------------------
// Device access routines
//--------------------------------------------------------------------------
DWORD DeviceReadPort(DWORD dwPort);
DWORD DeviceWritePort(DWORD dwPort,DWORD dwValue);
WORD DeviceReadEeprom(DWORD dwAddress);
WORD DeviceWriteEeprom(DWORD dwAddress,WORD wValue);
WORD DeviceReadPhy(DWORD dwPhyRegister,DWORD dwOffset);
WORD DeviceWritePhy(DWORD dwPhyRegister,DWORD dwOffset,WORD wValue);
int OP_GetMaxTxPending();
void OP_SetLinkMode(int linkMode);
BOOL OP_ShowLinkMode();
BOOL OP_ShowLinkMode(int PIndex);
int LnkStat_WaitLinkUp(void); //BOOL(LPWSTR head, LPWSTR modename, LPWSTR linkname);
BOOL LnkStat_SetLinkMode(int linkMode, LPWSTR modename);
int LnkStat_GetLinkStatus(void);
BOOL ISA_LinkUp(void);
int ISA_LinkUpProcess(int i); //LinkState_LinkUp(int i)
WORD LinkState_Op(int i);
WORD LinkState_GetBMCR(int i);
WORD LinkState_Get_BMSR(int i);
WORD LinkState_Get_DSCSR(LPWSTR head, int i);
WORD LinkState_Get_DSCSR_EX(LPWSTR head, LPWSTR regname, int i);
WORD LinkState_Get_SCFG(LPWSTR head, int i);
// WORD GetLinkState_init();
WORD DeviceCheckLink(void);
virtual WORD GetLinkState();
virtual void Pnt_Dot_MsgCtrl(WORD wLinkState);
//--------------------------------------------------------------------------
// device control routines
//--------------------------------------------------------------------------
// overwrite this routine for identification purpose
void RegisterIoSpace(void);
// Device access routines, new
// And ISA ckeck routine
virtual DWORD DeviceReadData(void);
virtual DWORD DeviceReadDataWithoutIncrement(void);
virtual PBYTE DeviceReadData(PBYTE pbtBuffer, int nLength);
virtual PBYTE DeviceWriteData(PBYTE pbtBuffer, int nLength);
void ISA_TxFIFO_Begin(); // for-check
void ISA_TxFIFO_End(); // for-check
// There is no hardware control for transmission,
// so, need to set one flag to control the tx.
virtual void DeviceEnableTransmit(void){ m_fTxEnabled=1; };
virtual void DeviceDisableTransmit(void){ m_fTxEnabled=0; };
// Device hanlder routines
virtual int DeviceOnSetupFilter( U32);
virtual void DeviceInterruptEventHandler( U32);
virtual void DeviceResetPHYceiver(void);
// Device hanlder routines
// And can be re-written
virtual int DeviceSend(PCQUEUE_GEN_HEADER); // [virtual: Parent will call, but child can modify(re-write!)]
// class specific routines
virtual int Dm9LookupRxBuffers(void);
#ifdef IMPL_DEVICE_ISR
virtual void DeviceIsr(U32);
#endif
virtual void DeviceHalt(void);
//public:
protected:
#ifdef IMPL_STORE_AND_INDICATION
virtual void DeviceOnTimer(void);
CQueue m_RQueue;
CQueue m_RQStandby;
#endif
virtual BOOL DeviceQueryTxResources(void);
//==========================================================================
// Data Member
//==========================================================================
public:
protected:
CSpinlock m_spinAccessToken;
U32 m_uLastAddressPort;
int m_nIoMode;
int m_nIoMaxPad;
bool m_auto_mdix_flgb;
int m_nMaxTxPending;
int m_nTxPendings;
};
#endif // _DAVICOM_DM9ISA_H_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -