Usage - 1.2 English

Multi-Scaler LogiCORE IP Product Guide (PG325)

Document ID
PG325
Release Date
2023-12-20
Version
1.2 English

To better understand the driver usage, consider the following test case scenario.

Assume that the core in the design was configured with eight outputs. The driver must program the input image width, input image height, output image width, output image height, stride for input image, stride for output image, pixel format of the input image, pixel format of the output image, pixel rate, line rate, source buffer address, and destination buffer address registers for all the eight outputs. The application should allocate required frame buffer space per output in memory. These addresses can be updated during the interrupt.

Use the following steps to integrate and use the Video Multi-Scaler driver in the application:

  1. Include the driver header file xv_multi_scaler.h that contains the Multi-Scaler instance object definition.
  2. Declare an instance of the Video Multi-Scaler type XV_multi_scaler MultiScalerInst.
  3. Initialize the Video Multi-Scaler instance at power on:
    int XV_multi_scaler_Initialize(XV_multi_scaler *InstancePtr, u16 DeviceId);

    This function accesses the hardware configuration and initializes the core instance structure.

  4. If the core is operating in interrupt mode, the application needs to perform the mentioned tasks. That is, register the ISR with the system interrupt controller and set the application callback function. This function is called by the Video Multi-Scaler driver when the frame done IRQ is triggered.
  5. If applicable, write the application level callback function. An example action to be performed here would be to update the Source Image buffer addresses, that is the address to read the next frame data for each output. This allows the application to render the frame updates in the memory, on screen.
  6. Set the number of outputs by the function XV_MultiScalerSetNumOutputs(MultiScalerPtr, XNUM_OUTPUTS);
  7. Call the setup function XV_MultiScalerSetup(MultiScalerPtr, thisCase);

    This function programs input image width, input image height, output image width, output image height, stride for input image, stride for output image, pixel format of the input image, pixel format of the output image, pixel rate, line rate, source buffer address, and destination buffer address registers.

    For the list of the use cases check the array given in the application code, that is xmulti_scaler_example.c of the Multi-Scaler driver.

    XV_multi_scaler_Video_Config useCase[USECASE_COUNT][XNUM_OUTPUTS]

    Some use cases shown in the application are:

    1. 720x540 frame is read from the source buffer, upscaled to 1920x1920 and written to the destination buffer.
    2. 1280x1920 frame is read from the source buffer, down scaled to 720x720 and written to the destination buffer.
  8. Enable the interrupts by these functions

    XV_multi_scaler_InterruptGlobalEnable(MultiScalerPtr); XV_multi_scaler_InterruptEnable(MultiScalerPtr, 0xF);

  9. Finally, start the IP by the function XV_MultiScalerStart(MultiScalerPtr) and wait for the interrupt.
Note: Resolution changes are not possible on the fly. If the changes are required, then the application must reset the Video Multi-Scaler, that is toggle ap_rst_n, and reconfigure the core for the new resolution. After reset, all the registers are cleared to 0. The application code should check the return status of all APIs to make sure the required action is completed successfully. If not, take the required action.