回答

收藏

Passing Data between an ISR and an IST

其他 其他 2442 人阅读 | 0 人回复 | 2008-08-01

There?may?be?times?when?you?want?to?pass?information?between?an?interrupt?service?routine?(ISR)?and?an?interrupt?service?thread?(IST).?For?example,?because?calling?an?IST?each?time?an?interrupt?request?(IRQ)?arrives?is?a?time-consuming?process,?you?might?want?to?design?an?ISR?to?buffer?IRQ?data?before?calling?the?IST.?The?ISR?would?return?SYSINTR_NOP?until?the?buffer?was?full,?and?then?would?return?the?appropriate?SYSINTR?identifier?when?the?ISR?is?ready?for?the?IST?to?run.?Once?the?IST?runs,?it?can?pick?up?the?data?that?the?ISR?has?been?buffering.?

To?pass?data?between?an?ISR?and?an?IST?

Reserve?physical?memory?for?the?ISR?in?your?Config.bib?file.?
Config.bib?contains?several?examples?of?reserving?physical?memory?for?the?serial?and?debug?drivers.?

Use?the?reserved?memory?in?your?ISR?call.?
Because?the?ISR?runs?in?kernel?mode,?the?ISR?can?access?the?reserved?memory?to?buffer?data.?

Call?the?MmMapIoSpace?function?in?your?IST?to?map?the?physical?memory?to?a?virtual?address.?
MMMapIoSpace?calls?the?VirtualAlloc?and?VirtualCopy?functions?to?map?the?physical?memory?to?a?virtual-memory?address?that?the?IST?can?access.?

You?can?also?call?VirtualAlloc?and?VirtualCopy?directly.?For?example,?you?can?allocate?memory?outside?of?the?virtual?memory?space?of?a?process?by?calling?VirtualAlloc?with?its?parameters?set?to?the?following?values:?

dwSize?>=?2?MB?
flAllocationType?set?to?MEM_RESERVE?
flProtect?set?to?PAGE_NOACCESS?
In?Windows?CE?.NET,?an?installable?ISR?can?easily?share?data?with?an?IST?as?the?memory?can?be?dynamically?allocated?instead?of?being?reserved?in?the?Config.bib?file.
分享到:
回复

使用道具 举报

您需要登录后才可以回帖 注册/登录

本版积分规则

关闭

站长推荐上一条 /3 下一条