如题,新手面前有个不小的坎,希望能有老手帮忙指点,谢谢啦~~~~~
这两天一直在做6400上的dm9000a的驱动,是在以前的2440的源码基础上修改的
这个板子的DM9000的CS#接在mpu的Xm0nCs4上,INT#接在XEINT9即af19引脚上,我查了下技术手册ncs4对应的地址是0x3000_0000,所以我在头文件中定义了它的基地址:
#define BSP_BASE_REG_PA_DM9000A_IOBASE 0x30000000
#define BSP_BASE_REG_PA_DM9000A_MEMBASE 0x30000000
不知道这样对不对,这里使用的地址应该还是物理地址吧,还有那个MEMBASE该如何确定,是不是与IOBASE一致?
我又将IRQ设为9:
CONFIG_PARAMETER g_szDm9ConfigParams[] =
{
。
。
。
{ CID_IRQ_NUMBER, 9, NDIS_STRING_CONST("IrqNumber")},
。
。
。
};
再后来按照readme修改project.bib和project.reg。下面是我的改的reg:
[HKEY_LOCAL_MACHINE\Windows CE Tools]
"Platform"="{a6e36254-01d9-408b-ac00-a0e76270fcd2}"
[HKEY_LOCAL_MACHINE\Comm\DM9CE]
"DisplayName"="DM9000 ISA Fast Ethernet Adapter"
"Group"="NDIS"
"ImagePath"="dm9isa.dll"
[HKEY_LOCAL_MACHINE\Comm\DM9CE\Linkage]
"Route"=multi_sz:"DM9CE1"
[HKEY_LOCAL_MACHINE\Comm\DM9CE1]
"DisplayName"="DM9000 ISA Fast Ethernet Adapter"
"Group"="NDIS"
"ImagePath"="dm9isa.dll"
[HKEY_LOCAL_MACHINE\Comm\Tcpip\Linkage]
"Bind"="dm9ce1"
[HKEY_LOCAL_MACHINE\Comm\DM9CE1\Parms]
"BusNumber"=dword:0
"BusType"=dword:1
"XmitBuffer"=dword:20
"RecvBuffer"=dword:20
"IrqNumber"=dword:64
"SysIntr"=dword:19
"IoAddress"=dword:30000000
[HKEY_LOCAL_MACHINE\Comm\DM9CE1\Parms\TcpIp]
"EnableDHCP"=dword:1
"UseZeroBroadcast"=dword:0
"DefaultGateway"="192.168.1.1"
"IpAddress"="192.168.1.119"
"Subnetmask"="255.255.255.0"
"DNS"="210.21.196.6"
"WINS"=""
[HKEY_LOCAL_MACHINE\Comm\DM9CE1\Parms]
"MACAddress"="00-11-22-33-44-55"
接着就是编译,下载,但老是说它是unknown device
dm9000 init.
vals are C8E0C8E0
val1 = DeviceReadPort(DM9_VIDL); is
8
val1 |= ((DeviceReadPort(DM9_VIDH)<<8)-0x100); is
808
val2 = DeviceReadPort(DM9_PIDL); is
A
val2 |= ((DeviceReadPort(DM9_PIDH)<<8)-0x100); is
A0A
Unknown device
[dm9]: Chip signature is 808 A0A
[dm9]: IRQ= 0x64
MAC address:00-11-22-33-44-55
-OALIntrRequestSysIntr(irq = 100, sysIntr = 22)
Where am I???????????[UFNPDD] USB Serial Function Class Enabled
[USB] dii.dwIrq = 96
-OALIntrRequestSysIntr(irq = 96, sysIntr = 23)
Where am I???????????Current Client "Serial_Class"
[UFNPDD] USB Serial Function Class Enabled
[UFNPDD] OTG Cable Attached
里面有部分输出是我自己添加的,用来查看val。下面是是我修改的这部分代码:
- void C_DM9000::EDeviceRegisterIoSpace(void)
- {
- RETAILMSG(1,(TEXT("\r\ndm9000 init.\r\n")));
- NIC_DEVICE_OBJECT::EDeviceRegisterIoSpace();
-
- U16 val1,val2,t_v1;//t_v2;
- #ifdef TEST
- RETAILMSG(1,(TEXT("vals are %0X%4X\r\n"), val1,val2));//0xc900 0xc900
- #endif
-
- val1 = DeviceReadPort(DM9_VIDL); //
- #ifdef TEST
- RETAILMSG(1,(TEXT("val1 = DeviceReadPort(DM9_VIDL); is\n\t %0X\r\n"), val1));
- #endif
-
- //t_v1 = DeviceReadPort(DM9_VIDH)<<8;
- //RETAILMSG(1,(TEXT("t_v1 loop 8:%0X\r\n"), t_v1));
- val1 |= ((DeviceReadPort(DM9_VIDH)<<8)-0x100);//
- //val1 -=0x100;
- #ifdef TEST
- RETAILMSG(1,(TEXT("val1 |= ((DeviceReadPort(DM9_VIDH)<<8)-0x100); is\n\t%0X\r\n"), val1));
- #endif
-
- val2 = DeviceReadPort(DM9_PIDL); //
- #ifdef TEST
- RETAILMSG(1,(TEXT("val2 = DeviceReadPort(DM9_PIDL); is\n\t %4X\r\n"), val2));
- #endif
-
- val2 |= ((DeviceReadPort(DM9_PIDH)<<8)-0x100); //
- //val2 -=0x100;
- #ifdef TEST
- RETAILMSG(1,(TEXT("val2 |= ((DeviceReadPort(DM9_PIDH)<<8)-0x100); is\n\t %4X\r\n"), val2));
- #endif
- if( (val1 != DM9000_VID) || (val2 != DM9000_PID))
- {
- RETAILMSG(1,(TEXT("Unknown device\r\n")));
- RETAILMSG(1,(TEXT("[dm9]: Chip signature is %0X%4X\r\n"), val1,val2));
- RETAILMSG(1,(TEXT("[dm9]: IRQ= 0x%02X\r\n"), m_szConfigures[CID_IRQ_NUMBER]));
- }
- }
上面代码中减去0x100是因为我认为之前的版本(
val2 |= DeviceReadPort(DM9_PIDH)<<8;)并没有达到将val中存储的8位数据自身复制组成U16类型的目的,就是说把0x08转换成0x808。
最终结果是,DNW 输出unknown device,系统中却又网络图标,但是接上网络,接头上的等不闪。