RTAI与LINUX关于中断共享分析
来源:互联网 发布:网络推广软件通科 编辑:程序博客网 时间:2024/06/09 20:20
1. Linux2.6中断数据结构:
extern struct irq_desc irq_desc[NR_IRQS]; //中断描述符表
struct irqaction {
irq_handler_t handler;//中断注册函数
unsigned long flags;
cpumask_t mask;
const char *name;
void *dev_id;
struct irqaction *next;//实现中断共享同一IRQ
int irq;
struct proc_dir_entry *dir;
};
在中断初始化阶段,调用 hw_interrupt_type 类型的变量初始化 irq_desc_t 结构中的 handle 成员。在早期的系统中使用级联的8259A,所以将用 i8259A_irq_type 来进行初始化,而对于SMP系统来说,要么以 ioapic_edge_type,或以 ioapic_level_type 来初始化 handle 变量。
对于每一个外设,要么以静态(声明为 static 类型的全局变量)或动态(调用 request_irq 函数)的方式向 Linux 内核注册中断处理程序。不管以何种方式注册,都会声明或分配一块 irqaction 结构(其中 handler 指向中断服务程序),然后调用 setup_irq() 函数,将 irq_desc_t 和 irqaction 联系起来。
中断注册函数:
request_irq - allocate an interrupt line
* @irq: Interrupt line to allocate
* @handler: Function to be called when the IRQ occurs
* @irqflags: Interrupt type flags
* @devname: An ascii name for the claiming device
* @dev_id: A cookie passed back to the handler function
* Flags: IRQF_SHARED Interrupt is shared
int request_irq(unsigned int irq, irq_handler_t handler,
unsigned long irqflags, const char *devname, void *dev_id)
(具体中断共享机制参考《Linux如何处理共享中断》)
2. RTAI3.5中断数据结构
struct rtai_realtime_irq_s rtai_realtime_irq[];
struct rtai_realtime_irq_s {
int (*handler)(unsigned irq, void *cookie);
void *cookie;
int retmode;
int cpumask;
int (*irq_ack)(unsigned int);
};
中断注册请求函数:
int rt_request_irq(unsigned irq, rt_irq_handler_t handler, void *cookie, int retmode)
{
……
if (rtai_realtime_irq[irq].handler != NULL)
return -EBUSY;
……
}
每个IRQ只能注册一个handler,因而不支持中断共享。分析原因:RTAI为了保证中断的实时性,因而避免了终端共享机制中对IRQ中断链上每个注册中断函数的遍历处理。
- RTAI与LINUX关于中断共享分析
- RTAI分析
- RTAI分析
- RTAI分析
- RTAI 分析
- RTAI分析【转】
- linux共享中断号
- Linux共享中断号
- RTAI安装与配置
- Linux内核---44.关于中断号与中断引脚
- 分析报告:关于Linux中断初始化的分析
- linux任务响应模型&linux实时化&RTAI 3.2分析&Adeos分析
- linux中断--中断原理分析
- linux中断--中断原理分析
- Linux如何处理共享中断
- Linux如何处理共享中断
- linux共享中断的处理
- linux的共享中断机制
- grant 命令
- Meta描述优化.net
- 可复用的线程处理器设计
- JAVA分析html算法(JAVA网页蜘蛛算法)
- 加域的windows共享linux文件
- RTAI与LINUX关于中断共享分析
- 函数指针和回调函数
- 安装arm-linux-gcc环境变量的设置[转载自:http://wenwen.soso.com/z/q30906555.htm]
- 伪静态页面的配置.net
- 深入浅出Hibernate笔记
- asp.net关闭网页代码
- wince下如何加载驱动
- 媒体播放器散热方式概览
- oracle 存储过程基础知识3