阅读:5074回复:9
请教一个关于READ_REGISTER_ULONG的问题??
我用READ_REGISTER_ULONG读PCI卡上的寄存器,
可是得到的总是其基地址,不知是为什么? 另外基地址是要去掉低8位吗? |
|
沙发#
发布于:2002-04-03 15:11
用户被禁言,该主题自动屏蔽! |
|
板凳#
发布于:2002-04-03 16:50
我得到的本来就是内存影射的基地址,还用影射吗?
|
|
地板#
发布于:2002-04-03 16:53
用户被禁言,该主题自动屏蔽! |
|
地下室#
发布于:2002-04-03 20:03
我是从PCI 寄存其的基地址寄存其中得到的基地址
这是影射的地址呀,还用影射吗? |
|
5楼#
发布于:2002-04-03 20:09
读pci 寄存器只能读出物理地址,你必将相应的物理地址通过相应的内核函数转换成windows的映射地址!
|
|
|
6楼#
发布于:2002-04-04 08:47
啊?我越来越糊涂了,由朋友给我完整的解释一下吗?
|
|
7楼#
发布于:2002-04-08 13:41
有朋友能解释一下吗???很急!!
|
|
8楼#
发布于:2002-04-09 08:50
访问PCI设备,用系统提供的函数可获得其配置空间的内容,其中包括DeviceId, VendorId, 还有6个寄存器地址,但这个地址是不能直接访问的,必须将其转换,用HalTranslateBusAddress,如果寄存器要求映射到内存空间,还要调用MmMapIoSpace将其映射到内存空间。这样就可以直接访问了。
你可以仔细读一下这几个函数的DDK文档,应该比较清楚。 Hope it can help.... |
|
|
9楼#
发布于:2002-04-09 19:54
HalTranslateBusAddress is obsolete and is exported only to support existing drivers. The PnP Manager passes lists of raw and translated resources in its IRP_MN_START_DEVICE request for each device. Consequently, PnP drivers seldom, if ever, need to translate bus addresses. However, if translation is required, drivers should use the PnP IRP_MN_QUERY_INTERFACE request to get the standard bus interface.
BOOLEAN HalTranslateBusAddress( IN INTERFACE_TYPE InterfaceType, IN ULONG BusNumber, IN PHYSICAL_ADDRESS BusAddress, IN OUT PULONG AddressSpace, OUT PPHYSICAL_ADDRESS TranslatedAddress ); MmMapIoSpace maps the given physical address range to nonpaged system space. PVOID MmMapIoSpace( IN PHYSICAL_ADDRESS PhysicalAddress, IN ULONG NumberOfBytes, IN MEMORY_CACHING_TYPE CacheEnable ); Parameters PhysicalAddress Specifies the starting physical address of the I/O range to be mapped. NumberOfBytes Specifies the number of bytes to be mapped. CacheEnable Specifies whether the physical address range can be mapped as cached memory. See MmAllocateContiguousMemorySpecifyCache for a description of the possible values. MmAllocateContiguousMemory PVOID MmAllocateContiguousMemory( IN ULONG NumberOfBytes, IN PHYSICAL_ADDRESS HighestAcceptableAddress ); MmAllocateContiguousMemory allocates a range of physically contiguous, cache-aligned memory from nonpaged pool. Parameters NumberOfBytes Specifies the size in bytes of the block of contiguous memory to be allocated. HighestAcceptableAddress Specifies the highest valid physical address the driver can use. For example, if a device can only reference physical memory in the lower 16MB, this value would be set to 0x00000000FFFFFF. Include ntddk.h 函数我已贴出,仅供参考 |
|
|