1. 中断部分的修改
加入中断配置,严格按照原来的架构。
相关阅读: Redboot 的DM9000 网卡驱动在 MINI2440平台的移植 http://www.linuxidc.com/Linux/2011-03/33439.htm
ricky@ricky-laptop:/opt/ecos/ecos-hg$ hg diff
diff -r 62c4efcc7b5b packages/devs/eth/arm/mini2440/current/include/mini2440_eth_driver.inl
--- a/packages/devs/eth/arm/mini2440/current/include/mini2440_eth_driver.inl Mon Mar 14 23:13:43 2011 +0800
+++ b/packages/devs/eth/arm/mini2440/current/include/mini2440_eth_driver.inl Tue Mar 15 17:17:37 2011 +0800
@@ -63,7 +63,8 @@
mac_address: CYGDAT_DEVS_ETH_ARM_MINI2440_ETH0_ESA,
#endif
io_addr: (volatile unsigned char *)0x20000300,
- io_data: (volatile unsigned char *)0x20000304
+ io_data: (volatile unsigned char *)0x20000304,
+ interrupt: CYGNUM_HAL_INTERRUPT_EINT4_7
};
ETH_DRV_SC(dm9000_sc0,
diff -r 62c4efcc7b5b packages/hal/arm/arch/current/src/vectors.S
--- a/packages/hal/arm/arch/current/src/vectors.S Mon Mar 14 23:13:43 2011 +0800
+++ b/packages/hal/arm/arch/current/src/vectors.S Tue Mar 15 17:17:37 2011 +0800
@@ -393,7 +393,7 @@
LED 4
-#if defined(CYG_HAL_STARTUP_ROM) || defined(CYG_HAL_STARTUP_ROMRAM)
+#if defined(CYG_HAL_STARTUP_ROM) || defined(CYG_HAL_STARTUP_ROMRAM) ||defined(CYG_HAL_STARTUP_QEMU)
// Set up reset vector
ldr r0,=CYGHWR_HAL_VECTOR_TABLE_BASE
ldr r1,.__exception_handlers
@@ -405,6 +405,8 @@
str r2,[r0,#HAL_ARM_RESET_VECTOR_ADDR]
# endif
# endif
+#endif
+#if defined(CYG_HAL_STARTUP_ROM) || defined(CYG_HAL_STARTUP_ROMRAM)
// Relocate [copy] data from ROM to RAM
ldr r3,.__rom_data_start
ldr r4,.__ram_data_start
diff -r 62c4efcc7b5b packages/hal/arm/arm9/mini2440/current/src/mini2440_misc.c
--- a/packages/hal/arm/arm9/mini2440/current/src/mini2440_misc.c Mon Mar 14 23:13:43 2011 +0800
+++ b/packages/hal/arm/arm9/mini2440/current/src/mini2440_misc.c Tue Mar 15 17:17:37 2011 +0800
@@ -307,6 +307,13 @@
HAL_WRITE_UINT32(EXTINT0, 0x12222222); // EINT[7:0]
HAL_WRITE_UINT32(EXTINT1, 0x22222222); // EINT[15:8]
HAL_WRITE_UINT32(EXTINT2, 0x22222222); // EINT[23:16]
+
+
+ //ENABLE EXTERN INT
+ //EINT DM9000 INT UNMASK
+ HAL_READ_UINT32(EINTMASK, reg);
+ reg &= (~(1<<7));
+ HAL_WRITE_UINT32(EINTMASK, reg);
}
2. 网络测试
ecosconfig new mini2440 net
ecosconfig tree
make
make tests
在install目录里面的tests有网络部分的测试,但是ping_lo_test失败,感觉不太像我移植的错误。
我把ping_lo_test拉了出来重新编译,发现可以用了。
[cyg_net_init] Init: loopattach(0x00000000)
[cyg_net_init] Init: ifinit(0x00000000)
[cyg_net_init] Init: domaininit(0x00000000)
[cyg_net_init] Init: cyg_net_add_domain(0x000465c8)
New domain internet at 0x00000000
[cyg_net_init] Init: cyg_net_add_domain(0x00046038)
New domain route at 0x00000000
[cyg_net_init] Init: call_route_init(0x00000000)
[cyg_net_init] Done
Start PING test
BOOTP[eth0] op: REPLY
htype: Ethernet
hlen: 6
hops: 0
xid: 0x0
secs: 0
flags: 0x0
hw_addr: 00:31:2d:78:81:01
client IP: 192.168.1.2
my IP: 192.168.1.2
server IP: 192.168.1.101
gateway IP: 192.168.1.1
options:
subnet mask: 255.255.255.0
IP broadcast: 192.168.1.255
gateway: 192.168.1.1
[eth_drv_ioctl] Warning: Driver can't set multi-cast mode
[eth_drv_ioctl] Warning: Driver can't set multi-cast mode
[eth_drv_ioctl] Warning: Driver can't set multi-cast mode
PING server 127.0.0.1
NIC collision bug detected!
64 bytes from 127.0.0.1: icmp_seq=0, time=10ms
64 bytes from 127.0.0.1: icmp_seq=1, time=0ms
64 bytes from 127.0.0.1: icmp_seq=2, time=0ms
64 bytes from 127.0.0.1: icmp_seq=3, time=0ms
64 bytes from 127.0.0.1: icmp_seq=4, time=0ms
64 bytes from 127.0.0.1: icmp_seq=5, time=0ms
64 bytes from 127.0.0.1: icmp_seq=6, time=0ms
64 bytes from 127.0.0.1: icmp_seq=7, time=0ms
64 bytes from 127.0.0.1: icmp_seq=8, time=0ms
64 bytes from 127.0.0.1: icmp_seq=9, time=0ms
64 bytes from 127.0.0.1: icmp_seq=10, time=0ms
64 bytes from 127.0.0.1: icmp_seq=11, time=0ms
64 bytes from 127.0.0.1: icmp_seq=12, time=0ms
64 bytes from 127.0.0.1: icmp_seq=13, time=0ms
64 bytes from 127.0.0.1: icmp_seq=14, time=0ms
64 bytes from 127.0.0.1: icmp_seq=15, time=0ms
Sent 16 packets, received 16 OK, 0 bad
PING server 127.0.0.33
NIC collision bug detected!
recvfrom: Operation timed out
recvfrom: Operation timed out
recvfrom: Operation timed out
recvfrom: Operation timed out
recvfrom: Operation timed out
recvfrom: Operation timed out
recvfrom: Operation timed out
recvfrom: Operation timed out
recvfrom: Operation timed out
recvfrom: Operation timed out
recvfrom: Operation timed out
recvfrom: Operation timed out
recvfrom: Operation timed out
recvfrom: Operation timed out
recvfrom: Operation timed out
recvfrom: Operation timed out
Sent 16 packets, received 0 OK, 0 bad
PING server 127.0.0.1
64 bytes from 127.0.0.1: icmp_seq=0, time=0ms
64 bytes from 127.0.0.1: icmp_seq=1, time=0ms
64 bytes from 127.0.0.1: icmp_seq=2, time=0ms
64 bytes from 127.0.0.1: icmp_seq=3, time=0ms
64 bytes from 127.0.0.1: icmp_seq=4, time=0ms
64 bytes from 127.0.0.1: icmp_seq=5, time=0ms
64 bytes from 127.0.0.1: icmp_seq=6, time=0ms
64 bytes from 127.0.0.1: icmp_seq=7, time=0ms
64 bytes from 127.0.0.1: icmp_seq=8, time=0ms
64 bytes from 127.0.0.1: icmp_seq=9, time=0ms
64 bytes from 127.0.0.1: icmp_seq=10, time=0ms
64 bytes from 127.0.0.1: icmp_seq=11, time=0ms
64 bytes from 127.0.0.1: icmp_seq=12, time=0ms
64 bytes from 127.0.0.1: icmp_seq=13, time=0ms
64 bytes from 127.0.0.1: icmp_seq=14, time=0ms
64 bytes from 127.0.0.1: icmp_seq=15, time=0ms
Sent 16 packets, received 16 OK, 0 bad
PING server 127.0.0.33
recvfrom: Operation timed out
recvfrom: Operation timed out
recvfrom: Operation timed out
recvfrom: Operation timed out
recvfrom: Operation timed out
recvfrom: Operation timed out
recvfrom: Operation timed out
recvfrom: Operation timed out
recvfrom: Operation timed out
recvfrom: Operation timed out
recvfrom: Operation timed out
recvfrom: Operation timed out
recvfrom: Operation timed out
recvfrom: Operation timed out
recvfrom: Operation timed out
recvfrom: Operation timed out
Sent 16 packets, received 0 OK, 0 bad
PASS:
EXIT: