mini2440 dm9000網絡卡驅動移植

2021-06-22 16:00:06 字數 1981 閱讀 5400

核心版本:linux-2.6.32.2        實驗平台:mini2440

1. 新增平台裝置支援

首先需要在mach-mini2440.c中包含標頭檔案,dm9000平台裝置定義如下:

/* dm9000aep 10/100 ethernet controller */

#define mach_mini2440_dm9000_base (s3c2410_cs4 + 0x300)

static struct resource mini2440_dm9000_resource = ,

[1] = ,

[2] = ,

};/*

* the dm9000 has no eeprom, and it's mac address is set by

* the bootloader before starting the kernel.

*/static struct dm9000_plat_data mini2440_dm9000_platdata = ;

static struct platform_device mini2440_device_eth = ,

};

最後需要將dm9000這個平台裝置新增到mini2440_devices這個平台裝置陣列裡面,這樣才能完成平台裝置的註冊。
static struct platform_device *mini2440_devices __initdata = ;

#if defined(config_arch_s3c2410)

#include #endif

修改dm9000片選匯流排時序:
static int __init

dm9000_init(void)

在dm9000_probe函式中還需要給dm9000設定乙個mac位址。

static int __devinit

dm9000_probe(struct platform_device *pdev)

3. 配置核心

device drivers  --->

[*] network device support  --->

[*]   ethernet (10 or 100mbit)  --->

<*>   dm9000 support

(4)     dm9000 maximum debug level

4. 啟動網路裝置

核心配置好之後,需要手動啟動網路裝置,使用如下命令:

ifconfig eth0 192.168.1.109 netmask 255.255.255.0 up
或者將上面的命令寫入到啟動指令碼中,還可以使用ifconfig命令來停止網路裝置:

ifconfig eth0 down
輸入ifconfig命令得到如下結果:

eth0      link encap:ethernet  hwaddr 08:90:90:90:90:90  

inet addr:192.168.1.109  bcast:192.168.1.255  mask:255.255.255.0

up broadcast running multicast  mtu:1500  metric:1

rx packets:21 errors:0 dropped:0 overruns:0 frame:0

tx packets:4 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000 

rx bytes:2455 (2.3 kib)  tx bytes:280 (280.0 b)

interrupt:51 base address:0x8300

mini2440 dm9000 網絡卡驅動詳解 2

3.platform driver的remove,suspend和resume的實現 remove函式的功能是把裝置從核心中移除,釋放記憶體區域。該函式在解除安裝模組時被呼叫。清單如下 static int devexit dm9000 drv remove struct platform devi...

FL2440開發板安裝DM9000網絡卡支援

1.修改核心 首先cd 到核心 資料夾下,在命令列輸入以下命令 vim arch arm mach s3c2440 mach smdk2440.c開啟mach smdk2440.c檔案後在檔案頭插入標頭檔案 include然後插入以下 define dm9000 base s3c2410 cs4 0...

DM9000網絡卡驅動移植

網絡卡驅動移植 步驟1 確定相異性 步驟2 修改 一般就是修改 iobase 和中斷 按照原理圖,其片選訊號可能是往固定段落記憶體寫資料,即是片選到這個裝置。這個也是統一編址的一種方式。根據原理圖,修改其中段引腳,把其irq修改為原理圖上面的iro.網絡卡中本來就有記憶體,當網絡卡接受到資料時候,就...