gic_irq_domain_xlate

来源:互联网 发布:mac代购 编辑:程序博客网 时间:2024/05/19 16:06
在dts文件中,我们经常看到下面的code
interrupts = <0,120,6>
解析的code 是
static int gic_irq_domain_xlate(struct irq_domain *d,
612                                 struct device_node *controller,
613                                 const u32 *intspec, unsigned int intsize,
614                                 unsigned long *out_hwirq, unsigned int *out_type)
615 {
616         if (d->of_node != controller)
617                 return -EINVAL;
618         if (intsize < 3)
619                 return -EINVAL;
620 
621         switch(intspec[0]) {
622         case 0:                 /* SPI */
623                 *out_hwirq = intspec[1] + 32;
624                 break;
625         case 1:                 /* PPI */
626                 *out_hwirq = intspec[1] + 16;
627                 break;
628         default:
629                 return -EINVAL;
630         }
631 
632         *out_type = intspec[2] & IRQ_TYPE_SENSE_MASK;
633         return 0;
634 }


可知0代表是SPI 中断,1代表的是PPI中断。interrupts 第二个参数代表中断号,第三个代表中断类型.
636 static const struct irq_domain_ops gic_irq_domain_ops = {
637         .map = gic_irq_domain_map,
638         .xlate = gic_irq_domain_xlate,
639 };


而domain是在gic_of_init 中设置的.
ic_data.domain = irq_domain_add_tree(node, &gic_irq_domain_ops,
0 0
原创粉丝点击