日期:2014-05-16 浏览次数:20724 次
版权所有,转载必须说明转自 http://my.csdn.net/weiqing1981127
原创作者:南京邮电大学 通信与信息系统专业 研二 魏清
三.网络设备驱动分析
我们先看看dm9000.c驱动的模块加载函数
static struct platform_driver dm9000_driver = {
.driver = {
.name = "dm9000", //驱动名
.owner = THIS_MODULE,
.pm = &dm9000_drv_pm_ops, //电源相关操作
},
.probe = dm9000_probe, //探测函数
.remove = __devexit_p(dm9000_drv_remove),
};
static int __init dm9000_init(void)
{
#if defined(CONFIG_ARCH_S3C2410) //调整DM9000所用的位宽寄存器
unsigned int oldval_bwscon = *(volatile unsigned int *)S3C2410_BWSCON;
unsigned int oldval_bankcon4 = *(volatile unsigned int *)S3C2410_BANKCON4;
*((volatile unsigned int *)S3C2410_BWSCON) =
(oldval_bwscon & ~(3<<16)) | S3C2410_BWSCON_DW4_16 | S3C2410_BWSCON_WS4 | S3C2410_BWSCON_ST4;
*((volatile unsigned int *)S3C2410_BANKCON4) = 0x1f7c;
#endif
printk(KERN_INFO "%s Ethernet Driver, V%s\n", CARDNAME, DRV_VERSION);
return platform_driver_register(&dm9000_driver); //注册驱动
}
下面我们重点关注下probe