request_irq函数功能描述:函数request_irq( )在实现过程中调用了函数request_threaded_irq( ),实现动态地申请注册一个中断。函数request_threaded_irq( )首先对传入的参数进行安全检查,根据传入的irq号获得数组irq_desc中以irq为下标的元素,然后动态地创建一个irqaction描述符,根据传入的参数初始化新生成的irqaction描述符,最后调用函数__setup_irq( )把该描述符加入IRQ链表中,完成中断的动态申请及注册。
request_irq文件包含
#include
request_irq函数定义
在内核源码中的位置:linux-3.19.3/include/linux/interrupt.h
函数定义格式:
static inline int __must_check request_irq(unsigned int irq, irq_handler_t handler, unsigned long flags, const char *name, void *dev)
{
return request_threaded_irq(irq, handler, NULL, flags, name, dev);
}
request_irq输入参数说明
函数输入参数与函数request_threaded_irq( )基本相同,参考函数request_threaded_irq( )。
request_irq返回参数说明
如果返回值是0则说明申请成功,如果申请不成功,则返回的值非零,一般为负数,可能的取值-16、-38,例如如果返回值是-16,则说明申请的中断