基于嵌入式Linux的DM9000网络驱动设计
西安 7 1 0 0 3 2 ) ( 西安工业大学电子信息工程学 院 摘 要
设备驱动是 I i n u x系统 的重要组成部分, 也是硬件 和应用软件之间的纽带, 而网络设备更是设备问通信的重要方式之一 , 所 以
设计网络驱动有着重要 的意义 。论 文在分析 I i n u x网络驱动程序体系结构的基础上 , 利用 L i n u x 2 . 6 . 3 2 . 2内核在 ¥ 3 C 2 4 4 0开发板上移植 编
总第 2 8 0期 2 0 1 3 年 第 2期
计 算 机 与 数 字 工 程
Co mp u t e r& Di g i t a l En g i n e e r i n g
Vo 1 . 4 1 No . 2
3 0 4
基于嵌入式 L i n u x的 D M9 0 0 0网络 驱 动 设 计
c a nc e . Ba s e d o n a n a l y s i n g o f t h e Li nu x n e t wo r k d r i v e r a r c h i t e c t u r e ,u s i n g Li n ux 2 . 6 . 3 2 . 2 k e r n e l o n¥ 3 C2 4 4 0 d e v e l o p me n t b o a r d t r a n s p l a n t wr i t e DM 9 0 0 0 c a r d d r i v e r i ns t a n c e ,t h e i mp l e me nt a t i o n p r i n c i p l e o f t he e mb e d d e d ne t wo r k d r i v e r pr o g r a me i s d i s c us s e d a n d t h e f r a me wo r k s t r u c t ur e Of t he p r o g r a m c o de i s a n a l y s e d i n d e t a i l . De s i g n o f i n t e r f a c e c i r c u i t a n d pr o g r a m f i n a l l y a c h i e v e t h e p u r p o s e o f d r i v i n g,ma k e s t h e DM 9 0 0 0 c a r d t O wor k p r o p e r l y,a n d c a n b e a p p l i e d t o a v a r i e t y o f e mb e d d e d e q u i p me n t . Ke y W or d s e mb e d d e d e q u i p me nt ,Li n ux ,DM 9 00 0 A ,d r i v e r Cl a s s Nu mb er TP3 9 】 . 4
写D M9 0 0 0网 卡驱 动 程 序 的 实 例 , 重 点 讨 论 了嵌 入 式 网 络 驱 动 程序 的实 现 原 理 , 并 详 细 分 析 了 程 序 代 码 的 框 架 结 构 。设 计 的 网 卡 接 口 电 路
与程序最终实现 了驱动 的目的 , 使得 D M9 0 0 0网卡能够正常工作, 并且可 以应用到多种嵌入式设 备当中。
GAO S oபைடு நூலகம் g 儿 Ch a o CHEN Ch a o b o
( S c h o o l o f El e c t r o n i c a n d I n f o r ma t i o n Eng i n e e r i n g,Xi ’ a n Te c h n o l o g i c a 1 Un i v e r s i t y,Xi ’ a n 7 1 0 0 3 2 )
Abs t r a c t Th e d e v i c e d r i v e r i s a n i mp o r t a n t p a r t o f Li n u x s y s t e m ,bu t a l s o t h e l i n k b e t we e n h a r d wa r e a n d a p p l i c a t i o n s o f t wa r e,a n d
n e t wo r k e q u i p me n t i s o ne o f t h e i mp o r t a nt wa y s o f c o mm u n i c a t i o n b e t we e n d e v i c e s ,S O t he d e s i g n o f ne t wo r k d r i v e r ha s i mp o r t a n t s i g ni f i
关键词 嵌 入 式 ;L i n u x系统 ;D M9 0 0 0 A 网卡 ;驱动 程 序 TP 3 9 l _ 4 中图分类号
DM 9 0 0 0 Ne t wo r k Dr i v e r De s i g n Ba s e d o n Emb e d d e d Li n u x
DM9000网卡驱动分析
DM9000网卡驱动分析#include <linux/module.h>#include <linux/ioport.h>#include <linux/netdevice.h>#include <linux/etherdevice.h>#include <linux/init.h>#include <linux/skbuff.h>#include <linux/spinlock.h>#include <linux/crc32.h>#include <linux/mii.h>#include <linux/ethtool.h>#include <linux/dm9000.h>#include <linux/delay.h>#include <linux/platform_device.h>#include <linux/irq.h>#include <asm/delay.h>#include <asm/irq.h>#include <asm/io.h>#if defined(CONFIG_ARCH_S3C2410)#include <mach/regs-mem.h>#endif#include "dm9000.h"/* Board/System/Debug information/definition ---------------- *///在EEPROM或PHY地址寄存器中要选择内部PHY,那么7-6位强制为01#define DM9000_PHY 0x40 /* PHY address 0x01 */#define CARDNAME "dm9000"#define DRV_VERSION "1.31"/** Transmit timeout, default 5 seconds.*///传输超时时间设定,当传输超时时调用函数dm9000_timeout(struct net_device *dev) static int watchdog = 5000;module_param(watchdog, int, 0400);//在驱动程序加载时可以重新设定watchdog MODULE_PARM_DESC(watchdog, "transmit timeout in milliseconds");/* DM9000 register address locking.** The DM9000 uses an address register to control where data written* to the data register goes. This means that the address register* must be preserved over interrupts or similar calls.** During interrupt and other critical calls, a spinlock is used to* protect the system, but the calls themselves save the address* in the address register in case they are interrupting another* access to the device.** For general accesses a lock is provided so that calls which are* allowed to sleep are serialised so that the address register does* not need to be saved. This lock also serves to serialise access* to the EEPROM and PHY access registers which are shared between* these two devices.*//* The driver supports the original DM9000E, and now the two newer* devices, DM9000A and DM9000B.*/enum dm9000_type {TYPE_DM9000E, /* original DM9000 */TYPE_DM9000A,TYPE_DM9000B};/* Structure/enum declaration ------------------------------- */typedef struct board_info {//cmd脚决定了数据数据口还是地址索引void __iomem *io_addr; /* Register I/O base address */void __iomem *io_data; /* Data I/O address */u16 irq; /* IRQ */u16 tx_pkt_cnt;//当前待传输的数据包的数量,最多两个//第二个数据包长度存于此处,第二个数据包写入网卡SRAM中后要释放skb u16 queue_pkt_len;u16 queue_start_addr;u16 dbug_cnt;u8 io_mode; /* 0:word, 2:byte */u8 phy_addr;u8 imr_all;//在probe()函数中有db->flags = pdata->flags;unsigned int flags;unsigned int in_suspend :1;int debug_level;enum dm9000_type type;void (*inblk)(void __iomem *port, void *data, int length);void (*outblk)(void __iomem *port, void *data, int length);void (*dumpblk)(void __iomem *port, int length);struct device *dev; /* parent device */struct resource *addr_res; /* resources found */struct resource *data_res;//物理地址struct resource *addr_req; /* resources requested */struct resource *data_req;//I/O映射后的虚拟地址struct resource *irq_res;struct mutex addr_lock; /* phy and eeprom access lock *///在probe函数中初始化,处理函数dm9000_poll_work,链路连接状态改变 struct delayed_work phy_poll;struct net_device *ndev;spinlock_t lock;struct mii_if_info mii;u32 msg_enable;//网络入口信息} board_info_t;/* debug code */#define dm9000_dbg(db, lev, msg...) do { \if ((lev) < CONFIG_DM9000_DEBUGLEVEL && \(lev) < db->debug_level) { \dev_dbg(db->dev, msg); \} \} while (0)static inline board_info_t *to_dm9000_board(struct net_device *dev){//存取私有数据指针专用函数return netdev_priv(dev);}/* DM9000 network board routine ---------------------------- */static voiddm9000_reset(board_info_t * db){dev_dbg(db->dev, "resetting device\n");//NCR(00H):网络控制寄存器/* RESET device */writeb(DM9000_NCR, db->io_addr);udelay(200);writeb(NCR_RST, db->io_data);udelay(200);}/** Read a byte from I/O port*/static u8ior(board_info_t * db, int reg){//对网卡寄存器进行操作要先写该寄存器的偏移地址writeb(reg, db->io_addr);return readb(db->io_data);}/** Write a byte to I/O port*/static voidiow(board_info_t * db, int reg, int value){writeb(reg, db->io_addr);writeb(value, db->io_data);}/* routines for sending block to chip */static void dm9000_outblk_8bit(void __iomem *reg, void *data, int count) {writesb(reg, data, count);}static void dm9000_outblk_16bit(void __iomem *reg, void *data, int count) {writesw(reg, data, (count+1) >> 1);}static void dm9000_outblk_32bit(void __iomem *reg, void *data, int count) {writesl(reg, data, (count+3) >> 2);}/* input block from chip to memory */static void dm9000_inblk_8bit(void __iomem *reg, void *data, int count) {readsb(reg, data, count);}static void dm9000_inblk_16bit(void __iomem *reg, void *data, int count) {readsw(reg, data, (count+1) >> 1);}static void dm9000_inblk_32bit(void __iomem *reg, void *data, int count) {readsl(reg, data, (count+3) >> 2);}/* dump block from chip to null *///读出没用的数据,为了改变网卡SRAM FIFO的数据指针,static void dm9000_dumpblk_8bit(void __iomem *reg, int count){int i;int tmp;for (i = 0; i < count; i++)tmp = readb(reg);}static void dm9000_dumpblk_16bit(void __iomem *reg, int count){int i;int tmp;count = (count + 1) >> 1;for (i = 0; i < count; i++)tmp = readw(reg);}static void dm9000_dumpblk_32bit(void __iomem *reg, int count){int i;int tmp;count = (count + 3) >> 2;for (i = 0; i < count; i++)tmp = readl(reg);}/* dm9000_set_io** select the specified set of io routines to use with the* device*///设定I/O线宽static void dm9000_set_io(struct board_info *db, int byte_width) {/* use the size of the data resource to work out what IO* routines we want to use*/switch (byte_width) {case 1:db->dumpblk = dm9000_dumpblk_8bit;db->outblk = dm9000_outblk_8bit;db->inblk = dm9000_inblk_8bit;break;case 3:dev_dbg(db->dev, ": 3 byte IO, falling back to 16bit\n");case 2:db->dumpblk = dm9000_dumpblk_16bit;db->outblk = dm9000_outblk_16bit;db->inblk = dm9000_inblk_16bit;break;case 4:default:db->dumpblk = dm9000_dumpblk_32bit;db->outblk = dm9000_outblk_32bit;db->inblk = dm9000_inblk_32bit;break;}}/*延时调度。
嵌入式Linux网卡用户态驱动设计
o f C o mp u t e r T e c h n o l o y g A p p i l c a i t o n s , Ku n mi n g Un i v e a n d T e c h n o l o y, g Ku n mi n g 6 5 0 5 4, 0 C h i n a )
2 0 1 3年第3 期
文 章 编号 : 1 0 0 9— 2 5 5 2 ( 2 0 1 3 ) 0 3— 0 1 6 4—0 4 中 图分 类 号 : T P 3 3 4 . 7 文 献标 识码 : A
嵌入 式 L i n u x网卡用户 态 驱 动设 计
董 占杰 , 周 兰 江
( 1 .昆明理工大学信息工程与 自动化学院 ,昆明 6 5 0 5 0 4 ;2 .昆 明理工大学 云南省计算机
技术应用重点实验室智能信息处理研究所 ,昆明 6 5 0 5 0 4 )
摘 要:为了进一步提高嵌入式 L i n u x系统的可靠性 ,设计和实现 了 D M 9 0 0 0网卡在 A R M平 台 的用户 态驱 动程序 。通过 将影响 I / O性 能 的数 据 处理 操 作 留在 内核 态全 速 运行 ,而将 管理 操 作 例如初 始化 和 配置 运行在 速度相 对 较 慢 的 用户 态 ,从 而获 得 了较 高的性 能 和 兼容 性 。 实验 结 果
Ku nm i ng 6 5 05 4 , Chi 0 n a; 2. I nt e l l i ge nt I fo n r m at io n Pr o c e s s i ng Lab or a t o r y, Yun na n Pr o v i n c i a l Ke y Lab
Abs t r ac t :I n o r d e r t o f u r t h e r i mp r o v e t he r e l i a b i l i t y o f e mb e d d e d L i n u x, t h i s p a p e r d e s i g n s a n d i mp l e me n t s he t u s e r mo d e d e v i c e d r i v e r o f DM9 0 0 0 n e t wo r k c a r d b a s e d o n ARM p l a t f o r m. T o a c h i e v e h i g h p e fo r r ma n c e a n d c o mp a t i b i l i t y, t h i s d e s i g n a l l o ws d a t a — h a nd l i n g o p e r a t i o n s c it r i c a l t o I /O p e r f o m a r n c e t o I Mn a t f u l l s p e e d,wh i l e ma n a g e me n t o p e r a t i o n s s u c h a s i n i t i a l i z a t i o n a n d c o n ig f u r a t i o n n l n a t r e d u c e d s p e e d i n us e r — l e v e 1 .Th e e x p e ime r n t s s h o w t ha t ,t he u s e r — mo d e d e v i c e d iv r e r d e s i g ne d b y hi t s p a p e r c a n s a t i s f y he t p e fo r r ma n c e r e q u i r e me n t o f p r a c t i c e,a n d r e d u c e s t h e c o d e t h a t r t l ns i n he t k e r ne l mo d e, t h e r e f o r e i t a c h i e v e s t h e p u r p o s e o f i mp r o v i n g o v e r a l l s y s t e m r e l i a b i l i t y . Ke y wo r d s: e mb e d de d s y s t e m ; Li n u x; d e v i c e d r i v e r ;r e l i a b i l i t y
网络控制器DM9000A在嵌入式系统中的应用
!"#$%&'( , !"#$%&'() !" !"#$ !"#$ !%& !"#$ 2008.8
!"#$%&# PHY
netif_carrier_on
95
!
!"# !"#$
netif_start_queue !"#$%& ! 32 !"#$% PIO 4 !"#$% IO !"# PIO 32 !"#$ 01H ! !"#$
!"#$%&'()*+,-. !"#$%&'() tx_timeout !"#$%
1. Davicom Corporation,DM9000A Application Notes V1.20, 2005 2. Lessandro Rubini,Jonathan Corbet. Linux Device Drivers, second edition O Reilly & Associates,2002 3. ! ! Linux ! !"#$%& !"#$2005 16 4. Atmel Corporation, AT91RM9200 Datasheet, version E, 2005
!" !"#$%&'()*+ !" ! !"# DM9000A !"#$ 4 !"#$%&'() !" CRC !" 01H ! !" !"#$% !"#
DM9000A !" !" !"#$ !"#$%& !"#$%&'() DM9000A I/O PD8 !"# !" $% ID !7
DM9000网卡驱动
DM9000网卡驱动笔记网卡芯片为DM9000,ARM开发板用的是S3C6410,PC机装的是RED HAT ENTERPRISE LINUX 5.5.网卡接入soc上并没有接入到专门的驱动ic上,而是接入到了SROM的控制器上,所以需要配置的寄存器就需要配置SROM的寄存器。
S3C6410支持6页的SROM,DM9000的片选连接到了SROM控制的bank1,地址线连接的是addr2,也就是以后地址线上发出去的数据,第2位为0,数据为地址,第2位为1,数据为数据(这比较难理解)。
根据这样的地址数据的读写,操作DM9000中的寄存器,配置好网卡芯片,arm端封装一个arp请求包,在PC机上用tcpdump命令看能不能接收到如果能接受,网卡配置就算比较成功了附上源码:#include "up.h"#define INDEX (0x18000000)#define DATA (0x18000004)int (*printf)(char *, ...) = 0x57e11d4c;void (*udelay)(int ) = 0x57e00a98;struct ethhdr{unsigned char dest[6];unsigned char source[6];unsigned short type;};struct arphdr{unsigned short hw_type;unsigned short pro_type;unsigned char hw_len;unsigned char pro_len;unsigned short op;unsigned char src_mac[6];unsigned char src_ip[4];unsigned char dest_mac[6];unsigned char dest_ip[4];};void write_dm9000(unsigned char reg, unsigned short val); unsigned short read_dm9000(unsigned char reg);void init_dm9000();void send_data(unsigned char *buff, int len);int create_arp(unsigned char *buff);void *memset(void *s, int c, int len);unsigned short htons(unsigned short);int main(){/*set XM0bank1*/SROM_BW = (1 << 4);SROM_BC1 = (4 << 4) | (5 << 16);unsigned char buff[1024] = {0};int len = create_arp(buff);init_dm9000();send_data(buff, len);return 0;}void write_dm9000(unsigned char reg, unsigned short val) {*(unsigned char *)INDEX = reg;*(unsigned short *)DATA = val;}unsigned short read_dm9000(unsigned char reg) {*(unsigned char *)INDEX = reg;unsigned char c = *(unsigned char *)DATA;return c;}void init_dm9000(){//application notes//step 1: p22write_dm9000(0x1f, 0x00);//step 2:write_dm9000(0x00, 0x01);udelay(10);write_dm9000(0x00, 0x00);//step 3:write_dm9000(0x00, (1 << 3));//step 4:write_dm9000(0xff, 0xff);//step 5://step 6:write_dm9000(0x10, 0x11);write_dm9000(0x11, 0x22);write_dm9000(0x12, 0x33);write_dm9000(0x13, 0x44);write_dm9000(0x14, 0x55);write_dm9000(0x15, 0x66);//step 7://step 8:write_dm9000(0x01, (1 << 2) | (1 << 3) | (1 << 5));write_dm9000(0xfe, 0x3f);printf("3\n");//step 9://step 10:write_dm9000(0xff, 0xff);//step 11:write_dm9000(0x05, 0x01);//step 12:}void send_data(unsigned char *buff, int len){//p28://step 1:unsigned char c = read_dm9000(0xfe);if(c >> 7)printf("8 bit mode\n");elseprintf("16 bit mode\n");//step 2*(unsigned char*)INDEX = 0xf8;int tmp = (len + 1) >> 1;int i = 0;for(i=0; i<tmp; i++){*(unsigned short *)DATA = ((unsigned short*)buff)[i];}//step 3write_dm9000(0xfd, (len >> 8) & 0xff);write_dm9000(0xfc, len & 0xff);//step 4write_dm9000(0x02, 0x01);}int create_arp(unsigned char *buff){int len = 0;struct ethhdr *eth = (struct ethhdr *)buff;eth->dest[0] = 0xff;eth->dest[1] = 0xff;eth->dest[2] = 0xff;eth->dest[3] = 0xff;eth->dest[4] = 0xff;eth->dest[5] = 0xff;eth->source[0] = 0x11;eth->source[1] = 0x22;eth->source[2] = 0x33;eth->source[3] = 0x44;eth->source[4] = 0x55;eth->source[5] = 0x66;eth->type = htons(0x0806);struct arphdr *arp = (struct arphdr *)(buff + sizeof(struct ethhdr));arp->hw_type = htons(1);arp->pro_type = htons(0x0800); arp->hw_len = 6;arp->pro_len = 4;arp->op = htons(1);arp->src_mac[0] = 0x11;arp->src_mac[1] = 0x22;arp->src_mac[2] = 0x33;arp->src_mac[3] = 0x44;arp->src_mac[4] = 0x55;arp->src_mac[5] = 0x66;arp->src_ip[0] = 192;arp->src_ip[1] = 168;arp->src_ip[2] = 1;arp->src_ip[3] = 2;arp->dest_mac[0] = 0xff;arp->dest_mac[1] = 0xff;arp->dest_mac[2] = 0xff;arp->dest_mac[3] = 0xff;arp->dest_mac[4] = 0xff;arp->dest_mac[5] = 0xff;arp->dest_ip[0] = 192;arp->dest_ip[1] = 168;arp->dest_ip[2] = 1;arp->dest_ip[3] = 1;len = sizeof(struct ethhdr) + sizeof(struct arphdr);return len;}void *memset(void *s, int c, int len){int i = 0;for(i=0; i<len; i++)((unsigned char *)s)[i] = c;}unsigned short htons(unsigned short data){unsigned short ret = 0;ret = ((data >> 8) & 0xff) | ((data << 8) & 0xff00);return ret;。
基于嵌入式Linux的DM9000的网络驱动
L i n u x 网络子 系统主要为系统提供协议层支持 、 数据缓 冲和数据流量控制 , 如图 l 所示 。位于 L i n u x
网络子系统 的最上层是系统调用接 口层 , 为应用程序提供访问 内核 网络子 系统的方法 ; 协议无关接 口层
提供 了使用传输层协议的一种通用方法 ; 网络协议层是具体 协议 的实现 , 在L i n u x 中包括 内嵌协议 T C P ,
l 系统调用接 口 f ’
l 协议无关接 口 l
肉 核空间
网 l 络协议 I
I设备无关 接口 』
备 驱动 程 序
\=
[ 亟 ]
图1 L i n u x网络子系统
Fi g . 1 Ne t wo r k s u b s y s t e m o fLi n u x
基 于嵌入 式L i n u x的DM9 0 0 0的网卡驱动程序 开发 , 通过对应用程序服务器和客户端的设计 , 进 一步分析 网络驱
动 的 工作 原 理 , 为 更 好 地 利 用 和 改 进 网络 驱 动提 供 理 论 依 据 。
关 键词 : 网络驱动程序; 嵌入式系统; 服务器; 客户端; D M9 0 0 0
中图分类号 : T P 3 1 6 文献标识码 : A 文章编号: 1 6 7 4 1 0 4 8 ( 2 0 1 4 ) 0 3 . 0 2 6 5 . 0 4 随着互联 网信息时代的到来 , 越来越多 的嵌入式设备都需要具有 以太网接人功能 。基于A R M微控 制器和L i n u x 操作 系统的手持智能终端系统 , 是适合下一代互联工业 自动化测量设备的理想小体积嵌入 平台。驱动程序作为控制与管理硬件设备数据收发的软件 , 是上层应用程序与硬件设备沟通的桥梁 , 因 此, 分析各种驱动程序对于软硬件结合至关重要。作为L i n u x 的三大驱动之一 , 网络设备驱动对网络在嵌 入式系统中的应用和发展有重要作用… 。在嵌入式设备上利用网卡进行通信已成为生活中不可或缺的一 部分 , 人们对网卡通信要求也越来越高 , 需要通过不断地改进驱动软件来提高通信质量和效率 。国际供 应商在 网络系统解决方案的提供方面起步较早 , 可 以为运营商提供无线访 问接入点 、 路由和网卡等系统 设备 ; 国内厂商也 开发了 自己的网络产品 , 但是 网卡无论是硬件技术还是软件技术与先进 国家的产品都
基于嵌入式Linux的DM9000网络驱动设计
基于嵌入式Linux的DM9000网络驱动设计高嵩;纪超;陈超波【期刊名称】《计算机与数字工程》【年(卷),期】2013(041)002【摘要】The device driver is an important part of Linux system, but also the link between hardware and application software, and network equipment is one of the important ways of communication between devices, so the design of network driver has important significance. Based on analysing of the Linux network driver architecture, using Linux2. 6. 32. 2 kernel on S3C2440 development board transplant write DM9000 card driver instance, the implementation principle of the embedded network driver programe is discussed and the framework structure of the program code is analysed in detail. Design of interface circuit and program finally achieve the purpose of driving, makes the DM9000 card to work properly, and can be applied to a variety of embedded equipment.%设备驱动是Linux 系统的重要组成部分,也是硬件和应用软件之间的纽带,而网络设备更是设备间通信的重要方式之一,所以设计网络驱动有着重要的意义.论文在分析Linux网络驱动程序体系结构的基础上,利用Linux2.6.32.2内核在S3C2440开发板上移植编写DM9000网卡驱动程序的实例,重点讨论了嵌入式网络驱动程序的实现原理,并详细分析了程序代码的框架结构.设计的网卡接口电路与程序最终实现了驱动的目的,使得DM9000网卡能够正常工作,并且可以应用到多种嵌入式设备当中.【总页数】3页(P304-306)【作者】高嵩;纪超;陈超波【作者单位】西安工业大学电子信息工程学院西安710032;西安工业大学电子信息工程学院西安710032;西安工业大学电子信息工程学院西安710032【正文语种】中文【中图分类】TP391.4【相关文献】1.嵌入式linux下DM9000网卡驱动的移植与实现 [J], 贺金平2.嵌入式Linux下基于SPI总线的网络设备驱动设计与实现 [J], 张晓雷;陈相宁;郭剑3.基于嵌入式Linux的DM9000的网络驱动 [J], 赵楠楠;刘敬伟;朱克研4.基于嵌入式Linux的platform驱动设计与应用 [J], 王晓君;王星;李玉莹5.基于嵌入式Linux的网络设备驱动设计与实现 [J], 管秋梅;胡仁杰因版权原因,仅展示原文概要,查看原文内容请购买。
基于S3C2440的DM9000网卡驱动的移植
}
};
Static struct dm9000_plat_data S3C2440_dm9k_pdata={
//数据线的位数是16 bit,没有使用E2PROM
.flags=(DM9000_PLATF_16BITONLY|DM9000_PLATF_NO_ EEPROM),
Reply from 10.10.150.180:bytes=32 time<1ms TTL=64
接着在开发板终端上输入命令ping 10.10.150.174,得到如下结果:
Ping 10.10.150.174(10.10.150.174):56 data bytes
64 bytes from 10.10.150.174:icmp_seq=0 ttl=64 time=0.9ms
所以配置内核make menuconfig时,需要选中这一项。
根据开发板电路图知道,DM9000的AEN端口接到了nGCS4上,INT端口接到了IRQ_EINT7上,CMD端口接到了LADDR2上,数据线是SD0~SD15,即数据线的位数是16 bit。
根据S3C2440地址空间的分配与片选信号的定义知道,引脚nGCS4对应的空间的起始地址为0x20000000,这由系统地址线控制。同时,DM9000使用的中断号是IRQ_EINT7。另外,DM9000上的CMD信号用来控制是地址端口还是数据端口,如果CMD为0,即LADDR2为0,表示访问地址寄存器;当CMD为1,即LADDR2为1,表示访问数据寄存器[5]。
},
};
最后在S3C2440的BSP文件mach-S3C2440.c中添加如下代码:
static struct platform_device*S3C2440_devices[]__initdata={
基于DM9000的嵌入式系统的网络接口设计与实现
《工业控制计算机》2007年20卷第4期摘要基于DM9000以太网控制器芯片对SMDK2440开发板硬件平台的网络接口进行了设计,在硬件平台上移植了嵌入式Linux操作系统,并在Linux平台上开发网络驱动程序实现了网络的接入。
测试结果表明网口运行正常,达到了功能要求。
关键词:DM9000,网络驱动程序,Linux,嵌入式系统AbstractThenetworkinterfacefortheSMDK2440developmentboardisdesignedbasedonDM9000Ethernetcontrollerchipinthispaper.WetransplantLinuxembeddedoperationsystemtothehardwareplatform,developnetworkdiversandrealizetheaccessofnetwork.Theresultofourtestindicatesthatthenetworkinterfacerunswellandsatisfiesthefunctionrequirement.Keywords:DM9000,networkdivers,Linux,Embeddedsystem由于Internet具有广泛的网络分布及相对低廉的接入成本,因此具有网络接入功能的嵌入式系统设备将能提供更方便、更经济的系统访问与服务,嵌入式设备与Internet的结合将是嵌入式系统的发展方向。
原则上讲,嵌入式设备只要转变为Web服务器,再加上TCP/IP网络协议就可以实现Internet上网,Internet上面的各种通信协议对于计算机存储器、运算速度等的要求比较高,对于嵌入式系统中的8位和16位MCU,由于自身处理能力不足,且存储空间有限,往往通过移植简化的TCP/IP协议栈(如uIP协议)来实现网络接入。
而32位以上的处理器因为处理能力强,硬件资源丰富,往往采用向目标硬件移植操作系统的方式,由操作系统管理系统的硬件资源,并在操作系统的基础上实现网络接入。
基于嵌入式Linux的DM9000A驱动的实现
基于嵌入式Linux的DM9000A驱动的实现
王军飞;白凤娥
【期刊名称】《微计算机信息》
【年(卷),期】2009(000)032
【摘要】嵌入式系统设计中经常需要扩展网口,以方便同外部通讯。
本文采用具有封装小、功耗低、AUTO-Mdix等优点的网络接口芯片DM9000A,设计了该芯片
与嵌入式微处理器S3C2410X之间的硬件接口电路,在此基础上实现了DM9000A 驱动程序的开发,同时对嵌入式Linux下驱动程序开发中的数据发送、接收、超时
等关键事件进行了详细阐述。
测试结果表明:该设计方案的网卡驱动程序能够快速、稳定地实现网络数据包的传输。
【总页数】3页(P49-51)
【作者】王军飞;白凤娥
【作者单位】太原理工大学计算机与软件学院,山西太原030024
【正文语种】中文
【中图分类】TP316
【相关文献】
1.基于嵌入式Linux的矩阵键盘驱动研究与实现 [J], 李其珂;付红桥
2.基于嵌入式Linux的矩阵键盘驱动研究与实现 [J], 李其珂;付红桥;
3.基于S3c2410和嵌入式Linux的ADC驱动程序实现与应用 [J], 靳光明;杜文平
4.基于S3c2410和嵌入式Linux的ADC驱动程序实现与应用 [J], 靳光明;杜文平
5.基于ARM11的嵌入式Linux中nRF24L01驱动的实现 [J], 张頔;宋欣;王宇航;宋占伟
因版权原因,仅展示原文概要,查看原文内容请购买。
基于嵌入式Linux的以太网卡驱动设计与实现
U
struct—device
介 介
Start Xmit() mYdev
device2占构的变量和办法
U
初始化 程序
hard
111terupt()
向硬_f牛发送数据
{}
从硬件接收数据 彳}
S3C2440与DM9000的接口设计 硬件上要完成DM9000与ARM芯片
网络物理没备和媒介
圜圜圜圆
S3C2440三大总线连接,以及DM9000与以太网水
start
l汇]:l ¥3C2440CPU阑DM9000№
l江二二]<l 1..1口Ⅲ
K控制总线>|
图l
数据总线>|I∈爿10#南
r l“~…
基于¥3C2440与DM9000的逻辑连接
具体电路设计时实现DM9000与¥3C2440连 接,必须对两者间的数据、地址、控制三大总线进行 连接和转换。S3C2440是32位微处理器,有32根 地址线,支持4GB存储空间。其中0到40000000 的1G空间被划分为8块128M空间,分别由 NGCS。一NGCS7片选。DM9000为16位以太网 控制芯片。对DM9000读写操作,首先对DM9000 正确寻址。AEN(地址允许)是输入引脚片选信 号。SA4一SA9是地址总线4到9位,当AEN低 且SA9和SA8高,而SA7,SA6,SA5,SA4为低 时,则DM9000被选中。 DM9000默认I/O基址为300H。CMD引脚 用于设置COMMAND模式,CMD为高时,选择数 据端口。CMD为低时,选地址端口。数据端口和 地址端口的地址码由下式决定: DM9000地址端口一高位片选地址+300H+oH DM9000数据端口一高位片选地址+300H+4H 其中,高位片选地址由¥3C2440的NGCS3提供, 即为:0x10000000H.
