request_irq 和 __interrupt 之间的区别
据我了解,两者都用于注册中断处理程序。我在内核代码中看到了很多 request_irq
调用,但甚至没有一个 __interrupt
调用。 __interrupt 是从用户空间注册处理程序的某种方法吗?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
request_irq
本质上是对request_threaded_irq
的包装调用,它分配IRQ资源并启用IRQ。这是从kernel/irq/manage.c
中的注释块转述的,第 1239 行。基本上,如果您需要为某种设备设置中断处理,则需要使用 request_irq。确保您正在使用的任何子系统还没有为
request_irq
提供包装器。即,如果您正在开发设备驱动程序,请考虑使用devm_*
系列调用来自动管理细节,例如释放未使用的变量等。请参阅第 29 行devm_request_threaded_irq a> 在kernel/irq/devres.c
中以获得更好的解释。其等效调用(也是您最有可能使用的调用)是devm_request_irq
。request_irq
is essentially a wrapper call torequest_threaded_irq
, which allocates the IRQ resources and enables the IRQ. That's paraphrased from the comment block inkernel/irq/manage.c
, Line #1239.Basically, you want to use
request_irq
if you need to setup interrupt handling for a device of some kind. Make sure that whatever subsystem you are working in doesn't already provide a wrapper forrequest_irq
, too. I.e., if you are working on a device driver, consider using thedevm_*
family of calls to auto-manage the minutiae, like freeing unused variables and such. Seedevm_request_threaded_irq
at Line #29 inkernel/irq/devres.c
for a better explanation. Its equivalent call (and the one you would most likely use) isdevm_request_irq
.据我记得 __interrupt() 用于在用户空间中将函数声明为 ISR。我不知道我从哪里得到这个,但我一找到地方就会回来给你。
As far as I remember __interrupt() is used to declare a function as ISR in userspace. I am not sure where I have this from but I'll come back to you as soon as I found the spot.