日期:2014-05-16 浏览次数:20623 次
#if 0
#define CONFIG_DRIVER_CS8900 1 /* we have a CS8900 on-board */
#define CS8900_BASE 0x19000300
#define CS8900_BUS16 1 /* the Linux driver does accesses as shorts */
#endif
#define CONFIG_DRIVER_DM9000 1
#define CONFIG_NET_MULTI 1
#define CONFIG_DM9000_NO_SROM 1
#define CONFIG_DM9000_BASE 0x20000300 //网卡片选地址
#define DM9000_IO CONFIG_DM9000_BASE
#define DM9000_DATA (CONFIG_DM9000_BASE + 4) //网卡数据地址
#define CONFIG_BOOTDELAY 3
/*#define CONFIG_BOOTARGS "root=ramfs devfs=mount console=ttySA0,9600" */
#define CONFIG_ETHADDR 08:00:3e:26:0a:5b
#define CONFIG_NETMASK 255.255.255.0
#define CONFIG_IPADDR 172.31.108.211//开发板IP地址
#define CONFIG_SERVERIP 172.31.108.66//Linux主机IP地址
#ifdef CONFIG_DRIVER_DM9000
dm9000_initialize(bis);
#endif
static void dm9000_get_enetaddr(struct eth_device *dev)
{
#if !defined(CONFIG_DM9000_NO_SROM)
int i;
for (i = 0; i < 3; i++)
phy_read(i, dev->enetaddr + (2 * i));
#endif
}
int dm9000_initialize(bd_t *bis)
{
struct eth_device *dev = &(dmfe_info.netdev);
// Load MAC address from EEPROM
dm9000_get_enetaddr(dev);
dev->init = eth_init;
dev->halt = eth_halt;
dev->send = eth_send;
dev->recv = eth_rx;
sprintf(dev->name, "dm9000");
eth_register(dev);
return 0;
}
/* Structure/enum declaration ------------------------------- */
typedef struct board_info {
u32 runt_length_counter; /* counter: RX length < 64byte */
u32 long_length_counter; /* counter: RX length > 1514byte */
u32 reset_counter; /* counter: RESET */
u32 reset_tx_timeout; /* RESET caused by TX Timeout */
u32 reset_rx_status; /* RESET caused by RX Statsus wrong */
u16 tx_pkt_cnt;
u16 queue_start_addr;
u16 dbug_cnt;
u8 phy_addr;
u8 device_wait_reset; /* device state */
u8 nic_type; /* NIC type */
unsigned char srom[128];
struct eth_device netdev;
} board_info_t;
board_info_t dmfe_info;
...
/* Set Node address */
#ifndef CONFIG_AT91SAM9261EK
for (i = 0;&nbs