分类: LINUX
2010-11-20 14:21:44
基于s
-------------内核:Linux.
一、 在arch/arm/plat-s
#includes
/*****************dm9000********************/
static struct resource s
[0] = {
.start = 0x10000000, //对应电路图nGCS2
.end = 0x10000001,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = 0x10000002,
.end = 0x10000003, // 0x
.flags = IORESOURCE_MEM,
},
[2] = {
.start = IRQ_EINT2,
.end = IRQ_EINT2,
.flags = IORESOURCE_IRQ,
}
};
static struct dm9000_plat_data s
.flags= DM9000_PLATF_16BITONLY
};
struct platform_device s
.name= "dm9000",
.id= -1,
.num_resources= ARRAY_SIZE(s
.resource= s
.dev= {
.platform_data = &s
}
};
EXPORT_SYMBOL(s
/************dm9000**************/
二、在include/asm/plat-s
extern struct platform_device s
三、在arch/arm/mach-s
在函数里添加&s
static struct platform_device *smdk2410_devices[] __initdata = {
&s
&s
&s
&s
&s
//&ax88796_dev, //加在这里
&s
&s
};
四、修改 drivers/net/dm9000.c
1. 添加头文件
/****************dm9000*********************/
#include
#include
#include
#include
/**********dm9000----end***************/
2. 在
/* Read SROM content */
for (i = 0; i < 64; i++)
((u16 *) db->srom)[i] = read_srom_word(db, i);
/* Set Node Address */
for (i = 0; i < 6; i++)
ndev->dev_addr[i] = db->srom[i];之后;
if (!is_valid_ether_addr(ndev->dev_addr)) {
/* try reading from mac */
for (i = 0; i < 6; i++)
ndev->dev_addr[i] = ior(db, i+DM9000_PAR);
}
if (!is_valid_ether_addr(ndev->dev_addr))
printk("%s: Invalid ethernet MAC address. Please "
"set using ifconfig\n", ndev->name);
platform_set_drvdata(pdev, ndev);之前添加:
/*********** add by shark************/
for(i=0;i<6;i++){
ndev->dev_addr[i]=net_mac_addr[i];
}
/*Set external intruppt*/
set_irq_type(IRQ_EINT2,IRQT_HIGH);//IRQ_EINT2要根据自己开发板而定,与步骤1中对应.
/******************end **************/ 大约在610行左右。
五、 内核的配置,在内核中选择:
#make menuconfig
Device Drivers --->
[*] Network device support --->
[*] Ethernet (10 or 100Mbit) --->
<*> DM9000 support
保存并推出。
#make zImage
编译之后烧写内核镜像文件,启动开发板。
至此,dm9000的网卡移植结束。