⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 irq.c.txt

📁 这是一个牛人的linux学习内核时分析内核的笔记
💻 TXT
字号:
any problem,send mail to lysindybear@sina.com.cn


相关文件


****************************数据结构********************************
irq_desc_t irq_desc[NR_IRQS]		//这是硬件中断的向量表
********************************************************************


*****************************基本函数*******************************
这个函数分配一个中断引脚,
(1)int request_irq(unsigned int irq,
                void (*handler)(int, void *, struct pt_regs *),
                unsigned long irqflags,
                const char * devname,
                void *dev_id)
	action = (struct irqaction *)kmalloc(sizeof(struct irqaction), GFP_KERNEL);//分配action

	action->handler = handler;
	…… 				//初始化action

	retval = setup_irq(irq, action);	//调用相应的irq建立函数

(2)int setup_irq(unsigned int irq, struct irqaction * new)
	irq_desc_t *desc = irq_desc + irq;	//得到当前的irq上的描述符
	p = &desc->action;			//得到当前的action
	……		//如果不能共享一个irq线,就返回busy。否则加到这个action后面。
	//从这里可以看出来,IRQ是怎样使得系统可以公用一根irq线,主要是利用这个一个action结构,
	//不同的设备可以连接到后面,然后在座判断
	
********************************************************************

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -