cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
resalmon
Adventurer
Adventurer
2,700 Views
Registered: ‎01-10-2014

Setting xaxivdma driver to internal genlock mode

Hello all,

 

We have a question about VDMA.

We'd like to use the VDMA core and  xaxivdma driver in our project. The TPG core is to generate test video signal for s2mm channel of the VDMA and mm2s channel is to send test video signal to video receiver by external synchronization pulse. The TPG and the receiver have different frequencies.

Would you kindly help us and tell which parameters are to be changed in the example listed below so that to set the driver to internal genlock mode for 16 frames-sized frame buffer?

 

 Thank you very much in advance!



static int WriteSetup(struct dma_chan_parms define_function[NUMBER_OF_DMAS])
{
   int i;
   u32 Addr;
   int Status;
   int n;
   for (n = 0; n < NUMBER_OF_DMAS; n++)
   {
      //if(n==0) continue;
      define_function[n].WriteCfg.VertSizeInput = SUBFRAME_VERTICAL_SIZE;
      define_function[n].WriteCfg.HoriSizeInput = SUBFRAME_HORIZONTAL_SIZE;

      define_function[n].WriteCfg.Stride = FRAME_HORIZONTAL_LEN;
      define_function[n].WriteCfg.FrameDelay = 0; /* This example does not test frame delay */

      define_function[n].WriteCfg.EnableCircularBuf = 1;
       // WriteCfg.EnableSync = 0; /* No Gen-Lock */
      define_function[n].WriteCfg.EnableSync = 1; /* Gen-Lock */

       // WriteCfg.PointNum = 0; /* No Gen-Lock */
      define_function[n].WriteCfg.PointNum = 0; /* No Gen-Lock */
      define_function[n].WriteCfg.EnableFrameCounter = 0; /* Endless transfers */

      define_function[n].WriteCfg.FixedFrameStoreAddr = 0; /* We are not doing parking */

      Status = XAxiVdma_DmaConfig(&define_function[n].AxiVdma, XAXIVDMA_WRITE, &define_function[n].WriteCfg);
      if (Status != XST_SUCCESS)
      {
         xil_printf("Write channel config failed %d\r\n", Status);

         return XST_FAILURE;
      }


/* Initialize buffer addresses
*
* Use physical addresses
*/
      Addr = define_function[n].WR_ADDR_BASE + define_function[n].BlockStartOffset;
      for(i = 0; i < NUMBER_OF_WRITE_FRAMES; i++) {
      define_function[n].WriteCfg.FrameStoreStartAddr[i] = Addr;
      Addr += FRAME_LENGTH ;
   }


/* Set the buffer addresses for transfer in the DMA engine
*/
   Status = XAxiVdma_DmaSetBufferAddr(&define_function[n].AxiVdma, XAXIVDMA_WRITE,
   define_function[n].WriteCfg.FrameStoreStartAddr);
   if (Status != XST_SUCCESS)
{
      xil_printf("Write channel set buffer address failed %d\r\n", Status);
      return XST_FAILURE;
}


}
   return XST_SUCCESS;
}

***************************************************************************/

static int ReadSetup(struct dma_chan_parms define_function[NUMBER_OF_DMAS])
{
   int i;
   u32 Addr;
   int Status;
   int n;
   int data_fill,*dst_data_fill;

   for (n = 0; n < NUMBER_OF_DMAS; n++)
   {

      //if(n==1)
      //break;
      define_function[n].ReadCfg.VertSizeInput = SUBFRAME_VERTICAL_SIZE;
      define_function[n].ReadCfg.HoriSizeInput = SUBFRAME_HORIZONTAL_SIZE;

      define_function[n].ReadCfg.Stride = FRAME_HORIZONTAL_LEN;
      define_function[n].ReadCfg.FrameDelay = 1; /* This example does not test frame delay */

      define_function[n].ReadCfg.EnableCircularBuf = 1;
      define_function[n].ReadCfg.EnableSync = 0; /* Gen-Lock */

      define_function[n].ReadCfg.PointNum = 0; /* No Gen-Lock */
      define_function[n].ReadCfg.EnableFrameCounter = 0; /* Endless transfers */

      define_function[n].ReadCfg.FixedFrameStoreAddr = 0; /* We are not doing parking */

      Status = XAxiVdma_DmaConfig(&define_function[n].AxiVdma, XAXIVDMA_READ, &define_function[n].ReadCfg);
      if (Status != XST_SUCCESS) {
         xil_printf("Read channel config failed %d\n\r", Status);

      return XST_FAILURE;
      }
/* Initialize buffer addresses
*
* These addresses are physical addresses
*/
   Addr = define_function[n].RD_ADDR_BASE + define_function[n].BlockStartOffset;
   for(i = 0; i < NUMBER_OF_READ_FRAMES; i++) {
      define_function[n].ReadCfg.FrameStoreStartAddr[i] = Addr;
      #if 0
      dst_data_fill = (unsigned int *)Addr;
      for(data_fill=0;data_fill<FRAME_LENGTH;)
      {
         dst_data_fill[data_fill] = 0xDEADBEEF;
         data_fill++;
         dst_data_fill[data_fill] = 0xDEADBEEF;
         data_fill++;
         dst_data_fill[data_fill] = 0xDEADBEEF;
         data_fill++;
         dst_data_fill[data_fill] = 0xDEADBEEF;
         data_fill++;
      }
      #endif
      Addr += FRAME_LENGTH ;
      }

/* Set the buffer addresses for transfer in the DMA engine
* The buffer addresses are physical addresses
*/
   Status = XAxiVdma_DmaSetBufferAddr(&define_function[n].AxiVdma, XAXIVDMA_READ,
   define_function[n].ReadCfg.FrameStoreStartAddr);
   if (Status != XST_SUCCESS) {
      xil_printf("Read channel set buffer address failed %d\n\r", Status);

      return XST_FAILURE;
   }
}
return XST_SUCCESS;
}

/***************************************************************************
* StartTransfer: It will start the VDMA.
* *
* XAxiVdma*: It is instance of VDMA that needs to be started.
*
* *
***************************************************************************/

int StartTransfer(XAxiVdma * InstancePtr, vdma_run_mode mode)
{
   int Status;

   xil_printf("VDMA Baseaddress 0x%x\r\n", InstancePtr->BaseAddr);
   xil_printf("VDMA SG Enable %d\r\n", InstancePtr->HasSG);
   xil_printf("VDMA MaxNumFrames %d\r\n", InstancePtr->MaxNumFrames);
   if((mode==BOTH)||(mode==ONLY_WRITE))
   {
      Status = XAxiVdma_DmaStart(InstancePtr, XAXIVDMA_WRITE);
      if (Status != XST_SUCCESS) {
      xil_printf("Start Write transfer failed %d\r\n", Status);

      return XST_FAILURE;
}
}
   if((mode==BOTH)||(mode==ONLY_READ))
   {
      Status = XAxiVdma_DmaStart(InstancePtr, XAXIVDMA_READ);
      if (Status != XST_SUCCESS) {
      xil_printf("Start read transfer failed %d\n\r", Status);

      return XST_FAILURE;
   }
}
   return XST_SUCCESS;
} 

0 Kudos
1 Reply
bwiec
Xilinx Employee
Xilinx Employee
2,684 Views
Registered: ‎08-02-2011

The config struct has a member called 'InternalGenLock.' You set the number of frame stores with a call to XAxiVdma_SetFrmStore
www.xilinx.com
0 Kudos