当前位置: 代码迷 >> 驱动开发 >> PCI驱动地址读写的有关问题
  详细解决方案

PCI驱动地址读写的有关问题

热度:122   发布时间:2016-04-28 11:13:38.0
PCI驱动地址读写的问题
写了个驱动(里面仅用RtlCopyMemory做一些操作),测试时采用CreateFile、ReadFile、WriteFile方式发现都是对共享内存进行操作,但是我想具体的读写PCI上所有地址和寄存器的值,驱动程序应该如何写呢?要应用哪些函数?

------解决方案--------------------
去http;//www.driverdevelop.com看看
------解决方案--------------------
用MmMapIoSpace();

MmMapIoSpace
The MmMapIoSpace routine maps the given physical address range to nonpaged system space.

PVOID
MmMapIoSpace(
IN PHYSICAL_ADDRESS PhysicalAddress,
IN ULONG NumberOfBytes,
IN MEMORY_CACHING_TYPE CacheType
);


Parameters
PhysicalAddress
Specifies the starting physical address of the I/O range to be mapped.
NumberOfBytes
Specifies a value greater than zero, indicating the number of bytes to be mapped.
CacheType
Specifies a MEMORY_CACHING_TYPE value, which indicates the permitted caching behavior when mapping the physical address range.

Return Value
MmMapIoSpace returns the base virtual address that maps the base physical address for the range. If space for mapping the range is insufficient, it returns NULL.

可以看《Programming the microsoft windows driver model》的Reading and Writing Data这一章。
------解决方案--------------------
经典mark
------解决方案--------------------
up
------解决方案--------------------
请教楼主一下
我现在在用DS编程读写物理内存,不知道楼主编程时如何将物理地址转换成虚拟地址
Kmemoryrange好像只能访问虚拟地址的,而且MapToSystemSpace()是将虚拟地址
转换到系统空间的,请楼主指教!
谢谢!
  相关解决方案