AnsweredAssumed Answered

BF60* - how to continuously capture video frames using API EPPI drivers?

Question asked by FF-PDW on Sep 1, 2015
Latest reply on Sep 23, 2015 by Rudstone

Hi

Using ADI API drivers - e.g. adi_eppi_Open(), adi_eppi_SubmitBuffer() etc to capture video to SDRAM on ADSP-BF609 EX-BOARD.

I am using two alternating buffers - one available for writing/filling and previous one available for read/processing.

 

My problem is that each buffer gets written to only once.

What do I do to make it continue cycling automatically e.g. CaptureBuf0, CaptureBuf1, CaptureBuf0,CaptureBuf1.....etc

 

Code snippets below:

 

ADI_EPPI_HANDLE EPPIDevCapture;

 

#pragma section ("sdram_bank0", DM)

static VIDEO_BUF    CaptureBuf0;

#pragma section ("sdram_bank0", DM)

static VIDEO_BUF   *pCapBufNext;        // Pointer to the next input video buffer to be submitted for filling

#pragma section ("sdram_bank1", DM)

static VIDEO_BUF    CaptureBuf1;

#pragma section ("sdram_bank1", DM)

static VIDEO_BUF   *pCapBufPrev;        // Pointer to a processed input video buffer with valid data

 

Start capture like this:

adi_eppi_Open(VIDEO_IN_EPPI_DEVICE_NUM, ADI_EPPI_DIRECTION_RX, pCapBufPrev, VIDEO_BUF_SIZE, &EPPIDevCapture);

  adi_eppi_SetDMAConfig(EPPIDevCapture, false);    //1 channel DMA

adi_eppi_StreamingEnable(EPPIDevCapture, true);
adi_eppi_RepetiveBufferEnable(EPPIDevCapture, true);
adi_eppi_SetDmaTransferSize(EPPIDevCapture, ADI_EPPI_DMA_TRANSFER_8BIT);
adi_eppi_SetControlReg(EPPIDevCapture, ADI_EPPI_CONTROL_REGISTER, ENUM_EPPI_CTL_ENTIRE656);
adi_eppi_SetDataLength(EPPIDevCapture, ADI_EPPI_8BIT);
adi_eppi_SubmitBuffer(EPPIDevCapture, &pCapBufPrev, VIDEO_BUF_SIZE);
adi_eppi_Enable(EPPIDevCapture, true);

In main while loop check for frame capture completion:

 

bool BufferReady = false;

    adi_eppi_IsBufferAvailable(EPPIDevCapture,  &BufferReady);

    if (BufferReady == true)

    {

   FrameCaptureISR();

    }

 

FrameCaptureISR switches the buffer pointers and restarts the process:

 

void FrameCaptureISR(void)

{   

    adi_eppi_Enable(EPPIDevCapture, false);

    if (pCapBufNext == &CaptureBuf0)

    {

        pCapBufNext = &CaptureBuf1;

            pCapBufPrev = &CaptureBuf0;

            adi_eppi_SubmitBuffer(EPPIDevCapture, &pCapBufNext, VIDEO_BUF_SIZE);

    }

    else

    {

        pCapBufNext = &CaptureBuf0;

        pCapBufPrev = &CaptureBuf1;

        adi_eppi_SubmitBuffer(EPPIDevCapture, &pCapBufPrev, VIDEO_BUF_SIZE);

    }

    eResult = adi_eppi_Enable(EPPIDevCapture, true);

}

 

Can anyone suggest what I need to do to get the process to continue past two frames?

Also how do I ensure that each captured frame is unique, i.e. I am not capturing multiple copies of the same frame?

Thanks

Outcomes