如何在C#中定义Isr(中断例程)? [英] How Do I Define An Isr (Interrupt Routine) In C#?

查看:59
本文介绍了如何在C#中定义Isr(中断例程)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将并行端口的IRQ 7映射到它的中断例程。我在C#中这样做。任何人都建议我如何用这种语言定义ISR?



例如。在C中我们在ISR之前使用



#pragma interrupt。



我们在C#中做什么?

I need to map the IRQ 7 of parallel port to its interrupt routine.I am doing this in C#.Can any body suggest how do i define the ISR in this language?

eg. in C we use

#pragma interrupt before the ISR.

what do we do in C#?

推荐答案

你不能。能够运行CLR的OS不允许在应用程序级别设置ISR。此外,ISR是实模式的概念。在保护模式中,您必须为中断处理设置单独的描述符段。

请参阅:

http://en.wikipedia.org/wiki/Protection_ring [ ^ ],

http: //en.wikipedia.org/wiki/Protected_mode [ ^ ]。







请参阅我对该问题的评论。要解决此类问题,您需要学习WDK和保护模式编程。请参阅:

http://en.wikipedia.org/wiki/Windows_Driver_Kit [< a href =http://en.wikipedia.org/wiki/Windows_Driver_Kittarget =_ blanktitle =New Window> ^ ],

http://www.microsoft.com/whdc/devtools/wdk/default.mspx [ ^ ],

http://msdn.microsoft.com/en-us/library/windows/hardware/hh852365.aspx [ ^ ]。



不,你不能用C#做。不适用于当今的Windows系统。这不仅仅是本机编程,这也是内核模式编程。目前,除了以本机代码为目标的高级编程语言之外,还需要一些汇编语言。



-SA
You cannot. The OS which are capable of running CLR do not allow setting ISR on the application level. Moreover, ISR is the concept of real mode. In protected mode, you would have to set up a separate descriptor segment for interrupt processing.
Please see:
http://en.wikipedia.org/wiki/Protection_ring[^],
http://en.wikipedia.org/wiki/Protected_mode[^].



Please see my comments to the question. To solve such problems, you need to learn WDK and protected-mode programming. Please see:
http://en.wikipedia.org/wiki/Windows_Driver_Kit[^],
http://www.microsoft.com/whdc/devtools/wdk/default.mspx[^],
http://msdn.microsoft.com/en-us/library/windows/hardware/hh852365.aspx[^].

No, you cannot do it in C#. Not for present-day Windows system. Not only this is native programming only, this is also kernel-mode programming. These days, some Assembly Language will be required, in addition to the native code targeted high-level programming language.

—SA


查看这篇文章,可能很方便!



由并行端口使用C#控制的LED [ ^ ]
Check this article, might handy for you!

LED Controlled by Parallel Port Using C#[^]


这篇关于如何在C#中定义Isr(中断例程)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆