编写的dm9000ep驱动(2.6.13)
来源:互联网 发布:淘宝怎么货到付款啊 编辑:程序博客网 时间:2024/06/02 02:35
the code behind is a some error ,the hwaddr must written to the relevantregesiters in the init function .this is important andessential.
最近手头刚好有个开发板,也还有点时间,就试着写了一下它上面的网卡驱动,当然也是参考了其现有的驱动再写的,程序如下:#include <linux/module.h>
#include <linux/init.h>
#include <linux/delay.h>
#include<linux/netdevice.h>
#include<linux/etherdevice.h>
#include <linux/skbuff.h>
#include <asm/irq.h>
#include <asm/io.h>
static void *bwscon;
static void *gpfcon;
static void *extint0;
static void *intmsk;
#defineBWSCON
#defineGPFCON
#defineEXTINT0
#defineINTMSK
#defineBWSCON
#defineGPFCON
#defineEXTINT0
#defineINTMSK
#defineDM9000_MIN_IO
#defineDM9000_MAX_IO
#defineDM9000_VID_L
#defineDM9000_VID_H
#defineDM9000_PID_L
#defineDM9000_PID_H
#defineDM9000_PKT_MAX
#defineDM9000_PKT_RDY
#define DMFE_TIMER_WUT
#define DMFE_TX_TIMEOUT(HZ*2)
struct dm9000x{
};
static struct net_device *xnet_dev = NULL;
int xnet_probe(struct net_device *dev);
static int xnet_open(struct net_device *dev);
static int xnet_stop(struct net_device *dev);
static int xnet_xmit(struct sk_buff *skb, struct net_device*dev);
static irqreturn_t xnet_interrupt(int irq, void *dev_id, structpt_regs *regs);
static void do_init_dm9000x(struct net_device *dev);
static void do_xnet_tx(void);
static void do_xnet_rx(void);
static void iowt(struct dm9000x *dm9x, int reg, u8value);
static u8 iord(struct dm9000x *dm9x, int reg);
static u16 phy_read(struct dm9000x *dm9x, int reg);
static void phy_write(struct dm9000x *dm9x, int reg, u16value);
int xnet_probe(struct net_device *dev)
{