| mipicsiss Vitis Drivers API Documentation

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

Functions
xcsiss_intr_example.c File Reference

## Overview

This file contains a design example using the XCsiSs driver with interrupts.

On receiving a frame received interrupt, it will print frames received count. On receiving a short packet FIFO not empty interrupt, it will print the contents of the short packet received. On receiving DPHY, protocol or Packet level error, it will print the same On receiving any type of error interrupt the sub-system will reset

Note
  This example requires an interrupt controller connected to the processor and the MIPI CSI Rx Subsystem in the system. The Camera Sensor may need some programming before via the IIC before it starts to send any video stream.

For this example to display output, the user need to implement initialization of the system (CsiSs_PlatformInit) and after MIPI CSI Rx subsystem start (XCsiSs_Start) is complete, implement configuration of the video stream source in order to provide the MIPI CSI Rx Subsystem HIP input. The functions CsiSs_PlatformInit and CsiSs_StreamSrc are declared and are left up to the user implement.

    MODIFICATION HISTORY:

    Ver Who Date     Changes

    1.0 vsa 07/21/15 Initial release
    1.1 ms  01/23/17 Modified xil_printf statement in main function to
                     ensure that "Successfully ran" and "Failed" strings
                     are available in all examples. This is a fix for
                     CR-965028.
    1.2 vsa 03/02/17 Added Word Count corruption interrupt
    1.11 ml 11/15/23 Fix compilation errors reported with -std=c2x compiler flag

## Functions
u32 | CsiSs_IntrExample (u32 DeviceId)
| This function is the main entry point for the interrupt example using the XCsiSs driver. More...
u32 | CsiSs_PlatformInit (void)
| This function initialize required platform-specifc peripherals. More...
u32 | CsiSs_CciInit (void)
| This function initialize required IIC instance to configure and control the camera. More...
u32 | CsiSs_CciSetupIntrSystem (void)
| This function setup interrupts of the IIC instance if used for the MIPI CSI Rx Subsystem. More...
u32 | CsiSs_SetupIntrSystem (void)
| This function sets up the interrupt system so interrupts can occur for the MIPI CSI Rx Subsystem core. More...
void | CsiSs_DphyEventHandler (void *InstancePtr, u32 Mask)
| This function is called when a DPHY level error event is received by the MIPI CSI Rx Subsystem core. More...
void | CsiSs_PktLvlEventHandler (void *InstancePtr, u32 Mask)
| This function is called when a Packet level error event is received by the MIPI CSI Rx Subsystem core. More...
void | CsiSs_ProtLvlEventHandler (void *InstancePtr, u32 Mask)
| This function is called when a Protocol decoding level error event is received by the MIPI CSI Rx Subsystem core. More...
void | CsiSs_SPktEventHandler (void *InstancePtr, u32 Mask)
| This function is called when a Short Packet FIFO event is received by the MIPI CSI Rx Subsystem core. More...
void | CsiSs_ErrEventHandler (void *InstancePtr, u32 Mask)
| This function is called when a Other errors event is received by the MIPI CSI Rx Subsystem core. More...
void | CsiSs_FrameRcvdEventHandler (void *InstancePtr, u32 Mask)
| This function is called when a Frame is received by the MIPI CSI Rx Subsystem core. More...
void | Delay (u32 Seconds)
| For Microblaze we use an assembly loop that is roughly the same regardless of optimization level, although caches and memory access time can make the delay vary. More...
int | main ()
| This is the main function for XCsiSs interrupt example. More...

## Function Documentation

u32 CsiSs_CciInit | ( | void |  | ) |

This function initialize required IIC instance to configure and control the camera.

Parameters

  None. |

Returns
  - XST_SUCCESS if required IIC is initialized and configured successfully.
  - XST_FAILURE, otherwise.

Note
  None.

Referenced by CsiSs_IntrExample().

u32 CsiSs_CciSetupIntrSystem | ( | void |  | ) |

This function setup interrupts of the IIC instance if used for the MIPI CSI Rx Subsystem.

Parameters

  None |

Returns
  - XST_SUCCESS if IIC interrupt is configured successfully.
  - XST_FAILURE,if IIC interrupt is failed to configure

Note
  None.

Referenced by CsiSs_SetupIntrSystem().

void CsiSs_DphyEventHandler | ( | void * | InstancePtr,
|  | u32 | Mask
| ) |  |

This function is called when a DPHY level error event is received by the MIPI CSI Rx Subsystem core.

Parameters

  InstancePtr | is a pointer to the XCsiSs instance.
  Mask | of interrupt which caused this event

Returns
  None.

Note
  Use the XCsiSs_SetCallback driver function to set this function as the handler for DPHY level error event.

Referenced by CsiSs_IntrExample(), and CsiSs_SetupIntrSystem().

void CsiSs_ErrEventHandler | ( | void * | InstancePtr,
|  | u32 | Mask
| ) |  |

This function is called when a Other errors event is received by the MIPI CSI Rx Subsystem core.

Parameters

  InstancePtr | is a pointer to the XCsiSs instance.
  Mask | of interrupt which caused this event

Returns
  None.

Note
  Use the XCsiSs_SetCallback driver function to set this function as the handler for Other error event.

Referenced by CsiSs_IntrExample(), and CsiSs_SetupIntrSystem().

void CsiSs_FrameRcvdEventHandler | ( | void * | InstancePtr,
|  | u32 | Mask
| ) |  |

This function is called when a Frame is received by the MIPI CSI Rx Subsystem core.

Parameters

  InstancePtr | is a pointer to the XCsiSs instance.
  Mask | of interrupt which caused this event

Returns
  None.

Note
  Use the XCsiSs_SetCallback driver function to set this function as the handler for Frame Received event.

Referenced by CsiSs_IntrExample(), and CsiSs_SetupIntrSystem().

u32 CsiSs_IntrExample | ( | u32 | DeviceId | ) |

This function is the main entry point for the interrupt example using the XCsiSs driver.

This function will set up the system with interrupts handlers.

Parameters

  DeviceId | is the unique device ID of the MIPI CSI Rx Subsystem core.

Returns
  - XST_FAILURE if the system setup failed.
  - XST_SUCCESS should never return since this function, if setup was successful, is blocking.

Note
  If system setup was successful, this function is blocking in order to illustrate interrupt handling.

References XCsiSs_Config::BaseAddr, XCsiSs::Config, CsiSs_CciInit(), CsiSs_DphyEventHandler(), CsiSs_ErrEventHandler(), CsiSs_FrameRcvdEventHandler(), CsiSs_PktLvlEventHandler(), CsiSs_PlatformInit(), CsiSs_ProtLvlEventHandler(), CsiSs_SetupIntrSystem(), CsiSs_SPktEventHandler(), Delay(), XCsiSs_Activate(), XCsiSs_CfgInitialize(), XCsiSs_Configure(), XCsiSs_IntrHandler(), XCsiSs_LookupConfig(), XCsiSs_ReportCoreInfo(), XCsiSs_Reset(), and XCsiSs_SetCallBack().

Referenced by main().

void CsiSs_PktLvlEventHandler | ( | void * | InstancePtr,
|  | u32 | Mask
| ) |  |

This function is called when a Packet level error event is received by the MIPI CSI Rx Subsystem core.

Parameters

  InstancePtr | is a pointer to the XCsiSs instance.
  Mask | of interrupt which caused this event

Returns
  None.

Note
  Use the XCsiSs_SetCallback driver function to set this function as the handler for Packet level error event.

Referenced by CsiSs_IntrExample(), and CsiSs_SetupIntrSystem().

u32 CsiSs_PlatformInit | ( | void |  | ) |

This function initialize required platform-specifc peripherals.

Parameters

  None. |

Returns
  - XST_SUCCESS if required peripherals are initialized and configured successfully.
  - XST_FAILURE, otherwise.

Note
  None.

Referenced by CsiSs_IntrExample().

void CsiSs_ProtLvlEventHandler | ( | void * | InstancePtr,
|  | u32 | Mask
| ) |  |

This function is called when a Protocol decoding level error event is received by the MIPI CSI Rx Subsystem core.

Parameters

  InstancePtr | is a pointer to the XCsiSs instance.
  Mask | of interrupt which caused this event

Returns
  None.

Note
  Use the XCsiSs_SetCallback driver function to set this function as the handler for Protocol Decoding level error

Referenced by CsiSs_IntrExample(), and CsiSs_SetupIntrSystem().

u32 CsiSs_SetupIntrSystem | ( | void |  | ) |

This function sets up the interrupt system so interrupts can occur for the MIPI CSI Rx Subsystem core.

The function is application-specific since the actual system may or may not have an interrupt controller. The MIPI CSI Subsystem core could be directly connected to a processor without an interrupt controller. The user should modify this function to fit the application.

Parameters

  None |

Returns
  - XST_SUCCESS if interrupt setup was successful.
  - A specific error code defined in "xstatus.h" if an error occurs.

Note
  None.

References CsiSs_CciSetupIntrSystem(), CsiSs_DphyEventHandler(), CsiSs_ErrEventHandler(), CsiSs_FrameRcvdEventHandler(), CsiSs_PktLvlEventHandler(), CsiSs_ProtLvlEventHandler(), CsiSs_SPktEventHandler(), XCsiSs_IntrHandler(), and XCsiSs_SetCallBack().

Referenced by CsiSs_IntrExample().

void CsiSs_SPktEventHandler | ( | void * | InstancePtr,
|  | u32 | Mask
| ) |  |

This function is called when a Short Packet FIFO event is received by the MIPI CSI Rx Subsystem core.

Parameters

  InstancePtr | is a pointer to the XCsiSs instance.
  Mask | of interrupt which caused this event

Returns
  None.

Note
  Use the XCsiSs_SetCallback driver function to set this function as the handler for Short Packet FIFO error event.

References XCsiSs::SpktData, and XCsiSs_GetShortPacket().

Referenced by CsiSs_IntrExample(), and CsiSs_SetupIntrSystem().

void Delay | ( | u32 | Seconds | ) |

For Microblaze we use an assembly loop that is roughly the same regardless of optimization level, although caches and memory access time can make the delay vary.

Just keep in mind that after resetting or updating the PHY modes, the PHY typically needs time to recover.

Parameters

  Number | of seconds to sleep

Returns
  None

Note
  None

Referenced by CsiSs_IntrExample().

int main | ( | void |  | ) |

This is the main function for XCsiSs interrupt example.

If the CsiSs_IntrExample function which sets up the system succeeds, this function will wait for the interrupts. Once a connection event or pulse is detected, CsiSs will RX device capabilities and re-start the subsystem.

Parameters

  None. |

Returns
  - XST_FAILURE if the interrupt example was unsuccessful.

Note
  Unless setup failed, main will never return since CsiSs_IntrExample is blocking (it is waiting on interrupts for Hot-Plug-Detect (HPD) events.

References CsiSs_IntrExample().