我正在尝试编写一个使用双端口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.
更多推荐
发布评论