简体   繁体   English

ISA 端口与 Visual Basic 的通信

[英]ISA port communication with Visual Basic

Is there any chance how I could write something to ISA card in Visual Basic .Net for Windows XP and higher?有没有机会在 Windows XP 及更高版本的 Visual Basic .Net 中向 ISA 卡写入内容? (I know Win XP and higher have restriction so U cant directly write data to port) (我知道Win XP及更高版本有限制,所以你不能直接将数据写入端口)

I have also done some research and if I understand the situation I have only 2 options:我也做了一些研究,如果我了解情况,我只有两个选择:

  1. Write driver (very problematic option :)) or编写驱动程序(非常有问题的选项:))或

  2. Try to use existing driver in kernel32 like driver to serial/paralel port.尝试使用kernel32现有的驱动程序,如驱动程序到串行/并行端口。

If there arent any other options, how I have to modify "using of serial/paralel port" to use it for ISA port?如果没有任何其他选项,我如何修改“使用串行/并行端口”以将其用于 ISA 端口?

Modern versions of Windows will not allow direct port I/O from a user application.现代版本的 Windows 不允许来自用户应用程序的直接端口 I/O。 Your program is running in Ring 3, not Ring 0. You need some kind of driver to do the port I/O on your application's behalf.您的程序运行在 Ring 3,而不是 Ring 0。您需要某种驱动程序来代表您的应用程序执行端口 I/O。

The first thing to do would be to contact the card manufacturer and see if they made a Windows driver for your board.首先要做的是联系卡制造商,看看他们是否为您的主板制作了 Windows 驱动程序。

If a Windows driver is not available, and you are only looking to do basic reigster reads and writes (no interrupts or DMA), there are some freely-downloadable libraries that you can download to do port I/O.如果 Windows 驱动程序不可用,并且您只想进行基本的寄存器读取和写入(无中断或 DMA),则可以下载一些可免费下载的库来执行端口 I/O。 Basically, the library includes a dummy "driver" that sits in Ring 0 and does the I/O for you.基本上,该库包含一个虚拟的“驱动程序”,它位于 Ring 0 中并为您执行 I/O。 I have the most experience with WinIO .我对WinIO 的经验最丰富。

WinIO has a C/C++ API, nothing .Net/CLR. WinIO 有一个 C/C++ API,没有 .Net/CLR。 You will need to use P/Invoke to call the WinIO functions from managed code.您将需要使用 P/Invoke 从托管代码调用 WinIO 函数。

If you search around, you may find a toolkit similar to WinIO that provides APIs for managed code.如果您四处搜索,您可能会找到一个类似于 WinIO 的工具包,它为托管代码提供 API。 (Edit: Here is one I have bookmarked called DirectIO .) (编辑:这是我收藏的名为DirectIO 的一个。)

The biggest problem with WinIO is that you are limited to basic register reads/writes. WinIO 的最大问题是您仅限于基本的寄存器读/写。 If you need interrupts or DMA, you are out of luck.如果您需要中断或 DMA,那您就不走运了。 At that point, you will need to write a "real" driver.此时,您将需要编写一个“真正的”驱动程序。

Writing a driver can be a pretty major task for the uninitiated (there is a lot you will screw up).编写驱动程序对于初学者来说可能是一项非常重要的任务(有很多事情你会搞砸)。 You will need to start by getting a copy of the Windows Driver Kit , and studying Microsoft's Kernel Mode Driver Framework .您需要先获取一份Windows 驱动程序工具包,然后学习 Microsoft 的内核模式驱动程序框架 You could also look into purchasing a copy of Jungo WinDriver .您还可以考虑购买Jungo WinDriver的副本。 WinDriver is a third party tool that simplifies driver development considerably, but it is quite expensive for a one-off project. WinDriver 是一种第三方工具,可大大简化驱动程序开发,但对于一次性项目而言,它的成本非常高。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM