访问PCI设备内存(Accessing PCI Device Memory)

编程入门 行业动态 更新时间:2024-10-26 18:29:30
访问PCI设备内存(Accessing PCI Device Memory)

我正在尝试编写一个使用双端口RAM的程序。 我有一个指向设备管理器中设备资源中列出的内存地址的指针。 但每次我尝试从中读取,我都会收到访问冲突,我做错了什么? 根据器件制造商的说法,读取和写入的偏移量为0x0800。

IntPtr ptr = new IntPtr(0xF7E00000); float value = Marshal.ReadInt32(ptr, 0x0800); MessageBox.Show(value.ToString());

I am trying to write a program that uses dual ported RAM. I have a made a pointer to the memory address listed in the resources for the device in device manager. But every time I try to read from it, I get an Access Violation, what I am doing wrong? According to the device manufacturer, an offset of 0x0800 is open to read and write.

IntPtr ptr = new IntPtr(0xF7E00000); float value = Marshal.ReadInt32(ptr, 0x0800); MessageBox.Show(value.ToString());

最满意答案

如果这是物理地址,则需要设备驱动程序。 您无法使用.NET创建设备驱动程序。 如果设备附带驱动程序,则可能有一个可以调用的API。

如果你真的需要编写驱动程序,我建议你从微软下载DDK,学习C和内核模式编程。 这不是一项简单的任务。

If this is a physical address, you need a device driver. You can't create a device driver with .NET. If the device comes with a driver, it probably has an API you can call.

If you really need to write a driver, I'd recommend downloading the DDK from Microsoft, and learning C and kernel-mode programming. This is not a simple task.

更多推荐

本文发布于:2023-08-05 23:30:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1441099.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:内存   设备   PCI   Memory   Device

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!