資源描述:
《linux.中斷處理.中斷處理》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在行業(yè)資料-天天文庫。
1、Linux.中斷處理.中斷處理通過上一篇文章就可以看出Linux是使用structirq_desc這個(gè)結(jié)構(gòu)體的數(shù)組來管理對(duì)應(yīng)的中斷號(hào)上的中斷處理事務(wù)的。在看irq_desc這個(gè)結(jié)構(gòu)體之前可以試著猜想它需要包含哪些要素:·中斷號(hào)。不過在后面可以看到中斷號(hào)其實(shí)就暗含中該中斷描述符相對(duì)于數(shù)組起始地址的偏移之中了?!す芾磉@個(gè)中斷號(hào)的是什么樣的中斷控制器。是8259A還是IO-APIC等等。以及對(duì)相當(dāng)控制器的操作如:?jiǎn)⑼?刂破?、開啟或禁用相應(yīng)的中斷號(hào)等?!ぴ谶@個(gè)中斷號(hào)上的中斷處理函數(shù)。這其中必需要考慮的問題有:由于中斷號(hào)的數(shù)量是有限的,必定就會(huì)出現(xiàn)多個(gè)設(shè)備共享一個(gè)中斷號(hào)的情況,這時(shí)中斷處理函數(shù)應(yīng)該是什么
2、樣的。以上幾點(diǎn)是一個(gè)中斷請(qǐng)求描述符必需要包含的,至于其它的可以看structirq_desc定義部分(include/linux/irq.h):147148149150151152153154155156157158159160161162163164165166/***structirq_desc-interruptdescriptor*@irq:interruptnumberforthisdescriptor*@timer_rand_state:pointertotimerrandstatestruct*@kstat_irqs:irqstatspercpu*@irq_2_iommu:iom
3、muwiththisirq*@handle_irq:highlevelirq-eventshandler[ifNULL,__do_IRQ()]*@chip:lowlevelinterrupthardwareaccess*@msi_desc:MSIdescriptor*@handler_data:per-IRQdatafortheirq_chipmethods*@chip_data:platform-specificper-chipprivatedataforthechip*methods,toallowsharedchipimplementations*@action:theirqaction
4、chain*@status:statusinformation*@depth:disable-depth,fornestedirq_disable()calls*@wake_depth:enabledepth,formultipleset_irq_wake()callers*@irq_count:statsfieldtodetectstalledirqs16716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620
5、7208209*@last_unhandled:agingtimerforunhandledcount*@irqs_unhandled:statsfieldforspuriousunhandledinterrupts*@lock:lockingforSMP*@affinity:IRQaffinityonSMP*@node:nodeindexusefulforbalancing*@pending_mask:pendingrebalancedinterrupts*@threads_active:numberofirqactionthreadscurrentlyrunning*@wait_for_t
6、hreads:waitqueueforsync_irqtowaitforthreadedhandlers*@dir:/proc/irq/procfsentry*@name:flowhandlernamefor/proc/interruptsoutput*/structirq_desc{unsignedintirq;structtimer_rand_state*timer_rand_state;unsignedint*kstat_irqs;#ifdefCONFIG_INTR_REMAPstructirq_2_iommu*irq_2_iommu;#endifirq_flow_handler_tha
7、ndle_irq;structirq_chip*chip;structmsi_desc*msi_desc;void*handler_data;void*chip_data;structirqaction*action;/*IRQactionlist*/unsignedintstatus;/*IRQstatus*/?unsignedintdepth;/*nestedirqdisables*/unsi