AnsweredAssumed Answered

Reinitializing PPI interface to use a different width (BF527)

Question asked by tcmichals on Aug 21, 2013
Latest reply on Sep 12, 2013 by tcmichals

All,

 

There is a requirement to reset the PPI Element count depending the incoming data rate.   The issue I'm trying to understand is how clear/reset/recover the DMA buffers made by adi_dev_Read.    The  pseudo code below shows a for loop calling adi_dev_Read allowing DMA to have several buffers to compensate for software jitter.  The basic goal is to:

  1. Setup PPI basic one time initialization
  2. Setup PPI for a given element count
  3. Start PPI Data collection
  4. Stop PPI
  5. goto step 2

 

 

openPPI()

{

....

 

    eResult = adi_dev_Open(adi_dev_ManagerHandle,

                           /* PPI Entry point */

                           &ADIPPIEntryPoint,

                           0,

                           this,

                           &m_hPpiDevice,

                           ADI_DEV_DIRECTION_INBOUND,

                           adi_dma_ManagerHandle,

                           adi_DCBManagerHandle /*Working NULL */,

                           adi_dd_VCCD_PpiCallback);

 

...

}

 

restartPPI( elementCount)

{

ADI_PPI_CONTROL_REG ppi_control;

    u16 ppi_count = ( u16)((width-1) &0xFFFF);

 

    // Configure the PPI_CONTROL register

    ppi_control.port_en  = 0;    // Disable until ready

    ppi_control.port_dir = 0;    // Receive mode

    ppi_control.xfr_type = 3;    // Non ITU-R 656 mode

    ppi_control.port_cfg = 0;    // 1 external frame syncs

    ppi_control.fld_sel  = 0;    // ????

    ppi_control.skip_en  = 0;    // Not required

    ppi_control.skip_eo  = 0;    // Not required

    ppi_control.pack_en  = 0;    // Not required

    ppi_control.dlen     = 7;    // 16 Bits data length

    ppi_control.polc     = 0;    // Do not invert PPI_CLK

    ppi_control.pols     = 0;    // Do not invert PPI_FS1 & PPI_FS2

// table of configuration values for the PPI on input   

 

    ADI_DEV_CMD_VALUE_PAIR InboundConfigurationTable [] = {

        { ADI_DEV_CMD_SET_DATAFLOW_METHOD,      (void *)ADI_DEV_MODE_CHAINED},

        { ADI_PPI_CMD_SET_CONTROL_REG,          (void*)(*(u16*)&ppi_control)},

 

        { ADI_PPI_CMD_SET_TRANSFER_COUNT_REG,   (void*)(*(u16*)&ppi_count)},

        {ADI_DEV_CMD_SET_ERROR_REPORTING, (void*)TRUE},

        {ADI_DEV_CMD_SET_STREAMING,(void *)TRUE},

        { ADI_DEV_CMD_END,                       NULL},

    };

//STOP PPI

Result = adi_dev_Control(m_hPpiDevice, ADI_DEV_CMD_SET_DATAFLOW, (void *)FALSE);

Result = adi_dev_Control( m_hPpiDevice, ADI_DEV_CMD_TABLE, (void*)InboundConfigurationTable );

for ( i=0; i < MAX_DESC_VCCD; ++i )

    {

 

        m_rxCCDDesc[i].Data = (void *)&_ppiData[i][0];

        m_rxCCDDesc[i].ElementWidth = 2 ;

        m_rxCCDDesc[i].ElementCount = width ; //1D   

        m_rxCCDDesc[i].CallbackParameter= (void *)&m_rxCCDDesc[i];

        m_rxCCDDesc[i].pNext = (adi_dev_1d_buffer *)NULL;

        m_rxCCDDesc[i].pAdditionalInfo = (void *) this;

FlushInvArea(m_rxCCDDesc[i].Data, ((char *)m_rxCCDDesc[i].Data) +

                     (m_rxCCDDesc[i].ElementWidth * m_rxCCDDesc[i].ElementCount)

                    );

 

        /* submit transfer buffers to PPI driver */

        if ( (Result = adi_dev_Read(m_hPpiDevice,

                                    //ADI_DEV_2D,

                                    ADI_DEV_1D,

                                    (ADI_DEV_BUFFER *)&m_rxCCDDesc[i]))

             != 0 )

        {

       

            syslog(LOG_DEBUG,SYSLOG_MODULE_VCCD, "adi_dev_Write failed. Error code: 0x%08X\n", Result);

        }

 

    }

  Result = adi_dev_Control(m_hPpiDevice, ADI_DEV_CMD_SET_DATAFLOW, (void *)TRUE);

     return rc;

 

}

Outcomes