csi2txss: Csi2txss_v1_1

| csi2txss Xilinx SDK Drivers API Documentation

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

Data Structures | Macros | Typedefs | Enumerations | Functions
Csi2txss_v1_1

## Data Structures
struct | SubCoreCsi2Tx
| Sub-Core Configuration Table. More...
struct | XCsi2TxSs_Config
| MIPI CSI Tx Subsystem configuration structure. More...
struct | XCsi2TxSs
| The XCsi2TxSs driver instance data. More...

## Macros
#define | XCSI2TXSS_H_
| Prevent circular inclusions by using protection macros. More...
#define | XCSI2TXSS_HW_H_
| Prevent circular inclusions by using protection macros. More...

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

## Enumerations
enum | XCsi2TxSS_LCStatus { XCSI2TXSS_LC_LESS_LINES = XCSI2TX_LC_LESS_LINES, XCSI2TXSS_LC_MORE_LINES = XCSI2TX_LC_MORE_LINES }
| This typedef defines the different errors codes for Line Count status for a Virtual Channel when Frame End Generation is enabled. More...

## Functions
u32 | XCsi2TxSs_CfgInitialize (XCsi2TxSs *InstancePtr, XCsi2TxSs_Config *CfgPtr, UINTPTR EffectiveAddr)
| This function initializes the MIPI CSI subsystem and included sub-cores. More...
u32 | XCsi2TxSs_Configure (XCsi2TxSs *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 | XCsi2TxSs_Activate (XCsi2TxSs *InstancePtr, u8 Flag)
| This function is used to activate the CSI Subsystem. More...
u32 | XCsi2TxSs_Reset (XCsi2TxSs *InstancePtr)
| This function is used to reset the CSI Subsystem. More...
void | XCsi2TxSs_ReportCoreInfo (XCsi2TxSs *InstancePtr)
| This function reports list of cores included. More...
void | XCsi2TxSs_GetShortPacket (XCsi2TxSs *InstancePtr)
| This function gets the short packets. More...
void | XCsi2TxSs_LineGen (XCsi2TxSs *InstancePtr, u32 Value)
| This function is to set the Line Synchronization packet Generation status. More...
void | XCsi2TxSs_SetGSPEntry (XCsi2TxSs *InstancePtr, u32 Value)
| This function is to set Generic Short Packet Entries. More...
u32 | XCsi2TxSs_GetPixelMode (XCsi2TxSs *InstancePtr)
| This function is used to get the Pixel Mode. More...
u32 | XCsi2TxSs_GetMaxLaneCount (XCsi2TxSs *InstancePtr)
| This function is used to get the number of lanes configured in the IP. More...
u32 | XCsi2TxSs_IsUlps (XCsi2TxSs *InstancePtr)
| This function is used to check if lanes are in ulps mode. More...
void | XCsi2TxSs_SetUlps (XCsi2TxSs *InstancePtr, u32 Value)
| This function is used to set lanes in ulps mode. More...
void | XCsi2TxSs_SetClkMode (XCsi2TxSs *InstancePtr, u8 Mode)
| This function is used to set the CSI2 Tx Subsystem Clock Mode as either Continuous (0) or Non-Continuous (1) mode. More...
u32 | XCsi2TxSs_GetClkMode (XCsi2TxSs *InstancePtr)
| This function is used to get the CSI2 Tx Subsystem Clock Mode as either Continuous (0) or Non-Continuous (1) mode. More...
u32 | XCsi2TxSs_SetLineCountForVC (XCsi2TxSs *InstancePtr, u8 VC, u16 LineCount)
| This function sets the Line Count for virtual Channel if Frame End Generation feature is enabled. More...
u32 | XCsi2TxSs_GetLineCountForVC (XCsi2TxSs *InstancePtr, u8 VC, u16 *LineCount)
| This function gets the Line Count for virtual Channel if Frame End Generation feature is enabled. More...
XCsi2TxSs_Config * | XCsi2TxSs_LookupConfig (u32 DeviceId)
| This function looks for the device configuration based on the unique device ID. More...
u32 | XCsi2TxSs_SelfTest (XCsi2TxSs *InstancePtr)
| This function performs self test on MIPI CSI Tx Subsystem sub-cores. More...
void | XCsi2TxSs_IntrHandler (void *InstancePtr)
| This function is the interrupt handler for the MIPI CSI2 Tx Subsystem. More...
void | XCsi2TxSs_IntrDisable (XCsi2TxSs *InstancePtr, u32 IntrMask)
| This function is used to disable the interrupts in the CSI core. More...
u32 | XCsi2TxSs_SetCallBack (XCsi2TxSs *InstancePtr, u32 HandlerType, void *CallbackFunc, void *CallbackRef)
| This routine installs an asynchronous callback function for the given HandlerType: More...

## Clock Modes for CSI2 Tx
These macros are used to set/get the clock mode in CSI2 Tx. CCM - continuous clock mode. NCCM - non-continuous clock mode.
#define | XCSI2TXSS_CCM 0
#define | XCSI2TXSS_NCCM 1

## Interrupt Types for setting Callbacks
These handlers are used to determine the type of the interrupt handler being registered with the MIPI CSI2 Tx Subsystem. Since the subsystem is tightly coupled with the CSI2 Tx Controller driver, the handlers from the sub core are promoted to the subsystem level so that the application can use them.
#define | XCSI2TXSS_HANDLER_WRG_LANE XCSI2TX_HANDLER_WRG_LANE
#define | XCSI2TXSS_HANDLER_GSPFIFO_FULL XCSI2TX_HANDLER_GSPFIFO_FULL
#define | XCSI2TXSS_HANDLER_ULPS XCSI2TX_HANDLER_ULPS
#define | XCSI2TXSS_HANDLER_LINEBUF_FULL XCSI2TX_HANDLER_LINEBUF_FULL
#define | XCSI2TXSS_HANDLER_WRG_DATATYPE XCSI2TX_HANDLER_WRG_DATATYPE
#define | XCSI2TXSS_HANDLER_UNDERRUN_PIXEL XCSI2TX_HANDLER_UNDERRUN_PIXEL
#define | XCSI2TXSS_HANDLER_LCERRVC0 XCSI2TX_HANDLER_LCERRVC0
#define | XCSI2TXSS_HANDLER_LCERRVC1 XCSI2TX_HANDLER_LCERRVC1
#define | XCSI2TXSS_HANDLER_LCERRVC2 XCSI2TX_HANDLER_LCERRVC2
#define | XCSI2TXSS_HANDLER_LCERRVC3 XCSI2TX_HANDLER_LCERRVC3

## Macro Definition Documentation

#define XCSI2TXSS_H_

Prevent circular inclusions by using protection macros.

#define XCSI2TXSS_HW_H_

Prevent circular inclusions by using protection macros.

## Typedef Documentation

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

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

Parameters

  CallbackRef | is 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.
  Mask | is a bit mask indicating the cause of the event. For current core version, this parameter is "OR" of 0 or more XCSI2TXSS_ISR_*_MASK constants defined in xcsi2txss_hw.h.

Returns
  None.

Note
  None.

## Enumeration Type Documentation

enum XCsi2TxSS_LCStatus

This typedef defines the different errors codes for Line Count status for a Virtual Channel when Frame End Generation is enabled.

Enumerator
XCSI2TXSS_LC_LESS_LINES | Less no of lines recvd.
XCSI2TXSS_LC_MORE_LINES | More no of lines recvd.

## Function Documentation

u32 XCsi2TxSs_Activate | ( | XCsi2TxSs * | InstancePtr,
|  | u8 | Flag
| ) |  |

This function is used to activate the CSI Subsystem.

Internally it activates the DPHY and CSI.

Parameters

  InstancePtr | is a pointer to the Subsystem instance to be worked on.
  Flag | is used to denote whether to enable or disable the subsystem

Returns
  - XST_SUCCESS on successful operation
  - XST_FAILURE on failed operation

Note
  None

References XCsi2TxSs::Config, and XCsi2TxSs_Config::IsDphyRegIntfcPresent.

Referenced by Csi2TxSs_IntrExample().

u32 XCsi2TxSs_CfgInitialize | ( | XCsi2TxSs * | InstancePtr,
|  | XCsi2TxSs_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

  InstancePtr | is a pointer to the Subsystem instance to be worked on.
  CfgPtr | points to the configuration structure associated with the subsystem instance.
  EffectiveAddr | is 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 XCsi2TxSs_Config::BaseAddr, XCsi2TxSs::Config, XCsi2TxSs_Config::IsDphyRegIntfcPresent, and XCsi2TxSs::IsReady.

Referenced by Csi2TxSs_IntrExample(), and Csi2TxSs_SelfTestExample().

u32 XCsi2TxSs_Configure | ( | XCsi2TxSs * | 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 XCsi2Tx.h for interrupt masks.

Parameters

  InstancePtr | is a pointer to the Subsystem instance to be worked on.
  ActiveLanes | is no of active lanes to be configure. This value ranges between 1 and 4.
  IntrMask | Indicates 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 XCsi2TxSs::Config, and XCsi2TxSs_Config::FEGenEnabled.

Referenced by Csi2TxSs_IntrExample().

u32 XCsi2TxSs_GetClkMode | ( | XCsi2TxSs * | InstancePtr | ) |

This function is used to get the CSI2 Tx Subsystem Clock Mode as either Continuous (0) or Non-Continuous (1) mode.

Parameters

  InstancePtr | is a pointer to the Subsystem instance to be worked on.

Returns
  0 - Continuous Clock Mode 1 - Non-continuous Clock Mode

Note
  None

u32 XCsi2TxSs_GetLineCountForVC | ( | XCsi2TxSs * | InstancePtr,
|  | u8 | VC,
|  | u16 * | LineCount
| ) |  |

This function gets the Line Count for virtual Channel if Frame End Generation feature is enabled.

Parameters

  InstancePtr | is a pointer to the Subsystem instance to be worked on.
  VC | is which Virtual channel to be configured for (0-3).
  LineCount | is pointer to variable to be filled with line count for the Virtual channel

Returns
  - XST_NO_FEATURE if Frame End generation is not enabled
  - XST_INVALID_PARAM if any param is invalid e.g. VC is always 0 to 3 and Line Count is 0 to 0xFFFF.
  - XST_SUCCESS otherwise

Note
  None.

References XCsi2TxSs::Config, and XCsi2TxSs_Config::FEGenEnabled.

u32 XCsi2TxSs_GetMaxLaneCount | ( | XCsi2TxSs * | InstancePtr | ) |

This function is used to get the number of lanes configured in the IP.

Parameters

  InstancePtr | is a pointer to the CSI2TX SS Instance to be worked on.

Returns
  Max number of lanes available in u32 format

Note
  None

u32 XCsi2TxSs_GetPixelMode | ( | XCsi2TxSs * | InstancePtr | ) |

This function is used to get the Pixel Mode.

Parameters

  InstancePtr | is a pointer to the CSI2TX SS Instance to be worked on.

Returns
  0x0 - Single Pixel Mode 0x1 - Dual Pixel Mode 0x3 - Quad Pixel Mode

Note
  None

void XCsi2TxSs_GetShortPacket | ( | XCsi2TxSs * | InstancePtr | ) |

This function gets the short packets.

Parameters

  InstancePtr | is a pointer to the Subsystem instance to be worked on.

Returns
  None

Note
  None

References XCsi2TxSs::SpktData.

void XCsi2TxSs_IntrDisable | ( | XCsi2TxSs * | InstancePtr,
|  | u32 | IntrMask
| ) |  |

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

Parameters

  InstancePtr | is a pointer to the Subsystem instance to be worked on.
  IntrMask | Indicates Mask for enable interrupts.

Returns
  None

Note
  None

References XCsi2TxSs::Config, and XCsi2TxSs_Config::FEGenEnabled.

void XCsi2TxSs_IntrHandler | ( | void * | InstancePtr | ) |

This function is the interrupt handler for the MIPI CSI2 Tx 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 XCsi2TxSs_SetCallBack() during initialization phase.

Parameters

  InstancePtr | is a pointer to the XCsi2TxSs core instance that just interrupted.

Returns
  None.

Note
  None.

Referenced by Csi2TxSs_SetupIntrSystem().

u32 XCsi2TxSs_IsUlps | ( | XCsi2TxSs * | InstancePtr | ) |

This function is used to check if lanes are in ulps mode.

Parameters

  InstancePtr | is a pointer to the CSI2TX SS Instance to be worked on.

Returns
  - 1 - ulps mode enter
  - 0 - ulps mode exit

Note
  None

void XCsi2TxSs_LineGen | ( | XCsi2TxSs * | InstancePtr,
|  | u32 | Value
| ) |  |

This function is to set the Line Synchronization packet Generation status.

Parameters

  InstancePtr | is a pointer to the CSI2 TX SS Instance to be worked on.
  Value | 0 : DISABLE 1 : ENABLE

Returns
  None

Note
  None

XCsi2TxSs_Config * XCsi2TxSs_LookupConfig | ( | u32 | DeviceId | ) |

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

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

Parameters

  DeviceId | is 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 Csi2TxSs_IntrExample(), and Csi2TxSs_SelfTestExample().

void XCsi2TxSs_ReportCoreInfo | ( | XCsi2TxSs * | InstancePtr | ) |

This function reports list of cores included.

Parameters

  InstancePtr | is a pointer to the Subsystem instance to be worked on.

Returns
  None

Note
  None

References XCsi2TxSs::Config, and XCsi2TxSs_Config::IsDphyRegIntfcPresent.

Referenced by Csi2TxSs_IntrExample().

u32 XCsi2TxSs_Reset | ( | XCsi2TxSs * | InstancePtr | ) |

This function is used to reset the CSI Subsystem.

Internally it resets the DPHY and CSI

Parameters

  InstancePtr | is 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

Referenced by Csi2TxSs_IntrExample().

u32 XCsi2TxSs_SelfTest | ( | XCsi2TxSs * | InstancePtr | ) |

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

Parameters

  InstancePtr | is a pointer to the XCsi2TxSs core instance.

Returns
  - XST_SUCCESS if self test passed.
  - XST_FAILURE if self test failed.

Note
  None.

Referenced by Csi2TxSs_SelfTestExample().

u32 XCsi2TxSs_SetCallBack | ( | XCsi2TxSs * | InstancePtr,
|  | u32 | HandlerType,
|  | void * | CallbackFunc,
|  | void * | CallbackRef
| ) |  |

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

    HandlerType                                     Invoked by this driver when:
    -------------------------                       -------------------------------
    (XCSI2TXSS_HANDLER_WRG_LANE)            IncorrectLaneCallBack
    (XCSI2TXSS_HANDLER_GSPFIFO_FULL)                GSPFIFOCallBack
    (XCSI2TXSS_HANDLER_ULPS)                        DPhyUlpsCallBack
    (XCSI2TXSS_HANDLER_LINEBUF_FULL)                LineBufferCallBack
    (XCSI2TXSS_HANDLER_WRG_DATATYPE)                WrgDataTypeCallBack
    (XCSI2TXSS_HANDLER_UNDERRUN_PIXEL)              UnderrunPixelCallBack
    (XCSI2TXSS_HANDLER_LCERRVC0                     LineCountErrVC0
    (XCSI2TXSS_HANDLER_LCERRVC1                     LineCountErrVC1
    (XCSI2TXSS_HANDLER_LCERRVC2                     LineCountErrVC2
    (XCSI2TXSS_HANDLER_LCERRVC3                     LineCountErrVC3

Parameters

  InstancePtr | is the XCsi instance to operate on
  HandlerType | is the type of call back to be registered.
  CallbackFunc | is the pointer to a call back funtion which is called when a particular event occurs.
  CallbackRef | is 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 XCsi2TxSs::IsReady.

Referenced by Csi2TxSs_SetupIntrSystem().

void XCsi2TxSs_SetClkMode | ( | XCsi2TxSs * | InstancePtr,
|  | u8 | Mode
| ) |  |

This function is used to set the CSI2 Tx Subsystem Clock Mode as either Continuous (0) or Non-Continuous (1) mode.

Parameters

  InstancePtr | is a pointer to the Subsystem instance to be worked on.
  Mode | for Continuous Mode (0) or Non-continuous Mode (1)

Returns
  None

Note
  None

void XCsi2TxSs_SetGSPEntry | ( | XCsi2TxSs * | InstancePtr,
|  | u32 | Value
| ) |  |

This function is to set Generic Short Packet Entries.

Parameters

  InstancePtr | is a pointer to the CSI2 TX SS Instance to be worked on.
  Value | GSP 32 bit Entry

Returns
  None

Note
  None

u32 XCsi2TxSs_SetLineCountForVC | ( | XCsi2TxSs * | InstancePtr,
|  | u8 | VC,
|  | u16 | LineCount
| ) |  |

This function sets the Line Count for virtual Channel if Frame End Generation feature is enabled.

This is to be called before starting the core.

Parameters

  InstancePtr | is a pointer to the Subsystem instance to be worked on.
  VC | is which Virtual channel to be configured for (0-3).
  LineCount | is valid line count for the Virtual channel.

Returns
  - XST_NO_FEATURE if Frame End generation is not enabled
  - XST_INVALID_PARAM if any param is invalid e.g. VC is always 0 to 3 and Line Count is 0 to 0xFFFF.
  - XST_FAILURE in case the core is already running.
  - XST_SUCCESS otherwise

Note
  None.

References XCsi2TxSs::Config, and XCsi2TxSs_Config::FEGenEnabled.

void XCsi2TxSs_SetUlps | ( | XCsi2TxSs * | InstancePtr,
|  | u32 | Value
| ) |  |

This function is used to set lanes in ulps mode.

Parameters

  InstancePtr | is a pointer to the CSI2TX SS Instance to be worked on.
  Value | 1 - ulps mode enter 0 - ulps mode exit

Returns
  None

Note
  None