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

news/2024/11/7 9:26:28/

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
}

 


http://www.ppmy.cn/news/623309.html

相关文章

[CPLEX簡要]2

[CPLEX簡要] cplex.txt是一些名詞的簡略說明 而CPLEX簡要安裝如下~~ 在CPLEX的光碟中,您必須安裝兩項程式 : AMPL CPLEX 及 ILOG license manager AMPL CPLEX是simulation的執行環境,此外還必須安裝 ILOG license manager 才能執行AMPL CPLEX 安裝好lice…

PAT甲级 1010 Radix

PAT甲级 1010 Radix Given a pair of positive integers, for example, 6 and 110, can this equation 6 110 be true? The answer is yes, if 6 is a decimal number and 110 is a binary number. Now for any pair of positive integers N1 and N​2​​ , your task is …

关于P-TMSI和TLLI

P-TMSI是属于GMM层的一个参数,通常包含在GMM层的一些消息里面,如Attach request、Attach accept、Routing area update request、Routing area update accept等等。而TLLI是属于LLC层(逻辑链路控制层)的一个临时逻辑链路标识符&am…

pat 甲级 1010 Radix (25 point(s))

1010 Radix (25 point(s)) Given a pair of positive integers, for example, 6 and 110, can this equation 6 110 be true? The answer is yes, if 6 is a decimal number and 110 is a binary number. Now for any pair of positive integers N1​ and N2​, your task …

Pareto Principle

最近在看ICDE2021的调优文章时发现出现了大量的Pareto Set的理论,这里记录一下。 一、Pareto理论 由意大利经济学家维弗雷多帕雷托 (Villefredo Pareto)(图1)在1987年提出:社会财富的80%是掌握在20%的人手中,而余下的…

PAT 1010 Radix (25 分)

1010 Radix (25 分) 今天给大家分享的是PAT甲级的一道小题,求进制。 原题请点击我 简单翻译: 给你两个数字,告诉你一个数的进制是多少,问,另一个数是否在某个进制下和第一个数相等。如果存在,就输出这个进…

PLL详解

https://www.cnblogs.com/MAQI/p/7831156.html PLL 时钟是时序逻辑的灵魂。 在实际应用中,时钟信号在频率或者相位上通常并不满足直接使用的需求,而内部时序逻辑又只能对时钟信号进行整数倍的分频,并且不能保证产生新时钟信号的相位稳定性,所以需要用到时钟管理单元对时钟…

RL_PPO

不同于value-based方法的 q π ( s , a ) q_{\pi}(s,a) qπ​(s,a),policy-base方法可以解决连续的动作,因为 π ( a ∣ s ) \pi(a|s) π(a∣s)是一个连续的函数。 策略梯度 Proximal Policy Optimization(PPO) 关于[[重要性采样]] PPO的两种算法都可以…