Usage - 2.5 English

Video Frame Buffer Read and Video Frame Buffer Write LogiCORE IP Product Guide (PG278)

Document ID
Release Date
2.5 English
To integrate and use the Video Frame Buffer Read and Video Frame Buffer Write core drivers in the application, perform the following steps:
Note: The Video Frame Buffer Read is used as an example.
  1. Include the driver header file xv_frmbufrd_l2.h that contains the frame buffer instance object definition.
  2. Declare an instance of the frame buffer core type: XV_FrmbufRd_l2 FrmbufRd.
  3. Initialize the frame buffer instance at power on.

    int XVFrmbufRd_Initialize(XV_FrmbufRd_l2 *InstancePtr, u16 DeviceId);

    This function accesses the hardware configuration and initializes the core to the power on default state.

  4. The application must register the ISR with the system interrupt controller and set the application callback function. This function will then be called by the Video Frame Buffer Read or Video Frame Buffer Write driver when the IRQ is triggered.
    • Register the core ISR routine XVFrmbufRd_InterruptHandler or XVFrmbufWr_InterruptHandler with the system interrupt controller.
    • Register the application callback function that should be called within the interrupt context. This can be done using the API XVFrmbufRd_SetCallback or XVFrmbufWr_SetCallback.
  5. If applicable, write the application-level callback function. An example action to be performed here would be to update the buffer address from where to read the next frame data. This allows the application to render the frame updates in memory and on screen.
  6. Write a function to configure the core. The following is an example event sequence that might be performed here.
    1. Set the video properties:
      void XVFrmbufRd_SetMemFormat(XV_FrmbufRd_l2 *InstancePtr,
      u32 StrideInBytes,
      XVidC_ColorFormat MemFmt
      const XVidC_VideoStream *StrmIn);
    2. Set the frame buffer base address.
      int XVFrmbufRd_SetBufferAddr(XV_FrmbufRd_l2 *InstancePtr, UINTPTR Addr);

      For semi-planar formats, set the buffer base address for the second plane:

      int XVFrmbufRd_SetChromaBufferAddr(XV_FrmbufRd_l2 *InstancePtr, UINTPTR Addr);

      For 3 planar formats, set the buffer base address for the 2nd plane and 3rd plane:

      int XVFrmbufRd_SetChromaBufferAddr(XV_FrmbufRd_l2 *InstancePtr, UINTPTR Addr); int XVFrmbufRd_SetVChromaBufferAddr(XV_FrmbufRd_l2 *InstancePtr,UINTPTR Addr);
    3. Enable the interrupts:
      void XVFrmbufRd_InterruptEnable(XV_FrmbufRd_l2 *InstancePtr, u32 IrqMask);
    4. Start the core:
      void XVFrmbufRd_Start(XV_FrmbufRd_l2 *InstancePtr);

      Also, to help debug the Video Frame Buffer Read core a Debug API is available that provides the state of the core.

      void XVFrmbufRd_DbgReportStatus(XV_FrmbufRd_l2 *InstancePtr);
  1. Resolution changes are not possible on the fly. If either the master input stream or the output stream resolution must be changed during operation, the application must reset the Video Frame Buffer Read and Video Frame Buffer Write, that is, toggle ap_rst_n, and reconfigure the core for the new resolution. After reset, all registers are cleared to 0.
  2. When configuring the frame buffer cores, the driver checks to ensure that the frame size, stride, and memory video format are valid. If any of these configurations are invalid, then the action will not be applied and the API will return an error code. The application code should check the return status of all APIs to make sure the required action was completed successfully and, if not, take corrective action.