send pattern data in CyCx3UvcAppDmaCallback

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

cross mob
AnWa_3863696
Level 2
Level 2
First like given

Hi

Is it possible to send pattern frame in UVC application from CX3 module FW in every DMA callback?

I try to modify dmaBuffer.buffer content, but the result seems only around 60 bytes data were modified that captured by USB wireshark.

What's wrong with my code or any limitation for change frame buffer?

          status = CyU3PDmaMultiChannelGetBuffer(chHandle, &dmaBuffer, CYU3P_WAIT_FOREVER);

       while (status == CY_U3P_SUCCESS)

        {

            /* Add Headers*/

            if(dmaBuffer.count < CX3_UVC_DATA_BUF_SIZE)

            {

#ifdef UVC_APPLICATION

                CyCx3UvcAppAddHeader ((dmaBuffer.buffer - CX3_UVC_PROD_HEADER), CX3_UVC_HEADER_EOF);

           CyU3PMemCopy(dmaBuffer.buffer+CX3_UVC_PROD_HEADER, ptrEEPROM, 0x4000);

#endif

Thanks

Angus

0 Likes
1 Solution
Hemanth
Moderator
Moderator
Moderator
First like given First question asked 750 replies posted

Hi Angus,

Angus Wang wrote:

I want to replace the entire video frame with local buffer data. Is this possible?

>> Please refer to following example in the FX3 SDK:

C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\firmware\uvc_examples\cyfxuvcinmem_bulk

(Please check readme file of the project)

You have to use CY_U3P_DMA_TYPE_MANUAL_OUT channel instead of CY_U3P_DMA_TYPE_MANUAL_MANY_TO_ONE

Note: I assume that you don't want to use MIPI interface at all.

Regards,

Hemanth

Hemanth

View solution in original post

0 Likes
4 Replies
Hemanth
Moderator
Moderator
Moderator
First like given First question asked 750 replies posted

Hi Angus,

What the producer socket of the DMA channel?

Is the entire video frame data formed using local buffer Or you want to replace some of the data which is incoming from GPIF interface?

Regards,

Hemanth

Hemanth
0 Likes

Hi Hemanth,

Here is the DMA configuration, referred with cx3 example

    dmaCfg.size                 = CX3_UVC_STREAM_BUF_SIZE;

    dmaCfg.count                = CX3_UVC_STREAM_BUF_COUNT;

    dmaCfg.validSckCount        = CX3_UVC_SOCKET_COUNT;

    dmaCfg.prodSckId[0]         = CX3_PRODUCER_PPORT_SOCKET_0;

    dmaCfg.prodSckId[1]         = CX3_PRODUCER_PPORT_SOCKET_1;

    dmaCfg.consSckId[0]         = CX3_EP_VIDEO_CONS_SOCKET;

    dmaCfg.dmaMode              = CY_U3P_DMA_MODE_BYTE;

    dmaCfg.notification         = CY_U3P_DMA_CB_PROD_EVENT | CY_U3P_DMA_CB_CONS_EVENT;

    dmaCfg.cb                   = CyCx3UvcAppDmaCallback;

    dmaCfg.prodHeader           = CX3_UVC_PROD_HEADER;

    dmaCfg.prodFooter           = CX3_UVC_PROD_FOOTER;

    dmaCfg.consHeader           = 0;

    dmaCfg.prodAvailCount       = 0;

    status = CyU3PDmaMultiChannelCreate (&glChHandleUVCStream,

            CY_U3P_DMA_TYPE_MANUAL_MANY_TO_ONE , &dmaCfg);

  I want to replace the entire video frame with local buffer data. Is this possible?

Thanks

Angus

0 Likes
Hemanth
Moderator
Moderator
Moderator
First like given First question asked 750 replies posted

Hi Angus,

Angus Wang wrote:

I want to replace the entire video frame with local buffer data. Is this possible?

>> Please refer to following example in the FX3 SDK:

C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\firmware\uvc_examples\cyfxuvcinmem_bulk

(Please check readme file of the project)

You have to use CY_U3P_DMA_TYPE_MANUAL_OUT channel instead of CY_U3P_DMA_TYPE_MANUAL_MANY_TO_ONE

Note: I assume that you don't want to use MIPI interface at all.

Regards,

Hemanth

Hemanth
0 Likes

Hi Hemanth, thanks. The solution is workable. My application need to send user buffer when receive usb extension unit command. After that send normal UVC frame stream from MIPI interface. So I have to switch for these two different configuration.

Thanks

Angus

0 Likes