| mipicsiss Vitis Drivers API Documentation

- Overview
- Data Structures
- APIs
- File List
- Examples

Macros | Functions | Variables
xmipi_example.c File Reference

## Overview

This file demonstrates the Xilinx MIPI CSI2 Rx Subsystem and MIPI DSI2 Tx Subsystem.

The video pipeline is created by connecting an IMX274 Camera sensor to the MIPI CSI2 Rx Subsystem. The sensor is programmed to generate RAW10 type de bayered data as per the pipeline configuration. The raw pixels are fed to Xilinx Demosaic, Gamma lut and v_proc_ss IPs to convert pixel to RGB format. The RGB pixels are then sent across to a data Video Test Pattern Generator. In a pass through mode, the camera data is passed to an AXI Stream broadcaster. This sends across video stream to along HDMI Tx Subsystem and a Video Processing Subsystem configured as Scalar. The output of the scalar is connected to the DSI2 Tx Subsystem. The DSI2 output is connected to AUO Asus Display panel with 1920x1200 fixed resolution

    MODIFICATION HISTORY:

    Ver   Who    Date     Changes

    1.00  pg    12/07/17 Initial release.

## Macros
#define | I2C_MUX_ADDR 0x74
| I2C Mux Address. More...
#define | I2C_CLK_ADDR 0x68
| I2C Clk Address. More...

## Functions
int | I2cMux (void)
| This function setup SI5324 clock generator over IIC. More...
int | I2cClk (u32 InFreq, u32 OutFreq)
| This function setup SI5324 clock generator either in free or locked mode. More...
void | EnableColorBar (XVphy *VphyPtr, XV_HdmiTxSs *HdmiTxSsPtr, XVidC_VideoMode VideoMode, XVidC_ColorFormat ColorFormat, XVidC_ColorDepth Bpc)
| This function enables the ColorBar. More...
u32 | InitStreamMuxGpio (void)
| This function initializes GPIO IP for Stream Switch selection and gets config parameters. More...
void | Info (void)
| This function outputs the video timing , Audio, Link Status, HDMI RX state of HDMI RX core. More...
void | CloneTxEdid (void)
| This function clones the EDID of the connected sink device to the HDMI RX. More...
void | XV_ConfigTpg (XV_tpg *InstancePtr)
| This function generates video pattern. More...
void | ResetTpg (void)
| This function resets TPG IP. More...
void | EnableDSI ()
| This function enables MIPI DSI SS. More...
void | SelectDSIOutput (void)
| This function programs GPIO to 1 to select MIPI DSI SS Stream Path in AXI- Stream switch. More...
void | SelectHDMIOutput (void)
| This function programs GPIO to '0' to select HDMI Stream path in AXI-Stream switch. More...
void | config_csi_cap_path ()
| Main function to initialize the video pipleline and process user input. More...
void | ReportStreamMode (XV_HdmiTxSs *HdmiTxSsPtr, u8 IsPassThrough)
| This function reports the stream mode. More...
void | TxConnectCallback (void *CallbackRef)
| This function is called when a TX connect event has occurred. More...
void | VphyHdmiTxInitCallback (void *CallbackRef)
| This function is called when the GT TX reference input clock has changed. More...
void | VphyHdmiTxReadyCallback (void *CallbackRef)
| This function is called when the GT TX has been initialized. More...
void | TxVsCallback (void *CallbackRef)
| This function is called when a TX vsync has occurred. More...
void | TxStreamUpCallback (void *CallbackRef)
| This function is called when the TX stream is up. More...
void | TxStreamDownCallback (void *CallbackRef)
| This function is called when the TX stream is down. More...
void | StartTxAfterRx (void)
| This function is called to start the TX stream after the RX stream was up and running. More...
int | SetupInterruptSystem (void)
| This function setups the interrupt system. More...
void | Xil_AssertCallbackRoutine (u8 *File, s32 Line)
| This function asserts a callback error. More...
void | CamReset (void)
| This function resets IMX274 camera sensor. More...
void | Reset_IP_Pipe (void)
| This function resets image processing pipe. More...
int | main (void)
| Main function to initialize the video pipleline and process user input. More...

## Variables
XTpg_PatternId | Pattern
| Video pattern. More...
u8 | IsPassThrough
| Demo mode 0-colorbar 1-pass through. More...

## Macro Definition Documentation

#define I2C_CLK_ADDR 0x68

I2C Clk Address.

Referenced by I2cClk(), and main().

#define I2C_MUX_ADDR 0x74

I2C Mux Address.

Referenced by I2cMux().

## Function Documentation

void CamReset | ( | void |  | ) |

This function resets IMX274 camera sensor.

Returns
  None.

Note
  None.

void CloneTxEdid | ( | void |  | ) |

This function clones the EDID of the connected sink device to the HDMI RX.

Returns
  None.

Note
  None.

void config_csi_cap_path | ( |  | ) |

Main function to initialize the video pipleline and process user input.

Returns
  XST_SUCCESS if MIPI example was successful else XST_FAILURE

Note
  None.

References FrmbufrdDoneCallback(), and FrmbufwrDoneCallback().

void EnableColorBar | ( | XVphy * | VphyPtr,
|  | XV_HdmiTxSs * | HdmiTxSsPtr,
|  | XVidC_VideoMode | VideoMode,
|  | XVidC_ColorFormat | ColorFormat,
|  | XVidC_ColorDepth | Bpc
| ) |  |

This function enables the ColorBar.

Parameters

  VphyPtr | is a pointer to the VPHY core instance.
  HdmiTxSsPtr | is a pointer to the XV_HdmiTxSs instance.
  VideoMode | is the resolution that is to be displayed
  ColorFormat | that can be RGB888 or YUV422 or YUV420
  Bpc | is the Bits per color that can be 8 or 10 or 12

Returns
  None.

Note
  None.

References I2cClk(), and IsPassThrough.

Referenced by main().

void EnableDSI | ( | void |  | ) |

This function enables MIPI DSI SS.

Returns
  None.

Note
  None.

int I2cClk | ( | u32 | InFreq,
|  | u32 | OutFreq
| ) |  |

This function setup SI5324 clock generator either in free or locked mode.

Parameters

  InFreq | specifies an input frequency for the si5324.
  OutFreq | specifies the output frequency of si5324.

Returns
  Zero if error in programming external clock ele '1' if success

Note
  None.

Parameters

  Index | specifies an index for selecting mode frequency.
  Mode | specifies either free or locked mode.

Returns
  - Zero if error in programming external clock.
  - One if programmed external clock.

Note
  None.

References I2C_CLK_ADDR.

Referenced by EnableColorBar(), and StartTxAfterRx().

int I2cMux | ( | void |  | ) |

This function setup SI5324 clock generator over IIC.

Returns
  The number of bytes sent.

Note
  None.

Parameters

  None. |

Returns
  The number of bytes sent.

Note
  None.

References I2C_MUX_ADDR.

void Info | ( | void |  | ) |

This function outputs the video timing , Audio, Link Status, HDMI RX state of HDMI RX core.

In addition, it also prints information about HDMI TX, and HDMI GT cores.

Returns
  None.

Note
  None.

In addition, it also prints information about HDMI TX, and HDMI GT cores.

Parameters

  None. |

Returns
  None.

Note
  None.

u32 InitStreamMuxGpio | ( | void |  | ) |

This function initializes GPIO IP for Stream Switch selection and gets config parameters.

Returns
  XST_SUCCESS if successful or else XST_FAILURE.

Note
  None.

Referenced by main().

int main | ( | void |  | ) |

Main function to initialize the video pipleline and process user input.

Returns
  XST_SUCCESS if MIPI example was successful else XST_FAILURE

Note
  None.

References XCsiSs::Config, config_csi_cap_path(), EnableColorBar(), EnableDSI(), I2C_CLK_ADDR, InitDSI(), InitializeCsiRxSs(), InitIIC(), InitImageProcessingPipe(), InitStreamMuxGpio(), IsPassThrough, Pattern, PrintPipeConfig(), Reset_IP_Pipe(), ResetTpg(), SelectDSIOutput(), SelectHDMIOutput(), SetColorDepth(), SetupCameraSensor(), SetupDSI(), SetupInterruptSystem(), StartSensor(), TxConnectCallback(), TxStreamUpCallback(), TxVsCallback(), VphyHdmiTxInitCallback(), VphyHdmiTxReadyCallback(), XCsiSs_IntrHandler(), Xil_AssertCallbackRoutine(), XMipi_MenuInitialize(), XMipi_MenuProcess(), and XV_ConfigTpg().

void ReportStreamMode | ( | XV_HdmiTxSs * | HdmiTxSsPtr,
|  | u8 | IsPassThrough
| ) |  |

This function reports the stream mode.

Parameters

  HdmiTxSsPtr | is a pointer to the XV_HdmiTxSs instance.
  IsPassThrough | is a flag to represent passthrough or colorbar mode.

Returns
  None.

Note
  None.

Referenced by TxStreamUpCallback().

void Reset_IP_Pipe | ( | void |  | ) |

This function resets image processing pipe.

Returns
  None.

Note
  None.

Referenced by main().

void ResetTpg | ( | void |  | ) |

This function resets TPG IP.

Returns
  None.

Note
  None.

Referenced by main(), and StartTxAfterRx().

void SelectDSIOutput | ( | void |  | ) |

This function programs GPIO to 1 to select MIPI DSI SS Stream Path in AXI- Stream switch.

Returns
  None.

Note
  None.

This function programs GPIO to 1 to select MIPI DSI SS Stream Path in AXI- Stream switch.

Returns
  None.

Note
  None.

Referenced by main().

void SelectHDMIOutput | ( | void |  | ) |

This function programs GPIO to '0' to select HDMI Stream path in AXI-Stream switch.

Returns
  None.

Note
  None.

This function programs GPIO to '0' to select HDMI Stream path in AXI-Stream switch.

Returns
  None.

Note
  None.

Referenced by main().

int SetupInterruptSystem | ( | void |  | ) |

This function setups the interrupt system.

Returns
  XST_SUCCESS if interrupt setup was successful else error code

Note
  None.

Referenced by main().

void StartTxAfterRx | ( | void |  | ) |

This function is called to start the TX stream after the RX stream was up and running.

Returns
  None.

Note
  None.

References I2cClk(), ResetTpg(), and XV_ConfigTpg().

void TxConnectCallback | ( | void * | CallbackRef | ) |

This function is called when a TX connect event has occurred.

Parameters

  CallbackRef | is a callback function reference.

Returns
  None.

Note
  None.

References IsPassThrough.

Referenced by main().

void TxStreamDownCallback | ( | void * | CallbackRef | ) |

This function is called when the TX stream is down.

Parameters

  CallbackRef | is a callback function reference.

Returns
  None.

Note
  None.

void TxStreamUpCallback | ( | void * | CallbackRef | ) |

This function is called when the TX stream is up.

Parameters

  CallbackRef | is a callback function reference.

Returns
  None.

Note
  None.

References IsPassThrough, and ReportStreamMode().

Referenced by main().

void TxVsCallback | ( | void * | CallbackRef | ) |

This function is called when a TX vsync has occurred.

Parameters

  CallbackRef | is a callback function reference.

Returns
  None.

Note
  None.

Referenced by main().

void VphyHdmiTxInitCallback | ( | void * | CallbackRef | ) |

This function is called when the GT TX reference input clock has changed.

Parameters

  CallbackRef | is a callback function reference.

Returns
  None.

Note
  None.

Referenced by main().

void VphyHdmiTxReadyCallback | ( | void * | CallbackRef | ) |

This function is called when the GT TX has been initialized.

Parameters

  CallbackRef | is a callback function reference.

Returns
  None.

Note
  None.

Referenced by main().

void Xil_AssertCallbackRoutine | ( | u8 * | File,
|  | s32 | Line
| ) |  |

This function asserts a callback error.

Parameters

  File | is current file name.
  Line | is line number of the asserted callback.

Returns
  None.

Note
  None.

Referenced by main().

void XV_ConfigTpg | ( | XV_tpg * | InstancePtr | ) |

This function generates video pattern.

Parameters

  InstancePtr | TPG Instance Pointer.

Returns
  None.

Note
  None.

References Pattern.

Referenced by main(), and StartTxAfterRx().

## Variable Documentation

u8 IsPassThrough

Demo mode 0-colorbar 1-pass through.

Referenced by EnableColorBar(), main(), TxConnectCallback(), and TxStreamUpCallback().

XTpg_PatternId Pattern

Video pattern.

Referenced by main(), and XV_ConfigTpg().