Linux异常处理体系结构

相关数据结构介绍

先来看跟中断处理体系相关的三个数据结构(我们抽取出主要的部分,实际上不止这些成员,详细看include/linux/irq.h):
1

struct irq_desc {
   
	irq_flow_handler_t	handle_irq;   /*当前中断的处理函数入口*/
	struct irq_chip		*chip;        /*低层的硬件访问*/
	struct irqaction	*action;	/* IRQ action list 用户提供的中断处理*/
	unsigned int		status;		/* IRQ status IRQ状态 */
	const char		   *name;     /*中断名称*/
} ____cacheline_internodealigned_in_smp;

2

struct irqaction {
   
	irq_handler_t handler;   /*用户注册的中断处理函数*/
	unsigned long flags;    /*中断标志,比如是否共享中断,电平触发还是边沿触发*/
	cpumask_t mask;        /*用于对称处理器系统*/
	const char *name;     /*用户注册的中断名字,cat/proc/interrupts可看到*/
	void *dev_id;         /*用户传给上面的handler参数,还可以用来区分共享中断*/
	struct irqaction *next;  
	int irq;                /*中断号*/
	struct proc_dir_entry *dir;
};

3

struct irq_chip {
   
	const char	*name;                              /*名字*/
	unsigned int	(*startup)(unsigned int irq);  /*启动中断,如果不设置,缺省为"enable"*/
	void		(*shutdown)(unsigned int irq);     /*关闭中断,如果不设置,缺省为"disable"*/
	void		(*enable)(unsigned int irq);      /*使能中断,如果不设置,缺省为"
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值