📄 dm9000.cpp
字号:
// DM9000.cpp: implementation of the DM9000 class.
//
// Copyright (c) 2000-2007 Davicom Inc. All rights reserved.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "DM9000.h"
#include "ver.h" //[chip]
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
DM9000::DM9000(NIC_DRIVER_OBJECT *pUpper,PVOID pVoid) : DM9ISA(pUpper,pVoid)
{
}
DM9000::~DM9000()
{
}
DWORD DM9000::GetDriverChipID()
{
return DM9000_CHIP_ID;
}
LPCTSTR DM9000::GetDriverVersion(void)
{
return DM9000_DRIVER_VERSION;
}
//LPCTSTR DM9000::GetReleaseDate(void)
//{
// return DM9000_RELEASE_DATE;
//}
void DM9000::InitialChip()
{
//(+)2008-01-10 Richard Chung
/* For DM9000B */
//Sometime the noise was causing some bytes missing from a packet.
//if ( GetChipRevision() == DM9000_REV_B)
//{
// DWORD dwPBCR = 0; /* Processor Bus Control Register (38H) */
// dwPBCR = DeviceReadPort(DM9_PBCR)& 0x9F ;
// dwPBCR |= 0x20; /* Data Bus Current Driving/Sinking Capability */
// /* bit6:bit5 01 => 4mA , default is 2mA */
// DeviceWritePort(DM9_PBCR, dwPBCR);
//}
//(-)2008-01-10 Richard Chung
}
DWORD DM9000::GetChipRevision(void)
{
// DWORD dwChipRevision;
DWORD dwChipRevision= DM9000_REV;
// dwChipRevision = DeviceReadPort(0x43) & 0x24;
// dwChipRevision |= DeviceReadPort(0x2c)<<8;
// dwRevCheck = DeviceReadPort(0x2c);
// return dwChipRevision;
// B[0x00]
// BI[0x00]
// C[0x04] 0000,0100b
// D[0x20], 0010,0000b
// D-3A[0x20], 0010,0000b *
// D-3K[0x04], 0000,0100b *
// B-3A[0x24], 0010,0100b ** // L03547A
DWORD dwRevCheck = DeviceReadPort(0x2c);
if ( (dwRevCheck == 0x19) || (dwRevCheck == 0x1A))
{
dwChipRevision= DeviceReadPort(0x43);
_CUR_RREG(RN_0X43,0x43,dwChipRevision);
if (dwRevCheck == 0x1A)
dwChipRevision= ((dwChipRevision >> 4) & 0x2) | ((dwChipRevision >> 2) & 0x1);
else
dwChipRevision= 0;
dwChipRevision += ((dwRevCheck+1) & 0xF);
if (dwChipRevision == 0x0E) // Skip similiar to 9000E model number!
dwChipRevision++;
}
return dwChipRevision;
}
DWORD DM9000::GetDriverRevision(void)
{
#ifdef TARGET_DM9000A
return DM9000_REV_A;
#endif
#ifdef TARGET_DM9000B
return DM9000_REV_B;
#endif
#ifdef TARGET_DM9000C
return DM9000_REV_C;
#endif
#ifdef TARGET_DM9000D
return DM9000_REV_D;
#endif
#ifdef TARGET_DM9000D_3A
return DM9000_REV_D_3A;
#endif
#ifdef TARGET_DM9000D_3K
return DM9000_REV_D_3K;
#endif
/*
#ifdef TARGET_DM9000E
return DM9000_REV_E;
#endif
*/
#ifdef TARGET_DM9000B_3A
return DM9000_REV_B_3A;
#endif
/*
#ifdef TARGET_DM9000
#endif
*/
return DM9000_REV_E;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -