Syntax:
PLX_STATUS PlxPci_PciBarSpaceRead( PLX_DEVICE_OBJECT *pDevice, U8 BarIndex, U32 offset, VOID *pBuffer, U32 ByteCount, PLX_ACCESS_TYPE AccessType, BOOLEAN bOffsetAsLocalAddr );
讯享网
PLX Chip Support:
All 9000 series & 8311
Description:
Reads from the specified PCI BAR space of a PLX chip (sometimes referred to as Direct Slave Read).
从PLX芯片的指定PCI条空间读取(有时称为直接从机读取)
Parameters:
pDevice
Pointer to an open device
BarIndex
The index of the PCI BAR to access. Valid values are in the range 0-5.
要访问的PCI条的索引。有效值在0-5范围内。
offset
If bOffsetAsLocalAddr is FALSE, offset is an offset from the PCI BAR space.
如果boffsetaslocaladdr为false,则offset是PCI条空间的偏移量。
The mapping will not be adjusted because the function assumes the space is already mapped correctly.
因为函数假定空间已正确映射所以不会调整映射。
The data range accessed must not be larger than the size of the PCI-to-Local Space window.
访问的数据范围不得大于PCI到本地空间窗口的大小。
If bOffsetAsLocalAddr is TRUE, offset is treated as the actual local bus base address to start reading from.
如果boffsetaslocaladdr为true,则偏移量被视为要开始读取的实际本地总线基址。
For 32-bit devices, this allows access to any location on the 4GB local bus space.
对于32位设备,这允许访问4GB本地总线空间上的任何位置。
pBuffer
A pointer to a user supplied buffer that will contain the retrieved data.
指向用户提供的缓冲区的指针,该缓冲区将包含检索到的数据。
This buffer must be large enough to hold the amount of data requested.
这个缓冲区必须足够大以容纳请求的数据量。
ByteCount
The number of bytes to read. Note: This a number of bytes, not units of data determined by AccessType.
要读取的字节数。注意:这是一个字节数,不是由AccessType确定的数据单位。
AccessType
Determines the size of each unit of data accessed: 8, 16, or 32-bit.
bOffsetAsLocalAddr (9000 & 8311 devices only)
Determines how the API treats the offset parameter.
确定API如何处理offset参数。
If TRUE, offset is treated as the actual local bus address. The driver will adjust the space remap register to access the address.
如果为真,则将偏移量视为实际的本地总线地址。驱动程序将调整空间重新映射寄存器以访问地址。
Return Codes:
| Code | Description |
| ApiSuccess | The function returned successfully |
| ApiInvalidHandle | The function was passed an invalid device handle |
| ApiNullParam | One or more parameters is NULL |
| ApiPowerDown | The PLX device is in a power state that is lower than required for this function |
| ApiInsufficientResources | The API was unable to communicate with the driver due to insufficient resources |
| ApiInvalidAccessType | An invalid or unsupported PLX_ACCESS_TYPE parameter |
| ApiInvalidAddress | The offset parameter is not aligned based on the AccessType |
| ApiInvalidSize | The transfer size parameter is 0 or is not aligned based on the AccessType |
Notes:
This function requires that the PCI-to-Local space is valid, enabled, and the space bus descriptors are setup
properly.
此函数要求PCI到本地空间有效、已启用,并且空间总线描述符设置正确。
Incorrect settings may result in incorrect data or system crashes.
不正确的设置可能导致不正确的数据或系统崩溃。
For better performance, use the PlxPci_PciBarMap function and access local memory from an application
directly through a virtual address.
为了获得更好的性能,请使用plxpci_pcibarmap函数并直接通过虚拟地址从应用程序访问本地内存。
This will completely bypass the driver and provide direct access to the local bus.
这将完全绕过驱动程序并提供对本地总线的直接访问。
The disadvantage to the direct method is that the application will be responsible for manually configuring the PLX chip local space re-map window.
直接法的缺点是应用程序将负责手动配置PLX芯片的本地空间重新映射窗口。
This will affect code portability, but overall performance is greater than using the API function.
这将影响代码的可移植性,但总体性能比使用API函数要好。
The end result of this function is a read from the device’s local bus. If no device on the local bus responds,
system crashes may result.
此功能的最终结果是从设备的本地总线读取。如果本地总线上没有设备响应,则可能导致系统崩溃。
Please make sure that valid devices are accessible and addresses are correct before using this function.
此功能的最终结果是从设备的本地总线读取。如果本地总线上没有设备响应,则可能导致系统崩溃。
Usage:
讯享网U32 buffer[0x40]; // Read from an absolute local bus address PlxPci_PciBarSpaceRead( pDevice, 2, // Use BAR 2 0x00, // Absolute local address of 1MB buffer, // Destination buffer sizeof(buffer),// Buffer size in bytes BitSize32,// 32-bit accesses TRUE// Treat offset as a local bus address ); // Read from an offset into the PCI BAR PlxPci_PciBarSpaceRead( pDevice, 3, // Use BAR 3 0x00000100, // Offset from BAR to start reading from buffer, // Destination buffer sizeof(buffer), // Buffer size in bytes BitSize16, // 16-bit accesses FALSE // Treat Offset as an offset from BAR );

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/14322.html