Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > USB Controllers > Extra fields of CyU3PDmaChannel

Bookmark and Share
Cypress Developer CommunityTM
Forums | Videos | Blogs | Training | Rewards Program | Community Components



Extra fields of CyU3PDmaChannel
Moderator:
RSKV

Post Reply
Follow this topic



Extra fields of CyU3PDmaChannel

sodafarl posted on 29 May 2012 1:09 AM PST
Top Contributor
128 Forum Posts

Hi,

The CyU3PDmaChannel structure has a lot of extra fields that are not configured when a CyU3PDmaChannel is created. The code below shows a typical CyU3PDmaChannel setup

dmaCfg.size = bulksize;
            dmaCfg.count = CY_FX_SLFIFO_DMA_BUF_COUNT;
            dmaCfg.prodSckId = (CyU3PDmaSocketId_t)(CY_U3P_UIB_SOCKET_PROD_0 | CY_FX_EP_PRODUCER_SOCKET);
            dmaCfg.consSckId = (CyU3PDmaSocketId_t)(CY_FX_EP_CONSUMER_PPORT_SOCKET);
            dmaCfg.dmaMode = CY_U3P_DMA_MODE_BYTE;
            dmaCfg.notification = CY_U3P_DMA_CB_PROD_EVENT;
            dmaCfg.cb = CyFxSlFifoUtoPDmaCallback;
            dmaCfg.prodHeader = 0;
            dmaCfg.prodFooter = 0;
            dmaCfg.consHeader = 0;
            dmaCfg.prodAvailCount = 0;

But there are a lot more parts to this structure than shown above . For example according to the FX3APIGuide there are two fields called currentProdIndex and currentConsIndex which point to the descriptor of the active DMA buffer.

Can I read the value of these two fields to find out more information about the status of the DMA buffers? I have tried reading these but they don't change during DMA transfers. What I hope to do with this information is determine whether a DMA buffer is empty or full. If anyone else has a way of doing this I would be grateful to find out how.

Sodafarl




Re: Extra fields of CyU3PDmaChannel

AssemblyRequired posted on 29 May 2012 05:05 AM PST
Top Contributor
37 Forum Posts

If you have a JTAG debugger you can look at the DMA descriptors directly; they are located at 0x40000000. Header files cyu3descriptor.h and sock_regs.h describe the format; each descriptor is 16 bytes. I look at the 'sync' field to find the descriptors I'm interested in, then the 'size' field to find the current status (low few bits; see sock_regs.h).

Also I believe that for the GPIF block, the current in-progress descriptor index for socket 0 is stored at 0xE0018000. See CY_U3P_PIB_SCK_DSCR_ADDRESS in pib_regs.h.

Hope this helps,
Steve



Re: Extra fields of CyU3PDmaChannel

sodafarl posted on 30 May 2012 12:49 AM PST
Top Contributor
128 Forum Posts

Thanks Steve, I was able to use your suggestions to make progress with this. I used the CyU3PDmaDscrGetConfig function to get the buffers descriptor  and then looked at the size variable from this  to see if the buffer was full or empty - CY_U3P_BUFFER_OCCUPIED. I can use this to signal to the host computer that data is available for transfer.

Once again many thanks.

Sodafarl






ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". CYPRESS SEMICONDUCTOR AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY CYPRESS SEMICONDUCTOR. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM CYPRESS SEMICONDUCTOR.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms and Conditions of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms and Conditions of this site. Cypress Semiconductor and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.