mipicsiss
Vitis Drivers API Documentation
Overview

Data Structures

struct  CsiRxSsSubCore
 Sub-Core Configuration Table. More...
 
struct  XCsiSs_Config
 MIPI CSI Rx Subsystem configuration structure. More...
 
struct  XCsiSs
 The XCsiSs driver instance data. More...
 

Macros

#define XCSISS_H_
 Prevent circular inclusions by using protection macros. More...
 
#define XCSISS_HW_H_
 Prevent circular inclusions by using protection macros. More...
 

Typedefs

typedef void(* XCsiSs_Callback )(void *CallbackRef, u32 Mask)
 Callback type which acts as a wrapper on top of CSI Callback. More...
 

Functions

u32 XCsiSs_CfgInitialize (XCsiSs *InstancePtr, XCsiSs_Config *CfgPtr, UINTPTR EffectiveAddr)
 This function initializes the MIPI CSI subsystem and included sub-cores. More...
 
u32 XCsiSs_Configure (XCsiSs *InstancePtr, u8 ActiveLanes, u32 IntrMask)
 This function is used to configure the CSI lanes and interrupts that are to be handled by the application. More...
 
u32 XCsiSs_Activate (XCsiSs *InstancePtr, u8 Flag)
 This function is used to activate the CSI Subsystem. More...
 
u32 XCsiSs_Reset (XCsiSs *InstancePtr)
 This function is used to reset the CSI Subsystem. More...
 
void XCsiSs_ReportCoreInfo (XCsiSs *InstancePtr)
 This function reports list of cores included. More...
 
void XCsiSs_SetVCSelection (XCsiSs *InstancePtr, u16 Value)
 This function will control the virtual channels selection dynamically. More...
 
u32 XCsiSs_GetVCSelection (XCsiSs *InstancePtr)
 This function will return the virtual channels selected. More...
 
void XCsiSs_GetShortPacket (XCsiSs *InstancePtr)
 This function gets the short packets. More...
 
void XCsiSs_GetLaneInfo (XCsiSs *InstancePtr)
 This function gets the clk and data lane info. More...
 
void XCsiSs_GetVCInfo (XCsiSs *InstancePtr)
 This function gets the virtual channel information. More...
 
XCsiSs_ConfigXCsiSs_LookupConfig (u32 DeviceId)
 This function looks for the device configuration based on the unique device ID. More...
 
u32 XCsiSs_SelfTest (XCsiSs *InstancePtr)
 This function performs self test on MIPI CSI Rx Subsystem sub-cores. More...
 
void XCsiSs_IntrHandler (void *InstancePtr)
 This function is the interrupt handler for the MIPI CSI Rx Subsystem. More...
 
void XCsiSs_IntrDisable (XCsiSs *InstancePtr, u32 IntrMask)
 This function is used to disable the interrupts in the CSI core. More...
 
u32 XCsiSs_SetCallBack (XCsiSs *InstancePtr, u32 HandlerType, void *CallbackFunc, void *CallbackRef)
 This routine installs an asynchronous callback function for the given HandlerType: More...
 

Interrupt Types for setting Callbacks

These handlers are used to determine the type of the interrupt handler being registered with the MIPI CSI Rx Subsystem.

Since the subsystem is tightly coupled with the CSI Rx Controller driver, the handlers from the sub core are promoted to the subsystem level so that the application can use them.

#define XCSISS_HANDLER_DPHY   XCSI_HANDLER_DPHY
 
#define XCSISS_HANDLER_PKTLVL   XCSI_HANDLER_PKTLVL
 
#define XCSISS_HANDLER_PROTLVL   XCSI_HANDLER_PROTLVL
 
#define XCSISS_HANDLER_SHORTPACKET   XCSI_HANDLER_SHORTPACKET
 
#define XCSISS_HANDLER_FRAMERECVD   XCSI_HANDLER_FRAMERECVD
 
#define XCSISS_HANDLER_OTHERERROR   XCSI_HANDLER_OTHERERROR
 
#define XCSISS_HANDLER_VCX   XCSI_HANDLER_VCXFRAMEERROR
 

Bitmasks for interrupt callbacks

Please refer to CSI driver for details of the bitmasks.

The application should use the XCSISS_ISR* masks in the call back functions to decode the exact cause of interrupt and handle it accordingly.

#define XCSISS_ISR_FR_MASK   XCSI_ISR_FR_MASK
 
#define XCSISS_ISR_VCXFE_MASK   XCSI_ISR_VCXFE_MASK
 
#define XCSISS_ISR_SKEWCALCHS_MASK   XCSI_ISR_SKEWCALCHS_MASK
 
#define XCSISS_ISR_YUV420_MASK   XCSI_ISR_YUV420_MASK
 
#define XCSISS_ISR_WC_MASK   XCSI_ISR_WC_MASK
 
#define XCSISS_ISR_ILC_MASK   XCSI_ISR_ILC_MASK
 
#define XCSISS_ISR_SPFIFOF_MASK   XCSI_ISR_SPFIFOF_MASK
 
#define XCSISS_ISR_SPFIFONE_MASK   XCSI_ISR_SPFIFONE_MASK
 
#define XCSISS_ISR_SLBF_MASK   XCSI_ISR_SLBF_MASK
 
#define XCSISS_ISR_STOP_MASK   XCSI_ISR_STOP_MASK
 
#define XCSISS_ISR_SOTERR_MASK   XCSI_ISR_SOTERR_MASK
 
#define XCSISS_ISR_SOTSYNCERR_MASK   XCSI_ISR_SOTSYNCERR_MASK
 
#define XCSISS_ISR_ECC2BERR_MASK   XCSI_ISR_ECC2BERR_MASK
 
#define XCSISS_ISR_ECC1BERR_MASK   XCSI_ISR_ECC1BERR_MASK
 
#define XCSISS_ISR_CRCERR_MASK   XCSI_ISR_CRCERR_MASK
 
#define XCSISS_ISR_DATAIDERR_MASK   XCSI_ISR_DATAIDERR_MASK
 
#define XCSISS_ISR_VC3FSYNCERR_MASK   XCSI_ISR_VC3FSYNCERR_MASK
 
#define XCSISS_ISR_VC3FLVLERR_MASK   XCSI_ISR_VC3FLVLERR_MASK
 
#define XCSISS_ISR_VC2FSYNCERR_MASK   XCSI_ISR_VC2FSYNCERR_MASK
 
#define XCSISS_ISR_VC2FLVLERR_MASK   XCSI_ISR_VC2FLVLERR_MASK
 
#define XCSISS_ISR_VC1FSYNCERR_MASK   XCSI_ISR_VC1FSYNCERR_MASK
 
#define XCSISS_ISR_VC1FLVLERR_MASK   XCSI_ISR_VC1FLVLERR_MASK
 
#define XCSISS_ISR_VC0FSYNCERR_MASK   XCSI_ISR_VC0FSYNCERR_MASK
 
#define XCSISS_ISR_VC0FLVLERR_MASK   XCSI_ISR_VC0FLVLERR_MASK
 
#define XCSISS_ISR_ALLINTR_MASK   XCSI_ISR_ALLINTR_MASK
 

BitMasks for grouped interrupts

All interrupts are grouped into DPHY Level Errors, Protocol Decoding Errors, Packet Level Errors, Normal Errors, Frame Received interrupt and Short Packet related.

These are used by application to determine the exact event causing the interrupt

#define XCSISS_INTR_PROT_MASK   XCSI_INTR_PROT_MASK
 
#define XCSISS_INTR_PKTLVL_MASK   XCSI_INTR_PKTLVL_MASK
 
#define XCSISS_INTR_DPHY_MASK   XCSI_INTR_DPHY_MASK
 
#define XCSISS_INTR_SPKT_MASK   XCSI_INTR_SPKT_MASK
 
#define XCSISS_INTR_FRAMERCVD_MASK   XCSI_INTR_FRAMERCVD_MASK
 
#define XCSISS_INTR_ERR_MASK   XCSI_INTR_ERR_MASK
 

Macro Definition Documentation

#define XCSISS_H_

Prevent circular inclusions by using protection macros.

#define XCSISS_HW_H_

Prevent circular inclusions by using protection macros.

Typedef Documentation

typedef void(* XCsiSs_Callback)(void *CallbackRef, u32 Mask)

Callback type which acts as a wrapper on top of CSI Callback.

Parameters
CallbackRefis a callback reference passed in by the upper layer when setting the callback functions, and passed back to the upper layer when the callback is invoked.
Maskis a bit mask indicating the cause of the event. For current core version, this parameter is "OR" of 0 or more XCSISS_ISR_*_MASK constants defined in xcsiss_hw.h.
Returns
None.
Note
None.

Function Documentation

u32 XCsiSs_Activate ( XCsiSs InstancePtr,
u8  Flag 
)

This function is used to activate the CSI Subsystem.

Internally it activates the DPHY and CSI.

Parameters
InstancePtris a pointer to the Subsystem instance to be worked on.
Flagis used to denote whether to enable or disable the subsystem
Returns
  • XST_SUCCESS on successful operation
  • XST_FAILURE on failed operation
Note
None

References XCsiSs::Config, XCsiSs::CsiPtr, and XCsiSs_Config::IsDphyRegIntfcPresent.

Referenced by CsiSs_IntrExample(), and EnableCSI().

u32 XCsiSs_CfgInitialize ( XCsiSs InstancePtr,
XCsiSs_Config CfgPtr,
UINTPTR  EffectiveAddr 
)

This function initializes the MIPI CSI subsystem and included sub-cores.

This function must be called prior to using the subsystem. Initialization includes setting up the instance data for top level as well as all included sub-core therein, and ensuring the hardware is in a known stable state.

Parameters
InstancePtris a pointer to the Subsystem instance to be worked on.
CfgPtrpoints to the configuration structure associated with the subsystem instance.
EffectiveAddris the base address of the device. If address translation is being used, then this parameter must reflect the virtual base address. Otherwise, the physical address should be used.
Returns
  • XST_SUCCESS if initialization is successful
  • XST_FAILURE, otherwise
Note
None.

References XCsiSs_Config::BaseAddr, XCsiSs::Config, XCsiSs::CsiPtr, XCsiSs_Config::IsDphyRegIntfcPresent, and XCsiSs::IsReady.

Referenced by CsiSs_IntrExample(), CsiSs_SelfTestExample(), and InitializeCsiRxSs().

u32 XCsiSs_Configure ( XCsiSs InstancePtr,
u8  ActiveLanes,
u32  IntrMask 
)

This function is used to configure the CSI lanes and interrupts that are to be handled by the application.

Refer to XCsi.h for interrupt masks.

Parameters
InstancePtris a pointer to the Subsystem instance to be worked on.
ActiveLanesis no of active lanes to be configure. This value ranges between 1 and 4. In case Dynamic Active Lane config is enabled, this value can't exceed maximum lanes present. When Dynamic Active Lane config is disabled, it should be equal to maximum lanes.
IntrMaskIndicates Mask for enable interrupts.
Returns
  • XST_SUCCESS on successful configuration of parameters
    • XST_FAILURE otherwise
Note
When EnableActiveLanes is 0, then the ActiveLanes parameter passed should be equal to Max Lanes of design.

References XCsiSs::CsiPtr.

Referenced by CsiSs_IntrExample(), and EnableCSI().

void XCsiSs_GetLaneInfo ( XCsiSs InstancePtr)

This function gets the clk and data lane info.

Parameters
InstancePtris a pointer to the Subsystem instance to be worked on.
Returns
None
Note
None

References XCsiSs::ClkInfo, XCsiSs::Config, XCsiSs::CsiPtr, XCsiSs::DLInfo, and XCsiSs_Config::LanesPresent.

void XCsiSs_GetShortPacket ( XCsiSs InstancePtr)

This function gets the short packets.

Parameters
InstancePtris a pointer to the Subsystem instance to be worked on.
Returns
None
Note
None

References XCsiSs::CsiPtr, and XCsiSs::SpktData.

Referenced by CsiSs_SPktEventHandler().

void XCsiSs_GetVCInfo ( XCsiSs InstancePtr)

This function gets the virtual channel information.

Parameters
InstancePtris a pointer to the Subsystem instance to be worked on.
Returns
None
Note
None

References XCsiSs::Config, XCsiSs::CsiPtr, and XCsiSs::VCInfo.

u32 XCsiSs_GetVCSelection ( XCsiSs InstancePtr)

This function will return the virtual channels selected.

Parameters
InstancePtris the XCsi instance to operate on
Returns
Value of selected VCs.

References XCsiSs::Config, XCsiSs::CsiPtr, and XCsiSs_Config::VcNo.

void XCsiSs_IntrDisable ( XCsiSs InstancePtr,
u32  IntrMask 
)

This function is used to disable the interrupts in the CSI core.

Parameters
InstancePtris a pointer to the Subsystem instance to be worked on.
IntrMaskIndicates Mask for enable interrupts.
Returns
None
Note
None

References XCsiSs::CsiPtr.

void XCsiSs_IntrHandler ( void *  InstancePtr)

This function is the interrupt handler for the MIPI CSI Rx Subsystem.

The application is responsible for connecting this function to the interrupt system. Application beyond this driver is also responsible for providing callbacks to handle interrupts and installing the callbacks using XCsiSs_SetCallBack() during initialization phase.

Parameters
InstancePtris a pointer to the XCsiSs core instance that just interrupted.
Returns
None.
Note
None.

References XCsiSs::CsiPtr.

Referenced by CsiSs_IntrExample(), CsiSs_SetupIntrSystem(), InitializeCsiRxSs(), and main().

XCsiSs_Config * XCsiSs_LookupConfig ( u32  DeviceId)

This function looks for the device configuration based on the unique device ID.

The table XCsiSs_ConfigTable[] contains the configuration information for each instance of the device in the system.

Parameters
DeviceIdis the unique device ID of the device being looked up
Returns
A pointer to the configuration table entry corresponding to the given device ID, or NULL if no match is found
Note
None.

Referenced by CsiSs_IntrExample(), CsiSs_SelfTestExample(), and InitializeCsiRxSs().

void XCsiSs_ReportCoreInfo ( XCsiSs InstancePtr)

This function reports list of cores included.

Parameters
InstancePtris a pointer to the Subsystem instance to be worked on.
Returns
None
Note
None

References XCsiSs::Config, XCsiSs::CsiPtr, and XCsiSs_Config::IsDphyRegIntfcPresent.

Referenced by CsiSs_IntrExample().

u32 XCsiSs_Reset ( XCsiSs InstancePtr)

This function is used to reset the CSI Subsystem.

Internally it resets the DPHY and CSI only as the IIC instance is separately handled by the application.

Parameters
InstancePtris a pointer to the Subsystem instance to be worked on.
Returns
  • XST_SUCCESS if all the sub core IP resets occur correctly
  • XST_FAILURE if reset fails for any sub core IP fails
Note
None

References XCsiSs::CsiPtr.

Referenced by CsiSs_IntrExample(), DisableCSI(), and EnableCSI().

u32 XCsiSs_SelfTest ( XCsiSs InstancePtr)

This function performs self test on MIPI CSI Rx Subsystem sub-cores.

Parameters
InstancePtris a pointer to the XCsiSs core instance.
Returns
  • XST_SUCCESS if self test passed.
  • XST_FAILURE if self test failed.
Note
None.

References XCsiSs::CsiPtr.

Referenced by CsiSs_SelfTestExample().

u32 XCsiSs_SetCallBack ( XCsiSs InstancePtr,
u32  HandlerType,
void *  CallbackFunc,
void *  CallbackRef 
)

This routine installs an asynchronous callback function for the given HandlerType:

HandlerType                Invoked by this driver when:
-------------------------  --------------------------------------------------
XCSISS_HANDLER_DPHY        A DPHY Level Error has been detected.
XCSISS_HANDLER_PROTLVL     A Protocol Level Error has been detected.
XCSISS_HANDLER_PKTLVL      A Packet Level Error has been detected.
XCSISS_HANDLER_SHORTPACKET A Short packet has been received or the
                           Short Packet FIFO is full.
XCSISS_HANDLER_FRAMERECVD  A Frame has been received
XCSISS_HANDLER_OTHERERROR  Any other type of interrupt has occured like
                           Stream Line Buffer Full, Incorrect Lanes, etc
Parameters
InstancePtris the XCsi instance to operate on
HandlerTypeis the type of call back to be registered.
CallbackFuncis the pointer to a call back funtion which is called when a particular event occurs.
CallbackRefis a void pointer to data to be referenced to by the CallBackFunc
Returns
  • XST_SUCCESS when handler is installed.
  • XST_INVALID_PARAM when HandlerType is invalid.
Note
Invoking this function for a handler that already has been installed replaces it with the new handler.

References XCsiSs::CsiPtr, and XCsiSs::IsReady.

Referenced by CsiSs_IntrExample(), and CsiSs_SetupIntrSystem().

void XCsiSs_SetVCSelection ( XCsiSs InstancePtr,
u16  Value 
)

This function will control the virtual channels selection dynamically.

Parameters
InstancePtris the XCsi instance to operate on
Valuewill set the virtual channels corresponding to each bit value.
Returns
None

References XCsiSs::Config, XCsiSs::CsiPtr, and XCsiSs_Config::VcNo.