Cypress技术william hill官网
直播中

李新梅

7年用户 203经验值
私信 关注
[问答]

怎么在PC和FPGA之间实现4线程数据传输

你好
除了添加2个线程(EP2/OUT/IN),在您的FieldWord的基础上实现四个线程,尽管FPGA & lt;=& ft3gpIF2& lt;=& gt;fx3EP1/OUT/IN,EP2/Out/In & lt;=& PC;我知道如何配置EPS的描述符,但是我不知道在C文件中应该做什么。在EP2和GPIF2之间的MMA管道,我们使用DMAYAutoType,可以复制关于EP1的DMA配置代码,只配置端点和DMAChanas,AS
CYU3PAPCONtiONT EPCFG1;CYU3PDMACHANNEL CONTICONT DMACFGG1;CYU3PAPCONTIONT EPFCFG2;CYU3PDMACHANNEL CONTICONT DMACFGG2;
配置PIB和UIB套接字2

以上来自于百度翻译


     以下为原文
  Hello
    In addition to add  2 threads (ep2 out/in) on the basis of fireware of your provided  to achieve four threads though the FPGA <=> FX3 GPIF2 <=> FX3 EP1 OUT/ IN, EP2 OUT/IN <=> PC ,I know how to configure the descriptor about eps, but I don't know what should i do in .c file to configure DMA pipe between ep2 and gpif2, we use DMA_AUTO_TYPE,  can i copy the DMA configuration code about ep1, just configuring endpoints and dma channel, as        
CyU3PEpConfig_t epCfg_1;CyU3PDmaChannelConfig_t dmaCfg_1;CyU3PEpConfig_t epCfg_2;CyU3PDmaChannelConfig_t dmaCfg_2;
                configure PIB and UIB socket 2      

回帖(1)

h1654155275.5814

2019-4-10 08:36:10
你好,
对。你需要重复同样的代码来增加额外的数据路径。
EpCF.Eng= Cytru.
EpCFE.EpType=CYU-U3PUS;
EpCF.BurSTLLN=1;
EFCFG流=0;
PCKTSIZE=大小;
/*生产者端点配置*/
ApItReStase= CYU3PSEPTECOFIG(CyfxxEppEuthor,and EpCFG);
如果(ApRestStand)!= CYU-U3PY成功
{
CYU3pDebug(4),“CyU3pStEtEnCOFIGG失败,错误代码= %DN”,ApIrTestStand;
CyFxAppErrorHandler(ApRestStand);
}
*消费端点配置*/
ApItReStase= CYU3PSEPTECOFIG(CyfxxEppEpple Euffor and EpCFG);
如果(ApRestStand)!= CYU-U3PY成功
{
CYU3pDebug(4),“CyU3pStEtEnCOFIGG失败,错误代码= %DN”,ApIrTestStand;
CyFxAppErrorHandler(ApRestStand);
}
*为U2P传输创建DMA手动通道。
*基于USB速度设置DMA大小。*/
大小=大小;
DCMACFG计数=CyfxxSLFIFOX-DMAY-Buffl计数;
DMACFG.PRODSCKID = CyfxFxPultReuleSubSoCult;
DCMAFG.COXSCHAVE=CyfxFuxEuffer-PpPosiSosik;
DMACGF.DMAMODE=CYU-U3PY-DMAYMODEEY字节;
/*启用产品事件的回调。*/
DMACFG通知= CYU-U3PYDMABCBYPRODYL事件;
DCMAFG.CB=0;
DMACG.PRODHead=0;
DMACGF.PRODHOPETER=0;
DMACGF.CONSEADADER=0;
DMACFG。
ApIdReStase= CUU3PDMACHANNEL CREATE(和GLCHANDACLE LIFOUDOP)
CYU-U3PYDMAX型汽车,DMACFG;
如果(ApRestStand)!= CYU-U3PY成功
{
CYU3pDebug(4),“CYU3PDMACHANNEL CREATION失败,错误代码= %DN”,APIRSTATION;
CyFxAppErrorHandler(ApRestStand);
}
/*为DU传输创建DMA手动通道。*/
DMACGF.PRODSCKID = CyfxxPuxelyPpPosiSosik;
DCMAFG.CascSKID= CyfxfxCuffier-U***SoCult;
DCMAFG.CB=0;
ApIdReStase= CYU3PDMACHANNEL CREATION(和GLCHANDACLE LIFOPPOTHOP)
CYU-U3PYDMAX型汽车,DMACFG;
如果(ApRestStand)!= CYU-U3PY成功
{
CYU3pDebug(4),“CYU3PDMACHANNEL CREATION失败,错误代码= %DN”,APIRSTATION;
CyFxAppErrorHandler(ApRestStand);
}
/*刷新端点内存*/
CYU3PUBFLUSSHEP(CyfxxEpEl生产者);
CYU3PUBFLUESHEP(CYFXFX EPLE消费者);
*设置DMA通道传输大小。*/
ApItReStase= CYU3PDMACHANNEL SETXFER(&GLCHANDACLE LIFOUTOP,CyfxFxSLIFOFIO-DMAY-TXX大小);
如果(ApRestStand)!= CYU-U3PY成功
{
CYU3pDebug(4),“CYU3PDMACHANNEL SETXFER失败,错误代码= %DN”,APIRSTATION;
CyFxAppErrorHandler(ApRestStand);
}
ApItReStase= CYU3PDMACHANNEL SETXFER(&GLCHANDACLE LIFOPPOTH,CYFXFSLIFFIOXDMAYRXX大小);
如果(ApRestStand)!= CYU-U3PY成功
{
CYU3pDebug(4),“CYU3PDMACHANNEL SETXFER失败,错误代码= %DN”,APIRSTATION;
CyFxAppErrorHandler(ApRestStand);
}
红色中突出显示的代码应根据新的数据路径要求更改。
请让我知道,如果你需要更多的帮助,我在创建新的数据路径。
谢谢,
西克里希纳。

以上来自于百度翻译


     以下为原文
   Hi,
    Yes. You need to repeat the same peice of code for additional data paths.
    epCfg.enable = CyTrue;       

        epCfg.epType = CY_U3P_USB_EP_BULK;       

        epCfg.burstLen = 1;       

        epCfg.streams = 0;       

        epCfg.pcktSize = size;       

     
        /* Producer endpoint configuration */       

        apiRetStatus = CyU3PSetEpConfig(CY_FX_EP_PRODUCER, &epCfg);       

        if (apiRetStatus != CY_U3P_SUCCESS)       

        {       

            CyU3PDebugPrint (4, "CyU3PSetEpConfig failed, Error code = %dn", apiRetStatus);       

            CyFxAppErrorHandler (apiRetStatus);       

        }       

     
        /* Consumer endpoint configuration */       

        apiRetStatus = CyU3PSetEpConfig(CY_FX_EP_CONSUMER, &epCfg);       

        if (apiRetStatus != CY_U3P_SUCCESS)       

        {       

            CyU3PDebugPrint (4, "CyU3PSetEpConfig failed, Error code = %dn", apiRetStatus);       

            CyFxAppErrorHandler (apiRetStatus);       

        }       

     
        /* Create a DMA MANUAL channel for U2P transfer.       

         * DMA size is set based on the USB speed. */       

        dmaCfg.size  = size;       

        dmaCfg.count = CY_FX_SLFIFO_DMA_BUF_COUNT;       

        dmaCfg.prodSckId = CY_FX_PRODUCER_USB_SOCKET;       

        dmaCfg.consSckId = CY_FX_CONSUMER_PPORT_SOCKET;       

        dmaCfg.dmaMode = CY_U3P_DMA_MODE_BYTE;       

        /* Enabling the callback for produce event. */       

        dmaCfg.notification = CY_U3P_DMA_CB_PROD_EVENT;       

        dmaCfg.cb = 0;       

        dmaCfg.prodHeader = 0;       

        dmaCfg.prodFooter = 0;       

        dmaCfg.consHeader = 0;       

        dmaCfg.prodAvailCount = 0;       

     
        apiRetStatus = CyU3PDmaChannelCreate (&glChHandleSlFifoUtoP,       

                CY_U3P_DMA_TYPE_AUTO, &dmaCfg);       

        if (apiRetStatus != CY_U3P_SUCCESS)       

        {       

            CyU3PDebugPrint (4, "CyU3PDmaChannelCreate failed, Error code = %dn", apiRetStatus);       

            CyFxAppErrorHandler(apiRetStatus);       

        }       

     
        /* Create a DMA MANUAL channel for P2U transfer. */       

        dmaCfg.prodSckId = CY_FX_PRODUCER_PPORT_SOCKET;       

        dmaCfg.consSckId = CY_FX_CONSUMER_USB_SOCKET;       

        dmaCfg.cb = 0;       

        apiRetStatus = CyU3PDmaChannelCreate (&glChHandleSlFifoPtoU,       

                CY_U3P_DMA_TYPE_AUTO, &dmaCfg);       

        if (apiRetStatus != CY_U3P_SUCCESS)       

        {       

            CyU3PDebugPrint (4, "CyU3PDmaChannelCreate failed, Error code = %dn", apiRetStatus);       

            CyFxAppErrorHandler(apiRetStatus);       

        }       

     
        /* Flush the Endpoint memory */       

        CyU3PU***FlushEp(CY_FX_EP_PRODUCER);       

        CyU3PU***FlushEp(CY_FX_EP_CONSUMER);       

     
        /* Set DMA channel transfer size. */       

        apiRetStatus = CyU3PDmaChannelSetXfer (&glChHandleSlFifoUtoP, CY_FX_SLFIFO_DMA_TX_SIZE);       

        if (apiRetStatus != CY_U3P_SUCCESS)       

        {       

            CyU3PDebugPrint (4, "CyU3PDmaChannelSetXfer Failed, Error code = %dn", apiRetStatus);       

            CyFxAppErrorHandler(apiRetStatus);       

        }       

        apiRetStatus = CyU3PDmaChannelSetXfer (&glChHandleSlFifoPtoU, CY_FX_SLFIFO_DMA_RX_SIZE);       

        if (apiRetStatus != CY_U3P_SUCCESS)       

        {       

            CyU3PDebugPrint (4, "CyU3PDmaChannelSetXfer Failed, Error code = %dn", apiRetStatus);       

            CyFxAppErrorHandler(apiRetStatus);       

        }       

     
        
      The code highlighted in Red should be changed as per your new data path requirement.    
    Please let me know if you need any more help from me in creating the new data paths.
    Thanks,
    sai krishna.
举报

更多回帖

发帖
×
20
完善资料,
赚取积分