点击查看系列文章 =》 Interrupt Pipeline系列文章大纲-优快云博客
原创不易,需要大家多多鼓励!您的关注、点赞、收藏就是我的创作动力!
4.4.3 timer中断流向Xenomai(__ipipe_dispatch_irq下半部)
第1543行,ipd在第1541行已经初始化为ipipe_head_domain。因已经注册了Xenomai为head domain,所以此处判断不成立,不会指向goto log。
第1550行,control在第1542行已经初始化为ipipe_head_domain->irqs[3].control。在《4.4.1 timer中断的3个逻辑中断号》,已经澄清了head domain的timer中断XIRQ和timer中断virq的数值是相同的,都是3。IPIPE_HANDLE_MASK的意义就是代表是否已经注册了handler!在ipipe_request_irq会对control进行赋值IPIPE_HANDLE_MASK,ipipe_free_irq会对control赋值0。针对head domain的timer中断XIRQ,因为之前已经调用ipipe_request_irq注册中断处理程序了,所以此处判断成立。
第1551行,flags是 __ipipe_dispatch_irq(unsigned int irq, int flags)的第2个入参。__ipipe_grab_irq调用 __ipipe_dispatch_irq(irq, 0)传入的flags为0,所以此处判断不成立,走到第1554行。但是也需要注意到,如果flags带IPIPE_IRQF_NOSYNC标记,即使是head domain的中断,也会记录到head domain的interrupt log。
第1554行,调用dispatch_irq_head函数。此函数的入参为virq 3,等同于Head domain的XIRQ 3,以3为数组下标,执行head domain已经注册的中断处理程序head->irqs[3].handler即xnintr_core_clock_handler。xnintr_core_clock_handler主体主要调用xnclock_tick(&nklock)更新Xenomai系统时钟,调用xnsched_run()执行调度操作,同时也会在合适的时机把timer中断传递给root domain。
第1555行,从dispatch_irq_head函数返回后,调用return退出__ipipe_dispatch_irq函数。所以,凡是中断已经在head domain注册了中断处理程序,在__ipipe_dispatch_irq中,是不会把此中断记录到root domain的interrupt log的。而timer中断是一个特例,timer中断必须传递给root domain,因为Linux需要时钟中断。
接下来讨论timer中断如何流向Linux.
点击查看系列文章 =》 Interrupt Pipeline系列文章大纲-优快云博客
原创不易,需要大家多多鼓励!您的关注、点赞、收藏就是我的创作动力!