声明:
PLX_STATUS
PlxPci_CommonBufferUnmap(
PLX_DEVICE_OBJECT *pDevice,
VOID **pVa
);
PLX Chip Support: All PLX devices
PLX芯片支持: 所有PLX仪器;
Description:Unmaps the common buffer from user virtual space.
功能:取消公共缓冲区到用户虚拟空间的映射
Parameters:
pDevice Pointer to an open device
pVa The virtual address of the common buffer originally obtained from PlxPci_CommonBufferMap
最初从plxpci_CommonBufferMap获得的公共缓冲区的虚拟地址
| Code | Description | 翻译 |
| ApiSuccess | The function returned successfully and at least one event ocurred | 函数成功返回,并且至少发生了一个事件 |
| ApiNullParam | One or more parameters is NULL | 一个或多个参数为空 |
| ApiInvalidDeviceInfo | The device object is not valid | 设备对象无效 |
| ApiInvalidAddress | Virtual address is invalid or buffer was not allocated properly | 虚拟地址无效或未正确分配缓冲区 |
| ApiFailed | The buffer to unmap is not valid | 要取消映射的缓冲区无效 |
It is important to unmap the common buffer when it is no longer needed to release mapping resources back to
the system.
取消公共缓冲区的映射是非常重要的,当它不再需要释放映射资源返回系统
The buffer should be un-mapped before calling PlxPci_DeviceClose to close the device.
在调用plxpci_device close关闭设备之前,应取消映射缓冲区。
The virtual address will cease to be valid after closing the device or after un-mapping the buffer.
这个关闭设备或取消缓冲区映射后,虚拟地址将不再有效。
VOID *pBuffer;
PLX_STATUS rc;
PLX_PHYSICAL_MEM BufferInfo;
// Get the common buffer information
rc =
PlxPci_CommonBufferProperties(
pDevice,
&BufferInfo
);
if (rc != ApiSucess)
{
// Error – Unable to get common buffer properties
}
// Map the buffer into user space
rc =
PlxPci_CommonBufferMap(
pDevice,
&pBuffer
);
if (rc != ApiSucess)
{
// Error – Unable to map common buffer to user virtual space
}
//
// Use the common buffer as needed
//
// Unmap the buffer from user space
rc =
PlxPci_CommonBufferUnmap(
pDevice,
&pBuffer
);
if (rc != ApiSucess)
{
// Error – Unable to unmap common buffer from user virtual space
}
本文详细介绍了PLX芯片中公共缓冲区的映射与取消映射过程,包括使用PlxPci_CommonBufferUnmap函数取消公共缓冲区到用户虚拟空间的映射,确保资源释放回系统。文章提供了代码示例,展示了如何获取缓冲区属性、映射及取消映射缓冲区。
897

被折叠的 条评论
为什么被折叠?



