DM9000网卡驱动源码分析系列06 - open && stop

这篇博客探讨了DM9000网卡驱动中的open和stop函数在设备管理中的作用。当使用ifconfig分配地址并启用接口时,ioctl(SIOCSIFFLAGS)会调用open方法。反之,接口关闭时,停止方法stop会被调用。文章提到了netif_msg_ifup宏用于检查设备状态,并简要提及了初始化函数和中断处理。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

static void dm9000_mask_interrupts(struct board_info *db)
{
	iow(db, DM9000_IMR, IMR_PAR);
}
屏蔽中断

static void dm9000_unmask_interrupts(struct board_info *db)
{
	iow(db, DM9000_IMR, db->imr_all);
}
恢复中断


/*
 *  Open the interface.
 *  The interface is opened whenever "ifconfig" actives it.
 */
static int dm9000_open(struct net_device *dev)
{
	struct board_info *db = netdev_priv(dev);
	unsigned long irqflags = db->irq_res->flags & IRQF_TRIGGER_MASK;

	if (netif_msg_ifup(db))
		dev_dbg(db->dev, "enabling %s\n", dev->name);

	/* If there is no IRQ type specified, default to something that
	 * may work, and tell the user that this is a problem */

	if (irqflags == IRQF_TRIGGER_NONE)
		irqflags = irq_get_trigger_type(dev->irq);

	if (irqflags == IRQF_TRIGGER_NONE)
		dev_warn(db->dev, "WARNING: no IRQ resource flags set.\n");

	irqflags |= IRQF_SHARED;

	/* GPIO0 on pre
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值