Software Drivers

xycrcb2rgb.c File Reference


Detailed Description

This file contains the implementation of the interface functions for YCRCB2RGB core. Refer to the header file xycrcb2rgb.h for more detailed information.

 MODIFICATION HISTORY:

 Ver   Who    Date     Changes
 ----- ----   -------- ----------------------------------------------------
 5.00a tb     02/28/12 Updated for YCRCB2RGB v5.00.a.
 7.0   adk    01/31/14 Changed the file name from "ycrcb2rgb.c" to
                       "xycrcb2rgb.c".

                       Implemented following functions:
                       XYCrCb2Rgb_CfgInitialize, XYCrCb2Rgb_EnableDbgByPass,
                       XYCrCb2Rgb_IsDbgByPassEnabled,
                       XYCrCb2Rgb_DisableDbgBypass,
                       XYCrCb2Rgb_EnableDbgTestPattern,
                       XYCrCb2Rgb_IsDbgTestPatternEnabled,
                       XYCrCb2Rgb_DisableDbgTestPattern,
                       XYCrCb2Rgb_GetVersion, XYCrCb2Rgb_GetDbgFrameCount,
                       XYCrCb2Rgb_GetDbgLineCount,
                       XYCrCb2Rgb_GetDbgPixelCount, XYCrCb2Rgb_Setup,
                       XYCrCb2Rgb_SetActiveSize, XYCrCb2Rgb_GetActiveSize,
                       XYCrCb2Rgb_SetRGBMax, XYCrCb2Rgb_GetRGBMax,
                       XYCrCb2Rgb_SetRGBMin, XYCrCb2Rgb_GetRGBMin,
                       XYCrCb2Rgb_SetROffset, XYCrCb2Rgb_GetROffset,
                       XYCrCb2Rgb_SetGOffset, XYCrCb2Rgb_GetGOffset,
                       XYCrCb2Rgb_SetBOffset, XYCrCb2Rgb_GetBOffset,
                       XYCrCb2Rgb_SetCoefs, XYCrCb2Rgb_GetCoefs,
                       XYCrCb2Rgb_Select_Standard,
                       XYCrCb2Rgb_Coefficient_Translation,
                       XYCrCb2Rgb_Select_OutputRange.
 

#include "xycrcb2rgb.h"

Functions

int XYCrCb2Rgb_CfgInitialize (XYCrCb2Rgb *InstancePtr, XYCrCb2Rgb_Config *CfgPtr, u32 EffectiveAddr)
void XYCrCb2Rgb_EnableDbgByPass (XYCrCb2Rgb *InstancePtr)
int XYCrCb2Rgb_IsDbgByPassEnabled (XYCrCb2Rgb *InstancePtr)
void XYCrCb2Rgb_DisableDbgBypass (XYCrCb2Rgb *InstancePtr)
void XYCrCb2Rgb_EnableDbgTestPattern (XYCrCb2Rgb *InstancePtr)
int XYCrCb2Rgb_IsDbgTestPatternEnabled (XYCrCb2Rgb *InstancePtr)
void XYCrCb2Rgb_DisableDbgTestPattern (XYCrCb2Rgb *InstancePtr)
u32 XYCrCb2Rgb_GetVersion (XYCrCb2Rgb *InstancePtr)
u32 XYCrCb2Rgb_GetDbgFrameCount (XYCrCb2Rgb *InstancePtr)
u32 XYCrCb2Rgb_GetDbgLineCount (XYCrCb2Rgb *InstancePtr)
u32 XYCrCb2Rgb_GetDbgPixelCount (XYCrCb2Rgb *InstancePtr)
void XYCrCb2Rgb_Setup (XYCrCb2Rgb *InstancePtr)
void XYCrCb2Rgb_SetActiveSize (XYCrCb2Rgb *InstancePtr, u16 HSize, u16 VSize)
void XYCrCb2Rgb_GetActiveSize (XYCrCb2Rgb *InstancePtr, u16 *HSize, u16 *VSize)
void XYCrCb2Rgb_SetRGBMax (XYCrCb2Rgb *InstancePtr, u32 RGBMax)
u32 XYCrCb2Rgb_GetRGBMax (XYCrCb2Rgb *InstancePtr)
void XYCrCb2Rgb_SetRGBMin (XYCrCb2Rgb *InstancePtr, u32 RGBMin)
u32 XYCrCb2Rgb_GetRGBMin (XYCrCb2Rgb *InstancePtr)
void XYCrCb2Rgb_SetROffset (XYCrCb2Rgb *InstancePtr, u32 ROffset)
u32 XYCrCb2Rgb_GetROffset (XYCrCb2Rgb *InstancePtr)
void XYCrCb2Rgb_SetGOffset (XYCrCb2Rgb *InstancePtr, u32 GOffset)
u32 XYCrCb2Rgb_GetGOffset (XYCrCb2Rgb *InstancePtr)
void XYCrCb2Rgb_SetBOffset (XYCrCb2Rgb *InstancePtr, u32 BOffset)
u32 XYCrCb2Rgb_GetBOffset (XYCrCb2Rgb *InstancePtr)
void XYCrCb2Rgb_SetCoefs (XYCrCb2Rgb *InstancePtr, struct XYCrCb2Rgb_Coefficients *Coef)
void XYCrCb2Rgb_GetCoefs (XYCrCb2Rgb *InstancePtr, struct XYCrCb2Rgb_Coefficients *Coef)
void XYCrCb2Rgb_Select_Standard (XYCrCb2Rgb *InstancePtr, enum XYcc_Standards StandardSel, enum XYcc_OutputRanges InputRange, u32 DataWidth, struct XYCrCb2Rgb_Coef_Inputs *CoefIn)
u32 XYCrCb2Rgb_Coefficient_Translation (XYCrCb2Rgb *InstancePtr, struct XYCrCb2Rgb_Coef_Inputs *CoefIn, struct XYCrCb2Rgb_Coef_Outputs *CoefOut, u32 DataWidth, u32 MWidth)
void XYCrCb2Rgb_Select_OutputRange (XYCrCb2Rgb *InstancePtr, enum XYcc_OutputRanges Range)


Function Documentation

int XYCrCb2Rgb_CfgInitialize ( XYCrCb2Rgb InstancePtr,
XYCrCb2Rgb_Config CfgPtr,
u32  EffectiveAddr 
)

This function initializes the YCrCb2Rgb core. This function must be called prior to using the YCrCb2Rgb core. Initialization of the YCrCb2Rgb includes setting up the instance data and ensuring the hardware is in a quiescent state.

Parameters:
InstancePtr is a pointer to the XYCrCb2Rgb instance.
CfgPtr is a reference to a structure containing information about a specific XYCrCb2Rgb driver.
EffectiveAddr is the core base address in the virtual memory address space. The caller is responsible for keeping the address mapping from EffectiveAddr to the core physical base address unchanged once this function is invoked. Unexpected errors may occur if the address mapping changes after this function is called. If address translation is not used, pass in the physical address instead.
Returns:
- XST_SUCCESS if initialization was successful.
Note:
None.

u32 XYCrCb2Rgb_Coefficient_Translation ( XYCrCb2Rgb InstancePtr,
struct XYCrCb2Rgb_Coef_Inputs CoefIn,
struct XYCrCb2Rgb_Coef_Outputs CoefOut,
u32  DataWidth,
u32  MWidth 
)

This function translates the XYCrCb2Rgb_Coef_Inputs structure into the XYCrCb2Rgb_Coef_Outputs structure that can be used to program the core's registers. The XYCrCb2Rgb_Coef_Inputs structure uses the same values as the core's GUIs. The XYCrCb2Rgb_Coef_Outputs structure uses the values that can be programmed into the core's registers.

Parameters:
InstancePtr is a pointer to the XYCrCb2Rgbb instance.
CoefIn specifies a pointer to a XYCrCb2Rgb_Coef_Inputs structure to be translated.
CoefOut specifies a pointer to a XYCrCb2Rgb_Coef_Outputs structure with translated values.
DataWidth specifies a valid range of [8,10,12,16] that needs to be set.
MWidth specifies a valid range from min(32, DataWidth + 17)
Returns:
RetVal, returns value with following bit information:
  • bit(0) = 1 = data width outside range [8, 10, 12, 16]
  • bit(1) = Acoef + Bcoef > 1.0
  • bit(2) = Y Offset outside data width range: [-2^DataWidth, (2^DataWidth)-1].
  • bit(3) = Cb Offset outside data width range: [-2^DataWidth, (2^DataWidth)-1].
  • bit(4) = Cr Offset outside data width range: [-2^DataWidth, (2^DataWidth)-1].
  • bit(5) = RGB Max outside data width range: [0, (2^DataWidth)-1].
  • bit(6) = RGB Min outside data width range: [0, (2^DataWidth)-1].
Note:
Floating point coefficients are represented in 17-bit fixed point format where 17 bits indicates integer portion (Mantissa) of the number exclusive of sign bit.

void XYCrCb2Rgb_DisableDbgBypass ( XYCrCb2Rgb InstancePtr  ) 

This function disables Bypass mode of the core.

Parameters:
InstancePtr is a pointer to the XYCrCb2Rgb instance.
Returns:
None.
Note:
Debug functionality should be enabled.

void XYCrCb2Rgb_DisableDbgTestPattern ( XYCrCb2Rgb InstancePtr  ) 

This function disables debug test pattern mode.

Parameters:
InstancePtr is a pointer to the XYCrCb2Rgb instance.
Returns:
None.
Note:
Debug functionality should be enabled.

void XYCrCb2Rgb_EnableDbgByPass ( XYCrCb2Rgb InstancePtr  ) 

This function sets the bypass bit of control register to switch the core to bypass mode if debug is enabled in the IP.

Parameters:
InstancePtr is a pointer to the XYCrCb2Rgb instance.
Returns:
None.
Note:
Debug functionality should be enabled.

void XYCrCb2Rgb_EnableDbgTestPattern ( XYCrCb2Rgb InstancePtr  ) 

This function switches the core to test-pattern generator mode if debug feature is enabled.

Parameters:
InstancePtr is a pointer to the XYCrCb2Rgb instance.
Returns:
None.
Note:
Debug functionality should be enabled.

void XYCrCb2Rgb_GetActiveSize ( XYCrCb2Rgb InstancePtr,
u16 *  HSize,
u16 *  VSize 
)

This function gets the active H/V sizes of the YCrCb2Rgb core from active size register.

Parameters:
InstancePtr is a pointer to the XYCrCb2Rgb instance.
HSize is a pointer to 16-bit variable in which the number of Active Pixels per scanline is returned within the range [32, 8192].
VSize is a pointer to 16-bit variable in which the number of Active Lines per frame is returned within the range [32, 8192].
Returns:
None.
Note:
None.

u32 XYCrCb2Rgb_GetBOffset ( XYCrCb2Rgb InstancePtr  ) 

This function gets offset compensation value from the Blue channel.

Parameters:
InstancePtr is a pointer to the XYCrCb2Rgb instance.
Returns:
BOffset is a compensation value within the range [0, 255] from the Blue channel.
Note:
None.

void XYCrCb2Rgb_GetCoefs ( XYCrCb2Rgb InstancePtr,
struct XYCrCb2Rgb_Coefficients Coef 
)

This function returns A, B, C and D coefficients.

Parameters:
InstancePtr is a pointer to the XYCrCb2Rgbb instance.
Coef specifies a pointer to XYCrCb2Rgb_Coefficients structure in which ACoef, BCoef, CCoef, DCoef members value will be updated within the range [0.0, 1.0].
Returns:
None.
Note:
Floating point coefficients are represented in 17-bit fixed point format where 17 bits indicates integer portion (Mantissa) of the number exclusive of sign bit.

u32 XYCrCb2Rgb_GetDbgFrameCount ( XYCrCb2Rgb InstancePtr  ) 

This function returns the frame count, the number of frames processed since power-up. This is available only if the debugging feature is enabled.

Parameters:
InstancePtr is a pointer to the XYCrCb2Rgb instance.
Returns:
DbgFrameCount, number of frames processed since power-up.
Note:
Debug functionality should be enabled.

u32 XYCrCb2Rgb_GetDbgLineCount ( XYCrCb2Rgb InstancePtr  ) 

This function returns Line count, the number of lines processed since power-up. This is available only if the debugging feature is enabled.

Parameters:
InstancePtr is a pointer to the XYCrCb2Rgb instance.
Returns:
DbgLineCount, number of lines processed since power-up.
Note:
Debug functionality should be enabled.

u32 XYCrCb2Rgb_GetDbgPixelCount ( XYCrCb2Rgb InstancePtr  ) 

This function returns the pixel count, the number of pixels processed since power up. This is available only if the debugging feature is enabled.

Parameters:
InstancePtr is a pointer to the XYCrCb2Rgb instance.
Returns:
DbgPixelCount, number of pixels processed since power-up.
Note:
Debug functionality should be enabled.

u32 XYCrCb2Rgb_GetGOffset ( XYCrCb2Rgb InstancePtr  ) 

This function gets offset compensation value from the Green channel.

Parameters:
InstancePtr is a pointer to the XYCrCb2Rgb instance.
Returns:
GOffset is a compensation value within the range [0, 255] from the Green channel.
Note:
None.

u32 XYCrCb2Rgb_GetRGBMax ( XYCrCb2Rgb InstancePtr  ) 

This function gets the maximum value on RGB channels of the output.

Parameters:
InstancePtr is a pointer to the XYCrCb2Rgb instance.
Returns:
RGBMax is the maximum value within the range [0, 255] from RGB channels of the output.
Note:
Clipping functionality should be enabled.

u32 XYCrCb2Rgb_GetRGBMin ( XYCrCb2Rgb InstancePtr  ) 

This function gets the minimum value on RGB channels of the output.

Parameters:
InstancePtr is a pointer to the XYCrCb2Rgb instance.
Returns:
RGBMin is the minimum value within the range [0, 255] from RGB channels of the output.
Note:
Clamping functionality should be enabled.

u32 XYCrCb2Rgb_GetROffset ( XYCrCb2Rgb InstancePtr  ) 

This function gets offset compensation value from the Red channel.

Parameters:
InstancePtr is a pointer to the XYCrCb2Rgb instance.
Returns:
ROffset is a compensation value within the range [0, 255] from the Red channel.
Note:
None.

u32 XYCrCb2Rgb_GetVersion ( XYCrCb2Rgb InstancePtr  ) 

This function facilitates software identification of exact version of the YCrCb2rGB hardware (h/w).

Parameters:
InstancePtr is a pointer to the XYCrCb2Rgb instance.
Returns:
Version, contents of a Version register.
Note:
None.

int XYCrCb2Rgb_IsDbgByPassEnabled ( XYCrCb2Rgb InstancePtr  ) 

This function returns the current bypass mode of the core.

Parameters:
InstancePtr is a pointer to the XYCrCb2Rgb instance.
Returns:
  • TRUE if Bypass mode is enabled.
  • FALSE if Bypass mode is not enabled.
Note:
Debug functionality should be enabled.

int XYCrCb2Rgb_IsDbgTestPatternEnabled ( XYCrCb2Rgb InstancePtr  ) 

This function returns the test-pattern generator mode (enabled or not), if debug feature is enabled.

Parameters:
InstancePtr is a pointer to the XYCrCb2Rgb instance.
Returns:
  • TRUE if Test-pattern mode is enabled.
  • FALSE if Test-pattern mode is not enabled.
Note:
Debug functionality should be enabled.

void XYCrCb2Rgb_Select_OutputRange ( XYCrCb2Rgb InstancePtr,
enum XYcc_OutputRanges  Range 
)

This function governs the range of outputs R, G and B by affecting the conversion coefficients as well as the clipping and clamping values.

Parameters:
InstancePtr is a pointer to the XYCrCb2Rgb instance.
Range needs to be set from the enum XYcc_OutputRanges values as: 0 = XYCC_TV_16_TO_240, 1 = XYCC_STUDIO_16_TO_235, 2 = XYCC_GRAPHICS_0_TO_255.
Returns:
None.
Note:
None.

void XYCrCb2Rgb_Select_Standard ( XYCrCb2Rgb InstancePtr,
enum XYcc_Standards  StandardSel,
enum XYcc_OutputRanges  InputRange,
u32  DataWidth,
struct XYCrCb2Rgb_Coef_Inputs CoefIn 
)

This function populates an XYCrCb2Rgb_Coef_Inputs structure with the values from the selected video standard.

Parameters:
InstancePtr is a pointer to the XYCrCb2Rgbb instance.
StandardSel needs to be set from enum XYcc_Standards value as : 0 = XYCC_STANDARD_ITU_601_SD 1 = XYCC_STANDARD_ITU_709_NTSC 2 = XYCC_STANDARD_ITU_709_PAL 3 = XYCC_STANDARD_YUV.
InputRange needs to be set from enum XYcc_OutputRanges value as: 0 = XYCC_TV_16_TO_240, 1 = XYCC_STUDIO_16_TO_235, 2 = XYCC_GRAPHICS_0_TO_255.
DataWidth specifies the valid range of [8,10,12,16] that needs to be set.
CoefIn specifies a pointer to a XYCrCb2Rgb_Coef_Inputs structure which is populated with the values from selected video standard.
Returns:
None.
Note:
Floating point coefficients are represented in 17-bit fixed point format where 17 bits indicates integer portion (Mantissa) of the number exclusive of sign bit.

void XYCrCb2Rgb_SetActiveSize ( XYCrCb2Rgb InstancePtr,
u16  HSize,
u16  VSize 
)

This function sets active H/V sizes in the active frame size register.

Parameters:
InstancePtr is a pointer to the XYCrCb2Rgb instance.
HSize specifies the number of Active Pixels per scanline that needs to be set within the range [32, 8192].
VSize specifies the number of Active Lines per frame that needs to be set within the range [32, 8192].
Returns:
None.
Note:
None.

void XYCrCb2Rgb_SetBOffset ( XYCrCb2Rgb InstancePtr,
u32  BOffset 
)

This function sets offset compensation value on the Blue channel.

Parameters:
InstancePtr is a pointer to the XYCrCb2Rgb instance.
BOffset is a compensation value within the range [0, 255] to be set on the Blue channel.
Returns:
None.
Note:
None.

void XYCrCb2Rgb_SetCoefs ( XYCrCb2Rgb InstancePtr,
struct XYCrCb2Rgb_Coefficients Coef 
)

This function sets A, B, C and D coefficients.

Parameters:
InstancePtr is a pointer to the XYCrCb2Rgb instance.
Coef specifies a pointer to XYCrCb2Rgb_Coefficients structure in which ACoef, BCoef, CCoef, DCoef members value within the range [0.0, 1.0] that needs to be set.
Returns:
None.
Note:
Floating point coefficients are represented in 17-bit fixed point format where 17 bits indicates integer portion (Mantissa) of the number exclusive of sign bit.

void XYCrCb2Rgb_SetGOffset ( XYCrCb2Rgb InstancePtr,
u32  GOffset 
)

This function sets offset compensation value on the Green channel.

Parameters:
InstancePtr is a pointer to the XYCrCb2Rgb instance.
GOffset is a compensation value within the range [0, 255] to be set on the Green channel.
Returns:
None.
Note:
None.

void XYCrCb2Rgb_SetRGBMax ( XYCrCb2Rgb InstancePtr,
u32  RGBMax 
)

This function sets the RGB maximum value on YCrCb2Rgb channels of the output.

Parameters:
InstancePtr is a pointer to the XYCrCb2Rgb instance.
RGBMax is the maximum value within the range [0, 255] on the RGB channels of the output.
Returns:
None.
Note:
Clipping functionality should be enabled.

void XYCrCb2Rgb_SetRGBMin ( XYCrCb2Rgb InstancePtr,
u32  RGBMin 
)

This function sets minimum value on RGB channels of the output.

Parameters:
InstancePtr is a pointer to the XYCrCb2Rgb instance.
RGBMin is the minimum value within the range [0, 255] on RGB channels of the output.
Returns:
None.
Note:
Clamping functionality should be enabled.

void XYCrCb2Rgb_SetROffset ( XYCrCb2Rgb InstancePtr,
u32  ROffset 
)

This function sets offset compensation value on the Red channel.

Parameters:
InstancePtr is a pointer to the XYCrCb2Rgb instance.
ROffset is compensation value within the range [0, 255] to be set on the Red channel.
Returns:
None.
Note:
None.

void XYCrCb2Rgb_Setup ( XYCrCb2Rgb InstancePtr  ) 

This function sets up double buffered active size register and enables the register update.

Parameters:
InstancePtr is a pointer to the XYCrCb2Rgb instance.
Returns:
None.
Note:
None.

Copyright @ 1995-2014 Xilinx, Inc. All rights reserved.