最終更新:2014-06-06 (金) 08:18:41 (2019d)  

request_irq はてなブックマークを見る
Top / request_irq

IRQの使用宣言

指定したIRQ用の割り込みハンドラを登録

int request_irq(unsigned int irq, irq_handler_t handler, unsigned long flags, const char *name, void *dev)

パラメータ

フラグ (Linux 2.6.18〜)

  • IRQF_DISABLED - keep irqs disabled when calling the action handler.
    • DEPRECATED. This flag is a NOOP and scheduled to be removed
    • 割り込みハンドラの実行中、「全ての」割り込みを禁止する。 このフラグがセットされていなければ、自分自身だけ禁止され、 他の割り込みは許可された状態で動作する。
  • IRQF_SHARED - allow sharing the irq among several devices
    • 基本的には1つのIRQに1つのハンドラだが、IRQF_SHAREDを付けて登録することで1つのIRQに複数のハンドラを登録することができる
  • IRQF_PROBE_SHARED? - set by callers when they expect sharing mismatches to occur
  • IRQF_TIMER? - Flag to mark this interrupt as timer interrupt
  • IRQF_PERCPU? - Interrupt is per cpu
  • IRQF_NOBALANCING? - Flag to exclude this interrupt from irq balancing
  • IRQF_IRQPOLL? - Interrupt is used for polling (only the interrupt that is registered first in an shared interrupt is considered for performance reasons)
  • IRQF_ONESHOT? - Interrupt is not reenabled after the hardirq handler finished.Used by threaded interrupts which need to keep the irq line disabled until the threaded handler has been run.
  • IRQF_NO_SUSPEND? - Do not disable this IRQ during suspend
  • IRQF_FORCE_RESUME? - Force enable it on resume even if IRQF_NO_SUSPEND is set
  • IRQF_NO_THREAD? - Interrupt cannot be threaded
  • IRQF_EARLY_RESUME? - Resume IRQ early during syscore instead of at device resume time.

Linux 2.6.23? (Scheduled for removal in 1/2007)

  • SA_INTERRUPT? - ハンドラ関数実行中は割り込み禁止 -> IRQF_DISABLED
  • SA_SAMPLE_RANDOM? -> IRQF_SAMPLE_RANDOM?
  • SA_SHIRQ? - 割り込みを共有 -> IRQF_SHARED
  • SA_PROBEIRQ? -> IRQF_PROBE_SHARED?
  • SA_PERCPU? - IRQF_PERCPU?

実装

  • if CONFIG_GENERIC_HARDIRQS? (〜Linux 3.11)
    • extern
  • else
    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);
    }

呼び出し

関連