Plx使用手册学习------3 PlxPci_DmaTransferBlock

本文档详细介绍了PlxPci_DmaTransferBlock函数,用于启动给定DMA通道的块DMA传输。内容涵盖函数参数、超时设置、物理地址需求以及DMA中断的启用和禁用情况。还提到了PLX_DMA_PARAMS结构体的使用,该结构体根据不同的DMA传输类型可能有不同的解释。
摘要由CSDN通过智能技术生成

Syntax:

PLX_STATUS
PlxPci_DmaTransferBlock(
PLX_DEVICE_OBJECT *pDevice,
U8 channel,
PLX_DMA_PARAMS *pDmaParams,
U64 Timeout_ms
);

 PLX Chip Support:
9054, 9056, 9080*, 9656, 8311, & 8000 DMA
Description:为给定的DMA通道启动块DMA传输
Starts a Block DMA transfer for a given DMA channel.
Parameters:
pDevice
Pointer to an open device
channel

用于传输的开放式DMA信道号
The open DMA channel number to use for the transfer
pDmaParams

指向包含DMA传输参数的结构的指针
A pointer to a structure containing the DMA transfer parameters
Timeout_ms

指定函数等待DMA完成的超时(毫秒)。如果为0,则API在启动DMA传输后立即返回,并且不等待其完成。要让函数无限期地等待DMA完成,请使用值plx_timeout_infinite。

Specifies the timeout, in milliseconds, for the function to wait for DMA completion.If 0, the API returns immediately after starting the DMA transfer and does not wait for its completion.To have the function wait indefinitely for DMA completion, use the value PLX_TIMEOUT_INFINITE.

Return Codes:

CodeDescription翻译
ApiSuccessThe function returned successfully函数返回成功
ApiNullParamOne or more parameters is NULL一个或多个参数为空
ApiInvalidDeviceInfoThe device object is not valid设备对象无效
ApiPowerDownThe PLX device is in a power state that is lower than required for this functionPLX设备处于低于此功能所需的电源状态。
ApiDmaChannelInvalidThe DMA channel is not supported by the PLX chipPLX芯片不支持DMA信道
ApiDmaChannelUnavailableThe DMA channel was not previously opened by the caller调用方没有提前打开DMA通道
ApiDmaInProgressA DMA transfer is currently in-progress目前正在进行DMA传输
ApiWaitTimeoutNo interrupt was received to signal DMA completion没有接收到中断信号来完成DMA
ApiUnsupportedFunctionThe device does not support DMA or 64-bit DMA is required but not supported (9080)设备不支持DMA或需要64位DMA但不支持(9080)
ApiDeviceInUseThe DMA channel is open but owned by another calling thread or processDMA通道已打开,但由另一个调用线程或进程拥有

Notes:
Block DMA transfers are useful with contiguous host buffers described by a PCI address.

块DMA传输对于PCI地址描述的连续主机缓冲区很有用。

The DMA channel requires a valid PCI physical addresses, not user or virtual address.

DMA通道需要有效的PCI物理地址,而不是用户或虚拟地址。

Virtual addresses are those returned by 5-36 malloc(), for example, or a static buffer in an application.

例如,虚拟地址是由5-36 malloc()返回的地址,或者是应用程序中的静态缓冲区。

The physical address of the Common buffer provided by PLX drivers (refer to PlxPci_CommonBufferProperties), for example, is a valid DMA buffer.

例如,plx驱动程序提供的公共缓冲区的物理地址(请参阅plxpci_commonbufferproperties)是有效的dma缓冲区。
By default, the DMA done interrupt is automatically enabled when this function is called.

默认情况下,当调用此函数时,将自动启用dma done中断。

It may be disabled by setting the bIgnoreBlockInt field of PLX_DMA_PARAMS.

它可以通过设置PLX_DMA_PARAMS的bIgnoreBlockInt 字段来禁用。

In this case, the DMA interrupt is disabled and will not trigger the PLX driver’s Interrupt Service Routine (ISR).

在这种情况下,DMA中断被禁用,不会触发PLX驱动程序的中断服务程序(ISR)。

This also means DMA done notification events registered with PlxPci_NotificationRegisterFor will not signal when the DMA has completed.

这也意味着在PlxPci_NotificationRegisterFor 中注册的DMA done通知事件在DMA 完成时不会发出信号。
The PLX_DMA_PARAMS structure contains members whose meanings may differ or even be ignored depending on the DMA transfer type selected by the calling function.

PLX_DMA_PARAMS 结构包含的成员的含义可能不同,甚至可以忽略,这取决于调用函数选择的DMA传输类型
PLX_DMA_PARAMS:

Structure ElementDescription 
UserVaIgnored. 
AddrSource(8000 DMA) Source PCI address 
AddrDest(8000 DMA) Destination PCI address 
PciAddr(9000 DMA) The PCI address to transfer to/from. 64-bit is supported 
LocalAddr(9000 DMA) The Local address for the transfer 
ByteCountThe number of bytes to transfer. 
Direction(8000 DMA) Ignored. AddrSource & AddrDest fields inherently imply transfer direction
(9000 DMA) Direction of the transfer. Refer to PLX_DMA_DIR
 
bConstAddrSrc(8000 DMA) Keeps the source address constant 
bConstAddrDest(8000 DMA) Keeps the destination address constant 
bForceFlush(8000 DMA) DMA engine will issue a Zero-length TLP to flush final writes. 
bIgnoreBlockIntWill disable the DMA done interrupt. API DMA done notification will timeout in this case. 

Usage:

PLX_DMA_PARAMS DmaParams;
PLX_PHYSICAL_MEM PciBuffer;
// Get Common buffer information
PlxPci_CommonBufferProperties(
pDevice,
&PciBuffer
);
memset( &DmaParams, 0, sizeof(PLX_DMA_PARAMS) );
// Fill in DMA transfer parameters
DmaParams.TransferCount = 0x1000;
if (pDevObj->Key.PlxChipFamily == PLX_FAMILY_BRIDGE_P2L)
{
// 9000/8311 DMA
DmaParams.PciAddr = PciBuffer.PhysicalAddr;
DmaParams.LocalAddr = 0x0;
DmaParams.Direction = PLX_DMA_LOC_TO_PCI;
}
else
{
// 8000 DMA
DmaParams.AddrSource = PciBuffer.PhysicalAddr;
DmaParams.AddrDest = PciBuffer.PhysicalAddr + 0x5000;
}
rc =
PlxPci_DmaTransferBlock(
pDevice,
0, // Channel 0
&DmaParams, // DMA transfer parameters
(3 * 1000) // Specify time to wait for DMA completion
);
if (rc != ApiSuccess)
{
if (rc == ApiWaitTimeout)
// Timed out waiting for DMA completion
else
// ERROR - Unable to perform DMA transfer
}

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值