微视linux 挂接中断action的前奏 设置中断处理函数

unsigned int irq_of_parse_and_map(struct device_node *dev, int index)
	struct of_irq oirq;
	
	of_irq_map_one(dev, index, &oirq)
	
	return irq_create_of_mapping(oirq.controller, oirq.specifier, oirq.size);	
	=>unsigned int irq_create_of_mapping(struct device_node *controller, const u32 *intspec, unsigned int intsize)
		host = irq_find_host(controller);
		
		host->ops->xlate(host, controller, intspec, intsize, &hwirq, &type))
		
		/* Create mapping */
		virq = irq_create_mapping(host, hwirq);
		=>unsigned int irq_create_mapping(struct irq_host *host, irq_hw_number_t hwirq)
			/* Check if mapping already exist, if it does, call
			 * host->ops->map() to update the flags
			 */
			virq = irq_find_mapping(host, hwirq);
			if (virq != NO_IRQ) {
				if (host->ops->remap)
					host->ops->remap(host, virq, hwirq);
				pr_debug("irq: -> existing mapping on virq %d\n", virq);
				return virq;
			}
			
			/* Allocate a virtual interrupt number */
			hint = hwirq % irq_virq_count;
			virq = irq_alloc_virt(host, 1, hint);
		
			irq_setup_virq(host, virq, hwirq)
			=>int irq_setup_virq(struct irq_host *host, unsigned int virq, irq_hw_number_t hwirq)
				struct irq_desc *desc = irq_to_desc_alloc_node(virq, 0);
				
				/* Clear IRQ_NOREQUEST flag */
				desc->status &= ~IRQ_NOREQUEST;

				/* map it */
				smp_wmb();
				irq_map[virq].hwirq = hwirq;
				smp_mb();
				
				host->ops->map(host, virq, hwirq)
				=>static struct irq_host_ops mpic_host_ops = {//在irq_alloc_host里面设置
					.match = mpic_host_match,
					.map = mpic_host_map,
					.xlate = mpic_host_xlate,
				};
					=>int mpic_host_map(struct irq_host *h, unsigned int virq, irq_hw_number_t hw)
						struct mpic *mpic = h->host_data;
						struct irq_chip *chip;
						set_irq_chip_data(virq, mpic);
						set_irq_chip_and_handler(virq, chip, handle_fasteoi_irq);//设置中断处理函数

						/* Set default irq type */
						set_irq_type(virq, IRQ_TYPE_NONE);

						return 0;
			
			
			return virq;
		
		/* Set type if specified and different than the current one */
		if (type != IRQ_TYPE_NONE &&
			type != (irq_to_desc(virq)->status & IRQF_TRIGGER_MASK))
			set_irq_type(virq, type);
			
		return virq;

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值