gpt4 book ai didi

linux-kernel - request_irq() 在内部做什么?

转载 作者:行者123 更新时间:2023-12-04 11:20:36 29 4
gpt4 key购买 nike

据我所知,它“分配一条中断线”,但是

> what is happening after request_irq()?
> How a particular handler is getting called on receiving interrupt?

任何人都可以用代码 snipet 解释它吗?

最佳答案

what is happening after request_irq()?



设备驱动程序注册一个中断处理程序并通过调用 request_irq() 启用给定的中断线进行处理。

调用流程是:-
  • request_irq() -> setup_irq() 注册结构 irqaction。
  • setup_irq() -> start_irq_thread() 创建一个内核线程来服务中断线。

  • 线程的工作在 do_irqd() 中实现。每条中断线只能创建一个线程,共享中断仍然由单个线程处理。

    通过 request_irq() 使用 ISR(中断处理程序)传递给 start_irq_thread()。 start_irq_thread() 创建一个调用 ISR 的内核线程。

    How a particular handler is getting called on receiving interrupt?



    当中断发生时,PIC Controller 向 cpu 提供中断信息。

    设备向 PIC 芯片发送中断,PIC 告诉 CPU 发生了中断(直接或间接)。当 CPU 确认“中断发生”信号时,PIC 芯片向 CPU 发送中断号(介于 00h 和 FFh 之间,或十进制 0 和 255 之间)。该中断号用作中断向量表的索引。

    处理器通常将每种中断类型映射到低内存中的相应指针。所有中断类型的指针集合是一个中断向量。向量中的每个指针都指向对应中断类型(IRQ 线)的 ISR。" 一个中断向量 只是一个中断处理程序的一个内存地址。一个中断向量表是一组多个内存地址.”

    进一步阅读 http://wiki.osdev.org/Interrupts

    关于linux-kernel - request_irq() 在内部做什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41257268/

    29 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com