irq_desc & irq_data & irq_chip & irqaction

 
1. IRQ 相关信息的数据结构: irq_desc[NR_IRQS]:
 
    /**
     * struct irq_desc - interrupt descriptor
     *
     * @handle_irq:        highlevel irq-events handler [if NULL, __do_IRQ()]
     * @chip:        low level interrupt hardware access
     * @msi_desc:        MSI descriptor
     * @handler_data:    per-IRQ data for the irq_chip methods
     * @chip_data:        platform-specific per-chip private data for the chip
     *            methods, to allow shared chip implementations
     * @action:        the irq action chain
     * @status:        status information
     * @depth:        disable-depth, for nested irq_disable() calls
     * @wake_depth:        enable depth, for multiple set_irq_wake() callers
     * @irq_count:        stats field to detect stalled irqs
     * @irqs_unhandled:    stats field for spurious unhandled interrupts
     * @last_unhandled:    aging timer for unhandled count
     * @lock:        locking for SMP
     * @affinity:        IRQ affinity on SMP
     * @cpu:        cpu index useful for balancing
     * @pending_mask:    pending rebalanced interrupts
     * @dir:        /proc/irq/ procfs entry
     * @affinity_entry:    /proc/irq/smp_affinity procfs entry on SMP
     * @name:        flow handler name for /proc/interrupts output
     */
    struct irq_desc {
        irq_flow_handler_t    handle_irq;
        struct irq_chip        *chip;
        struct msi_desc        *msi_desc;
        void            *handler_data;
        void            *chip_data;
        struct irqaction    *action;    /* IRQ action list */
        unsigned int        status;        /* IRQ status */
        unsigned int        depth;        /* nested irq disables */
        unsigned int        wake_depth;    /* nested wake enables */
        unsigned int        irq_count;    /* For detecting broken IRQs */
        unsigned int        irqs_unhandled;
        unsigned long        last_unhandled;    /* Aging timer for unhandled count */
        spinlock_t        lock;
    #ifdef CONFIG_SMP
        cpumask_t        affinity;
        unsigned int        cpu;
    #endif
    #if defined(CONFIG_GENERIC_PENDING_IRQ) || defined(CONFIG_IRQBALANCE)
        cpumask_t        pending_mask;
    #endif
    #ifdef CONFIG_PROC_FS
        struct proc_dir_entry    *dir;
    #endif
        const char        *name;
    } ____cacheline_internodealigned_in_smp;
    extern struct irq_desc irq_desc[NR_IRQS];

2. IRQ控制器抽象: irq_chip
    /**
     * struct irq_chip - hardware interrupt chip descriptor
     *
     * @name:        name for /proc/interrupts
     * @startup:        start up the interrupt (defaults to ->enable if NULL)
     * @shutdown:        shut down the interrupt (defaults to ->disable if NULL)
     * @enable:        enable the interrupt (defaults to chip->unmask if NULL)
     * @disable:        disable the interrupt (defaults to chip->mask if NULL)
     * @ack:        start of a new interrupt
     * @mask:        mask an interrupt source
     * @mask_ack:        ack and mask an interrupt source
     * @unmask:        unmask an interrupt source
     * @eoi:        end of interrupt - chip level
     * @end:        end of interrupt - flow level
     * @set_affinity:    set the CPU affinity on SMP machines
     * @retrigger:        resend an IRQ to the CPU
     * @set_type:        set the flow type (IRQ_TYPE_LEVEL/etc.) of an IRQ
     * @set_wake:        enable/disable power-management wake-on of an IRQ
     *
     * @release:        release function solely used by UML
     * @typename:        obsoleted by name, kept as migration helper
     */
    struct irq_chip {
        const char    *name;
        unsigned int    (*startup)(unsigned int irq);
        void        (*shutdown)(unsigned int irq);
        void        (*enable)(unsigned int irq);
        void        (*disable)(unsigned int irq);
        void        (*ack)(unsigned int irq);
        void        (*mask)(unsigned int irq);
        void        (*mask_ack)(unsigned int irq);
        void        (*unmask)(unsigned int irq);
        void        (*eoi)(unsigned int irq);
        void        (*end)(unsigned int irq);
        void        (*set_affinity)(unsigned int irq, cpumask_t dest);
        int        (*retrigger)(unsigned int irq);
        int        (*set_type)(unsigned int irq, unsigned int flow_type);
        int        (*set_wake)(unsigned int irq, unsigned int on);
        /* Currently used only by UML, might disappear one day.*/
    #ifdef CONFIG_IRQ_RELEASE_METHOD
        void        (*release)(unsigned int irq, void *dev_id);
    #endif
        /*
         * For compatibility, ->typename is copied into ->name.
         * Will disappear.
         */
        const char    *typename;
    };

3. 中断处理函数的表示:irqaction
    struct irqaction {
        irq_handler_t handler;
        unsigned long flags;
        cpumask_t mask;
        const char *name;   //name 和 *dev_id 唯一的标识一个中断处理程序。
        void *dev_id;
        struct irqaction *next;
        int irq;
        struct proc_dir_entry *dir;
    };
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值