I need to do something like MANY_TO_ONE, but not with 1:1 interleaving.

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

I have two producer GPIF channels that may produce in any order, and I want to send the packets to a single endpoint. It has to be MANUAL since I do a simple byte count fixup on each packet.  Do I have to use SetupRecvBuffer and SetupSendBuffer?  In other words, do the buffers completely 'by hand' - ?

This is with the FX3 product.

0 Likes
1 Solution

Hi Mark,

Could you please tell me how are you going to send data on GPIF sockets randomly?

I think you can make use of address lines to select appropriate thread to write data into it. I suggest you to go through AN 65974 in which we use 1:1 channel but address lines are used to select a particular thread. You can modify it to perform DMA Multi channel (as in AN 75779).

Thanks & Regards

Abhinav

View solution in original post

0 Likes
3 Replies
abhinavg_21
Moderator
Moderator
Moderator
50 likes received 25 likes received 10 likes received

Hi,

You can make use of DmaMultiChannel. Please refer to the AN 75779. It makes use of DMA multi channel.

Here is the code snippet for your reference:     

    dmaMultiConfig.size           = CY_FX_UVC_STREAM_BUF_SIZE;

    dmaMultiConfig.count          = CY_FX_UVC_STREAM_BUF_COUNT;

    dmaMultiConfig.validSckCount  = 2;

    dmaMultiConfig.prodSckId [0]  = (CyU3PDmaSocketId_t)CY_U3P_PIB_SOCKET_0;

    dmaMultiConfig.prodSckId [1]  = (CyU3PDmaSocketId_t)CY_U3P_PIB_SOCKET_1;

    dmaMultiConfig.consSckId [0]  = (CyU3PDmaSocketId_t)(CY_U3P_UIB_SOCKET_CONS_0 | CY_FX_EP_VIDEO_CONS_SOCKET);

    dmaMultiConfig.prodAvailCount = 0;

    dmaMultiConfig.prodHeader     = 12;                 /* 12 byte UVC header to be added. */

    dmaMultiConfig.prodFooter     = 4;                  /* 4 byte footer to compensate for the 12 byte header. */

    dmaMultiConfig.consHeader     = 0;

    dmaMultiConfig.dmaMode        = CY_U3P_DMA_MODE_BYTE;

    dmaMultiConfig.notification   = CY_U3P_DMA_CB_PROD_EVENT | CY_U3P_DMA_CB_CONS_EVENT;

    dmaMultiConfig.cb             = CyFxUvcApplnDmaCallback;

    apiRetStatus = CyU3PDmaMultiChannelCreate (&glChHandleUVCStream, CY_U3P_DMA_TYPE_MANUAL_MANY_TO_ONE,

            &dmaMultiConfig);

    if (apiRetStatus != CY_U3P_SUCCESS)

    {

        /* Error handling */

        CyU3PDebugPrint (4, "DMA Channel Creation Failed, Error Code = %d\n", apiRetStatus);

        CyFxAppErrorHandler (apiRetStatus);

    }

Thanks & regards

Abhinav

0 Likes
Anonymous
Not applicable

But this sounds like a forced ping-pong buffer application.  The API Guide says this: "The producer sockets needs to be updated in the required order of operation. The first buffer shall be taken from the prodSckId[0], second from prodSckId[1] and so on."

In my application, packets might come all from socket0, or all from socket1, or any mix of the two.

I've got the app working with manual buffer management so it may not matter at this point.

0 Likes

Hi Mark,

Could you please tell me how are you going to send data on GPIF sockets randomly?

I think you can make use of address lines to select appropriate thread to write data into it. I suggest you to go through AN 65974 in which we use 1:1 channel but address lines are used to select a particular thread. You can modify it to perform DMA Multi channel (as in AN 75779).

Thanks & Regards

Abhinav

0 Likes